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,90 +1,314 @@
1
- import { defineComponent as k, useModel as C, ref as V, watch as f, openBlock as B, createBlock as N, withCtx as i, createElementVNode as x, toDisplayString as u, createVNode as c, createTextVNode as m, mergeModels as M } from "vue";
2
- import b from "../HysModal/HysModal.vue.js";
3
- import v from "../HysButton/HysButton.vue.js";
4
- const w = /* @__PURE__ */ k({
1
+ import { defineComponent as ce, useModel as de, ref as W, computed as o, watch as O, openBlock as d, createBlock as D, createSlots as ve, withCtx as v, createElementBlock as C, renderSlot as y, normalizeProps as k, guardReactiveProps as g, createVNode as p, createCommentVNode as I, createElementVNode as j, createTextVNode as Y, toDisplayString as M, mergeProps as Z, resolveDynamicComponent as pe, unref as f, normalizeStyle as fe, mergeModels as _, nextTick as he } from "vue";
2
+ import { X as me } from "lucide-vue-next";
3
+ import H from "../HysButton/HysButton.vue.js";
4
+ import ye from "../HysModal/HysModal.vue.js";
5
+ import { useTourLayout as ke } from "../../composables/useTourLayout.js";
6
+ const ge = ["viewBox"], xe = ["width", "height"], we = ["d", "fill"], Te = ["id"], Be = { key: 0 }, be = {
7
+ key: 0,
8
+ class: "hys-ui-tour-cover"
9
+ }, Ce = { key: 1 }, Se = {
10
+ class: "hys-ui-tour-indicators",
11
+ "aria-live": "polite"
12
+ }, Ve = /* @__PURE__ */ ce({
5
13
  __name: "HysTour",
6
- props: /* @__PURE__ */ M({
7
- popupTransition: {},
8
- popupTransitionDuration: {},
14
+ props: /* @__PURE__ */ _({
9
15
  steps: {},
16
+ open: { type: Boolean, default: void 0 },
10
17
  current: {},
11
- closeOnEscape: { type: Boolean, default: !0 }
18
+ closeOnEscape: { type: Boolean, default: !0 },
19
+ appendTo: { type: [String, Boolean], default: "body" },
20
+ zIndex: {},
21
+ skipText: { default: "跳过" },
22
+ prevText: { default: "上一步" },
23
+ nextText: { default: "下一步" },
24
+ finishText: { default: "完成" },
25
+ popupTransition: {},
26
+ popupTransitionDuration: {},
27
+ placement: { default: "bottom" },
28
+ mask: { type: [Boolean, Object], default: !0 },
29
+ gap: {},
30
+ showArrow: { type: Boolean, default: void 0 },
31
+ arrow: { type: [Boolean, Object], default: void 0 },
32
+ type: { default: "default" },
33
+ contentStyle: {},
34
+ scrollIntoViewOptions: { type: Boolean, default: !0 },
35
+ targetAreaClickable: { type: Boolean, default: !0 },
36
+ showClose: { type: Boolean, default: !0 },
37
+ closeIcon: {},
38
+ prevButtonProps: {},
39
+ nextButtonProps: {}
12
40
  }, {
13
41
  modelValue: { type: Boolean, default: !1 },
14
42
  modelModifiers: {}
15
43
  }),
16
- emits: /* @__PURE__ */ M(["finish", "close", "change", "update:current"], ["update:modelValue"]),
17
- setup(t, { emit: T }) {
18
- const a = t, r = C(t, "modelValue"), s = T, e = V(l(a.current ?? 0));
19
- function l(n) {
20
- return Math.max(0, Math.min(Math.max(0, a.steps.length - 1), Number.isFinite(n) ? Math.floor(n) : 0));
44
+ emits: /* @__PURE__ */ _(["update:open", "update:current", "change", "finish", "close"], ["update:modelValue"]),
45
+ setup(i, { expose: ee, emit: te }) {
46
+ const a = i, F = de(i, "modelValue"), x = te, V = W(), S = o(() => a.open ?? F.value), u = W(h(a.current ?? 0));
47
+ let z;
48
+ const l = o(() => a.steps[u.value]), R = o(() => u.value >= a.steps.length - 1), s = o(() => {
49
+ var e, t;
50
+ return {
51
+ ...a,
52
+ ...l.value,
53
+ gap: { ...a.gap, ...(e = l.value) == null ? void 0 : e.gap },
54
+ contentStyle: { ...a.contentStyle, ...(t = l.value) == null ? void 0 : t.contentStyle }
55
+ };
56
+ }), { bounds: oe, view: $, card: w, arrow: q, path: L } = ke(
57
+ o(() => {
58
+ var e;
59
+ return ((e = V.value) == null ? void 0 : e.open) === !0;
60
+ }),
61
+ o(() => {
62
+ var e;
63
+ return (e = V.value) == null ? void 0 : e.element;
64
+ }),
65
+ s,
66
+ o(() => {
67
+ var e;
68
+ return (e = l.value) == null ? void 0 : e.target;
69
+ })
70
+ ), X = o(() => s.value.mask !== !1), G = o(() => !!oe.value && s.value.targetAreaClickable !== !1), J = o(() => {
71
+ const e = s.value.mask;
72
+ return typeof e == "object" ? e : void 0;
73
+ }), ae = {
74
+ background: "transparent",
75
+ backdropFilter: "none",
76
+ pointerEvents: "none"
77
+ }, le = o(() => {
78
+ var e, t;
79
+ return {
80
+ ...s.value.contentStyle,
81
+ pointerEvents: "auto",
82
+ ...w.value ? { position: "fixed", left: w.value.x + "px", top: w.value.y + "px" } : {},
83
+ "--hys-ui-tour-arrow-x": (((e = q.value) == null ? void 0 : e.x) ?? 0) + "px",
84
+ "--hys-ui-tour-arrow-y": (((t = q.value) == null ? void 0 : t.y) ?? 0) + "px"
85
+ };
86
+ }), ne = o(() => {
87
+ const e = s.value.showArrow ?? s.value.arrow !== !1;
88
+ if (!(!w.value || !e))
89
+ return w.value.placement;
90
+ }), se = o(() => {
91
+ var e;
92
+ return typeof ((e = l.value) == null ? void 0 : e.title) == "string" ? l.value.title : "引导";
93
+ }), ue = o(() => {
94
+ var e;
95
+ return ((e = l.value) == null ? void 0 : e.title) && typeof l.value.title != "string";
96
+ }), ie = o(() => a.popupTransition === "none" ? !1 : a.popupTransition === "slide-fade" ? "slide" : a.popupTransition), T = ({ value: e }) => typeof e == "function" ? e() : e;
97
+ function h(e) {
98
+ return Math.max(0, Math.min(a.steps.length - 1, Number.isFinite(e) ? Math.floor(e) : 0));
21
99
  }
22
- f(() => a.current, (n) => {
23
- n !== void 0 && (e.value = l(n));
24
- }), f(r, (n) => {
25
- n && (e.value = l(a.current ?? 0));
26
- }), f(() => a.steps.length, () => {
27
- e.value = l(e.value);
100
+ O(() => a.current, (e) => {
101
+ e !== void 0 && (u.value = h(e));
102
+ }), O(S, (e) => {
103
+ e && z === void 0 && (u.value = h(a.current ?? 0));
104
+ }, { flush: "sync" }), O(() => a.steps.length, () => {
105
+ u.value = h(u.value);
28
106
  });
29
- function h(n) {
30
- e.value = l(n), s("change", e.value), s("update:current", e.value);
107
+ function K(e) {
108
+ a.open !== void 0 ? x("update:open", e) : F.value = e;
109
+ }
110
+ function B(e) {
111
+ const t = h(e);
112
+ u.value !== t && (u.value = t, x("change", t), x("update:current", t));
113
+ }
114
+ function re(e = a.current ?? 0) {
115
+ const t = h(e);
116
+ S.value || (z = t, K(!0), he(() => {
117
+ z === t && (z = void 0);
118
+ })), B(t);
31
119
  }
32
- function d() {
33
- r.value = !1, s("close");
120
+ function b() {
121
+ var e, t;
122
+ S.value && (K(!1), (t = (e = l.value) == null ? void 0 : e.onClose) == null || t.call(e), x("close"));
34
123
  }
35
- function y() {
36
- e.value >= a.steps.length - 1 ? (s("finish"), d()) : h(e.value + 1);
124
+ function A() {
125
+ B(u.value - 1);
37
126
  }
38
- return (n, o) => {
39
- var g;
40
- return B(), N(b, {
41
- transition: t.popupTransition === "none" ? !1 : t.popupTransition === "slide-fade" ? "slide" : t.popupTransition,
42
- "transition-duration": t.popupTransitionDuration,
43
- open: r.value,
44
- title: ((g = t.steps[e.value]) == null ? void 0 : g.title) || "引导",
45
- "close-on-escape": t.closeOnEscape !== !1,
127
+ function E() {
128
+ if (!R.value) {
129
+ B(u.value + 1);
130
+ return;
131
+ }
132
+ x("finish"), b();
133
+ }
134
+ function Q(e) {
135
+ const { children: t, onClick: c, ...n } = e ?? {};
136
+ return { children: t, onClick: c, props: n };
137
+ }
138
+ const P = o(() => Q(s.value.prevButtonProps)), N = o(() => Q(s.value.nextButtonProps));
139
+ function U(e, t) {
140
+ var n;
141
+ const c = t === "previous" ? P.value : N.value;
142
+ (n = c.onClick) == null || n.call(c, e), e.defaultPrevented || (t === "previous" ? A : E)();
143
+ }
144
+ const m = o(() => ({
145
+ step: l.value,
146
+ current: u.value,
147
+ total: a.steps.length,
148
+ goTo: B,
149
+ previous: A,
150
+ next: E,
151
+ close: b
152
+ }));
153
+ return ee({ start: re, close: b, goTo: B, previous: A, next: E }), (e, t) => {
154
+ var c;
155
+ return d(), D(ye, {
156
+ ref_key: "modal",
157
+ ref: V,
158
+ open: S.value,
159
+ title: se.value,
160
+ modal: X.value && !G.value,
161
+ "modal-penetrable": "",
162
+ "close-on-escape": i.closeOnEscape,
46
163
  "close-on-mask": !1,
47
- onClose: d
48
- }, {
49
- footer: i(() => [
50
- x("span", null, u(t.steps.length ? e.value + 1 : 0) + " / " + u(t.steps.length), 1),
51
- c(v, {
52
- variant: "ghost",
53
- onClick: d
54
- }, {
55
- default: i(() => [...o[1] || (o[1] = [
56
- m("跳过", -1)
57
- ])]),
58
- _: 1
59
- }),
60
- c(v, {
61
- variant: "secondary",
62
- disabled: e.value === 0,
63
- onClick: o[0] || (o[0] = (p) => h(e.value - 1))
64
- }, {
65
- default: i(() => [...o[2] || (o[2] = [
66
- m("上一步", -1)
67
- ])]),
68
- _: 1
69
- }, 8, ["disabled"]),
70
- c(v, { onClick: y }, {
71
- default: i(() => [
72
- m(u(e.value >= t.steps.length - 1 ? "完成" : "下一步"), 1)
164
+ "show-close": s.value.showClose !== !1,
165
+ "append-to": i.appendTo,
166
+ "z-index": i.zIndex,
167
+ transition: ie.value,
168
+ "transition-duration": i.popupTransitionDuration,
169
+ overflow: "",
170
+ "keep-handle-visible": !1,
171
+ width: (c = l.value) != null && c.target ? "min(380px, calc(100vw - 24px))" : void 0,
172
+ "data-hys-tour-placement": ne.value,
173
+ "modal-class": "hys-ui-tour-card hys-ui-tour-card-" + (s.value.type ?? "default"),
174
+ "modal-style": le.value,
175
+ "mask-style": ae,
176
+ onClose: b
177
+ }, ve({
178
+ "close-icon": v(() => [
179
+ y(e.$slots, "close-icon", k(g(m.value)), () => [
180
+ typeof s.value.closeIcon == "string" ? (d(), C("span", Be, M(s.value.closeIcon), 1)) : (d(), D(pe(s.value.closeIcon ?? f(me)), {
181
+ key: 1,
182
+ size: 18
183
+ }))
184
+ ])
185
+ ]),
186
+ footer: v(() => [
187
+ y(e.$slots, "footer", k(g(m.value)), () => [
188
+ j("span", Se, [
189
+ y(e.$slots, "indicators", k(g(m.value)), () => [
190
+ Y(M(i.steps.length ? u.value + 1 : 0) + " / " + M(i.steps.length), 1)
191
+ ])
73
192
  ]),
74
- _: 1
75
- })
193
+ p(H, {
194
+ size: "sm",
195
+ variant: "ghost",
196
+ onClick: b
197
+ }, {
198
+ default: v(() => [
199
+ Y(M(i.skipText), 1)
200
+ ]),
201
+ _: 1
202
+ }),
203
+ p(H, Z({
204
+ size: "sm",
205
+ variant: "secondary"
206
+ }, P.value.props, {
207
+ disabled: u.value === 0 || P.value.props.disabled,
208
+ onClick: t[0] || (t[0] = (n) => U(n, "previous"))
209
+ }), {
210
+ default: v(() => [
211
+ p(T, {
212
+ value: P.value.children ?? i.prevText
213
+ }, null, 8, ["value"])
214
+ ]),
215
+ _: 1
216
+ }, 16, ["disabled"]),
217
+ p(H, Z({
218
+ size: "sm",
219
+ variant: s.value.type === "primary" ? "secondary" : "primary"
220
+ }, N.value.props, {
221
+ onClick: t[1] || (t[1] = (n) => U(n, "next"))
222
+ }), {
223
+ default: v(() => [
224
+ p(T, {
225
+ value: N.value.children ?? (R.value ? i.finishText : i.nextText)
226
+ }, null, 8, ["value"])
227
+ ]),
228
+ _: 1
229
+ }, 16, ["variant"])
230
+ ])
76
231
  ]),
77
- default: i(() => {
78
- var p;
232
+ default: v(() => {
233
+ var n;
79
234
  return [
80
- x("p", null, u(((p = t.steps[e.value]) == null ? void 0 : p.description) || "暂无引导步骤"), 1)
235
+ (n = l.value) != null && n.cover || e.$slots.cover ? (d(), C("div", be, [
236
+ y(e.$slots, "cover", k(g(m.value)), () => {
237
+ var r;
238
+ return [
239
+ p(T, {
240
+ value: (r = l.value) == null ? void 0 : r.cover
241
+ }, null, 8, ["value"])
242
+ ];
243
+ })
244
+ ])) : I("", !0),
245
+ y(e.$slots, "default", k(g(m.value)), () => {
246
+ var r;
247
+ return [
248
+ (r = l.value) != null && r.description ? (d(), D(T, {
249
+ key: 0,
250
+ value: l.value.description
251
+ }, null, 8, ["value"])) : l.value ? I("", !0) : (d(), C("span", Ce, "暂无引导步骤"))
252
+ ];
253
+ })
81
254
  ];
82
255
  }),
83
- _: 1
84
- }, 8, ["transition", "transition-duration", "open", "title", "close-on-escape"]);
256
+ _: 2
257
+ }, [
258
+ X.value ? {
259
+ name: "backdrop",
260
+ fn: v(() => {
261
+ var n, r;
262
+ return [
263
+ f(L) ? (d(), C("svg", {
264
+ key: 0,
265
+ class: "hys-ui-tour-mask",
266
+ viewBox: `0 0 ${f($).width} ${f($).height}`,
267
+ preserveAspectRatio: "none",
268
+ "aria-hidden": "true",
269
+ style: fe((n = J.value) == null ? void 0 : n.style)
270
+ }, [
271
+ G.value ? I("", !0) : (d(), C("rect", {
272
+ key: 0,
273
+ width: f($).width,
274
+ height: f($).height,
275
+ fill: "transparent",
276
+ class: "hys-ui-tour-mask-hit"
277
+ }, null, 8, xe)),
278
+ j("path", {
279
+ d: f(L),
280
+ "fill-rule": "evenodd",
281
+ fill: ((r = J.value) == null ? void 0 : r.color) ?? "rgba(11, 24, 61, 0.48)",
282
+ class: "hys-ui-tour-mask-hit"
283
+ }, null, 8, we)
284
+ ], 12, ge)) : I("", !0)
285
+ ];
286
+ }),
287
+ key: "0"
288
+ } : void 0,
289
+ ue.value || e.$slots.header ? {
290
+ name: "header",
291
+ fn: v(({ titleId: n }) => [
292
+ j("h2", {
293
+ id: n,
294
+ class: "hys-ui-tour-heading"
295
+ }, [
296
+ y(e.$slots, "header", k(g(m.value)), () => {
297
+ var r;
298
+ return [
299
+ p(T, {
300
+ value: (r = l.value) == null ? void 0 : r.title
301
+ }, null, 8, ["value"])
302
+ ];
303
+ })
304
+ ], 8, Te)
305
+ ]),
306
+ key: "1"
307
+ } : void 0
308
+ ]), 1032, ["open", "title", "modal", "close-on-escape", "show-close", "append-to", "z-index", "transition", "transition-duration", "width", "data-hys-tour-placement", "modal-class", "modal-style"]);
85
309
  };
86
310
  }
87
311
  });
88
312
  export {
89
- w as default
313
+ Ve as default
90
314
  };
@@ -0,0 +1,5 @@
1
+ import o from "./HysTour.vue.js";
2
+ /* empty css */
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,12 @@
1
+ function r(t) {
2
+ return t === "small" ? "sm" : t === "default" ? "md" : t === "large" ? "lg" : t || void 0;
3
+ }
4
+ function u(t) {
5
+ return t === "default" ? "secondary" : t === "button" || t === "submit" || t === "reset" ? void 0 : t || void 0;
6
+ }
7
+ const n = Symbol("hys-ui-button-group");
8
+ export {
9
+ n as buttonGroupKey,
10
+ r as buttonSize,
11
+ u as buttonVariant
12
+ };
@@ -0,0 +1,18 @@
1
+ function B(t, x, u, y, o, e, F) {
2
+ const { width: f, height: n } = u, m = Math.min(x.width, Math.max(0, f - 2 * e)), s = Math.min(x.height, Math.max(0, n - 2 * e)), [j, l] = y.split("-"), b = {
3
+ top: t.top - o,
4
+ bottom: n - t.bottom - o,
5
+ left: t.left - o,
6
+ right: f - t.right - o
7
+ }, k = { top: "bottom", bottom: "top", left: "right", right: "left" }, i = j, M = i === "top" || i === "bottom", c = k[i], h = F && b[i] < (M ? s : m) && b[c] > b[i] ? c : i, v = (p, r, w) => l === "start" ? p : l === "end" ? r - w : (p + r - w) / 2, q = M ? v(t.left, t.right, m) : h === "left" ? t.left - m - o : t.right + o, A = M ? h === "top" ? t.top - s - o : t.bottom + o : v(t.top, t.bottom, s);
8
+ return {
9
+ width: m,
10
+ height: s,
11
+ x: Math.max(e, Math.min(q, f - m - e)),
12
+ y: Math.max(e, Math.min(A, n - s - e)),
13
+ placement: l ? h + "-" + l : h
14
+ };
15
+ }
16
+ export {
17
+ B as positionFloating
18
+ };
@@ -0,0 +1,79 @@
1
+ function M(e) {
2
+ var s;
3
+ const i = typeof e.prefix == "string" ? [e.prefix] : e.prefix ?? ((s = e.triggers) != null && s.length ? [] : ["@"]), r = /* @__PURE__ */ new Map();
4
+ for (const n of i) n && r.set(n, { prefix: n });
5
+ for (const n of e.triggers ?? [])
6
+ n.prefix && r.set(n.prefix, n);
7
+ return [...r.values()].sort((n, t) => t.prefix.length - n.prefix.length);
8
+ }
9
+ function w(e, i, r, s) {
10
+ const n = Math.max(0, Math.min(e.length, Math.trunc(i) || 0)), t = e.slice(0, n);
11
+ let o;
12
+ for (const f of r) {
13
+ const { prefix: u } = f, a = f.match ?? s.matchTrigger, c = a == null ? void 0 : a({ text: e, caret: n, prefix: u });
14
+ if (a && !c) continue;
15
+ const l = (c == null ? void 0 : c.start) ?? t.lastIndexOf(u);
16
+ if (!Number.isInteger(l) || l < 0 || l + u.length > n || !t.startsWith(u, l) || o && l < o.start + o.prefix.length) continue;
17
+ const h = f.boundary ?? s.boundary;
18
+ if (typeof h == "function" && !h(e, l) || h === "word" && /[\p{L}\p{N}\p{M}_]$/u.test(t.slice(0, l)))
19
+ continue;
20
+ const p = (c == null ? void 0 : c.query) ?? t.slice(l + u.length), x = f.allowSpaces ?? s.allowSpaces, g = f.split ?? s.split;
21
+ !a && (/[\r\n]/.test(p) || !x && /\s/.test(p) || g && (!x || /\S/.test(g)) && p.includes(g) || r.some((m) => p.includes(m.prefix))) || (o = { prefix: u, query: p, start: l, end: n });
22
+ }
23
+ return o;
24
+ }
25
+ function d(e, i) {
26
+ const r = i.filter(
27
+ (t) => t && typeof t.text == "string" && t.text.length > 0 && (typeof t.id == "string" || typeof t.id == "number") && (typeof t.value == "string" || typeof t.value == "number") && typeof t.label == "string" && typeof t.type == "string" && typeof t.prefix == "string" && Number.isInteger(t.start) && Number.isInteger(t.end) && t.start >= 0 && t.end <= e.length && t.start < t.end && e.slice(t.start, t.end) === t.text
28
+ ).sort((t, o) => t.start - o.start || o.end - t.end), s = [];
29
+ let n = 0;
30
+ for (const t of r)
31
+ t.start < n || (s.push({ ...t }), n = t.end);
32
+ return s;
33
+ }
34
+ function S(e) {
35
+ return JSON.stringify({
36
+ text: e.text,
37
+ entities: d(e.text, e.entities)
38
+ });
39
+ }
40
+ function b(e) {
41
+ const i = JSON.parse(e);
42
+ if (!i || typeof i != "object" || !("text" in i) || typeof i.text != "string" || !("entities" in i) || !Array.isArray(i.entities))
43
+ throw new TypeError("Invalid Mention document");
44
+ return {
45
+ text: i.text,
46
+ entities: d(i.text, i.entities)
47
+ };
48
+ }
49
+ function v(e, i, r) {
50
+ if (!r && e.text === i) return e.entities;
51
+ let s = (r == null ? void 0 : r.start) ?? 0, n = (r == null ? void 0 : r.end) ?? e.text.length;
52
+ if (!r) {
53
+ const o = Math.min(e.text.length, i.length);
54
+ for (; s < o && e.text[s] === i[s]; ) s++;
55
+ let f = i.length;
56
+ for (; n > s && f > s && e.text[n - 1] === i[f - 1]; )
57
+ n--, f--;
58
+ }
59
+ const t = i.length - e.text.length;
60
+ return e.entities.flatMap((o) => o.end <= s ? [o] : o.start >= n ? [
61
+ { ...o, start: o.start + t, end: o.end + t }
62
+ ] : []);
63
+ }
64
+ function N(e, i) {
65
+ const r = [];
66
+ let s = 0;
67
+ for (const n of i)
68
+ s < n.start && r.push({ text: e.slice(s, n.start), start: s }), r.push({ text: n.text, start: n.start, entity: n }), s = n.end;
69
+ return (s < e.length || !r.length) && r.push({ text: e.slice(s), start: s }), r;
70
+ }
71
+ export {
72
+ b as deserializeMentionDocument,
73
+ w as matchMention,
74
+ N as mentionSegments,
75
+ M as mentionTriggers,
76
+ d as normalizeMentionEntities,
77
+ v as rebaseMentionEntities,
78
+ S as serializeMentionDocument
79
+ };
@@ -0,0 +1,58 @@
1
+ function p(t) {
2
+ return t.tagName === "INPUT" || t.tagName === "TEXTAREA";
3
+ }
4
+ function E(t, n) {
5
+ var d;
6
+ if (p(t))
7
+ return {
8
+ start: t.selectionStart ?? n,
9
+ end: t.selectionEnd ?? n
10
+ };
11
+ const r = (d = t.ownerDocument.defaultView) == null ? void 0 : d.getSelection();
12
+ if (!(r != null && r.rangeCount)) return { start: n, end: n };
13
+ const e = r.getRangeAt(0);
14
+ if (!t.contains(e.startContainer) || !t.contains(e.endContainer))
15
+ return { start: n, end: n };
16
+ const o = t.ownerDocument.createRange();
17
+ o.selectNodeContents(t), o.setEnd(e.startContainer, e.startOffset);
18
+ const s = o.toString().length;
19
+ return { start: s, end: s + e.toString().length };
20
+ }
21
+ function A(t, n) {
22
+ var u;
23
+ if (p(t)) {
24
+ t.setSelectionRange(n.start, n.end);
25
+ return;
26
+ }
27
+ const r = t.ownerDocument, e = (u = r.defaultView) == null ? void 0 : u.getSelection();
28
+ if (!e) return;
29
+ function o(R) {
30
+ var N, S;
31
+ const f = r.createTreeWalker(t, 4);
32
+ let c = R;
33
+ for (let i = f.nextNode(); i; i = f.nextNode()) {
34
+ const h = ((N = i.textContent) == null ? void 0 : N.length) ?? 0;
35
+ if (c <= h) {
36
+ const a = (S = i.parentElement) == null ? void 0 : S.closest(
37
+ "[data-mention-entity]"
38
+ );
39
+ if (a != null && a.parentNode) {
40
+ const C = Array.from(a.parentNode.childNodes).indexOf(
41
+ a
42
+ );
43
+ return [a.parentNode, C + (c > 0 ? 1 : 0)];
44
+ }
45
+ return [i, Math.max(0, c)];
46
+ }
47
+ c -= h;
48
+ }
49
+ return [t, t.childNodes.length];
50
+ }
51
+ const [s, d] = o(n.start), [w, x] = o(n.end), g = r.createRange();
52
+ g.setStart(s, d), g.setEnd(w, x), e.removeAllRanges(), e.addRange(g);
53
+ }
54
+ export {
55
+ p as isNativeMentionInput,
56
+ E as readMentionSelection,
57
+ A as writeMentionSelection
58
+ };
@@ -1,54 +1,60 @@
1
- import { toRaw as g } from "vue";
2
- function W(a) {
3
- let r = 0;
4
- const s = /* @__PURE__ */ new WeakMap();
5
- return (e) => {
6
- if (e && typeof e == "object") {
7
- const n = g(e), o = a().split(".").reduce(
8
- (l, i) => l && typeof l == "object" && Object.prototype.hasOwnProperty.call(l, i) ? l[i] : void 0,
9
- n
1
+ import { toRaw as S } from "vue";
2
+ function W(n) {
3
+ if (typeof n != "object" || typeof n.label != "string" || !Object.hasOwn(n, "value")) return !1;
4
+ const e = n.value;
5
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e !== null && typeof e == "object" && !Array.isArray(e);
6
+ }
7
+ function z(n) {
8
+ let e = 0;
9
+ const c = /* @__PURE__ */ new WeakMap();
10
+ return (t) => {
11
+ if (t && typeof t == "object") {
12
+ const l = S(t), r = n().split(".").reduce(
13
+ (s, a) => s && typeof s == "object" && Object.prototype.hasOwnProperty.call(s, a) ? s[a] : void 0,
14
+ l
10
15
  );
11
- return o != null && typeof o != "object" ? "object:" + typeof o + ":" + String(o) : (s.has(n) || s.set(n, ++r), "reference:" + s.get(n));
16
+ return r != null && typeof r != "object" ? "object:" + typeof r + ":" + String(r) : (c.has(l) || c.set(l, ++e), "reference:" + c.get(l));
12
17
  }
13
- return typeof e + ":" + String(e);
18
+ return typeof t + ":" + String(t);
14
19
  };
15
20
  }
16
- function z(a, r, s) {
17
- const e = [], n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new WeakSet();
18
- let l = 0;
19
- const i = r.label ?? "label", u = r.value ?? "value", K = r.options ?? "options", v = r.disabled ?? "disabled";
20
- function p(x, d, O = !1, b = "") {
21
- x.forEach((t, h) => {
22
- if (!t || typeof t != "object") return;
23
- const w = t[K], j = O || !!t[v], f = String(t[i] ?? t[u] ?? "");
21
+ function E(n, e, c) {
22
+ const t = [], l = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new WeakSet();
23
+ let s = 0;
24
+ const a = e.label ?? "label", p = e.value ?? "value", K = e.options ?? "options", O = e.disabled ?? "disabled";
25
+ function u(x, f, A = !1, d = "") {
26
+ x.forEach((o, j) => {
27
+ if (!o || typeof o != "object") return;
28
+ const w = o[K], h = A || !!o[O], y = String(o[a] ?? o[p] ?? "");
24
29
  if (Array.isArray(w)) {
25
- const k = g(t);
26
- if (o.has(k)) return;
27
- o.add(k);
28
- const S = d ? d + " / " + f : f;
29
- e.push({ key: "group:" + b + h, group: S, index: -1 }), p(w, S, j, b + h + ".");
30
+ const g = S(o);
31
+ if (r.has(g)) return;
32
+ r.add(g);
33
+ const k = f ? f + " / " + y : y;
34
+ t.push({ key: "group:" + d + j, group: k, index: -1 }), u(w, k, h, d + j + ".");
30
35
  return;
31
36
  }
32
- const c = t[u];
33
- if (c == null || !["string", "number", "boolean", "object"].includes(typeof c))
37
+ const i = o[p];
38
+ if (i == null || !["string", "number", "boolean", "object"].includes(typeof i))
34
39
  return;
35
- const y = s(c);
36
- n.has(y) || (n.add(y), e.push({
37
- key: y,
40
+ const b = c(i);
41
+ l.has(b) || (l.add(b), t.push({
42
+ key: b,
38
43
  option: {
39
- ...t,
40
- value: c,
41
- label: f,
42
- disabled: j
44
+ ...o,
45
+ value: i,
46
+ label: y,
47
+ disabled: h
43
48
  },
44
- group: d,
45
- index: l++
49
+ group: f,
50
+ index: s++
46
51
  }));
47
52
  });
48
53
  }
49
- return p(a), e;
54
+ return u(n), t;
50
55
  }
51
56
  export {
52
- z as normalizeSelectOptions,
53
- W as selectKeyFactory
57
+ W as isSelectLabeledValue,
58
+ E as normalizeSelectOptions,
59
+ z as selectKeyFactory
54
60
  };