@fluentui/react-positioning 0.0.0-nightly-20230316-0427.1 → 0.0.0-nightly-20230317-1454.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/.swcrc +39 -0
  2. package/CHANGELOG.json +24 -9
  3. package/CHANGELOG.md +16 -7
  4. package/lib/constants.js +4 -4
  5. package/lib/constants.js.map +1 -1
  6. package/lib/createArrowStyles.js +19 -19
  7. package/lib/createArrowStyles.js.map +1 -1
  8. package/lib/createPositionManager.js +13 -13
  9. package/lib/createPositionManager.js.map +1 -1
  10. package/lib/createVirtualElementFromClick.js +1 -2
  11. package/lib/createVirtualElementFromClick.js.map +1 -1
  12. package/lib/index.js +5 -5
  13. package/lib/index.js.map +1 -1
  14. package/lib/middleware/coverTarget.js +6 -6
  15. package/lib/middleware/coverTarget.js.map +1 -1
  16. package/lib/middleware/flip.js +4 -4
  17. package/lib/middleware/flip.js.map +1 -1
  18. package/lib/middleware/index.js +6 -6
  19. package/lib/middleware/index.js.map +1 -1
  20. package/lib/middleware/intersecting.js +2 -2
  21. package/lib/middleware/intersecting.js.map +1 -1
  22. package/lib/middleware/maxSize.js +8 -8
  23. package/lib/middleware/maxSize.js.map +1 -1
  24. package/lib/middleware/offset.js +2 -2
  25. package/lib/middleware/offset.js.map +1 -1
  26. package/lib/middleware/shift.js +5 -5
  27. package/lib/middleware/shift.js.map +1 -1
  28. package/lib/types.js +1 -1
  29. package/lib/types.js.map +1 -1
  30. package/lib/usePositioning.js +20 -26
  31. package/lib/usePositioning.js.map +1 -1
  32. package/lib/usePositioningMouseTarget.js +4 -4
  33. package/lib/usePositioningMouseTarget.js.map +1 -1
  34. package/lib/utils/debounce.js +1 -2
  35. package/lib/utils/debounce.js.map +1 -1
  36. package/lib/utils/fromFloatingUIPlacement.js +10 -10
  37. package/lib/utils/fromFloatingUIPlacement.js.map +1 -1
  38. package/lib/utils/getBoundary.js +8 -8
  39. package/lib/utils/getBoundary.js.map +1 -1
  40. package/lib/utils/getFloatingUIOffset.js +2 -2
  41. package/lib/utils/getFloatingUIOffset.js.map +1 -1
  42. package/lib/utils/getReactFiberFromNode.js +3 -2
  43. package/lib/utils/getReactFiberFromNode.js.map +1 -1
  44. package/lib/utils/getScrollParent.js +7 -10
  45. package/lib/utils/getScrollParent.js.map +1 -1
  46. package/lib/utils/hasAutoFocusFilter.js +3 -4
  47. package/lib/utils/hasAutoFocusFilter.js.map +1 -1
  48. package/lib/utils/index.js +15 -15
  49. package/lib/utils/index.js.map +1 -1
  50. package/lib/utils/mergeArrowOffset.js +6 -8
  51. package/lib/utils/mergeArrowOffset.js.map +1 -1
  52. package/lib/utils/parseFloatingUIPlacement.js +2 -3
  53. package/lib/utils/parseFloatingUIPlacement.js.map +1 -1
  54. package/lib/utils/resolvePositioningShorthand.js +33 -33
  55. package/lib/utils/resolvePositioningShorthand.js.map +1 -1
  56. package/lib/utils/toFloatingUIPadding.js +3 -3
  57. package/lib/utils/toFloatingUIPadding.js.map +1 -1
  58. package/lib/utils/toFloatingUIPlacement.js +11 -11
  59. package/lib/utils/toFloatingUIPlacement.js.map +1 -1
  60. package/lib/utils/toggleScrollListener.js +4 -4
  61. package/lib/utils/toggleScrollListener.js.map +1 -1
  62. package/lib/utils/useCallbackRef.js +2 -2
  63. package/lib/utils/useCallbackRef.js.map +1 -1
  64. package/lib/utils/writeArrowUpdates.js +1 -2
  65. package/lib/utils/writeArrowUpdates.js.map +1 -1
  66. package/lib/utils/writeContainerupdates.js +7 -8
  67. package/lib/utils/writeContainerupdates.js.map +1 -1
  68. package/lib-commonjs/constants.js +18 -7
  69. package/lib-commonjs/constants.js.map +1 -1
  70. package/lib-commonjs/createArrowStyles.js +60 -88
  71. package/lib-commonjs/createArrowStyles.js.map +1 -1
  72. package/lib-commonjs/createPositionManager.js +103 -117
  73. package/lib-commonjs/createPositionManager.js.map +1 -1
  74. package/lib-commonjs/createVirtualElementFromClick.js +27 -26
  75. package/lib-commonjs/createVirtualElementFromClick.js.map +1 -1
  76. package/lib-commonjs/index.js +24 -51
  77. package/lib-commonjs/index.js.map +1 -1
  78. package/lib-commonjs/middleware/coverTarget.js +34 -37
  79. package/lib-commonjs/middleware/coverTarget.js.map +1 -1
  80. package/lib-commonjs/middleware/flip.js +31 -38
  81. package/lib-commonjs/middleware/flip.js.map +1 -1
  82. package/lib-commonjs/middleware/index.js +10 -9
  83. package/lib-commonjs/middleware/index.js.map +1 -1
  84. package/lib-commonjs/middleware/intersecting.js +24 -22
  85. package/lib-commonjs/middleware/intersecting.js.map +1 -1
  86. package/lib-commonjs/middleware/maxSize.js +34 -40
  87. package/lib-commonjs/middleware/maxSize.js.map +1 -1
  88. package/lib-commonjs/middleware/offset.js +11 -12
  89. package/lib-commonjs/middleware/offset.js.map +1 -1
  90. package/lib-commonjs/middleware/shift.js +29 -37
  91. package/lib-commonjs/middleware/shift.js.map +1 -1
  92. package/lib-commonjs/types.js +5 -2
  93. package/lib-commonjs/types.js.map +1 -1
  94. package/lib-commonjs/usePositioning.js +192 -164
  95. package/lib-commonjs/usePositioning.js.map +1 -1
  96. package/lib-commonjs/usePositioningMouseTarget.js +34 -37
  97. package/lib-commonjs/usePositioningMouseTarget.js.map +1 -1
  98. package/lib-commonjs/utils/debounce.js +22 -21
  99. package/lib-commonjs/utils/debounce.js.map +1 -1
  100. package/lib-commonjs/utils/fromFloatingUIPlacement.js +30 -35
  101. package/lib-commonjs/utils/fromFloatingUIPlacement.js.map +1 -1
  102. package/lib-commonjs/utils/getBoundary.js +21 -22
  103. package/lib-commonjs/utils/getBoundary.js.map +1 -1
  104. package/lib-commonjs/utils/getFloatingUIOffset.js +23 -35
  105. package/lib-commonjs/utils/getFloatingUIOffset.js.map +1 -1
  106. package/lib-commonjs/utils/getReactFiberFromNode.js +45 -41
  107. package/lib-commonjs/utils/getReactFiberFromNode.js.map +1 -1
  108. package/lib-commonjs/utils/getScrollParent.js +50 -56
  109. package/lib-commonjs/utils/getScrollParent.js.map +1 -1
  110. package/lib-commonjs/utils/hasAutoFocusFilter.js +17 -17
  111. package/lib-commonjs/utils/hasAutoFocusFilter.js.map +1 -1
  112. package/lib-commonjs/utils/index.js +19 -18
  113. package/lib-commonjs/utils/index.js.map +1 -1
  114. package/lib-commonjs/utils/mergeArrowOffset.js +32 -32
  115. package/lib-commonjs/utils/mergeArrowOffset.js.map +1 -1
  116. package/lib-commonjs/utils/parseFloatingUIPlacement.js +15 -14
  117. package/lib-commonjs/utils/parseFloatingUIPlacement.js.map +1 -1
  118. package/lib-commonjs/utils/resolvePositioningShorthand.js +63 -61
  119. package/lib-commonjs/utils/resolvePositioningShorthand.js.map +1 -1
  120. package/lib-commonjs/utils/toFloatingUIPadding.js +23 -25
  121. package/lib-commonjs/utils/toFloatingUIPadding.js.map +1 -1
  122. package/lib-commonjs/utils/toFloatingUIPlacement.js +31 -33
  123. package/lib-commonjs/utils/toFloatingUIPlacement.js.map +1 -1
  124. package/lib-commonjs/utils/toggleScrollListener.js +20 -24
  125. package/lib-commonjs/utils/toggleScrollListener.js.map +1 -1
  126. package/lib-commonjs/utils/useCallbackRef.js +39 -53
  127. package/lib-commonjs/utils/useCallbackRef.js.map +1 -1
  128. package/lib-commonjs/utils/writeArrowUpdates.js +19 -24
  129. package/lib-commonjs/utils/writeArrowUpdates.js.map +1 -1
  130. package/lib-commonjs/utils/writeContainerupdates.js +36 -45
  131. package/lib-commonjs/utils/writeContainerupdates.js.map +1 -1
  132. package/package.json +6 -6
