hys-ui 0.2.0 → 0.3.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 (201) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +15 -1
  3. package/dist/components/HysAlert/HysAlert.vue.js +5 -54
  4. package/dist/components/HysAlert/HysAlert2.vue.js +159 -2
  5. package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +2 -2
  6. package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +285 -273
  7. package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +1 -1
  8. package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +102 -98
  9. package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +1 -1
  10. package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +273 -59
  11. package/dist/components/HysCalendar/HysCalendar.vue.js +3 -3
  12. package/dist/components/HysCalendar/HysCalendar2.vue.js +237 -225
  13. package/dist/components/HysCascader/HysCascader.vue.js +2 -2
  14. package/dist/components/HysCascader/HysCascader2.vue.js +337 -324
  15. package/dist/components/HysColorPicker/HysColorPanel.vue.js +7 -0
  16. package/dist/components/HysColorPicker/HysColorPanel2.vue.js +238 -0
  17. package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
  18. package/dist/components/HysColorPicker/HysColorPicker2.vue.js +239 -217
  19. package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +90 -76
  20. package/dist/components/HysContextMenu/HysContextMenu.vue.js +5 -89
  21. package/dist/components/HysContextMenu/HysContextMenu2.vue.js +247 -2
  22. package/dist/components/HysContextMenu/HysMenuPanel.vue.js +7 -0
  23. package/dist/components/HysContextMenu/HysMenuPanel2.vue.js +208 -0
  24. package/dist/components/HysContextMenu/HysMenuSlot.js +10 -0
  25. package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
  26. package/dist/components/HysDataGrid/HysDataGrid2.vue.js +1008 -559
  27. package/dist/components/HysDatePicker/HysDatePicker.vue.js +2 -0
  28. package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +2 -2
  29. package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +539 -526
  30. package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +5 -3
  31. package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
  32. package/dist/components/HysDrawer/HysDrawer2.vue.js +434 -84
  33. package/dist/components/HysEmpty/HysEmpty.vue.js +5 -41
  34. package/dist/components/HysEmpty/HysEmpty2.vue.js +181 -2
  35. package/dist/components/HysFormItem/HysFormItem.vue.js +2 -2
  36. package/dist/components/HysFormItem/HysFormItem2.vue.js +171 -164
  37. package/dist/components/HysGantt/HysGantt.vue.js +1 -1
  38. package/dist/components/HysGantt/HysGantt2.vue.js +810 -795
  39. package/dist/components/HysMention/HysMention.vue.js +1 -1
  40. package/dist/components/HysMention/HysMention2.vue.js +112 -100
  41. package/dist/components/HysModal/HysModal.vue.js +2 -2
  42. package/dist/components/HysModal/HysModal2.vue.js +490 -85
  43. package/dist/components/HysPopover/HysPopover.vue.js +5 -91
  44. package/dist/components/HysPopover/HysPopover2.vue.js +120 -2
  45. package/dist/components/HysProgress/HysProgress.vue.js +2 -2
  46. package/dist/components/HysProgress/HysProgress2.vue.js +319 -52
  47. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  48. package/dist/components/HysSelect/HysSelect2.vue.js +730 -594
  49. package/dist/components/HysSlider/HysSlider.vue.js +2 -2
  50. package/dist/components/HysSlider/HysSlider2.vue.js +192 -188
  51. package/dist/components/HysSlider/SliderTooltip.vue.js +2 -2
  52. package/dist/components/HysSlider/SliderTooltip2.vue.js +103 -89
  53. package/dist/components/HysTable/HysTable.vue.js +2 -2
  54. package/dist/components/HysTable/HysTable2.vue.js +389 -368
  55. package/dist/components/HysTagInput/HysTagInput.vue.js +5 -82
  56. package/dist/components/HysTagInput/HysTagInput2.vue.js +396 -2
  57. package/dist/components/HysTimeline/HysTimeline.vue.js +2 -2
  58. package/dist/components/HysTimeline/HysTimeline2.vue.js +243 -24
  59. package/dist/components/HysTooltip/HysTooltip.vue.js +5 -64
  60. package/dist/components/HysTooltip/HysTooltip2.vue.js +110 -2
  61. package/dist/components/HysTour/HysTour.vue.js +46 -42
  62. package/dist/components/HysTransfer/HysTransfer.vue.js +2 -2
  63. package/dist/components/HysTransfer/HysTransfer2.vue.js +237 -207
  64. package/dist/components/HysTransfer/HysTransferPanel.vue.js +1 -1
  65. package/dist/components/HysTransfer/HysTransferPanel2.vue.js +320 -271
  66. package/dist/components/HysTree/HysTree.vue.js +2 -2
  67. package/dist/components/HysTree/HysTree2.vue.js +195 -184
  68. package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +4 -4
  69. package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +389 -377
  70. package/dist/components/HysUpload/HysUpload.vue.js +2 -2
  71. package/dist/components/HysUpload/HysUpload2.vue.js +459 -125
  72. package/dist/components/HysVirtualTable/HysVirtualTable.vue.js +5 -94
  73. package/dist/components/HysVirtualTable/HysVirtualTable2.vue.js +656 -2
  74. package/dist/composables/color.js +97 -0
  75. package/dist/composables/dataGrid.js +68 -0
  76. package/dist/composables/drawer.js +17 -0
  77. package/dist/composables/feedback.js +14 -0
  78. package/dist/composables/menu.js +96 -0
  79. package/dist/composables/modal.js +14 -0
  80. package/dist/composables/overlayManager.js +48 -18
  81. package/dist/composables/progress.js +94 -0
  82. package/dist/composables/tagInput.js +16 -0
  83. package/dist/composables/timeline.js +19 -0
  84. package/dist/composables/transfer.js +19 -17
  85. package/dist/composables/upload.js +55 -0
  86. package/dist/composables/uploadRequest.js +58 -0
  87. package/dist/composables/useAlert.js +124 -0
  88. package/dist/composables/useColorPicker.js +402 -0
  89. package/dist/composables/useContextMenu.js +514 -0
  90. package/dist/composables/useDataGridRemote.js +67 -0
  91. package/dist/composables/useDialog.js +86 -43
  92. package/dist/composables/useDrawerPush.js +33 -0
  93. package/dist/composables/useDrawerResize.js +221 -0
  94. package/dist/composables/useFloating.js +110 -76
  95. package/dist/composables/useHysModal.js +185 -0
  96. package/dist/composables/useModal.js +295 -0
  97. package/dist/composables/useModalInteraction.js +394 -0
  98. package/dist/composables/usePopupSurface.js +458 -0
  99. package/dist/composables/useTagInput.js +313 -0
  100. package/dist/composables/useTransferMotion.js +185 -0
  101. package/dist/composables/useUpload.js +472 -0
  102. package/dist/composables/useUploadModel.js +65 -0
  103. package/dist/composables/useUploadRequests.js +266 -0
  104. package/dist/composables/useVirtualTableLayout.js +277 -0
  105. package/dist/composables/virtualTable.js +43 -0
  106. package/dist/index.js +27 -24
  107. package/dist/internal/PopupReference.js +39 -0
  108. package/dist/internal/PopupSurfacePanel.vue.js +7 -0
  109. package/dist/internal/PopupSurfacePanel2.vue.js +92 -0
  110. package/dist/motion/PopupMotion.js +105 -0
  111. package/dist/motion/popup.js +10 -0
  112. package/dist/style.css +1 -1
  113. package/dist/types/components/HysAlert/HysAlert.vue.d.ts +32 -22
  114. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +7 -7
  115. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +6 -1
  116. package/dist/types/components/HysBadge/HysBadge.vue.d.ts +3 -3
  117. package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +54 -31
  118. package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +3 -2
  119. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +7 -7
  120. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
  121. package/dist/types/components/HysColorPicker/HysColorPanel.vue.d.ts +58 -0
  122. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +63 -10
  123. package/dist/types/components/HysCommandPalette/HysCommandPalette.vue.d.ts +2 -1
  124. package/dist/types/components/HysContextMenu/HysContextMenu.vue.d.ts +50 -34
  125. package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +79 -0
  126. package/dist/types/components/HysContextMenu/HysMenuSlot.d.ts +8 -0
  127. package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +65 -118
  128. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +1 -1
  129. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +92 -35
  130. package/dist/types/components/HysEmpty/HysEmpty.vue.d.ts +24 -20
  131. package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +2 -2
  132. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +2 -1
  133. package/dist/types/components/HysMention/HysMention.vue.d.ts +2 -1
  134. package/dist/types/components/HysModal/HysModal.vue.d.ts +111 -34
  135. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +41 -29
  136. package/dist/types/components/HysProgress/HysProgress.vue.d.ts +18 -24
  137. package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +2 -2
  138. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +13 -4
  139. package/dist/types/components/HysSlider/HysSlider.vue.d.ts +5 -4
  140. package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +3 -1
  141. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +2 -2
  142. package/dist/types/components/HysTable/HysTable.vue.d.ts +4 -4
  143. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +2 -2
  144. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +47 -25
  145. package/dist/types/components/HysTimeline/HysTimeline.vue.d.ts +19 -32
  146. package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +39 -19
  147. package/dist/types/components/HysTour/HysTour.vue.d.ts +2 -1
  148. package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +2 -2
  149. package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +5 -3
  150. package/dist/types/components/HysTree/HysTree.vue.d.ts +2 -2
  151. package/dist/types/components/HysUpload/HysUpload.vue.d.ts +55 -67
  152. package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +71 -40
  153. package/dist/types/composables/autocomplete.d.ts +3 -0
  154. package/dist/types/composables/avatar.d.ts +3 -0
  155. package/dist/types/composables/cascader.d.ts +3 -0
  156. package/dist/types/composables/color.d.ts +97 -0
  157. package/dist/types/composables/dataGrid.d.ts +100 -0
  158. package/dist/types/composables/datePicker.d.ts +3 -0
  159. package/dist/types/composables/drawer.d.ts +102 -0
  160. package/dist/types/composables/feedback.d.ts +98 -0
  161. package/dist/types/composables/formContext.d.ts +2 -0
  162. package/dist/types/composables/menu.d.ts +183 -0
  163. package/dist/types/composables/modal.d.ts +183 -0
  164. package/dist/types/composables/overlayManager.d.ts +7 -3
  165. package/dist/types/composables/popupSurface.d.ts +83 -0
  166. package/dist/types/composables/progress.d.ts +92 -0
  167. package/dist/types/composables/selectOptions.d.ts +2 -0
  168. package/dist/types/composables/table.d.ts +3 -0
  169. package/dist/types/composables/tagInput.d.ts +96 -0
  170. package/dist/types/composables/timeline.d.ts +82 -0
  171. package/dist/types/composables/transfer.d.ts +7 -0
  172. package/dist/types/composables/tree.d.ts +3 -0
  173. package/dist/types/composables/treeSelect.d.ts +3 -0
  174. package/dist/types/composables/upload.d.ts +202 -0
  175. package/dist/types/composables/uploadRequest.d.ts +3 -0
  176. package/dist/types/composables/useAlert.d.ts +21 -0
  177. package/dist/types/composables/useCascader.d.ts +1 -1
  178. package/dist/types/composables/useColorPicker.d.ts +101 -0
  179. package/dist/types/composables/useContextMenu.d.ts +81 -0
  180. package/dist/types/composables/useDataGridRemote.d.ts +15 -0
  181. package/dist/types/composables/useDialog.d.ts +16 -3
  182. package/dist/types/composables/useDrawerPush.d.ts +6 -0
  183. package/dist/types/composables/useDrawerResize.d.ts +27 -0
  184. package/dist/types/composables/useFloating.d.ts +21 -2
  185. package/dist/types/composables/useHysModal.d.ts +44 -0
  186. package/dist/types/composables/useModal.d.ts +62 -0
  187. package/dist/types/composables/useModalInteraction.d.ts +27 -0
  188. package/dist/types/composables/usePopupSurface.d.ts +3341 -0
  189. package/dist/types/composables/useTagInput.d.ts +66 -0
  190. package/dist/types/composables/useTransferMotion.d.ts +36 -0
  191. package/dist/types/composables/useUpload.d.ts +94 -0
  192. package/dist/types/composables/useUploadModel.d.ts +14 -0
  193. package/dist/types/composables/useUploadRequests.d.ts +38 -0
  194. package/dist/types/composables/useVirtualTableLayout.d.ts +51 -0
  195. package/dist/types/composables/virtualTable.d.ts +126 -0
  196. package/dist/types/index.d.ts +17 -2
  197. package/dist/types/internal/PopupReference.d.ts +18 -0
  198. package/dist/types/internal/PopupSurfacePanel.vue.d.ts +37 -0
  199. package/dist/types/motion/PopupMotion.d.ts +59 -0
  200. package/dist/types/motion/popup.d.ts +12 -0
  201. package/package.json +1 -1
