hys-ui 0.4.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 (92) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +3 -3
  3. package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +440 -119
  4. package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.js +7 -0
  5. package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas2.vue.js +166 -0
  6. package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.js +7 -0
  7. package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits2.vue.js +105 -0
  8. package/dist/components/HysAnimatedNumber/animation/digital.js +186 -0
  9. package/dist/components/HysAnimatedNumber/animation/morph.js +110 -0
  10. package/dist/components/HysAnimatedNumber/animation/paint.js +34 -0
  11. package/dist/components/HysAnimatedNumber/animation/particles.js +51 -0
  12. package/dist/components/HysAnimatedNumber/animation/paths.js +165 -0
  13. package/dist/components/HysAnimatedNumber/animation/physics.js +66 -0
  14. package/dist/components/HysAnimatedNumber/animation/render.js +89 -0
  15. package/dist/components/HysAnimatedNumber/animation/reveal.js +125 -0
  16. package/dist/components/HysAnimatedNumber/animation/rolling.js +66 -0
  17. package/dist/components/HysAnimatedNumber/animation/scenarios.js +217 -0
  18. package/dist/components/HysAnimatedNumber/animation/spatial.js +112 -0
  19. package/dist/components/HysAnimatedNumber/useNumberCountdown.js +58 -0
  20. package/dist/components/HysAnimatedNumber/useNumberVisuals.js +60 -0
  21. package/dist/components/HysFormItem/HysFormItem.vue.js +1 -1
  22. package/dist/components/HysFormItem/HysFormItem2.vue.js +231 -229
  23. package/dist/components/HysInput/HysInput.vue.js +2 -2
  24. package/dist/components/HysInput/HysInput2.vue.js +327 -274
  25. package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
  26. package/dist/composables/animatedNumberDigits.js +106 -0
  27. package/dist/composables/animatedNumberFormat.js +222 -0
  28. package/dist/composables/animatedNumberTiming.js +66 -0
  29. package/dist/composables/numberAnimation.js +72 -0
  30. package/dist/composables/numberAnimationCatalog.js +301 -0
  31. package/dist/composables/numberAnimationSequence.js +45 -0
  32. package/dist/composables/textInput.js +23 -14
  33. package/dist/composables/useHysAnimatedNumber.js +264 -0
  34. package/dist/composables/useHysNumberAnimationGroup.js +23 -0
  35. package/dist/composables/useTextareaSize.js +62 -46
  36. package/dist/index.js +129 -117
  37. package/dist/style.css +1 -1
  38. package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +88 -49
  39. package/dist/types/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.d.ts +19 -0
  40. package/dist/types/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.d.ts +31 -0
  41. package/dist/types/components/HysAnimatedNumber/animation/digital.d.ts +3 -0
  42. package/dist/types/components/HysAnimatedNumber/animation/morph.d.ts +2 -0
  43. package/dist/types/components/HysAnimatedNumber/animation/paint.d.ts +44 -0
  44. package/dist/types/components/HysAnimatedNumber/animation/particles.d.ts +5 -0
  45. package/dist/types/components/HysAnimatedNumber/animation/paths.d.ts +12 -0
  46. package/dist/types/components/HysAnimatedNumber/animation/physics.d.ts +2 -0
  47. package/dist/types/components/HysAnimatedNumber/animation/render.d.ts +2 -0
  48. package/dist/types/components/HysAnimatedNumber/animation/reveal.d.ts +2 -0
  49. package/dist/types/components/HysAnimatedNumber/animation/rolling.d.ts +2 -0
  50. package/dist/types/components/HysAnimatedNumber/animation/scenarios.d.ts +4 -0
  51. package/dist/types/components/HysAnimatedNumber/animation/spatial.d.ts +2 -0
  52. package/dist/types/components/HysAnimatedNumber/useNumberCountdown.d.ts +8 -0
  53. package/dist/types/components/HysAnimatedNumber/useNumberVisuals.d.ts +12 -0
  54. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +11 -2
  55. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
  56. package/dist/types/components/HysCard/HysCard.vue.d.ts +1 -1
  57. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +3 -3
  58. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
  59. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +2 -2
  60. package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +3 -3
  61. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +5 -5
  62. package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
  63. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +1 -1
  64. package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
  65. package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
  66. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
  67. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +1 -1
  68. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +1 -1
  69. package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
  70. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
  71. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +1 -1
  72. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +1 -1
  73. package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +13 -2
  74. package/dist/types/components/HysToast/HysToast.vue.d.ts +1 -1
  75. package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
  76. package/dist/types/components/HysTour/HysTour.vue.d.ts +1 -1
  77. package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +3 -3
  78. package/dist/types/components/HysUpload/HysUpload.vue.d.ts +2 -2
  79. package/dist/types/composables/animatedNumber.d.ts +220 -0
  80. package/dist/types/composables/animatedNumberDigits.d.ts +32 -0
  81. package/dist/types/composables/animatedNumberFormat.d.ts +16 -0
  82. package/dist/types/composables/animatedNumberTiming.d.ts +21 -0
  83. package/dist/types/composables/drawer.d.ts +1 -1
  84. package/dist/types/composables/numberAnimation.d.ts +29 -0
  85. package/dist/types/composables/numberAnimationCatalog.d.ts +58 -0
  86. package/dist/types/composables/numberAnimationSequence.d.ts +13 -0
  87. package/dist/types/composables/textInput.d.ts +39 -4
  88. package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
  89. package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
  90. package/dist/types/composables/useTextareaSize.d.ts +5 -2
  91. package/dist/types/index.d.ts +12 -2
  92. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
