@tamagui/floating 2.0.0-rc.3 → 2.0.0-rc.31
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.
- package/dist/cjs/Floating.native.js +4 -0
- package/dist/cjs/Floating.native.js.map +1 -1
- package/dist/cjs/index.cjs +33 -2
- package/dist/cjs/index.native.js +33 -2
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/interactions/PopupTriggerMap.cjs +40 -0
- package/dist/cjs/interactions/PopupTriggerMap.native.js +73 -0
- package/dist/cjs/interactions/PopupTriggerMap.native.js.map +1 -0
- package/dist/cjs/interactions/createFloatingEvents.cjs +41 -0
- package/dist/cjs/interactions/createFloatingEvents.native.js +47 -0
- package/dist/cjs/interactions/createFloatingEvents.native.js.map +1 -0
- package/dist/cjs/interactions/safePolygon.cjs +191 -0
- package/dist/cjs/interactions/safePolygon.native.js +205 -0
- package/dist/cjs/interactions/safePolygon.native.js.map +1 -0
- package/dist/cjs/interactions/types.cjs +16 -0
- package/dist/cjs/interactions/types.native.js +19 -0
- package/dist/cjs/interactions/types.native.js.map +1 -0
- package/dist/cjs/interactions/useClick.cjs +82 -0
- package/dist/cjs/interactions/useClick.native.js +90 -0
- package/dist/cjs/interactions/useClick.native.js.map +1 -0
- package/dist/cjs/interactions/useDelayGroup.cjs +96 -0
- package/dist/cjs/interactions/useDelayGroup.native.js +109 -0
- package/dist/cjs/interactions/useDelayGroup.native.js.map +1 -0
- package/dist/cjs/interactions/useFocus.cjs +101 -0
- package/dist/cjs/interactions/useFocus.native.js +113 -0
- package/dist/cjs/interactions/useFocus.native.js.map +1 -0
- package/dist/cjs/interactions/useHover.cjs +224 -0
- package/dist/cjs/interactions/useHover.native.js +248 -0
- package/dist/cjs/interactions/useHover.native.js.map +1 -0
- package/dist/cjs/interactions/useInnerOffset.cjs +104 -0
- package/dist/cjs/interactions/useInnerOffset.native.js +118 -0
- package/dist/cjs/interactions/useInnerOffset.native.js.map +1 -0
- package/dist/cjs/interactions/useInteractions.cjs +76 -0
- package/dist/cjs/interactions/useInteractions.native.js +164 -0
- package/dist/cjs/interactions/useInteractions.native.js.map +1 -0
- package/dist/cjs/interactions/useListNavigation.cjs +253 -0
- package/dist/cjs/interactions/useListNavigation.native.js +297 -0
- package/dist/cjs/interactions/useListNavigation.native.js.map +1 -0
- package/dist/cjs/interactions/useRole.cjs +112 -0
- package/dist/cjs/interactions/useRole.native.js +128 -0
- package/dist/cjs/interactions/useRole.native.js.map +1 -0
- package/dist/cjs/interactions/useTypeahead.cjs +93 -0
- package/dist/cjs/interactions/useTypeahead.native.js +114 -0
- package/dist/cjs/interactions/useTypeahead.native.js.map +1 -0
- package/dist/cjs/interactions/utils.cjs +178 -0
- package/dist/cjs/interactions/utils.native.js +188 -0
- package/dist/cjs/interactions/utils.native.js.map +1 -0
- package/dist/cjs/middleware/inner.cjs +106 -0
- package/dist/cjs/middleware/inner.native.js +120 -0
- package/dist/cjs/middleware/inner.native.js.map +1 -0
- package/dist/cjs/useFloating.cjs +21 -17
- package/dist/cjs/useFloating.native.js +2 -0
- package/dist/cjs/useFloating.native.js.map +1 -1
- package/dist/esm/Floating.native.js +4 -1
- package/dist/esm/Floating.native.js.map +1 -1
- package/dist/esm/index.js +17 -34
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/index.mjs +16 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +16 -2
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/interactions/PopupTriggerMap.mjs +17 -0
- package/dist/esm/interactions/PopupTriggerMap.mjs.map +1 -0
- package/dist/esm/interactions/PopupTriggerMap.native.js +47 -0
- package/dist/esm/interactions/PopupTriggerMap.native.js.map +1 -0
- package/dist/esm/interactions/createFloatingEvents.mjs +18 -0
- package/dist/esm/interactions/createFloatingEvents.mjs.map +1 -0
- package/dist/esm/interactions/createFloatingEvents.native.js +21 -0
- package/dist/esm/interactions/createFloatingEvents.native.js.map +1 -0
- package/dist/esm/interactions/safePolygon.mjs +168 -0
- package/dist/esm/interactions/safePolygon.mjs.map +1 -0
- package/dist/esm/interactions/safePolygon.native.js +179 -0
- package/dist/esm/interactions/safePolygon.native.js.map +1 -0
- package/dist/esm/interactions/types.mjs +2 -0
- package/dist/esm/interactions/types.mjs.map +1 -0
- package/dist/esm/interactions/types.native.js +2 -0
- package/dist/esm/interactions/types.native.js.map +1 -0
- package/dist/esm/interactions/useClick.mjs +59 -0
- package/dist/esm/interactions/useClick.mjs.map +1 -0
- package/dist/esm/interactions/useClick.native.js +64 -0
- package/dist/esm/interactions/useClick.native.js.map +1 -0
- package/dist/esm/interactions/useDelayGroup.mjs +60 -0
- package/dist/esm/interactions/useDelayGroup.mjs.map +1 -0
- package/dist/esm/interactions/useDelayGroup.native.js +70 -0
- package/dist/esm/interactions/useDelayGroup.native.js.map +1 -0
- package/dist/esm/interactions/useFocus.mjs +78 -0
- package/dist/esm/interactions/useFocus.mjs.map +1 -0
- package/dist/esm/interactions/useFocus.native.js +87 -0
- package/dist/esm/interactions/useFocus.native.js.map +1 -0
- package/dist/esm/interactions/useHover.mjs +189 -0
- package/dist/esm/interactions/useHover.mjs.map +1 -0
- package/dist/esm/interactions/useHover.native.js +210 -0
- package/dist/esm/interactions/useHover.native.js.map +1 -0
- package/dist/esm/interactions/useInnerOffset.mjs +70 -0
- package/dist/esm/interactions/useInnerOffset.mjs.map +1 -0
- package/dist/esm/interactions/useInnerOffset.native.js +81 -0
- package/dist/esm/interactions/useInnerOffset.native.js.map +1 -0
- package/dist/esm/interactions/useInteractions.mjs +53 -0
- package/dist/esm/interactions/useInteractions.mjs.map +1 -0
- package/dist/esm/interactions/useInteractions.native.js +138 -0
- package/dist/esm/interactions/useInteractions.native.js.map +1 -0
- package/dist/esm/interactions/useListNavigation.mjs +230 -0
- package/dist/esm/interactions/useListNavigation.mjs.map +1 -0
- package/dist/esm/interactions/useListNavigation.native.js +271 -0
- package/dist/esm/interactions/useListNavigation.native.js.map +1 -0
- package/dist/esm/interactions/useRole.mjs +78 -0
- package/dist/esm/interactions/useRole.mjs.map +1 -0
- package/dist/esm/interactions/useRole.native.js +91 -0
- package/dist/esm/interactions/useRole.native.js.map +1 -0
- package/dist/esm/interactions/useTypeahead.mjs +70 -0
- package/dist/esm/interactions/useTypeahead.mjs.map +1 -0
- package/dist/esm/interactions/useTypeahead.native.js +88 -0
- package/dist/esm/interactions/useTypeahead.native.js.map +1 -0
- package/dist/esm/interactions/utils.mjs +134 -0
- package/dist/esm/interactions/utils.mjs.map +1 -0
- package/dist/esm/interactions/utils.native.js +141 -0
- package/dist/esm/interactions/utils.native.js.map +1 -0
- package/dist/esm/middleware/inner.mjs +72 -0
- package/dist/esm/middleware/inner.mjs.map +1 -0
- package/dist/esm/middleware/inner.native.js +83 -0
- package/dist/esm/middleware/inner.native.js.map +1 -0
- package/dist/esm/useFloating.mjs +21 -17
- package/dist/esm/useFloating.mjs.map +1 -1
- package/dist/esm/useFloating.native.js +2 -0
- package/dist/esm/useFloating.native.js.map +1 -1
- package/package.json +8 -10
- package/src/Floating.native.tsx +1 -0
- package/src/index.ts +49 -0
- package/src/interactions/PopupTriggerMap.ts +30 -0
- package/src/interactions/createFloatingEvents.ts +34 -0
- package/src/interactions/safePolygon.ts +500 -0
- package/src/interactions/types.ts +165 -0
- package/src/interactions/useClick.ts +148 -0
- package/src/interactions/useDelayGroup.ts +114 -0
- package/src/interactions/useFocus.ts +164 -0
- package/src/interactions/useHover.ts +453 -0
- package/src/interactions/useInnerOffset.ts +116 -0
- package/src/interactions/useInteractions.ts +101 -0
- package/src/interactions/useListNavigation.ts +578 -0
- package/src/interactions/useRole.ts +103 -0
- package/src/interactions/useTypeahead.ts +173 -0
- package/src/interactions/utils.ts +234 -0
- package/src/middleware/inner.ts +142 -0
- package/src/useFloating.tsx +13 -1
- package/types/Floating.native.d.ts +1 -0
- package/types/Floating.native.d.ts.map +1 -1
- package/types/index.d.ts +17 -2
- package/types/index.d.ts.map +1 -1
- package/types/interactions/PopupTriggerMap.d.ts +8 -0
- package/types/interactions/PopupTriggerMap.d.ts.map +1 -0
- package/types/interactions/createFloatingEvents.d.ts +7 -0
- package/types/interactions/createFloatingEvents.d.ts.map +1 -0
- package/types/interactions/safePolygon.d.ts +4 -0
- package/types/interactions/safePolygon.d.ts.map +1 -0
- package/types/interactions/types.d.ts +123 -0
- package/types/interactions/types.d.ts.map +1 -0
- package/types/interactions/useClick.d.ts +3 -0
- package/types/interactions/useClick.d.ts.map +1 -0
- package/types/interactions/useDelayGroup.d.ts +23 -0
- package/types/interactions/useDelayGroup.d.ts.map +1 -0
- package/types/interactions/useFocus.d.ts +3 -0
- package/types/interactions/useFocus.d.ts.map +1 -0
- package/types/interactions/useHover.d.ts +6 -0
- package/types/interactions/useHover.d.ts.map +1 -0
- package/types/interactions/useInnerOffset.d.ts +3 -0
- package/types/interactions/useInnerOffset.d.ts.map +1 -0
- package/types/interactions/useInteractions.d.ts +8 -0
- package/types/interactions/useInteractions.d.ts.map +1 -0
- package/types/interactions/useListNavigation.d.ts +3 -0
- package/types/interactions/useListNavigation.d.ts.map +1 -0
- package/types/interactions/useRole.d.ts +3 -0
- package/types/interactions/useRole.d.ts.map +1 -0
- package/types/interactions/useTypeahead.d.ts +3 -0
- package/types/interactions/useTypeahead.d.ts.map +1 -0
- package/types/interactions/utils.d.ts +46 -0
- package/types/interactions/utils.d.ts.map +1 -0
- package/types/middleware/inner.d.ts +14 -0
- package/types/middleware/inner.d.ts.map +1 -0
- package/types/useFloating.d.ts +7 -1
- package/types/useFloating.d.ts.map +1 -1
- package/dist/cjs/Floating.js +0 -15
- package/dist/cjs/Floating.js.map +0 -6
- package/dist/cjs/index.js +0 -34
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/useFloating.js +0 -46
- package/dist/cjs/useFloating.js.map +0 -6
- package/dist/esm/Floating.js +0 -2
- package/dist/esm/Floating.js.map +0 -6
- package/dist/esm/useFloating.js +0 -23
- package/dist/esm/useFloating.js.map +0 -6
|
@@ -24,10 +24,14 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
24
24
|
var Floating_native_exports = {};
|
|
25
25
|
__export(Floating_native_exports, {
|
|
26
26
|
autoUpdate: () => autoUpdate,
|
|
27
|
+
getOverflowAncestors: () => getOverflowAncestors,
|
|
27
28
|
platform: () => platform
|
|
28
29
|
});
|
|
29
30
|
module.exports = __toCommonJS(Floating_native_exports);
|
|
30
31
|
__reExport(Floating_native_exports, require("@floating-ui/react-native"), module.exports);
|
|
31
32
|
var autoUpdate = function () {},
|
|
33
|
+
getOverflowAncestors = function () {
|
|
34
|
+
return [];
|
|
35
|
+
},
|
|
32
36
|
platform = null;
|
|
33
37
|
//# sourceMappingURL=Floating.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Floating_native_exports","__export","autoUpdate","platform","module","exports","__toCommonJS","__reExport","require"],"sources":["../../src/Floating.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAA,UAAA;EAAAC,QAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,
|
|
1
|
+
{"version":3,"names":["Floating_native_exports","__export","autoUpdate","getOverflowAncestors","platform","module","exports","__toCommonJS","__reExport","require"],"sources":["../../src/Floating.native.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAA,UAAA;EAAAC,oBAAA,EAAAA,CAAA,KAAAA,oBAAA;EAAAC,QAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAC,YAAA,CAAAP,uBAAA;AAIAQ,UAAA,CAAAR,uBAAA,EAAcS,OAAA,+BAJdJ,MAAA,CAAAC,OAAA;AAAO,IAAIJ,UAAA,GAAa,SAAAA,CAAA,EAAW,CAAC;EACzBC,oBAAA,GAAuB,SAAAA,CAAA,EAAW;IACzC,OAAO,EAAC;EACZ;EAEWC,QAAA,GAAW","ignoreList":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -20,21 +20,52 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
20
20
|
}), mod);
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
FloatingDelayGroup: () => import_useDelayGroup.FloatingDelayGroup,
|
|
23
24
|
FloatingOverrideContext: () => import_useFloating.FloatingOverrideContext,
|
|
25
|
+
PopupTriggerMap: () => import_PopupTriggerMap.PopupTriggerMap,
|
|
24
26
|
arrow: () => import_Floating.arrow,
|
|
25
27
|
autoPlacement: () => import_Floating.autoPlacement,
|
|
26
28
|
autoUpdate: () => import_Floating.autoUpdate,
|
|
29
|
+
createFloatingEvents: () => import_createFloatingEvents.createFloatingEvents,
|
|
27
30
|
detectOverflow: () => import_Floating.detectOverflow,
|
|
28
31
|
flip: () => import_Floating.flip,
|
|
32
|
+
getOverflowAncestors: () => import_Floating.getOverflowAncestors,
|
|
29
33
|
hide: () => import_Floating.hide,
|
|
30
34
|
inline: () => import_Floating.inline,
|
|
35
|
+
inner: () => import_inner.inner,
|
|
31
36
|
limitShift: () => import_Floating.limitShift,
|
|
32
37
|
offset: () => import_Floating.offset,
|
|
33
38
|
platform: () => import_Floating.platform,
|
|
39
|
+
safePolygon: () => import_safePolygon.safePolygon,
|
|
34
40
|
shift: () => import_Floating.shift,
|
|
35
41
|
size: () => import_Floating.size,
|
|
36
|
-
|
|
42
|
+
useClick: () => import_useClick.useClick,
|
|
43
|
+
useDelayGroup: () => import_useDelayGroup.useDelayGroup,
|
|
44
|
+
useDelayGroupContext: () => import_useDelayGroup.useDelayGroupContext,
|
|
45
|
+
useFloating: () => import_useFloating.useFloating,
|
|
46
|
+
useFloatingRaw: () => import_Floating2.useFloating,
|
|
47
|
+
useFocus: () => import_useFocus.useFocus,
|
|
48
|
+
useHover: () => import_useHover.useHover,
|
|
49
|
+
useInnerOffset: () => import_useInnerOffset.useInnerOffset,
|
|
50
|
+
useInteractions: () => import_useInteractions.useInteractions,
|
|
51
|
+
useListNavigation: () => import_useListNavigation.useListNavigation,
|
|
52
|
+
useRole: () => import_useRole.useRole,
|
|
53
|
+
useTypeahead: () => import_useTypeahead.useTypeahead
|
|
37
54
|
});
|
|
38
55
|
module.exports = __toCommonJS(index_exports);
|
|
39
56
|
var import_Floating = require("./Floating.cjs"),
|
|
40
|
-
import_useFloating = require("./useFloating.cjs")
|
|
57
|
+
import_useFloating = require("./useFloating.cjs"),
|
|
58
|
+
import_Floating2 = require("./Floating.cjs"),
|
|
59
|
+
import_createFloatingEvents = require("./interactions/createFloatingEvents.cjs"),
|
|
60
|
+
import_PopupTriggerMap = require("./interactions/PopupTriggerMap.cjs"),
|
|
61
|
+
import_useInteractions = require("./interactions/useInteractions.cjs"),
|
|
62
|
+
import_useHover = require("./interactions/useHover.cjs"),
|
|
63
|
+
import_safePolygon = require("./interactions/safePolygon.cjs"),
|
|
64
|
+
import_useFocus = require("./interactions/useFocus.cjs"),
|
|
65
|
+
import_useRole = require("./interactions/useRole.cjs"),
|
|
66
|
+
import_useClick = require("./interactions/useClick.cjs"),
|
|
67
|
+
import_useListNavigation = require("./interactions/useListNavigation.cjs"),
|
|
68
|
+
import_useTypeahead = require("./interactions/useTypeahead.cjs"),
|
|
69
|
+
import_useInnerOffset = require("./interactions/useInnerOffset.cjs"),
|
|
70
|
+
import_useDelayGroup = require("./interactions/useDelayGroup.cjs"),
|
|
71
|
+
import_inner = require("./middleware/inner.cjs");
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -22,22 +22,53 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
22
22
|
}), mod);
|
|
23
23
|
var index_exports = {};
|
|
24
24
|
__export(index_exports, {
|
|
25
|
+
FloatingDelayGroup: () => import_useDelayGroup.FloatingDelayGroup,
|
|
25
26
|
FloatingOverrideContext: () => import_useFloating.FloatingOverrideContext,
|
|
27
|
+
PopupTriggerMap: () => import_PopupTriggerMap.PopupTriggerMap,
|
|
26
28
|
arrow: () => import_Floating.arrow,
|
|
27
29
|
autoPlacement: () => import_Floating.autoPlacement,
|
|
28
30
|
autoUpdate: () => import_Floating.autoUpdate,
|
|
31
|
+
createFloatingEvents: () => import_createFloatingEvents.createFloatingEvents,
|
|
29
32
|
detectOverflow: () => import_Floating.detectOverflow,
|
|
30
33
|
flip: () => import_Floating.flip,
|
|
34
|
+
getOverflowAncestors: () => import_Floating.getOverflowAncestors,
|
|
31
35
|
hide: () => import_Floating.hide,
|
|
32
36
|
inline: () => import_Floating.inline,
|
|
37
|
+
inner: () => import_inner.inner,
|
|
33
38
|
limitShift: () => import_Floating.limitShift,
|
|
34
39
|
offset: () => import_Floating.offset,
|
|
35
40
|
platform: () => import_Floating.platform,
|
|
41
|
+
safePolygon: () => import_safePolygon.safePolygon,
|
|
36
42
|
shift: () => import_Floating.shift,
|
|
37
43
|
size: () => import_Floating.size,
|
|
38
|
-
|
|
44
|
+
useClick: () => import_useClick.useClick,
|
|
45
|
+
useDelayGroup: () => import_useDelayGroup.useDelayGroup,
|
|
46
|
+
useDelayGroupContext: () => import_useDelayGroup.useDelayGroupContext,
|
|
47
|
+
useFloating: () => import_useFloating.useFloating,
|
|
48
|
+
useFloatingRaw: () => import_Floating2.useFloating,
|
|
49
|
+
useFocus: () => import_useFocus.useFocus,
|
|
50
|
+
useHover: () => import_useHover.useHover,
|
|
51
|
+
useInnerOffset: () => import_useInnerOffset.useInnerOffset,
|
|
52
|
+
useInteractions: () => import_useInteractions.useInteractions,
|
|
53
|
+
useListNavigation: () => import_useListNavigation.useListNavigation,
|
|
54
|
+
useRole: () => import_useRole.useRole,
|
|
55
|
+
useTypeahead: () => import_useTypeahead.useTypeahead
|
|
39
56
|
});
|
|
40
57
|
module.exports = __toCommonJS(index_exports);
|
|
41
58
|
var import_Floating = require("./Floating.native.js"),
|
|
42
|
-
import_useFloating = require("./useFloating.native.js")
|
|
59
|
+
import_useFloating = require("./useFloating.native.js"),
|
|
60
|
+
import_Floating2 = require("./Floating.native.js"),
|
|
61
|
+
import_createFloatingEvents = require("./interactions/createFloatingEvents.native.js"),
|
|
62
|
+
import_PopupTriggerMap = require("./interactions/PopupTriggerMap.native.js"),
|
|
63
|
+
import_useInteractions = require("./interactions/useInteractions.native.js"),
|
|
64
|
+
import_useHover = require("./interactions/useHover.native.js"),
|
|
65
|
+
import_safePolygon = require("./interactions/safePolygon.native.js"),
|
|
66
|
+
import_useFocus = require("./interactions/useFocus.native.js"),
|
|
67
|
+
import_useRole = require("./interactions/useRole.native.js"),
|
|
68
|
+
import_useClick = require("./interactions/useClick.native.js"),
|
|
69
|
+
import_useListNavigation = require("./interactions/useListNavigation.native.js"),
|
|
70
|
+
import_useTypeahead = require("./interactions/useTypeahead.native.js"),
|
|
71
|
+
import_useInnerOffset = require("./interactions/useInnerOffset.native.js"),
|
|
72
|
+
import_useDelayGroup = require("./interactions/useDelayGroup.native.js"),
|
|
73
|
+
import_inner = require("./middleware/inner.native.js");
|
|
43
74
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","FloatingOverrideContext","import_useFloating","arrow","import_Floating","autoPlacement","autoUpdate","detectOverflow","flip","hide","inline","limitShift","offset","platform","shift","size","useFloating","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,uBAAA,EAAAA,CAAA,KAAAC,kBAAA,CAAAD,uBAAA;EAAAE,KAAA,EAAAA,CAAA,KAAAC,eAAA,CAAAD,KAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAD,eAAA,CAAAC,aAAA;EAAAC,UAAA,EAAAA,CAAA,KAAAF,eAAA,CAAAE,UAAA;EAAAC,cAAA,EAAAA,CAAA,
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","FloatingDelayGroup","import_useDelayGroup","FloatingOverrideContext","import_useFloating","PopupTriggerMap","import_PopupTriggerMap","arrow","import_Floating","autoPlacement","autoUpdate","createFloatingEvents","import_createFloatingEvents","detectOverflow","flip","getOverflowAncestors","hide","inline","inner","import_inner","limitShift","offset","platform","safePolygon","import_safePolygon","shift","size","useClick","import_useClick","useDelayGroup","useDelayGroupContext","useFloating","useFloatingRaw","import_Floating2","useFocus","import_useFocus","useHover","import_useHover","useInnerOffset","import_useInnerOffset","useInteractions","import_useInteractions","useListNavigation","import_useListNavigation","useRole","import_useRole","useTypeahead","import_useTypeahead","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAC,oBAAA,CAAAD,kBAAA;EAAAE,uBAAA,EAAAA,CAAA,KAAAC,kBAAA,CAAAD,uBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAC,sBAAA,CAAAD,eAAA;EAAAE,KAAA,EAAAA,CAAA,KAAAC,eAAA,CAAAD,KAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAD,eAAA,CAAAC,aAAA;EAAAC,UAAA,EAAAA,CAAA,KAAAF,eAAA,CAAAE,UAAA;EAAAC,oBAAA,EAAAA,CAAA,KAAAC,2BAAA,CAAAD,oBAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAL,eAAA,CAAAK,cAAA;EAAAC,IAAA,EAAAA,CAAA,KAAAN,eAAA,CAAAM,IAAA;EAAAC,oBAAA,EAAAA,CAAA,KAAAP,eAAA,CAAAO,oBAAA;EAAAC,IAAA,EAAAA,CAAA,KAAAR,eAAA,CAAAQ,IAAA;EAAAC,MAAA,EAAAA,CAAA,KAAAT,eAAA,CAAAS,MAAA;EAAAC,KAAA,EAAAA,CAAA,KAAAC,YAAA,CAAAD,KAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAZ,eAAA,CAAAY,UAAA;EAAAC,MAAA,EAAAA,CAAA,KAAAb,eAAA,CAAAa,MAAA;EAAAC,QAAA,EAAAA,CAAA,KAAAd,eAAA,CAAAc,QAAA;EAAAC,WAAA,EAAAA,CAAA,KAAAC,kBAAA,CAAAD,WAAA;EAAAE,KAAA,EAAAA,CAAA,KAAAjB,eAAA,CAAAiB,KAAA;EAAAC,IAAA,EAAAA,CAAA,KAAAlB,eAAA,CAAAkB,IAAA;EAAAC,QAAA,EAAAA,CAAA,KAAAC,eAAA,CAAAD,QAAA;EAAAE,aAAA,EAAAA,CAAA,KAAA3B,oBAAA,CAAA2B,aAAA;EAAAC,oBAAA,EAAAA,CAAA,KAAA5B,oBAAA,CAAA4B,oBAAA;EAAAC,WAAA,EAAAA,CAAA,KAAA3B,kBAAA,CAAA2B,WAAA;EAAAC,cAAA,EAAAA,CAAA,KAAAC,gBAAA,CAAAF,WAAA;EAAAG,QAAA,EAAAA,CAAA,KAAAC,eAAA,CAAAD,QAAA;EAAAE,QAAA,EAAAA,CAAA,KAAAC,eAAA,CAAAD,QAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAC,qBAAA,CAAAD,cAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAC,sBAAA,CAAAD,eAAA;EAAAE,iBAAA,EAAAA,CAAA,KAAAC,wBAAA,CAAAD,iBAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAC,cAAA,CAAAD,OAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAC,mBAAA,CAAAD;AAAA;AA6CAE,MAAA,CAAAC,OAAA,GAAAvD,YAcO,CAAAK,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var PopupTriggerMap_exports = {};
|
|
22
|
+
__export(PopupTriggerMap_exports, {
|
|
23
|
+
PopupTriggerMap: () => PopupTriggerMap
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(PopupTriggerMap_exports);
|
|
26
|
+
class PopupTriggerMap {
|
|
27
|
+
map = /* @__PURE__ */new Map();
|
|
28
|
+
elements = /* @__PURE__ */new Set();
|
|
29
|
+
add(id, element) {
|
|
30
|
+
const prev = this.map.get(id);
|
|
31
|
+
prev && this.elements.delete(prev), this.map.set(id, element), this.elements.add(element);
|
|
32
|
+
}
|
|
33
|
+
delete(id) {
|
|
34
|
+
const el = this.map.get(id);
|
|
35
|
+
el && (this.elements.delete(el), this.map.delete(id));
|
|
36
|
+
}
|
|
37
|
+
hasElement(element) {
|
|
38
|
+
return this.elements.has(element);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: !0
|
|
22
|
+
}), mod);
|
|
23
|
+
var PopupTriggerMap_exports = {};
|
|
24
|
+
__export(PopupTriggerMap_exports, {
|
|
25
|
+
PopupTriggerMap: () => PopupTriggerMap
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(PopupTriggerMap_exports);
|
|
28
|
+
function _class_call_check(instance, Constructor) {
|
|
29
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
30
|
+
}
|
|
31
|
+
function _defineProperties(target, props) {
|
|
32
|
+
for (var i = 0; i < props.length; i++) {
|
|
33
|
+
var descriptor = props[i];
|
|
34
|
+
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
38
|
+
return protoProps && _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Constructor;
|
|
39
|
+
}
|
|
40
|
+
function _define_property(obj, key, value) {
|
|
41
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
42
|
+
value,
|
|
43
|
+
enumerable: !0,
|
|
44
|
+
configurable: !0,
|
|
45
|
+
writable: !0
|
|
46
|
+
}) : obj[key] = value, obj;
|
|
47
|
+
}
|
|
48
|
+
var PopupTriggerMap = /* @__PURE__ */function () {
|
|
49
|
+
"use strict";
|
|
50
|
+
|
|
51
|
+
function PopupTriggerMap2() {
|
|
52
|
+
_class_call_check(this, PopupTriggerMap2), _define_property(this, "map", /* @__PURE__ */new Map()), _define_property(this, "elements", /* @__PURE__ */new Set());
|
|
53
|
+
}
|
|
54
|
+
return _create_class(PopupTriggerMap2, [{
|
|
55
|
+
key: "add",
|
|
56
|
+
value: function (id, element) {
|
|
57
|
+
var prev = this.map.get(id);
|
|
58
|
+
prev && this.elements.delete(prev), this.map.set(id, element), this.elements.add(element);
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "delete",
|
|
62
|
+
value: function (id) {
|
|
63
|
+
var el = this.map.get(id);
|
|
64
|
+
el && (this.elements.delete(el), this.map.delete(id));
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
key: "hasElement",
|
|
68
|
+
value: function (element) {
|
|
69
|
+
return this.elements.has(element);
|
|
70
|
+
}
|
|
71
|
+
}]), PopupTriggerMap2;
|
|
72
|
+
}();
|
|
73
|
+
//# sourceMappingURL=PopupTriggerMap.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","PopupTriggerMap_exports","__export","PopupTriggerMap","module","exports","_class_call_check","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_create_class","protoProps","staticProps","prototype","_define_property","obj"],"sources":["../../../src/interactions/PopupTriggerMap.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AAKOC,MAAM,CAAAC,OAAA,GAAAT,YAAgB,CAAAK,uBAAA;AAAA,SACbK,kBAAAC,QAAyB,EAAAC,WAAA;EAC/B,MAAAD,QAAW,YAAAC,WAAiB,GAEpC,MAAgB,IAAAC,SAAkB;AAChC;AACA,SAAIC,iBACYA,CAAAC,MAAO,EAAAC,KAEvB;EAEF,SAAAC,CAAA,MAAAA,CAAA,GAAAD,KAAA,CAAAE,MAAA,EAAAD,CAAA;IAEA,IAAAE,UAAmB,GAAAH,KAAA,CAAAC,CAAA;IACjBE,UAAM,CAAKC,UAAS,GAAID,UAAE,CAAAC,UAAA,QAAAD,UAAA,CAAAE,YAAA,kBAAAF,UAAA,KAAAA,UAAA,CAAAG,QAAA,QAAAC,MAAA,CAAAC,cAAA,CAAAT,MAAA,EAAAI,UAAA,CAAAM,GAAA,EAAAN,UAAA;EAC1B;AAEoB;AAEtB,SAEAO,aAAsCA,CAAAd,WAAA,EAAAe,UAAA,EAAAC,WAAA;EACpC,OAAAD,UAAY,IAAAb,iBAAoB,CAAAF,WAAA,CAAAiB,SAAA,EAAAF,UAAA,GAAAC,WAAA,IAAAd,iBAAA,CAAAF,WAAA,EAAAgB,WAAA,GAAAhB,WAAA;AAAA;AAEpC,SAAAkB,iBAAAC,GAAA,EAAAN,GAAA,EAAArB,KAAA","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var createFloatingEvents_exports = {};
|
|
22
|
+
__export(createFloatingEvents_exports, {
|
|
23
|
+
createFloatingEvents: () => createFloatingEvents
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(createFloatingEvents_exports);
|
|
26
|
+
function createFloatingEvents() {
|
|
27
|
+
const listeners = /* @__PURE__ */new Map();
|
|
28
|
+
return {
|
|
29
|
+
emit(event, data) {
|
|
30
|
+
listeners.get(event)?.forEach(fn => fn(data));
|
|
31
|
+
},
|
|
32
|
+
on(event, handler) {
|
|
33
|
+
let set = listeners.get(event);
|
|
34
|
+
set || (set = /* @__PURE__ */new Set(), listeners.set(event, set)), set.add(handler);
|
|
35
|
+
},
|
|
36
|
+
off(event, handler) {
|
|
37
|
+
const set = listeners.get(event);
|
|
38
|
+
set && (set.delete(handler), set.size === 0 && listeners.delete(event));
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: !0
|
|
22
|
+
}), mod);
|
|
23
|
+
var createFloatingEvents_exports = {};
|
|
24
|
+
__export(createFloatingEvents_exports, {
|
|
25
|
+
createFloatingEvents: () => createFloatingEvents
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(createFloatingEvents_exports);
|
|
28
|
+
function createFloatingEvents() {
|
|
29
|
+
var listeners = /* @__PURE__ */new Map();
|
|
30
|
+
return {
|
|
31
|
+
emit(event, data) {
|
|
32
|
+
var _listeners_get;
|
|
33
|
+
(_listeners_get = listeners.get(event)) === null || _listeners_get === void 0 || _listeners_get.forEach(function (fn) {
|
|
34
|
+
return fn(data);
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
on(event, handler) {
|
|
38
|
+
var set = listeners.get(event);
|
|
39
|
+
set || (set = /* @__PURE__ */new Set(), listeners.set(event, set)), set.add(handler);
|
|
40
|
+
},
|
|
41
|
+
off(event, handler) {
|
|
42
|
+
var set = listeners.get(event);
|
|
43
|
+
set && (set.delete(handler), set.size === 0 && listeners.delete(event));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=createFloatingEvents.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","createFloatingEvents_exports","__export","createFloatingEvents","module","exports","listeners","Map","emit","event","data","_listeners_get","get","forEach","fn","on","handler","set","Set","add","off"],"sources":["../../../src/interactions/createFloatingEvents.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,4BAAA;AAAAC,QAAA,CAAAD,4BAAA;EAAAE,oBAAA,EAAAA,CAAA,KAAAA;AAAA;AAUOC,MAAA,CAAAC,OAAS,GAAAT,YAAA,CAAAK,4BAAuC;AACrD,SAAME,oBAAYA,CAAA;EAElB,IAAAG,SAAO,sBAAAC,GAAA;EAAA,OACA;IACHC,KAAAC,KAAA,EAAUC,IAAI;MAChB,IAAAC,cAAA;MACA,CAAGA,cAAO,GAASL,SAAA,CAAAM,GAAA,CAAAH,KAAA,eAAAE,cAAA,eAAAA,cAAA,CAAAE,OAAA,WAAAC,EAAA;QACjB,OAAIA,EAAM,CAAAJ,IAAA;MACL;IAKP;IACAK,GAAAN,KAAI,EAAAO,OAAO;MACT,IAAAC,GAAM,GAAAX,SAAM,CAAAM,GAAU,CAAAH,KAAI;MACtBQ,GAAA,KACFA,GAAA,GAAI,eACA,IAAIC,GAAA,IAAAZ,SAAY,CAAAW,GAAA,CAAAR,KAAU,EAAAQ,GAAO,IAAKA,GAAA,CAAAE,GAAA,CAAAH,OAAA;IAE9C;IACFI,IAAAX,KAAA,EAAAO,OAAA;MACF,IAAAC,GAAA,GAAAX,SAAA,CAAAM,GAAA,CAAAH,KAAA","ignoreList":[]}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var safePolygon_exports = {};
|
|
22
|
+
__export(safePolygon_exports, {
|
|
23
|
+
safePolygon: () => safePolygon
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(safePolygon_exports);
|
|
26
|
+
var import_utils = require("./utils.cjs");
|
|
27
|
+
function isPointInPolygon(point, polygon) {
|
|
28
|
+
const [x, y] = point;
|
|
29
|
+
let isInside2 = !1;
|
|
30
|
+
const length = polygon.length;
|
|
31
|
+
for (let i = 0, j = length - 1; i < length; j = i++) {
|
|
32
|
+
const [xi, yi] = polygon[i] || [0, 0],
|
|
33
|
+
[xj, yj] = polygon[j] || [0, 0];
|
|
34
|
+
yi >= y != yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi && (isInside2 = !isInside2);
|
|
35
|
+
}
|
|
36
|
+
return isInside2;
|
|
37
|
+
}
|
|
38
|
+
function isInside(point, rect) {
|
|
39
|
+
return point[0] >= rect.x && point[0] <= rect.x + rect.width && point[1] >= rect.y && point[1] <= rect.y + rect.height;
|
|
40
|
+
}
|
|
41
|
+
let debugSvg = null;
|
|
42
|
+
function debugDrawPolygon(polygon, trough, cursor, anchor) {
|
|
43
|
+
if (debugSvg || (debugSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg"), debugSvg.id = "__safe-polygon-debug", Object.assign(debugSvg.style, {
|
|
44
|
+
position: "fixed",
|
|
45
|
+
inset: "0",
|
|
46
|
+
width: "100vw",
|
|
47
|
+
height: "100vh",
|
|
48
|
+
pointerEvents: "none",
|
|
49
|
+
zIndex: "999999"
|
|
50
|
+
}), document.body.appendChild(debugSvg)), debugSvg.innerHTML = "", trough.length) {
|
|
51
|
+
const troughEl = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
|
|
52
|
+
troughEl.setAttribute("points", trough.map(p => p.join(",")).join(" ")), troughEl.setAttribute("fill", "rgba(0,100,255,0.15)"), troughEl.setAttribute("stroke", "rgba(0,100,255,0.6)"), troughEl.setAttribute("stroke-width", "1"), debugSvg.appendChild(troughEl);
|
|
53
|
+
}
|
|
54
|
+
if (polygon.length) {
|
|
55
|
+
const polyEl = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
|
|
56
|
+
polyEl.setAttribute("points", polygon.map(p => p.join(",")).join(" ")), polyEl.setAttribute("fill", "rgba(255,50,50,0.2)"), polyEl.setAttribute("stroke", "rgba(255,50,50,0.8)"), polyEl.setAttribute("stroke-width", "1.5"), debugSvg.appendChild(polyEl);
|
|
57
|
+
}
|
|
58
|
+
const anchorCircle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
59
|
+
anchorCircle.setAttribute("cx", String(anchor[0])), anchorCircle.setAttribute("cy", String(anchor[1])), anchorCircle.setAttribute("r", "5"), anchorCircle.setAttribute("fill", "lime"), anchorCircle.setAttribute("stroke", "darkgreen"), anchorCircle.setAttribute("stroke-width", "1.5"), debugSvg.appendChild(anchorCircle);
|
|
60
|
+
const cursorCircle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
61
|
+
cursorCircle.setAttribute("cx", String(cursor[0])), cursorCircle.setAttribute("cy", String(cursor[1])), cursorCircle.setAttribute("r", "4"), cursorCircle.setAttribute("fill", "yellow"), cursorCircle.setAttribute("stroke", "orange"), cursorCircle.setAttribute("stroke-width", "1.5"), debugSvg.appendChild(cursorCircle);
|
|
62
|
+
}
|
|
63
|
+
function debugClear() {
|
|
64
|
+
debugSvg && (debugSvg.remove(), debugSvg = null);
|
|
65
|
+
}
|
|
66
|
+
function safePolygon(options = {}) {
|
|
67
|
+
const {
|
|
68
|
+
buffer = 0.5,
|
|
69
|
+
blockPointerEvents = !1,
|
|
70
|
+
requireIntent = !0,
|
|
71
|
+
__debug = !1
|
|
72
|
+
} = options,
|
|
73
|
+
timeoutRef = {
|
|
74
|
+
current: -1
|
|
75
|
+
};
|
|
76
|
+
let hasLanded = !1,
|
|
77
|
+
lastX = null,
|
|
78
|
+
lastY = null,
|
|
79
|
+
lastCursorTime = typeof performance < "u" ? performance.now() : 0;
|
|
80
|
+
function getCursorSpeed(x, y) {
|
|
81
|
+
const currentTime = performance.now(),
|
|
82
|
+
elapsedTime = currentTime - lastCursorTime;
|
|
83
|
+
if (lastX === null || lastY === null || elapsedTime === 0) return lastX = x, lastY = y, lastCursorTime = currentTime, null;
|
|
84
|
+
const deltaX = x - lastX,
|
|
85
|
+
deltaY = y - lastY,
|
|
86
|
+
speed = Math.sqrt(deltaX * deltaX + deltaY * deltaY) / elapsedTime;
|
|
87
|
+
return lastX = x, lastY = y, lastCursorTime = currentTime, speed;
|
|
88
|
+
}
|
|
89
|
+
const fn = ({
|
|
90
|
+
x,
|
|
91
|
+
y,
|
|
92
|
+
placement,
|
|
93
|
+
elements,
|
|
94
|
+
onClose
|
|
95
|
+
}) => (hasLanded = !1, lastX = null, lastY = null, function (event) {
|
|
96
|
+
function close() {
|
|
97
|
+
(0, import_utils.clearTimeoutIfSet)(timeoutRef), onClose();
|
|
98
|
+
}
|
|
99
|
+
(0, import_utils.clearTimeoutIfSet)(timeoutRef);
|
|
100
|
+
const domReference = elements.domReference ?? elements.reference;
|
|
101
|
+
if (!domReference || !elements.floating || placement == null || x == null || y == null) return;
|
|
102
|
+
const {
|
|
103
|
+
clientX,
|
|
104
|
+
clientY
|
|
105
|
+
} = event,
|
|
106
|
+
clientPoint = [clientX, clientY],
|
|
107
|
+
target = (0, import_utils.getTarget)(event),
|
|
108
|
+
isLeave = event.type === "mouseleave",
|
|
109
|
+
isOverFloatingEl = (0, import_utils.contains)(elements.floating, target),
|
|
110
|
+
isOverReferenceEl = (0, import_utils.contains)(domReference, target),
|
|
111
|
+
refRect = domReference.getBoundingClientRect(),
|
|
112
|
+
rect = elements.floating.getBoundingClientRect(),
|
|
113
|
+
side = placement.split("-")[0],
|
|
114
|
+
cursorLeaveFromRight = x > rect.right - rect.width / 2,
|
|
115
|
+
cursorLeaveFromBottom = y > rect.bottom - rect.height / 2,
|
|
116
|
+
isOverReferenceRect = isInside(clientPoint, refRect),
|
|
117
|
+
isFloatingWider = rect.width > refRect.width,
|
|
118
|
+
isFloatingTaller = rect.height > refRect.height,
|
|
119
|
+
left = (isFloatingWider ? refRect : rect).left,
|
|
120
|
+
right = (isFloatingWider ? refRect : rect).right,
|
|
121
|
+
top = (isFloatingTaller ? refRect : rect).top,
|
|
122
|
+
bottom = (isFloatingTaller ? refRect : rect).bottom;
|
|
123
|
+
if (isOverFloatingEl && (hasLanded = !0, !isLeave)) return;
|
|
124
|
+
if (isOverReferenceEl && (hasLanded = !1), isOverReferenceEl && !isLeave) {
|
|
125
|
+
hasLanded = !0;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (!isOverReferenceEl && isOverReferenceRect && !isLeave || isLeave && event.relatedTarget && (0, import_utils.contains)(elements.floating, event.relatedTarget)) return;
|
|
129
|
+
if (side === "top" && y >= refRect.bottom - 1 || side === "bottom" && y <= refRect.top + 1 || side === "left" && x >= refRect.right - 1 || side === "right" && x <= refRect.left + 1) return close();
|
|
130
|
+
let rectPoly = [];
|
|
131
|
+
switch (side) {
|
|
132
|
+
case "top":
|
|
133
|
+
rectPoly = [[left, refRect.top + 1], [left, rect.bottom - 1], [right, rect.bottom - 1], [right, refRect.top + 1]];
|
|
134
|
+
break;
|
|
135
|
+
case "bottom":
|
|
136
|
+
rectPoly = [[left, rect.top + 1], [left, refRect.bottom - 1], [right, refRect.bottom - 1], [right, rect.top + 1]];
|
|
137
|
+
break;
|
|
138
|
+
case "left":
|
|
139
|
+
rectPoly = [[rect.right - 1, bottom], [rect.right - 1, top], [refRect.left + 1, top], [refRect.left + 1, bottom]];
|
|
140
|
+
break;
|
|
141
|
+
case "right":
|
|
142
|
+
rectPoly = [[refRect.right - 1, bottom], [refRect.right - 1, top], [rect.left + 1, top], [rect.left + 1, bottom]];
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
function getPolygon([x2, y2]) {
|
|
146
|
+
switch (side) {
|
|
147
|
+
case "top":
|
|
148
|
+
{
|
|
149
|
+
const cursorPointOne = [isFloatingWider ? x2 + buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4, y2 + buffer + 1],
|
|
150
|
+
cursorPointTwo = [isFloatingWider ? x2 - buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4, y2 + buffer + 1],
|
|
151
|
+
commonPoints = [[rect.left, cursorLeaveFromRight || isFloatingWider ? rect.bottom - buffer : rect.top], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer]];
|
|
152
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
153
|
+
}
|
|
154
|
+
case "bottom":
|
|
155
|
+
{
|
|
156
|
+
const cursorPointOne = [isFloatingWider ? x2 + buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4, y2 - buffer],
|
|
157
|
+
cursorPointTwo = [isFloatingWider ? x2 - buffer / 2 : cursorLeaveFromRight ? x2 + buffer * 4 : x2 - buffer * 4, y2 - buffer],
|
|
158
|
+
commonPoints = [[rect.left, cursorLeaveFromRight || isFloatingWider ? rect.top + buffer : rect.bottom], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer]];
|
|
159
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
160
|
+
}
|
|
161
|
+
case "left":
|
|
162
|
+
{
|
|
163
|
+
const cursorPointOne = [x2 + buffer + 1, isFloatingTaller ? y2 + buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4],
|
|
164
|
+
cursorPointTwo = [x2 + buffer + 1, isFloatingTaller ? y2 - buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4];
|
|
165
|
+
return [...[[cursorLeaveFromBottom || isFloatingTaller ? rect.right - buffer : rect.left, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer, rect.bottom]], cursorPointOne, cursorPointTwo];
|
|
166
|
+
}
|
|
167
|
+
case "right":
|
|
168
|
+
{
|
|
169
|
+
const cursorPointOne = [x2 - buffer, isFloatingTaller ? y2 + buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4],
|
|
170
|
+
cursorPointTwo = [x2 - buffer, isFloatingTaller ? y2 - buffer / 2 : cursorLeaveFromBottom ? y2 + buffer * 4 : y2 - buffer * 4],
|
|
171
|
+
commonPoints = [[cursorLeaveFromBottom || isFloatingTaller ? rect.left + buffer : rect.right, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer, rect.bottom]];
|
|
172
|
+
return [cursorPointOne, cursorPointTwo, ...commonPoints];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const poly = getPolygon([x, y]);
|
|
177
|
+
if (__debug && debugDrawPolygon(poly, rectPoly, clientPoint, [x, y]), !isPointInPolygon([clientX, clientY], rectPoly)) {
|
|
178
|
+
if (hasLanded && !isOverReferenceRect) return __debug && debugClear(), close();
|
|
179
|
+
if (!isPointInPolygon([clientX, clientY], poly)) {
|
|
180
|
+
if (!isLeave && requireIntent) {
|
|
181
|
+
const cursorSpeed = getCursorSpeed(clientX, clientY);
|
|
182
|
+
if (cursorSpeed !== null && cursorSpeed < 0.1) return __debug && debugClear(), close();
|
|
183
|
+
}
|
|
184
|
+
__debug && debugClear(), close();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
return fn.__options = {
|
|
189
|
+
blockPointerEvents
|
|
190
|
+
}, fn;
|
|
191
|
+
}
|