@@ -1,56 +1,99 @@
1
- import { ref as k, computed as D, onActivated as w, onDeactivated as x, watch as L, nextTick as b, onBeforeUnmount as S } from "vue";
2
- import { lockBodyScroll as T, registerOverlay as A } from "./overlayManager.js";
3
- const C = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
4
- function B(h, t, m) {
5
- const o = k(!0), s = D(() => h.value && o.value);
6
- w(() => {
7
- o.value = !0;
8
- }), x(() => {
9
- o.value = !1, c++, f();
10
- });
11
- let d = null, i, u, c = 0;
12
- function v() {
1
+ import { ref as O, inject as P, computed as b, provide as R, shallowRef as g, watch as L, nextTick as w, onActivated as B, onDeactivated as H, onBeforeUnmount as M } from "vue";
2
+ import { overlayOwnerKey as D, registerOverlay as j, lockBodyScroll as N } from "./overlayManager.js";
3
+ const U = 'a[href],button:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
4
+ function J(A, a, x, t = {}) {
5
+ const m = O(!0), h = P(D, void 0), o = b(() => m.value && (h == null ? void 0 : h.value) !== !1), i = b(() => A.value && o.value);
6
+ R(
7
+ D,
8
+ b(() => {
9
+ var e;
10
+ return i.value && ((e = t.childVisible) == null ? void 0 : e.call(t)) !== !1;
11
+ })
12
+ );
13
+ const d = g(), z = b(
14
+ () => {
15
+ var e, u;
16
+ return ((e = d.value) == null ? void 0 : e.zIndex.value) ?? ((u = t.zIndex) == null ? void 0 : u.call(t)) ?? 100;
17
+ }
18
+ );
19
+ let E = null, r, s = 0;
20
+ function S() {
21
+ var e;
22
+ return Array.from(
23
+ ((e = a.value) == null ? void 0 : e.querySelectorAll(U)) ?? []
24
+ ).filter(
25
+ (u) => u.tabIndex >= 0 && u.getClientRects().length > 0 && getComputedStyle(u).visibility !== "hidden" && !u.closest('[inert],[aria-hidden="true"]')
26
+ );
27
+ }
28
+ function T() {
13
29
  var e;
14
- return Array.from(((e = t.value) == null ? void 0 : e.querySelectorAll(C)) ?? []).filter((n) => n.getClientRects().length > 0 && getComputedStyle(n).visibility !== "hidden");
30
+ (e = S()[0] ?? a.value) == null || e.focus({ preventScroll: !0 });
15
31
  }
16
- function y(e) {
17
- if (!s.value || !(u != null && u()) || !t.value) return;
32
+ function k(e) {
33
+ var n, f;
34
+ if (!i.value || !((n = d.value) != null && n.isTop()) || !a.value) return;
18
35
  if (e.key === "Escape") {
19
- e.preventDefault(), e.stopImmediatePropagation(), m();
36
+ e.preventDefault(), e.stopImmediatePropagation(), x();
20
37
  return;
21
38
  }
22
- if (e.key !== "Tab") return;
23
- const n = v();
24
- if (!n.length) {
25
- e.preventDefault(), t.value.focus();
39
+ if (e.key !== "Tab" || ((f = t.trapFocus) == null ? void 0 : f.call(t)) === !1) return;
40
+ const u = S();
41
+ if (!u.length) {
42
+ e.preventDefault(), a.value.focus({ preventScroll: !0 });
26
43
  return;
27
44
  }
28
- const l = n[0], r = n[n.length - 1];
29
- e.shiftKey && (document.activeElement === l || document.activeElement === t.value || !t.value.contains(document.activeElement)) ? (e.preventDefault(), r.focus()) : !e.shiftKey && (document.activeElement === r || !t.value.contains(document.activeElement)) && (e.preventDefault(), l.focus());
45
+ const l = u[0], c = u[u.length - 1];
46
+ e.shiftKey && (document.activeElement === l || document.activeElement === a.value || !a.value.contains(document.activeElement)) ? (e.preventDefault(), c.focus({ preventScroll: !0 })) : !e.shiftKey && (document.activeElement === c || !a.value.contains(document.activeElement)) && (e.preventDefault(), l.focus({ preventScroll: !0 }));
47
+ }
48
+ function C(e) {
49
+ var u, l, c;
50
+ i.value && ((u = d.value) != null && u.isTop()) && ((l = t.trapFocus) == null ? void 0 : l.call(t)) !== !1 && e.target instanceof Node && !((c = a.value) != null && c.contains(e.target)) && T();
30
51
  }
31
- function p(e) {
32
- !s.value || !(u != null && u()) || !t.value || e.target instanceof Node && !t.value.contains(e.target) && (v()[0] ?? t.value).focus();
52
+ function F() {
53
+ var e;
54
+ i.value && ((e = t.lockScroll) == null ? void 0 : e.call(t)) !== !1 ? r ?? (r = N()) : (r == null || r(), r = void 0);
33
55
  }
34
- function f() {
35
- i == null || i(), i = void 0, u = void 0, document.removeEventListener("keydown", y, !0), document.removeEventListener("focusin", p, !0);
56
+ function y() {
57
+ var u, l;
58
+ const e = ((u = d.value) == null ? void 0 : u.isTop()) ?? !1;
59
+ return (l = d.value) == null || l.unregister(), d.value = void 0, r == null || r(), r = void 0, document.removeEventListener("keydown", k, !0), document.removeEventListener("focusin", C, !0), e;
36
60
  }
37
- return L(s, async (e) => {
38
- var l, r;
39
- const n = ++c;
40
- if (e) {
41
- f(), d = document.activeElement instanceof HTMLElement ? document.activeElement : null;
42
- const a = T(), E = A("dialog", m);
43
- u = E.isTop, i = () => {
44
- E.unregister(), a();
45
- }, document.addEventListener("keydown", y, !0), document.addEventListener("focusin", p, !0), await b(), n === c && s.value && ((r = ((l = t.value) == null ? void 0 : l.querySelector("[autofocus]")) ?? v()[0] ?? t.value) == null || r.focus());
46
- } else {
47
- const a = d;
48
- f(), await b(), n === c && o.value && (a != null && a.isConnected) && a.focus();
49
- }
50
- }, { immediate: !0, flush: "post" }), S(() => {
51
- o.value = !1, c++, f();
52
- }), { active: o };
61
+ function q(e, u, l) {
62
+ w(() => {
63
+ var n, f;
64
+ if (u !== s || !o.value || !l || ((n = t.restoreFocus) == null ? void 0 : n.call(t)) === !1)
65
+ return;
66
+ const c = new Event("hys-ui-close-auto-focus", { cancelable: !0 });
67
+ (f = t.onCloseAutoFocus) == null || f.call(t, c), !c.defaultPrevented && (e != null && e.isConnected) && e.focus({ preventScroll: !0 });
68
+ });
69
+ }
70
+ return L(
71
+ i,
72
+ async (e) => {
73
+ var l, c, n, f;
74
+ const u = ++s;
75
+ if (e) {
76
+ if (y(), E = document.activeElement instanceof HTMLElement ? document.activeElement : null, d.value = j("dialog", x, t.zIndex), F(), document.addEventListener("keydown", k, !0), document.addEventListener("focusin", C, !0), await w(), u !== s || !i.value) return;
77
+ const I = new Event("hys-ui-open-auto-focus", { cancelable: !0 });
78
+ (l = t.onOpenAutoFocus) == null || l.call(t, I);
79
+ const v = (c = t.initialFocus) == null ? void 0 : c.call(t), K = v instanceof HTMLElement && v.isConnected && v.getClientRects().length > 0 && getComputedStyle(v).visibility !== "hidden" && !v.closest('[inert],[aria-hidden="true"]') && !v.disabled ? v : void 0;
80
+ !I.defaultPrevented && v !== !1 && ((f = K ?? ((n = a.value) == null ? void 0 : n.querySelector("[autofocus]")) ?? S()[0] ?? a.value) == null || f.focus({ preventScroll: !0 }));
81
+ } else q(E, u, y());
82
+ },
83
+ { immediate: !0, flush: "post" }
84
+ ), L(() => {
85
+ var e;
86
+ return (e = t.lockScroll) == null ? void 0 : e.call(t);
87
+ }, F), B(() => m.value = !0), H(() => {
88
+ m.value = !1, s++, y();
89
+ }), M(() => {
90
+ var c;
91
+ const e = E, u = y(), l = o.value && ((c = t.restoreFocus) == null ? void 0 : c.call(t)) !== !1;
92
+ m.value = !1, s++, l && u && w(() => {
93
+ e != null && e.isConnected && e.focus({ preventScroll: !0 });
94
+ });
95
+ }), { active: o, zIndex: z, focus: T };
53
96
  }
54
97
  export {
55
- B as useDialog
98
+ J as useDialog
56
99
  };
@@ -0,0 +1,33 @@
1
+ import { inject as y, shallowRef as f, provide as w, onMounted as b, onActivated as g, onDeactivated as M, onBeforeUnmount as j, computed as v } from "vue";
2
+ const p = Symbol("hys-ui-drawer-parent");
3
+ function S(t, r, m) {
4
+ const c = y(p, void 0), a = f(/* @__PURE__ */ new Map()), h = Symbol("drawer-child");
5
+ w(p, {
6
+ register(e, l) {
7
+ return a.value = new Map(a.value).set(e, l), () => {
8
+ const u = new Map(a.value);
9
+ u.delete(e), a.value = u;
10
+ };
11
+ }
12
+ });
13
+ let n;
14
+ const i = () => {
15
+ n ?? (n = c == null ? void 0 : c.register(h, r));
16
+ }, s = () => {
17
+ n == null || n(), n = void 0;
18
+ };
19
+ b(i), g(i), M(s), j(s);
20
+ const o = v(
21
+ () => !!t.push && r.value && !m.value && [...a.value.values()].some((e) => e.value)
22
+ ), x = v(() => {
23
+ const e = typeof t.push == "object" ? t.push.distance : 160, l = typeof e == "number" ? Number.isFinite(e) ? Math.max(0, e) + "px" : "160px" : e || "160px", u = o.value ? l : "0px", d = o.value ? `calc(-1 * ${l})` : "0px";
24
+ return {
25
+ "--hys-ui-drawer-push-x": t.placement === "left" ? u : t.placement === "right" ? d : "0px",
26
+ "--hys-ui-drawer-push-y": t.placement === "top" ? u : t.placement === "bottom" ? d : "0px"
27
+ };
28
+ });
29
+ return { pushed: o, style: x };
30
+ }
31
+ export {
32
+ S as useDrawerPush
33
+ };
@@ -0,0 +1,221 @@
1
+ import { ref as C, computed as S, watch as x, nextTick as K, onMounted as te, onActivated as ie, onDeactivated as ne, onBeforeUnmount as ae } from "vue";
2
+ import { useChoiceModel as re } from "./choiceModel.js";
3
+ import { drawerVertical as ue } from "./drawer.js";
4
+ function ce(i, V, c, M, $, G, d) {
5
+ const w = re(
6
+ {
7
+ get modelValue() {
8
+ return i.resizeValue;
9
+ }
10
+ },
11
+ () => Number.isFinite(i.defaultResizeValue) ? Math.max(0, i.defaultResizeValue) : null
12
+ ), D = C(!1), P = C(0), F = C(0), N = C(), f = S(() => ue(i.placement)), T = S(() => {
13
+ const e = w.current.value;
14
+ if (typeof e != "number" || !Number.isFinite(e)) return;
15
+ const t = A();
16
+ return Math.max(t.min, Math.min(t.max, e));
17
+ }), h = S(() => T.value ?? P.value), z = S(
18
+ () => typeof i.resizable == "object" ? i.resizable : {}
19
+ ), v = S(
20
+ () => M.value && !$.value && !G.value
21
+ );
22
+ let r = !0, y = 0, g = 0, l, s;
23
+ function I(e, t) {
24
+ if (typeof e == "number")
25
+ return Number.isFinite(e) ? e : void 0;
26
+ if (typeof e != "string" || !/^\s*\d+(?:\.\d+)?(?:px|%)?\s*$/.test(e))
27
+ return;
28
+ const n = parseFloat(e);
29
+ return e.trim().endsWith("%") ? t * n / 100 : n;
30
+ }
31
+ function R() {
32
+ var n;
33
+ const e = (n = V.value) == null ? void 0 : n.getBoundingClientRect(), t = f.value ? e == null ? void 0 : e.height : e == null ? void 0 : e.width;
34
+ return Math.max(
35
+ 1,
36
+ (t && t > 0 ? t : void 0) ?? (f.value ? document.documentElement.clientHeight || window.innerHeight : document.documentElement.clientWidth || window.innerWidth)
37
+ );
38
+ }
39
+ function A(e = F.value || R()) {
40
+ const t = Math.max(
41
+ 1,
42
+ Math.min(
43
+ e,
44
+ I(z.value.maxSize, e) ?? e
45
+ )
46
+ );
47
+ return { min: Math.min(
48
+ t,
49
+ Math.max(1, I(z.value.minSize, e) ?? 160)
50
+ ), max: t };
51
+ }
52
+ function L() {
53
+ if (!r || !M.value || s || !c.value) return;
54
+ F.value = R();
55
+ const e = c.value.getBoundingClientRect();
56
+ P.value = f.value ? e.height : e.width;
57
+ }
58
+ function p() {
59
+ g && cancelAnimationFrame(g), g = requestAnimationFrame(() => {
60
+ g = 0, L();
61
+ });
62
+ }
63
+ function J() {
64
+ var t;
65
+ y = 0;
66
+ const e = s;
67
+ !e || !e.activated || !c.value || e.last !== e.value && (e.last = e.value, c.value.style[e.axis] = e.value + "px", (t = N.value) == null || t.setAttribute("aria-valuenow", String(Math.round(e.value))), d("resize", e.value));
68
+ }
69
+ function Q() {
70
+ window.removeEventListener("pointermove", U), window.removeEventListener("pointerup", W), window.removeEventListener("pointercancel", a), window.removeEventListener("blur", a), window.removeEventListener("keydown", O, !0);
71
+ }
72
+ async function B(e) {
73
+ return !r || !v.value ? !1 : e === w.current.value ? !0 : await w.commit(
74
+ e,
75
+ (n) => d("update:resizeValue", n),
76
+ () => {
77
+ }
78
+ ) && r && v.value;
79
+ }
80
+ async function b(e = !1) {
81
+ var o, m;
82
+ const t = s;
83
+ if (!t) return !1;
84
+ y && cancelAnimationFrame(y), y = 0;
85
+ const n = !e && t.activated && t.last !== t.value;
86
+ s = void 0, D.value = !1, Q(), document.documentElement.style.cursor = t.cursor, document.documentElement.style.userSelect = t.selection;
87
+ try {
88
+ (m = (o = t.target).hasPointerCapture) != null && m.call(o, t.id) && t.target.releasePointerCapture(t.id);
89
+ } catch {
90
+ }
91
+ c.value && (c.value.style[t.axis] = t.style), n && d("resize", t.value);
92
+ const u = !e && t.activated ? await B(t.value) : !1;
93
+ return t.activated && (await K(), r && (L(), d("resizeEnd", e || !u ? h.value : t.value, {
94
+ placement: i.placement ?? "right",
95
+ cancelled: e,
96
+ accepted: u
97
+ }))), u;
98
+ }
99
+ function a() {
100
+ b(!0);
101
+ }
102
+ function O(e) {
103
+ e.key === "Escape" ? (e.preventDefault(), e.stopImmediatePropagation(), a()) : e.key === "Tab" && a();
104
+ }
105
+ function U(e) {
106
+ const t = s;
107
+ if (!t || e.pointerId !== t.id) return;
108
+ const n = ((t.axis === "width" ? e.clientX : e.clientY) - t.start) * t.sign;
109
+ !t.activated && (Math.abs(n) < 4 || (t.activated = !0, D.value = !0, d("resizeStart", t.size), s !== t)) || (t.value = Math.max(t.min, Math.min(t.max, t.size + n)), y || (y = requestAnimationFrame(J)));
110
+ }
111
+ function W(e) {
112
+ s && e.pointerId === s.id && b(!1);
113
+ }
114
+ function Z(e) {
115
+ if (!i.resizable || !v.value || !r || e.button !== 0 || e.isPrimary === !1 || !c.value)
116
+ return;
117
+ e.preventDefault(), e.stopPropagation(), b(!0);
118
+ const t = R(), n = A(t), u = c.value.getBoundingClientRect(), o = f.value ? "height" : "width", m = e.currentTarget, E = o === "width" ? u.width : u.height;
119
+ F.value = t, P.value = E, s = {
120
+ id: e.pointerId,
121
+ start: o === "width" ? e.clientX : e.clientY,
122
+ size: E,
123
+ value: E,
124
+ last: E,
125
+ ...n,
126
+ axis: o,
127
+ sign: i.placement === "right" || i.placement === "bottom" ? -1 : 1,
128
+ target: m,
129
+ style: c.value.style[o],
130
+ cursor: document.documentElement.style.cursor,
131
+ selection: document.documentElement.style.userSelect,
132
+ activated: !1
133
+ }, m.focus({ preventScroll: !0 });
134
+ try {
135
+ m.setPointerCapture(e.pointerId);
136
+ } catch {
137
+ }
138
+ document.documentElement.style.cursor = f.value ? "ns-resize" : "ew-resize", document.documentElement.style.userSelect = "none", window.addEventListener("pointermove", U), window.addEventListener("pointerup", W), window.addEventListener("pointercancel", a), window.addEventListener("blur", a), window.addEventListener("keydown", O, !0);
139
+ }
140
+ async function q(e) {
141
+ if (!r || !v.value) return !1;
142
+ const t = R(), n = I(e, t);
143
+ if (n === void 0) return !1;
144
+ const u = A(t), o = Math.max(u.min, Math.min(u.max, n));
145
+ return F.value = t, B(o);
146
+ }
147
+ async function _() {
148
+ return s && await b(!0), B(null);
149
+ }
150
+ async function ee(e) {
151
+ if (!i.resizable || !v.value || e.isComposing || e.ctrlKey || e.metaKey || e.altKey || ![...f.value ? ["ArrowUp", "ArrowDown"] : ["ArrowLeft", "ArrowRight"], "Home", "End"].includes(e.key)) return;
152
+ e.preventDefault(), e.stopPropagation(), L();
153
+ const n = A(), u = Number.isFinite(z.value.step) ? Math.max(1, z.value.step) : 10, o = i.placement === "left" ? "ArrowRight" : i.placement === "right" ? "ArrowLeft" : i.placement === "top" ? "ArrowDown" : "ArrowUp", m = e.key === "Home" ? n.min : e.key === "End" ? n.max : h.value + (e.key === o ? 1 : -1) * u * (e.shiftKey ? 10 : 1);
154
+ d("resizeStart", h.value);
155
+ const E = await q(m);
156
+ r && (L(), d("resize", h.value), d("resizeEnd", h.value, {
157
+ placement: i.placement ?? "right",
158
+ cancelled: !1,
159
+ accepted: E
160
+ }));
161
+ }
162
+ function k() {
163
+ a(), p();
164
+ }
165
+ function X() {
166
+ l == null || l.disconnect(), l = void 0, r && M.value && typeof ResizeObserver < "u" && V.value && i.contained && (l = new ResizeObserver(k), l.observe(V.value));
167
+ }
168
+ function H() {
169
+ var e;
170
+ !r || !M.value || (window.addEventListener("resize", k), (e = window.visualViewport) == null || e.addEventListener("resize", k), X(), p());
171
+ }
172
+ function Y() {
173
+ var e;
174
+ l == null || l.disconnect(), l = void 0, window.removeEventListener("resize", k), (e = window.visualViewport) == null || e.removeEventListener("resize", k), cancelAnimationFrame(g), g = 0;
175
+ }
176
+ function j() {
177
+ r = !1, b(!0), Y();
178
+ }
179
+ return x(
180
+ () => [i.placement, i.width, i.height, i.size],
181
+ () => {
182
+ a(), i.resizeValue === void 0 && w.reset(), K(p);
183
+ }
184
+ ), x(
185
+ () => i.resizeValue,
186
+ () => {
187
+ a(), p();
188
+ }
189
+ ), x([v, () => i.resizable], () => {
190
+ (!v.value || !i.resizable) && a();
191
+ }), x(
192
+ () => [z.value.minSize, z.value.maxSize],
193
+ () => {
194
+ a(), p();
195
+ }
196
+ ), x(M, (e) => {
197
+ e ? K(H) : (a(), Y());
198
+ }), x([V, () => i.contained], X, { flush: "post" }), te(H), ie(() => {
199
+ r = !0, H();
200
+ }), ne(j), ae(j), {
201
+ handle: N,
202
+ resizing: D,
203
+ size: h,
204
+ vertical: f,
205
+ limits: A,
206
+ model: w,
207
+ resolvedSize: T,
208
+ start: Z,
209
+ stop: b,
210
+ keyboard: ee,
211
+ resizeTo: q,
212
+ reset: _,
213
+ measure: L,
214
+ resetAfterClose: () => {
215
+ i.resetSizeOnClose !== !1 && i.resizeValue === void 0 && w.reset();
216
+ }
217
+ };
218
+ }
219
+ export {
220
+ ce as useDrawerResize
221
+ };
@@ -1,128 +1,162 @@
1
- import { ref as E, watch as I, onDeactivated as S, onBeforeUnmount as K, nextTick as P } from "vue";
2
- import { useHysControlState as T } from "./formContext.js";
3
- import { registerOverlay as U } from "./overlayManager.js";
4
- function J(m, r, i = {}) {
5
- const { disabled: C } = T({}), d = E(!1), M = E(!1), L = E({
1
+ import { inject as G, ref as z, shallowRef as J, watch as V, onDeactivated as Q, onBeforeUnmount as Z, computed as _, nextTick as ee } from "vue";
2
+ import { useHysControlState as te } from "./formContext.js";
3
+ import { popupSize as ie } from "../motion/popup.js";
4
+ import { overlayOwnerKey as ae, registerOverlay as ne } from "./overlayManager.js";
5
+ function de(g, r, t = {}) {
6
+ const { disabled: B } = te({}), y = G(ae, void 0), o = z(!1), F = J(), O = z(!1), k = z({
6
7
  position: "fixed",
7
8
  top: "0px",
8
9
  left: "0px",
9
10
  visibility: "hidden"
10
- }), F = E(i.placement ?? "bottom-start"), v = i.gap ?? 8, o = i.padding ?? 10;
11
- let $ = 0, w, h, b = 0;
12
- function k() {
13
- var R;
14
- if (!d.value || !m.value || !r.value) return;
15
- const t = m.value.getBoundingClientRect();
16
- if (!t.width && !t.height) {
11
+ }), N = z(t.placement ?? "bottom-start");
12
+ let A = 0, W, u, E = 0;
13
+ function C() {
14
+ var K, T, Y;
15
+ if (!o.value || !g.value || !r.value) return;
16
+ const e = g.value.getBoundingClientRect();
17
+ if (!e.width && !e.height) {
17
18
  s();
18
19
  return;
19
20
  }
20
- const e = document.documentElement.clientWidth, a = document.documentElement.clientHeight, l = Math.min(t.width, Math.max(0, e - 2 * o)), u = typeof i.matchWidth == "function" ? i.matchWidth() : i.matchWidth, f = (R = i.width) == null ? void 0 : R.call(i), x = typeof f == "number" ? Math.max(0, f) + "px" : f;
21
- x !== void 0 ? (r.value.style.width = x, r.value.style.minWidth = "0", r.value.style.maxWidth = `calc(100vw - ${o * 2}px)`) : u === !0 && (r.value.style.width = `${l}px`, r.value.style.minWidth = "0", r.value.style.maxWidth = `${l}px`), x === void 0 && u === "min" && (r.value.style.width = "max-content", r.value.style.minWidth = `${l}px`, r.value.style.maxWidth = `calc(100vw - ${o * 2}px)`);
22
- const H = r.value.getBoundingClientRect(), g = Math.min(H.width, Math.max(0, e - 2 * o)), y = Math.min(H.height, Math.max(0, a - 2 * o));
23
- let n = i.placement ?? "bottom-start";
24
- const z = a - t.bottom - v, A = t.top - v;
25
- n.startsWith("bottom") && z < y && A > z ? n = n.replace("bottom", "top") : n.startsWith("top") && A < y && z > A ? n = n.replace("top", "bottom") : n === "right" && e - t.right - v < g && t.left > e - t.right ? n = "left" : n === "left" && t.left - v < g && e - t.right > t.left && (n = "right");
26
- let p = n.endsWith("end") ? t.right - g : t.left, W = n.startsWith("top") ? t.top - y - v : t.bottom + v;
27
- (n === "right" || n === "left") && (p = n === "right" ? t.right + v : t.left - g - v, W = t.top + (t.height - y) / 2), p = Math.max(o, Math.min(p, e - g - o)), W = Math.max(o, Math.min(W, a - y - o)), F.value = n, L.value = {
28
- ...x !== void 0 ? { width: x, minWidth: "0" } : u === !0 ? { width: `${l}px`, minWidth: "0" } : u === "min" ? { width: "max-content", minWidth: `${l}px` } : {},
29
- position: "fixed",
30
- left: `${Math.round(p)}px`,
31
- top: `${Math.round(W)}px`,
21
+ const n = Number.isFinite(t.gap) ? t.gap : 8, i = Number.isFinite(t.padding) ? Math.max(0, t.padding) : 10, l = document.documentElement.clientWidth, f = document.documentElement.clientHeight, d = Math.min(e.width, Math.max(0, l - 2 * i)), M = typeof t.matchWidth == "function" ? t.matchWidth() : t.matchWidth, b = (K = t.maxWidth) == null ? void 0 : K.call(t), P = b !== void 0 && (typeof b != "number" || Number.isFinite(b)) ? `min(${typeof b == "number" ? Math.max(0, b) + "px" : b},calc(100vw - ${i * 2}px))` : `calc(100vw - ${i * 2}px)`, L = (T = t.width) == null ? void 0 : T.call(t), p = typeof L == "number" ? Number.isFinite(L) ? Math.max(0, L) + "px" : void 0 : L;
22
+ p !== void 0 ? (r.value.style.width = p, r.value.style.minWidth = "0", r.value.style.maxWidth = P) : M === !0 && (r.value.style.width = `${d}px`, r.value.style.minWidth = "0", r.value.style.maxWidth = `${d}px`), p === void 0 && M === "min" && (r.value.style.width = "max-content", r.value.style.minWidth = `${d}px`, r.value.style.maxWidth = `calc(100vw - ${i * 2}px)`);
23
+ const D = ie(r.value), h = Math.min(D.width, Math.max(0, l - 2 * i)), v = Math.min(D.height, Math.max(0, f - 2 * i));
24
+ let a = t.placement ?? "bottom-start";
25
+ const I = f - e.bottom - n, q = e.top - n, $ = t.autoAdjustOverflow !== !1;
26
+ $ && a.startsWith("bottom") && I < v && q > I ? a = a.replace("bottom", "top") : $ && a.startsWith("top") && q < v && I > q ? a = a.replace("top", "bottom") : $ && a.startsWith("right") && l - e.right - n < h && e.left > l - e.right ? a = a.replace("right", "left") : $ && a.startsWith("left") && e.left - n < h && l - e.right > e.left && (a = a.replace("left", "right"));
27
+ let w = a.endsWith("end") ? e.right - h : a.endsWith("start") ? e.left : e.left + (e.width - h) / 2, x = a.startsWith("top") ? e.top - v - n : e.bottom + n;
28
+ if ((a.startsWith("right") || a.startsWith("left")) && (w = a.startsWith("right") ? e.right + n : e.left - h - n, x = a.endsWith("start") ? e.top : a.endsWith("end") ? e.bottom - v : e.top + (e.height - v) / 2), w = Math.max(i, Math.min(w, l - h - i)), x = Math.max(i, Math.min(x, f - v - i)), N.value = a, (Y = t.onPosition) == null || Y.call(t, {
29
+ anchor: e,
30
+ width: h,
31
+ height: v,
32
+ x: w,
33
+ y: x,
34
+ placement: a
35
+ }), t.strategy === "absolute") {
36
+ const m = r.value.offsetParent;
37
+ if (m && m !== document.body && m !== document.documentElement) {
38
+ const U = m.getBoundingClientRect();
39
+ w += m.scrollLeft - U.left - m.clientLeft, x += m.scrollTop - U.top - m.clientTop;
40
+ } else
41
+ w += window.scrollX, x += window.scrollY;
42
+ }
43
+ k.value = {
44
+ ...p !== void 0 ? { width: p, minWidth: "0" } : M === !0 ? { width: `${d}px`, minWidth: "0" } : M === "min" ? { width: "max-content", minWidth: `${d}px` } : {},
45
+ position: t.strategy ?? "fixed",
46
+ left: `${Math.round(w)}px`,
47
+ top: `${Math.round(x)}px`,
32
48
  visibility: "visible",
33
49
  zIndex: "1200",
34
- maxWidth: `calc(100vw - ${o * 2}px)`,
35
- maxHeight: `calc(100vh - ${o * 2}px)`,
50
+ maxWidth: P,
51
+ maxHeight: `calc(100vh - ${i * 2}px)`,
36
52
  overflowY: "auto",
37
53
  overscrollBehavior: "contain"
38
54
  };
39
55
  }
40
56
  function c() {
41
- cancelAnimationFrame($), $ = requestAnimationFrame(k);
57
+ cancelAnimationFrame(A), A = requestAnimationFrame(C);
42
58
  }
43
- function q(t) {
44
- var e, a;
45
- h != null && h() && !((e = m.value) != null && e.contains(t.target)) && !((a = r.value) != null && a.contains(t.target)) && s();
59
+ function R(e) {
60
+ var n, i;
61
+ !(u != null && u()) || t.closeOnOutside === !1 || !((n = g.value) != null && n.contains(e.target)) && !((i = r.value) != null && i.contains(e.target)) && s();
46
62
  }
47
- function B(t) {
48
- var e, a;
49
- if (!(!d.value || !(h != null && h()))) {
50
- if (t.key === "Escape")
51
- t.preventDefault(), t.stopImmediatePropagation(), s(!0);
52
- else if (t.key === "Tab" && i.closeOnTab !== !1) {
63
+ function S(e) {
64
+ var n, i;
65
+ if (!(!o.value || !(u != null && u()))) {
66
+ if (e.key === "Escape" && t.closeOnEscape !== !1)
67
+ e.preventDefault(), e.stopImmediatePropagation(), s(!0);
68
+ else if (e.key === "Tab" && t.closeOnTab !== !1) {
53
69
  const l = document.activeElement;
54
- if ((e = m.value) != null && e.contains(l)) {
70
+ if ((n = g.value) != null && n.contains(l)) {
55
71
  s();
56
72
  return;
57
73
  }
58
- if ((a = r.value) != null && a.contains(l)) {
59
- const u = Array.from(
74
+ if ((i = r.value) != null && i.contains(l)) {
75
+ const f = Array.from(
60
76
  r.value.querySelectorAll(
61
77
  'a[href],button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[tabindex]:not([tabindex="-1"])'
62
78
  )
63
79
  ).filter(
64
- (f) => f.getClientRects().length && !f.closest("[inert]")
80
+ (d) => d.getClientRects().length && !d.closest("[inert]")
65
81
  );
66
- (!u.length || l === (t.shiftKey ? u[0] : u.at(-1))) && s(!0);
82
+ (!f.length || l === (e.shiftKey ? f[0] : f.at(-1))) && s(!0);
67
83
  }
68
84
  }
69
85
  }
70
86
  }
71
- function O() {
72
- var t, e;
73
- document.removeEventListener("pointerdown", q, !0), document.removeEventListener("keydown", B, !0), window.removeEventListener("resize", c), window.removeEventListener("scroll", c, !0), (t = window.visualViewport) == null || t.removeEventListener("resize", c), (e = window.visualViewport) == null || e.removeEventListener("scroll", c), cancelAnimationFrame($), w == null || w(), w = void 0, h = void 0;
87
+ function j() {
88
+ var e, n;
89
+ document.removeEventListener("pointerdown", R, !0), document.removeEventListener("keydown", S, !0), window.removeEventListener("resize", c), window.removeEventListener("scroll", c, !0), (e = window.visualViewport) == null || e.removeEventListener("resize", c), (n = window.visualViewport) == null || n.removeEventListener("scroll", c), cancelAnimationFrame(A), W == null || W(), W = void 0, F.value = void 0, u = void 0;
74
90
  }
75
- function s(t = !1, e = !1) {
76
- var a, l;
77
- if (!(!e && d.value && ((a = i.requestOpen) == null ? void 0 : a.call(i, !1, t)) === !1) && (b++, !!d.value && (d.value = !1, O(), t && ((l = m.value) != null && l.isConnected)))) {
78
- M.value = !0;
91
+ function s(e = !1, n = !1) {
92
+ var i, l;
93
+ if (!(!n && o.value && ((i = t.requestOpen) == null ? void 0 : i.call(t, !1, e)) === !1) && (E++, !!o.value && (o.value = !1, j(), e && ((l = g.value) != null && l.isConnected)))) {
94
+ O.value = !0;
79
95
  try {
80
- m.value.focus();
96
+ g.value.focus();
81
97
  } finally {
82
- M.value = !1;
98
+ O.value = !1;
83
99
  }
84
100
  }
85
101
  }
86
- async function V(t = !1) {
87
- var l, u, f;
88
- if (C.value) return;
89
- if (d.value) {
102
+ async function H(e = !1) {
103
+ var l, f, d;
104
+ if (B.value || (y == null ? void 0 : y.value) === !1) return;
105
+ if (o.value) {
90
106
  c();
91
107
  return;
92
108
  }
93
- if (!t && ((l = i.requestOpen) == null ? void 0 : l.call(i, !0)) === !1) return;
94
- const e = ++b;
95
- if (d.value = !0, L.value = {
109
+ if (!e && ((l = t.requestOpen) == null ? void 0 : l.call(t, !0)) === !1) return;
110
+ const n = ++E;
111
+ if (o.value = !0, k.value = {
96
112
  position: "fixed",
97
113
  top: "0px",
98
114
  left: "0px",
99
115
  visibility: "hidden"
100
- }, await P(), e !== b || !d.value) return;
101
- const a = U("floating", () => s(!0));
102
- w = a.unregister, h = a.isTop, k(), document.addEventListener("pointerdown", q, !0), document.addEventListener("keydown", B, !0), window.addEventListener("resize", c), window.addEventListener("scroll", c, !0), (u = window.visualViewport) == null || u.addEventListener("resize", c), (f = window.visualViewport) == null || f.addEventListener("scroll", c);
116
+ }, await ee(), n !== E || !o.value) return;
117
+ const i = ne(
118
+ "floating",
119
+ () => s(!0),
120
+ t.zIndex
121
+ );
122
+ F.value = i, W = i.unregister, u = i.isTop, C(), document.addEventListener("pointerdown", R, !0), document.addEventListener("keydown", S, !0), window.addEventListener("resize", c), window.addEventListener("scroll", c, !0), (f = window.visualViewport) == null || f.addEventListener("resize", c), (d = window.visualViewport) == null || d.addEventListener("scroll", c);
103
123
  }
104
- function D() {
105
- return d.value ? s() : V();
124
+ function X() {
125
+ return o.value ? s() : H();
106
126
  }
107
- return I(
108
- C,
109
- (t) => {
110
- t && s(!1, !0);
127
+ return V(
128
+ B,
129
+ (e) => {
130
+ e && s(!1, !0);
131
+ },
132
+ { flush: "sync" }
133
+ ), Q(() => s(!1, !0)), V(
134
+ () => y == null ? void 0 : y.value,
135
+ (e) => {
136
+ e === !1 && s(!1, !0);
111
137
  },
112
138
  { flush: "sync" }
113
- ), S(() => s(!1, !0)), K(() => {
114
- b++, O();
139
+ ), Z(() => {
140
+ E++, j();
115
141
  }), {
116
- open: d,
117
- style: L,
118
- placement: F,
119
- update: k,
120
- show: V,
142
+ open: o,
143
+ style: _(() => {
144
+ var e;
145
+ return {
146
+ ...k.value,
147
+ zIndex: String(((e = F.value) == null ? void 0 : e.zIndex.value) ?? 1200)
148
+ };
149
+ }),
150
+ placement: N,
151
+ update: C,
152
+ show: H,
121
153
  close: s,
122
- toggle: D,
123
- restoringFocus: M
154
+ toggle: X,
155
+ restoringFocus: O,
156
+ schedule: c,
157
+ isTop: () => (u == null ? void 0 : u()) ?? !1
124
158
  };
125
159
  }
126
160
  export {
127
- J as useFloating
161
+ de as useFloating
128
162
  };