@@ -1,41 +1,38 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "usePositioningMouseTarget", {
6
+ enumerable: true,
7
+ get: ()=>usePositioningMouseTarget
5
8
  });
6
- exports.usePositioningMouseTarget = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const createVirtualElementFromClick_1 = /*#__PURE__*/require("./createVirtualElementFromClick");
9
- /**
10
- * @internal
11
- * A state hook that manages a popper virtual element from mouseevents.
12
- * Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)
13
- * React synthetic events are not persisted by this hook
14
- *
15
- * @param initialState - initializes a user provided state similare to useState
16
- * @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events
17
- */
18
- const usePositioningMouseTarget = initialState => {
19
- const [virtualElement, setVirtualElement] = React.useState(initialState);
20
- const setVirtualMouseTarget = event => {
21
- if (event === undefined || event === null) {
22
- setVirtualElement(undefined);
23
- return;
24
- }
25
- let mouseevent;
26
- if (!(event instanceof MouseEvent)) {
27
- mouseevent = event.nativeEvent;
28
- } else {
29
- mouseevent = event;
30
- }
31
- if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {
32
- // eslint-disable-next-line no-console
33
- console.error('usePositioningMouseTarget should only be used with MouseEvent');
34
- }
35
- const contextTarget = createVirtualElementFromClick_1.createVirtualElementFromClick(mouseevent);
36
- setVirtualElement(contextTarget);
37
- };
38
- return [virtualElement, setVirtualMouseTarget];
39
- };
40
- exports.usePositioningMouseTarget = usePositioningMouseTarget;
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _createVirtualElementFromClick = require("./createVirtualElementFromClick");
12
+ const usePositioningMouseTarget = (initialState)=>{
13
+ const [virtualElement, setVirtualElement] = _react.useState(initialState);
14
+ const setVirtualMouseTarget = (event)=>{
15
+ if (event === undefined || event === null) {
16
+ setVirtualElement(undefined);
17
+ return;
18
+ }
19
+ let mouseevent;
20
+ if (!(event instanceof MouseEvent)) {
21
+ mouseevent = event.nativeEvent;
22
+ } else {
23
+ mouseevent = event;
24
+ }
25
+ if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== "production") {
26
+ // eslint-disable-next-line no-console
27
+ console.error("usePositioningMouseTarget should only be used with MouseEvent");
28
+ }
29
+ const contextTarget = (0, _createVirtualElementFromClick.createVirtualElementFromClick)(mouseevent);
30
+ setVirtualElement(contextTarget);
31
+ };
32
+ return [
33
+ virtualElement,
34
+ setVirtualMouseTarget
35
+ ];
36
+ }; //# sourceMappingURL=usePositioningMouseTarget.js.map
37
+
41
38
  //# sourceMappingURL=usePositioningMouseTarget.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","createVirtualElementFromClick_1","usePositioningMouseTarget","initialState","virtualElement","setVirtualElement","useState","setVirtualMouseTarget","event","undefined","mouseevent","MouseEvent","nativeEvent","process","env","NODE_ENV","console","error","contextTarget","createVirtualElementFromClick","exports"],"sources":["../../../../../../../packages/react-components/react-positioning/src/usePositioningMouseTarget.ts"],"sourcesContent":["import * as React from 'react';\nimport { createVirtualElementFromClick } from './createVirtualElementFromClick';\nimport { PositioningVirtualElement, SetVirtualMouseTarget } from './types';\n\n/**\n * @internal\n * A state hook that manages a popper virtual element from mouseevents.\n * Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)\n * React synthetic events are not persisted by this hook\n *\n * @param initialState - initializes a user provided state similare to useState\n * @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events\n */\nexport const usePositioningMouseTarget = (\n initialState?: PositioningVirtualElement | (() => PositioningVirtualElement),\n) => {\n const [virtualElement, setVirtualElement] = React.useState<PositioningVirtualElement | undefined>(initialState);\n\n const setVirtualMouseTarget: SetVirtualMouseTarget = event => {\n if (event === undefined || event === null) {\n setVirtualElement(undefined);\n return;\n }\n\n let mouseevent: MouseEvent;\n if (!(event instanceof MouseEvent)) {\n mouseevent = event.nativeEvent;\n } else {\n mouseevent = event;\n }\n\n if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line no-console\n console.error('usePositioningMouseTarget should only be used with MouseEvent');\n }\n\n const contextTarget = createVirtualElementFromClick(mouseevent);\n setVirtualElement(contextTarget);\n };\n\n return [virtualElement, setVirtualMouseTarget] as const;\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,+BAAA,gBAAAD,OAAA;AAGA;;;;;;;;;AASO,MAAME,yBAAyB,GACpCC,YAA4E,IAC1E;EACF,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAAwCH,YAAY,CAAC;EAE/G,MAAMI,qBAAqB,GAA0BC,KAAK,IAAG;IAC3D,IAAIA,KAAK,KAAKC,SAAS,IAAID,KAAK,KAAK,IAAI,EAAE;MACzCH,iBAAiB,CAACI,SAAS,CAAC;MAC5B;;IAGF,IAAIC,UAAsB;IAC1B,IAAI,EAAEF,KAAK,YAAYG,UAAU,CAAC,EAAE;MAClCD,UAAU,GAAGF,KAAK,CAACI,WAAW;KAC/B,MAAM;MACLF,UAAU,GAAGF,KAAK;;IAGpB,IAAI,EAAEE,UAAU,YAAYC,UAAU,CAAC,IAAIE,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;MAChF;MACAC,OAAO,CAACC,KAAK,CAAC,+DAA+D,CAAC;;IAGhF,MAAMC,aAAa,GAAGjB,+BAAA,CAAAkB,6BAA6B,CAACT,UAAU,CAAC;IAC/DL,iBAAiB,CAACa,aAAa,CAAC;EAClC,CAAC;EAED,OAAO,CAACd,cAAc,EAAEG,qBAAqB,CAAU;AACzD,CAAC;AA5BYa,OAAA,CAAAlB,yBAAyB,GAAAA,yBAAA"}
