Vulture/VApp/node_modules/vuetify/lib/services/goto/index.mjs.map

1 line
5.8 KiB
Plaintext
Raw Normal View History

{"version":3,"file":"index.mjs","names":["easingPatterns","getContainer","getOffset","goTo","_target","_settings","arguments","length","undefined","settings","container","document","scrollingElement","body","documentElement","duration","offset","easing","appOffset","framework","application","isDrawer","classList","contains","isClipped","bar","top","startTime","performance","now","targetLocation","startLocation","scrollTop","Promise","resolve","ease","TypeError","requestAnimationFrame","step","currentTime","timeElapsed","progress","Math","abs","min","floor","clientHeight","reachBottom","scrollHeight"],"sources":["../../../src/services/goto/index.ts"],"sourcesContent":["// @ts-nocheck\n/* eslint-disable */\n\n// Extensions\n// import { Service } from '../service'\n\n// Utilities\nimport * as easingPatterns from './easing-patterns'\nimport {\n getContainer,\n getOffset,\n} from './util'\n\n// Types\nimport { GoToOptions, VuetifyGoToTarget } from 'vuetify/types/services/goto'\n\nimport { VuetifyServiceContract } from 'vuetify/types/services'\n\nfunction goTo (\n _target: VuetifyGoToTarget,\n _settings: GoToOptions = {}\n): Promise<number> {\n const settings: GoToOptions = {\n container: (document.scrollingElement as HTMLElement | null) || document.body || document.documentElement,\n duration: 500,\n offset: 0,\n easing: 'easeInOutCubic',\n appOffset: true,\n ..._settings,\n }\n const container = getContainer(settings.container)\n\n /* istanbul ignore else */\n if (settings.appOffset && goTo.framework.application) {\n const isDrawer = container.classList.contains('v-navigation-drawer')\n const isClipped = container.classList.contains('v-navigation-drawer--clipped')\n const { bar, top } = goTo.framework.application as any\n\n settings.offset += bar\n /* istanbul ignore else */\n if (!isDrawer || isClipped) settings.offset += top\n }\n\n const startTime = performance.now()\n\n let targetLocation: number\n if (typeof _target === 'number') {\n targetLocation = getOffset(_target) - settings.offset!\n } else {\n targetLocation = getOffset(_target) - getOffset(container) - settings.offset!\n }\n\n const startLocation = container.scrollTop\n if (targetLocation === startLocation) return Promise.resolve(targetLocation)\n\n const ease = typeof settings.easing === 'function'\n ? settings.easing\n : easingPatterns[settings.easing!]\n /* istanbul ignore else */\n if (!ease) throw new TypeError(`Easing function \"${settings.easing}\" not found.`)\n\n // Cannot be tested properly in jsdom\n /* istanbul ignore next */\n return new Promise(resolve => requestAnimationFrame(function step (currentTime: number) {\n const timeElapsed = currentTime - startTime\n const progress = Math.abs(settings.duration ? Math.min(timeElapsed / settings.duration, 1) : 1)\n\n container.scrollTop = Math.floor(startLocation + (targetLocation - startLocation) * ease(progress))\n\n const clientHeight = container === document.body ? document.documentElement.clientHeight : container.clientHeight\n const reachBottom = clientHeight + container.scrollTop >= container.scrollHeight\n if (\n progress === 1 ||\n // Need to go lower but reach bottom\n (targetLocation > container.scrollTop && reachBottom)\n ) {\n return resolve(targetLocation)\n }\n\n requestAnimationFrame(step)\n }))\n}\n\n// goTo.framework = {} as Record<string, VuetifyServiceContract>\n\n// export class Goto extends Service {\n// public static property: 'goTo' = 'goTo'\n\n// constructor () {\n// super()\n\n// return goTo\n// }\n// }\n"],"mappings":"AAAA;AACA;AAEA;AACA;AAEA;AAAA,OACO,KAAKA,cAAc;AAAA,SAExBC,YAAY,EACZC,SAAS,sBAGX;AAKA,SAASC,IAAIA,CACXC,OAA0B,EAET;EAAA,IADjBC,SAAsB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAE3B,MAAMG,QAAqB,GAAG;IAC5BC,SAAS,EAAGC,QAAQ,CAACC,gBAAgB,IAA2BD,QAAQ,CAACE,IAAI,IAAIF,QAAQ,CAACG,eAAe;IACzGC,QAAQ,EAAE,GAAG;IACbC,MAAM,EAAE,CAAC;IACTC,MAAM,EAAE,gBAAgB;IACxBC,SAAS,EAAE,IAAI;IACf,GAAGb;EACL,CAAC;EACD,MAAMK,SAAS,GAAGT,Y