@fluentui/react-positioning 9.5.5 → 9.5.7
Sign up to get free protection for your applications and to get access to all the features.
- package/.swcrc +30 -0
- package/CHANGELOG.json +55 -1
- package/CHANGELOG.md +24 -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,45 +1,40 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
exports
|
7
|
-
|
8
|
-
|
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
|
-
|
18
|
+
const getAlignmentMap = (position)=>{
|
19
|
+
if (position === 'above' || position === 'below') {
|
20
|
+
return {
|
21
|
+
start: 'start',
|
22
|
+
end: 'end'
|
23
|
+
};
|
24
|
+
}
|
18
25
|
return {
|
19
|
-
|
20
|
-
|
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
|
-
|
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,"
|
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
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "getBoundary", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>getBoundary
|
5
8
|
});
|
6
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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 === null || element === void 0 ? void 0 : element.ownerDocument.documentElement;
|
13
|
+
}
|
14
|
+
if (boundary === 'clippingParents') {
|
15
|
+
return 'clippingAncestors';
|
22
16
|
}
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
17
|
+
if (boundary === 'scrollParent') {
|
18
|
+
let boundariesNode = (0, _getScrollParent.getScrollParent)(element);
|
19
|
+
if (boundariesNode.nodeName === 'BODY') {
|
20
|
+
boundariesNode = element === null || element === void 0 ? void 0 : 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,"
|
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 === 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//# 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,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQE,aAAa,CAACC,eAAe;IAChG,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,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQE,aAAa,CAACC,eAAe;QAC1G,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
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "getFloatingUIOffset", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>getFloatingUIOffset
|
5
8
|
});
|
6
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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,"
|
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
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "getReactFiberFromNode", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>getReactFiberFromNode
|
5
8
|
});
|
6
|
-
|
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
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
34
|
-
|
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
|
-
|
47
|
-
|
48
|
-
|
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":["../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,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"}
|
@@ -1,68 +1,64 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.hasScrollParent = exports.getScrollParent = exports.getParentNode = void 0;
|
7
1
|
/**
|
8
2
|
* Returns the parent node or the host of the node argument.
|
9
3
|
* @param node - DOM node.
|
10
4
|
* @returns - parent DOM node.
|
11
|
-
*/
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
5
|
+
*/ "use strict";
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
7
|
+
value: true
|
8
|
+
});
|
9
|
+
function _export(target, all) {
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
11
|
+
enumerable: true,
|
12
|
+
get: all[name]
|
13
|
+
});
|
14
|
+
}
|
15
|
+
_export(exports, {
|
16
|
+
getParentNode: ()=>getParentNode,
|
17
|
+
getScrollParent: ()=>getScrollParent,
|
18
|
+
hasScrollParent: ()=>hasScrollParent
|
19
|
+
});
|
20
|
+
const getParentNode = (node)=>{
|
21
|
+
if (node.nodeName === 'HTML') {
|
22
|
+
return node;
|
23
|
+
}
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
25
|
+
return node.parentNode || node.host;
|
18
26
|
};
|
19
|
-
exports.getParentNode = getParentNode;
|
20
27
|
/**
|
21
28
|
* Returns CSS styles of the given node.
|
22
29
|
* @param node - DOM node.
|
23
30
|
* @returns - CSS styles.
|
24
|
-
*/
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
return window.getComputedStyle(node, null);
|
31
|
+
*/ const getStyleComputedProperty = (node)=>{
|
32
|
+
var _node_ownerDocument;
|
33
|
+
if (node.nodeType !== 1) {
|
34
|
+
return {};
|
35
|
+
}
|
36
|
+
const window = (_node_ownerDocument = node.ownerDocument) === null || _node_ownerDocument === void 0 ? void 0 : _node_ownerDocument.defaultView;
|
37
|
+
return window.getComputedStyle(node, null);
|
32
38
|
};
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
const {
|
52
|
-
overflow,
|
53
|
-
overflowX,
|
54
|
-
overflowY
|
55
|
-
} = getStyleComputedProperty(parentNode);
|
56
|
-
if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
|
57
|
-
return parentNode;
|
58
|
-
}
|
59
|
-
return exports.getScrollParent(parentNode);
|
39
|
+
const getScrollParent = (node)=>{
|
40
|
+
// Return body, `getScroll` will take care to get the correct `scrollTop` from it
|
41
|
+
const parentNode = node && getParentNode(node);
|
42
|
+
// eslint-disable-next-line
|
43
|
+
if (!parentNode) return document.body;
|
44
|
+
switch(parentNode.nodeName){
|
45
|
+
case 'HTML':
|
46
|
+
case 'BODY':
|
47
|
+
return parentNode.ownerDocument.body;
|
48
|
+
case '#document':
|
49
|
+
return parentNode.body;
|
50
|
+
}
|
51
|
+
// If any of the overflow props is defined for the node then we return it as the parent
|
52
|
+
const { overflow , overflowX , overflowY } = getStyleComputedProperty(parentNode);
|
53
|
+
if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
|
54
|
+
return parentNode;
|
55
|
+
}
|
56
|
+
return getScrollParent(parentNode);
|
60
57
|
};
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
exports.hasScrollParent = hasScrollParent;
|
58
|
+
const hasScrollParent = (node)=>{
|
59
|
+
var _scrollParentElement_ownerDocument;
|
60
|
+
const scrollParentElement = getScrollParent(node);
|
61
|
+
return scrollParentElement ? scrollParentElement !== ((_scrollParentElement_ownerDocument = scrollParentElement.ownerDocument) === null || _scrollParentElement_ownerDocument === void 0 ? void 0 : _scrollParentElement_ownerDocument.body) : false;
|
62
|
+
}; //# sourceMappingURL=getScrollParent.js.map
|
63
|
+
|
68
64
|
//# sourceMappingURL=getScrollParent.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/utils/getScrollParent.js"],"sourcesContent":["/**\n * Returns the parent node or the host of the node argument.\n * @param node - DOM node.\n * @returns - parent DOM node.\n */export const getParentNode = node => {\n if (node.nodeName === 'HTML') {\n return node;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return node.parentNode || node.host;\n};\n/**\n * Returns CSS styles of the given node.\n * @param node - DOM node.\n * @returns - CSS styles.\n */\nconst getStyleComputedProperty = node => {\n var _node_ownerDocument;\n if (node.nodeType !== 1) {\n return {};\n }\n const window = (_node_ownerDocument = node.ownerDocument) === null || _node_ownerDocument === void 0 ? void 0 : _node_ownerDocument.defaultView;\n return window.getComputedStyle(node, null);\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 => {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n const parentNode = node && getParentNode(node);\n // eslint-disable-next-line\n if (!parentNode) return document.body;\n switch (parentNode.nodeName) {\n case 'HTML':\n case 'BODY':\n return parentNode.ownerDocument.body;\n case '#document':\n return parentNode.body;\n }\n // If any of the overflow props is defined for the node then we return it as the parent\n const {\n overflow,\n overflowX,\n overflowY\n } = getStyleComputedProperty(parentNode);\n if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {\n return parentNode;\n }\n return getScrollParent(parentNode);\n};\nexport const hasScrollParent = node => {\n var _scrollParentElement_ownerDocument;\n const scrollParentElement = getScrollParent(node);\n return scrollParentElement ? scrollParentElement !== ((_scrollParentElement_ownerDocument = scrollParentElement.ownerDocument) === null || _scrollParentElement_ownerDocument === void 0 ? void 0 : _scrollParentElement_ownerDocument.body) : false;\n};\n//# sourceMappingURL=getScrollParent.js.map"],"names":["getParentNode","getScrollParent","hasScrollParent","node","nodeName","parentNode","host","getStyleComputedProperty","_node_ownerDocument","nodeType","window","ownerDocument","defaultView","getComputedStyle","document","body","overflow","overflowX","overflowY","test","_scrollParentElement_ownerDocument","scrollParentElement"],"mappings":"AAAA;;;;CAIC;;;;;;;;;;;IAAeA,aAAa,MAAbA;IAyBHC,eAAe,MAAfA;IAuBAC,eAAe,MAAfA;;AAhDH,MAAMF,gBAAgBG,CAAAA,OAAQ;IACtC,IAAIA,KAAKC,QAAQ,KAAK,QAAQ;QAC5B,OAAOD;IACT,CAAC;IACD,8DAA8D;IAC9D,OAAOA,KAAKE,UAAU,IAAIF,KAAKG,IAAI;AACrC;AACA;;;;CAIC,GACD,MAAMC,2BAA2BJ,CAAAA,OAAQ;IACvC,IAAIK;IACJ,IAAIL,KAAKM,QAAQ,KAAK,GAAG;QACvB,OAAO,CAAC;IACV,CAAC;IACD,MAAMC,SAAS,AAACF,CAAAA,sBAAsBL,KAAKQ,aAAa,AAAD,MAAO,IAAI,IAAIH,wBAAwB,KAAK,IAAI,KAAK,IAAIA,oBAAoBI,WAAW;IAC/I,OAAOF,OAAOG,gBAAgB,CAACV,MAAM,IAAI;AAC3C;AAMO,MAAMF,kBAAkBE,CAAAA,OAAQ;IACrC,iFAAiF;IACjF,MAAME,aAAaF,QAAQH,cAAcG;IACzC,2BAA2B;IAC3B,IAAI,CAACE,YAAY,OAAOS,SAASC,IAAI;IACrC,OAAQV,WAAWD,QAAQ;QACzB,KAAK;QACL,KAAK;YACH,OAAOC,WAAWM,aAAa,CAACI,IAAI;QACtC,KAAK;YACH,OAAOV,WAAWU,IAAI;IAC1B;IACA,uFAAuF;IACvF,MAAM,EACJC,SAAQ,EACRC,UAAS,EACTC,UAAS,EACV,GAAGX,yBAAyBF;IAC7B,IAAI,wBAAwBc,IAAI,CAACH,WAAWE,YAAYD,YAAY;QAClE,OAAOZ;IACT,CAAC;IACD,OAAOJ,gBAAgBI;AACzB;AACO,MAAMH,kBAAkBC,CAAAA,OAAQ;IACrC,IAAIiB;IACJ,MAAMC,sBAAsBpB,gBAAgBE;IAC5C,OAAOkB,sBAAsBA,wBAAyB,CAAA,AAACD,CAAAA,qCAAqCC,oBAAoBV,aAAa,AAAD,MAAO,IAAI,IAAIS,uCAAuC,KAAK,IAAI,KAAK,IAAIA,mCAAmCL,IAAI,AAAD,IAAK,KAAK;AACtP,GACA,2CAA2C"}
|
@@ -1,30 +1,31 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
1
|
//
|
4
2
|
// Dev utils to detect if nodes have "autoFocus" props.
|
5
3
|
//
|
4
|
+
"use strict";
|
6
5
|
Object.defineProperty(exports, "__esModule", {
|
7
|
-
|
6
|
+
value: true
|
8
7
|
});
|
9
|
-
exports
|
10
|
-
|
8
|
+
Object.defineProperty(exports, "hasAutofocusFilter", {
|
9
|
+
enumerable: true,
|
10
|
+
get: ()=>hasAutofocusFilter
|
11
|
+
});
|
12
|
+
const _getReactFiberFromNode = require("./getReactFiberFromNode");
|
11
13
|
/**
|
12
14
|
* Detects if a passed HTML node has "autoFocus" prop on a React's fiber. Is needed as React handles autofocus behavior
|
13
15
|
* in React DOM and will not pass "autoFocus" to an actual HTML.
|
14
16
|
*
|
15
17
|
* @param node
|
16
|
-
*/
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
return false;
|
18
|
+
*/ function hasAutofocusProp(node) {
|
19
|
+
// https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166
|
20
|
+
const isAutoFocusableElement = node.nodeName === 'BUTTON' || node.nodeName === 'INPUT' || node.nodeName === 'SELECT' || node.nodeName === 'TEXTAREA';
|
21
|
+
if (isAutoFocusableElement) {
|
22
|
+
var _getReactFiberFromNode1;
|
23
|
+
return !!((_getReactFiberFromNode1 = (0, _getReactFiberFromNode.getReactFiberFromNode)(node)) === null || _getReactFiberFromNode1 === void 0 ? void 0 : _getReactFiberFromNode1.pendingProps.autoFocus);
|
24
|
+
}
|
25
|
+
return false;
|
25
26
|
}
|
26
27
|
function hasAutofocusFilter(node) {
|
27
|
-
|
28
|
-
}
|
29
|
-
|
28
|
+
return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
29
|
+
} //# sourceMappingURL=hasAutoFocusFilter.js.map
|
30
|
+
|
30
31
|
//# sourceMappingURL=hasAutoFocusFilter.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../lib/utils/hasAutoFocusFilter.js"],"sourcesContent":["//\n// Dev utils to detect if nodes have \"autoFocus\" props.\n//\nimport { getReactFiberFromNode } from './getReactFiberFromNode';\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) {\n // https://github.com/facebook/react/blob/848bb2426e44606e0a55dfe44c7b3ece33772485/packages/react-dom/src/client/ReactDOMHostConfig.js#L157-L166\n const isAutoFocusableElement = node.nodeName === 'BUTTON' || node.nodeName === 'INPUT' || node.nodeName === 'SELECT' || node.nodeName === 'TEXTAREA';\n if (isAutoFocusableElement) {\n var _getReactFiberFromNode;\n return !!((_getReactFiberFromNode = getReactFiberFromNode(node)) === null || _getReactFiberFromNode === void 0 ? void 0 : _getReactFiberFromNode.pendingProps.autoFocus);\n }\n return false;\n}\nexport function hasAutofocusFilter(node) {\n return hasAutofocusProp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n}\n//# sourceMappingURL=hasAutoFocusFilter.js.map"],"names":["hasAutofocusFilter","hasAutofocusProp","node","isAutoFocusableElement","nodeName","_getReactFiberFromNode","getReactFiberFromNode","pendingProps","autoFocus","NodeFilter","FILTER_ACCEPT","FILTER_SKIP"],"mappings":"AAAA,EAAE;AACF,uDAAuD;AACvD,EAAE;;;;;+BAiBcA;;aAAAA;;uCAhBsB;AACtC;;;;;CAKC,GACD,SAASC,iBAAiBC,IAAI,EAAE;IAC9B,gJAAgJ;IAChJ,MAAMC,yBAAyBD,KAAKE,QAAQ,KAAK,YAAYF,KAAKE,QAAQ,KAAK,WAAWF,KAAKE,QAAQ,KAAK,YAAYF,KAAKE,QAAQ,KAAK;IAC1I,IAAID,wBAAwB;QAC1B,IAAIE;QACJ,OAAO,CAAC,CAAE,CAAA,AAACA,CAAAA,0BAAyBC,IAAAA,4CAAqB,EAACJ,KAAI,MAAO,IAAI,IAAIG,4BAA2B,KAAK,IAAI,KAAK,IAAIA,wBAAuBE,YAAY,CAACC,SAAS,AAAD;IACxK,CAAC;IACD,OAAO,KAAK;AACd;AACO,SAASR,mBAAmBE,IAAI,EAAE;IACvC,OAAOD,iBAAiBC,QAAQO,WAAWC,aAAa,GAAGD,WAAWE,WAAW;AACnF,EACA,8CAA8C"}
|