1
+ {"version":3,"sources":["../lib/usePositioningMouseTarget.js"],"sourcesContent":["import * as React from \"react\";\nimport { createVirtualElementFromClick } from \"./createVirtualElementFromClick\";\n/**\n * @internal\n * A state hook that manages a popper virtual element from mouseevents.\n * Useful for scenarios where a component needs to be positioned by mouse click (e.g. contextmenu)\n * React synthetic events are not persisted by this hook\n *\n * @param initialState - initializes a user provided state similare to useState\n * @returns state and dispatcher for a Popper virtual element that uses native/synthetic mouse events\n */\nexport const usePositioningMouseTarget = initialState => {\n const [virtualElement, setVirtualElement] = React.useState(initialState);\n const setVirtualMouseTarget = event => {\n if (event === undefined || event === null) {\n setVirtualElement(undefined);\n return;\n }\n let mouseevent;\n if (!(event instanceof MouseEvent)) {\n mouseevent = event.nativeEvent;\n } else {\n mouseevent = event;\n }\n if (!(mouseevent instanceof MouseEvent) && process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.error(\"usePositioningMouseTarget should only be used with MouseEvent\");\n }\n const contextTarget = createVirtualElementFromClick(mouseevent);\n setVirtualElement(contextTarget);\n };\n return [virtualElement, setVirtualMouseTarget];\n};\n//# sourceMappingURL=usePositioningMouseTarget.js.map"],"names":["usePositioningMouseTarget","initialState","virtualElement","setVirtualElement","React","useState","setVirtualMouseTarget","event","undefined","mouseevent","MouseEvent","nativeEvent","process","env","NODE_ENV","console","error","contextTarget","createVirtualElementFromClick"],"mappings":";;;;+BAWaA;;aAAAA;;;6DAXU;+CACuB;AAUvC,MAAMA,4BAA4BC,CAAAA,eAAgB;IACvD,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGC,OAAMC,QAAQ,CAACJ;IAC3D,MAAMK,wBAAwBC,CAAAA,QAAS;QACrC,IAAIA,UAAUC,aAAaD,UAAU,IAAI,EAAE;YACzCJ,kBAAkBK;YAClB;QACF,CAAC;QACD,IAAIC;QACJ,IAAI,CAAEF,CAAAA,iBAAiBG,UAAS,GAAI;YAClCD,aAAaF,MAAMI,WAAW;QAChC,OAAO;YACLF,aAAaF;QACf,CAAC;QACD,IAAI,CAAEE,CAAAA,sBAAsBC,UAAS,KAAME,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YAChF,sCAAsC;YACtCC,QAAQC,KAAK,CAAC;QAChB,CAAC;QACD,MAAMC,gBAAgBC,IAAAA,4DAA6B,EAACT;QACpDN,kBAAkBc;IACpB;IACA,OAAO;QAACf;QAAgBI;KAAsB;AAChD,GACA,qDAAqD"}
@@ -1,28 +1,29 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.debounce = void 0;
7
1
  /**
8
2
  * Promise microtask debouncer used by Popper.js v2
9
3
  * This is no longer exported in Floating UI (Popper.js v3)
10
4
  * https://github.com/floating-ui/floating-ui/blob/v2.x/src/utils/debounce.js
11
5
  * @param fn function that will be debounced
12
- */
6
+ */ "use strict";
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ Object.defineProperty(exports, "debounce", {
11
+ enumerable: true,
12
+ get: ()=>debounce
13
+ });
13
14
  function debounce(fn) {
14
- let pending;
15
- return () => {
16
- if (!pending) {
17
- pending = new Promise(resolve => {
18
- Promise.resolve().then(() => {
19
- pending = undefined;
20
- resolve(fn());
21
- });
22
- });
23
- }
24
- return pending;
25
- };
26
- }
27
- exports.debounce = debounce;
15
+ let pending;
16
+ return ()=>{
17
+ if (!pending) {
18
+ pending = new Promise((resolve)=>{
19
+ Promise.resolve().then(()=>{
20
+ pending = undefined;
21
+ resolve(fn());
22
+ });
23
+ });
24
+ }
25
+ return pending;
26
+ };
27
+ } //# sourceMappingURL=debounce.js.map
28
+
28
29
  //# sourceMappingURL=debounce.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["debounce","fn","pending","Promise","resolve","then","undefined","exports"],"sources":["../../../../../../../../packages/react-components/react-positioning/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;;;;;;AAMA,SAAgBA,QAAQA,CAAIC,EAAY;EACtC,IAAIC,OAA+B;EACnC,OAAO,MAAK;IACV,IAAI,CAACA,OAAO,EAAE;MACZA,OAAO,GAAG,IAAIC,OAAO,CAAIC,OAAO,IAAG;QACjCD,OAAO,CAACC,OAAO,EAAE,CAACC,IAAI,CAAC,MAAK;UAC1BH,OAAO,GAAGI,SAAS;UACnBF,OAAO,CAACH,EAAE,EAAE,CAAC;QACf,CAAC,CAAC;MACJ,CAAC,CAAC;;IAGJ,OAAOC,OAAO;EAChB,CAAC;AACH;AAdAK,OAAA,CAAAP,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"sources":["../../lib/utils/debounce.js"],"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 */export function debounce(fn) {\n let pending;\n return () => {\n if (!pending) {\n pending = new Promise(resolve => {\n Promise.resolve().then(() => {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n return pending;\n };\n}\n//# sourceMappingURL=debounce.js.map"],"names":["debounce","fn","pending","Promise","resolve","then","undefined"],"mappings":"AAAA;;;;;CAKC;;;;+BAAkBA;;aAAAA;;AAAT,SAASA,SAASC,EAAE,EAAE;IAC9B,IAAIC;IACJ,OAAO,IAAM;QACX,IAAI,CAACA,SAAS;YACZA,UAAU,IAAIC,QAAQC,CAAAA,UAAW;gBAC/BD,QAAQC,OAAO,GAAGC,IAAI,CAAC,IAAM;oBAC3BH,UAAUI;oBACVF,QAAQH;gBACV;YACF;QACF,CAAC;QACD,OAAOC;IACT;AACF,EACA,oCAAoC"}