- import { defineComponent as y, ref as v, useAttrs as c, computed as i, openBlock as B, createBlock as $, mergeProps as g, unref as b, createSlots as C, withCtx as l, renderSlot as r, normalizeProps as k, guardReactiveProps as w } from "vue";
2
- import x from "../HysInput/HysInput.vue.js";
1
+ import { defineComponent as y, ref as v, useAttrs as B, computed as a, openBlock as x, createBlock as b, mergeProps as g, unref as w, createSlots as $, withCtx as s, renderSlot as r, normalizeProps as C, guardReactiveProps as k } from "vue";
2
+ import P from "../HysInput/HysInput.vue.js";
3
3
  const I = /* @__PURE__ */ y({
4
4
  inheritAttrs: !1,
5
5
  __name: "HysTextarea",
6
6
  props: {
7
7
  modelValue: {},
8
+ modelModifiers: {},
8
9
  defaultValue: {},
9
10
  placeholder: {},
10
11
  label: {},
@@ -13,7 +14,10 @@ const I = /* @__PURE__ */ y({
13
14
  ariaLabel: {},
14
15
  error: {},
15
16
  status: {},
16
- clearable: { type: Boolean },
17
+ clearable: { type: Boolean, default: void 0 },
18
+ allowClear: { type: Boolean },
19
+ addonBefore: {},
20
+ addonAfter: {},
17
21
  clearIcon: {},
18
22
  prefixIcon: {},
19
23
  suffixIcon: {},
@@ -34,24 +38,33 @@ const I = /* @__PURE__ */ y({
34
38
  autosize: { type: [Boolean, Object] },
35
39
  resize: { default: "vertical" },
36
40
  inputProps: {},
41
+ inputStyle: { type: [Boolean, null, String, Object, Array] },
42
+ inputmode: {},
43
+ tabindex: {},
44
+ form: {},
45
+ validateEvent: { type: Boolean, default: !0 },
37
46
  autofocus: { type: Boolean },
38
47
  selectOnFocus: { type: Boolean },
39
48
  bordered: { type: Boolean, default: !0 },
40
49
  round: { type: Boolean }
41
50
  },
42
- emits: ["update:modelValue", "input", "change", "clear", "focus", "blur", "pressEnter", "compositionstart", "compositionupdate", "compositionend"],
43
- setup(u, { expose: d, emit: m }) {
44
- const a = u, s = m, n = v(), f = c();
51
+ emits: ["update:modelValue", "input", "change", "clear", "focus", "blur", "pressEnter", "keydown", "mouseenter", "mouseleave", "compositionstart", "compositionupdate", "compositionend"],
52
+ setup(p, { expose: d, emit: m }) {
53
+ const i = p, l = m, n = v(), f = B();
45
54
  return d({
46
- input: i(() => {
55
+ element: a(() => {
47
56
  var e;
48
57
  return (e = n.value) == null ? void 0 : e.textarea;
49
58
  }),
50
- textarea: i(() => {
59
+ input: a(() => {
51
60
  var e;
52
61
  return (e = n.value) == null ? void 0 : e.textarea;
53
62
  }),
54
- isComposing: i(() => {
63
+ textarea: a(() => {
64
+ var e;
65
+ return (e = n.value) == null ? void 0 : e.textarea;
66
+ }),
67
+ isComposing: a(() => {
55
68
  var e;
56
69
  return ((e = n.value) == null ? void 0 : e.isComposing) ?? !1;
57
70
  }),
@@ -75,71 +88,82 @@ const I = /* @__PURE__ */ y({
75
88
  var e;
76
89
  return ((e = n.value) == null ? void 0 : e.resize()) ?? Promise.resolve();
77
90
  },
91
+ resizeTextarea: () => {
92
+ var e;
93
+ return ((e = n.value) == null ? void 0 : e.resizeTextarea()) ?? Promise.resolve();
94
+ },
95
+ textareaStyle: a(() => {
96
+ var e;
97
+ return ((e = n.value) == null ? void 0 : e.textareaStyle) ?? {};
98
+ }),
78
99
  setSelectionRange: (e, o, t) => {
79
- var p;
80
- return (p = n.value) == null ? void 0 : p.setSelectionRange(e, o, t);
100
+ var u;
101
+ return (u = n.value) == null ? void 0 : u.setSelectionRange(e, o, t);
81
102
  },
82
103
  scrollTo: (e) => {
83
104
  var o;
84
105
  return (o = n.value) == null ? void 0 : o.scrollTo(e);
85
106
  }
86
- }), (e, o) => (B(), $(x, g({
107
+ }), (e, o) => (x(), b(P, g({
87
108
  ref_key: "control",
88
109
  ref: n
89
- }, { ...a, ...b(f) }, {
90
- "show-count": a.showCount ?? a.maxlength !== void 0,
110
+ }, { ...i, ...w(f) }, {
111
+ "show-count": i.showCount ?? i.maxlength !== void 0,
91
112
  type: "textarea",
92
113
  class: "hys-ui-ex-field",
93
- "onUpdate:modelValue": o[0] || (o[0] = (t) => s("update:modelValue", t)),
94
- onInput: o[1] || (o[1] = (t) => s("input", t)),
95
- onChange: o[2] || (o[2] = (t) => s("change", t)),
96
- onClear: o[3] || (o[3] = (t) => s("clear")),
97
- onFocus: o[4] || (o[4] = (t) => s("focus", t)),
98
- onBlur: o[5] || (o[5] = (t) => s("blur", t)),
99
- onPressEnter: o[6] || (o[6] = (t) => s("pressEnter", t)),
100
- onCompositionstart: o[7] || (o[7] = (t) => s("compositionstart", t)),
101
- onCompositionupdate: o[8] || (o[8] = (t) => s("compositionupdate", t)),
102
- onCompositionend: o[9] || (o[9] = (t) => s("compositionend", t))
103
- }), C({ _: 2 }, [
114
+ "onUpdate:modelValue": o[0] || (o[0] = (t) => l("update:modelValue", t)),
115
+ onInput: o[1] || (o[1] = (t) => l("input", t)),
116
+ onChange: o[2] || (o[2] = (t) => l("change", t)),
117
+ onClear: o[3] || (o[3] = (t) => l("clear")),
118
+ onFocus: o[4] || (o[4] = (t) => l("focus", t)),
119
+ onBlur: o[5] || (o[5] = (t) => l("blur", t)),
120
+ onPressEnter: o[6] || (o[6] = (t) => l("pressEnter", t)),
121
+ onKeydown: o[7] || (o[7] = (t) => l("keydown", t)),
122
+ onMouseenter: o[8] || (o[8] = (t) => l("mouseenter", t)),
123
+ onMouseleave: o[9] || (o[9] = (t) => l("mouseleave", t)),
124
+ onCompositionstart: o[10] || (o[10] = (t) => l("compositionstart", t)),
125
+ onCompositionupdate: o[11] || (o[11] = (t) => l("compositionupdate", t)),
126
+ onCompositionend: o[12] || (o[12] = (t) => l("compositionend", t))
127
+ }), $({ _: 2 }, [
104
128
  e.$slots.prefix ? {
105
129
  name: "prefix",
106
- fn: l(() => [
130
+ fn: s(() => [
107
131
  r(e.$slots, "prefix")
108
132
  ]),
109
133
  key: "0"
110
134
  } : void 0,
111
135
  e.$slots.suffix ? {
112
136
  name: "suffix",
113
- fn: l(() => [
137
+ fn: s(() => [
114
138
  r(e.$slots, "suffix")
115
139
  ]),
116
140
  key: "1"
117
141
  } : void 0,
118
142
  e.$slots.prepend ? {
119
143
  name: "prepend",
120
- fn: l(() => [
144
+ fn: s(() => [
121
145
  r(e.$slots, "prepend")
122
146
  ]),
123
147
  key: "2"
124
148
  } : void 0,
125
149
  e.$slots.append ? {
126
150
  name: "append",
127
- fn: l(() => [
151
+ fn: s(() => [
128
152
  r(e.$slots, "append")
129
153
  ]),
130
154
  key: "3"
131
155
  } : void 0,
132
156
  e.$slots["clear-icon"] ? {
133
157
  name: "clear-icon",
134
- fn: l(() => [
158
+ fn: s(() => [
135
159
  r(e.$slots, "clear-icon")
136
160
  ]),
137
161
  key: "4"
138
162
  } : void 0,
139
163
  e.$slots.count ? {
140
164
  name: "count",
141
- fn: l((t) => [
142
- r(e.$slots, "count", k(w(t)))
165
+ fn: s((t) => [
166
+ r(e.$slots, "count", C(k(t)))
143
167
  ]),
144
168
  key: "5"
145
169
  } : void 0
@@ -0,0 +1,106 @@
1
+ const I = [
2
+ "odometer",
3
+ "wheel",
4
+ "flip",
5
+ "slot",
6
+ "random",
7
+ "scramble",
8
+ "appear",
9
+ "disappear"
10
+ ];
11
+ function w(t) {
12
+ return t.reduce(
13
+ (i, { type: r, value: a }) => i + (r === "integer" || r === "fraction" ? [...a].length : 0),
14
+ 0
15
+ );
16
+ }
17
+ function $(t, i) {
18
+ let r = t.filter(({ type: n }) => n === "integer").reduce((n, s) => n + [...s.value].length, 0), a = 0;
19
+ return t.flatMap(({ type: n, value: s }, l) => !i || n !== "integer" && n !== "fraction" ? [{ key: `${n}-${l}`, text: s, type: n, position: 0 }] : [...s].map((f) => {
20
+ const d = n === "integer" ? --r : ++a;
21
+ return {
22
+ key: `${n}-digit-${d}`,
23
+ text: f,
24
+ type: n,
25
+ position: d,
26
+ section: n
27
+ };
28
+ }));
29
+ }
30
+ function N(t, i) {
31
+ const r = { integer: "", fraction: "" };
32
+ for (const a of t.parts)
33
+ (a.type === "integer" || a.type === "fraction") && (r[a.type] += [...a.value].map((n) => Math.max(0, i.indexOf(n))).join(""));
34
+ return r;
35
+ }
36
+ function B(t, i, r) {
37
+ var p, M;
38
+ const a = N(t, r), n = N(i, r), s = Math.max(a.fraction.length, n.fraction.length), l = (e) => BigInt(e.integer + e.fraction.padEnd(s, "0")), f = l(a), d = l(n), g = t.unit === i.unit && ((p = t.parts.find(({ type: e }) => e === "exponentInteger")) == null ? void 0 : p.value) === ((M = i.parts.find(({ type: e }) => e === "exponentInteger")) == null ? void 0 : M.value);
39
+ return (e) => {
40
+ const u = e.section === "integer" ? s + e.position : s - e.position, o = 10n ** BigInt(Math.max(0, u)), h = f / o, m = d / o, c = m - h, x = Number(h % 10n), v = Number(m % 10n), P = c > 40n ? 30 + Number(c % 10n) : c < -40n ? -30 + Number(c % 10n) : Number(c);
41
+ return {
42
+ offset: x,
43
+ destination: v,
44
+ steps: g ? P : v - x,
45
+ carry: g && o > 1n && c !== 0n && c >= -40n && c <= 40n ? {
46
+ start: Number(f % o * 1000000n / o) / 1e6,
47
+ end: Number(d % o * 1000000n / o) / 1e6
48
+ } : void 0,
49
+ fromPresent: e.position < a.integer.length && e.section === "integer" || e.position <= a.fraction.length && e.section === "fraction",
50
+ toPresent: e.position < n.integer.length && e.section === "integer" || e.position <= n.fraction.length && e.section === "fraction"
51
+ };
52
+ };
53
+ }
54
+ const b = (t) => (t % 10 + 10) % 10;
55
+ function E(t, i, r, a, n) {
56
+ const { offset: s, destination: l, steps: f } = i, d = f < 0 ? -1 : 1, g = (u) => (Math.imul(u + 23, 2246822519) ^ Math.imul(a + 17, 3266489917)) >>> 0;
57
+ if (t === "scramble") {
58
+ const u = r * 24, o = Math.floor(u);
59
+ return {
60
+ first: n[o === 0 ? s : g(o) % 10],
61
+ second: n[o >= 23 ? l : g(o + 1) % 10],
62
+ phase: u - o,
63
+ direction: d,
64
+ changed: !0
65
+ };
66
+ }
67
+ if (t === "odometer" && i.carry) {
68
+ const { start: u, end: o } = i.carry, h = u + (f + o - u) * r, m = Math.floor(h), c = Math.max(
69
+ 0.9,
70
+ m === 0 ? u : 0,
71
+ m === f ? o : 0
72
+ );
73
+ return {
74
+ first: n[b(s + m)],
75
+ second: n[b(s + m + 1)],
76
+ phase: Math.max(0, (h - m - c) / (1 - c)),
77
+ direction: 1,
78
+ changed: !0
79
+ };
80
+ }
81
+ if (t === "odometer" || t === "wheel" || t === "slot") {
82
+ const u = (l - s + 10 * d) % 10, o = t === "slot" ? 20 * d + u : t === "wheel" ? u : f, h = Math.abs(o) * r, m = Math.floor(h), c = s + m * d;
83
+ return {
84
+ first: n[b(c)],
85
+ second: n[b(c + d)],
86
+ phase: h - m,
87
+ direction: d,
88
+ changed: o !== 0
89
+ };
90
+ }
91
+ const p = Math.floor(Math.min(r, 0.87) * 37), M = t === "random" && p > 0 ? g(p) % 10 : s, e = t === "appear" || t === "disappear";
92
+ return {
93
+ first: e && !i.fromPresent ? "" : n[M],
94
+ second: e && !i.toPresent ? "" : n[l],
95
+ phase: t === "random" ? Math.max(0, (r - 0.87) / 0.13) : r,
96
+ direction: d,
97
+ changed: s !== l || t === "random" || e && i.fromPresent !== i.toPresent
98
+ };
99
+ }
100
+ export {
101
+ B as createDigitTracks,
102
+ w as digitCount,
103
+ I as digitEffects,
104
+ E as digitMotion,
105
+ $ as numberTokens
106
+ };
@@ -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,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
+ };