hys-ui 0.2.0 → 0.4.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.
- package/CHANGELOG.md +59 -0
- package/README.md +68 -59
- package/dist/components/HysAlert/HysAlert.vue.js +5 -54
- package/dist/components/HysAlert/HysAlert2.vue.js +159 -2
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +146 -2
- package/dist/components/HysAutocomplete/HysAutocomplete.vue.js +2 -2
- package/dist/components/HysAutocomplete/HysAutocomplete2.vue.js +285 -273
- package/dist/components/HysAvatarGroup/HysAvatarGroup.vue.js +1 -1
- package/dist/components/HysAvatarGroup/HysAvatarGroup2.vue.js +102 -98
- package/dist/components/HysBreadcrumb/HysBreadcrumb.vue.js +1 -1
- package/dist/components/HysBreadcrumb/HysBreadcrumb2.vue.js +273 -59
- package/dist/components/HysButton/HysButton.vue.js +2 -2
- package/dist/components/HysButton/HysButton2.vue.js +227 -60
- package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
- package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
- package/dist/components/HysCalendar/HysCalendar.vue.js +3 -3
- package/dist/components/HysCalendar/HysCalendar2.vue.js +237 -225
- package/dist/components/HysCascader/HysCascader.vue.js +2 -2
- package/dist/components/HysCascader/HysCascader2.vue.js +337 -324
- package/dist/components/HysColorPicker/HysColorPanel.vue.js +7 -0
- package/dist/components/HysColorPicker/HysColorPanel2.vue.js +238 -0
- package/dist/components/HysColorPicker/HysColorPicker.vue.js +2 -2
- package/dist/components/HysColorPicker/HysColorPicker2.vue.js +239 -217
- package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +90 -76
- package/dist/components/HysContextMenu/HysContextMenu.vue.js +5 -89
- package/dist/components/HysContextMenu/HysContextMenu2.vue.js +247 -2
- package/dist/components/HysContextMenu/HysMenuPanel.vue.js +7 -0
- package/dist/components/HysContextMenu/HysMenuPanel2.vue.js +208 -0
- package/dist/components/HysContextMenu/HysMenuSlot.js +10 -0
- package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
- package/dist/components/HysDataGrid/HysDataGrid2.vue.js +1008 -559
- package/dist/components/HysDatePicker/HysDatePicker.vue.js +2 -0
- package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +2 -2
- package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +539 -526
- package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +5 -3
- package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
- package/dist/components/HysDrawer/HysDrawer2.vue.js +434 -84
- package/dist/components/HysEmpty/HysEmpty.vue.js +5 -41
- package/dist/components/HysEmpty/HysEmpty2.vue.js +181 -2
- package/dist/components/HysFormItem/HysFormItem.vue.js +2 -2
- package/dist/components/HysFormItem/HysFormItem2.vue.js +171 -164
- package/dist/components/HysGantt/HysGantt.vue.js +1 -1
- package/dist/components/HysGantt/HysGantt2.vue.js +810 -795
- package/dist/components/HysMention/HysMention.vue.js +1 -1
- package/dist/components/HysMention/HysMention2.vue.js +1092 -142
- package/dist/components/HysModal/HysModal.vue.js +2 -2
- package/dist/components/HysModal/HysModal2.vue.js +491 -85
- package/dist/components/HysPagination/HysPagination.vue.js +2 -2
- package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
- package/dist/components/HysPopover/HysPopover.vue.js +5 -91
- package/dist/components/HysPopover/HysPopover2.vue.js +120 -2
- package/dist/components/HysProgress/HysProgress.vue.js +2 -2
- package/dist/components/HysProgress/HysProgress2.vue.js +319 -52
- package/dist/components/HysSearch/HysSearch.vue.js +5 -82
- package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
- package/dist/components/HysSelect/HysSelect.vue.js +2 -2
- package/dist/components/HysSelect/HysSelect2.vue.js +755 -590
- package/dist/components/HysSlider/HysSlider.vue.js +2 -2
- package/dist/components/HysSlider/HysSlider2.vue.js +192 -188
- package/dist/components/HysSlider/SliderTooltip.vue.js +2 -2
- package/dist/components/HysSlider/SliderTooltip2.vue.js +103 -89
- package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
- package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
- package/dist/components/HysTable/HysTable.vue.js +2 -2
- package/dist/components/HysTable/HysTable2.vue.js +1416 -1127
- package/dist/components/HysTagInput/HysTagInput.vue.js +5 -82
- package/dist/components/HysTagInput/HysTagInput2.vue.js +396 -2
- package/dist/components/HysTimeline/HysTimeline.vue.js +2 -2
- package/dist/components/HysTimeline/HysTimeline2.vue.js +243 -24
- package/dist/components/HysTooltip/HysTooltip.vue.js +5 -64
- package/dist/components/HysTooltip/HysTooltip2.vue.js +110 -2
- package/dist/components/HysTour/HysTour.vue.js +291 -63
- package/dist/components/HysTour/HysTour3.vue.js +5 -0
- package/dist/components/HysTransfer/HysTransfer.vue.js +2 -2
- package/dist/components/HysTransfer/HysTransfer2.vue.js +237 -207
- package/dist/components/HysTransfer/HysTransferPanel.vue.js +1 -1
- package/dist/components/HysTransfer/HysTransferPanel2.vue.js +320 -271
- package/dist/components/HysTree/HysTree.vue.js +2 -2
- package/dist/components/HysTree/HysTree2.vue.js +195 -184
- package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +4 -4
- package/dist/components/HysTreeSelect/HysTreeSelect2.vue.js +389 -377
- package/dist/components/HysUpload/HysUpload.vue.js +2 -2
- package/dist/components/HysUpload/HysUpload2.vue.js +459 -125
- package/dist/components/HysVirtualTable/HysVirtualTable.vue.js +5 -94
- package/dist/components/HysVirtualTable/HysVirtualTable2.vue.js +656 -2
- package/dist/composables/buttonGroup.js +12 -0
- package/dist/composables/color.js +97 -0
- package/dist/composables/dataGrid.js +68 -0
- package/dist/composables/drawer.js +17 -0
- package/dist/composables/feedback.js +14 -0
- package/dist/composables/floatingPosition.js +18 -0
- package/dist/composables/mentionDocument.js +79 -0
- package/dist/composables/mentionEditor.js +58 -0
- package/dist/composables/menu.js +96 -0
- package/dist/composables/modal.js +14 -0
- package/dist/composables/overlayManager.js +48 -18
- package/dist/composables/progress.js +94 -0
- package/dist/composables/selectOptions.js +44 -38
- package/dist/composables/splitPaneSizes.js +58 -0
- package/dist/composables/table.js +128 -105
- package/dist/composables/tagInput.js +16 -0
- package/dist/composables/timeline.js +19 -0
- package/dist/composables/transfer.js +19 -17
- package/dist/composables/upload.js +55 -0
- package/dist/composables/uploadRequest.js +58 -0
- package/dist/composables/useAlert.js +124 -0
- package/dist/composables/useColorPicker.js +402 -0
- package/dist/composables/useContextMenu.js +514 -0
- package/dist/composables/useDataGridRemote.js +67 -0
- package/dist/composables/useDialog.js +86 -43
- package/dist/composables/useDrawerPush.js +33 -0
- package/dist/composables/useDrawerResize.js +221 -0
- package/dist/composables/useFloating.js +118 -80
- package/dist/composables/useHysModal.js +185 -0
- package/dist/composables/useMentionCaret.js +81 -0
- package/dist/composables/useMentionList.js +81 -0
- package/dist/composables/useMentionModel.js +90 -0
- package/dist/composables/useMentionOptions.js +421 -0
- package/dist/composables/useModal.js +295 -0
- package/dist/composables/useModalInteraction.js +394 -0
- package/dist/composables/usePopupSurface.js +458 -0
- package/dist/composables/useSplitPaneDrag.js +52 -0
- package/dist/composables/useSplitPaneStorage.js +38 -0
- package/dist/composables/useTable.js +344 -312
- package/dist/composables/useTableSticky.js +79 -0
- package/dist/composables/useTagInput.js +313 -0
- package/dist/composables/useTourLayout.js +129 -0
- package/dist/composables/useTransferMotion.js +185 -0
- package/dist/composables/useUpload.js +472 -0
- package/dist/composables/useUploadModel.js +65 -0
- package/dist/composables/useUploadRequests.js +266 -0
- package/dist/composables/useVirtualTableLayout.js +277 -0
- package/dist/composables/virtualTable.js +43 -0
- package/dist/config.js +11 -11
- package/dist/index.js +175 -153
- package/dist/internal/MultiSplitPane.vue.js +305 -0
- package/dist/internal/MultiSplitPane2.vue.js +4 -0
- package/dist/internal/PopupReference.js +39 -0
- package/dist/internal/PopupSurfacePanel.vue.js +7 -0
- package/dist/internal/PopupSurfacePanel2.vue.js +92 -0
- package/dist/motion/PopupMotion.js +105 -0
- package/dist/motion/popup.js +10 -0
- package/dist/style.css +1 -1
- package/dist/types/components/HysAlert/HysAlert.vue.d.ts +32 -22
- package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +61 -7
- package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +7 -7
- package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +6 -1
- package/dist/types/components/HysBadge/HysBadge.vue.d.ts +3 -3
- package/dist/types/components/HysBreadcrumb/HysBreadcrumb.vue.d.ts +54 -31
- package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
- package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
- package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +3 -2
- package/dist/types/components/HysCascader/HysCascader.vue.d.ts +7 -7
- package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
- package/dist/types/components/HysColorPicker/HysColorPanel.vue.d.ts +58 -0
- package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +63 -10
- package/dist/types/components/HysCommandPalette/HysCommandPalette.vue.d.ts +2 -1
- package/dist/types/components/HysContextMenu/HysContextMenu.vue.d.ts +50 -34
- package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +79 -0
- package/dist/types/components/HysContextMenu/HysMenuSlot.d.ts +8 -0
- package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +65 -118
- package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +3 -3
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +92 -35
- package/dist/types/components/HysEmpty/HysEmpty.vue.d.ts +24 -20
- package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +2 -2
- package/dist/types/components/HysGantt/HysGantt.vue.d.ts +2 -1
- package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -39
- package/dist/types/components/HysModal/HysModal.vue.d.ts +111 -34
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
- package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
- package/dist/types/components/HysPopover/HysPopover.vue.d.ts +41 -29
- package/dist/types/components/HysProgress/HysProgress.vue.d.ts +18 -24
- package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
- package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +2 -2
- package/dist/types/components/HysSearch/HysSearch.vue.d.ts +45 -7
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +19 -5
- package/dist/types/components/HysSlider/HysSlider.vue.d.ts +5 -4
- package/dist/types/components/HysSlider/SliderTooltip.vue.d.ts +3 -1
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
- package/dist/types/components/HysTable/HysTable.vue.d.ts +1742 -5
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +2 -2
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +47 -25
- package/dist/types/components/HysTimeline/HysTimeline.vue.d.ts +19 -32
- package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +39 -19
- package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -8
- package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +2 -2
- package/dist/types/components/HysTransfer/HysTransferPanel.vue.d.ts +5 -3
- package/dist/types/components/HysTree/HysTree.vue.d.ts +2 -2
- package/dist/types/components/HysUpload/HysUpload.vue.d.ts +55 -67
- package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +71 -40
- package/dist/types/composables/autocomplete.d.ts +3 -0
- package/dist/types/composables/avatar.d.ts +3 -0
- package/dist/types/composables/buttonGroup.d.ts +9 -0
- package/dist/types/composables/cascader.d.ts +3 -0
- package/dist/types/composables/color.d.ts +97 -0
- package/dist/types/composables/dataGrid.d.ts +100 -0
- package/dist/types/composables/datePicker.d.ts +3 -0
- package/dist/types/composables/drawer.d.ts +102 -0
- package/dist/types/composables/feedback.d.ts +98 -0
- package/dist/types/composables/floatingPosition.d.ts +14 -0
- package/dist/types/composables/formContext.d.ts +2 -0
- package/dist/types/composables/mention.d.ts +284 -0
- package/dist/types/composables/mentionDocument.d.ts +15 -0
- package/dist/types/composables/mentionEditor.d.ts +7 -0
- package/dist/types/composables/menu.d.ts +183 -0
- package/dist/types/composables/modal.d.ts +185 -0
- package/dist/types/composables/overlayManager.d.ts +7 -3
- package/dist/types/composables/popupSurface.d.ts +83 -0
- package/dist/types/composables/progress.d.ts +92 -0
- package/dist/types/composables/selectOptions.d.ts +7 -0
- package/dist/types/composables/splitPaneSizes.d.ts +11 -0
- package/dist/types/composables/table.d.ts +119 -6
- package/dist/types/composables/tagInput.d.ts +96 -0
- package/dist/types/composables/timeline.d.ts +82 -0
- package/dist/types/composables/tour.d.ts +68 -0
- package/dist/types/composables/transfer.d.ts +7 -0
- package/dist/types/composables/tree.d.ts +3 -0
- package/dist/types/composables/treeSelect.d.ts +3 -0
- package/dist/types/composables/upload.d.ts +202 -0
- package/dist/types/composables/uploadRequest.d.ts +3 -0
- package/dist/types/composables/useAlert.d.ts +21 -0
- package/dist/types/composables/useCascader.d.ts +1 -1
- package/dist/types/composables/useColorPicker.d.ts +101 -0
- package/dist/types/composables/useContextMenu.d.ts +81 -0
- package/dist/types/composables/useDataGridRemote.d.ts +15 -0
- package/dist/types/composables/useDialog.d.ts +16 -3
- package/dist/types/composables/useDrawerPush.d.ts +6 -0
- package/dist/types/composables/useDrawerResize.d.ts +27 -0
- package/dist/types/composables/useFloating.d.ts +22 -3
- package/dist/types/composables/useHysModal.d.ts +44 -0
- package/dist/types/composables/useMentionCaret.d.ts +6 -0
- package/dist/types/composables/useMentionList.d.ts +23 -0
- package/dist/types/composables/useMentionModel.d.ts +14 -0
- package/dist/types/composables/useMentionOptions.d.ts +26 -0
- package/dist/types/composables/useModal.d.ts +62 -0
- package/dist/types/composables/useModalInteraction.d.ts +27 -0
- package/dist/types/composables/usePopupSurface.d.ts +3341 -0
- package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
- package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
- package/dist/types/composables/useTable.d.ts +7 -3
- package/dist/types/composables/useTableSticky.d.ts +22 -0
- package/dist/types/composables/useTagInput.d.ts +66 -0
- package/dist/types/composables/useTourLayout.d.ts +33 -0
- package/dist/types/composables/useTransferMotion.d.ts +36 -0
- package/dist/types/composables/useUpload.d.ts +94 -0
- package/dist/types/composables/useUploadModel.d.ts +14 -0
- package/dist/types/composables/useUploadRequests.d.ts +38 -0
- package/dist/types/composables/useVirtualTableLayout.d.ts +51 -0
- package/dist/types/composables/virtualTable.d.ts +126 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/index.d.ts +53 -3
- package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
- package/dist/types/internal/PopupReference.d.ts +18 -0
- package/dist/types/internal/PopupSurfacePanel.vue.d.ts +37 -0
- package/dist/types/motion/PopupMotion.d.ts +59 -0
- package/dist/types/motion/popup.d.ts +12 -0
- package/package.json +3 -2
- package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
- package/dist/components/HysTour/HysTour2.vue.js +0 -4
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ref as U, shallowRef as G, onMounted as I, onActivated as J, onDeactivated as K, onBeforeUnmount as P, onUpdated as Q, watch as j } from "vue";
|
|
2
|
+
const x = 16, H = (o) => o !== void 0 && Number.isFinite(o) ? Math.max(0, o) : 0;
|
|
3
|
+
function Z(o, k, v) {
|
|
4
|
+
const L = U(0), p = U(), a = G();
|
|
5
|
+
let f = 0, w = !1, i = !1, m, s;
|
|
6
|
+
function b() {
|
|
7
|
+
const t = p.value, c = o.value;
|
|
8
|
+
!t || !c || t.scrollLeft === c.scrollLeft || (t.scrollLeft = c.scrollLeft, m = t.scrollLeft);
|
|
9
|
+
}
|
|
10
|
+
function q(t) {
|
|
11
|
+
if (!i || !o.value) return;
|
|
12
|
+
const c = t.currentTarget.scrollLeft, e = c === m;
|
|
13
|
+
m = void 0, !e && c !== o.value.scrollLeft && (o.value.scrollLeft = c);
|
|
14
|
+
}
|
|
15
|
+
function D() {
|
|
16
|
+
var F, O;
|
|
17
|
+
f = 0;
|
|
18
|
+
const t = o.value;
|
|
19
|
+
if (!i || !(t != null && t.isConnected)) return;
|
|
20
|
+
const c = v(), e = typeof c == "object" ? c : void 0, y = (F = e == null ? void 0 : e.getContainer) == null ? void 0 : F.call(e), S = document.documentElement.clientWidth, T = document.documentElement.clientHeight, n = y instanceof HTMLElement ? y.getBoundingClientRect() : void 0, z = Math.max(0, (n == null ? void 0 : n.top) ?? 0), N = Math.min(T, (n == null ? void 0 : n.bottom) ?? T), d = t.getBoundingClientRect(), B = ((O = k.value) == null ? void 0 : O.getBoundingClientRect().height) ?? 0, V = Math.max(0, t.clientHeight - B);
|
|
21
|
+
L.value = Math.min(
|
|
22
|
+
V,
|
|
23
|
+
Math.max(0, z + H(e == null ? void 0 : e.offsetHeader) - d.top)
|
|
24
|
+
);
|
|
25
|
+
const g = t.scrollWidth - t.clientWidth, u = N - H(e == null ? void 0 : e.offsetScroll) - x, M = Math.max(
|
|
26
|
+
0,
|
|
27
|
+
(n == null ? void 0 : n.left) ?? 0,
|
|
28
|
+
d.left + t.clientLeft
|
|
29
|
+
), h = Math.min(
|
|
30
|
+
S,
|
|
31
|
+
(n == null ? void 0 : n.right) ?? S,
|
|
32
|
+
d.left + t.clientLeft + t.clientWidth
|
|
33
|
+
) - M;
|
|
34
|
+
if (g <= 1 || h <= 0 || d.bottom <= u + x || u <= d.top || u <= z + H(e == null ? void 0 : e.offsetHeader) + B) {
|
|
35
|
+
a.value = void 0;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const A = getComputedStyle(t).direction === "rtl" ? "rtl" : "ltr", r = a.value;
|
|
39
|
+
((r == null ? void 0 : r.top) !== u || r.left !== M || r.width !== h || r.contentWidth !== g + h || r.direction !== A) && (a.value = {
|
|
40
|
+
top: u,
|
|
41
|
+
left: M,
|
|
42
|
+
width: h,
|
|
43
|
+
contentWidth: g + h,
|
|
44
|
+
direction: A
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function l() {
|
|
48
|
+
i && !f && (f = requestAnimationFrame(D));
|
|
49
|
+
}
|
|
50
|
+
function E() {
|
|
51
|
+
i && (i = !1, cancelAnimationFrame(f), f = 0, window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", l), s == null || s.disconnect(), L.value = 0, a.value = void 0);
|
|
52
|
+
}
|
|
53
|
+
function R() {
|
|
54
|
+
!w || !v() || i || !o.value || (i = !0, window.addEventListener("scroll", l, !0), window.addEventListener("resize", l), typeof ResizeObserver < "u" && (s = new ResizeObserver(l), s.observe(o.value)), l());
|
|
55
|
+
}
|
|
56
|
+
function W() {
|
|
57
|
+
w = !0, R();
|
|
58
|
+
}
|
|
59
|
+
function C() {
|
|
60
|
+
w = !1, E();
|
|
61
|
+
}
|
|
62
|
+
return I(W), J(W), K(C), P(C), Q(l), j(v, (t) => t ? R() : E(), { flush: "post" }), j(
|
|
63
|
+
p,
|
|
64
|
+
() => {
|
|
65
|
+
m = void 0, b();
|
|
66
|
+
},
|
|
67
|
+
{ flush: "post" }
|
|
68
|
+
), {
|
|
69
|
+
headerTop: L,
|
|
70
|
+
bar: a,
|
|
71
|
+
scrollbar: p,
|
|
72
|
+
syncScrollbar: b,
|
|
73
|
+
scrollViewport: q,
|
|
74
|
+
scrollbarHeight: x
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
Z as useTableSticky
|
|
79
|
+
};
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { useAttrs as Ee, inject as ne, ref as b, useId as le, computed as S, watch as G, onMounted as Ce, onActivated as Le, onDeactivated as xe, onBeforeUnmount as Te, nextTick as P } from "vue";
|
|
2
|
+
import { fieldKey as Ie, formKey as Se, useHysControlState as Me } from "./formContext.js";
|
|
3
|
+
import { useChoiceModel as Be, useChoiceNativeReset as Ke } from "./choiceModel.js";
|
|
4
|
+
import { splitTags as Q } from "./tagInput.js";
|
|
5
|
+
function He(n, i) {
|
|
6
|
+
const ue = Ee(), f = ne(Ie, void 0), y = ne(Se, void 0), L = Me(n), R = b(), W = b(), u = b(""), m = b(!1), g = b(!1), D = b(!1), ie = le();
|
|
7
|
+
let j = 0, A, v = !0, M;
|
|
8
|
+
const B = (e, a) => e.length === a.length && e.every((t, r) => t === a[r]);
|
|
9
|
+
function d() {
|
|
10
|
+
j++, A == null || A.abort(), A = void 0, m.value = !1, M = void 0, E();
|
|
11
|
+
}
|
|
12
|
+
const K = Be(
|
|
13
|
+
n,
|
|
14
|
+
() => [...n.defaultValue ?? []],
|
|
15
|
+
B,
|
|
16
|
+
d
|
|
17
|
+
), l = S(
|
|
18
|
+
() => Array.isArray(K.current.value) ? K.current.value.filter((e) => typeof e == "string") : []
|
|
19
|
+
), s = S(() => L.disabled.value || !!n.readonly), Y = S(
|
|
20
|
+
() => n.max === 1 / 0 ? 1 / 0 : Number.isFinite(n.max) ? Math.max(0, Math.floor(n.max)) : 10
|
|
21
|
+
), re = S(
|
|
22
|
+
() => {
|
|
23
|
+
var e, a;
|
|
24
|
+
return n.error || (e = f == null ? void 0 : f.invalid) != null && e.value ? "error" : n.status ?? ((a = f == null ? void 0 : f.status) == null ? void 0 : a.value);
|
|
25
|
+
}
|
|
26
|
+
), Z = le(), w = b(), x = b();
|
|
27
|
+
function N(e) {
|
|
28
|
+
var a;
|
|
29
|
+
e === "change" && (y != null && y.model.value) || n.validateEvent !== !1 && !(y != null && y.resetting.value) && ((a = f == null ? void 0 : f.validate) == null || a.call(f, e));
|
|
30
|
+
}
|
|
31
|
+
async function H(e) {
|
|
32
|
+
return K.commit(
|
|
33
|
+
e,
|
|
34
|
+
(a) => i("update:modelValue", [...a]),
|
|
35
|
+
(a) => i("change", [...a]),
|
|
36
|
+
!0
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function U(e, a, t) {
|
|
40
|
+
i("reject", e), i("invalid", {
|
|
41
|
+
value: e,
|
|
42
|
+
reason: a,
|
|
43
|
+
...t ? { error: t instanceof Error ? t : new Error(String(t)) } : {}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async function T(e, a = "api") {
|
|
47
|
+
var te;
|
|
48
|
+
if (!v || s.value || m.value || g.value) return !1;
|
|
49
|
+
const t = u.value, r = e ?? t, o = Array.isArray(r) ? r : Q(r, n.delimiters ?? n.separator), C = [...l.value], O = [], F = [], z = new AbortController(), ae = ++j;
|
|
50
|
+
A = z, m.value = !0;
|
|
51
|
+
const k = () => ae === j && !z.signal.aborted && v && !s.value;
|
|
52
|
+
try {
|
|
53
|
+
for (const J of o) {
|
|
54
|
+
if (!k()) return !1;
|
|
55
|
+
const c = n.trim === !1 ? J : J.trim();
|
|
56
|
+
if (!c) continue;
|
|
57
|
+
let I;
|
|
58
|
+
if (!n.allowDuplicates && C.some(
|
|
59
|
+
(h) => n.caseSensitive === !1 ? h.toLocaleLowerCase() === c.toLocaleLowerCase() : h === c
|
|
60
|
+
) ? I = "duplicate" : C.length >= Y.value ? I = "max" : n.maxlength !== void 0 && c.length > n.maxlength ? I = "maxlength" : n.minlength !== void 0 && c.length < n.minlength && (I = "minlength"), I) {
|
|
61
|
+
if (U(c, I), F.push(c), !k()) return !1;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
const h = (te = n.beforeAdd) == null ? void 0 : te.call(n, c, {
|
|
66
|
+
signal: z.signal,
|
|
67
|
+
values: [...C],
|
|
68
|
+
reason: a
|
|
69
|
+
}), Ae = h && typeof h.then == "function" ? await h : h;
|
|
70
|
+
if (!k()) return !1;
|
|
71
|
+
if (Ae === !1) {
|
|
72
|
+
U(c, "guard"), F.push(c);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
} catch (h) {
|
|
76
|
+
if (!k()) return !1;
|
|
77
|
+
U(c, "error", h), F.push(c);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (!k()) return !1;
|
|
81
|
+
C.push(c), O.push(c);
|
|
82
|
+
}
|
|
83
|
+
if (!k() || !O.length) return !1;
|
|
84
|
+
for (const J of O) i("add", J);
|
|
85
|
+
if (!k()) return !1;
|
|
86
|
+
M = C;
|
|
87
|
+
const De = await H(C);
|
|
88
|
+
return !k() || !De ? !1 : (e === void 0 && u.value === t && (u.value = F.join(
|
|
89
|
+
typeof n.separator == "string" && n.separator ? n.separator : ", "
|
|
90
|
+
)), i("acceptedChange", [...l.value]), N("change"), !0);
|
|
91
|
+
} finally {
|
|
92
|
+
ae === j && (A = void 0, m.value = !1, M = void 0);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function X(e) {
|
|
96
|
+
if (!v || s.value || !Number.isInteger(e) || e < 0 || e >= l.value.length)
|
|
97
|
+
return !1;
|
|
98
|
+
d();
|
|
99
|
+
const a = l.value[e], t = l.value.filter((C, O) => O !== e), r = H(t);
|
|
100
|
+
i("remove", a);
|
|
101
|
+
const o = await r;
|
|
102
|
+
return o && (i("acceptedChange", [...l.value]), N("change")), o;
|
|
103
|
+
}
|
|
104
|
+
async function $() {
|
|
105
|
+
if (!v || s.value) return !1;
|
|
106
|
+
d();
|
|
107
|
+
const e = u.value;
|
|
108
|
+
if (!l.value.length)
|
|
109
|
+
return u.value = "", e && i("clear"), !!e;
|
|
110
|
+
const a = await H([]);
|
|
111
|
+
return a && (u.value === e && (u.value = ""), i("clear"), i("acceptedChange", []), N("change")), a;
|
|
112
|
+
}
|
|
113
|
+
async function _(e, a) {
|
|
114
|
+
if (!v || s.value || !n.draggable || ![e, a].every(Number.isInteger) || e < 0 || a < 0 || e >= l.value.length || a >= l.value.length || e === a)
|
|
115
|
+
return !1;
|
|
116
|
+
d();
|
|
117
|
+
const t = [...l.value], r = t.splice(e, 1)[0];
|
|
118
|
+
t.splice(a, 0, r), i("reorder", e, a, [...t]);
|
|
119
|
+
const o = await H(t);
|
|
120
|
+
return o && (i("acceptedChange", [...l.value]), N("change")), o;
|
|
121
|
+
}
|
|
122
|
+
function V(e) {
|
|
123
|
+
var a;
|
|
124
|
+
v && !L.disabled.value && ((a = W.value) == null || a.focus(e));
|
|
125
|
+
}
|
|
126
|
+
function ce(e) {
|
|
127
|
+
u.value = e.target.value, i("input", u.value), !(g.value || e.isComposing) && n.delimiters && Q(u.value, n.delimiters).length > 1 && T(void 0, "separator");
|
|
128
|
+
}
|
|
129
|
+
function oe(e) {
|
|
130
|
+
g.value = !1, u.value = e.target.value, i("compositionend", e);
|
|
131
|
+
}
|
|
132
|
+
function fe(e) {
|
|
133
|
+
var o;
|
|
134
|
+
if (s.value || g.value || !n.delimiters) return;
|
|
135
|
+
const a = (o = e.clipboardData) == null ? void 0 : o.getData("text/plain");
|
|
136
|
+
if (!a) return;
|
|
137
|
+
const t = e.target, r = u.value.slice(0, t.selectionStart ?? u.value.length) + a + u.value.slice(t.selectionEnd ?? u.value.length);
|
|
138
|
+
Q(r, n.delimiters).length < 2 || (e.preventDefault(), u.value = r, i("input", r), T(void 0, "paste"));
|
|
139
|
+
}
|
|
140
|
+
function se(e) {
|
|
141
|
+
if (e.isComposing || e.keyCode === 229 || g.value || s.value)
|
|
142
|
+
return;
|
|
143
|
+
const a = Array.isArray(n.trigger) ? n.trigger : [n.trigger ?? "Enter"], t = e.key === " " ? "Space" : e.key;
|
|
144
|
+
if (a.includes(t) && u.value.trim()) {
|
|
145
|
+
t !== "Tab" && e.preventDefault(), T(void 0, "keyboard");
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
e.key === "Backspace" && !u.value && l.value.length ? (e.preventDefault(), X(l.value.length - 1)) : e.key === "ArrowLeft" && !u.value && l.value.length ? (e.preventDefault(), q(l.value.length - 1)) : e.key === "Escape" && m.value && (e.preventDefault(), d());
|
|
149
|
+
}
|
|
150
|
+
function q(e) {
|
|
151
|
+
var t;
|
|
152
|
+
if (!v || L.disabled.value) return;
|
|
153
|
+
const a = (t = R.value) == null ? void 0 : t.querySelector(
|
|
154
|
+
'[data-tag-index="' + e + '"]'
|
|
155
|
+
);
|
|
156
|
+
a ? a.focus() : V();
|
|
157
|
+
}
|
|
158
|
+
async function ve(e, a) {
|
|
159
|
+
if (!(s.value || e.isComposing)) {
|
|
160
|
+
if (n.draggable && e.altKey && ["ArrowLeft", "ArrowRight"].includes(e.key)) {
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
const t = a + (e.key === "ArrowLeft" ? -1 : 1);
|
|
163
|
+
await _(a, t) && (await P(), q(t));
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (["Backspace", "Delete"].includes(e.key)) {
|
|
167
|
+
e.preventDefault(), await X(a) && (await P(), q(Math.min(a, l.value.length - 1)));
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key)) {
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
const t = e.key === "Home" ? 0 : e.key === "End" ? l.value.length - 1 : a + (e.key === "ArrowLeft" ? -1 : 1);
|
|
173
|
+
t >= 0 && t < l.value.length ? q(t) : V();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function de(e, a) {
|
|
178
|
+
var t;
|
|
179
|
+
return !!e && (!!((t = R.value) != null && t.contains(e)) || !!(a != null && a.contains(e)));
|
|
180
|
+
}
|
|
181
|
+
function ge(e) {
|
|
182
|
+
D.value || (D.value = !0, i("focus", e));
|
|
183
|
+
}
|
|
184
|
+
function ye(e, a) {
|
|
185
|
+
P(() => {
|
|
186
|
+
!v || de(document.activeElement, a) || D.value && (D.value = !1, i("blur", e), n.addOnBlur && !g.value && T(void 0, "blur"), N("blur"));
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function E() {
|
|
190
|
+
w.value = void 0, x.value = void 0, document.removeEventListener("keydown", p, !0), window.removeEventListener("blur", E);
|
|
191
|
+
}
|
|
192
|
+
function p(e) {
|
|
193
|
+
e.key === "Escape" && E();
|
|
194
|
+
}
|
|
195
|
+
function he(e, a) {
|
|
196
|
+
var t;
|
|
197
|
+
if (s.value || m.value || !n.draggable || e.target.closest("button,input,a")) {
|
|
198
|
+
e.preventDefault();
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
d(), w.value = { index: a, values: [...l.value] }, (t = e.dataTransfer) == null || t.setData("application/x-hys-tag-input", Z), e.dataTransfer && (e.dataTransfer.effectAllowed = "move"), document.addEventListener("keydown", p, !0), window.addEventListener("blur", E);
|
|
202
|
+
}
|
|
203
|
+
function me(e, a) {
|
|
204
|
+
if (!w.value || s.value || !B(w.value.values, l.value))
|
|
205
|
+
return;
|
|
206
|
+
e.preventDefault();
|
|
207
|
+
const t = e.currentTarget.getBoundingClientRect();
|
|
208
|
+
x.value = { index: a, after: e.clientX > t.left + t.width / 2 }, e.dataTransfer && (e.dataTransfer.dropEffect = "move");
|
|
209
|
+
}
|
|
210
|
+
async function we(e) {
|
|
211
|
+
var o;
|
|
212
|
+
if (!w.value || !x.value || s.value || !B(w.value.values, l.value) || ((o = e.dataTransfer) == null ? void 0 : o.getData("application/x-hys-tag-input")) !== Z)
|
|
213
|
+
return;
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
const a = w.value.index, t = x.value.index + (x.value.after ? 1 : 0), r = t - (a < t ? 1 : 0);
|
|
216
|
+
await _(a, r), E();
|
|
217
|
+
}
|
|
218
|
+
Ke(
|
|
219
|
+
R,
|
|
220
|
+
() => {
|
|
221
|
+
d(), K.reset(), u.value = "", g.value = !1, D.value = !1;
|
|
222
|
+
},
|
|
223
|
+
void 0,
|
|
224
|
+
() => n.form
|
|
225
|
+
), G(
|
|
226
|
+
l,
|
|
227
|
+
(e, a) => {
|
|
228
|
+
!B(e, a) && (!M || !B(e, M)) && (A ? d() : E());
|
|
229
|
+
},
|
|
230
|
+
{ flush: "sync" }
|
|
231
|
+
), G(
|
|
232
|
+
() => [
|
|
233
|
+
L.disabled.value,
|
|
234
|
+
n.readonly,
|
|
235
|
+
n.beforeAdd,
|
|
236
|
+
n.max,
|
|
237
|
+
n.delimiters,
|
|
238
|
+
n.separator
|
|
239
|
+
],
|
|
240
|
+
d,
|
|
241
|
+
{ flush: "sync" }
|
|
242
|
+
), G(
|
|
243
|
+
() => y == null ? void 0 : y.resetting.value,
|
|
244
|
+
(e) => {
|
|
245
|
+
e && (d(), K.reset(), u.value = "", g.value = !1);
|
|
246
|
+
},
|
|
247
|
+
{ flush: "sync" }
|
|
248
|
+
), Ce(() => {
|
|
249
|
+
n.autofocus && V();
|
|
250
|
+
}), Le(() => {
|
|
251
|
+
v = !0;
|
|
252
|
+
});
|
|
253
|
+
function ee() {
|
|
254
|
+
v = !1, d(), g.value = !1, D.value = !1;
|
|
255
|
+
}
|
|
256
|
+
xe(ee), Te(ee);
|
|
257
|
+
const ke = S(() => ({
|
|
258
|
+
values: l.value,
|
|
259
|
+
draft: u.value,
|
|
260
|
+
disabled: L.disabled.value,
|
|
261
|
+
readonly: !!n.readonly,
|
|
262
|
+
pending: m.value,
|
|
263
|
+
add: (e) => T(e),
|
|
264
|
+
clear: $
|
|
265
|
+
})), be = S(() => {
|
|
266
|
+
const e = /* @__PURE__ */ new Map();
|
|
267
|
+
return l.value.map((a, t) => {
|
|
268
|
+
const r = e.get(a) ?? 0;
|
|
269
|
+
return e.set(a, r + 1), { value: a, index: t, key: JSON.stringify([a, r]) };
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
return {
|
|
273
|
+
attrs: ue,
|
|
274
|
+
field: f,
|
|
275
|
+
control: L,
|
|
276
|
+
element: R,
|
|
277
|
+
input: W,
|
|
278
|
+
errorId: ie,
|
|
279
|
+
draft: u,
|
|
280
|
+
pending: m,
|
|
281
|
+
composing: g,
|
|
282
|
+
focused: D,
|
|
283
|
+
values: l,
|
|
284
|
+
status: re,
|
|
285
|
+
maximum: Y,
|
|
286
|
+
context: ke,
|
|
287
|
+
tags: be,
|
|
288
|
+
drag: w,
|
|
289
|
+
drop: x,
|
|
290
|
+
add: T,
|
|
291
|
+
remove: X,
|
|
292
|
+
clear: $,
|
|
293
|
+
move: _,
|
|
294
|
+
focus: V,
|
|
295
|
+
nativeInput: ce,
|
|
296
|
+
compositionEnd: oe,
|
|
297
|
+
pasted: fe,
|
|
298
|
+
key: se,
|
|
299
|
+
tagKey: ve,
|
|
300
|
+
focusIn: ge,
|
|
301
|
+
focusOut: ye,
|
|
302
|
+
stopDrag: E,
|
|
303
|
+
dragStart: he,
|
|
304
|
+
dragOver: me,
|
|
305
|
+
dragDrop: we,
|
|
306
|
+
setDraft: (e) => {
|
|
307
|
+
v && !s.value && (u.value = e);
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
export {
|
|
312
|
+
He as useTagInput
|
|
313
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { ref as S, shallowRef as E, computed as O, watch as H, onMounted as j, onActivated as k, onDeactivated as D, onBeforeUnmount as q } from "vue";
|
|
2
|
+
import { popupSize as X } from "../motion/popup.js";
|
|
3
|
+
import { positionFloating as Y } from "./floatingPosition.js";
|
|
4
|
+
function R(t) {
|
|
5
|
+
try {
|
|
6
|
+
const s = typeof t == "function" ? t() : typeof t == "string" ? document.querySelector(t) : t;
|
|
7
|
+
return s instanceof HTMLElement && s.isConnected ? s : void 0;
|
|
8
|
+
} catch {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function F() {
|
|
13
|
+
return {
|
|
14
|
+
width: document.documentElement.clientWidth || window.innerWidth,
|
|
15
|
+
height: document.documentElement.clientHeight || window.innerHeight
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function B(t, s) {
|
|
19
|
+
const n = t.getBoundingClientRect();
|
|
20
|
+
let l = Math.max(0, n.left), i = Math.max(0, n.top), e = Math.min(s.width, n.right), o = Math.min(s.height, n.bottom);
|
|
21
|
+
if (!(!t.getClientRects().length || getComputedStyle(t).visibility !== "visible")) {
|
|
22
|
+
for (let c = t.parentElement; c && c !== document.body; c = c.parentElement) {
|
|
23
|
+
const { overflowX: w, overflowY: M } = getComputedStyle(c), f = /^(auto|scroll|hidden|clip|overlay)$/.test(w), r = /^(auto|scroll|hidden|clip|overlay)$/.test(M);
|
|
24
|
+
if (!f && !r) continue;
|
|
25
|
+
const $ = c.getBoundingClientRect();
|
|
26
|
+
f && (l = Math.max(l, $.left + c.clientLeft), e = Math.min(e, $.left + c.clientLeft + c.clientWidth)), r && (i = Math.max(i, $.top + c.clientTop), o = Math.min(o, $.top + c.clientTop + c.clientHeight));
|
|
27
|
+
}
|
|
28
|
+
return e > l && o > i ? new window.DOMRect(l, i, e - l, o - i) : void 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const V = (t, s) => Number.isFinite(t) ? Math.max(0, t) : s;
|
|
32
|
+
function Z(t, s, n) {
|
|
33
|
+
const [l, i] = Array.isArray(n) ? n : [n, n], e = V(l, 6), o = V(i, 6), c = Math.max(0, t.left - e), w = Math.max(0, t.top - o);
|
|
34
|
+
return new window.DOMRect(
|
|
35
|
+
c,
|
|
36
|
+
w,
|
|
37
|
+
Math.min(s.width, t.right + e) - c,
|
|
38
|
+
Math.min(s.height, t.bottom + o) - w
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function N(t, s) {
|
|
42
|
+
const { left: n, top: l, right: i, bottom: e } = t, o = Math.min(s, t.width / 2, t.height / 2);
|
|
43
|
+
return [
|
|
44
|
+
`M ${n + o} ${l} H ${i - o} Q ${i} ${l} ${i} ${l + o}`,
|
|
45
|
+
`V ${e - o} Q ${i} ${e} ${i - o} ${e}`,
|
|
46
|
+
`H ${n + o} Q ${n} ${e} ${n} ${e - o}`,
|
|
47
|
+
`V ${l + o} Q ${n} ${l} ${n + o} ${l} Z`
|
|
48
|
+
].join(" ");
|
|
49
|
+
}
|
|
50
|
+
function G(t, s, n, l) {
|
|
51
|
+
const i = S(!1), e = E(), o = E(), c = E({ width: 0, height: 0 }), w = E(), M = E();
|
|
52
|
+
let f, r;
|
|
53
|
+
const $ = O(() => i.value && t.value ? R(l.value) : void 0), T = O(() => {
|
|
54
|
+
var p;
|
|
55
|
+
const { width: a, height: u } = c.value;
|
|
56
|
+
if (!a || !u) return "";
|
|
57
|
+
const d = `M 0 0 H ${a} V ${u} H 0 Z`;
|
|
58
|
+
return o.value ? d + " " + N(o.value, V((p = n.value.gap) == null ? void 0 : p.radius, 4)) : d;
|
|
59
|
+
});
|
|
60
|
+
function A() {
|
|
61
|
+
var L;
|
|
62
|
+
const a = F();
|
|
63
|
+
c.value = a;
|
|
64
|
+
const u = e.value && B(e.value, a), d = s.value;
|
|
65
|
+
if (!u || !d) {
|
|
66
|
+
o.value = void 0, w.value = void 0, M.value = void 0;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const p = n.value, b = Z(u, a, (L = p.gap) == null ? void 0 : L.offset);
|
|
70
|
+
o.value = b;
|
|
71
|
+
const v = Y(
|
|
72
|
+
p.mask === !1 ? u : b,
|
|
73
|
+
X(d),
|
|
74
|
+
a,
|
|
75
|
+
p.placement ?? "bottom",
|
|
76
|
+
9,
|
|
77
|
+
12,
|
|
78
|
+
!0
|
|
79
|
+
);
|
|
80
|
+
w.value = v;
|
|
81
|
+
const y = p.arrow, x = typeof y == "object" && y.pointAtCenter === !1, g = x && v.placement.endsWith("start") ? 0 : x && v.placement.endsWith("end") ? 1 : 0.5, m = (W, Q) => Math.max(12, Math.min(W, Q - 12));
|
|
82
|
+
M.value = {
|
|
83
|
+
x: m(u.left + u.width * g - v.x, v.width),
|
|
84
|
+
y: m(u.top + u.height * g - v.y, v.height)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function h() {
|
|
88
|
+
f === void 0 && (f = requestAnimationFrame(() => {
|
|
89
|
+
f = void 0, A();
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
function C(a) {
|
|
93
|
+
var u;
|
|
94
|
+
if (e.value !== a) {
|
|
95
|
+
if (e.value && (r == null || r.unobserve(e.value)), e.value = a, a) {
|
|
96
|
+
r == null || r.observe(a);
|
|
97
|
+
const d = n.value.scrollIntoViewOptions, p = a.getBoundingClientRect(), b = F(), v = B(a, b);
|
|
98
|
+
d !== !1 && (!v || v.width < p.width || v.height < p.height) && ((u = a.scrollIntoView) == null || u.call(a, typeof d == "object" ? { block: "center", inline: "nearest", ...d } : { block: "center", inline: "nearest" }));
|
|
99
|
+
}
|
|
100
|
+
h();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return H($, C, { flush: "post" }), H(n, () => {
|
|
104
|
+
i.value && t.value && h();
|
|
105
|
+
}, { flush: "post" }), H([i, t, s], ([a, u, d], p, b) => {
|
|
106
|
+
var y, x;
|
|
107
|
+
if (!a || !u || !d) return;
|
|
108
|
+
r = typeof ResizeObserver == "function" ? new ResizeObserver(h) : void 0, r == null || r.observe(d), e.value && (r == null || r.observe(e.value)), C(R(l.value)), A();
|
|
109
|
+
const v = new MutationObserver((g) => {
|
|
110
|
+
var m;
|
|
111
|
+
l.value && ((m = e.value) != null && m.isConnected ? g.some((L) => !d.contains(L.target)) && h() : C(R(l.value)));
|
|
112
|
+
});
|
|
113
|
+
v.observe(document.body, { childList: !0, subtree: !0 }), window.addEventListener("resize", h), window.addEventListener("scroll", h, !0), (y = window.visualViewport) == null || y.addEventListener("resize", h), (x = window.visualViewport) == null || x.addEventListener("scroll", h), b(() => {
|
|
114
|
+
var g, m;
|
|
115
|
+
f !== void 0 && cancelAnimationFrame(f), f = void 0, r == null || r.disconnect(), r = void 0, v.disconnect(), window.removeEventListener("resize", h), window.removeEventListener("scroll", h, !0), (g = window.visualViewport) == null || g.removeEventListener("resize", h), (m = window.visualViewport) == null || m.removeEventListener("scroll", h), e.value = void 0, w.value = void 0, o.value = void 0;
|
|
116
|
+
});
|
|
117
|
+
}, { flush: "post" }), j(() => {
|
|
118
|
+
i.value = !0;
|
|
119
|
+
}), k(() => {
|
|
120
|
+
i.value = !0;
|
|
121
|
+
}), D(() => {
|
|
122
|
+
i.value = !1;
|
|
123
|
+
}), q(() => {
|
|
124
|
+
f !== void 0 && cancelAnimationFrame(f);
|
|
125
|
+
}), { view: c, bounds: o, card: w, arrow: M, path: T };
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
G as useTourLayout
|
|
129
|
+
};
|