@@ -1,45 +1,40 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.fromFloatingUIPlacement = void 0;
7
- const parseFloatingUIPlacement_1 = /*#__PURE__*/require("./parseFloatingUIPlacement");
8
- const getPositionMap = () => ({
9
- top: 'above',
10
- bottom: 'below',
11
- right: 'after',
12
- left: 'before'
5
+ Object.defineProperty(exports, "fromFloatingUIPlacement", {
6
+ enumerable: true,
7
+ get: ()=>fromFloatingUIPlacement
13
8
  });
9
+ const _parseFloatingUIPlacement = require("./parseFloatingUIPlacement");
10
+ const getPositionMap = ()=>({
11
+ top: "above",
12
+ bottom: "below",
13
+ right: "after",
14
+ left: "before"
15
+ });
14
16
  // Floating UI automatically flips alignment
15
17
  // https://github.com/floating-ui/floating-ui/issues/1563
16
- const getAlignmentMap = position => {
17
- if (position === 'above' || position === 'below') {
18
+ const getAlignmentMap = (position)=>{
19
+ if (position === "above" || position === "below") {
20
+ return {
21
+ start: "start",
22
+ end: "end"
23
+ };
24
+ }
18
25
  return {
19
- start: 'start',
20
- end: 'end'
26
+ start: "top",
27
+ end: "bottom"
21
28
  };
22
- }
23
- return {
24
- start: 'top',
25
- end: 'bottom'
26
- };
27
- };
28
- /**
29
- * Maps Floating UI placement to positioning values
30
- * @see positioningHelper.test.ts for expected placement values
31
- */
32
- const fromFloatingUIPlacement = placement => {
33
- const {
34
- side,
35
- alignment: floatingUIAlignment
36
- } = parseFloatingUIPlacement_1.parseFloatingUIPlacement(placement);
37
- const position = getPositionMap()[side];
38
- const alignment = floatingUIAlignment && getAlignmentMap(position)[floatingUIAlignment];
39
- return {
40
- position,
41
- alignment
42
- };
43
29
  };
44
- exports.fromFloatingUIPlacement = fromFloatingUIPlacement;
30
+ const fromFloatingUIPlacement = (placement)=>{
31
+ const { side , alignment: floatingUIAlignment } = (0, _parseFloatingUIPlacement.parseFloatingUIPlacement)(placement);
32
+ const position = getPositionMap()[side];
33
+ const alignment = floatingUIAlignment && getAlignmentMap(position)[floatingUIAlignment];
34
+ return {
35
+ position,
36
+ alignment
37
+ };
38
+ }; //# sourceMappingURL=fromFloatingUIPlacement.js.map
39
+
45
40
  //# sourceMappingURL=fromFloatingUIPlacement.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["parseFloatingUIPlacement_1","require","getPositionMap","top","bottom","right","left","getAlignmentMap","position","start","end","fromFloatingUIPlacement","placement","side","alignment","floatingUIAlignment","parseFloatingUIPlacement","exports"],"sources":["../../../../../../../../packages/react-components/react-positioning/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,MAAAA,0BAAA,gBAAAC,OAAA;AAEA,MAAMC,cAAc,GAAGA,CAAA,MAA+B;EACpDC,GAAG,EAAE,OAAO;EACZC,MAAM,EAAE,OAAO;EACfC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE;CACP,CAAC;AAEF;AACA;AACA,MAAMC,eAAe,GAAIC,QAAkB,IAA4C;EACrF,IAAIA,QAAQ,KAAK,OAAO,IAAIA,QAAQ,KAAK,OAAO,EAAE;IAChD,OAAO;MACLC,KAAK,EAAE,OAAO;MACdC,GAAG,EAAE;KACN;;EAGH,OAAO;IACLD,KAAK,EAAE,KAAK;IACZC,GAAG,EAAE;GACN;AACH,CAAC;AAED;;;;AAIO,MAAMC,uBAAuB,GAAIC,SAAoB,IAAmD;EAC7G,MAAM;IAAEC,IAAI;IAAEC,SAAS,EAAEC;EAAmB,CAAE,GAAGf,0BAAA,CAAAgB,wBAAwB,CAACJ,SAAS,CAAC;EACpF,MAAMJ,QAAQ,GAAGN,cAAc,EAAE,CAACW,IAAI,CAAC;EACvC,MAAMC,SAAS,GAAGC,mBAAmB,IAAIR,eAAe,CAACC,QAAQ,CAAC,CAACO,mBAAmB,CAAC;EAEvF,OAAO;IAAEP,QAAQ;IAAEM;EAAS,CAAE;AAChC,CAAC;AANYG,OAAA,CAAAN,uBAAuB,GAAAA,uBAAA"}
1
+ {"version":3,"sources":["../../lib/utils/fromFloatingUIPlacement.js"],"sourcesContent":["import { parseFloatingUIPlacement } from \"./parseFloatingUIPlacement\";\nconst getPositionMap = () => ({\n top: \"above\",\n bottom: \"below\",\n right: \"after\",\n left: \"before\"\n});\n// Floating UI automatically flips alignment\n// https://github.com/floating-ui/floating-ui/issues/1563\nconst getAlignmentMap = position => {\n if (position === \"above\" || position === \"below\") {\n return {\n start: \"start\",\n end: \"end\"\n };\n }\n return {\n start: \"top\",\n end: \"bottom\"\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 => {\n const {\n side,\n alignment: floatingUIAlignment\n } = parseFloatingUIPlacement(placement);\n const position = getPositionMap()[side];\n const alignment = floatingUIAlignment && getAlignmentMap(position)[floatingUIAlignment];\n return {\n position,\n alignment\n };\n};\n//# sourceMappingURL=fromFloatingUIPlacement.js.map"],"names":["fromFloatingUIPlacement","getPositionMap","top","bottom","right","left","getAlignmentMap","position","start","end","placement","side","alignment","floatingUIAlignment","parseFloatingUIPlacement"],"mappings":";;;;+BAyBaA;;aAAAA;;0CAzB4B;AACzC,MAAMC,iBAAiB,IAAO,CAAA;QAC5BC,KAAK;QACLC,QAAQ;QACRC,OAAO;QACPC,MAAM;IACR,CAAA;AACA,4CAA4C;AAC5C,yDAAyD;AACzD,MAAMC,kBAAkBC,CAAAA,WAAY;IAClC,IAAIA,aAAa,WAAWA,aAAa,SAAS;QAChD,OAAO;YACLC,OAAO;YACPC,KAAK;QACP;IACF,CAAC;IACD,OAAO;QACLD,OAAO;QACPC,KAAK;IACP;AACF;AAKO,MAAMT,0BAA0BU,CAAAA,YAAa;IAClD,MAAM,EACJC,KAAI,EACJC,WAAWC,oBAAmB,EAC/B,GAAGC,IAAAA,kDAAwB,EAACJ;IAC7B,MAAMH,WAAWN,gBAAgB,CAACU,KAAK;IACvC,MAAMC,YAAYC,uBAAuBP,gBAAgBC,SAAS,CAACM,oBAAoB;IACvF,OAAO;QACLN;QACAK;IACF;AACF,GACA,mDAAmD"}
@@ -1,28 +1,27 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getBoundary", {
6
+ enumerable: true,
7
+ get: ()=>getBoundary
5
8
  });
6
- exports.getBoundary = void 0;
7
- const getScrollParent_1 = /*#__PURE__*/require("./getScrollParent");
8
- /**
9
- * Allows to mimic a behavior from V1 of Popper and accept `window` and `scrollParent` as strings.
10
- */
9
+ const _getScrollParent = require("./getScrollParent");
11
10
  function getBoundary(element, boundary) {
12
- if (boundary === 'window') {
13
- return element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
14
- }
15
- if (boundary === 'clippingParents') {
16
- return 'clippingAncestors';
17
- }
18
- if (boundary === 'scrollParent') {
19
- let boundariesNode = getScrollParent_1.getScrollParent(element);
20
- if (boundariesNode.nodeName === 'BODY') {
21
- boundariesNode = element === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
11
+ if (boundary === "window") {
12
+ return element?.ownerDocument.documentElement;
13
+ }
14
+ if (boundary === "clippingParents") {
15
+ return "clippingAncestors";
22
16
  }
23
- return boundariesNode;
24
- }
25
- return boundary;
26
- }
27
- exports.getBoundary = getBoundary;
17
+ if (boundary === "scrollParent") {
18
+ let boundariesNode = (0, _getScrollParent.getScrollParent)(element);
19
+ if (boundariesNode.nodeName === "BODY") {
20
+ boundariesNode = element?.ownerDocument.documentElement;
21
+ }
22
+ return boundariesNode;
23
+ }
24
+ return boundary;
25
+ } //# sourceMappingURL=getBoundary.js.map
26
+
28
27
  //# sourceMappingURL=getBoundary.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getScrollParent_1","require","getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","getScrollParent","nodeName","exports"],"sources":["../../../../../../../../packages/react-components/react-positioning/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,MAAAA,iBAAA,gBAAAC,OAAA;AAGA;;;AAGA,SAAgBC,WAAWA,CAACC,OAA2B,EAAEC,QAAmB;EAC1E,IAAIA,QAAQ,KAAK,QAAQ,EAAE;IACzB,OAAOD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,aAAa,CAAEC,eAAe;;EAGhD,IAAIF,QAAQ,KAAK,iBAAiB,EAAE;IAClC,OAAO,mBAAmB;;EAG5B,IAAIA,QAAQ,KAAK,cAAc,EAAE;IAC/B,IAAIG,cAAc,GAA4BP,iBAAA,CAAAQ,eAAe,CAACL,OAAO,CAAC;IAEtE,IAAII,cAAc,CAACE,QAAQ,KAAK,MAAM,EAAE;MACtCF,cAAc,GAAGJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,aAAa,CAAEC,eAAe;;IAG1D,OAAOC,cAAc;;EAGvB,OAAOH,QAAQ;AACjB;AApBAM,OAAA,CAAAR,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"sources":["../../lib/utils/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 */\nexport function getBoundary(element, boundary) {\n if (boundary === \"window\") {\n return 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?.ownerDocument.documentElement;\n }\n return boundariesNode;\n }\n return boundary;\n}\n//# sourceMappingURL=getBoundary.js.map"],"names":["getBoundary","element","boundary","ownerDocument","documentElement","boundariesNode","getScrollParent","nodeName"],"mappings":";;;;+BAIgBA;;aAAAA;;iCAJgB;AAIzB,SAASA,YAAYC,OAAO,EAAEC,QAAQ,EAAE;IAC7C,IAAIA,aAAa,UAAU;QACzB,OAAOD,SAASE,cAAcC,eAAe;IAC/C,CAAC;IACD,IAAIF,aAAa,mBAAmB;QAClC,OAAO;IACT,CAAC;IACD,IAAIA,aAAa,gBAAgB;QAC/B,IAAIG,iBAAiBC,IAAAA,gCAAe,EAACL;QACrC,IAAII,eAAeE,QAAQ,KAAK,QAAQ;YACtCF,iBAAiBJ,SAASE,cAAcC,eAAe;QACzD,CAAC;QACD,OAAOC;IACT,CAAC;IACD,OAAOH;AACT,EACA,uCAAuC"}
@@ -1,40 +1,28 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getFloatingUIOffset", {
6
+ enumerable: true,
7
+ get: ()=>getFloatingUIOffset
5
8
  });
