hys-ui 0.3.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.
Files changed (93) hide show
  1. package/CHANGELOG.md +21 -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 +146 -2
  5. package/dist/components/HysButton/HysButton.vue.js +2 -2
  6. package/dist/components/HysButton/HysButton2.vue.js +227 -60
  7. package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
  8. package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
  9. package/dist/components/HysMention/HysMention.vue.js +1 -1
  10. package/dist/components/HysMention/HysMention2.vue.js +1092 -154
  11. package/dist/components/HysModal/HysModal.vue.js +3 -3
  12. package/dist/components/HysModal/HysModal2.vue.js +81 -80
  13. package/dist/components/HysPagination/HysPagination.vue.js +2 -2
  14. package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
  15. package/dist/components/HysSearch/HysSearch.vue.js +5 -82
  16. package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
  17. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  18. package/dist/components/HysSelect/HysSelect2.vue.js +472 -443
  19. package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
  20. package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
  21. package/dist/components/HysTable/HysTable.vue.js +2 -2
  22. package/dist/components/HysTable/HysTable2.vue.js +1418 -1150
  23. package/dist/components/HysTour/HysTour.vue.js +291 -67
  24. package/dist/components/HysTour/HysTour3.vue.js +5 -0
  25. package/dist/composables/buttonGroup.js +12 -0
  26. package/dist/composables/floatingPosition.js +18 -0
  27. package/dist/composables/mentionDocument.js +79 -0
  28. package/dist/composables/mentionEditor.js +58 -0
  29. package/dist/composables/selectOptions.js +44 -38
  30. package/dist/composables/splitPaneSizes.js +58 -0
  31. package/dist/composables/table.js +128 -105
  32. package/dist/composables/useDialog.js +50 -50
  33. package/dist/composables/useFloating.js +107 -103
  34. package/dist/composables/useMentionCaret.js +81 -0
  35. package/dist/composables/useMentionList.js +81 -0
  36. package/dist/composables/useMentionModel.js +90 -0
  37. package/dist/composables/useMentionOptions.js +421 -0
  38. package/dist/composables/useSplitPaneDrag.js +52 -0
  39. package/dist/composables/useSplitPaneStorage.js +38 -0
  40. package/dist/composables/useTable.js +344 -312
  41. package/dist/composables/useTableSticky.js +79 -0
  42. package/dist/composables/useTourLayout.js +129 -0
  43. package/dist/config.js +11 -11
  44. package/dist/index.js +175 -156
  45. package/dist/internal/MultiSplitPane.vue.js +305 -0
  46. package/dist/internal/MultiSplitPane2.vue.js +4 -0
  47. package/dist/style.css +1 -1
  48. package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +61 -7
  49. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +1 -1
  50. package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
  51. package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
  52. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
  53. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +2 -2
  54. package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +2 -2
  55. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +2 -2
  56. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +1 -1
  57. package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -40
  58. package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
  59. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
  60. package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
  61. package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
  62. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +45 -7
  63. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +6 -1
  64. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
  65. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
  66. package/dist/types/components/HysTable/HysTable.vue.d.ts +1740 -3
  67. package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -9
  68. package/dist/types/composables/buttonGroup.d.ts +9 -0
  69. package/dist/types/composables/floatingPosition.d.ts +14 -0
  70. package/dist/types/composables/mention.d.ts +284 -0
  71. package/dist/types/composables/mentionDocument.d.ts +15 -0
  72. package/dist/types/composables/mentionEditor.d.ts +7 -0
  73. package/dist/types/composables/modal.d.ts +2 -0
  74. package/dist/types/composables/selectOptions.d.ts +5 -0
  75. package/dist/types/composables/splitPaneSizes.d.ts +11 -0
  76. package/dist/types/composables/table.d.ts +116 -6
  77. package/dist/types/composables/tour.d.ts +68 -0
  78. package/dist/types/composables/useFloating.d.ts +1 -1
  79. package/dist/types/composables/useMentionCaret.d.ts +6 -0
  80. package/dist/types/composables/useMentionList.d.ts +23 -0
  81. package/dist/types/composables/useMentionModel.d.ts +14 -0
  82. package/dist/types/composables/useMentionOptions.d.ts +26 -0
  83. package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
  84. package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
  85. package/dist/types/composables/useTable.d.ts +7 -3
  86. package/dist/types/composables/useTableSticky.d.ts +22 -0
  87. package/dist/types/composables/useTourLayout.d.ts +33 -0
  88. package/dist/types/config.d.ts +1 -0
  89. package/dist/types/index.d.ts +36 -1
  90. package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
  91. package/package.json +3 -2
  92. package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
  93. package/dist/components/HysTour/HysTour2.vue.js +0 -4
