1 line
30 KiB
Plaintext
1 line
30 KiB
Plaintext
|
{"version":3,"file":"locationStrategies.mjs","names":["useToggleScope","computed","nextTick","onScopeDispose","ref","watch","anchorToPoint","getOffset","clamp","consoleError","convertToUnit","destructComputed","flipAlign","flipCorner","flipSide","getAxis","getScrollParents","IN_BROWSER","isFixedPosition","nullifyTransforms","parseAnchor","propsFactory","Box","getOverflow","getTargetBox","locationStrategies","static","staticLocationStrategy","connected","connectedLocationStrategy","makeLocationStrategyProps","locationStrategy","type","String","Function","default","validator","val","location","origin","offset","Number","Array","useLocationStrategies","props","data","contentStyles","updateLocation","isActive","value","reset","window","removeEventListener","onResize","undefined","addEventListener","passive","e","getIntrinsicSize","el","isRtl","style","removeProperty","contentBox","x","parseFloat","right","left","y","top","activatorFixed","isArray","target","Object","assign","position","preferredAnchor","preferredOrigin","parsedAnchor","parsedOrigin","side","align","minWidth","minHeight","maxWidth","maxHeight","map","key","isNaN","Infinity","split","length","push","observe","observer","ResizeObserver","contentEl","_ref","_ref2","newTarget","newContentEl","oldTarget","oldContentEl","unobserve","immediate","disconnect","requestAnimationFrame","targetBox","scrollParents","viewportMargin","document","documentElement","getPropertyValue","viewport","reduce","box","rect","getBoundingClientRect","scrollBox","width","clientWidth","height","clientHeight","Math","max","min","bottom","placement","anchor","checkOverflow","_placement","targetPoint","contentPoint","overflows","available","flipped","resets","_x","_y","axis","hasOverflowX","before","after","hasOverflowY","forEach","newPlacement","flip","newOverflows","transformOrigin","pixelRound","pixelCeil","result","round","devicePixelRatio","ceil"],"sources":["../../../src/components/VOverlay/locationStrategies.ts"],"sourcesContent":["// Composables\nimport { useToggleScope } from '@/composables/toggleScope'\n\n// Utilities\nimport { computed, nextTick, onScopeDispose, ref, watch } from 'vue'\nimport { anchorToPoint, getOffset } from './util/point'\nimport {\n clamp,\n consoleError,\n convertToUnit,\n destructComputed,\n flipAlign,\n flipCorner,\n flipSide,\n getAxis,\n getScrollParents,\n IN_BROWSER,\n isFixedPosition,\n nullifyTransforms,\n parseAnchor,\n propsFactory,\n} from '@/util'\nimport { Box, getOverflow, getTargetBox } from '@/util/box'\n\n// Types\nimport type { PropType, Ref } from 'vue'\nimport type { Anchor } from '@/util'\n\nexport interface LocationStrategyData {\n contentEl: Ref<HTMLElement | undefined>\n target: Ref<HTMLElement | [x: number, y: number] | undefined>\n isActive: Ref<boolean>\n isRtl: Ref<boolean>\n}\n\ntype LocationStrategyFn = (\n data: LocationStrategyData,\n props: StrategyProps,\n contentStyles: Ref<Record<string, string>>\n) => undefined | { updateLocation: (e: Event) => void }\n\nconst locationStrategies = {\n static: staticLocationStrategy, // specific viewport position, usually centered\n connected: connectedLocationStrategy, // connected to a certain element\n}\n\nexport interface StrategyProps {\n locationStrategy: keyof typeof locationStrategies | LocationStrategyFn\n location: Anchor\n origin: Anchor | 'auto' | 'overlap'\n offset?: number | string | number[]\n maxHeight?: number | string\n maxWidth?: number | string\n minHeight?: number | string\n minWidth?: number | string\n}\n\nexport const makeLocationStrategyProps = propsFactory({\n locationStrategy: {\n type: [String, Function] as PropType<StrategyProps['locationStrategy']>,\n default: 'static',\n validator: (val: any) => typeof val === 'function' || val in locationStrategies,\n },\n location: {\n type: String as PropType<StrategyProps['location']>,\n default: 'bottom',\n },\n origin: {\n type: String as PropType<StrategyProps['origin']>,\n default: 'auto',\n },\n offset: [Number, String, Array] as PropType<StrategyProps['offset'
|