6
- exports.getFloatingUIOffset = void 0;
7
- const fromFloatingUIPlacement_1 = /*#__PURE__*/require("./fromFloatingUIPlacement");
8
- /**
9
- * Shim to transform offset values from this library to Floating UI
10
- * @param rawOffset Offset from this library
11
- * @returns An offset value compatible with Floating UI
12
- */
9
+ const _fromFloatingUIPlacement = require("./fromFloatingUIPlacement");
13
10
  function getFloatingUIOffset(rawOffset) {
14
- if (!rawOffset) {
15
- return rawOffset;
16
- }
17
- if (typeof rawOffset === 'number' || typeof rawOffset === 'object') {
18
- return rawOffset;
19
- }
20
- return ({
21
- rects: {
22
- floating,
23
- reference
24
- },
25
- placement
26
- }) => {
27
- const {
28
- position,
29
- alignment
30
- } = fromFloatingUIPlacement_1.fromFloatingUIPlacement(placement);
31
- return rawOffset({
32
- positionedRect: floating,
33
- targetRect: reference,
34
- position,
35
- alignment
36
- });
37
- };
38
- }
39
- exports.getFloatingUIOffset = getFloatingUIOffset;
11
+ if (!rawOffset) {
12
+ return rawOffset;
13
+ }
14
+ if (typeof rawOffset === "number" || typeof rawOffset === "object") {
15
+ return rawOffset;
16
+ }
17
+ return ({ rects: { floating , reference } , placement })=>{
18
+ const { position , alignment } = (0, _fromFloatingUIPlacement.fromFloatingUIPlacement)(placement);
19
+ return rawOffset({
20
+ positionedRect: floating,
21
+ targetRect: reference,
22
+ position,
23
+ alignment
24
+ });
25
+ };
26
+ } //# sourceMappingURL=getFloatingUIOffset.js.map
27
+
40
28
  //# sourceMappingURL=getFloatingUIOffset.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["fromFloatingUIPlacement_1","require","getFloatingUIOffset","rawOffset","rects","floating","reference","placement","position","alignment","fromFloatingUIPlacement","positionedRect","targetRect","exports"],"sources":["../../../../../../../../packages/react-components/react-positioning/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,MAAAA,yBAAA,gBAAAC,OAAA;AAgCA;;;;;AAKA,SAAgBC,mBAAmBA,CACjCC,SAA6B;EAE7B,IAAI,CAACA,SAAS,EAAE;IACd,OAAOA,SAAS;;EAGlB,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;IAClE,OAAOA,SAAS;;EAGlB,OAAO,CAAC;IAAEC,KAAK,EAAE;MAAEC,QAAQ;MAAEC;IAAS,CAAE;IAAEC;EAAS,CAAE,KAAI;IACvD,MAAM;MAAEC,QAAQ;MAAEC;IAAS,CAAE,GAAGT,yBAAA,CAAAU,uBAAuB,CAACH,SAAS,CAAC;IAClE,OAAOJ,SAAS,CAAC;MAAEQ,cAAc,EAAEN,QAAQ;MAAEO,UAAU,EAAEN,SAAS;MAAEE,QAAQ;MAAEC;IAAS,CAAE,CAAC;EAC5F,CAAC;AACH;AAfAI,OAAA,CAAAX,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"sources":["../../lib/utils/getFloatingUIOffset.js"],"sourcesContent":["import { fromFloatingUIPlacement } from \"./fromFloatingUIPlacement\";\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(rawOffset) {\n if (!rawOffset) {\n return rawOffset;\n }\n if (typeof rawOffset === \"number\" || typeof rawOffset === \"object\") {\n return rawOffset;\n }\n return ({\n rects: {\n floating,\n reference\n },\n placement\n }) => {\n const {\n position,\n alignment\n } = fromFloatingUIPlacement(placement);\n return rawOffset({\n positionedRect: floating,\n targetRect: reference,\n position,\n alignment\n });\n };\n}\n//# sourceMappingURL=getFloatingUIOffset.js.map"],"names":["getFloatingUIOffset","rawOffset","rects","floating","reference","placement","position","alignment","fromFloatingUIPlacement","positionedRect","targetRect"],"mappings":";;;;+BAMgBA;;aAAAA;;yCANwB;AAMjC,SAASA,oBAAoBC,SAAS,EAAE;IAC7C,IAAI,CAACA,WAAW;QACd,OAAOA;IACT,CAAC;IACD,IAAI,OAAOA,cAAc,YAAY,OAAOA,cAAc,UAAU;QAClE,OAAOA;IACT,CAAC;IACD,OAAO,CAAC,EACNC,OAAO,EACLC,SAAQ,EACRC,UAAS,EACV,CAAA,EACDC,UAAS,EACV,GAAK;QACJ,MAAM,EACJC,SAAQ,EACRC,UAAS,EACV,GAAGC,IAAAA,gDAAuB,EAACH;QAC5B,OAAOJ,UAAU;YACfQ,gBAAgBN;YAChBO,YAAYN;YACZE;YACAC;QACF;IACF;AACF,EACA,+CAA+C"}
