hys-ui 0.3.0 → 0.5.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 (168) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +68 -73
  3. package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
  4. package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +467 -2
  5. package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.js +7 -0
  6. package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas2.vue.js +166 -0
  7. package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.js +7 -0
  8. package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits2.vue.js +105 -0
  9. package/dist/components/HysAnimatedNumber/animation/digital.js +186 -0
  10. package/dist/components/HysAnimatedNumber/animation/morph.js +110 -0
  11. package/dist/components/HysAnimatedNumber/animation/paint.js +34 -0
  12. package/dist/components/HysAnimatedNumber/animation/particles.js +51 -0
  13. package/dist/components/HysAnimatedNumber/animation/paths.js +165 -0
  14. package/dist/components/HysAnimatedNumber/animation/physics.js +66 -0
  15. package/dist/components/HysAnimatedNumber/animation/render.js +89 -0
  16. package/dist/components/HysAnimatedNumber/animation/reveal.js +125 -0
  17. package/dist/components/HysAnimatedNumber/animation/rolling.js +66 -0
  18. package/dist/components/HysAnimatedNumber/animation/scenarios.js +217 -0
  19. package/dist/components/HysAnimatedNumber/animation/spatial.js +112 -0
  20. package/dist/components/HysAnimatedNumber/useNumberCountdown.js +58 -0
  21. package/dist/components/HysAnimatedNumber/useNumberVisuals.js +60 -0
  22. package/dist/components/HysButton/HysButton.vue.js +2 -2
  23. package/dist/components/HysButton/HysButton2.vue.js +227 -60
  24. package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
  25. package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
  26. package/dist/components/HysFormItem/HysFormItem.vue.js +1 -1
  27. package/dist/components/HysFormItem/HysFormItem2.vue.js +231 -229
  28. package/dist/components/HysInput/HysInput.vue.js +2 -2
  29. package/dist/components/HysInput/HysInput2.vue.js +327 -274
  30. package/dist/components/HysMention/HysMention.vue.js +1 -1
  31. package/dist/components/HysMention/HysMention2.vue.js +1092 -154
  32. package/dist/components/HysModal/HysModal.vue.js +3 -3
  33. package/dist/components/HysModal/HysModal2.vue.js +81 -80
  34. package/dist/components/HysPagination/HysPagination.vue.js +2 -2
  35. package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
  36. package/dist/components/HysSearch/HysSearch.vue.js +5 -82
  37. package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
  38. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  39. package/dist/components/HysSelect/HysSelect2.vue.js +472 -443
  40. package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
  41. package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
  42. package/dist/components/HysTable/HysTable.vue.js +2 -2
  43. package/dist/components/HysTable/HysTable2.vue.js +1418 -1150
  44. package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
  45. package/dist/components/HysTour/HysTour.vue.js +291 -67
  46. package/dist/components/HysTour/HysTour3.vue.js +5 -0
  47. package/dist/composables/animatedNumberDigits.js +106 -0
  48. package/dist/composables/animatedNumberFormat.js +222 -0
  49. package/dist/composables/animatedNumberTiming.js +66 -0
  50. package/dist/composables/buttonGroup.js +12 -0
  51. package/dist/composables/floatingPosition.js +18 -0
  52. package/dist/composables/mentionDocument.js +79 -0
  53. package/dist/composables/mentionEditor.js +58 -0
  54. package/dist/composables/numberAnimation.js +72 -0
  55. package/dist/composables/numberAnimationCatalog.js +301 -0
  56. package/dist/composables/numberAnimationSequence.js +45 -0
  57. package/dist/composables/selectOptions.js +44 -38
  58. package/dist/composables/splitPaneSizes.js +58 -0
  59. package/dist/composables/table.js +128 -105
  60. package/dist/composables/textInput.js +23 -14
  61. package/dist/composables/useDialog.js +50 -50
  62. package/dist/composables/useFloating.js +107 -103
  63. package/dist/composables/useHysAnimatedNumber.js +264 -0
  64. package/dist/composables/useHysNumberAnimationGroup.js +23 -0
  65. package/dist/composables/useMentionCaret.js +81 -0
  66. package/dist/composables/useMentionList.js +81 -0
  67. package/dist/composables/useMentionModel.js +90 -0
  68. package/dist/composables/useMentionOptions.js +421 -0
  69. package/dist/composables/useSplitPaneDrag.js +52 -0
  70. package/dist/composables/useSplitPaneStorage.js +38 -0
  71. package/dist/composables/useTable.js +344 -312
  72. package/dist/composables/useTableSticky.js +79 -0
  73. package/dist/composables/useTextareaSize.js +62 -46
  74. package/dist/composables/useTourLayout.js +129 -0
  75. package/dist/config.js +11 -11
  76. package/dist/index.js +183 -152
  77. package/dist/internal/MultiSplitPane.vue.js +305 -0
  78. package/dist/internal/MultiSplitPane2.vue.js +4 -0
  79. package/dist/style.css +1 -1
  80. package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +99 -6
  81. package/dist/types/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.d.ts +19 -0
  82. package/dist/types/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.d.ts +31 -0
  83. package/dist/types/components/HysAnimatedNumber/animation/digital.d.ts +3 -0
  84. package/dist/types/components/HysAnimatedNumber/animation/morph.d.ts +2 -0
  85. package/dist/types/components/HysAnimatedNumber/animation/paint.d.ts +44 -0
  86. package/dist/types/components/HysAnimatedNumber/animation/particles.d.ts +5 -0
  87. package/dist/types/components/HysAnimatedNumber/animation/paths.d.ts +12 -0
  88. package/dist/types/components/HysAnimatedNumber/animation/physics.d.ts +2 -0
  89. package/dist/types/components/HysAnimatedNumber/animation/render.d.ts +2 -0
  90. package/dist/types/components/HysAnimatedNumber/animation/reveal.d.ts +2 -0
  91. package/dist/types/components/HysAnimatedNumber/animation/rolling.d.ts +2 -0
  92. package/dist/types/components/HysAnimatedNumber/animation/scenarios.d.ts +4 -0
  93. package/dist/types/components/HysAnimatedNumber/animation/spatial.d.ts +2 -0
  94. package/dist/types/components/HysAnimatedNumber/useNumberCountdown.d.ts +8 -0
  95. package/dist/types/components/HysAnimatedNumber/useNumberVisuals.d.ts +12 -0
  96. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +12 -3
  97. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
  98. package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
  99. package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
  100. package/dist/types/components/HysCard/HysCard.vue.d.ts +1 -1
  101. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +3 -3
  102. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +3 -3
  103. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +3 -3
  104. package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +2 -2
  105. package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +3 -3
  106. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +6 -6
  107. package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
  108. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +2 -2
  109. package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
  110. package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
  111. package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -40
  112. package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
  113. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
  114. package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
  115. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +1 -1
  116. package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
  117. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +46 -8
  118. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +6 -1
  119. package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
  120. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
  121. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
  122. package/dist/types/components/HysTable/HysTable.vue.d.ts +1740 -3
  123. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +1 -1
  124. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +1 -1
  125. package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +13 -2
  126. package/dist/types/components/HysToast/HysToast.vue.d.ts +1 -1
  127. package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
  128. package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -9
  129. package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +3 -3
  130. package/dist/types/components/HysUpload/HysUpload.vue.d.ts +2 -2
  131. package/dist/types/composables/animatedNumber.d.ts +220 -0
  132. package/dist/types/composables/animatedNumberDigits.d.ts +32 -0
  133. package/dist/types/composables/animatedNumberFormat.d.ts +16 -0
  134. package/dist/types/composables/animatedNumberTiming.d.ts +21 -0
  135. package/dist/types/composables/buttonGroup.d.ts +9 -0
  136. package/dist/types/composables/drawer.d.ts +1 -1
  137. package/dist/types/composables/floatingPosition.d.ts +14 -0
  138. package/dist/types/composables/mention.d.ts +284 -0
  139. package/dist/types/composables/mentionDocument.d.ts +15 -0
  140. package/dist/types/composables/mentionEditor.d.ts +7 -0
  141. package/dist/types/composables/modal.d.ts +2 -0
  142. package/dist/types/composables/numberAnimation.d.ts +29 -0
  143. package/dist/types/composables/numberAnimationCatalog.d.ts +58 -0
  144. package/dist/types/composables/numberAnimationSequence.d.ts +13 -0
  145. package/dist/types/composables/selectOptions.d.ts +5 -0
  146. package/dist/types/composables/splitPaneSizes.d.ts +11 -0
  147. package/dist/types/composables/table.d.ts +116 -6
  148. package/dist/types/composables/textInput.d.ts +39 -4
  149. package/dist/types/composables/tour.d.ts +68 -0
  150. package/dist/types/composables/useFloating.d.ts +1 -1
  151. package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
  152. package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
  153. package/dist/types/composables/useMentionCaret.d.ts +6 -0
  154. package/dist/types/composables/useMentionList.d.ts +23 -0
  155. package/dist/types/composables/useMentionModel.d.ts +14 -0
  156. package/dist/types/composables/useMentionOptions.d.ts +26 -0
  157. package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
  158. package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
  159. package/dist/types/composables/useTable.d.ts +7 -3
  160. package/dist/types/composables/useTableSticky.d.ts +22 -0
  161. package/dist/types/composables/useTextareaSize.d.ts +5 -2
  162. package/dist/types/composables/useTourLayout.d.ts +33 -0
  163. package/dist/types/config.d.ts +1 -0
  164. package/dist/types/index.d.ts +46 -1
  165. package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
  166. package/package.json +3 -2
  167. package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
  168. package/dist/components/HysTour/HysTour2.vue.js +0 -4
