@fluentui/react-positioning 9.5.5 → 9.5.6
Sign up to get free protection for your applications and to get access to all the features.
- package/.swcrc +30 -0
- package/CHANGELOG.json +40 -1
- package/CHANGELOG.md +15 -2
- package/lib/constants.js.map +1 -1
- package/lib/createArrowStyles.js.map +1 -1
- package/lib/createPositionManager.js.map +1 -1
- package/lib/createVirtualElementFromClick.js +1 -2
- package/lib/createVirtualElementFromClick.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/middleware/coverTarget.js.map +1 -1
- package/lib/middleware/flip.js.map +1 -1
- package/lib/middleware/index.js.map +1 -1
- package/lib/middleware/intersecting.js.map +1 -1
- package/lib/middleware/maxSize.js.map +1 -1
- package/lib/middleware/offset.js.map +1 -1
- package/lib/middleware/shift.js.map +1 -1
- package/lib/types.js +1 -1
- package/lib/types.js.map +1 -1
- package/lib/usePositioning.js +23 -21
- package/lib/usePositioning.js.map +1 -1
- package/lib/usePositioningMouseTarget.js.map +1 -1
- package/lib/utils/debounce.js +1 -2
- package/lib/utils/debounce.js.map +1 -1
- package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib/utils/getFloatingUIOffset.js.map +1 -1
- package/lib/utils/getReactFiberFromNode.js +1 -0
- package/lib/utils/getReactFiberFromNode.js.map +1 -1
- package/lib/utils/getScrollParent.js +5 -6
- package/lib/utils/getScrollParent.js.map +1 -1
- package/lib/utils/hasAutoFocusFilter.js +2 -2
- package/lib/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/mergeArrowOffset.js +3 -4
- package/lib/utils/mergeArrowOffset.js.map +1 -1
- package/lib/utils/parseFloatingUIPlacement.js +1 -2
- package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib/utils/toFloatingUIPadding.js.map +1 -1
- package/lib/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib/utils/toggleScrollListener.js.map +1 -1
- package/lib/utils/useCallbackRef.js.map +1 -1
- package/lib/utils/writeArrowUpdates.js +1 -2
- package/lib/utils/writeArrowUpdates.js.map +1 -1
- package/lib/utils/writeContainerupdates.js +4 -4
- package/lib/utils/writeContainerupdates.js.map +1 -1
- package/lib-commonjs/constants.js +18 -7
- package/lib-commonjs/constants.js.map +1 -1
- package/lib-commonjs/createArrowStyles.js +60 -88
- package/lib-commonjs/createArrowStyles.js.map +1 -1
- package/lib-commonjs/createPositionManager.js +103 -117
- package/lib-commonjs/createPositionManager.js.map +1 -1
- package/lib-commonjs/createVirtualElementFromClick.js +27 -26
- package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
- package/lib-commonjs/index.js +24 -51
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/middleware/coverTarget.js +34 -37
- package/lib-commonjs/middleware/coverTarget.js.map +1 -1
- package/lib-commonjs/middleware/flip.js +31 -38
- package/lib-commonjs/middleware/flip.js.map +1 -1
- package/lib-commonjs/middleware/index.js +10 -9
- package/lib-commonjs/middleware/index.js.map +1 -1
- package/lib-commonjs/middleware/intersecting.js +24 -22
- package/lib-commonjs/middleware/intersecting.js.map +1 -1
- package/lib-commonjs/middleware/maxSize.js +34 -40
- package/lib-commonjs/middleware/maxSize.js.map +1 -1
- package/lib-commonjs/middleware/offset.js +11 -12
- package/lib-commonjs/middleware/offset.js.map +1 -1
- package/lib-commonjs/middleware/shift.js +29 -37
- package/lib-commonjs/middleware/shift.js.map +1 -1
- package/lib-commonjs/types.js +5 -2
- package/lib-commonjs/types.js.map +1 -1
- package/lib-commonjs/usePositioning.js +200 -164
- package/lib-commonjs/usePositioning.js.map +1 -1
- package/lib-commonjs/usePositioningMouseTarget.js +34 -37
- package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
- package/lib-commonjs/utils/debounce.js +22 -21
- package/lib-commonjs/utils/debounce.js.map +1 -1
- package/lib-commonjs/utils/fromFloatingUIPlacement.js +30 -35
- package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js +21 -22
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/utils/getFloatingUIOffset.js +23 -35
- package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
- package/lib-commonjs/utils/getReactFiberFromNode.js +45 -41
- package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
- package/lib-commonjs/utils/getScrollParent.js +52 -56
- package/lib-commonjs/utils/getScrollParent.js.map +1 -1
- package/lib-commonjs/utils/hasAutoFocusFilter.js +18 -17
- package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
- package/lib-commonjs/utils/index.js +19 -18
- package/lib-commonjs/utils/index.js.map +1 -1
- package/lib-commonjs/utils/mergeArrowOffset.js +33 -32
- package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
- package/lib-commonjs/utils/parseFloatingUIPlacement.js +15 -14
- package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/resolvePositioningShorthand.js +63 -61
- package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPadding.js +23 -25
- package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
- package/lib-commonjs/utils/toFloatingUIPlacement.js +31 -33
- package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
- package/lib-commonjs/utils/toggleScrollListener.js +20 -24
- package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
- package/lib-commonjs/utils/useCallbackRef.js +39 -53
- package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
- package/lib-commonjs/utils/writeArrowUpdates.js +19 -24
- package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
- package/lib-commonjs/utils/writeContainerupdates.js +37 -45
- package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
- package/package.json +7 -6
- package/lib-amd/constants.js +0 -10
- package/lib-amd/constants.js.map +0 -1
- package/lib-amd/createArrowStyles.js +0 -62
- package/lib-amd/createArrowStyles.js.map +0 -1
- package/lib-amd/createPositionManager.js +0 -97
- package/lib-amd/createPositionManager.js.map +0 -1
- package/lib-amd/createVirtualElementFromClick.js +0 -32
- package/lib-amd/createVirtualElementFromClick.js.map +0 -1
- package/lib-amd/index.js +0 -13
- package/lib-amd/index.js.map +0 -1
- package/lib-amd/middleware/coverTarget.js +0 -32
- package/lib-amd/middleware/coverTarget.js.map +0 -1
- package/lib-amd/middleware/flip.js +0 -19
- package/lib-amd/middleware/flip.js.map +0 -1
- package/lib-amd/middleware/index.js +0 -11
- package/lib-amd/middleware/index.js.map +0 -1
- package/lib-amd/middleware/intersecting.js +0 -33
- package/lib-amd/middleware/intersecting.js.map +0 -1
- package/lib-amd/middleware/maxSize.js +0 -33
- package/lib-amd/middleware/maxSize.js.map +0 -1
- package/lib-amd/middleware/offset.js +0 -14
- package/lib-amd/middleware/offset.js.map +0 -1
- package/lib-amd/middleware/shift.js +0 -17
- package/lib-amd/middleware/shift.js.map +0 -1
- package/lib-amd/types.js +0 -5
- package/lib-amd/types.js.map +0 -1
- package/lib-amd/usePositioning.js +0 -161
- package/lib-amd/usePositioning.js.map +0 -1
- package/lib-amd/usePositioningMouseTarget.js +0 -39
- package/lib-amd/usePositioningMouseTarget.js.map +0 -1
- package/lib-amd/utils/debounce.js +0 -27
- package/lib-amd/utils/debounce.js.map +0 -1
- package/lib-amd/utils/fromFloatingUIPlacement.js +0 -37
- package/lib-amd/utils/fromFloatingUIPlacement.js.map +0 -1
- package/lib-amd/utils/getBoundary.js +0 -26
- package/lib-amd/utils/getBoundary.js.map +0 -1
- package/lib-amd/utils/getFloatingUIOffset.js +0 -25
- package/lib-amd/utils/getFloatingUIOffset.js.map +0 -1
- package/lib-amd/utils/getReactFiberFromNode.js +0 -48
- package/lib-amd/utils/getReactFiberFromNode.js.map +0 -1
- package/lib-amd/utils/getScrollParent.js +0 -64
- package/lib-amd/utils/getScrollParent.js.map +0 -1
- package/lib-amd/utils/hasAutoFocusFilter.js +0 -31
- package/lib-amd/utils/hasAutoFocusFilter.js.map +0 -1
- package/lib-amd/utils/index.js +0 -20
- package/lib-amd/utils/index.js.map +0 -1
- package/lib-amd/utils/mergeArrowOffset.js +0 -38
- package/lib-amd/utils/mergeArrowOffset.js.map +0 -1
- package/lib-amd/utils/parseFloatingUIPlacement.js +0 -20
- package/lib-amd/utils/parseFloatingUIPlacement.js.map +0 -1
- package/lib-amd/utils/resolvePositioningShorthand.js +0 -31
- package/lib-amd/utils/resolvePositioningShorthand.js.map +0 -1
- package/lib-amd/utils/toFloatingUIPadding.js +0 -25
- package/lib-amd/utils/toFloatingUIPadding.js.map +0 -1
- package/lib-amd/utils/toFloatingUIPlacement.js +0 -40
- package/lib-amd/utils/toFloatingUIPlacement.js.map +0 -1
- package/lib-amd/utils/toggleScrollListener.js +0 -26
- package/lib-amd/utils/toggleScrollListener.js.map +0 -1
- package/lib-amd/utils/useCallbackRef.js +0 -55
- package/lib-amd/utils/useCallbackRef.js.map +0 -1
- package/lib-amd/utils/writeArrowUpdates.js +0 -21
- package/lib-amd/utils/writeArrowUpdates.js.map +0 -1
- package/lib-amd/utils/writeContainerupdates.js +0 -41
- package/lib-amd/utils/writeContainerupdates.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["debounce","fn","pending","Promise","resolve","then","undefined"],"sources":["
|
1
|
+
{"version":3,"names":["debounce","fn","pending","Promise","resolve","then","undefined"],"sources":["../../src/utils/debounce.ts"],"sourcesContent":["/**\n * Promise microtask debouncer used by Popper.js v2\n * This is no longer exported in Floating UI (Popper.js v3)\n * https://github.com/floating-ui/floating-ui/blob/v2.x/src/utils/debounce.js\n * @param fn function that will be debounced\n */\nexport function debounce<T>(fn: Function): () => Promise<T> {\n let pending: Promise<T> | undefined;\n return () => {\n if (!pending) {\n pending = new Promise<T>(resolve => {\n Promise.resolve().then(() => {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}\n"],"mappings":"AAAA;;;;;GAMA,OAAO,SAASA,SAAYC,EAAY,EAAoB;EAC1D,IAAIC,OAAA;EACJ,OAAO,MAAM;IACX,IAAI,CAACA,OAAA,EAAS;MACZA,OAAA,GAAU,IAAIC,OAAA,CAAWC,OAAA,IAAW;QAClCD,OAAA,CAAQC,OAAO,GAAGC,IAAI,CAAC,MAAM;UAC3BH,OAAA,GAAUI,SAAA;UACVF,OAAA,CAAQH,EAAA;QACV;MACF;IACF;IAEA,OAAOC,OAAA;EACT;AACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["parseFloatingUIPlacement","getPositionMap","top","bottom","right","left","getAlignmentMap","position","start","end","fromFloatingUIPlacement","placement","side","alignment","floatingUIAlignment"],"sources":["
|
1
|
+
{"version":3,"names":["parseFloatingUIPlacement","getPositionMap","top","bottom","right","left","getAlignmentMap","position","start","end","fromFloatingUIPlacement","placement","side","alignment","floatingUIAlignment"],"sources":["../../src/utils/fromFloatingUIPlacement.ts"],"sourcesContent":["import type { Side, Alignment as FloatingUIAlignment, Placement } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\nimport { parseFloatingUIPlacement } from './parseFloatingUIPlacement';\n\nconst getPositionMap = (): Record<Side, Position> => ({\n top: 'above',\n bottom: 'below',\n right: 'after',\n left: 'before',\n});\n\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (position: Position): Record<FloatingUIAlignment, Alignment> => {\n if (position === 'above' || position === 'below') {\n return {\n start: 'start',\n end: 'end',\n };\n }\n\n return {\n start: 'top',\n end: 'bottom',\n };\n};\n\n/**\n * Maps Floating UI placement to positioning values\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const fromFloatingUIPlacement = (placement: Placement): { position: Position; alignment?: Alignment } => {\n const { side, alignment: floatingUIAlignment } = parseFloatingUIPlacement(placement);\n const position = getPositionMap()[side];\n const alignment = floatingUIAlignment && getAlignmentMap(position)[floatingUIAlignment];\n\n return { position, alignment };\n};\n"],"mappings":"AAEA,SAASA,wBAAwB,QAAQ;AAEzC,MAAMC,cAAA,GAAiBA,CAAA,MAA+B;EACpDC,GAAA,EAAK;EACLC,MAAA,EAAQ;EACRC,KAAA,EAAO;EACPC,IAAA,EAAM;AACR;AAEA;AACA;AACA,MAAMC,eAAA,GAAmBC,QAAA,IAA+D;EACtF,IAAIA,QAAA,KAAa,WAAWA,QAAA,KAAa,SAAS;IAChD,OAAO;MACLC,KAAA,EAAO;MACPC,GAAA,EAAK;IACP;EACF;EAEA,OAAO;IACLD,KAAA,EAAO;IACPC,GAAA,EAAK;EACP;AACF;AAEA;;;;AAIA,OAAO,MAAMC,uBAAA,GAA2BC,SAAA,IAAwE;EAC9G,MAAM;IAAEC,IAAA;IAAMC,SAAA,EAAWC;EAAmB,CAAE,GAAGd,wBAAA,CAAyBW,SAAA;EAC1E,MAAMJ,QAAA,GAAWN,cAAA,EAAgB,CAACW,IAAA,CAAK;EACvC,MAAMC,SAAA,GAAYC,mBAAA,IAAuBR,eAAA,CAAgBC,QAAA,CAAS,CAACO,mBAAA,CAAoB;EAEvF,OAAO;IAAEP,QAAA;IAAUM;EAAU;AAC/B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getScrollParent","getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","nodeName"],"sources":["
|
1
|
+
{"version":3,"names":["getScrollParent","getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","nodeName"],"sources":["../../src/utils/getBoundary.ts"],"sourcesContent":["import type { Boundary as FloatingUIBoundary } from '@floating-ui/dom';\n\nimport { getScrollParent } from './getScrollParent';\nimport type { Boundary } from '../types';\n\n/**\n * Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.\n */\nexport function getBoundary(element: HTMLElement | null, boundary?: Boundary): FloatingUIBoundary | undefined {\n if (boundary === 'window') {\n return element?.ownerDocument!.documentElement;\n }\n\n if (boundary === 'clippingParents') {\n return 'clippingAncestors';\n }\n\n if (boundary === 'scrollParent') {\n let boundariesNode: HTMLElement | undefined = getScrollParent(element);\n\n if (boundariesNode.nodeName === 'BODY') {\n boundariesNode = element?.ownerDocument!.documentElement;\n }\n\n return boundariesNode;\n }\n\n return boundary;\n}\n"],"mappings":"AAEA,SAASA,eAAe,QAAQ;AAGhC;;;AAGA,OAAO,SAASC,YAAYC,OAA2B,EAAEC,QAAmB,EAAkC;EAC5G,IAAIA,QAAA,KAAa,UAAU;IACzB,OAAOD,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASE,aAAa,CAAEC,eAAe;EAChD;EAEA,IAAIF,QAAA,KAAa,mBAAmB;IAClC,OAAO;EACT;EAEA,IAAIA,QAAA,KAAa,gBAAgB;IAC/B,IAAIG,cAAA,GAA0CN,eAAA,CAAgBE,OAAA;IAE9D,IAAII,cAAA,CAAeC,QAAQ,KAAK,QAAQ;MACtCD,cAAA,GAAiBJ,OAAA,aAAAA,OAAA,uBAAAA,OAAA,CAASE,aAAa,CAAEC,eAAe;IAC1D;IAEA,OAAOC,cAAA;EACT;EAEA,OAAOH,QAAA;AACT"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["fromFloatingUIPlacement","getFloatingUIOffset","rawOffset","rects","floating","reference","placement","position","alignment","positionedRect","targetRect"],"sources":["
|
1
|
+
{"version":3,"names":["fromFloatingUIPlacement","getFloatingUIOffset","rawOffset","rects","floating","reference","placement","position","alignment","positionedRect","targetRect"],"sources":["../../src/utils/getFloatingUIOffset.ts"],"sourcesContent":["import type { Offset } from '../types';\nimport type { MiddlewareArguments } from '@floating-ui/dom';\nimport { fromFloatingUIPlacement } from './fromFloatingUIPlacement';\n/**\n * Type taken from Floating UI since they are not exported\n */\nexport type FloatingUIOffsetValue =\n | number\n | {\n /**\n * The axis that runs along the side of the floating element.\n * @default 0\n */\n mainAxis?: number;\n /**\n * The axis that runs along the alignment of the floating element.\n * @default 0\n */\n crossAxis?: number;\n /**\n * When set to a number, overrides the `crossAxis` value for aligned\n * (non-centered/base) placements and works logically. A positive number\n * will move the floating element in the direction of the opposite edge\n * to the one that is aligned, while a negative number the reverse.\n * @default null\n */\n alignmentAxis?: number | null;\n };\n\n/**\n * Type taken from Floating UI since they are not exported\n */\nexport type FloatingUIOffsetFunction = (args: MiddlewareArguments) => FloatingUIOffsetValue;\n\n/**\n * Shim to transform offset values from this library to Floating UI\n * @param rawOffset Offset from this library\n * @returns An offset value compatible with Floating UI\n */\nexport function getFloatingUIOffset(\n rawOffset: Offset | undefined,\n): FloatingUIOffsetValue | FloatingUIOffsetFunction | undefined {\n if (!rawOffset) {\n return rawOffset;\n }\n\n if (typeof rawOffset === 'number' || typeof rawOffset === 'object') {\n return rawOffset;\n }\n\n return ({ rects: { floating, reference }, placement }) => {\n const { position, alignment } = fromFloatingUIPlacement(placement);\n return rawOffset({ positionedRect: floating, targetRect: reference, position, alignment });\n };\n}\n"],"mappings":"AAEA,SAASA,uBAAuB,QAAQ;AAgCxC;;;;;AAKA,OAAO,SAASC,oBACdC,SAA6B,EACiC;EAC9D,IAAI,CAACA,SAAA,EAAW;IACd,OAAOA,SAAA;EACT;EAEA,IAAI,OAAOA,SAAA,KAAc,YAAY,OAAOA,SAAA,KAAc,UAAU;IAClE,OAAOA,SAAA;EACT;EAEA,OAAO,CAAC;IAAEC,KAAA,EAAO;MAAEC,QAAA;MAAUC;IAAS,CAAE;IAAEC;EAAS,CAAE,KAAK;IACxD,MAAM;MAAEC,QAAA;MAAUC;IAAS,CAAE,GAAGR,uBAAA,CAAwBM,SAAA;IACxD,OAAOJ,SAAA,CAAU;MAAEO,cAAA,EAAgBL,QAAA;MAAUM,UAAA,EAAYL,SAAA;MAAWE,QAAA;MAAUC;IAAU;EAC1F;AACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["WorkTag","getReactFiberFromNode","elm","k","indexOf","Error"],"sources":["../src/packages/react-components/react-positioning/src/utils/getReactFiberFromNode.ts"],"sourcesContent":["import * as React from 'react';\n\n// ========================================================\n// react/packages/shared/ReactTypes.js\n// ========================================================\n\ntype ReactEventResponder<E, C> = {\n $$typeof: Symbol | number;\n displayName: string;\n targetEventTypes: null | string[];\n rootEventTypes: null | string[];\n getInitialState: null | ((props: Object) => Object);\n onEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onRootEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onMount: null | ((context: C, props: Object, state: Object) => void);\n onUnmount: null | ((context: C, props: Object, state: Object) => void);\n};\n\ntype ReactEventResponderInstance<E, C> = {\n fiber: Object;\n props: Object;\n responder: ReactEventResponder<E, C>;\n rootEventTypes: null | Set<string>;\n state: Object;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiberHooks.js\n// ========================================================\n\nexport type HookType =\n | 'useState'\n | 'useReducer'\n | 'useContext'\n | 'useRef'\n | 'useEffect'\n | 'useLayoutEffect'\n | 'useCallback'\n | 'useMemo'\n | 'useImperativeHandle'\n | 'useDebugValue'\n | 'useResponder';\n\ntype ReactProviderType<T> = {\n $$typeof: Symbol | number;\n _context: ReactContext<T>;\n};\n\ntype ReactContext<T> = {\n $$typeof: Symbol | number;\n Consumer: ReactContext<T>;\n Provider: ReactProviderType<T>;\n\n _calculateChangedBits: ((a: T, b: T) => number) | null;\n\n _currentValue: T;\n _currentValue2: T;\n _threadCount: number;\n\n // DEV only\n _currentRenderer?: Object | null;\n _currentRenderer2?: Object | null;\n};\n\ntype ContextDependency<T> = {\n context: ReactContext<T>;\n observedBits: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n next: ContextDependency<any> | null;\n};\n\nenum WorkTag {\n FunctionComponent = 0,\n ClassComponent = 1,\n IndeterminateComponent = 2, // Before we know whether it is function or class\n HostRoot = 3, // Root of a host tree. Could be nested inside another node.\n HostPortal = 4, // A subtree. Could be an entry point to a different renderer.\n HostComponent = 5,\n HostText = 6,\n Fragment = 7,\n Mode = 8,\n ContextConsumer = 9,\n ContextProvider = 10,\n ForwardRef = 11,\n Profiler = 12,\n SuspenseComponent = 13,\n MemoComponent = 14,\n SimpleMemoComponent = 15,\n LazyComponent = 16,\n IncompleteClassComponent = 17,\n DehydratedFragment = 18,\n SuspenseListComponent = 19,\n FundamentalComponent = 20,\n ScopeComponent = 21,\n}\n\ntype Source = {\n fileName: string;\n lineNumber: number;\n};\n\ntype ExpirationTime = number;\n\ntype Dependencies = {\n expirationTime: ExpirationTime;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n firstContext: ContextDependency<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n responders: Map<ReactEventResponder<any, any>, ReactEventResponderInstance<any, any>> | null;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiber.js\n// ========================================================\n\n// A Fiber is work on a Component that needs to be done or was done. There can\n// be more than one per component.\n\nexport type Fiber = {\n // These first fields are conceptually members of an Instance. This used to\n // be split into a separate type and intersected with the other Fiber fields,\n // but until Flow fixes its intersection bugs, we've merged them into a\n // single type.\n\n // An Instance is shared between all versions of a component. We can easily\n // break this out into a separate object to avoid copying so much to the\n // alternate versions of the tree. We put this on a single object for now to\n // minimize the number of objects created during the initial render.\n\n // Tag identifying the type of fiber.\n tag: WorkTag;\n\n // Unique identifier of this child.\n key: null | string;\n\n // The value of element.type which is used to preserve the identity during\n // reconciliation of this child.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementType: any;\n\n // The resolved function/class/ associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type: any;\n\n // The local state associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stateNode: any;\n\n // Conceptual aliases\n // parent : Instance -> return The parent happens to be the same as the\n // return fiber since we've merged the fiber and instance.\n\n // Remaining fields belong to Fiber\n\n // The Fiber to return to after finishing processing this one.\n // This is effectively the parent, but there can be multiple parents (two)\n // so this is only the parent of the thing we're currently processing.\n // It is conceptually the same as the return address of a stack frame.\n return: Fiber | null;\n\n // Singly Linked List Tree Structure.\n child: Fiber | null;\n sibling: Fiber | null;\n index: number;\n\n // The ref last used to attach this node.\n // I'll avoid adding an owner field for prod and model that as functions.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: React.Ref<any>;\n\n // Input is the data coming into process this fiber. Arguments. Props.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pendingProps: any; // This type will be more specific once we overload the tag.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedProps: any; // The props used to create the output.\n\n // A queue of state updates and callbacks.\n // updateQueue: UpdateQueue<any> | null,\n\n // The state used to create the output\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedState: any;\n\n // Dependencies (contexts, events) for this fiber, if it has any\n dependencies: Dependencies | null;\n\n // // Bitfield that describes properties about the fiber and its subtree. E.g.\n // // the ConcurrentMode flag indicates whether the subtree should be async-by-\n // // default. When a fiber is created, it inherits the mode of its\n // // parent. Additional flags can be set at creation time, but after that the\n // // value should remain unchanged throughout the fiber's lifetime, particularly\n // // before its child fibers are created.\n // mode: TypeOfMode\n //\n // // Effect\n // effectTag: SideEffectTag\n\n // Singly linked list fast path to the next fiber with side-effects.\n nextEffect: Fiber | null;\n\n // The first and last fiber with side-effect within this subtree. This allows\n // us to reuse a slice of the linked list when we reuse the work done within\n // this fiber.\n firstEffect: Fiber | null;\n lastEffect: Fiber | null;\n\n // Represents a time in the future by which this work should be completed.\n // Does not include work found in its subtree.\n expirationTime: ExpirationTime;\n\n // This is used to quickly determine if a subtree has no pending changes.\n childExpirationTime: ExpirationTime;\n\n // This is a pooled version of a Fiber. Every fiber that gets updated will\n // eventually have a pair. There are cases when we can clean up pairs to save\n // memory if we need to.\n alternate: Fiber | null;\n\n // Time spent rendering this Fiber and its descendants for the current update.\n // This tells us how well the tree makes use of sCU for memoization.\n // It is reset to 0 each time we render and only updated when we don't bailout.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualDuration?: number;\n\n // If the Fiber is currently active in the \"render\" phase,\n // This marks the time at which the work began.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualStartTime?: number;\n\n // Duration of the most recent render time for this Fiber.\n // This value is not updated when we bailout for memoization purposes.\n // This field is only set when the enableProfilerTimer flag is enabled.\n selfBaseDuration?: number;\n\n // Sum of base times for all descendants of this Fiber.\n // This value bubbles up during the \"complete\" phase.\n // This field is only set when the enableProfilerTimer flag is enabled.\n treeBaseDuration?: number;\n\n // Conceptual aliases\n // workInProgress : Fiber -> alternate The alternate used for reuse happens\n // to be the same as work in progress.\n // __DEV__ only\n _debugID?: number;\n _debugSource?: Source | null;\n _debugOwner?: Fiber | null;\n _debugIsCurrentlyTiming?: boolean;\n _debugNeedsRemount?: boolean;\n\n // Used to verify that the order of hooks does not change between renders.\n _debugHookTypes?: HookType[] | null;\n};\n\nexport function getReactFiberFromNode(elm: Node | undefined): Fiber | null {\n if (!elm) {\n return null;\n }\n\n for (const k in elm) {\n // React 16 uses \"__reactInternalInstance$\" prefix\n // React 17 uses \"__reactFiber$\" prefix\n // https://github.com/facebook/react/pull/18377\n if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return elm[k];\n }\n }\n\n throw new Error('getReactFiber(): Failed to find a React Fiber on a node');\n}\n"],"mappings":"AAuEA,IAAKA,OAuBJ;AAvBD,WAAKA,OAAO;EACVA,OAAA,CAAAA,OAAA,gDAAqB;EACrBA,OAAA,CAAAA,OAAA,0CAAkB;EAClBA,OAAA,CAAAA,OAAA,0DAA0B;EAC1BA,OAAA,CAAAA,OAAA,8BAAY;EACZA,OAAA,CAAAA,OAAA,kCAAc;EACdA,OAAA,CAAAA,OAAA,wCAAiB;EACjBA,OAAA,CAAAA,OAAA,8BAAY;EACZA,OAAA,CAAAA,OAAA,8BAAY;EACZA,OAAA,CAAAA,OAAA,sBAAQ;EACRA,OAAA,CAAAA,OAAA,4CAAmB;EACnBA,OAAA,CAAAA,OAAA,6CAAoB;EACpBA,OAAA,CAAAA,OAAA,mCAAe;EACfA,OAAA,CAAAA,OAAA,+BAAa;EACbA,OAAA,CAAAA,OAAA,iDAAsB;EACtBA,OAAA,CAAAA,OAAA,yCAAkB;EAClBA,OAAA,CAAAA,OAAA,qDAAwB;EACxBA,OAAA,CAAAA,OAAA,yCAAkB;EAClBA,OAAA,CAAAA,OAAA,+DAA6B;EAC7BA,OAAA,CAAAA,OAAA,mDAAuB;EACvBA,OAAA,CAAAA,OAAA,yDAA0B;EAC1BA,OAAA,CAAAA,OAAA,uDAAyB;EACzBA,OAAA,CAAAA,OAAA,2CAAmB;AACrB,CAAC,EAvBIA,OAAO,KAAPA,OAAO;AAsLZ,OAAM,SAAUC,qBAAqBA,CAACC,GAAqB;EACzD,IAAI,CAACA,GAAG,EAAE;IACR,OAAO,IAAI;;EAGb,KAAK,MAAMC,CAAC,IAAID,GAAG,EAAE;IACnB;IACA;IACA;IACA,IAAIC,CAAC,CAACC,OAAO,CAAC,0BAA0B,CAAC,KAAK,CAAC,IAAID,CAAC,CAACC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;MACnF;MACA;MACA,OAAOF,GAAG,CAACC,CAAC,CAAC;;;EAIjB,MAAM,IAAIE,KAAK,CAAC,yDAAyD,CAAC;AAC5E"}
|
1
|
+
{"version":3,"names":["React","WorkTag","getReactFiberFromNode","elm","k","indexOf","Error"],"sources":["../../src/utils/getReactFiberFromNode.ts"],"sourcesContent":["import * as React from 'react';\n\n// ========================================================\n// react/packages/shared/ReactTypes.js\n// ========================================================\n\ntype ReactEventResponder<E, C> = {\n $$typeof: Symbol | number;\n displayName: string;\n targetEventTypes: null | string[];\n rootEventTypes: null | string[];\n getInitialState: null | ((props: Object) => Object);\n onEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onRootEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n onMount: null | ((context: C, props: Object, state: Object) => void);\n onUnmount: null | ((context: C, props: Object, state: Object) => void);\n};\n\ntype ReactEventResponderInstance<E, C> = {\n fiber: Object;\n props: Object;\n responder: ReactEventResponder<E, C>;\n rootEventTypes: null | Set<string>;\n state: Object;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiberHooks.js\n// ========================================================\n\nexport type HookType =\n | 'useState'\n | 'useReducer'\n | 'useContext'\n | 'useRef'\n | 'useEffect'\n | 'useLayoutEffect'\n | 'useCallback'\n | 'useMemo'\n | 'useImperativeHandle'\n | 'useDebugValue'\n | 'useResponder';\n\ntype ReactProviderType<T> = {\n $$typeof: Symbol | number;\n _context: ReactContext<T>;\n};\n\ntype ReactContext<T> = {\n $$typeof: Symbol | number;\n Consumer: ReactContext<T>;\n Provider: ReactProviderType<T>;\n\n _calculateChangedBits: ((a: T, b: T) => number) | null;\n\n _currentValue: T;\n _currentValue2: T;\n _threadCount: number;\n\n // DEV only\n _currentRenderer?: Object | null;\n _currentRenderer2?: Object | null;\n};\n\ntype ContextDependency<T> = {\n context: ReactContext<T>;\n observedBits: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n next: ContextDependency<any> | null;\n};\n\nenum WorkTag {\n FunctionComponent = 0,\n ClassComponent = 1,\n IndeterminateComponent = 2, // Before we know whether it is function or class\n HostRoot = 3, // Root of a host tree. Could be nested inside another node.\n HostPortal = 4, // A subtree. Could be an entry point to a different renderer.\n HostComponent = 5,\n HostText = 6,\n Fragment = 7,\n Mode = 8,\n ContextConsumer = 9,\n ContextProvider = 10,\n ForwardRef = 11,\n Profiler = 12,\n SuspenseComponent = 13,\n MemoComponent = 14,\n SimpleMemoComponent = 15,\n LazyComponent = 16,\n IncompleteClassComponent = 17,\n DehydratedFragment = 18,\n SuspenseListComponent = 19,\n FundamentalComponent = 20,\n ScopeComponent = 21,\n}\n\ntype Source = {\n fileName: string;\n lineNumber: number;\n};\n\ntype ExpirationTime = number;\n\ntype Dependencies = {\n expirationTime: ExpirationTime;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n firstContext: ContextDependency<any> | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n responders: Map<ReactEventResponder<any, any>, ReactEventResponderInstance<any, any>> | null;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiber.js\n// ========================================================\n\n// A Fiber is work on a Component that needs to be done or was done. There can\n// be more than one per component.\n\nexport type Fiber = {\n // These first fields are conceptually members of an Instance. This used to\n // be split into a separate type and intersected with the other Fiber fields,\n // but until Flow fixes its intersection bugs, we've merged them into a\n // single type.\n\n // An Instance is shared between all versions of a component. We can easily\n // break this out into a separate object to avoid copying so much to the\n // alternate versions of the tree. We put this on a single object for now to\n // minimize the number of objects created during the initial render.\n\n // Tag identifying the type of fiber.\n tag: WorkTag;\n\n // Unique identifier of this child.\n key: null | string;\n\n // The value of element.type which is used to preserve the identity during\n // reconciliation of this child.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n elementType: any;\n\n // The resolved function/class/ associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type: any;\n\n // The local state associated with this fiber.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stateNode: any;\n\n // Conceptual aliases\n // parent : Instance -> return The parent happens to be the same as the\n // return fiber since we've merged the fiber and instance.\n\n // Remaining fields belong to Fiber\n\n // The Fiber to return to after finishing processing this one.\n // This is effectively the parent, but there can be multiple parents (two)\n // so this is only the parent of the thing we're currently processing.\n // It is conceptually the same as the return address of a stack frame.\n return: Fiber | null;\n\n // Singly Linked List Tree Structure.\n child: Fiber | null;\n sibling: Fiber | null;\n index: number;\n\n // The ref last used to attach this node.\n // I'll avoid adding an owner field for prod and model that as functions.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref: React.Ref<any>;\n\n // Input is the data coming into process this fiber. Arguments. Props.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pendingProps: any; // This type will be more specific once we overload the tag.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedProps: any; // The props used to create the output.\n\n // A queue of state updates and callbacks.\n // updateQueue: UpdateQueue<any> | null,\n\n // The state used to create the output\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n memoizedState: any;\n\n // Dependencies (contexts, events) for this fiber, if it has any\n dependencies: Dependencies | null;\n\n // // Bitfield that describes properties about the fiber and its subtree. E.g.\n // // the ConcurrentMode flag indicates whether the subtree should be async-by-\n // // default. When a fiber is created, it inherits the mode of its\n // // parent. Additional flags can be set at creation time, but after that the\n // // value should remain unchanged throughout the fiber's lifetime, particularly\n // // before its child fibers are created.\n // mode: TypeOfMode\n //\n // // Effect\n // effectTag: SideEffectTag\n\n // Singly linked list fast path to the next fiber with side-effects.\n nextEffect: Fiber | null;\n\n // The first and last fiber with side-effect within this subtree. This allows\n // us to reuse a slice of the linked list when we reuse the work done within\n // this fiber.\n firstEffect: Fiber | null;\n lastEffect: Fiber | null;\n\n // Represents a time in the future by which this work should be completed.\n // Does not include work found in its subtree.\n expirationTime: ExpirationTime;\n\n // This is used to quickly determine if a subtree has no pending changes.\n childExpirationTime: ExpirationTime;\n\n // This is a pooled version of a Fiber. Every fiber that gets updated will\n // eventually have a pair. There are cases when we can clean up pairs to save\n // memory if we need to.\n alternate: Fiber | null;\n\n // Time spent rendering this Fiber and its descendants for the current update.\n // This tells us how well the tree makes use of sCU for memoization.\n // It is reset to 0 each time we render and only updated when we don't bailout.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualDuration?: number;\n\n // If the Fiber is currently active in the \"render\" phase,\n // This marks the time at which the work began.\n // This field is only set when the enableProfilerTimer flag is enabled.\n actualStartTime?: number;\n\n // Duration of the most recent render time for this Fiber.\n // This value is not updated when we bailout for memoization purposes.\n // This field is only set when the enableProfilerTimer flag is enabled.\n selfBaseDuration?: number;\n\n // Sum of base times for all descendants of this Fiber.\n // This value bubbles up during the \"complete\" phase.\n // This field is only set when the enableProfilerTimer flag is enabled.\n treeBaseDuration?: number;\n\n // Conceptual aliases\n // workInProgress : Fiber -> alternate The alternate used for reuse happens\n // to be the same as work in progress.\n // __DEV__ only\n _debugID?: number;\n _debugSource?: Source | null;\n _debugOwner?: Fiber | null;\n _debugIsCurrentlyTiming?: boolean;\n _debugNeedsRemount?: boolean;\n\n // Used to verify that the order of hooks does not change between renders.\n _debugHookTypes?: HookType[] | null;\n};\n\nexport function getReactFiberFromNode(elm: Node | undefined): Fiber | null {\n if (!elm) {\n return null;\n }\n\n for (const k in elm) {\n // React 16 uses \"__reactInternalInstance$\" prefix\n // React 17 uses \"__reactFiber$\" prefix\n // https://github.com/facebook/react/pull/18377\n if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return elm[k];\n }\n }\n\n throw new Error('getReactFiber(): Failed to find a React Fiber on a node');\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;IAuEvBC,OAAA;WAAKA,OAAO;EAAPA,OAAA,CAAAA,OAAA,CACH,uBAAoB,KAApB;EADGA,OAAA,CAAAA,OAAA,CAEH,oBAAiB,KAAjB;EAFGA,OAAA,CAAAA,OAAA,CAGH,4BAAyB,KAAzB;EAHGA,OAAA,CAAAA,OAAA,CAIH,cAAW,KAAX;EAJGA,OAAA,CAAAA,OAAA,CAKH,gBAAa,KAAb;EALGA,OAAA,CAAAA,OAAA,CAMH,mBAAgB,KAAhB;EANGA,OAAA,CAAAA,OAAA,CAOH,cAAW,KAAX;EAPGA,OAAA,CAAAA,OAAA,CAQH,cAAW,KAAX;EARGA,OAAA,CAAAA,OAAA,CASH,UAAO,KAAP;EATGA,OAAA,CAAAA,OAAA,CAUH,qBAAkB,KAAlB;EAVGA,OAAA,CAAAA,OAAA,CAWH,qBAAkB,MAAlB;EAXGA,OAAA,CAAAA,OAAA,CAYH,gBAAa,MAAb;EAZGA,OAAA,CAAAA,OAAA,CAaH,cAAW,MAAX;EAbGA,OAAA,CAAAA,OAAA,CAcH,uBAAoB,MAApB;EAdGA,OAAA,CAAAA,OAAA,CAeH,mBAAgB,MAAhB;EAfGA,OAAA,CAAAA,OAAA,CAgBH,yBAAsB,MAAtB;EAhBGA,OAAA,CAAAA,OAAA,CAiBH,mBAAgB,MAAhB;EAjBGA,OAAA,CAAAA,OAAA,CAkBH,8BAA2B,MAA3B;EAlBGA,OAAA,CAAAA,OAAA,CAmBH,wBAAqB,MAArB;EAnBGA,OAAA,CAAAA,OAAA,CAoBH,2BAAwB,MAAxB;EApBGA,OAAA,CAAAA,OAAA,CAqBH,0BAAuB,MAAvB;EArBGA,OAAA,CAAAA,OAAA,CAsBH,oBAAiB,MAAjB;GAtBGA,OAAA,KAAAA,OAAA;AAsLL,OAAO,SAASC,sBAAsBC,GAAqB,EAAgB;EACzE,IAAI,CAACA,GAAA,EAAK;IACR,OAAO,IAAI;EACb;EAEA,KAAK,MAAMC,CAAA,IAAKD,GAAA,EAAK;IACnB;IACA;IACA;IACA,IAAIC,CAAA,CAAEC,OAAO,CAAC,gCAAgC,KAAKD,CAAA,CAAEC,OAAO,CAAC,qBAAqB,GAAG;MACnF;MACA;MACA,OAAOF,GAAG,CAACC,CAAA,CAAE;IACf;EACF;EAEA,MAAM,IAAIE,KAAA,CAAM;AAClB"}
|
@@ -2,8 +2,7 @@
|
|
2
2
|
* Returns the parent node or the host of the node argument.
|
3
3
|
* @param node - DOM node.
|
4
4
|
* @returns - parent DOM node.
|
5
|
-
*/
|
6
|
-
export const getParentNode = node => {
|
5
|
+
*/export const getParentNode = node => {
|
7
6
|
if (node.nodeName === 'HTML') {
|
8
7
|
return node;
|
9
8
|
}
|
@@ -16,11 +15,11 @@ export const getParentNode = node => {
|
|
16
15
|
* @returns - CSS styles.
|
17
16
|
*/
|
18
17
|
const getStyleComputedProperty = node => {
|
19
|
-
var
|
18
|
+
var _node_ownerDocument;
|
20
19
|
if (node.nodeType !== 1) {
|
21
20
|
return {};
|
22
21
|
}
|
23
|
-
const window = (
|
22
|
+
const window = (_node_ownerDocument = node.ownerDocument) === null || _node_ownerDocument === void 0 ? void 0 : _node_ownerDocument.defaultView;
|
24
23
|
return window.getComputedStyle(node, null);
|
25
24
|
};
|
26
25
|
/**
|
@@ -52,8 +51,8 @@ export const getScrollParent = node => {
|
|
52
51
|
return getScrollParent(parentNode);
|
53
52
|
};
|
54
53
|
export const hasScrollParent = node => {
|
55
|
-
var
|
54
|
+
var _scrollParentElement_ownerDocument;
|
56
55
|
const scrollParentElement = getScrollParent(node);
|
57
|
-
return scrollParentElement ? scrollParentElement !== ((
|
56
|
+
return scrollParentElement ? scrollParentElement !== ((_scrollParentElement_ownerDocument = scrollParentElement.ownerDocument) === null || _scrollParentElement_ownerDocument === void 0 ? void 0 : _scrollParentElement_ownerDocument.body) : false;
|
58
57
|
};
|
59
58
|
//# sourceMappingURL=getScrollParent.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getParentNode","node","nodeName","parentNode","host","getStyleComputedProperty","
|
1
|
+
{"version":3,"names":["getParentNode","node","nodeName","parentNode","host","getStyleComputedProperty","_node_ownerDocument","nodeType","window","ownerDocument","defaultView","getComputedStyle","getScrollParent","document","body","overflow","overflowX","overflowY","test","hasScrollParent","_scrollParentElement_ownerDocument","scrollParentElement"],"sources":["../../src/utils/getScrollParent.ts"],"sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */\nexport const getParentNode = (node: HTMLElement): HTMLElement => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || (node as any).host;\n};\n\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = (node: HTMLElement): Partial<CSSStyleDeclaration> => {\n if (node.nodeType !== 1) {\n return {};\n }\n\n const window = node.ownerDocument?.defaultView;\n return window!.getComputedStyle(node, null);\n};\n\n/**\n * Returns the first scrollable parent of the given element.\n * @param node - DOM node.\n * @returns - the first scrollable parent.\n */\nexport const getScrollParent = (node: Document | HTMLElement | null): HTMLElement => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node as HTMLElement);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument!.body;\n case '#document':\n return (parentNode as unknown as Document).body;\n }\n\n // If any of the overflow props is defined for the node then we return it as the parent\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow! + overflowY! + overflowX)) {\n return parentNode;\n }\n\n return getScrollParent(parentNode);\n};\n\nexport const hasScrollParent = (node: Document | HTMLElement | null): boolean => {\n const scrollParentElement: HTMLElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== scrollParentElement.ownerDocument?.body : false;\n};\n"],"mappings":"AAAA;;;;GAKA,OAAO,MAAMA,aAAA,GAAiBC,IAAA,IAAmC;EAC/D,IAAIA,IAAA,CAAKC,QAAQ,KAAK,QAAQ;IAC5B,OAAOD,IAAA;EACT;EACA;EACA,OAAOA,IAAA,CAAKE,UAAU,IAAIF,IAAC,CAAaG,IAAI;AAC9C;AAEA;;;;;AAKA,MAAMC,wBAAA,GAA4BJ,IAAA,IAAoD;MAKrEK,mBAAA;EAJf,IAAIL,IAAA,CAAKM,QAAQ,KAAK,GAAG;IACvB,OAAO,CAAC;EACV;EAEA,MAAMC,MAAA,GAAS,CAAAF,mBAAA,GAAAL,IAAA,CAAKQ,aAAa,cAAlBH,mBAAA,uBAAAA,mBAAA,CAAoBI,WAAW;EAC9C,OAAOF,MAAA,CAAQG,gBAAgB,CAACV,IAAA,EAAM,IAAI;AAC5C;AAEA;;;;;AAKA,OAAO,MAAMW,eAAA,GAAmBX,IAAA,IAAqD;EACnF;EACA,MAAME,UAAA,GAAaF,IAAA,IAAQD,aAAA,CAAcC,IAAA;EACzC;EACA,IAAI,CAACE,UAAA,EAAY,OAAOU,QAAA,CAASC,IAAI;EAErC,QAAQX,UAAA,CAAWD,QAAQ;IACzB,KAAK;IACL,KAAK;MACH,OAAOC,UAAA,CAAWM,aAAa,CAAEK,IAAI;IACvC,KAAK;MACH,OAAOX,UAAC,CAAmCW,IAAI;EAAA;EAGnD;EACA,MAAM;IAAEC,QAAA;IAAUC,SAAA;IAAWC;EAAS,CAAE,GAAGZ,wBAAA,CAAyBF,UAAA;EACpE,IAAI,wBAAwBe,IAAI,CAACH,QAAA,GAAYE,SAAA,GAAaD,SAAA,GAAY;IACpE,OAAOb,UAAA;EACT;EAEA,OAAOS,eAAA,CAAgBT,UAAA;AACzB;AAEA,OAAO,MAAMgB,eAAA,GAAmBlB,IAAA,IAAiD;MAE1BmB,kCAAA;EADrD,MAAMC,mBAAA,GAAmCT,eAAA,CAAgBX,IAAA;EACzD,OAAOoB,mBAAA,GAAsBA,mBAAA,MAAwB,CAAAD,kCAAA,GAAAC,mBAAA,CAAoBZ,aAAa,cAAjCW,kCAAA,uBAAAA,kCAAA,CAAmCN,IAAI,CAAD,GAAI,KAAK;AACtG"}
|
@@ -9,11 +9,11 @@ import { getReactFiberFromNode } from './getReactFiberFromNode';
|
|
9
9
|
* @param node
|
10
10
|
*/
|
11
11
|
function hasAutofocusProp(node) {
|
12
|
-
var _a;
|
13
12
|
// https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166
|
14
13
|
const isAutoFocusableElement = node.nodeName === 'BUTTON' || node.nodeName === 'INPUT' || node.nodeName === 'SELECT' || node.nodeName === 'TEXTAREA';
|
15
14
|
if (isAutoFocusableElement) {
|
16
|
-
|
15
|
+
var _getReactFiberFromNode;
|
16
|
+
return !!((_getReactFiberFromNode = getReactFiberFromNode(node)) === null || _getReactFiberFromNode === void 0 ? void 0 : _getReactFiberFromNode.pendingProps.autoFocus);
|
17
17
|
}
|
18
18
|
return false;
|
19
19
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getReactFiberFromNode","hasAutofocusProp","node","isAutoFocusableElement","nodeName","
|
1
|
+
{"version":3,"names":["getReactFiberFromNode","hasAutofocusProp","node","isAutoFocusableElement","nodeName","_getReactFiberFromNode","pendingProps","autoFocus","hasAutofocusFilter","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"sources":["../../src/utils/hasAutoFocusFilter.ts"],"sourcesContent":["//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\n\nimport { getReactFiberFromNode } from './getReactFiberFromNode';\n\n/**\n * Detects if a passed HTML node has \"autoFocus\" prop on a React's fiber. Is needed as React handles autofocus behavior\n * in React DOM and will not pass \"autoFocus\" to an actual HTML.\n *\n * @param node\n */\nfunction hasAutofocusProp(node: Node): boolean {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement =\n node.nodeName === 'BUTTON' ||\n node.nodeName === 'INPUT' ||\n node.nodeName === 'SELECT' ||\n node.nodeName === 'TEXTAREA';\n\n if (isAutoFocusableElement) {\n return !!getReactFiberFromNode(node)?.pendingProps.autoFocus;\n }\n\n return false;\n}\n\nexport function hasAutofocusFilter(node: Node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n"],"mappings":"AAAA;AACA;AACA;AAEA,SAASA,qBAAqB,QAAQ;AAEtC;;;;;;AAMA,SAASC,iBAAiBC,IAAU,EAAW;EAC7C;EACA,MAAMC,sBAAA,GACJD,IAAA,CAAKE,QAAQ,KAAK,YAClBF,IAAA,CAAKE,QAAQ,KAAK,WAClBF,IAAA,CAAKE,QAAQ,KAAK,YAClBF,IAAA,CAAKE,QAAQ,KAAK;EAEpB,IAAID,sBAAA,EAAwB;QACjBE,sBAAA;IAAT,OAAO,CAAC,EAAC,CAAAA,sBAAA,GAAAL,qBAAA,CAAsBE,IAAA,eAAtBG,sBAAA,uBAAAA,sBAAA,CAA6BC,YAAA,CAAaC,SAAS;EAC9D;EAEA,OAAO,KAAK;AACd;AAEA,OAAO,SAASC,mBAAmBN,IAAU,EAAE;EAC7C,OAAOD,gBAAA,CAAiBC,IAAA,IAAQO,UAAA,CAAWC,aAAa,GAAGD,UAAA,CAAWE,WAAW;AACnF"}
|
package/lib/utils/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './parseFloatingUIPlacement';\nexport * from './getBoundary';\nexport * from './getReactFiberFromNode';\nexport * from './getScrollParent';\nexport * from './mergeArrowOffset';\nexport * from './toFloatingUIPadding';\nexport * from './toFloatingUIPlacement';\nexport * from './fromFloatingUIPlacement';\nexport * from './resolvePositioningShorthand';\nexport * from './useCallbackRef';\nexport * from './debounce';\nexport * from './toggleScrollListener';\nexport * from './hasAutoFocusFilter';\nexport * from './writeArrowUpdates';\nexport * from './writeContainerupdates';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
@@ -6,8 +6,7 @@
|
|
6
6
|
* @param userOffset - The offset provided by the user
|
7
7
|
* @param arrowHeight - The height of the arrow in px
|
8
8
|
* @returns User offset augmented with arrow height
|
9
|
-
*/
|
10
|
-
export function mergeArrowOffset(userOffset, arrowHeight) {
|
9
|
+
*/export function mergeArrowOffset(userOffset, arrowHeight) {
|
11
10
|
if (typeof userOffset === 'number') {
|
12
11
|
return addArrowOffset(userOffset, arrowHeight);
|
13
12
|
}
|
@@ -25,15 +24,15 @@ export function mergeArrowOffset(userOffset, arrowHeight) {
|
|
25
24
|
};
|
26
25
|
}
|
27
26
|
const addArrowOffset = (offset, arrowHeight) => {
|
28
|
-
var _a;
|
29
27
|
if (typeof offset === 'number') {
|
30
28
|
return {
|
31
29
|
mainAxis: offset + arrowHeight
|
32
30
|
};
|
33
31
|
}
|
32
|
+
var _offset_mainAxis;
|
34
33
|
return {
|
35
34
|
...offset,
|
36
|
-
mainAxis: ((
|
35
|
+
mainAxis: ((_offset_mainAxis = offset.mainAxis) !== null && _offset_mainAxis !== void 0 ? _offset_mainAxis : 0) + arrowHeight
|
37
36
|
};
|
38
37
|
};
|
39
38
|
//# sourceMappingURL=mergeArrowOffset.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis","
|
1
|
+
{"version":3,"names":["mergeArrowOffset","userOffset","arrowHeight","addArrowOffset","offsetParams","offset","mainAxis","_offset_mainAxis"],"sources":["../../src/utils/mergeArrowOffset.ts"],"sourcesContent":["import type { Offset, OffsetObject } from '../types';\n\n/**\n * Generally when adding an arrow to popper, it's necessary to offset the position of the popper by the\n * height of the arrow. A simple utility to merge a provided offset with an arrow height to return the final offset\n *\n * @internal\n * @param userOffset - The offset provided by the user\n * @param arrowHeight - The height of the arrow in px\n * @returns User offset augmented with arrow height\n */\nexport function mergeArrowOffset(userOffset: Offset | undefined | null, arrowHeight: number): Offset {\n if (typeof userOffset === 'number') {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'object' && userOffset !== null) {\n return addArrowOffset(userOffset, arrowHeight);\n }\n\n if (typeof userOffset === 'function') {\n return offsetParams => {\n const offset = userOffset(offsetParams);\n return addArrowOffset(offset, arrowHeight);\n };\n }\n\n return { mainAxis: arrowHeight };\n}\n\nconst addArrowOffset = (offset: OffsetObject | number, arrowHeight: number): OffsetObject => {\n if (typeof offset === 'number') {\n return { mainAxis: offset + arrowHeight };\n }\n\n return { ...offset, mainAxis: (offset.mainAxis ?? 0) + arrowHeight };\n};\n"],"mappings":"AAEA;;;;;;;;GASA,OAAO,SAASA,iBAAiBC,UAAqC,EAAEC,WAAmB,EAAU;EACnG,IAAI,OAAOD,UAAA,KAAe,UAAU;IAClC,OAAOE,cAAA,CAAeF,UAAA,EAAYC,WAAA;EACpC;EAEA,IAAI,OAAOD,UAAA,KAAe,YAAYA,UAAA,KAAe,IAAI,EAAE;IACzD,OAAOE,cAAA,CAAeF,UAAA,EAAYC,WAAA;EACpC;EAEA,IAAI,OAAOD,UAAA,KAAe,YAAY;IACpC,OAAOG,YAAA,IAAgB;MACrB,MAAMC,MAAA,GAASJ,UAAA,CAAWG,YAAA;MAC1B,OAAOD,cAAA,CAAeE,MAAA,EAAQH,WAAA;IAChC;EACF;EAEA,OAAO;IAAEI,QAAA,EAAUJ;EAAY;AACjC;AAEA,MAAMC,cAAA,GAAiBA,CAACE,MAAA,EAA+BH,WAAA,KAAsC;EAC3F,IAAI,OAAOG,MAAA,KAAW,UAAU;IAC9B,OAAO;MAAEC,QAAA,EAAUD,MAAA,GAASH;IAAY;EAC1C;MAE+BK,gBAAA;EAA/B,OAAO;IAAE,GAAGF,MAAM;IAAEC,QAAA,EAAU,CAAC,CAAAC,gBAAA,GAAAF,MAAA,CAAOC,QAAQ,cAAfC,gBAAA,cAAAA,gBAAA,GAAmB,CAAC,IAAIL;EAAY;AACrE"}
|
@@ -3,8 +3,7 @@
|
|
3
3
|
* @param placement - the floating ui placement (i.e. bottom-start)
|
4
4
|
*
|
5
5
|
* @returns side and alignment components of the placement
|
6
|
-
*/
|
7
|
-
export function parseFloatingUIPlacement(placement) {
|
6
|
+
*/export function parseFloatingUIPlacement(placement) {
|
8
7
|
const tokens = placement.split('-');
|
9
8
|
return {
|
10
9
|
side: tokens[0],
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["parseFloatingUIPlacement","placement","tokens","split","side","alignment"],"sources":["
|
1
|
+
{"version":3,"names":["parseFloatingUIPlacement","placement","tokens","split","side","alignment"],"sources":["../../src/utils/parseFloatingUIPlacement.ts"],"sourcesContent":["import type { Side, Placement, Alignment } from '@floating-ui/dom';\n\n/**\n * Parses Floating UI placement and returns the different components\n * @param placement - the floating ui placement (i.e. bottom-start)\n *\n * @returns side and alignment components of the placement\n */\nexport function parseFloatingUIPlacement(placement: Placement): { side: Side; alignment: Alignment } {\n const tokens = placement.split('-');\n return {\n side: tokens[0] as Side,\n alignment: tokens[1] as Alignment,\n };\n}\n"],"mappings":"AAEA;;;;;GAMA,OAAO,SAASA,yBAAyBC,SAAoB,EAAwC;EACnG,MAAMC,MAAA,GAASD,SAAA,CAAUE,KAAK,CAAC;EAC/B,OAAO;IACLC,IAAA,EAAMF,MAAM,CAAC,EAAE;IACfG,SAAA,EAAWH,MAAM,CAAC;EACpB;AACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["shorthandLookup","above","position","align","below","before","after","resolvePositioningShorthand","shorthand","undefined"],"sources":["
|
1
|
+
{"version":3,"names":["shorthandLookup","above","position","align","below","before","after","resolvePositioningShorthand","shorthand","undefined"],"sources":["../../src/utils/resolvePositioningShorthand.ts"],"sourcesContent":["import type { PositioningShorthand, PositioningShorthandValue, PositioningProps } from '../types';\n\n// Look up table for shorthand to avoid parsing strings\nconst shorthandLookup: Record<PositioningShorthandValue, Pick<PositioningProps, 'position' | 'align'>> = {\n above: { position: 'above', align: 'center' },\n 'above-start': { position: 'above', align: 'start' },\n 'above-end': { position: 'above', align: 'end' },\n below: { position: 'below', align: 'center' },\n 'below-start': { position: 'below', align: 'start' },\n 'below-end': { position: 'below', align: 'end' },\n before: { position: 'before', align: 'center' },\n 'before-top': { position: 'before', align: 'top' },\n 'before-bottom': { position: 'before', align: 'bottom' },\n after: { position: 'after', align: 'center' },\n 'after-top': { position: 'after', align: 'top' },\n 'after-bottom': { position: 'after', align: 'bottom' },\n};\n\nexport function resolvePositioningShorthand(\n shorthand: PositioningShorthand | undefined | null,\n): Readonly<PositioningProps> {\n if (shorthand === undefined || shorthand === null) {\n return {};\n }\n\n if (typeof shorthand === 'string') {\n return shorthandLookup[shorthand];\n }\n\n return shorthand as Readonly<PositioningProps>;\n}\n"],"mappings":"AAEA;AACA,MAAMA,eAAA,GAAmG;EACvGC,KAAA,EAAO;IAAEC,QAAA,EAAU;IAASC,KAAA,EAAO;EAAS;EAC5C,eAAe;IAAED,QAAA,EAAU;IAASC,KAAA,EAAO;EAAQ;EACnD,aAAa;IAAED,QAAA,EAAU;IAASC,KAAA,EAAO;EAAM;EAC/CC,KAAA,EAAO;IAAEF,QAAA,EAAU;IAASC,KAAA,EAAO;EAAS;EAC5C,eAAe;IAAED,QAAA,EAAU;IAASC,KAAA,EAAO;EAAQ;EACnD,aAAa;IAAED,QAAA,EAAU;IAASC,KAAA,EAAO;EAAM;EAC/CE,MAAA,EAAQ;IAAEH,QAAA,EAAU;IAAUC,KAAA,EAAO;EAAS;EAC9C,cAAc;IAAED,QAAA,EAAU;IAAUC,KAAA,EAAO;EAAM;EACjD,iBAAiB;IAAED,QAAA,EAAU;IAAUC,KAAA,EAAO;EAAS;EACvDG,KAAA,EAAO;IAAEJ,QAAA,EAAU;IAASC,KAAA,EAAO;EAAS;EAC5C,aAAa;IAAED,QAAA,EAAU;IAASC,KAAA,EAAO;EAAM;EAC/C,gBAAgB;IAAED,QAAA,EAAU;IAASC,KAAA,EAAO;EAAS;AACvD;AAEA,OAAO,SAASI,4BACdC,SAAkD,EACtB;EAC5B,IAAIA,SAAA,KAAcC,SAAA,IAAaD,SAAA,KAAc,IAAI,EAAE;IACjD,OAAO,CAAC;EACV;EAEA,IAAI,OAAOA,SAAA,KAAc,UAAU;IACjC,OAAOR,eAAe,CAACQ,SAAA,CAAU;EACnC;EAEA,OAAOA,SAAA;AACT"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["toFloatingUIPadding","padding","isRtl","start","end","verticalPadding","paddingObject","left","right"],"sources":["
|
1
|
+
{"version":3,"names":["toFloatingUIPadding","padding","isRtl","start","end","verticalPadding","paddingObject","left","right"],"sources":["../../src/utils/toFloatingUIPadding.ts"],"sourcesContent":["import type { SideObject } from '@floating-ui/dom';\nimport { PositioningOptions } from '../types';\n\nexport function toFloatingUIPadding(\n padding: NonNullable<PositioningOptions['overflowBoundaryPadding']>,\n isRtl: boolean,\n): number | Partial<SideObject> {\n if (typeof padding === 'number') {\n return padding;\n }\n\n const { start, end, ...verticalPadding } = padding;\n\n const paddingObject: Partial<SideObject> = verticalPadding;\n\n const left = isRtl ? 'end' : 'start';\n const right = isRtl ? 'start' : 'end';\n\n // assign properties explicitly since undefined values are actually handled by floating UI\n // TODO create floating UI issue\n if (padding[left]) {\n paddingObject.left = padding[left];\n }\n\n if (padding[right]) {\n paddingObject.right = padding[right];\n }\n\n return paddingObject;\n}\n"],"mappings":"AAGA,OAAO,SAASA,oBACdC,OAAmE,EACnEC,KAAc,EACgB;EAC9B,IAAI,OAAOD,OAAA,KAAY,UAAU;IAC/B,OAAOA,OAAA;EACT;EAEA,MAAM;IAAEE,KAAA;IAAOC,GAAA;IAAK,GAAGC;EAAA,CAAiB,GAAGJ,OAAA;EAE3C,MAAMK,aAAA,GAAqCD,eAAA;EAE3C,MAAME,IAAA,GAAOL,KAAA,GAAQ,QAAQ,OAAO;EACpC,MAAMM,KAAA,GAAQN,KAAA,GAAQ,UAAU,KAAK;EAErC;EACA;EACA,IAAID,OAAO,CAACM,IAAA,CAAK,EAAE;IACjBD,aAAA,CAAcC,IAAI,GAAGN,OAAO,CAACM,IAAA,CAAK;EACpC;EAEA,IAAIN,OAAO,CAACO,KAAA,CAAM,EAAE;IAClBF,aAAA,CAAcE,KAAK,GAAGP,OAAO,CAACO,KAAA,CAAM;EACtC;EAEA,OAAOF,aAAA;AACT"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getPositionMap","rtl","above","below","before","after","getAlignmentMap","start","end","top","bottom","center","undefined","shouldAlignToCenter","p","a","positionedVertically","alignedVertically","toFloatingUIPlacement","align","position","alignment","computedPosition","computedAlignment"],"sources":["
|
1
|
+
{"version":3,"names":["getPositionMap","rtl","above","below","before","after","getAlignmentMap","start","end","top","bottom","center","undefined","shouldAlignToCenter","p","a","positionedVertically","alignedVertically","toFloatingUIPlacement","align","position","alignment","computedPosition","computedAlignment"],"sources":["../../src/utils/toFloatingUIPlacement.ts"],"sourcesContent":["import type { Placement, Side, Alignment as FloatingUIAlignment } from '@floating-ui/dom';\nimport type { Alignment, Position } from '../types';\n\ntype PlacementPosition = Side;\ntype PlacementAlign = FloatingUIAlignment;\n\nconst getPositionMap = (rtl?: boolean): Record<Position, PlacementPosition> => ({\n above: 'top',\n below: 'bottom',\n before: rtl ? 'right' : 'left',\n after: rtl ? 'left' : 'right',\n});\n\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = (): Record<Alignment, PlacementAlign | undefined> => ({\n start: 'start',\n end: 'end',\n top: 'start',\n bottom: 'end',\n center: undefined,\n});\n\nconst shouldAlignToCenter = (p?: Position, a?: Alignment): boolean => {\n const positionedVertically = p === 'above' || p === 'below';\n const alignedVertically = a === 'top' || a === 'bottom';\n\n return (positionedVertically && alignedVertically) || (!positionedVertically && !alignedVertically);\n};\n\n/**\n * Maps internal positioning values to Floating UI placement\n * @see positioningHelper.test.ts for expected placement values\n */\nexport const toFloatingUIPlacement = (align?: Alignment, position?: Position, rtl?: boolean): Placement | undefined => {\n const alignment = shouldAlignToCenter(position, align) ? 'center' : align;\n\n const computedPosition = position && getPositionMap(rtl)[position];\n const computedAlignment = alignment && getAlignmentMap()[alignment];\n\n if (computedPosition && computedAlignment) {\n return `${computedPosition}-${computedAlignment}` as Placement;\n }\n\n return computedPosition;\n};\n"],"mappings":"AAMA,MAAMA,cAAA,GAAkBC,GAAA,KAAwD;EAC9EC,KAAA,EAAO;EACPC,KAAA,EAAO;EACPC,MAAA,EAAQH,GAAA,GAAM,UAAU,MAAM;EAC9BI,KAAA,EAAOJ,GAAA,GAAM,SAAS;AACxB;AAEA;AACA;AACA,MAAMK,eAAA,GAAkBA,CAAA,MAAsD;EAC5EC,KAAA,EAAO;EACPC,GAAA,EAAK;EACLC,GAAA,EAAK;EACLC,MAAA,EAAQ;EACRC,MAAA,EAAQC;AACV;AAEA,MAAMC,mBAAA,GAAsBA,CAACC,CAAA,EAAcC,CAAA,KAA2B;EACpE,MAAMC,oBAAA,GAAuBF,CAAA,KAAM,WAAWA,CAAA,KAAM;EACpD,MAAMG,iBAAA,GAAoBF,CAAA,KAAM,SAASA,CAAA,KAAM;EAE/C,OAAOC,oBAAC,IAAwBC,iBAAA,IAAuB,CAACD,oBAAA,IAAwB,CAACC,iBAAA;AACnF;AAEA;;;;AAIA,OAAO,MAAMC,qBAAA,GAAwBA,CAACC,KAAA,EAAmBC,QAAA,EAAqBnB,GAAA,KAAyC;EACrH,MAAMoB,SAAA,GAAYR,mBAAA,CAAoBO,QAAA,EAAUD,KAAA,IAAS,WAAWA,KAAK;EAEzE,MAAMG,gBAAA,GAAmBF,QAAA,IAAYpB,cAAA,CAAeC,GAAA,CAAI,CAACmB,QAAA,CAAS;EAClE,MAAMG,iBAAA,GAAoBF,SAAA,IAAaf,eAAA,EAAiB,CAACe,SAAA,CAAU;EAEnE,IAAIC,gBAAA,IAAoBC,iBAAA,EAAmB;IACzC,OAAQ,GAAED,gBAAiB,IAAGC,iBAAkB,EAAC;EACnD;EAEA,OAAOD,gBAAA;AACT"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isHTMLElement","getScrollParent","toggleScrollListener","next","prev","handler","prevScrollParent","removeEventListener","scrollParent","addEventListener"],"sources":["
|
1
|
+
{"version":3,"names":["isHTMLElement","getScrollParent","toggleScrollListener","next","prev","handler","prevScrollParent","removeEventListener","scrollParent","addEventListener"],"sources":["../../src/utils/toggleScrollListener.ts"],"sourcesContent":["import { isHTMLElement } from '@fluentui/react-utilities';\nimport type { PositioningVirtualElement } from '../types';\nimport { getScrollParent } from './getScrollParent';\n\n/**\n * Toggles event listeners for scroll parent.\n * Cleans up the event listeners for the previous element and adds them for the new scroll parent.\n * @param next Next element\n * @param prev Previous element\n */\nexport function toggleScrollListener(\n next: HTMLElement | PositioningVirtualElement | null,\n prev: HTMLElement | PositioningVirtualElement | null,\n handler: EventListener,\n) {\n if (next === prev) {\n return;\n }\n\n if (isHTMLElement(prev)) {\n const prevScrollParent = getScrollParent(prev);\n prevScrollParent.removeEventListener('scroll', handler);\n }\n if (isHTMLElement(next)) {\n const scrollParent = getScrollParent(next);\n scrollParent.addEventListener('scroll', handler);\n }\n}\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ;AAE9B,SAASC,eAAe,QAAQ;AAEhC;;;;;;AAMA,OAAO,SAASC,qBACdC,IAAoD,EACpDC,IAAoD,EACpDC,OAAsB,EACtB;EACA,IAAIF,IAAA,KAASC,IAAA,EAAM;IACjB;EACF;EAEA,IAAIJ,aAAA,CAAcI,IAAA,GAAO;IACvB,MAAME,gBAAA,GAAmBL,eAAA,CAAgBG,IAAA;IACzCE,gBAAA,CAAiBC,mBAAmB,CAAC,UAAUF,OAAA;EACjD;EACA,IAAIL,aAAA,CAAcG,IAAA,GAAO;IACvB,MAAMK,YAAA,GAAeP,eAAA,CAAgBE,IAAA;IACrCK,YAAA,CAAaC,gBAAgB,CAAC,UAAUJ,OAAA;EAC1C;AACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useIsomorphicLayoutEffect","useCallbackRef","initialValue","callback","skipInitialResolve","isFirst","useRef","ref","useState","value","facade","current","last"],"sources":["
|
1
|
+
{"version":3,"names":["React","useIsomorphicLayoutEffect","useCallbackRef","initialValue","callback","skipInitialResolve","isFirst","useRef","ref","useState","value","facade","current","last"],"sources":["../../src/utils/useCallbackRef.ts"],"sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\n\n/**\n * Creates a MutableRef with ref change callback. Is useful as React.useRef() doesn't notify you when its content\n * changes and mutating the .current property doesn't cause a re-render. An opt-out will be use a callback ref via\n * React.useState(), but it will cause re-renders always.\n *\n * https://reactjs.org/docs/hooks-reference.html#useref\n * https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref\n *\n * @param initialValue - initial ref value\n * @param callback - a callback to run when value changes\n * @param skipInitialResolve - a flag to skip an initial ref report\n *\n * @example\n * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);\n * ref.current = 1;\n * // prints 0 -> 1\n */\nexport function useCallbackRef<T>(\n initialValue: T | null,\n callback: (newValue: T | null, lastValue: T | null) => void,\n skipInitialResolve?: boolean,\n): React.MutableRefObject<T | null> {\n const isFirst = React.useRef(true);\n const [ref] = React.useState(() => ({\n // value\n value: initialValue,\n // last callback\n callback,\n // \"memoized\" public interface\n facade: {\n get current() {\n return ref.value;\n },\n set current(value) {\n const last = ref.value;\n\n if (last !== value) {\n ref.value = value;\n\n if (skipInitialResolve && isFirst.current) {\n return;\n }\n\n ref.callback(value, last);\n }\n },\n },\n }));\n\n useIsomorphicLayoutEffect(() => {\n isFirst.current = false;\n }, []);\n\n // update callback\n ref.callback = callback;\n\n return ref.facade;\n}\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,yBAAyB,QAAQ;AAE1C;;;;;;;;;;;;;;;;;AAiBA,OAAO,SAASC,eACdC,YAAsB,EACtBC,QAA2D,EAC3DC,kBAA4B,EACM;EAClC,MAAMC,OAAA,GAAUN,KAAA,CAAMO,MAAM,CAAC,IAAI;EACjC,MAAM,CAACC,GAAA,CAAI,GAAGR,KAAA,CAAMS,QAAQ,CAAC,OAAO;IAClC;IACAC,KAAA,EAAOP,YAAA;IACP;IACAC,QAAA;IACA;IACAO,MAAA,EAAQ;MACN,IAAIC,QAAA,EAAU;QACZ,OAAOJ,GAAA,CAAIE,KAAK;MAClB;MACA,IAAIE,QAAQF,KAAA,EAAO;QACjB,MAAMG,IAAA,GAAOL,GAAA,CAAIE,KAAK;QAEtB,IAAIG,IAAA,KAASH,KAAA,EAAO;UAClBF,GAAA,CAAIE,KAAK,GAAGA,KAAA;UAEZ,IAAIL,kBAAA,IAAsBC,OAAA,CAAQM,OAAO,EAAE;YACzC;UACF;UAEAJ,GAAA,CAAIJ,QAAQ,CAACM,KAAA,EAAOG,IAAA;QACtB;MACF;IACF;EACF;EAEAZ,yBAAA,CAA0B,MAAM;IAC9BK,OAAA,CAAQM,OAAO,GAAG,KAAK;EACzB,GAAG,EAAE;EAEL;EACAJ,GAAA,CAAIJ,QAAQ,GAAGA,QAAA;EAEf,OAAOI,GAAA,CAAIG,MAAM;AACnB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["writeArrowUpdates","options","arrow","middlewareData","x","arrowX","y","arrowY","Object","assign","style","left","top"],"sources":["
|
1
|
+
{"version":3,"names":["writeArrowUpdates","options","arrow","middlewareData","x","arrowX","y","arrowY","Object","assign","style","left","top"],"sources":["../../src/utils/writeArrowUpdates.ts"],"sourcesContent":["import { MiddlewareData } from '@floating-ui/dom';\n\n/**\n * Writes all DOM element updates after position is computed\n */\nexport function writeArrowUpdates(options: { arrow: HTMLElement | null; middlewareData: MiddlewareData }) {\n const { arrow, middlewareData } = options;\n if (!middlewareData.arrow || !arrow) {\n return;\n }\n\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n Object.assign(arrow.style, {\n left: `${arrowX}px`,\n top: `${arrowY}px`,\n });\n}\n"],"mappings":"AAEA;;GAGA,OAAO,SAASA,kBAAkBC,OAAsE,EAAE;EACxG,MAAM;IAAEC,KAAA;IAAOC;EAAc,CAAE,GAAGF,OAAA;EAClC,IAAI,CAACE,cAAA,CAAeD,KAAK,IAAI,CAACA,KAAA,EAAO;IACnC;EACF;EAEA,MAAM;IAAEE,CAAA,EAAGC,MAAA;IAAQC,CAAA,EAAGC;EAAM,CAAE,GAAGJ,cAAA,CAAeD,KAAK;EAErDM,MAAA,CAAOC,MAAM,CAACP,KAAA,CAAMQ,KAAK,EAAE;IACzBC,IAAA,EAAO,GAAEN,MAAO,IAAG;IACnBO,GAAA,EAAM,GAAEL,MAAO;EACjB;AACF"}
|
@@ -3,7 +3,7 @@ import { DATA_POSITIONING_ESCAPED, DATA_POSITIONING_HIDDEN, DATA_POSITIONING_INT
|
|
3
3
|
* Writes all container element position updates after the position is computed
|
4
4
|
*/
|
5
5
|
export function writeContainerUpdates(options) {
|
6
|
-
var
|
6
|
+
var _middlewareData_hide, _middlewareData_hide1, _container_ownerDocument_defaultView;
|
7
7
|
const {
|
8
8
|
container,
|
9
9
|
placement,
|
@@ -21,18 +21,18 @@ export function writeContainerUpdates(options) {
|
|
21
21
|
container.setAttribute(DATA_POSITIONING_INTERSECTING, '');
|
22
22
|
}
|
23
23
|
container.removeAttribute(DATA_POSITIONING_ESCAPED);
|
24
|
-
if ((
|
24
|
+
if ((_middlewareData_hide = middlewareData.hide) === null || _middlewareData_hide === void 0 ? void 0 : _middlewareData_hide.escaped) {
|
25
25
|
container.setAttribute(DATA_POSITIONING_ESCAPED, '');
|
26
26
|
}
|
27
27
|
container.removeAttribute(DATA_POSITIONING_HIDDEN);
|
28
|
-
if ((
|
28
|
+
if ((_middlewareData_hide1 = middlewareData.hide) === null || _middlewareData_hide1 === void 0 ? void 0 : _middlewareData_hide1.referenceHidden) {
|
29
29
|
container.setAttribute(DATA_POSITIONING_HIDDEN, '');
|
30
30
|
}
|
31
31
|
// Round so that the coordinates land on device pixels.
|
32
32
|
// This prevents blurriness in cases where the browser doesn't apply pixel snapping, such as when other effects like
|
33
33
|
// `backdrop-filter: blur()` are applied to the container, and the browser is zoomed in.
|
34
34
|
// See https://github.com/microsoft/fluentui/issues/26764 for more info.
|
35
|
-
const devicePixelRatio = ((
|
35
|
+
const devicePixelRatio = ((_container_ownerDocument_defaultView = container.ownerDocument.defaultView) === null || _container_ownerDocument_defaultView === void 0 ? void 0 : _container_ownerDocument_defaultView.devicePixelRatio) || 1;
|
36
36
|
const x = Math.round(coordinates.x * devicePixelRatio) / devicePixelRatio;
|
37
37
|
const y = Math.round(coordinates.y * devicePixelRatio) / devicePixelRatio;
|
38
38
|
Object.assign(container.style, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["DATA_POSITIONING_ESCAPED","DATA_POSITIONING_HIDDEN","DATA_POSITIONING_INTERSECTING","DATA_POSITIONING_PLACEMENT","writeContainerUpdates","options","container","placement","middlewareData","strategy","lowPPI","coordinates","setAttribute","removeAttribute","intersectionObserver","intersecting","
|
1
|
+
{"version":3,"names":["DATA_POSITIONING_ESCAPED","DATA_POSITIONING_HIDDEN","DATA_POSITIONING_INTERSECTING","DATA_POSITIONING_PLACEMENT","writeContainerUpdates","options","_middlewareData_hide","_middlewareData_hide1","_container_ownerDocument_defaultView","container","placement","middlewareData","strategy","lowPPI","coordinates","setAttribute","removeAttribute","intersectionObserver","intersecting","hide","escaped","referenceHidden","devicePixelRatio","ownerDocument","defaultView","x","Math","round","y","Object","assign","style","transform","position"],"sources":["../../src/utils/writeContainerupdates.ts"],"sourcesContent":["import type { Placement, MiddlewareData, Strategy, Coords } from '@floating-ui/dom';\nimport {\n DATA_POSITIONING_ESCAPED,\n DATA_POSITIONING_HIDDEN,\n DATA_POSITIONING_INTERSECTING,\n DATA_POSITIONING_PLACEMENT,\n} from '../constants';\n\n/**\n * Writes all container element position updates after the position is computed\n */\nexport function writeContainerUpdates(options: {\n container: HTMLElement | null;\n placement: Placement;\n middlewareData: MiddlewareData;\n /**\n * Layer acceleration can disable subpixel rendering which causes slightly\n * blurry text on low PPI displays, so we want to use 2D transforms\n * instead\n */\n lowPPI: boolean;\n strategy: Strategy;\n coordinates: Coords;\n}) {\n const { container, placement, middlewareData, strategy, lowPPI, coordinates } = options;\n if (!container) {\n return;\n }\n container.setAttribute(DATA_POSITIONING_PLACEMENT, placement);\n container.removeAttribute(DATA_POSITIONING_INTERSECTING);\n if (middlewareData.intersectionObserver.intersecting) {\n container.setAttribute(DATA_POSITIONING_INTERSECTING, '');\n }\n\n container.removeAttribute(DATA_POSITIONING_ESCAPED);\n if (middlewareData.hide?.escaped) {\n container.setAttribute(DATA_POSITIONING_ESCAPED, '');\n }\n\n container.removeAttribute(DATA_POSITIONING_HIDDEN);\n if (middlewareData.hide?.referenceHidden) {\n container.setAttribute(DATA_POSITIONING_HIDDEN, '');\n }\n\n // Round so that the coordinates land on device pixels.\n // This prevents blurriness in cases where the browser doesn't apply pixel snapping, such as when other effects like\n // `backdrop-filter: blur()` are applied to the container, and the browser is zoomed in.\n // See https://github.com/microsoft/fluentui/issues/26764 for more info.\n const devicePixelRatio = container.ownerDocument.defaultView?.devicePixelRatio || 1;\n const x = Math.round(coordinates.x * devicePixelRatio) / devicePixelRatio;\n const y = Math.round(coordinates.y * devicePixelRatio) / devicePixelRatio;\n\n Object.assign(container.style, {\n transform: lowPPI ? `translate(${x}px, ${y}px)` : `translate3d(${x}px, ${y}px, 0)`,\n position: strategy,\n });\n}\n"],"mappings":"AACA,SACEA,wBAAwB,EACxBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,0BAA0B,QACrB;AAEP;;;AAGA,OAAO,SAASC,sBAAsBC,OAYrC,EAAE;MAYGC,oBAAA,EAKAC,qBAAA,EAQqBC,oCAAA;EAxBzB,MAAM;IAAEC,SAAA;IAAWC,SAAA;IAAWC,cAAA;IAAgBC,QAAA;IAAUC,MAAA;IAAQC;EAAW,CAAE,GAAGT,OAAA;EAChF,IAAI,CAACI,SAAA,EAAW;IACd;EACF;EACAA,SAAA,CAAUM,YAAY,CAACZ,0BAAA,EAA4BO,SAAA;EACnDD,SAAA,CAAUO,eAAe,CAACd,6BAAA;EAC1B,IAAIS,cAAA,CAAeM,oBAAoB,CAACC,YAAY,EAAE;IACpDT,SAAA,CAAUM,YAAY,CAACb,6BAAA,EAA+B;EACxD;EAEAO,SAAA,CAAUO,eAAe,CAAChB,wBAAA;EAC1B,IAAI,CAAAM,oBAAA,GAAAK,cAAA,CAAeQ,IAAI,cAAnBb,oBAAA,uBAAAA,oBAAA,CAAqBc,OAAO,EAAE;IAChCX,SAAA,CAAUM,YAAY,CAACf,wBAAA,EAA0B;EACnD;EAEAS,SAAA,CAAUO,eAAe,CAACf,uBAAA;EAC1B,IAAI,CAAAM,qBAAA,GAAAI,cAAA,CAAeQ,IAAI,cAAnBZ,qBAAA,uBAAAA,qBAAA,CAAqBc,eAAe,EAAE;IACxCZ,SAAA,CAAUM,YAAY,CAACd,uBAAA,EAAyB;EAClD;EAEA;EACA;EACA;EACA;EACA,MAAMqB,gBAAA,GAAmB,EAAAd,oCAAA,GAAAC,SAAA,CAAUc,aAAa,CAACC,WAAW,cAAnChB,oCAAA,uBAAAA,oCAAA,CAAqCc,gBAAgB,KAAI;EAClF,MAAMG,CAAA,GAAIC,IAAA,CAAKC,KAAK,CAACb,WAAA,CAAYW,CAAC,GAAGH,gBAAA,IAAoBA,gBAAA;EACzD,MAAMM,CAAA,GAAIF,IAAA,CAAKC,KAAK,CAACb,WAAA,CAAYc,CAAC,GAAGN,gBAAA,IAAoBA,gBAAA;EAEzDO,MAAA,CAAOC,MAAM,CAACrB,SAAA,CAAUsB,KAAK,EAAE;IAC7BC,SAAA,EAAWnB,MAAA,GAAU,aAAYY,CAAE,OAAMG,CAAE,KAAI,GAAI,eAAcH,CAAE,OAAMG,CAAE,QAAO;IAClFK,QAAA,EAAUrB;EACZ;AACF"}
|
@@ -1,11 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
DATA_POSITIONING_INTERSECTING: ()=>DATA_POSITIONING_INTERSECTING,
|
13
|
+
DATA_POSITIONING_ESCAPED: ()=>DATA_POSITIONING_ESCAPED,
|
14
|
+
DATA_POSITIONING_HIDDEN: ()=>DATA_POSITIONING_HIDDEN,
|
15
|
+
DATA_POSITIONING_PLACEMENT: ()=>DATA_POSITIONING_PLACEMENT
|
5
16
|
});
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
17
|
+
const DATA_POSITIONING_INTERSECTING = 'data-popper-is-intersecting';
|
18
|
+
const DATA_POSITIONING_ESCAPED = 'data-popper-escaped';
|
19
|
+
const DATA_POSITIONING_HIDDEN = 'data-popper-reference-hidden';
|
20
|
+
const DATA_POSITIONING_PLACEMENT = 'data-popper-placement'; //# sourceMappingURL=constants.js.map
|
21
|
+
|
11
22
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../lib/constants.js"],"sourcesContent":["export const DATA_POSITIONING_INTERSECTING = 'data-popper-is-intersecting';\nexport const DATA_POSITIONING_ESCAPED = 'data-popper-escaped';\nexport const DATA_POSITIONING_HIDDEN = 'data-popper-reference-hidden';\nexport const DATA_POSITIONING_PLACEMENT = 'data-popper-placement';\n//# sourceMappingURL=constants.js.map"],"names":["DATA_POSITIONING_INTERSECTING","DATA_POSITIONING_ESCAPED","DATA_POSITIONING_HIDDEN","DATA_POSITIONING_PLACEMENT"],"mappings":";;;;;;;;;;;IAAaA,6BAA6B,MAA7BA;IACAC,wBAAwB,MAAxBA;IACAC,uBAAuB,MAAvBA;IACAC,0BAA0B,MAA1BA;;AAHN,MAAMH,gCAAgC;AACtC,MAAMC,2BAA2B;AACjC,MAAMC,0BAA0B;AAChC,MAAMC,6BAA6B,yBAC1C,qCAAqC"}
|