@fluentui/react-positioning 9.9.12 → 9.9.14
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +55 -1
- package/CHANGELOG.md +24 -2
- package/lib/createPositionManager.js +1 -2
- package/lib/createPositionManager.js.map +1 -1
- package/lib/utils/getBoundary.js +2 -4
- package/lib/utils/getBoundary.js.map +1 -1
- package/lib-commonjs/createPositionManager.js +1 -2
- package/lib-commonjs/createPositionManager.js.map +1 -1
- package/lib-commonjs/utils/getBoundary.js +2 -4
- package/lib-commonjs/utils/getBoundary.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,61 @@
|
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
5
|
+
"date": "Tue, 26 Sep 2023 15:14:57 GMT",
|
6
|
+
"tag": "@fluentui/react-positioning_v9.9.14",
|
7
|
+
"version": "9.9.14",
|
8
|
+
"comments": {
|
9
|
+
"patch": [
|
10
|
+
{
|
11
|
+
"author": "martinhochel@microsoft.com",
|
12
|
+
"package": "@fluentui/react-positioning",
|
13
|
+
"commit": "e61473fa10195f6ebf2308205c1e72e91b711831",
|
14
|
+
"comment": "fix: bump swc core to mitigate transpilation memory leaks"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "beachball",
|
18
|
+
"package": "@fluentui/react-positioning",
|
19
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.9.0",
|
20
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-positioning",
|
25
|
+
"comment": "Bump @fluentui/react-theme to v9.1.13",
|
26
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-positioning",
|
31
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.4",
|
32
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
33
|
+
}
|
34
|
+
]
|
35
|
+
}
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"date": "Wed, 20 Sep 2023 17:47:40 GMT",
|
39
|
+
"tag": "@fluentui/react-positioning_v9.9.13",
|
40
|
+
"version": "9.9.13",
|
41
|
+
"comments": {
|
42
|
+
"patch": [
|
43
|
+
{
|
44
|
+
"author": "martinhochel@microsoft.com",
|
45
|
+
"package": "@fluentui/react-positioning",
|
46
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0",
|
47
|
+
"comment": "chore: trigger manual version bump after broken release"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"author": "beachball",
|
51
|
+
"package": "@fluentui/react-positioning",
|
52
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.8.1",
|
53
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
|
54
|
+
}
|
55
|
+
]
|
56
|
+
}
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"date": "Wed, 20 Sep 2023 14:59:53 GMT",
|
6
60
|
"tag": "@fluentui/react-positioning_v9.9.12",
|
7
61
|
"version": "9.9.12",
|
8
62
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,34 @@
|
|
1
1
|
# Change Log - @fluentui/react-positioning
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 26 Sep 2023 15:14:57 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.9.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.9.14)
|
8
|
+
|
9
|
+
Tue, 26 Sep 2023 15:14:57 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.9.13..@fluentui/react-positioning_v9.9.14)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- fix: bump swc core to mitigate transpilation memory leaks ([PR #29253](https://github.com/microsoft/fluentui/pull/29253) by martinhochel@microsoft.com)
|
15
|
+
- Bump @fluentui/react-shared-contexts to v9.9.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
16
|
+
- Bump @fluentui/react-theme to v9.1.13 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
17
|
+
- Bump @fluentui/react-utilities to v9.13.4 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
18
|
+
|
19
|
+
## [9.9.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.9.13)
|
20
|
+
|
21
|
+
Wed, 20 Sep 2023 17:47:40 GMT
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.9.12..@fluentui/react-positioning_v9.9.13)
|
23
|
+
|
24
|
+
### Patches
|
25
|
+
|
26
|
+
- chore: trigger manual version bump after broken release ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by martinhochel@microsoft.com)
|
27
|
+
- Bump @fluentui/react-shared-contexts to v9.8.1 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
|
28
|
+
|
7
29
|
## [9.9.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-positioning_v9.9.12)
|
8
30
|
|
9
|
-
Wed, 20 Sep 2023 14:
|
31
|
+
Wed, 20 Sep 2023 14:59:53 GMT
|
10
32
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-positioning_v9.9.11..@fluentui/react-positioning_v9.9.12)
|
11
33
|
|
12
34
|
### Patches
|
@@ -50,7 +50,6 @@ import { isHTMLElement } from '@fluentui/react-utilities';
|
|
50
50
|
middleware,
|
51
51
|
strategy
|
52
52
|
}).then(({ x, y, middlewareData, placement: computedPlacement })=>{
|
53
|
-
var _targetWindow;
|
54
53
|
// Promise can still resolve after destruction
|
55
54
|
// early return to avoid applying outdated position
|
56
55
|
if (isDestroyed) {
|
@@ -68,7 +67,7 @@ import { isHTMLElement } from '@fluentui/react-utilities';
|
|
68
67
|
x,
|
69
68
|
y
|
70
69
|
},
|
71
|
-
lowPPI: ((
|
70
|
+
lowPPI: ((targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.devicePixelRatio) || 1) <= 1,
|
72
71
|
strategy,
|
73
72
|
useTransform
|
74
73
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["createPositionManager.ts"],"sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport type { Middleware, Placement, Strategy } from '@floating-ui/dom';\nimport type { PositionManager, TargetElement } from './types';\nimport { debounce, writeArrowUpdates, writeContainerUpdates, getScrollParent } from './utils';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n\ninterface PositionManagerOptions {\n /**\n * The positioned element\n */\n container: HTMLElement;\n /**\n * Element that the container will be anchored to\n */\n target: TargetElement;\n /**\n * Arrow that points from the container to the target\n */\n arrow: HTMLElement | null;\n /**\n * The value of the css `position` property\n * @default absolute\n */\n strategy: Strategy;\n /**\n * [Floating UI middleware](https://floating-ui.com/docs/middleware)\n */\n middleware: Middleware[];\n /**\n * [Floating UI placement](https://floating-ui.com/docs/computePosition#placement)\n */\n placement?: Placement;\n /**\n * Modifies whether popover is positioned using transform.\n * @default true\n */\n useTransform?: boolean;\n}\n\n/**\n * @internal\n * @returns manager that handles positioning out of the react lifecycle\n */\nexport function createPositionManager(options: PositionManagerOptions): PositionManager {\n const { container, target, arrow, strategy, middleware, placement, useTransform = true } = options;\n let isDestroyed = false;\n if (!target || !container) {\n return {\n updatePosition: () => undefined,\n dispose: () => undefined,\n };\n }\n\n let isFirstUpdate = true;\n const scrollParents: Set<HTMLElement> = new Set<HTMLElement>();\n const targetWindow = container.ownerDocument.defaultView;\n\n // When the container is first resolved, set position `fixed` to avoid scroll jumps.\n // Without this scroll jumps can occur when the element is rendered initially and receives focus\n Object.assign(container.style, { position: 'fixed', left: 0, top: 0, margin: 0 });\n\n const forceUpdate = () => {\n // debounced update can still occur afterwards\n // early return to avoid memory leaks\n if (isDestroyed) {\n return;\n }\n\n if (isFirstUpdate) {\n scrollParents.add(getScrollParent(container));\n if (isHTMLElement(target)) {\n scrollParents.add(getScrollParent(target));\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.addEventListener('scroll', updatePosition, { passive: true });\n });\n\n isFirstUpdate = false;\n }\n\n Object.assign(container.style, { position: strategy });\n computePosition(target, container, { placement, middleware, strategy })\n .then(({ x, y, middlewareData, placement: computedPlacement }) => {\n // Promise can still resolve after destruction\n // early return to avoid applying outdated position\n if (isDestroyed) {\n return;\n }\n\n writeArrowUpdates({ arrow, middlewareData });\n writeContainerUpdates({\n container,\n middlewareData,\n placement: computedPlacement,\n coordinates: { x, y },\n lowPPI: (targetWindow?.devicePixelRatio || 1) <= 1,\n strategy,\n useTransform,\n });\n })\n .catch(err => {\n // https://github.com/floating-ui/floating-ui/issues/1845\n // FIXME for node > 14\n // node 15 introduces promise rejection which means that any components\n // tests need to be `it('', async () => {})` otherwise there can be race conditions with\n // JSDOM being torn down before this promise is resolved so globals like `window` and `document` don't exist\n // Unless all tests that ever use `usePositioning` are turned into async tests, any logging during testing\n // will actually be counter productive\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('[usePositioning]: Failed to calculate position', err);\n }\n });\n };\n\n const updatePosition = debounce(() => forceUpdate());\n\n const dispose = () => {\n isDestroyed = true;\n\n if (targetWindow) {\n targetWindow.removeEventListener('scroll', updatePosition);\n targetWindow.removeEventListener('resize', updatePosition);\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.removeEventListener('scroll', updatePosition);\n });\n };\n\n if (targetWindow) {\n targetWindow.addEventListener('scroll', updatePosition, { passive: true });\n targetWindow.addEventListener('resize', updatePosition);\n }\n\n // Update the position on initialization\n updatePosition();\n\n return {\n updatePosition,\n dispose,\n };\n}\n"],"names":["computePosition","debounce","writeArrowUpdates","writeContainerUpdates","getScrollParent","isHTMLElement","createPositionManager","options","container","target","arrow","strategy","middleware","placement","useTransform","isDestroyed","updatePosition","undefined","dispose","isFirstUpdate","scrollParents","Set","targetWindow","ownerDocument","defaultView","Object","assign","style","position","left","top","margin","forceUpdate","add","forEach","scrollParent","addEventListener","passive","then","x","y","middlewareData","computedPlacement","coordinates","lowPPI","devicePixelRatio","catch","err","process","env","NODE_ENV","console","error","removeEventListener"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AAGnD,SAASC,QAAQ,EAAEC,iBAAiB,EAAEC,qBAAqB,EAAEC,eAAe,QAAQ,UAAU;AAC9F,SAASC,aAAa,QAAQ,4BAA4B;AAmC1D;;;CAGC,GACD,OAAO,SAASC,sBAAsBC,OAA+B;IACnE,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,SAAS,EAAEC,eAAe,IAAI,EAAE,GAAGP;IAC3F,IAAIQ,cAAc;IAClB,IAAI,CAACN,UAAU,CAACD,WAAW;QACzB,OAAO;YACLQ,gBAAgB,IAAMC;YACtBC,SAAS,IAAMD;QACjB;IACF;IAEA,IAAIE,gBAAgB;IACpB,MAAMC,gBAAkC,IAAIC;IAC5C,MAAMC,eAAed,UAAUe,aAAa,CAACC,WAAW;IAExD,oFAAoF;IACpF,gGAAgG;IAChGC,OAAOC,MAAM,CAAClB,UAAUmB,KAAK,EAAE;QAAEC,UAAU;QAASC,MAAM;QAAGC,KAAK;QAAGC,QAAQ;IAAE;IAE/E,MAAMC,cAAc;QAClB,8CAA8C;QAC9C,qCAAqC;QACrC,IAAIjB,aAAa;YACf;QACF;QAEA,IAAII,eAAe;YACjBC,cAAca,GAAG,CAAC7B,gBAAgBI;YAClC,IAAIH,cAAcI,SAAS;gBACzBW,cAAca,GAAG,CAAC7B,gBAAgBK;YACpC;YAEAW,cAAcc,OAAO,CAACC,CAAAA;gBACpBA,aAAaC,gBAAgB,CAAC,UAAUpB,gBAAgB;oBAAEqB,SAAS;gBAAK;YAC1E;YAEAlB,gBAAgB;QAClB;QAEAM,OAAOC,MAAM,CAAClB,UAAUmB,KAAK,EAAE;YAAEC,UAAUjB;QAAS;QACpDX,gBAAgBS,QAAQD,WAAW;YAAEK;YAAWD;YAAYD;QAAS,GAClE2B,IAAI,CAAC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,cAAc,EAAE5B,WAAW6B,iBAAiB,EAAE;
|
1
|
+
{"version":3,"sources":["createPositionManager.ts"],"sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport type { Middleware, Placement, Strategy } from '@floating-ui/dom';\nimport type { PositionManager, TargetElement } from './types';\nimport { debounce, writeArrowUpdates, writeContainerUpdates, getScrollParent } from './utils';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n\ninterface PositionManagerOptions {\n /**\n * The positioned element\n */\n container: HTMLElement;\n /**\n * Element that the container will be anchored to\n */\n target: TargetElement;\n /**\n * Arrow that points from the container to the target\n */\n arrow: HTMLElement | null;\n /**\n * The value of the css `position` property\n * @default absolute\n */\n strategy: Strategy;\n /**\n * [Floating UI middleware](https://floating-ui.com/docs/middleware)\n */\n middleware: Middleware[];\n /**\n * [Floating UI placement](https://floating-ui.com/docs/computePosition#placement)\n */\n placement?: Placement;\n /**\n * Modifies whether popover is positioned using transform.\n * @default true\n */\n useTransform?: boolean;\n}\n\n/**\n * @internal\n * @returns manager that handles positioning out of the react lifecycle\n */\nexport function createPositionManager(options: PositionManagerOptions): PositionManager {\n const { container, target, arrow, strategy, middleware, placement, useTransform = true } = options;\n let isDestroyed = false;\n if (!target || !container) {\n return {\n updatePosition: () => undefined,\n dispose: () => undefined,\n };\n }\n\n let isFirstUpdate = true;\n const scrollParents: Set<HTMLElement> = new Set<HTMLElement>();\n const targetWindow = container.ownerDocument.defaultView;\n\n // When the container is first resolved, set position `fixed` to avoid scroll jumps.\n // Without this scroll jumps can occur when the element is rendered initially and receives focus\n Object.assign(container.style, { position: 'fixed', left: 0, top: 0, margin: 0 });\n\n const forceUpdate = () => {\n // debounced update can still occur afterwards\n // early return to avoid memory leaks\n if (isDestroyed) {\n return;\n }\n\n if (isFirstUpdate) {\n scrollParents.add(getScrollParent(container));\n if (isHTMLElement(target)) {\n scrollParents.add(getScrollParent(target));\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.addEventListener('scroll', updatePosition, { passive: true });\n });\n\n isFirstUpdate = false;\n }\n\n Object.assign(container.style, { position: strategy });\n computePosition(target, container, { placement, middleware, strategy })\n .then(({ x, y, middlewareData, placement: computedPlacement }) => {\n // Promise can still resolve after destruction\n // early return to avoid applying outdated position\n if (isDestroyed) {\n return;\n }\n\n writeArrowUpdates({ arrow, middlewareData });\n writeContainerUpdates({\n container,\n middlewareData,\n placement: computedPlacement,\n coordinates: { x, y },\n lowPPI: (targetWindow?.devicePixelRatio || 1) <= 1,\n strategy,\n useTransform,\n });\n })\n .catch(err => {\n // https://github.com/floating-ui/floating-ui/issues/1845\n // FIXME for node > 14\n // node 15 introduces promise rejection which means that any components\n // tests need to be `it('', async () => {})` otherwise there can be race conditions with\n // JSDOM being torn down before this promise is resolved so globals like `window` and `document` don't exist\n // Unless all tests that ever use `usePositioning` are turned into async tests, any logging during testing\n // will actually be counter productive\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('[usePositioning]: Failed to calculate position', err);\n }\n });\n };\n\n const updatePosition = debounce(() => forceUpdate());\n\n const dispose = () => {\n isDestroyed = true;\n\n if (targetWindow) {\n targetWindow.removeEventListener('scroll', updatePosition);\n targetWindow.removeEventListener('resize', updatePosition);\n }\n\n scrollParents.forEach(scrollParent => {\n scrollParent.removeEventListener('scroll', updatePosition);\n });\n };\n\n if (targetWindow) {\n targetWindow.addEventListener('scroll', updatePosition, { passive: true });\n targetWindow.addEventListener('resize', updatePosition);\n }\n\n // Update the position on initialization\n updatePosition();\n\n return {\n updatePosition,\n dispose,\n };\n}\n"],"names":["computePosition","debounce","writeArrowUpdates","writeContainerUpdates","getScrollParent","isHTMLElement","createPositionManager","options","container","target","arrow","strategy","middleware","placement","useTransform","isDestroyed","updatePosition","undefined","dispose","isFirstUpdate","scrollParents","Set","targetWindow","ownerDocument","defaultView","Object","assign","style","position","left","top","margin","forceUpdate","add","forEach","scrollParent","addEventListener","passive","then","x","y","middlewareData","computedPlacement","coordinates","lowPPI","devicePixelRatio","catch","err","process","env","NODE_ENV","console","error","removeEventListener"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AAGnD,SAASC,QAAQ,EAAEC,iBAAiB,EAAEC,qBAAqB,EAAEC,eAAe,QAAQ,UAAU;AAC9F,SAASC,aAAa,QAAQ,4BAA4B;AAmC1D;;;CAGC,GACD,OAAO,SAASC,sBAAsBC,OAA+B;IACnE,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,SAAS,EAAEC,eAAe,IAAI,EAAE,GAAGP;IAC3F,IAAIQ,cAAc;IAClB,IAAI,CAACN,UAAU,CAACD,WAAW;QACzB,OAAO;YACLQ,gBAAgB,IAAMC;YACtBC,SAAS,IAAMD;QACjB;IACF;IAEA,IAAIE,gBAAgB;IACpB,MAAMC,gBAAkC,IAAIC;IAC5C,MAAMC,eAAed,UAAUe,aAAa,CAACC,WAAW;IAExD,oFAAoF;IACpF,gGAAgG;IAChGC,OAAOC,MAAM,CAAClB,UAAUmB,KAAK,EAAE;QAAEC,UAAU;QAASC,MAAM;QAAGC,KAAK;QAAGC,QAAQ;IAAE;IAE/E,MAAMC,cAAc;QAClB,8CAA8C;QAC9C,qCAAqC;QACrC,IAAIjB,aAAa;YACf;QACF;QAEA,IAAII,eAAe;YACjBC,cAAca,GAAG,CAAC7B,gBAAgBI;YAClC,IAAIH,cAAcI,SAAS;gBACzBW,cAAca,GAAG,CAAC7B,gBAAgBK;YACpC;YAEAW,cAAcc,OAAO,CAACC,CAAAA;gBACpBA,aAAaC,gBAAgB,CAAC,UAAUpB,gBAAgB;oBAAEqB,SA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A;IAEA,OAAO;QACLA;QACAE;IACF;AACF"}
|
package/lib/utils/getBoundary.js
CHANGED
@@ -3,8 +3,7 @@ import { getScrollParent } from './getScrollParent';
|
|
3
3
|
* Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.
|
4
4
|
*/ export function getBoundary(element, boundary) {
|
5
5
|
if (boundary === 'window') {
|
6
|
-
|
7
|
-
return (_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.documentElement;
|
6
|
+
return element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
8
7
|
}
|
9
8
|
if (boundary === 'clippingParents') {
|
10
9
|
return 'clippingAncestors';
|
@@ -12,8 +11,7 @@ import { getScrollParent } from './getScrollParent';
|
|
12
11
|
if (boundary === 'scrollParent') {
|
13
12
|
let boundariesNode = getScrollParent(element);
|
14
13
|
if (boundariesNode.nodeName === 'BODY') {
|
15
|
-
|
16
|
-
boundariesNode = (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.ownerDocument.documentElement;
|
14
|
+
boundariesNode = element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
17
15
|
}
|
18
16
|
return boundariesNode;
|
19
17
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["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"],"names":["getScrollParent","getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","nodeName"],"mappings":"AAEA,SAASA,eAAe,QAAQ,oBAAoB;AAGpD;;CAEC,GACD,OAAO,SAASC,YAAYC,OAA2B,EAAEC,QAAmB;IAC1E,IAAIA,aAAa,UAAU;
|
1
|
+
{"version":3,"sources":["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"],"names":["getScrollParent","getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","nodeName"],"mappings":"AAEA,SAASA,eAAe,QAAQ,oBAAoB;AAGpD;;CAEC,GACD,OAAO,SAASC,YAAYC,OAA2B,EAAEC,QAAmB;IAC1E,IAAIA,aAAa,UAAU;QACzB,OAAOD,oBAAAA,8BAAAA,QAASE,aAAa,CAAEC,eAAe;IAChD;IAEA,IAAIF,aAAa,mBAAmB;QAClC,OAAO;IACT;IAEA,IAAIA,aAAa,gBAAgB;QAC/B,IAAIG,iBAA0CN,gBAAgBE;QAE9D,IAAII,eAAeC,QAAQ,KAAK,QAAQ;YACtCD,iBAAiBJ,oBAAAA,8BAAAA,QAASE,aAAa,CAAEC,eAAe;QAC1D;QAEA,OAAOC;IACT;IAEA,OAAOH;AACT"}
|
@@ -57,7 +57,6 @@ function createPositionManager(options) {
|
|
57
57
|
middleware,
|
58
58
|
strategy
|
59
59
|
}).then(({ x, y, middlewareData, placement: computedPlacement })=>{
|
60
|
-
var _targetWindow;
|
61
60
|
// Promise can still resolve after destruction
|
62
61
|
// early return to avoid applying outdated position
|
63
62
|
if (isDestroyed) {
|
@@ -75,7 +74,7 @@ function createPositionManager(options) {
|
|
75
74
|
x,
|
76
75
|
y
|
77
76
|
},
|
78
|
-
lowPPI: ((
|
77
|
+
lowPPI: ((targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.devicePixelRatio) || 1) <= 1,
|
79
78
|
strategy,
|
80
79
|
useTransform
|
81
80
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["createPositionManager.js"],"sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport { debounce, writeArrowUpdates, writeContainerUpdates, getScrollParent } from './utils';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n/**\n * @internal\n * @returns manager that handles positioning out of the react lifecycle\n */ export function createPositionManager(options) {\n const { container, target, arrow, strategy, middleware, placement, useTransform = true } = options;\n let isDestroyed = false;\n if (!target || !container) {\n return {\n updatePosition: ()=>undefined,\n dispose: ()=>undefined\n };\n }\n let isFirstUpdate = true;\n const scrollParents = new Set();\n const targetWindow = container.ownerDocument.defaultView;\n // When the container is first resolved, set position `fixed` to avoid scroll jumps.\n // Without this scroll jumps can occur when the element is rendered initially and receives focus\n Object.assign(container.style, {\n position: 'fixed',\n left: 0,\n top: 0,\n margin: 0\n });\n const forceUpdate = ()=>{\n // debounced update can still occur afterwards\n // early return to avoid memory leaks\n if (isDestroyed) {\n return;\n }\n if (isFirstUpdate) {\n scrollParents.add(getScrollParent(container));\n if (isHTMLElement(target)) {\n scrollParents.add(getScrollParent(target));\n }\n scrollParents.forEach((scrollParent)=>{\n scrollParent.addEventListener('scroll', updatePosition, {\n passive: true\n });\n });\n isFirstUpdate = false;\n }\n Object.assign(container.style, {\n position: strategy\n });\n computePosition(target, container, {\n placement,\n middleware,\n strategy\n }).then(({ x, y, middlewareData, placement: computedPlacement })=>{\n
|
1
|
+
{"version":3,"sources":["createPositionManager.js"],"sourcesContent":["import { computePosition } from '@floating-ui/dom';\nimport { debounce, writeArrowUpdates, writeContainerUpdates, getScrollParent } from './utils';\nimport { isHTMLElement } from '@fluentui/react-utilities';\n/**\n * @internal\n * @returns manager that handles positioning out of the react lifecycle\n */ export function createPositionManager(options) {\n const { container, target, arrow, strategy, middleware, placement, useTransform = true } = options;\n let isDestroyed = false;\n if (!target || !container) {\n return {\n updatePosition: ()=>undefined,\n dispose: ()=>undefined\n };\n }\n let isFirstUpdate = true;\n const scrollParents = new Set();\n const targetWindow = container.ownerDocument.defaultView;\n // When the container is first resolved, set position `fixed` to avoid scroll jumps.\n // Without this scroll jumps can occur when the element is rendered initially and receives focus\n Object.assign(container.style, {\n position: 'fixed',\n left: 0,\n top: 0,\n margin: 0\n });\n const forceUpdate = ()=>{\n // debounced update can still occur afterwards\n // early return to avoid memory leaks\n if (isDestroyed) {\n return;\n }\n if (isFirstUpdate) {\n scrollParents.add(getScrollParent(container));\n if (isHTMLElement(target)) {\n scrollParents.add(getScrollParent(target));\n }\n scrollParents.forEach((scrollParent)=>{\n scrollParent.addEventListener('scroll', updatePosition, {\n passive: true\n });\n });\n isFirstUpdate = false;\n }\n Object.assign(container.style, {\n position: strategy\n });\n computePosition(target, container, {\n placement,\n middleware,\n strategy\n }).then(({ x, y, middlewareData, placement: computedPlacement })=>{\n // Promise can still resolve after destruction\n // early return to avoid applying outdated position\n if (isDestroyed) {\n return;\n }\n writeArrowUpdates({\n arrow,\n middlewareData\n });\n writeContainerUpdates({\n container,\n middlewareData,\n placement: computedPlacement,\n coordinates: {\n x,\n y\n },\n lowPPI: ((targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.devicePixelRatio) || 1) <= 1,\n strategy,\n useTransform\n });\n }).catch((err)=>{\n // https://github.com/floating-ui/floating-ui/issues/1845\n // FIXME for node > 14\n // node 15 introduces promise rejection which means that any components\n // tests need to be `it('', async () => {})` otherwise there can be race conditions with\n // JSDOM being torn down before this promise is resolved so globals like `window` and `document` don't exist\n // Unless all tests that ever use `usePositioning` are turned into async tests, any logging during testing\n // will actually be counter productive\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error('[usePositioning]: Failed to calculate position', err);\n }\n });\n };\n const updatePosition = debounce(()=>forceUpdate());\n const dispose = ()=>{\n isDestroyed = true;\n if (targetWindow) {\n targetWindow.removeEventListener('scroll', updatePosition);\n targetWindow.removeEventListener('resize', updatePosition);\n }\n scrollParents.forEach((scrollParent)=>{\n scrollParent.removeEventListener('scroll', updatePosition);\n });\n };\n if (targetWindow) {\n targetWindow.addEventListener('scroll', updatePosition, {\n passive: true\n });\n targetWindow.addEventListener('resize', updatePosition);\n }\n // Update the position on initialization\n updatePosition();\n return {\n updatePosition,\n dispose\n };\n}\n"],"names":["createPositionManager","options","container","target","arrow","strategy","middleware","placement","useTransform","isDestroyed","updatePosition","undefined","dispose","isFirstUpdate","scrollParents","Set","targetWindow","ownerDocument","defaultView","Object","assign","style","position","left","top","margin","forceUpdate","add","getScrollParent","isHTMLElement","forEach","scrollParent","addEventListener","passive","computePosition","then","x","y","middlewareData","computedPlacement","writeArrowUpdates","writeContainerUpdates","coordinates","lowPPI","devicePixelRatio","catch","err","process","env","NODE_ENV","console","error","debounce","removeEventListener"],"mappings":";;;;+BAMoBA;;;eAAAA;;;qBANY;uBACoD;gCACtD;AAInB,SAASA,sBAAsBC,OAAO;IAC7C,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,SAAS,EAAEC,eAAe,IAAI,EAAE,GAAGP;IAC3F,IAAIQ,cAAc;IAClB,IAAI,CAACN,UAAU,CAACD,WAAW;QACvB,OAAO;YACHQ,gBAAgB,IAAIC;YACpBC,SAAS,IAAID;QACjB;IACJ;IACA,IAAIE,gBAAgB;IACpB,MAAMC,gBAAgB,IAAIC;IAC1B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AwF;YACxF,4GAA4G;YAC5G,0GAA0G;YAC1G,sCAAsC;YACtC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;gBACxC,sCAAsC;gBACtCC,QAAQC,KAAK,CAAC,kDAAkDL;YACpE;QACJ;IACJ;IACA,MAAMpC,iBAAiB0C,IAAAA,eAAQ,EAAC,IAAI1B;IACpC,MAAMd,UAAU;QACZH,cAAc;QACd,IAAIO,cAAc;YACdA,aAAaqC,mBAAmB,CAAC,UAAU3C;YAC3CM,aAAaqC,mBAAmB,CAAC,UAAU3C;QAC/C;QACAI,cAAcgB,OAAO,CAAC,CAACC;YACnBA,aAAasB,mBAAmB,CAAC,UAAU3C;QAC/C;IACJ;IACA,IAAIM,cAAc;QACdA,aAAagB,gBAAgB,CAAC,UAAUtB,gBAAgB;YACpDuB,SAAS;QACb;QACAjB,aAAagB,gBAAgB,CAAC,UAAUtB;IAC5C;IACA,wCAAwC;IACxCA;IACA,OAAO;QACHA;QACAE;IACJ;AACJ"}
|
@@ -11,8 +11,7 @@ Object.defineProperty(exports, "getBoundary", {
|
|
11
11
|
const _getScrollParent = require("./getScrollParent");
|
12
12
|
function getBoundary(element, boundary) {
|
13
13
|
if (boundary === 'window') {
|
14
|
-
|
15
|
-
return (_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.documentElement;
|
14
|
+
return element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
16
15
|
}
|
17
16
|
if (boundary === 'clippingParents') {
|
18
17
|
return 'clippingAncestors';
|
@@ -20,8 +19,7 @@ function getBoundary(element, boundary) {
|
|
20
19
|
if (boundary === 'scrollParent') {
|
21
20
|
let boundariesNode = (0, _getScrollParent.getScrollParent)(element);
|
22
21
|
if (boundariesNode.nodeName === 'BODY') {
|
23
|
-
|
24
|
-
boundariesNode = (_element1 = element) === null || _element1 === void 0 ? void 0 : _element1.ownerDocument.documentElement;
|
22
|
+
boundariesNode = element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
25
23
|
}
|
26
24
|
return boundariesNode;
|
27
25
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["getBoundary.js"],"sourcesContent":["import { getScrollParent } from './getScrollParent';\n/**\n * Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.\n */ export function getBoundary(element, boundary) {\n if (boundary === 'window') {\n
|
1
|
+
{"version":3,"sources":["getBoundary.js"],"sourcesContent":["import { getScrollParent } from './getScrollParent';\n/**\n * Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.\n */ export function getBoundary(element, boundary) {\n if (boundary === 'window') {\n return element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;\n }\n if (boundary === 'clippingParents') {\n return 'clippingAncestors';\n }\n if (boundary === 'scrollParent') {\n let boundariesNode = getScrollParent(element);\n if (boundariesNode.nodeName === 'BODY') {\n boundariesNode = element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;\n }\n return boundariesNode;\n }\n return boundary;\n}\n"],"names":["getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","getScrollParent","nodeName"],"mappings":";;;;+BAGoBA;;;eAAAA;;;iCAHY;AAGrB,SAASA,YAAYC,OAAO,EAAEC,QAAQ;IAC7C,IAAIA,aAAa,UAAU;QACvB,OAAOD,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQE,aAAa,CAACC,eAAe;IAClG;IACA,IAAIF,aAAa,mBAAmB;QAChC,OAAO;IACX;IACA,IAAIA,aAAa,gBAAgB;QAC7B,IAAIG,iBAAiBC,IAAAA,gCAAe,EAACL;QACrC,IAAII,eAAeE,QAAQ,KAAK,QAAQ;YACpCF,iBAAiBJ,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQE,aAAa,CAACC,eAAe;QAC5G;QACA,OAAOC;IACX;IACA,OAAOH;AACX"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-positioning",
|
3
|
-
"version": "9.9.
|
3
|
+
"version": "9.9.14",
|
4
4
|
"description": "A react wrapper around Popper.js for Fluent UI",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -30,9 +30,9 @@
|
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
32
|
"@floating-ui/dom": "^1.2.0",
|
33
|
-
"@fluentui/react-shared-contexts": "^9.
|
34
|
-
"@fluentui/react-theme": "^9.1.
|
35
|
-
"@fluentui/react-utilities": "^9.13.
|
33
|
+
"@fluentui/react-shared-contexts": "^9.9.0",
|
34
|
+
"@fluentui/react-theme": "^9.1.13",
|
35
|
+
"@fluentui/react-utilities": "^9.13.4",
|
36
36
|
"@griffel/react": "^1.5.14",
|
37
37
|
"@swc/helpers": "^0.5.1"
|
38
38
|
},
|