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.
- package/CHANGELOG.md +27 -0
- package/README.md +68 -73
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +467 -2
- package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.js +7 -0
- package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas2.vue.js +166 -0
- package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.js +7 -0
- package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits2.vue.js +105 -0
- package/dist/components/HysAnimatedNumber/animation/digital.js +186 -0
- package/dist/components/HysAnimatedNumber/animation/morph.js +110 -0
- package/dist/components/HysAnimatedNumber/animation/paint.js +34 -0
- package/dist/components/HysAnimatedNumber/animation/particles.js +51 -0
- package/dist/components/HysAnimatedNumber/animation/paths.js +165 -0
- package/dist/components/HysAnimatedNumber/animation/physics.js +66 -0
- package/dist/components/HysAnimatedNumber/animation/render.js +89 -0
- package/dist/components/HysAnimatedNumber/animation/reveal.js +125 -0
- package/dist/components/HysAnimatedNumber/animation/rolling.js +66 -0
- package/dist/components/HysAnimatedNumber/animation/scenarios.js +217 -0
- package/dist/components/HysAnimatedNumber/animation/spatial.js +112 -0
- package/dist/components/HysAnimatedNumber/useNumberCountdown.js +58 -0
- package/dist/components/HysAnimatedNumber/useNumberVisuals.js +60 -0
- package/dist/components/HysButton/HysButton.vue.js +2 -2
- package/dist/components/HysButton/HysButton2.vue.js +227 -60
- package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
- package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
- package/dist/components/HysFormItem/HysFormItem.vue.js +1 -1
- package/dist/components/HysFormItem/HysFormItem2.vue.js +231 -229
- package/dist/components/HysInput/HysInput.vue.js +2 -2
- package/dist/components/HysInput/HysInput2.vue.js +327 -274
- package/dist/components/HysMention/HysMention.vue.js +1 -1
- package/dist/components/HysMention/HysMention2.vue.js +1092 -154
- package/dist/components/HysModal/HysModal.vue.js +3 -3
- package/dist/components/HysModal/HysModal2.vue.js +81 -80
- package/dist/components/HysPagination/HysPagination.vue.js +2 -2
- package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
- package/dist/components/HysSearch/HysSearch.vue.js +5 -82
- package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
- package/dist/components/HysSelect/HysSelect.vue.js +2 -2
- package/dist/components/HysSelect/HysSelect2.vue.js +472 -443
- package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
- package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
- package/dist/components/HysTable/HysTable.vue.js +2 -2
- package/dist/components/HysTable/HysTable2.vue.js +1418 -1150
- package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
- package/dist/components/HysTour/HysTour.vue.js +291 -67
- package/dist/components/HysTour/HysTour3.vue.js +5 -0
- package/dist/composables/animatedNumberDigits.js +106 -0
- package/dist/composables/animatedNumberFormat.js +222 -0
- package/dist/composables/animatedNumberTiming.js +66 -0
- package/dist/composables/buttonGroup.js +12 -0
- package/dist/composables/floatingPosition.js +18 -0
- package/dist/composables/mentionDocument.js +79 -0
- package/dist/composables/mentionEditor.js +58 -0
- package/dist/composables/numberAnimation.js +72 -0
- package/dist/composables/numberAnimationCatalog.js +301 -0
- package/dist/composables/numberAnimationSequence.js +45 -0
- package/dist/composables/selectOptions.js +44 -38
- package/dist/composables/splitPaneSizes.js +58 -0
- package/dist/composables/table.js +128 -105
- package/dist/composables/textInput.js +23 -14
- package/dist/composables/useDialog.js +50 -50
- package/dist/composables/useFloating.js +107 -103
- package/dist/composables/useHysAnimatedNumber.js +264 -0
- package/dist/composables/useHysNumberAnimationGroup.js +23 -0
- package/dist/composables/useMentionCaret.js +81 -0
- package/dist/composables/useMentionList.js +81 -0
- package/dist/composables/useMentionModel.js +90 -0
- package/dist/composables/useMentionOptions.js +421 -0
- package/dist/composables/useSplitPaneDrag.js +52 -0
- package/dist/composables/useSplitPaneStorage.js +38 -0
- package/dist/composables/useTable.js +344 -312
- package/dist/composables/useTableSticky.js +79 -0
- package/dist/composables/useTextareaSize.js +62 -46
- package/dist/composables/useTourLayout.js +129 -0
- package/dist/config.js +11 -11
- package/dist/index.js +183 -152
- package/dist/internal/MultiSplitPane.vue.js +305 -0
- package/dist/internal/MultiSplitPane2.vue.js +4 -0
- package/dist/style.css +1 -1
- package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +99 -6
- package/dist/types/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.d.ts +19 -0
- package/dist/types/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.d.ts +31 -0
- package/dist/types/components/HysAnimatedNumber/animation/digital.d.ts +3 -0
- package/dist/types/components/HysAnimatedNumber/animation/morph.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/paint.d.ts +44 -0
- package/dist/types/components/HysAnimatedNumber/animation/particles.d.ts +5 -0
- package/dist/types/components/HysAnimatedNumber/animation/paths.d.ts +12 -0
- package/dist/types/components/HysAnimatedNumber/animation/physics.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/render.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/reveal.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/rolling.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/scenarios.d.ts +4 -0
- package/dist/types/components/HysAnimatedNumber/animation/spatial.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/useNumberCountdown.d.ts +8 -0
- package/dist/types/components/HysAnimatedNumber/useNumberVisuals.d.ts +12 -0
- package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +12 -3
- package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
- package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
- package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
- package/dist/types/components/HysCard/HysCard.vue.d.ts +1 -1
- package/dist/types/components/HysCascader/HysCascader.vue.d.ts +3 -3
- package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +3 -3
- package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +3 -3
- package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +2 -2
- package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +3 -3
- package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +6 -6
- package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +2 -2
- package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
- package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
- package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -40
- package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
- package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
- package/dist/types/components/HysPopover/HysPopover.vue.d.ts +1 -1
- package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
- package/dist/types/components/HysSearch/HysSearch.vue.d.ts +46 -8
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +6 -1
- package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
- package/dist/types/components/HysTable/HysTable.vue.d.ts +1740 -3
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +1 -1
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +1 -1
- package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +13 -2
- package/dist/types/components/HysToast/HysToast.vue.d.ts +1 -1
- package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
- package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -9
- package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +3 -3
- package/dist/types/components/HysUpload/HysUpload.vue.d.ts +2 -2
- package/dist/types/composables/animatedNumber.d.ts +220 -0
- package/dist/types/composables/animatedNumberDigits.d.ts +32 -0
- package/dist/types/composables/animatedNumberFormat.d.ts +16 -0
- package/dist/types/composables/animatedNumberTiming.d.ts +21 -0
- package/dist/types/composables/buttonGroup.d.ts +9 -0
- package/dist/types/composables/drawer.d.ts +1 -1
- package/dist/types/composables/floatingPosition.d.ts +14 -0
- package/dist/types/composables/mention.d.ts +284 -0
- package/dist/types/composables/mentionDocument.d.ts +15 -0
- package/dist/types/composables/mentionEditor.d.ts +7 -0
- package/dist/types/composables/modal.d.ts +2 -0
- package/dist/types/composables/numberAnimation.d.ts +29 -0
- package/dist/types/composables/numberAnimationCatalog.d.ts +58 -0
- package/dist/types/composables/numberAnimationSequence.d.ts +13 -0
- package/dist/types/composables/selectOptions.d.ts +5 -0
- package/dist/types/composables/splitPaneSizes.d.ts +11 -0
- package/dist/types/composables/table.d.ts +116 -6
- package/dist/types/composables/textInput.d.ts +39 -4
- package/dist/types/composables/tour.d.ts +68 -0
- package/dist/types/composables/useFloating.d.ts +1 -1
- package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
- package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
- package/dist/types/composables/useMentionCaret.d.ts +6 -0
- package/dist/types/composables/useMentionList.d.ts +23 -0
- package/dist/types/composables/useMentionModel.d.ts +14 -0
- package/dist/types/composables/useMentionOptions.d.ts +26 -0
- package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
- package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
- package/dist/types/composables/useTable.d.ts +7 -3
- package/dist/types/composables/useTableSticky.d.ts +22 -0
- package/dist/types/composables/useTextareaSize.d.ts +5 -2
- package/dist/types/composables/useTourLayout.d.ts +33 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/index.d.ts +46 -1
- package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
- package/package.json +3 -2
- package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
- package/dist/components/HysTour/HysTour2.vue.js +0 -4
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { decimal as l, decimalAdd as $, decimalCompare as I, decimalText as D, decimalRound as nn } from "./numberInput.js";
|
|
2
|
+
const tn = { units: 0n, scale: 0 }, v = (n) => 10n ** BigInt(n), b = (n) => ({
|
|
3
|
+
units: n.units < 0n ? -n.units : n.units,
|
|
4
|
+
scale: n.scale
|
|
5
|
+
});
|
|
6
|
+
function un(n) {
|
|
7
|
+
return n === void 0 || typeof n == "number" && !Number.isFinite(n) ? 0 : n;
|
|
8
|
+
}
|
|
9
|
+
function A(n, i, t, e) {
|
|
10
|
+
return Math.min(
|
|
11
|
+
e,
|
|
12
|
+
Math.max(t, Number.isFinite(n) ? n : i)
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
function an(n, i) {
|
|
16
|
+
const t = l(n), e = l(i);
|
|
17
|
+
if (!t || !e) return "none";
|
|
18
|
+
const s = I(e, t);
|
|
19
|
+
return s > 0 ? "up" : s < 0 ? "down" : "none";
|
|
20
|
+
}
|
|
21
|
+
function en(n, i) {
|
|
22
|
+
const t = l(n), e = l(i);
|
|
23
|
+
if (!t || !e) return () => n;
|
|
24
|
+
const s = Math.min(1e3, Math.max(t.scale, e.scale) + 9), r = t.units * v(s - t.scale), u = e.units * v(s - e.scale) - r, m = typeof n == "string" || typeof i == "string";
|
|
25
|
+
return (x) => {
|
|
26
|
+
const S = r + u * BigInt(Math.round(x * 1e9)) / 1000000000n, M = D({ units: S, scale: s });
|
|
27
|
+
if (m) return M;
|
|
28
|
+
const p = Number(M);
|
|
29
|
+
return Number.isFinite(p) ? p : M;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function ln(n, i, t) {
|
|
33
|
+
const e = en(n, i);
|
|
34
|
+
return t ? (s, r) => {
|
|
35
|
+
const u = e(r);
|
|
36
|
+
try {
|
|
37
|
+
const m = t({ from: n, to: i, progress: s, easedProgress: r, defaultValue: u });
|
|
38
|
+
return l(m) ? m : u;
|
|
39
|
+
} catch {
|
|
40
|
+
return u;
|
|
41
|
+
}
|
|
42
|
+
} : (s, r) => e(r);
|
|
43
|
+
}
|
|
44
|
+
function V(n, i, t) {
|
|
45
|
+
const e = n / i, s = n % i;
|
|
46
|
+
if (!s || t === "trunc") return e;
|
|
47
|
+
const r = n < 0n ? -1n : 1n;
|
|
48
|
+
if (t === "floor") return r < 0n ? e - 1n : e;
|
|
49
|
+
if (t === "ceil") return r > 0n ? e + 1n : e;
|
|
50
|
+
const u = s * r * 2n;
|
|
51
|
+
return u > i || u === i && (t === "half-up" || e % 2n !== 0n) ? e + r : e;
|
|
52
|
+
}
|
|
53
|
+
function Y(n, i, t, e) {
|
|
54
|
+
const s = t + i.scale - n.scale;
|
|
55
|
+
return {
|
|
56
|
+
scale: t,
|
|
57
|
+
units: V(
|
|
58
|
+
n.units * v(Math.max(0, s)),
|
|
59
|
+
i.units * v(Math.max(0, -s)),
|
|
60
|
+
e
|
|
61
|
+
)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function G(n, i, t) {
|
|
65
|
+
return n.scale <= i ? n : t === "half-up" ? nn(n, i) : {
|
|
66
|
+
scale: i,
|
|
67
|
+
units: V(n.units, v(n.scale - i), t)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function mn(n, i, t) {
|
|
71
|
+
const e = l(n), s = l(i);
|
|
72
|
+
if (!e || !s)
|
|
73
|
+
return {
|
|
74
|
+
previous: n,
|
|
75
|
+
target: i,
|
|
76
|
+
direction: "none",
|
|
77
|
+
delta: null,
|
|
78
|
+
percent: null,
|
|
79
|
+
significant: !1
|
|
80
|
+
};
|
|
81
|
+
const r = $(s, e, -1), u = r.units > 0n ? "up" : r.units < 0n ? "down" : "none", m = l(t);
|
|
82
|
+
return {
|
|
83
|
+
previous: n,
|
|
84
|
+
target: i,
|
|
85
|
+
direction: u,
|
|
86
|
+
delta: D(r),
|
|
87
|
+
percent: e.units === 0n ? null : D(
|
|
88
|
+
Y(
|
|
89
|
+
{ ...r, units: r.units * 100n },
|
|
90
|
+
b(e),
|
|
91
|
+
6,
|
|
92
|
+
"half-up"
|
|
93
|
+
)
|
|
94
|
+
),
|
|
95
|
+
significant: u !== "none" && !!m && m.units >= 0n && I(b(r), m) >= 0
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const rn = [
|
|
99
|
+
{ threshold: "1e3", label: "K" },
|
|
100
|
+
{ threshold: "1e6", label: "M" },
|
|
101
|
+
{ threshold: "1e9", label: "B" },
|
|
102
|
+
{ threshold: "1e12", label: "T" }
|
|
103
|
+
], sn = [
|
|
104
|
+
{ threshold: "1e4", label: "万" },
|
|
105
|
+
{ threshold: "1e8", label: "亿" },
|
|
106
|
+
{ threshold: "1e12", label: "万亿" }
|
|
107
|
+
];
|
|
108
|
+
function cn(n) {
|
|
109
|
+
return (n === "short" ? rn : n === "zh" ? sn : n ?? []).flatMap(({ threshold: t, divisor: e, label: s }) => {
|
|
110
|
+
const r = l(t), u = l(e ?? t);
|
|
111
|
+
return r && r.units > 0n && u && u.units > 0n ? [{ minimum: r, factor: u, label: s }] : [];
|
|
112
|
+
}).sort((t, e) => I(e.minimum, t.minimum));
|
|
113
|
+
}
|
|
114
|
+
function fn(n) {
|
|
115
|
+
var U;
|
|
116
|
+
const {
|
|
117
|
+
locale: i,
|
|
118
|
+
numberFormat: t = "decimal",
|
|
119
|
+
currency: e = "CNY",
|
|
120
|
+
currencySymbol: s,
|
|
121
|
+
currencyDisplay: r = "symbol",
|
|
122
|
+
percentInput: u = "ratio",
|
|
123
|
+
compact: m,
|
|
124
|
+
unit: x = "",
|
|
125
|
+
rounding: S = "half-up",
|
|
126
|
+
trimZeros: M = !1,
|
|
127
|
+
groupSeparator: p,
|
|
128
|
+
decimalSeparator: Z,
|
|
129
|
+
grouping: _,
|
|
130
|
+
signDisplay: F = "auto",
|
|
131
|
+
positiveSign: j,
|
|
132
|
+
negativeSign: K
|
|
133
|
+
} = n, T = n.precision ?? n.decimals, O = T === void 0 ? void 0 : Math.floor(A(T, 0, 0, 100)), k = Math.floor(
|
|
134
|
+
A(n.minimumIntegerDigits, 1, 1, 21)
|
|
135
|
+
), q = cn(m), E = p === "" ? !1 : _ ?? (p !== void 0 || i !== void 0), w = t === "scientific" ? "decimal" : t, N = (o) => {
|
|
136
|
+
try {
|
|
137
|
+
return new Intl.NumberFormat(i ?? "en-US", o);
|
|
138
|
+
} catch {
|
|
139
|
+
return new Intl.NumberFormat("en-US", { ...o, currency: "CNY" });
|
|
140
|
+
}
|
|
141
|
+
}, H = N({
|
|
142
|
+
minimumIntegerDigits: k,
|
|
143
|
+
useGrouping: E,
|
|
144
|
+
maximumFractionDigits: 0
|
|
145
|
+
}), J = N({ useGrouping: !1, maximumFractionDigits: 0 }), z = Array.from({ length: 10 }, (o, a) => J.format(a)), B = (o) => o.replace(/[0-9]/g, (a) => z[Number(a)]), L = Z ?? ((U = N({}).formatToParts(1.1).find(({ type: o }) => o === "decimal")) == null ? void 0 : U.value) ?? ".", P = N({
|
|
146
|
+
style: w,
|
|
147
|
+
currency: e,
|
|
148
|
+
currencyDisplay: r,
|
|
149
|
+
signDisplay: "always"
|
|
150
|
+
}), Q = [-1, 0, 1].map((o) => P.formatToParts(o));
|
|
151
|
+
function W(o, a, h) {
|
|
152
|
+
const [f, d] = D(
|
|
153
|
+
b(o),
|
|
154
|
+
M ? void 0 : a
|
|
155
|
+
).split("."), g = H.formatToParts(BigInt(f)).map(
|
|
156
|
+
(c) => c.type === "group" && p !== void 0 ? { ...c, value: p } : c
|
|
157
|
+
);
|
|
158
|
+
return d && g.push(
|
|
159
|
+
{ type: "decimal", value: L },
|
|
160
|
+
{ type: "fraction", value: B(d) }
|
|
161
|
+
), h !== void 0 && g.push(
|
|
162
|
+
{ type: "exponentSeparator", value: "e" },
|
|
163
|
+
{ type: "exponentInteger", value: B(String(h)) }
|
|
164
|
+
), Q[o.units < 0n ? 0 : o.units > 0n ? 2 : 1].flatMap(
|
|
165
|
+
(c) => {
|
|
166
|
+
switch (c.type) {
|
|
167
|
+
case "integer":
|
|
168
|
+
return g;
|
|
169
|
+
case "decimal":
|
|
170
|
+
case "fraction":
|
|
171
|
+
case "group":
|
|
172
|
+
return [];
|
|
173
|
+
case "minusSign":
|
|
174
|
+
return F === "never" ? [] : [{ ...c, value: K ?? c.value }];
|
|
175
|
+
case "plusSign":
|
|
176
|
+
return F === "always" || F === "exceptZero" && o.units !== 0n ? [{ ...c, value: j ?? c.value }] : [];
|
|
177
|
+
case "currency":
|
|
178
|
+
return [{ ...c, value: s ?? c.value }];
|
|
179
|
+
default:
|
|
180
|
+
return [c];
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
function X(o) {
|
|
186
|
+
const a = l(o);
|
|
187
|
+
if (!a)
|
|
188
|
+
return {
|
|
189
|
+
text: String(o) + x,
|
|
190
|
+
parts: [{ type: "literal", value: String(o) }],
|
|
191
|
+
unit: x
|
|
192
|
+
};
|
|
193
|
+
const h = w === "percent" && u === "ratio" ? { ...a, units: a.units * 100n } : a, f = q.find(
|
|
194
|
+
({ minimum: y }) => I(b(h), y) >= 0
|
|
195
|
+
), d = O ?? (f || t === "scientific" ? f ? 1 : 3 : w === "currency" ? P.resolvedOptions().maximumFractionDigits : typeof o == "string" ? void 0 : 0);
|
|
196
|
+
let g, c = h;
|
|
197
|
+
if (t === "scientific") {
|
|
198
|
+
const y = b(a).units.toString().length;
|
|
199
|
+
g = a.units === 0n ? 0 : y - a.scale - 1, c = a.units === 0n ? tn : G(
|
|
200
|
+
{ units: a.units, scale: y - 1 },
|
|
201
|
+
d,
|
|
202
|
+
S
|
|
203
|
+
), I(b(c), { units: 10n, scale: 0 }) >= 0 && (c = { ...c, scale: c.scale + 1 }, g++);
|
|
204
|
+
} else f ? c = Y(h, f.factor, d, S) : d !== void 0 && (c = G(h, d, S));
|
|
205
|
+
const C = W(c, d, g), R = (t === "scientific" ? "" : (f == null ? void 0 : f.label) ?? "") + x;
|
|
206
|
+
return {
|
|
207
|
+
text: C.map(({ value: y }) => y).join("") + R,
|
|
208
|
+
parts: C,
|
|
209
|
+
unit: R
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
return { format: X, localized: z };
|
|
213
|
+
}
|
|
214
|
+
export {
|
|
215
|
+
A as bounded,
|
|
216
|
+
ln as createNumberInterpolator,
|
|
217
|
+
fn as createNumberPresentation,
|
|
218
|
+
an as numberDirection,
|
|
219
|
+
en as numberInterpolation,
|
|
220
|
+
mn as numberTrend,
|
|
221
|
+
un as numberValue
|
|
222
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const r = /* @__PURE__ */ new Set();
|
|
2
|
+
let t;
|
|
3
|
+
function b() {
|
|
4
|
+
t === void 0 && r.size && (t = requestAnimationFrame(v));
|
|
5
|
+
}
|
|
6
|
+
function v(e) {
|
|
7
|
+
t = void 0;
|
|
8
|
+
for (const i of [...r])
|
|
9
|
+
r.has(i) && i(e);
|
|
10
|
+
b();
|
|
11
|
+
}
|
|
12
|
+
function z(e) {
|
|
13
|
+
r.delete(e), !r.size && t !== void 0 && (cancelAnimationFrame(t), t = void 0);
|
|
14
|
+
}
|
|
15
|
+
function w(e) {
|
|
16
|
+
r.add(e), b();
|
|
17
|
+
}
|
|
18
|
+
const o = /* @__PURE__ */ new Set();
|
|
19
|
+
function m() {
|
|
20
|
+
for (const e of o) e();
|
|
21
|
+
}
|
|
22
|
+
function F(e) {
|
|
23
|
+
o.size || document.addEventListener("visibilitychange", m), o.add(e);
|
|
24
|
+
}
|
|
25
|
+
function k(e) {
|
|
26
|
+
o.delete(e), o.size || document.removeEventListener("visibilitychange", m);
|
|
27
|
+
}
|
|
28
|
+
function h([e, i, f, a]) {
|
|
29
|
+
const d = (n, u, c) => 3 * (1 - n) ** 2 * n * u + 3 * (1 - n) * n ** 2 * c + n ** 3;
|
|
30
|
+
return ![e, i, f, a].every(Number.isFinite) || e < 0 || e > 1 || f < 0 || f > 1 ? (n) => n : (n) => {
|
|
31
|
+
let u = 0, c = 1;
|
|
32
|
+
for (let l = 0; l < 20; l++) {
|
|
33
|
+
const s = (u + c) / 2;
|
|
34
|
+
d(s, e, f) < n ? u = s : c = s;
|
|
35
|
+
}
|
|
36
|
+
return d((u + c) / 2, i, a);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function y(e) {
|
|
40
|
+
return e < 1 / 2.75 ? 7.5625 * e ** 2 : e < 2 / 2.75 ? 7.5625 * (e - 1.5 / 2.75) ** 2 + 0.75 : e < 2.5 / 2.75 ? 7.5625 * (e - 2.25 / 2.75) ** 2 + 0.9375 : 7.5625 * (e - 2.625 / 2.75) ** 2 + 0.984375;
|
|
41
|
+
}
|
|
42
|
+
function E(e = "ease-out") {
|
|
43
|
+
if (typeof e == "function") return e;
|
|
44
|
+
if (typeof e != "string") return h(e);
|
|
45
|
+
switch (e) {
|
|
46
|
+
case "linear":
|
|
47
|
+
return (i) => i;
|
|
48
|
+
case "ease-in":
|
|
49
|
+
return (i) => i ** 3;
|
|
50
|
+
case "ease-in-out":
|
|
51
|
+
return (i) => i < 0.5 ? 4 * i ** 3 : 1 - (-2 * i + 2) ** 3 / 2;
|
|
52
|
+
case "spring":
|
|
53
|
+
return (i) => 1 - Math.exp(-7 * i) * Math.cos(12 * i);
|
|
54
|
+
case "bounce":
|
|
55
|
+
return y;
|
|
56
|
+
default:
|
|
57
|
+
return (i) => 1 - (1 - i) ** 3;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
F as listenVisibility,
|
|
62
|
+
E as makeEasing,
|
|
63
|
+
w as subscribe,
|
|
64
|
+
k as unlistenVisibility,
|
|
65
|
+
z as unsubscribe
|
|
66
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { hysNumberAnimationCatalog as h } from "./numberAnimationCatalog.js";
|
|
2
|
+
const d = new Map(
|
|
3
|
+
h.map((e) => [e.name, e])
|
|
4
|
+
), p = /* @__PURE__ */ new Set([
|
|
5
|
+
"count",
|
|
6
|
+
"odometer",
|
|
7
|
+
"wheel",
|
|
8
|
+
"flip",
|
|
9
|
+
"slot",
|
|
10
|
+
"random",
|
|
11
|
+
"scramble",
|
|
12
|
+
"fade",
|
|
13
|
+
"scale",
|
|
14
|
+
"bounce",
|
|
15
|
+
"spring",
|
|
16
|
+
"slide",
|
|
17
|
+
"blur",
|
|
18
|
+
"appear",
|
|
19
|
+
"disappear",
|
|
20
|
+
"flash",
|
|
21
|
+
"highlight",
|
|
22
|
+
"gradient"
|
|
23
|
+
]), o = (e, n, t) => typeof e == "number" && Number.isFinite(e) ? Math.min(t, Math.max(n, e)) : void 0;
|
|
24
|
+
function y(e) {
|
|
25
|
+
const n = typeof e == "string" ? { name: e } : e;
|
|
26
|
+
if (!(typeof (n == null ? void 0 : n.name) != "string" || !n.name.trim()))
|
|
27
|
+
return {
|
|
28
|
+
name: n.name.trim(),
|
|
29
|
+
strength: o(n.strength, 0, 2),
|
|
30
|
+
cycles: o(n.cycles, 1, 12),
|
|
31
|
+
stagger: o(n.stagger, 0, 0.9),
|
|
32
|
+
seed: o(n.seed, 0, 2147483647),
|
|
33
|
+
axis: n.axis === "horizontal" || n.axis === "vertical" ? n.axis : void 0
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function a(e) {
|
|
37
|
+
return (Array.isArray(e) ? e : [e]).slice(0, 8).map(y).filter((n) => n !== void 0);
|
|
38
|
+
}
|
|
39
|
+
function N(e, n) {
|
|
40
|
+
const t = [];
|
|
41
|
+
function m(s, c) {
|
|
42
|
+
if (t.length === 8 || c.length === 8 || c.includes(s.name))
|
|
43
|
+
return;
|
|
44
|
+
const { name: r, ...i } = s;
|
|
45
|
+
if (n && Object.hasOwn(n, r)) {
|
|
46
|
+
for (const g of a(n[r])) {
|
|
47
|
+
const u = { ...g };
|
|
48
|
+
for (const f of Object.keys(
|
|
49
|
+
i
|
|
50
|
+
))
|
|
51
|
+
i[f] !== void 0 && Object.assign(u, { [f]: i[f] });
|
|
52
|
+
m(u, [...c, r]);
|
|
53
|
+
}
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const l = d.get(r);
|
|
57
|
+
l ? t.push({ ...i, entry: l }) : p.has(r) && t.push({ ...i, effect: r });
|
|
58
|
+
}
|
|
59
|
+
for (const s of a(e)) m(s, []);
|
|
60
|
+
return t;
|
|
61
|
+
}
|
|
62
|
+
function v(e) {
|
|
63
|
+
return a(JSON.parse(e));
|
|
64
|
+
}
|
|
65
|
+
function x(e) {
|
|
66
|
+
return JSON.stringify(a(e), null, 2);
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
v as parseHysNumberAnimation,
|
|
70
|
+
N as resolveNumberAnimation,
|
|
71
|
+
x as stringifyHysNumberAnimation
|
|
72
|
+
};
|