@@ -1,49 +1,53 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getReactFiberFromNode", {
6
+ enumerable: true,
7
+ get: ()=>getReactFiberFromNode
5
8
  });
6
- exports.getReactFiberFromNode = void 0;
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
7
11
  var WorkTag;
8
- (function (WorkTag) {
9
- WorkTag[WorkTag["FunctionComponent"] = 0] = "FunctionComponent";
10
- WorkTag[WorkTag["ClassComponent"] = 1] = "ClassComponent";
11
- WorkTag[WorkTag["IndeterminateComponent"] = 2] = "IndeterminateComponent";
12
- WorkTag[WorkTag["HostRoot"] = 3] = "HostRoot";
13
- WorkTag[WorkTag["HostPortal"] = 4] = "HostPortal";
14
- WorkTag[WorkTag["HostComponent"] = 5] = "HostComponent";
15
- WorkTag[WorkTag["HostText"] = 6] = "HostText";
16
- WorkTag[WorkTag["Fragment"] = 7] = "Fragment";
17
- WorkTag[WorkTag["Mode"] = 8] = "Mode";
18
- WorkTag[WorkTag["ContextConsumer"] = 9] = "ContextConsumer";
19
- WorkTag[WorkTag["ContextProvider"] = 10] = "ContextProvider";
20
- WorkTag[WorkTag["ForwardRef"] = 11] = "ForwardRef";
21
- WorkTag[WorkTag["Profiler"] = 12] = "Profiler";
22
- WorkTag[WorkTag["SuspenseComponent"] = 13] = "SuspenseComponent";
23
- WorkTag[WorkTag["MemoComponent"] = 14] = "MemoComponent";
24
- WorkTag[WorkTag["SimpleMemoComponent"] = 15] = "SimpleMemoComponent";
25
- WorkTag[WorkTag["LazyComponent"] = 16] = "LazyComponent";
26
- WorkTag[WorkTag["IncompleteClassComponent"] = 17] = "IncompleteClassComponent";
27
- WorkTag[WorkTag["DehydratedFragment"] = 18] = "DehydratedFragment";
28
- WorkTag[WorkTag["SuspenseListComponent"] = 19] = "SuspenseListComponent";
29
- WorkTag[WorkTag["FundamentalComponent"] = 20] = "FundamentalComponent";
30
- WorkTag[WorkTag["ScopeComponent"] = 21] = "ScopeComponent";
12
+ (function(WorkTag) {
13
+ WorkTag[WorkTag["FunctionComponent"] = 0] = "FunctionComponent";
14
+ WorkTag[WorkTag["ClassComponent"] = 1] = "ClassComponent";
15
+ WorkTag[WorkTag["IndeterminateComponent"] = 2] = "IndeterminateComponent";
16
+ WorkTag[WorkTag["HostRoot"] = 3] = "HostRoot";
17
+ WorkTag[WorkTag["HostPortal"] = 4] = "HostPortal";
18
+ WorkTag[WorkTag["HostComponent"] = 5] = "HostComponent";
19
+ WorkTag[WorkTag["HostText"] = 6] = "HostText";
20
+ WorkTag[WorkTag["Fragment"] = 7] = "Fragment";
21
+ WorkTag[WorkTag["Mode"] = 8] = "Mode";
22
+ WorkTag[WorkTag["ContextConsumer"] = 9] = "ContextConsumer";
23
+ WorkTag[WorkTag["ContextProvider"] = 10] = "ContextProvider";
24
+ WorkTag[WorkTag["ForwardRef"] = 11] = "ForwardRef";
25
+ WorkTag[WorkTag["Profiler"] = 12] = "Profiler";
26
+ WorkTag[WorkTag["SuspenseComponent"] = 13] = "SuspenseComponent";
27
+ WorkTag[WorkTag["MemoComponent"] = 14] = "MemoComponent";
28
+ WorkTag[WorkTag["SimpleMemoComponent"] = 15] = "SimpleMemoComponent";
29
+ WorkTag[WorkTag["LazyComponent"] = 16] = "LazyComponent";
30
+ WorkTag[WorkTag["IncompleteClassComponent"] = 17] = "IncompleteClassComponent";
31
+ WorkTag[WorkTag["DehydratedFragment"] = 18] = "DehydratedFragment";
32
+ WorkTag[WorkTag["SuspenseListComponent"] = 19] = "SuspenseListComponent";
33
+ WorkTag[WorkTag["FundamentalComponent"] = 20] = "FundamentalComponent";
34
+ WorkTag[WorkTag["ScopeComponent"] = 21] = "ScopeComponent";
31
35
  })(WorkTag || (WorkTag = {}));
32
36
  function getReactFiberFromNode(elm) {
33
- if (!elm) {
34
- return null;
35
- }
36
- for (const k in elm) {
37
- // React 16 uses "__reactInternalInstance$" prefix
38
- // React 17 uses "__reactFiber$" prefix
39
- // https://github.com/facebook/react/pull/18377
40
- if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {
41
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
- // @ts-ignore
43
- return elm[k];
37
+ if (!elm) {
38
+ return null;
44
39
  }
45
- }
46
- throw new Error('getReactFiber(): Failed to find a React Fiber on a node');
47
- }
48
- exports.getReactFiberFromNode = getReactFiberFromNode;
40
+ for(const k in elm){
41
+ // React 16 uses "__reactInternalInstance$" prefix
42
+ // React 17 uses "__reactFiber$" prefix
43
+ // https://github.com/facebook/react/pull/18377
44
+ if (k.indexOf("__reactInternalInstance$") === 0 || k.indexOf("__reactFiber$") === 0) {
45
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
46
+ // @ts-ignore
47
+ return elm[k];
48
+ }
49
+ }
50
+ throw new Error("getReactFiber(): Failed to find a React Fiber on a node");
51
+ } //# sourceMappingURL=getReactFiberFromNode.js.map
52
+
49
53
  //# sourceMappingURL=getReactFiberFromNode.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WorkTag","getReactFiberFromNode","elm","k","indexOf","Error","exports"],"sources":["../../../../../../../../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,SAAgBC,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;AAjBAC,OAAA,CAAAL,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"sources":["../../lib/utils/getReactFiberFromNode.js"],"sourcesContent":["import * as React from \"react\";\nvar WorkTag;\n(function (WorkTag) {\n WorkTag[WorkTag[\"FunctionComponent\"] = 0] = \"FunctionComponent\";\n WorkTag[WorkTag[\"ClassComponent\"] = 1] = \"ClassComponent\";\n WorkTag[WorkTag[\"IndeterminateComponent\"] = 2] = \"IndeterminateComponent\";\n WorkTag[WorkTag[\"HostRoot\"] = 3] = \"HostRoot\";\n WorkTag[WorkTag[\"HostPortal\"] = 4] = \"HostPortal\";\n WorkTag[WorkTag[\"HostComponent\"] = 5] = \"HostComponent\";\n WorkTag[WorkTag[\"HostText\"] = 6] = \"HostText\";\n WorkTag[WorkTag[\"Fragment\"] = 7] = \"Fragment\";\n WorkTag[WorkTag[\"Mode\"] = 8] = \"Mode\";\n WorkTag[WorkTag[\"ContextConsumer\"] = 9] = \"ContextConsumer\";\n WorkTag[WorkTag[\"ContextProvider\"] = 10] = \"ContextProvider\";\n WorkTag[WorkTag[\"ForwardRef\"] = 11] = \"ForwardRef\";\n WorkTag[WorkTag[\"Profiler\"] = 12] = \"Profiler\";\n WorkTag[WorkTag[\"SuspenseComponent\"] = 13] = \"SuspenseComponent\";\n WorkTag[WorkTag[\"MemoComponent\"] = 14] = \"MemoComponent\";\n WorkTag[WorkTag[\"SimpleMemoComponent\"] = 15] = \"SimpleMemoComponent\";\n WorkTag[WorkTag[\"LazyComponent\"] = 16] = \"LazyComponent\";\n WorkTag[WorkTag[\"IncompleteClassComponent\"] = 17] = \"IncompleteClassComponent\";\n WorkTag[WorkTag[\"DehydratedFragment\"] = 18] = \"DehydratedFragment\";\n WorkTag[WorkTag[\"SuspenseListComponent\"] = 19] = \"SuspenseListComponent\";\n WorkTag[WorkTag[\"FundamentalComponent\"] = 20] = \"FundamentalComponent\";\n WorkTag[WorkTag[\"ScopeComponent\"] = 21] = \"ScopeComponent\";\n})(WorkTag || (WorkTag = {}));\nexport function getReactFiberFromNode(elm) {\n if (!elm) {\n return null;\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 throw new Error(\"getReactFiber(): Failed to find a React Fiber on a node\");\n}\n//# sourceMappingURL=getReactFiberFromNode.js.map"],"names":["getReactFiberFromNode","WorkTag","elm","k","indexOf","Error"],"mappings":";;;;+BA0BgBA;;aAAAA;;;6DA1BO;AACvB,IAAIC;AACH,CAAA,SAAUA,OAAO,EAAE;IAClBA,OAAO,CAACA,OAAO,CAAC,oBAAoB,GAAG,EAAE,GAAG;IAC5CA,OAAO,CAACA,OAAO,CAAC,iBAAiB,GAAG,EAAE,GAAG;IACzCA,OAAO,CAACA,OAAO,CAAC,yBAAyB,GAAG,EAAE,GAAG;IACjDA,OAAO,CAACA,OAAO,CAAC,WAAW,GAAG,EAAE,GAAG;IACnCA,OAAO,CAACA,OAAO,CAAC,aAAa,GAAG,EAAE,GAAG;IACrCA,OAAO,CAACA,OAAO,CAAC,gBAAgB,GAAG,EAAE,GAAG;IACxCA,OAAO,CAACA,OAAO,CAAC,WAAW,GAAG,EAAE,GAAG;IACnCA,OAAO,CAACA,OAAO,CAAC,WAAW,GAAG,EAAE,GAAG;IACnCA,OAAO,CAACA,OAAO,CAAC,OAAO,GAAG,EAAE,GAAG;IAC/BA,OAAO,CAACA,OAAO,CAAC,kBAAkB,GAAG,EAAE,GAAG;IAC1CA,OAAO,CAACA,OAAO,CAAC,kBAAkB,GAAG,GAAG,GAAG;IAC3CA,OAAO,CAACA,OAAO,CAAC,aAAa,GAAG,GAAG,GAAG;IACtCA,OAAO,CAACA,OAAO,CAAC,WAAW,GAAG,GAAG,GAAG;IACpCA,OAAO,CAACA,OAAO,CAAC,oBAAoB,GAAG,GAAG,GAAG;IAC7CA,OAAO,CAACA,OAAO,CAAC,gBAAgB,GAAG,GAAG,GAAG;IACzCA,OAAO,CAACA,OAAO,CAAC,sBAAsB,GAAG,GAAG,GAAG;IAC/CA,OAAO,CAACA,OAAO,CAAC,gBAAgB,GAAG,GAAG,GAAG;IACzCA,OAAO,CAACA,OAAO,CAAC,2BAA2B,GAAG,GAAG,GAAG;IACpDA,OAAO,CAACA,OAAO,CAAC,qBAAqB,GAAG,GAAG,GAAG;IAC9CA,OAAO,CAACA,OAAO,CAAC,wBAAwB,GAAG,GAAG,GAAG;IACjDA,OAAO,CAACA,OAAO,CAAC,uBAAuB,GAAG,GAAG,GAAG;IAChDA,OAAO,CAACA,OAAO,CAAC,iBAAiB,GAAG,GAAG,GAAG;AAC5C,CAAA,EAAGA,WAAYA,CAAAA,UAAU,CAAC,CAAA;AACnB,SAASD,sBAAsBE,GAAG,EAAE;IACzC,IAAI,CAACA,KAAK;QACR,OAAO,IAAI;IACb,CAAC;IACD,IAAK,MAAMC,KAAKD,IAAK;QACnB,kDAAkD;QAClD,uCAAuC;QACvC,+CAA+C;QAC/C,IAAIC,EAAEC,OAAO,CAAC,gCAAgC,KAAKD,EAAEC,OAAO,CAAC,qBAAqB,GAAG;YACnF,6DAA6D;YAC7D,aAAa;YACb,OAAOF,GAAG,CAACC,EAAE;QACf,CAAC;IACH;IACA,MAAM,IAAIE,MAAM,2DAA2D;AAC7E,EACA,iDAAiD"}