@@ -1,50 +1,54 @@
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({
1
+ import { inject as T, ref as E, shallowRef as Y, watch as D, onDeactivated as U, onBeforeUnmount as V, computed as X, nextTick as G } from "vue";
2
+ import { useHysControlState as J } from "./formContext.js";
3
+ import { popupSize as Q } from "../motion/popup.js";
4
+ import { positionFloating as Z } from "./floatingPosition.js";
5
+ import { overlayOwnerKey as _, registerOverlay as ee } from "./overlayManager.js";
6
+ function re(v, n, e = {}) {
7
+ const { disabled: k } = J({}), m = T(_, void 0), c = E(!1), W = Y(), p = E(!1), L = E({
7
8
  position: "fixed",
8
9
  top: "0px",
9
10
  left: "0px",
10
11
  visibility: "hidden"
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) {
18
- s();
12
+ });
13
+ function A() {
14
+ return typeof e.placement == "function" ? e.placement() : e.placement ?? "bottom-start";
15
+ }
16
+ const C = E(A());
17
+ let $ = 0, w, r, y = 0;
18
+ function F() {
19
+ var R, S, H;
20
+ if (!c.value || !v.value || !n.value) return;
21
+ const t = v.value.getBoundingClientRect();
22
+ if (!t.width && !t.height) {
23
+ u();
19
24
  return;
20
25
  }
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;
26
+ const a = Number.isFinite(e.gap) ? e.gap : 8, i = Number.isFinite(e.padding) ? Math.max(0, e.padding) : 10, l = document.documentElement.clientWidth, o = document.documentElement.clientHeight, d = Math.min(t.width, Math.max(0, l - 2 * i)), g = typeof e.matchWidth == "function" ? e.matchWidth() : e.matchWidth, h = (R = e.maxWidth) == null ? void 0 : R.call(e), P = h !== void 0 && (typeof h != "number" || Number.isFinite(h)) ? `min(${typeof h == "number" ? Math.max(0, h) + "px" : h},calc(100vw - ${i * 2}px))` : `calc(100vw - ${i * 2}px)`, b = (S = e.width) == null ? void 0 : S.call(e), x = typeof b == "number" ? Number.isFinite(b) ? Math.max(0, b) + "px" : void 0 : b;
27
+ x !== void 0 ? (n.value.style.width = x, n.value.style.minWidth = "0", n.value.style.maxWidth = P) : g === !0 && (n.value.style.width = `${d}px`, n.value.style.minWidth = "0", n.value.style.maxWidth = `${d}px`), x === void 0 && g === "min" && (n.value.style.width = "max-content", n.value.style.minWidth = `${d}px`, n.value.style.maxWidth = `calc(100vw - ${i * 2}px)`);
28
+ const z = Z(
29
+ t,
30
+ Q(n.value),
31
+ { width: l, height: o },
32
+ A(),
33
+ a,
34
+ i,
35
+ e.autoAdjustOverflow !== !1
36
+ );
37
+ let { x: O, y: M } = z;
38
+ if (C.value = z.placement, (H = e.onPosition) == null || H.call(e, { anchor: t, ...z }), e.strategy === "absolute") {
39
+ n.value.style.position = "absolute";
40
+ const f = n.value.offsetParent;
41
+ if (f && f !== document.body && f !== document.documentElement) {
42
+ const j = f.getBoundingClientRect();
43
+ O += f.scrollLeft - j.left - f.clientLeft, M += f.scrollTop - j.top - f.clientTop;
40
44
  } else
41
- w += window.scrollX, x += window.scrollY;
45
+ O += window.scrollX, M += window.scrollY;
42
46
  }
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`,
47
+ L.value = {
48
+ ...x !== void 0 ? { width: x, minWidth: "0" } : g === !0 ? { width: `${d}px`, minWidth: "0" } : g === "min" ? { width: "max-content", minWidth: `${d}px` } : {},
49
+ position: e.strategy ?? "fixed",
50
+ left: `${Math.round(O)}px`,
51
+ top: `${Math.round(M)}px`,
48
52
  visibility: "visible",
49
53
  zIndex: "1200",
50
54
  maxWidth: P,
@@ -53,110 +57,110 @@ function de(g, r, t = {}) {
53
57
  overscrollBehavior: "contain"
54
58
  };
55
59
  }
56
- function c() {
57
- cancelAnimationFrame(A), A = requestAnimationFrame(C);
60
+ function s() {
61
+ cancelAnimationFrame($), $ = requestAnimationFrame(F);
58
62
  }
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();
63
+ function I(t) {
64
+ var a, i;
65
+ !(r != null && r()) || e.closeOnOutside === !1 || !((a = v.value) != null && a.contains(t.target)) && !((i = n.value) != null && i.contains(t.target)) && u();
62
66
  }
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) {
67
+ function q(t) {
68
+ var a, i;
69
+ if (!(!c.value || !(r != null && r()))) {
70
+ if (t.key === "Escape" && e.closeOnEscape !== !1)
71
+ t.preventDefault(), t.stopImmediatePropagation(), u(!0);
72
+ else if (t.key === "Tab" && e.closeOnTab !== !1) {
69
73
  const l = document.activeElement;
70
- if ((n = g.value) != null && n.contains(l)) {
71
- s();
74
+ if ((a = v.value) != null && a.contains(l)) {
75
+ u();
72
76
  return;
73
77
  }
74
- if ((i = r.value) != null && i.contains(l)) {
75
- const f = Array.from(
76
- r.value.querySelectorAll(
78
+ if ((i = n.value) != null && i.contains(l)) {
79
+ const o = Array.from(
80
+ n.value.querySelectorAll(
77
81
  'a[href],button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[tabindex]:not([tabindex="-1"])'
78
82
  )
79
83
  ).filter(
80
84
  (d) => d.getClientRects().length && !d.closest("[inert]")
81
85
  );
82
- (!f.length || l === (e.shiftKey ? f[0] : f.at(-1))) && s(!0);
86
+ (!o.length || l === (t.shiftKey ? o[0] : o.at(-1))) && u(!0);
83
87
  }
84
88
  }
85
89
  }
86
90
  }
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;
91
+ function B() {
92
+ var t, a;
93
+ document.removeEventListener("pointerdown", I, !0), document.removeEventListener("keydown", q, !0), window.removeEventListener("resize", s), window.removeEventListener("scroll", s, !0), (t = window.visualViewport) == null || t.removeEventListener("resize", s), (a = window.visualViewport) == null || a.removeEventListener("scroll", s), cancelAnimationFrame($), w == null || w(), w = void 0, W.value = void 0, r = void 0;
90
94
  }
91
- function s(e = !1, n = !1) {
95
+ function u(t = !1, a = !1) {
92
96
  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;
97
+ if (!(!a && c.value && ((i = e.requestOpen) == null ? void 0 : i.call(e, !1, t)) === !1) && (y++, !!c.value && (c.value = !1, B(), t && ((l = v.value) != null && l.isConnected)))) {
98
+ p.value = !0;
95
99
  try {
96
- g.value.focus();
100
+ v.value.focus();
97
101
  } finally {
98
- O.value = !1;
102
+ p.value = !1;
99
103
  }
100
104
  }
101
105
  }
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) {
106
- c();
106
+ async function N(t = !1) {
107
+ var l, o, d;
108
+ if (k.value || (m == null ? void 0 : m.value) === !1) return;
109
+ if (c.value) {
110
+ s();
107
111
  return;
108
112
  }
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 = {
113
+ if (!t && ((l = e.requestOpen) == null ? void 0 : l.call(e, !0)) === !1) return;
114
+ const a = ++y;
115
+ if (c.value = !0, L.value = {
112
116
  position: "fixed",
113
117
  top: "0px",
114
118
  left: "0px",
115
119
  visibility: "hidden"
116
- }, await ee(), n !== E || !o.value) return;
117
- const i = ne(
120
+ }, await G(), a !== y || !c.value) return;
121
+ const i = ee(
118
122
  "floating",
119
- () => s(!0),
120
- t.zIndex
123
+ () => u(!0),
124
+ e.zIndex
121
125
  );
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);
126
+ W.value = i, w = i.unregister, r = i.isTop, F(), document.addEventListener("pointerdown", I, !0), document.addEventListener("keydown", q, !0), window.addEventListener("resize", s), window.addEventListener("scroll", s, !0), (o = window.visualViewport) == null || o.addEventListener("resize", s), (d = window.visualViewport) == null || d.addEventListener("scroll", s);
123
127
  }
124
- function X() {
125
- return o.value ? s() : H();
128
+ function K() {
129
+ return c.value ? u() : N();
126
130
  }
127
- return V(
128
- B,
129
- (e) => {
130
- e && s(!1, !0);
131
+ return D(
132
+ k,
133
+ (t) => {
134
+ t && u(!1, !0);
131
135
  },
132
136
  { flush: "sync" }
133
- ), Q(() => s(!1, !0)), V(
134
- () => y == null ? void 0 : y.value,
135
- (e) => {
136
- e === !1 && s(!1, !0);
137
+ ), U(() => u(!1, !0)), D(
138
+ () => m == null ? void 0 : m.value,
139
+ (t) => {
140
+ t === !1 && u(!1, !0);
137
141
  },
138
142
  { flush: "sync" }
139
- ), Z(() => {
140
- E++, j();
143
+ ), V(() => {
144
+ y++, B();
141
145
  }), {
142
- open: o,
143
- style: _(() => {
144
- var e;
146
+ open: c,
147
+ style: X(() => {
148
+ var t;
145
149
  return {
146
- ...k.value,
147
- zIndex: String(((e = F.value) == null ? void 0 : e.zIndex.value) ?? 1200)
150
+ ...L.value,
151
+ zIndex: String(((t = W.value) == null ? void 0 : t.zIndex.value) ?? 1200)
148
152
  };
149
153
  }),
150
- placement: N,
151
- update: C,
152
- show: H,
153
- close: s,
154
- toggle: X,
155
- restoringFocus: O,
156
- schedule: c,
157
- isTop: () => (u == null ? void 0 : u()) ?? !1
154
+ placement: C,
155
+ update: F,
156
+ show: N,
157
+ close: u,
158
+ toggle: K,
159
+ restoringFocus: p,
160
+ schedule: s,
161
+ isTop: () => (r == null ? void 0 : r()) ?? !1
158
162
  };
159
163
  }
160
164
  export {
161
- de as useFloating
165
+ re as useFloating
162
166
  };
@@ -0,0 +1,81 @@
1
+ import { computed as x, onBeforeUnmount as y, onDeactivated as C } from "vue";
2
+ function L(r, a, p) {
3
+ let e;
4
+ function d() {
5
+ e == null || e.remove(), e = void 0;
6
+ }
7
+ function f() {
8
+ const t = r.value, o = t.getBoundingClientRect();
9
+ if (!o.width && !o.height) return o;
10
+ const n = getComputedStyle(t);
11
+ e || (e = document.createElement("div"), e.setAttribute("aria-hidden", "true"), document.body.append(e));
12
+ for (const l of [
13
+ "direction",
14
+ "font",
15
+ "font-family",
16
+ "font-size",
17
+ "font-weight",
18
+ "font-style",
19
+ "font-variant",
20
+ "letter-spacing",
21
+ "word-spacing",
22
+ "text-transform",
23
+ "text-indent",
24
+ "text-align",
25
+ "line-height",
26
+ "padding-top",
27
+ "padding-right",
28
+ "padding-bottom",
29
+ "padding-left",
30
+ "border-top-width",
31
+ "border-right-width",
32
+ "border-bottom-width",
33
+ "border-left-width",
34
+ "border-style",
35
+ "box-sizing",
36
+ "tab-size"
37
+ ])
38
+ e.style.setProperty(l, n.getPropertyValue(l));
39
+ const s = parseFloat(n.borderLeftWidth) || 0, g = parseFloat(n.borderRightWidth) || 0, u = parseFloat(n.borderTopWidth) || 0, b = t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement && t.wrap === "off";
40
+ Object.assign(e.style, {
41
+ position: "fixed",
42
+ top: "0px",
43
+ left: "-10000px",
44
+ visibility: "hidden",
45
+ pointerEvents: "none",
46
+ height: "auto",
47
+ overflow: "hidden",
48
+ whiteSpace: b ? "pre" : "pre-wrap",
49
+ overflowWrap: "break-word",
50
+ wordBreak: n.wordBreak,
51
+ width: (t.clientWidth ? t.clientWidth + s + g : o.width) + "px"
52
+ });
53
+ const c = p();
54
+ e.textContent = a.value.slice(0, c);
55
+ const i = document.createElement("span");
56
+ i.textContent = a.value.slice(c) || "​", e.append(i);
57
+ const w = parseFloat(n.lineHeight) || (parseFloat(n.fontSize) || 14) * 1.6, m = o.left + i.offsetLeft + s - t.scrollLeft, v = o.top + i.offsetTop + u - t.scrollTop;
58
+ return new window.DOMRect(m, v, 1, w);
59
+ }
60
+ const h = x(
61
+ () => r.value ? {
62
+ getBoundingClientRect: f,
63
+ contains: (t) => {
64
+ var o;
65
+ return !!((o = r.value) != null && o.contains(t));
66
+ },
67
+ focus: () => {
68
+ var t;
69
+ return (t = r.value) == null ? void 0 : t.focus();
70
+ },
71
+ get isConnected() {
72
+ var t;
73
+ return !!((t = r.value) != null && t.isConnected);
74
+ }
75
+ } : void 0
76
+ );
77
+ return y(d), C(d), { anchor: h, removeMirror: d };
78
+ }
79
+ export {
80
+ L as useMentionCaret
81
+ };
@@ -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
+ };