@hanzogui/floating 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/Floating.cjs +18 -0
  3. package/dist/cjs/Floating.native.js +37 -0
  4. package/dist/cjs/Floating.native.js.map +1 -0
  5. package/dist/cjs/index.cjs +71 -0
  6. package/dist/cjs/index.native.js +74 -0
  7. package/dist/cjs/index.native.js.map +1 -0
  8. package/dist/cjs/interactions/PopupTriggerMap.cjs +40 -0
  9. package/dist/cjs/interactions/PopupTriggerMap.native.js +73 -0
  10. package/dist/cjs/interactions/PopupTriggerMap.native.js.map +1 -0
  11. package/dist/cjs/interactions/createFloatingEvents.cjs +41 -0
  12. package/dist/cjs/interactions/createFloatingEvents.native.js +47 -0
  13. package/dist/cjs/interactions/createFloatingEvents.native.js.map +1 -0
  14. package/dist/cjs/interactions/safePolygon.cjs +191 -0
  15. package/dist/cjs/interactions/safePolygon.native.js +205 -0
  16. package/dist/cjs/interactions/safePolygon.native.js.map +1 -0
  17. package/dist/cjs/interactions/types.cjs +16 -0
  18. package/dist/cjs/interactions/types.native.js +19 -0
  19. package/dist/cjs/interactions/types.native.js.map +1 -0
  20. package/dist/cjs/interactions/useClick.cjs +82 -0
  21. package/dist/cjs/interactions/useClick.native.js +90 -0
  22. package/dist/cjs/interactions/useClick.native.js.map +1 -0
  23. package/dist/cjs/interactions/useDelayGroup.cjs +96 -0
  24. package/dist/cjs/interactions/useDelayGroup.native.js +109 -0
  25. package/dist/cjs/interactions/useDelayGroup.native.js.map +1 -0
  26. package/dist/cjs/interactions/useFocus.cjs +101 -0
  27. package/dist/cjs/interactions/useFocus.native.js +113 -0
  28. package/dist/cjs/interactions/useFocus.native.js.map +1 -0
  29. package/dist/cjs/interactions/useHover.cjs +224 -0
  30. package/dist/cjs/interactions/useHover.native.js +248 -0
  31. package/dist/cjs/interactions/useHover.native.js.map +1 -0
  32. package/dist/cjs/interactions/useInnerOffset.cjs +104 -0
  33. package/dist/cjs/interactions/useInnerOffset.native.js +118 -0
  34. package/dist/cjs/interactions/useInnerOffset.native.js.map +1 -0
  35. package/dist/cjs/interactions/useInteractions.cjs +76 -0
  36. package/dist/cjs/interactions/useInteractions.native.js +164 -0
  37. package/dist/cjs/interactions/useInteractions.native.js.map +1 -0
  38. package/dist/cjs/interactions/useListNavigation.cjs +253 -0
  39. package/dist/cjs/interactions/useListNavigation.native.js +297 -0
  40. package/dist/cjs/interactions/useListNavigation.native.js.map +1 -0
  41. package/dist/cjs/interactions/useRole.cjs +112 -0
  42. package/dist/cjs/interactions/useRole.native.js +128 -0
  43. package/dist/cjs/interactions/useRole.native.js.map +1 -0
  44. package/dist/cjs/interactions/useTypeahead.cjs +93 -0
  45. package/dist/cjs/interactions/useTypeahead.native.js +114 -0
  46. package/dist/cjs/interactions/useTypeahead.native.js.map +1 -0
  47. package/dist/cjs/interactions/utils.cjs +178 -0
  48. package/dist/cjs/interactions/utils.native.js +188 -0
  49. package/dist/cjs/interactions/utils.native.js.map +1 -0
  50. package/dist/cjs/middleware/inner.cjs +106 -0
  51. package/dist/cjs/middleware/inner.native.js +120 -0
  52. package/dist/cjs/middleware/inner.native.js.map +1 -0
  53. package/dist/cjs/useFloating.cjs +61 -0
  54. package/dist/cjs/useFloating.native.js +67 -0
  55. package/dist/cjs/useFloating.native.js.map +1 -0
  56. package/dist/esm/Floating.mjs +2 -0
  57. package/dist/esm/Floating.mjs.map +1 -0
  58. package/dist/esm/Floating.native.js +8 -0
  59. package/dist/esm/Floating.native.js.map +1 -0
  60. package/dist/esm/index.js +18 -0
  61. package/dist/esm/index.js.map +1 -0
  62. package/dist/esm/index.mjs +18 -0
  63. package/dist/esm/index.mjs.map +1 -0
  64. package/dist/esm/index.native.js +18 -0
  65. package/dist/esm/index.native.js.map +1 -0
  66. package/dist/esm/interactions/PopupTriggerMap.mjs +17 -0
  67. package/dist/esm/interactions/PopupTriggerMap.mjs.map +1 -0
  68. package/dist/esm/interactions/PopupTriggerMap.native.js +47 -0
  69. package/dist/esm/interactions/PopupTriggerMap.native.js.map +1 -0
  70. package/dist/esm/interactions/createFloatingEvents.mjs +18 -0
  71. package/dist/esm/interactions/createFloatingEvents.mjs.map +1 -0
  72. package/dist/esm/interactions/createFloatingEvents.native.js +21 -0
  73. package/dist/esm/interactions/createFloatingEvents.native.js.map +1 -0
  74. package/dist/esm/interactions/safePolygon.mjs +168 -0
  75. package/dist/esm/interactions/safePolygon.mjs.map +1 -0
  76. package/dist/esm/interactions/safePolygon.native.js +179 -0
  77. package/dist/esm/interactions/safePolygon.native.js.map +1 -0
  78. package/dist/esm/interactions/types.mjs +2 -0
  79. package/dist/esm/interactions/types.mjs.map +1 -0
  80. package/dist/esm/interactions/types.native.js +2 -0
  81. package/dist/esm/interactions/types.native.js.map +1 -0
  82. package/dist/esm/interactions/useClick.mjs +59 -0
  83. package/dist/esm/interactions/useClick.mjs.map +1 -0
  84. package/dist/esm/interactions/useClick.native.js +64 -0
  85. package/dist/esm/interactions/useClick.native.js.map +1 -0
  86. package/dist/esm/interactions/useDelayGroup.mjs +60 -0
  87. package/dist/esm/interactions/useDelayGroup.mjs.map +1 -0
  88. package/dist/esm/interactions/useDelayGroup.native.js +70 -0
  89. package/dist/esm/interactions/useDelayGroup.native.js.map +1 -0
  90. package/dist/esm/interactions/useFocus.mjs +78 -0
  91. package/dist/esm/interactions/useFocus.mjs.map +1 -0
  92. package/dist/esm/interactions/useFocus.native.js +87 -0
  93. package/dist/esm/interactions/useFocus.native.js.map +1 -0
  94. package/dist/esm/interactions/useHover.mjs +189 -0
  95. package/dist/esm/interactions/useHover.mjs.map +1 -0
  96. package/dist/esm/interactions/useHover.native.js +210 -0
  97. package/dist/esm/interactions/useHover.native.js.map +1 -0
  98. package/dist/esm/interactions/useInnerOffset.mjs +70 -0
  99. package/dist/esm/interactions/useInnerOffset.mjs.map +1 -0
  100. package/dist/esm/interactions/useInnerOffset.native.js +81 -0
  101. package/dist/esm/interactions/useInnerOffset.native.js.map +1 -0
  102. package/dist/esm/interactions/useInteractions.mjs +53 -0
  103. package/dist/esm/interactions/useInteractions.mjs.map +1 -0
  104. package/dist/esm/interactions/useInteractions.native.js +138 -0
  105. package/dist/esm/interactions/useInteractions.native.js.map +1 -0
  106. package/dist/esm/interactions/useListNavigation.mjs +230 -0
  107. package/dist/esm/interactions/useListNavigation.mjs.map +1 -0
  108. package/dist/esm/interactions/useListNavigation.native.js +271 -0
  109. package/dist/esm/interactions/useListNavigation.native.js.map +1 -0
  110. package/dist/esm/interactions/useRole.mjs +78 -0
  111. package/dist/esm/interactions/useRole.mjs.map +1 -0
  112. package/dist/esm/interactions/useRole.native.js +91 -0
  113. package/dist/esm/interactions/useRole.native.js.map +1 -0
  114. package/dist/esm/interactions/useTypeahead.mjs +70 -0
  115. package/dist/esm/interactions/useTypeahead.mjs.map +1 -0
  116. package/dist/esm/interactions/useTypeahead.native.js +88 -0
  117. package/dist/esm/interactions/useTypeahead.native.js.map +1 -0
  118. package/dist/esm/interactions/utils.mjs +134 -0
  119. package/dist/esm/interactions/utils.mjs.map +1 -0
  120. package/dist/esm/interactions/utils.native.js +141 -0
  121. package/dist/esm/interactions/utils.native.js.map +1 -0
  122. package/dist/esm/middleware/inner.mjs +72 -0
  123. package/dist/esm/middleware/inner.mjs.map +1 -0
  124. package/dist/esm/middleware/inner.native.js +83 -0
  125. package/dist/esm/middleware/inner.native.js.map +1 -0
  126. package/dist/esm/useFloating.mjs +26 -0
  127. package/dist/esm/useFloating.mjs.map +1 -0
  128. package/dist/esm/useFloating.native.js +29 -0
  129. package/dist/esm/useFloating.native.js.map +1 -0
  130. package/package.json +50 -0
  131. package/src/Floating.native.tsx +45 -0
  132. package/src/Floating.tsx +1 -0
  133. package/src/index.ts +116 -0
  134. package/src/interactions/PopupTriggerMap.ts +30 -0
  135. package/src/interactions/createFloatingEvents.ts +34 -0
  136. package/src/interactions/safePolygon.ts +500 -0
  137. package/src/interactions/types.ts +165 -0
  138. package/src/interactions/useClick.ts +148 -0
  139. package/src/interactions/useDelayGroup.ts +114 -0
  140. package/src/interactions/useFocus.ts +164 -0
  141. package/src/interactions/useHover.ts +453 -0
  142. package/src/interactions/useInnerOffset.ts +116 -0
  143. package/src/interactions/useInteractions.ts +101 -0
  144. package/src/interactions/useListNavigation.ts +578 -0
  145. package/src/interactions/useRole.ts +103 -0
  146. package/src/interactions/useTypeahead.ts +173 -0
  147. package/src/interactions/utils.ts +234 -0
  148. package/src/middleware/inner.ts +142 -0
  149. package/src/useFloating.tsx +53 -0
  150. package/types/Floating.d.ts +2 -0
  151. package/types/Floating.d.ts.map +1 -0
  152. package/types/Floating.native.d.ts +41 -0
  153. package/types/Floating.native.d.ts.map +1 -0
  154. package/types/index.d.ts +19 -0
  155. package/types/index.d.ts.map +1 -0
  156. package/types/interactions/PopupTriggerMap.d.ts +8 -0
  157. package/types/interactions/PopupTriggerMap.d.ts.map +1 -0
  158. package/types/interactions/createFloatingEvents.d.ts +7 -0
  159. package/types/interactions/createFloatingEvents.d.ts.map +1 -0
  160. package/types/interactions/safePolygon.d.ts +4 -0
  161. package/types/interactions/safePolygon.d.ts.map +1 -0
  162. package/types/interactions/types.d.ts +123 -0
  163. package/types/interactions/types.d.ts.map +1 -0
  164. package/types/interactions/useClick.d.ts +3 -0
  165. package/types/interactions/useClick.d.ts.map +1 -0
  166. package/types/interactions/useDelayGroup.d.ts +23 -0
  167. package/types/interactions/useDelayGroup.d.ts.map +1 -0
  168. package/types/interactions/useFocus.d.ts +3 -0
  169. package/types/interactions/useFocus.d.ts.map +1 -0
  170. package/types/interactions/useHover.d.ts +6 -0
  171. package/types/interactions/useHover.d.ts.map +1 -0
  172. package/types/interactions/useInnerOffset.d.ts +3 -0
  173. package/types/interactions/useInnerOffset.d.ts.map +1 -0
  174. package/types/interactions/useInteractions.d.ts +8 -0
  175. package/types/interactions/useInteractions.d.ts.map +1 -0
  176. package/types/interactions/useListNavigation.d.ts +3 -0
  177. package/types/interactions/useListNavigation.d.ts.map +1 -0
  178. package/types/interactions/useRole.d.ts +3 -0
  179. package/types/interactions/useRole.d.ts.map +1 -0
  180. package/types/interactions/useTypeahead.d.ts +3 -0
  181. package/types/interactions/useTypeahead.d.ts.map +1 -0
  182. package/types/interactions/utils.d.ts +46 -0
  183. package/types/interactions/utils.d.ts.map +1 -0
  184. package/types/middleware/inner.d.ts +14 -0
  185. package/types/middleware/inner.d.ts.map +1 -0
  186. package/types/useFloating.d.ts +28 -0
  187. package/types/useFloating.d.ts.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var Floating_exports = {};