@@ -0,0 +1,81 @@
1
+ import { computed as u, ref as m, watch as R } from "vue";
2
+ function F(o, H, s, M) {
3
+ const c = u(() => {
4
+ const e = /* @__PURE__ */ new Map();
5
+ for (const l of H.value) {
6
+ const i = l.option.group ?? "", t = e.get(i);
7
+ t ? t.push(l) : e.set(i, [l]);
8
+ }
9
+ let a = 0;
10
+ return [...e].flatMap(([l, i]) => [
11
+ ...l ? [{ key: "group:" + l, group: l }] : [],
12
+ ...i.map((t) => ({ key: t.key, entry: t, index: a++ }))
13
+ ]);
14
+ }), x = u(
15
+ () => c.value.flatMap(
16
+ (e) => "entry" in e && !e.entry.user.disabled ? [e.entry] : []
17
+ )
18
+ ), r = m(0), v = m(240), n = u(
19
+ () => o.itemHeight && Number.isFinite(o.itemHeight) ? Math.max(20, o.itemHeight) : 44
20
+ ), f = u(
21
+ () => o.overscan !== void 0 && Number.isFinite(o.overscan) ? Math.max(0, Math.floor(o.overscan)) : 4
22
+ ), h = u(
23
+ () => o.virtual ? Math.max(
24
+ 0,
25
+ Math.floor(r.value / n.value) - f.value
26
+ ) : 0
27
+ ), d = u(
28
+ () => o.virtual ? Math.ceil((r.value + v.value) / n.value) + f.value : c.value.length
29
+ ), y = u(() => c.value.slice(h.value, d.value)), T = u(
30
+ () => o.virtual ? h.value * n.value : 0
31
+ ), b = u(
32
+ () => o.virtual ? Math.max(0, c.value.length - d.value) * n.value : 0
33
+ );
34
+ function p() {
35
+ const e = s.value;
36
+ e && (r.value = e.scrollTop, e.scrollHeight > e.clientHeight && e.scrollHeight - e.scrollTop - e.clientHeight <= n.value && M());
37
+ }
38
+ function w() {
39
+ r.value = 0, s.value && (s.value.scrollTop = 0);
40
+ }
41
+ R(
42
+ s,
43
+ (e, a, l) => {
44
+ if (!e) return;
45
+ const i = () => {
46
+ v.value = e.clientHeight || 240;
47
+ };
48
+ i();
49
+ const t = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(i);
50
+ t == null || t.observe(e), l(() => t == null ? void 0 : t.disconnect());
51
+ },
52
+ { flush: "post" }
53
+ );
54
+ function k(e) {
55
+ var g;
56
+ const a = s.value;
57
+ if (!a) return;
58
+ if (!o.virtual) {
59
+ (g = a.querySelector('[data-active="true"]')) == null || g.scrollIntoView({ block: "nearest" });
60
+ return;
61
+ }
62
+ const l = c.value.findIndex((S) => S.key === e);
63
+ if (l < 0) return;
64
+ const i = l * n.value, t = a.clientHeight || v.value;
65
+ i < a.scrollTop ? a.scrollTop = i : i + n.value > a.scrollTop + t && (a.scrollTop = i + n.value - t), r.value = a.scrollTop;
66
+ }
67
+ return {
68
+ rows: c,
69
+ enabled: x,
70
+ visibleRows: y,
71
+ topSpacer: T,
72
+ bottomSpacer: b,
73
+ rowHeight: n,
74
+ onScroll: p,
75
+ reset: w,
76
+ ensureVisible: k
77
+ };
78
+ }
79
+ export {
80
+ F as useMentionList
81
+ };
@@ -0,0 +1,90 @@
1
+ import { ref as j, computed as R, shallowRef as A, watch as B, nextTick as C } from "vue";
2
+ import { normalizeMentionEntities as M, rebaseMentionEntities as K } from "./mentionDocument.js";
3
+ function b(e) {
4
+ return JSON.stringify([
5
+ typeof e.id,
6
+ e.id,
7
+ e.type,
8
+ e.prefix,
9
+ e.text
10
+ ]);
11
+ }
12
+ function D(e, n) {
13
+ function i(a, u) {
14
+ const d = /* @__PURE__ */ new Map();
15
+ for (const l of u) {
16
+ const r = b(l);
17
+ d.set(r, (d.get(r) ?? 0) + 1);
18
+ }
19
+ return a.filter((l) => {
20
+ const r = b(l), v = d.get(r) ?? 0;
21
+ return v ? (d.set(r, v - 1), !1) : !0;
22
+ });
23
+ }
24
+ return {
25
+ added: i(n, e),
26
+ removed: i(e, n)
27
+ };
28
+ }
29
+ function T(e, n) {
30
+ return e.length === n.length && e.every(
31
+ (i, a) => i.start === n[a].start && i.end === n[a].end && b(i) === b(n[a]) && i.label === n[a].label && i.value === n[a].value && i.payload === n[a].payload
32
+ );
33
+ }
34
+ function H(e, n, i) {
35
+ var z;
36
+ const a = j(e.defaultValue ?? ""), u = R(() => e.modelValue ?? a.value), d = e.defaultEntities ?? ((z = e.parseEntities) == null ? void 0 : z.call(e, u.value)) ?? [], l = A({
37
+ text: u.value,
38
+ entities: M(u.value, d)
39
+ }), r = R(() => {
40
+ const t = u.value, o = e.entities ?? (l.value.text === t ? l.value.entities : K(l.value, t)), f = M(t, o);
41
+ return e.invalidEntity === "text" && e.validateEntity ? f.filter(e.validateEntity) : f;
42
+ }), v = R(() => ({
43
+ text: u.value,
44
+ entities: r.value
45
+ }));
46
+ let s, V = 0;
47
+ const m = [], w = [];
48
+ B(
49
+ u,
50
+ (t) => {
51
+ var o;
52
+ e.entities !== void 0 || (s == null ? void 0 : s.text) === t || (l.value = {
53
+ text: t,
54
+ entities: M(t, [
55
+ ...K(l.value, t),
56
+ ...((o = e.parseEntities) == null ? void 0 : o.call(e, t)) ?? []
57
+ ])
58
+ });
59
+ },
60
+ { flush: "sync" }
61
+ );
62
+ async function q(t, o, f, y = !0, E = !1) {
63
+ const c = v.value, h = M(t.text, t.entities), x = t.text !== c.text;
64
+ if (!x && T(c.entities, h) || !E && e.beforeRemove && D(c.entities, h).removed.some(
65
+ (S) => {
66
+ var J;
67
+ return ((J = e.beforeRemove) == null ? void 0 : J.call(e, S)) === !1;
68
+ }
69
+ ) || (s == null ? void 0 : s.text) === t.text && T(s.entities, h))
70
+ return !1;
71
+ const k = { text: t.text, entities: h }, O = ++V;
72
+ if (s = k, x && e.modelValue === void 0 && (a.value = t.text), f == null || f(), n(k, c, x), await C(), O !== V || (s = void 0, u.value !== t.text)) return !1;
73
+ e.entities === void 0 && (l.value = k);
74
+ const g = v.value;
75
+ return !x && T(g.entities, c.entities) ? !1 : (y && (m.push({ ...c, selection: o }), m.length > 100 && m.shift(), w.length = 0), i(g, c), !0);
76
+ }
77
+ async function N(t, o) {
78
+ const f = t === "undo" ? m : w, y = t === "undo" ? w : m, E = f.at(-1);
79
+ if (!E) return;
80
+ const c = v.value;
81
+ if (await q(E, o, void 0, !1))
82
+ return f.pop(), y.push({ ...c, selection: o }), E.selection;
83
+ }
84
+ return { value: u, entities: r, document: v, commit: q, history: N };
85
+ }
86
+ export {
87
+ D as diffMentionEntities,
88
+ b as mentionEntityKey,
89
+ H as useMentionModel
90
+ };
@@ -0,0 +1,421 @@
1
+ import { computed as w, shallowRef as W, ref as ce, watch as Z, onBeforeUnmount as we, onDeactivated as Me, onMounted as Se } from "vue";
2
+ function k(e, c) {
3
+ const d = e.id ?? (c == null ? void 0 : c.id) ?? e.value;
4
+ return {
5
+ option: e,
6
+ key: (e.type ?? e.prefix ?? "") + ":" + typeof d + ":" + d,
7
+ user: c ?? {
8
+ id: String(d),
9
+ name: typeof e.label == "string" ? e.label : String(e.value),
10
+ disabled: e.disabled
11
+ }
12
+ };
13
+ }
14
+ function ke(e, c, d) {
15
+ const g = e, O = g[(c == null ? void 0 : c.value) ?? "value"];
16
+ if (typeof O != "string" && typeof O != "number") return;
17
+ const b = { ...e, value: O };
18
+ if (c) {
19
+ const A = g[c.label ?? "label"], z = g[c.id ?? "id"];
20
+ b.label = typeof A == "string" || typeof A == "function" ? A : void 0, b.id = typeof z == "string" || typeof z == "number" ? z : void 0, b.disabled = !!g[c.disabled ?? "disabled"];
21
+ for (const N of ["group", "avatar", "description", "type"]) {
22
+ const F = g[c[N] ?? N];
23
+ b[N] = typeof F == "string" ? F : void 0;
24
+ }
25
+ b.payload = g.payload ?? e;
26
+ }
27
+ return b.group ?? (b.group = d), b;
28
+ }
29
+ const R = (e) => e.normalize("NFKC").toLocaleLowerCase(), $ = (e) => R(e).replace(/ü/g, "v").replace(/[\s'’-]/g, "");
30
+ function Oe(e, c) {
31
+ let d = 0;
32
+ for (const g of e) {
33
+ const O = c.indexOf(g, d);
34
+ if (O < 0) return !1;
35
+ d = O + g.length;
36
+ }
37
+ return !0;
38
+ }
39
+ function ze(e, c) {
40
+ return c.split(".").reduce(
41
+ (d, g) => d && typeof d == "object" ? d[g] : void 0,
42
+ e
43
+ );
44
+ }
45
+ function ue(e) {
46
+ return Array.isArray(e) ? e.map(ue).filter(Boolean).join(" ") : typeof e == "string" || typeof e == "number" ? String(e) : "";
47
+ }
48
+ function j(e, c) {
49
+ return typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.floor(e)) : c;
50
+ }
51
+ function Ne(e) {
52
+ return Array.isArray(e) ? { items: e, hasMore: !1 } : e;
53
+ }
54
+ function Pe(e, c, d, g, O, b) {
55
+ const A = w(() => {
56
+ const t = d.value, n = (t == null ? void 0 : t.options) ?? e.options, o = (t == null ? void 0 : t.loadOptions) ?? e.loadOptions;
57
+ return [
58
+ {
59
+ key: "$default",
60
+ options: n,
61
+ loader: o,
62
+ fields: e.fieldNames
63
+ },
64
+ ...(e.sources ?? []).filter(
65
+ (l) => {
66
+ var i;
67
+ return !l.prefixes || l.prefixes.includes(((i = c.value) == null ? void 0 : i.prefix) ?? "");
68
+ }
69
+ ).map((l) => ({
70
+ key: "source:" + l.key,
71
+ loader: l.loadOptions,
72
+ options: l.options,
73
+ fields: l.fieldNames ?? e.fieldNames,
74
+ group: l.group
75
+ }))
76
+ ];
77
+ }), z = w(
78
+ () => A.value.filter((t) => t.loader)
79
+ ), N = /* @__PURE__ */ new WeakMap();
80
+ let F = 0;
81
+ const fe = w(
82
+ () => JSON.stringify(
83
+ z.value.map(({ key: t, loader: n }) => (N.has(n) || N.set(n, ++F), [t, N.get(n)]))
84
+ )
85
+ ), K = w(() => {
86
+ const t = c.value;
87
+ return t && !g.value ? JSON.stringify([
88
+ t.prefix,
89
+ t.query,
90
+ t.start,
91
+ t.manual,
92
+ fe.value,
93
+ e.pageSize
94
+ ]) : void 0;
95
+ }), M = W(/* @__PURE__ */ new Map()), L = ce(!1), D = ce(!1), T = W(), Q = w(
96
+ () => e.loading || L.value && !D.value
97
+ ), X = w(
98
+ () => z.value.some(({ key: t }) => {
99
+ var n;
100
+ return (n = M.value.get(t)) == null ? void 0 : n.hasMore;
101
+ })
102
+ ), p = /* @__PURE__ */ new Map();
103
+ let S, Y, _ = -1 / 0;
104
+ function B() {
105
+ clearTimeout(Y), S == null || S.abort(), S = void 0, L.value = !1, D.value = !1;
106
+ }
107
+ function de() {
108
+ if (!e.cache) return;
109
+ const t = typeof e.cache == "object" ? e.cache : void 0;
110
+ return {
111
+ ttl: j(t == null ? void 0 : t.ttl, 3e4),
112
+ limit: j(t == null ? void 0 : t.maxEntries, 40)
113
+ };
114
+ }
115
+ async function ve(t, n, o, l, i, u) {
116
+ const r = t.loader, s = Math.max(1, j(e.pageSize, 20)), a = JSON.stringify([
117
+ t.key,
118
+ N.get(r),
119
+ n.prefix,
120
+ n.query,
121
+ s,
122
+ o,
123
+ l
124
+ ]), v = de(), y = v && !u ? p.get(a) : void 0;
125
+ if (y && y.expires > Date.now())
126
+ return p.delete(a), p.set(a, y), y.page;
127
+ p.delete(a);
128
+ const x = Ne(
129
+ await r({
130
+ ...n,
131
+ text: O.value,
132
+ page: o,
133
+ pageSize: s,
134
+ cursor: l,
135
+ signal: i
136
+ })
137
+ );
138
+ if (!i.aborted && (v != null && v.limit) && v.ttl)
139
+ for (p.set(a, { expires: Date.now() + v.ttl, page: x }); p.size > v.limit; )
140
+ p.delete(p.keys().next().value);
141
+ return x;
142
+ }
143
+ async function q(t, n, o, l) {
144
+ if (n.aborted || K.value !== o) return !1;
145
+ _ = Date.now();
146
+ const i = M.value, u = z.value.filter((s) => {
147
+ const a = i.get(s.key);
148
+ return t === "initial" || (t === "more" ? (a == null ? void 0 : a.hasMore) && !a.failed : a == null ? void 0 : a.failed);
149
+ });
150
+ let r = !1;
151
+ return await Promise.all(
152
+ u.map(async (s) => {
153
+ const a = i.get(s.key), v = ((a == null ? void 0 : a.page) ?? 0) + 1;
154
+ try {
155
+ const y = await ve(
156
+ s,
157
+ l,
158
+ v,
159
+ a == null ? void 0 : a.cursor,
160
+ n,
161
+ t === "retry"
162
+ );
163
+ if (n.aborted || K.value !== o) return;
164
+ const x = [...(a == null ? void 0 : a.items) ?? [], ...y.items], G = y.hasMore ?? (y.nextCursor !== void 0 ? y.nextCursor !== null : y.total !== void 0 && x.length < y.total), J = new Map(M.value);
165
+ J.set(s.key, {
166
+ page: v,
167
+ cursor: y.nextCursor ?? void 0,
168
+ hasMore: G,
169
+ items: x
170
+ }), M.value = J, r = !0;
171
+ } catch (y) {
172
+ if (n.aborted || K.value !== o) return;
173
+ const x = new Map(M.value);
174
+ x.set(s.key, {
175
+ page: (a == null ? void 0 : a.page) ?? 0,
176
+ cursor: a == null ? void 0 : a.cursor,
177
+ hasMore: (a == null ? void 0 : a.hasMore) ?? !1,
178
+ items: (a == null ? void 0 : a.items) ?? [],
179
+ failed: !0
180
+ }), M.value = x, T.value = { reason: y }, b(y, l);
181
+ }
182
+ })
183
+ ), !n.aborted && (S == null ? void 0 : S.signal) === n && (S = void 0, L.value = !1, D.value = !1), r;
184
+ }
185
+ function U(t) {
186
+ if (t !== "initial" && L.value)
187
+ return Promise.resolve(!1);
188
+ B(), t === "initial" && (M.value = /* @__PURE__ */ new Map()), t !== "more" && (T.value = void 0);
189
+ const n = c.value, o = K.value;
190
+ if (!n || !o || !z.value.length)
191
+ return Promise.resolve(!1);
192
+ const l = new AbortController();
193
+ S = l, L.value = !0, D.value = t !== "initial" && [...M.value.values()].some(({ items: u }) => u.length);
194
+ const i = t === "initial" ? Math.max(
195
+ j(e.debounce, 180),
196
+ j(e.throttle, 0) - (Date.now() - _)
197
+ ) : 0;
198
+ return i ? (Y = setTimeout(
199
+ () => void q(t, l.signal, o, n),
200
+ i
201
+ ), Promise.resolve(!1)) : q(t, l.signal, o, n);
202
+ }
203
+ Z(
204
+ [K, () => e.debounce, () => e.throttle],
205
+ () => void U("initial"),
206
+ { flush: "post" }
207
+ ), we(B), Me(B);
208
+ const ye = () => {
209
+ U("retry");
210
+ }, me = () => X.value ? U("more") : Promise.resolve(!1), P = W([]);
211
+ function ee() {
212
+ if (P.value = [], !(!e.historyKey || typeof window > "u"))
213
+ try {
214
+ const t = JSON.parse(
215
+ window.localStorage.getItem(e.historyKey) ?? "[]"
216
+ );
217
+ Array.isArray(t) && (P.value = t.filter(
218
+ (n) => n && typeof n.prefix == "string" && Number.isFinite(n.count) && n.option && ["number", "string"].includes(typeof n.option.value)
219
+ ));
220
+ } catch {
221
+ }
222
+ }
223
+ Se(ee), Z(() => e.historyKey, ee);
224
+ function he(t, n) {
225
+ const o = k(t).key, l = P.value.filter(
226
+ (u) => u.prefix !== n || k(u.option).key !== o
227
+ ), i = P.value.find(
228
+ (u) => u.prefix === n && k(u.option).key === o
229
+ );
230
+ if (P.value = [
231
+ { option: t, prefix: n, count: ((i == null ? void 0 : i.count) ?? 0) + 1 },
232
+ ...l
233
+ ].slice(0, j(e.recentLimit, 8)), !!e.historyKey)
234
+ try {
235
+ window.localStorage.setItem(
236
+ e.historyKey,
237
+ JSON.stringify(
238
+ P.value.map(({ prefix: u, count: r, option: s }) => ({
239
+ prefix: u,
240
+ count: r,
241
+ option: {
242
+ id: s.id,
243
+ value: s.value,
244
+ label: k(s).user.name,
245
+ type: s.type,
246
+ avatar: s.avatar
247
+ }
248
+ }))
249
+ )
250
+ );
251
+ } catch {
252
+ }
253
+ }
254
+ const te = w(() => {
255
+ var n, o, l;
256
+ const t = [];
257
+ if (!((n = d.value) != null && n.options) && !e.options && !e.loadOptions && !((o = d.value) != null && o.loadOptions))
258
+ for (const i of e.users ?? [])
259
+ t.push(
260
+ k(
261
+ {
262
+ id: i.id,
263
+ value: i.name,
264
+ label: i.name,
265
+ disabled: i.disabled
266
+ },
267
+ i
268
+ )
269
+ );
270
+ for (const i of A.value) {
271
+ const u = i.options ?? [], r = ((l = M.value.get(i.key)) == null ? void 0 : l.items) ?? [];
272
+ for (const [s, a] of [...u, ...r].entries()) {
273
+ const v = ke(a, i.fields, i.group);
274
+ v && t.push({
275
+ ...k(v),
276
+ remote: s >= u.length
277
+ });
278
+ }
279
+ }
280
+ return t;
281
+ }), I = w(() => {
282
+ var n;
283
+ const t = ((n = d.value) == null ? void 0 : n.searchMode) ?? e.searchMode ?? "includes";
284
+ return typeof t == "string" ? [t] : t;
285
+ }), E = W();
286
+ let V = !1;
287
+ Z(
288
+ () => I.value.some((t) => t === "pinyin" || t === "initials"),
289
+ (t) => {
290
+ !t || E.value || V || (V = !0, import("pinyin-pro").then((n) => {
291
+ E.value = n.pinyin;
292
+ }).catch(() => {
293
+ }).finally(() => {
294
+ V = !1;
295
+ }));
296
+ },
297
+ { immediate: !0 }
298
+ );
299
+ const ne = /* @__PURE__ */ new Map();
300
+ function ge(t, n, o) {
301
+ if (!o) return 0;
302
+ const l = [
303
+ n,
304
+ String(t.value),
305
+ ...t.keywords ?? [],
306
+ ...(e.searchFields ?? []).map(
307
+ (r) => ue(
308
+ typeof r == "function" ? r(t) : ze(t, r)
309
+ )
310
+ )
311
+ ], i = l.map(R);
312
+ if (i.some((r) => r === o)) return 5;
313
+ if (i.some((r) => r.startsWith(o))) return 4;
314
+ if (i.join(" ").includes(o) || o.includes(" ") && o.split(/\s+/).every((r) => i.some((s) => s.includes(r))))
315
+ return 3;
316
+ if (I.value.includes("fuzzy") && i.some((r) => Oe(o, r)))
317
+ return 1;
318
+ if (!E.value || !I.value.some((r) => r === "pinyin" || r === "initials"))
319
+ return -1;
320
+ const u = $(o);
321
+ for (const r of l) {
322
+ if (!new RegExp("\\p{Script=Han}", "u").test(r)) continue;
323
+ let s = ne.get(r);
324
+ if (!s) {
325
+ const a = E.value(r, {
326
+ toneType: "none",
327
+ type: "array",
328
+ nonZh: "consecutive"
329
+ });
330
+ s = {
331
+ full: $(a.join("")),
332
+ initials: $(a.map((v) => v[0]).join(""))
333
+ }, ne.set(r, s);
334
+ }
335
+ if (I.value.includes("pinyin") && s.full.includes(u) || I.value.includes("initials") && s.initials.includes(u))
336
+ return 2;
337
+ }
338
+ return -1;
339
+ }
340
+ const ae = w(() => {
341
+ var y, x, G, J, ie;
342
+ const t = c.value;
343
+ if (!t || g.value || Q.value) return [];
344
+ const n = R(t.query.trim()), o = d.value, l = (o == null ? void 0 : o.filterOption) ?? e.filterOption, i = /* @__PURE__ */ new Set(), u = te.value.slice();
345
+ if (!n) {
346
+ const f = P.value.filter(
347
+ (m) => m.prefix === t.prefix
348
+ ), h = ((y = e.locale) == null ? void 0 : y.recent) ?? "最近使用", C = ((x = e.locale) == null ? void 0 : x.recommended) ?? "常用推荐", H = [
349
+ ...e.recommendations ?? [],
350
+ ...u.filter(({ option: m }) => m.recommended).map(({ option: m }) => m),
351
+ ...f.filter(({ count: m }) => m > 1).sort((m, oe) => oe.count - m.count).map(({ option: m }) => m)
352
+ ];
353
+ u.unshift(
354
+ ...H.map(
355
+ (m) => k({ ...m, group: C })
356
+ ),
357
+ ...f.map(
358
+ ({ option: m }) => k({ ...m, group: h })
359
+ )
360
+ );
361
+ }
362
+ const r = u.flatMap((f) => {
363
+ var le, se;
364
+ const { option: h, user: C, key: H } = f;
365
+ if (i.has(H) || h.prefix !== void 0 && h.prefix !== t.prefix)
366
+ return [];
367
+ const m = ge(h, C.name, n);
368
+ if (!(typeof l == "function" ? l(t.query, h, t.prefix) : l === !1 || l !== !0 && f.remote || m >= 0)) return [];
369
+ i.add(H);
370
+ const xe = ((le = e.groupBy) == null ? void 0 : le.call(e, h, t)) ?? h.group, re = C.disabled || ((se = e.canSelect) == null ? void 0 : se.call(e, h, t)) === !1;
371
+ return [
372
+ {
373
+ entry: {
374
+ ...f,
375
+ option: { ...h, group: xe },
376
+ user: re === C.disabled ? C : { ...C, disabled: re }
377
+ },
378
+ relevance: m
379
+ }
380
+ ];
381
+ }), s = e.sortOptions;
382
+ s && r.sort(
383
+ (f, h) => typeof s == "function" ? s(f.entry.option, h.entry.option, t) : h.relevance - f.relevance
384
+ );
385
+ const a = j(e.maxOptions, 8), v = r.slice(0, a || void 0).map(({ entry: f }) => f);
386
+ if (!T.value && ((o == null ? void 0 : o.allowCreate) ?? e.allowCreate) && n && !u.some(
387
+ ({ option: f }) => (!f.prefix || f.prefix === t.prefix) && R(String(f.value)) === n
388
+ )) {
389
+ const f = ((G = e.createOption) == null ? void 0 : G.call(e, t)) ?? {
390
+ value: t.query,
391
+ label: (((J = e.locale) == null ? void 0 : J.create) ?? "创建 {value}").replace(
392
+ "{value}",
393
+ t.query
394
+ )
395
+ };
396
+ if (f && ((ie = e.canSelect) == null ? void 0 : ie.call(e, f, t)) !== !1) {
397
+ const h = k(f);
398
+ i.has(h.key) || v.push({ ...h, created: !0 });
399
+ }
400
+ }
401
+ return v;
402
+ }), be = w(
403
+ () => ae.value.filter(({ user: t }) => !t.disabled)
404
+ );
405
+ return {
406
+ entries: te,
407
+ choices: ae,
408
+ enabled: be,
409
+ busy: Q,
410
+ loadingMore: D,
411
+ hasMore: X,
412
+ loadError: T,
413
+ retry: ye,
414
+ loadMore: me,
415
+ cancelLoad: B,
416
+ remember: he
417
+ };
418
+ }
419
+ export {
420
+ Pe as useMentionOptions
421
+ };
@@ -0,0 +1,52 @@
1
+ function m(s, v) {
2
+ let n;
3
+ const p = (e, t) => t ? e.clientY : e.clientX;
4
+ function w(e, t) {
5
+ var r;
6
+ if (n || e.button !== 0 || t.available <= 0) return !1;
7
+ e.preventDefault();
8
+ const i = e.currentTarget;
9
+ i.focus({ preventScroll: !0 }), n = {
10
+ ...t,
11
+ pointer: e.pointerId,
12
+ handle: i,
13
+ origin: p(e, t.vertical),
14
+ latest: t.initial,
15
+ reported: t.initial
16
+ };
17
+ try {
18
+ (r = i.setPointerCapture) == null || r.call(i, e.pointerId);
19
+ } catch {
20
+ }
21
+ return window.addEventListener("pointermove", c), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", a), window.addEventListener("keydown", d, !0), !0;
22
+ }
23
+ function c(e) {
24
+ const t = n;
25
+ if (!t || e.pointerId !== t.pointer) return;
26
+ const i = p(e, t.vertical) - t.origin;
27
+ t.latest = i === 0 ? t.initial : t.constrain(
28
+ t.initial + t.direction * i / t.available * 100
29
+ ), t.frame === void 0 && (t.frame = requestAnimationFrame(() => u(t)));
30
+ }
31
+ function u(e) {
32
+ e.frame = void 0, e.latest !== e.reported && (e.reported = e.latest, s(e.latest));
33
+ }
34
+ function l(e) {
35
+ e.pointerId === (n == null ? void 0 : n.pointer) && o(!1);
36
+ }
37
+ function a(e) {
38
+ e.pointerId === (n == null ? void 0 : n.pointer) && o(!0);
39
+ }
40
+ function d(e) {
41
+ e.key !== "Escape" || !n || (e.preventDefault(), e.stopPropagation(), o(!0));
42
+ }
43
+ function o(e, t = !0) {
44
+ var r, f;
45
+ const i = n;
46
+ i && (n = void 0, i.frame !== void 0 && cancelAnimationFrame(i.frame), window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", a), window.removeEventListener("keydown", d, !0), (f = (r = i.handle).hasPointerCapture) != null && f.call(r, i.pointer) && i.handle.releasePointerCapture(i.pointer), e || u(i), v(i.latest, e, t));
47
+ }
48
+ return { start: w, cancel: a, finish: o, active: () => !!n };
49
+ }
50
+ export {
51
+ m as useSplitPaneDrag
52
+ };
@@ -0,0 +1,38 @@
1
+ import { onMounted as a, watch as f } from "vue";
2
+ function l(r) {
3
+ if (!r || typeof r != "object" || Array.isArray(r)) return;
4
+ const n = Object.entries(r).filter((o) => {
5
+ const t = o[1];
6
+ return typeof t == "number" ? Number.isFinite(t) && t >= 0 : typeof t == "string" && /^(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?(?:px|%)$/i.test(t);
7
+ });
8
+ if (n.length) return Object.fromEntries(n);
9
+ }
10
+ function u(r, n, o) {
11
+ let t = !1;
12
+ const i = (e) => "hys-ui:split-pane:" + e;
13
+ function c(e) {
14
+ try {
15
+ n.value = o(JSON.parse(window.localStorage.getItem(i(e)) ?? "null"));
16
+ } catch {
17
+ n.value = void 0;
18
+ }
19
+ }
20
+ a(() => {
21
+ t = !0;
22
+ const e = r();
23
+ e && c(e);
24
+ }), f(r, (e) => {
25
+ t && e && c(e);
26
+ }, { flush: "sync" }), f(n, (e) => {
27
+ const s = r();
28
+ if (!(!t || !s))
29
+ try {
30
+ e === void 0 ? window.localStorage.removeItem(i(s)) : window.localStorage.setItem(i(s), JSON.stringify(e));
31
+ } catch {
32
+ }
33
+ });
34
+ }
35
+ export {
36
+ l as readStoredPaneSizes,
37
+ u as useSplitPaneStorage
38
+ };