17
+ module.exports = __toCommonJS(Floating_exports);
18
+ __reExport(Floating_exports, require("@floating-ui/react-dom"), module.exports);
@@ -0,0 +1,37 @@
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
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
22
+ value: !0
23
+ }), mod);
24
+ var Floating_native_exports = {};
25
+ __export(Floating_native_exports, {
26
+ autoUpdate: () => autoUpdate,
27
+ getOverflowAncestors: () => getOverflowAncestors,
28
+ platform: () => platform
29
+ });
30
+ module.exports = __toCommonJS(Floating_native_exports);
31
+ __reExport(Floating_native_exports, require("@floating-ui/react-native"), module.exports);
32
+ var autoUpdate = function () {},
33
+ getOverflowAncestors = function () {
34
+ return [];
35
+ },
36
+ platform = null;
37
+ //# sourceMappingURL=Floating.native.js.map
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1,71 @@
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 index_exports = {};
22
+ __export(index_exports, {
23
+ FloatingDelayGroup: () => import_useDelayGroup.FloatingDelayGroup,
24
+ FloatingOverrideContext: () => import_useFloating.FloatingOverrideContext,
25
+ PopupTriggerMap: () => import_PopupTriggerMap.PopupTriggerMap,
26
+ arrow: () => import_Floating.arrow,
27
+ autoPlacement: () => import_Floating.autoPlacement,
28
+ autoUpdate: () => import_Floating.autoUpdate,
29
+ createFloatingEvents: () => import_createFloatingEvents.createFloatingEvents,
30
+ detectOverflow: () => import_Floating.detectOverflow,
31
+ flip: () => import_Floating.flip,
32
+ getOverflowAncestors: () => import_Floating.getOverflowAncestors,
33
+ hide: () => import_Floating.hide,
34
+ inline: () => import_Floating.inline,
35
+ inner: () => import_inner.inner,
36
+ limitShift: () => import_Floating.limitShift,
37
+ offset: () => import_Floating.offset,
38
+ platform: () => import_Floating.platform,
39
+ safePolygon: () => import_safePolygon.safePolygon,
40
+ shift: () => import_Floating.shift,
41
+ size: () => import_Floating.size,
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
54
+ });
55
+ module.exports = __toCommonJS(index_exports);
56
+ var import_Floating = require("./Floating.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");
@@ -0,0 +1,74 @@
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 index_exports = {};
24
+ __export(index_exports, {
25
+ FloatingDelayGroup: () => import_useDelayGroup.FloatingDelayGroup,
26
+ FloatingOverrideContext: () => import_useFloating.FloatingOverrideContext,
27
+ PopupTriggerMap: () => import_PopupTriggerMap.PopupTriggerMap,
28
+ arrow: () => import_Floating.arrow,
29
+ autoPlacement: () => import_Floating.autoPlacement,
30
+ autoUpdate: () => import_Floating.autoUpdate,
31
+ createFloatingEvents: () => import_createFloatingEvents.createFloatingEvents,
32
+ detectOverflow: () => import_Floating.detectOverflow,
33
+ flip: () => import_Floating.flip,
34
+ getOverflowAncestors: () => import_Floating.getOverflowAncestors,
35
+ hide: () => import_Floating.hide,
36
+ inline: () => import_Floating.inline,
37
+ inner: () => import_inner.inner,
38
+ limitShift: () => import_Floating.limitShift,
39
+ offset: () => import_Floating.offset,
40
+ platform: () => import_Floating.platform,
41
+ safePolygon: () => import_safePolygon.safePolygon,
42
+ shift: () => import_Floating.shift,
43
+ size: () => import_Floating.size,
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
56
+ });
57
+ module.exports = __toCommonJS(index_exports);
58
+ var import_Floating = require("./Floating.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");
74
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
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
+ }