hys-ui 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +68 -73
  3. package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
  4. package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +467 -2
  5. package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.js +7 -0
  6. package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas2.vue.js +166 -0
  7. package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.js +7 -0
  8. package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits2.vue.js +105 -0
  9. package/dist/components/HysAnimatedNumber/animation/digital.js +186 -0
  10. package/dist/components/HysAnimatedNumber/animation/morph.js +110 -0
  11. package/dist/components/HysAnimatedNumber/animation/paint.js +34 -0
  12. package/dist/components/HysAnimatedNumber/animation/particles.js +51 -0
  13. package/dist/components/HysAnimatedNumber/animation/paths.js +165 -0
  14. package/dist/components/HysAnimatedNumber/animation/physics.js +66 -0
  15. package/dist/components/HysAnimatedNumber/animation/render.js +89 -0
  16. package/dist/components/HysAnimatedNumber/animation/reveal.js +125 -0
  17. package/dist/components/HysAnimatedNumber/animation/rolling.js +66 -0
  18. package/dist/components/HysAnimatedNumber/animation/scenarios.js +217 -0
  19. package/dist/components/HysAnimatedNumber/animation/spatial.js +112 -0
  20. package/dist/components/HysAnimatedNumber/useNumberCountdown.js +58 -0
  21. package/dist/components/HysAnimatedNumber/useNumberVisuals.js +60 -0
  22. package/dist/components/HysButton/HysButton.vue.js +2 -2
  23. package/dist/components/HysButton/HysButton2.vue.js +227 -60
  24. package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
  25. package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
  26. package/dist/components/HysFormItem/HysFormItem.vue.js +1 -1
  27. package/dist/components/HysFormItem/HysFormItem2.vue.js +231 -229
  28. package/dist/components/HysInput/HysInput.vue.js +2 -2
  29. package/dist/components/HysInput/HysInput2.vue.js +327 -274
  30. package/dist/components/HysMention/HysMention.vue.js +1 -1
  31. package/dist/components/HysMention/HysMention2.vue.js +1092 -154
  32. package/dist/components/HysModal/HysModal.vue.js +3 -3
  33. package/dist/components/HysModal/HysModal2.vue.js +81 -80
  34. package/dist/components/HysPagination/HysPagination.vue.js +2 -2
  35. package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
  36. package/dist/components/HysSearch/HysSearch.vue.js +5 -82
  37. package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
  38. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  39. package/dist/components/HysSelect/HysSelect2.vue.js +472 -443
  40. package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
  41. package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
  42. package/dist/components/HysTable/HysTable.vue.js +2 -2
  43. package/dist/components/HysTable/HysTable2.vue.js +1418 -1150
  44. package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
  45. package/dist/components/HysTour/HysTour.vue.js +291 -67
  46. package/dist/components/HysTour/HysTour3.vue.js +5 -0
  47. package/dist/composables/animatedNumberDigits.js +106 -0
  48. package/dist/composables/animatedNumberFormat.js +222 -0
  49. package/dist/composables/animatedNumberTiming.js +66 -0
  50. package/dist/composables/buttonGroup.js +12 -0
  51. package/dist/composables/floatingPosition.js +18 -0
  52. package/dist/composables/mentionDocument.js +79 -0
  53. package/dist/composables/mentionEditor.js +58 -0
  54. package/dist/composables/numberAnimation.js +72 -0
  55. package/dist/composables/numberAnimationCatalog.js +301 -0
  56. package/dist/composables/numberAnimationSequence.js +45 -0
  57. package/dist/composables/selectOptions.js +44 -38
  58. package/dist/composables/splitPaneSizes.js +58 -0
  59. package/dist/composables/table.js +128 -105
  60. package/dist/composables/textInput.js +23 -14
  61. package/dist/composables/useDialog.js +50 -50
  62. package/dist/composables/useFloating.js +107 -103
  63. package/dist/composables/useHysAnimatedNumber.js +264 -0
  64. package/dist/composables/useHysNumberAnimationGroup.js +23 -0
  65. package/dist/composables/useMentionCaret.js +81 -0
  66. package/dist/composables/useMentionList.js +81 -0
  67. package/dist/composables/useMentionModel.js +90 -0
  68. package/dist/composables/useMentionOptions.js +421 -0
  69. package/dist/composables/useSplitPaneDrag.js +52 -0
  70. package/dist/composables/useSplitPaneStorage.js +38 -0
  71. package/dist/composables/useTable.js +344 -312
  72. package/dist/composables/useTableSticky.js +79 -0
  73. package/dist/composables/useTextareaSize.js +62 -46
  74. package/dist/composables/useTourLayout.js +129 -0
  75. package/dist/config.js +11 -11
  76. package/dist/index.js +183 -152
  77. package/dist/internal/MultiSplitPane.vue.js +305 -0
  78. package/dist/internal/MultiSplitPane2.vue.js +4 -0
  79. package/dist/style.css +1 -1
  80. package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +99 -6
  81. package/dist/types/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.d.ts +19 -0
  82. package/dist/types/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.d.ts +31 -0
  83. package/dist/types/components/HysAnimatedNumber/animation/digital.d.ts +3 -0
  84. package/dist/types/components/HysAnimatedNumber/animation/morph.d.ts +2 -0
  85. package/dist/types/components/HysAnimatedNumber/animation/paint.d.ts +44 -0
  86. package/dist/types/components/HysAnimatedNumber/animation/particles.d.ts +5 -0
  87. package/dist/types/components/HysAnimatedNumber/animation/paths.d.ts +12 -0
  88. package/dist/types/components/HysAnimatedNumber/animation/physics.d.ts +2 -0
  89. package/dist/types/components/HysAnimatedNumber/animation/render.d.ts +2 -0
  90. package/dist/types/components/HysAnimatedNumber/animation/reveal.d.ts +2 -0
  91. package/dist/types/components/HysAnimatedNumber/animation/rolling.d.ts +2 -0
  92. package/dist/types/components/HysAnimatedNumber/animation/scenarios.d.ts +4 -0
  93. package/dist/types/components/HysAnimatedNumber/animation/spatial.d.ts +2 -0
  94. package/dist/types/components/HysAnimatedNumber/useNumberCountdown.d.ts +8 -0
  95. package/dist/types/components/HysAnimatedNumber/useNumberVisuals.d.ts +12 -0
  96. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +12 -3
  97. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
  98. package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
  99. package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
  100. package/dist/types/components/HysCard/HysCard.vue.d.ts +1 -1
  101. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +3 -3
  102. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +3 -3
  103. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +3 -3
  104. package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +2 -2
  105. package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +3 -3
  106. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +6 -6
  107. package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
  108. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +2 -2
  109. package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
  110. package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
  111. package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -40
  112. package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
  113. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
  114. package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
  115. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +1 -1
  116. package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
  117. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +46 -8
  118. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +6 -1
  119. package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
  120. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
  121. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
  122. package/dist/types/components/HysTable/HysTable.vue.d.ts +1740 -3
  123. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +1 -1
  124. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +1 -1
  125. package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +13 -2
  126. package/dist/types/components/HysToast/HysToast.vue.d.ts +1 -1
  127. package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
  128. package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -9
  129. package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +3 -3
  130. package/dist/types/components/HysUpload/HysUpload.vue.d.ts +2 -2
  131. package/dist/types/composables/animatedNumber.d.ts +220 -0
  132. package/dist/types/composables/animatedNumberDigits.d.ts +32 -0
  133. package/dist/types/composables/animatedNumberFormat.d.ts +16 -0
  134. package/dist/types/composables/animatedNumberTiming.d.ts +21 -0
  135. package/dist/types/composables/buttonGroup.d.ts +9 -0
  136. package/dist/types/composables/drawer.d.ts +1 -1
  137. package/dist/types/composables/floatingPosition.d.ts +14 -0
  138. package/dist/types/composables/mention.d.ts +284 -0
  139. package/dist/types/composables/mentionDocument.d.ts +15 -0
  140. package/dist/types/composables/mentionEditor.d.ts +7 -0
  141. package/dist/types/composables/modal.d.ts +2 -0
  142. package/dist/types/composables/numberAnimation.d.ts +29 -0
  143. package/dist/types/composables/numberAnimationCatalog.d.ts +58 -0
  144. package/dist/types/composables/numberAnimationSequence.d.ts +13 -0
  145. package/dist/types/composables/selectOptions.d.ts +5 -0
  146. package/dist/types/composables/splitPaneSizes.d.ts +11 -0
  147. package/dist/types/composables/table.d.ts +116 -6
  148. package/dist/types/composables/textInput.d.ts +39 -4
  149. package/dist/types/composables/tour.d.ts +68 -0
  150. package/dist/types/composables/useFloating.d.ts +1 -1
  151. package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
  152. package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
  153. package/dist/types/composables/useMentionCaret.d.ts +6 -0
  154. package/dist/types/composables/useMentionList.d.ts +23 -0
  155. package/dist/types/composables/useMentionModel.d.ts +14 -0
  156. package/dist/types/composables/useMentionOptions.d.ts +26 -0
  157. package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
  158. package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
  159. package/dist/types/composables/useTable.d.ts +7 -3
  160. package/dist/types/composables/useTableSticky.d.ts +22 -0
  161. package/dist/types/composables/useTextareaSize.d.ts +5 -2
  162. package/dist/types/composables/useTourLayout.d.ts +33 -0
  163. package/dist/types/config.d.ts +1 -0
  164. package/dist/types/index.d.ts +46 -1
  165. package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
  166. package/package.json +3 -2
  167. package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
  168. package/dist/components/HysTour/HysTour2.vue.js +0 -4
@@ -1,4 +1,469 @@
1
- import f from "./HysAnimatedNumber.vue.js";
1
+ import { defineComponent as Ke, useSlots as Ue, useTemplateRef as Ge, ref as j, computed as i, watch as M, onMounted as Ze, onActivated as Je, onDeactivated as Qe, onBeforeUnmount as Xe, openBlock as s, createElementBlock as r, mergeProps as Ye, unref as m, renderSlot as k, createTextVNode as W, toDisplayString as b, createCommentVNode as B, createElementVNode as z, normalizeStyle as ee, normalizeProps as O, guardReactiveProps as S, Fragment as $, createBlock as te, normalizeClass as be, createSlots as _e, withCtx as et, renderList as tt } from "vue";
2
+ import { useHysRootAttrs as at } from "../../config.js";
3
+ import { decimal as nt } from "../../composables/numberInput.js";
4
+ import { numberValue as xe, createNumberPresentation as it, numberTrend as ae, bounded as ke } from "../../composables/animatedNumberFormat.js";
5
+ import { useHysAnimatedNumber as lt } from "../../composables/useHysAnimatedNumber.js";
6
+ import { resolveNumberAnimation as ne } from "../../composables/numberAnimation.js";
7
+ import { useNumberCountdown as ot } from "./useNumberCountdown.js";
8
+ import { useNumberVisuals as ut } from "./useNumberVisuals.js";
9
+ import st from "./NumberDigits/NumberDigits.vue.js";
10
+ import rt from "./NumberAnimationCanvas/NumberAnimationCanvas.vue.js";
11
+ const dt = ["data-tone", "data-direction", "data-status", "data-appearance", "role", "tabindex"], ct = {
12
+ key: 0,
13
+ class: "hys-ui-motion-number-title"
14
+ }, vt = ["role", "aria-label"], ft = {
15
+ key: 0,
16
+ class: "hys-ui-motion-number-affix hys-ui-motion-number-prefix"
17
+ }, mt = {
18
+ class: "hys-number-measure",
19
+ "aria-hidden": "true"
20
+ }, pt = {
21
+ class: "hys-number-measure",
22
+ "aria-hidden": "true"
23
+ }, yt = {
24
+ key: 3,
25
+ class: "hys-ui-motion-number-unit"
26
+ }, gt = {
27
+ key: 5,
28
+ class: "hys-ui-motion-number-affix hys-ui-motion-number-suffix"
29
+ }, ht = {
30
+ key: 2,
31
+ class: "hys-number-live",
32
+ role: "status",
33
+ "aria-live": "polite",
34
+ "aria-atomic": "true"
35
+ }, Nt = /* @__PURE__ */ Ke({
36
+ __name: "HysAnimatedNumber",
37
+ props: {
38
+ modelValue: {},
39
+ trigger: {},
40
+ canPlay: { type: [Boolean, Function], default: !0 },
41
+ visibleOnce: { type: Boolean, default: !0 },
42
+ pauseOutside: { type: Boolean },
43
+ visibilityThreshold: {},
44
+ effect: {},
45
+ animation: {},
46
+ animationPresets: {},
47
+ fallbackAnimation: {},
48
+ digitAnimations: {},
49
+ motionIntensity: {},
50
+ animationMotion: {},
51
+ thresholdEffect: {},
52
+ axis: {},
53
+ stagger: {},
54
+ digitDuration: {},
55
+ digitOrder: {},
56
+ animationStyle: {},
57
+ stableWidth: { type: Boolean },
58
+ appearance: { default: "plain" },
59
+ colorBySign: { type: Boolean },
60
+ colorByDirection: { type: Boolean },
61
+ changeThreshold: {},
62
+ title: {},
63
+ prefix: {},
64
+ suffix: {},
65
+ valueStyle: { type: [Boolean, null, String, Object, Array] },
66
+ formatter: {},
67
+ announce: { type: Boolean },
68
+ deadline: {},
69
+ format: { default: "HH:mm:ss" },
70
+ value: {},
71
+ from: {},
72
+ duration: { default: 650 },
73
+ delay: {},
74
+ speed: {},
75
+ easing: {},
76
+ interpolate: {},
77
+ loop: { type: [Boolean, Number] },
78
+ alternate: { type: Boolean },
79
+ interrupt: {},
80
+ queueLimit: {},
81
+ updateInterval: {},
82
+ fps: {},
83
+ disabled: { type: Boolean },
84
+ pauseWhenHidden: { type: Boolean, default: !0 },
85
+ decimals: {},
86
+ precision: {},
87
+ trimZeros: { type: Boolean },
88
+ minimumIntegerDigits: {},
89
+ rounding: {},
90
+ groupSeparator: {},
91
+ decimalSeparator: {},
92
+ grouping: { type: Boolean, default: void 0 },
93
+ locale: {},
94
+ numberFormat: {},
95
+ percentInput: {},
96
+ currency: {},
97
+ currencySymbol: {},
98
+ currencyDisplay: {},
99
+ compact: {},
100
+ unit: {},
101
+ signDisplay: {},
102
+ positiveSign: {},
103
+ negativeSign: {}
104
+ },
105
+ emits: ["update:modelValue", "value-change", "threshold", "change", "finish", "start", "update", "progress", "pause", "resume", "end", "cancel", "loop"],
106
+ setup(l, { expose: Be, emit: Oe }) {
107
+ const e = l, T = Oe, u = Ue(), ie = at(), w = Ge("root"), le = j(0), p = i(
108
+ () => xe(e.modelValue ?? e.value ?? le.value)
109
+ ), o = i(() => e.deadline !== void 0), P = i(() => it(e)), R = j(""), y = lt(
110
+ () => ({
111
+ from: e.from,
112
+ value: p.value,
113
+ duration: e.duration,
114
+ delay: e.delay,
115
+ speed: e.speed,
116
+ easing: e.easing,
117
+ interpolate: e.interpolate,
118
+ loop: e.loop,
119
+ alternate: e.alternate,
120
+ interrupt: e.interrupt,
121
+ queueLimit: e.queueLimit,
122
+ updateInterval: e.updateInterval,
123
+ fps: e.fps,
124
+ disabled: e.disabled || e.animationMotion === "off",
125
+ pauseWhenHidden: e.pauseWhenHidden,
126
+ autoPlay: !1,
127
+ autoUpdate: !1
128
+ }),
129
+ (t, a) => {
130
+ T(t, a), t === "end" && e.announce && (R.value = _(
131
+ P.value.format(a.value).text
132
+ ));
133
+ }
134
+ ), {
135
+ frame: g,
136
+ motionEnabled: F,
137
+ play: Se,
138
+ pause: Te,
139
+ resume: Pe,
140
+ stop: oe,
141
+ reset: Ve,
142
+ restart: L,
143
+ reverse: Ae,
144
+ seek: Ne,
145
+ finishAnimation: Ce
146
+ } = y, d = j(
147
+ ae(e.from ?? p.value, p.value, e.changeThreshold)
148
+ ), {
149
+ remaining: q,
150
+ parts: ue,
151
+ milliseconds: De
152
+ } = ot(
153
+ () => e.deadline,
154
+ () => e.format,
155
+ () => e.pauseWhenHidden,
156
+ (t) => T("change", t),
157
+ () => {
158
+ T("finish"), e.announce && (R.value = _(f.value.text));
159
+ }
160
+ ), K = i(
161
+ () => e.trigger === void 0 ? ["mount", "update"] : typeof e.trigger == "string" ? [e.trigger] : e.trigger
162
+ ), c = (t) => K.value.includes(t) && !K.value.includes("manual"), E = (t) => {
163
+ if (!c(t) || o.value) return !1;
164
+ try {
165
+ return typeof e.canPlay == "function" ? e.canPlay(t, p.value) : e.canPlay !== !1;
166
+ } catch {
167
+ return !1;
168
+ }
169
+ };
170
+ let v, V = !1, N = !1, C = !1, I = !1;
171
+ const D = j(!1);
172
+ function A(t) {
173
+ return E(t) ? (t === "activate" || t === "visible" || g.value.to === p.value ? L() : y.updateTarget(p.value), I = !1, !0) : !1;
174
+ }
175
+ function se() {
176
+ const t = !N || !e.visibleOnce, a = ["delayed", "paused", "playing"].includes(g.value.status);
177
+ I && E("update") ? (y.updateTarget(p.value), I = !1, c("visible") && (N = !0)) : t && !(e.pauseOutside && a) && A("visible") && (N = !0);
178
+ }
179
+ function re() {
180
+ if (v == null || v.disconnect(), v = void 0, !V || o.value || !c("visible") && !e.pauseOutside) {
181
+ D.value = !1, y.hold(!1);
182
+ return;
183
+ }
184
+ if (typeof IntersectionObserver > "u" || !w.value) {
185
+ D.value = !1, C = !0, y.hold(!1), se();
186
+ return;
187
+ }
188
+ C = !1, D.value = !0, y.hold(!!e.pauseOutside || c("visible"));
189
+ const t = ke(e.visibilityThreshold, 0.2, 0, 1);
190
+ v = new IntersectionObserver(
191
+ ([a]) => {
192
+ if (!V || !a) return;
193
+ const n = a.isIntersecting && a.intersectionRatio >= t, x = n && !C;
194
+ C = n, x && se(), y.hold(
195
+ !n && (!!e.pauseOutside || c("visible") && !N)
196
+ );
197
+ },
198
+ { threshold: t }
199
+ ), v.observe(w.value);
200
+ }
201
+ M(p, (t, a) => {
202
+ d.value = ae(a, t, e.changeThreshold), T("value-change", d.value), d.value.significant && T("threshold", d.value), E("update") && (c("visible") && D.value && !C && (!N || e.pauseOutside) ? I = !0 : y.updateTarget(t));
203
+ }), M(
204
+ () => e.changeThreshold,
205
+ (t) => {
206
+ d.value = ae(d.value.previous, p.value, t);
207
+ }
208
+ ), M(o, (t) => {
209
+ t ? oe() : y.sync();
210
+ }), M(
211
+ [
212
+ K,
213
+ () => e.pauseOutside,
214
+ () => e.visibilityThreshold,
215
+ o
216
+ ],
217
+ re,
218
+ { flush: "post" }
219
+ );
220
+ function de() {
221
+ V || (V = !0, re());
222
+ }
223
+ function ce() {
224
+ V = !1, v == null || v.disconnect(), v = void 0, D.value = !1;
225
+ }
226
+ Ze(() => {
227
+ de(), e.from !== void 0 && E("mount") && !c("visible") && L();
228
+ }), Je(() => {
229
+ V || (de(), A("activate"));
230
+ }), Qe(ce), Xe(ce);
231
+ const f = i((t) => {
232
+ const a = o.value ? {
233
+ text: ue.value.map(({ text: n }) => n).join(""),
234
+ unit: "",
235
+ parts: ue.value.map(({ text: n, numeric: x }) => ({
236
+ type: x ? "integer" : "literal",
237
+ value: n
238
+ }))
239
+ } : P.value.format(g.value.value);
240
+ return (t == null ? void 0 : t.text) === a.text && t.unit === a.unit && t.parts.length === a.parts.length && t.parts.every(
241
+ (n, x) => n.type === a.parts[x].type && n.value === a.parts[x].value
242
+ ) ? t : a;
243
+ }), U = i(() => f.value.text), h = i(() => ({
244
+ ...g.value,
245
+ value: o.value ? q.value : g.value.value,
246
+ displayValue: U.value,
247
+ unit: f.value.unit,
248
+ remaining: o.value ? q.value : void 0,
249
+ trend: d.value
250
+ })), G = i(() => {
251
+ const t = ne(e.animation, e.animationPresets);
252
+ return t.length ? t : ne(e.fallbackAnimation, e.animationPresets);
253
+ }), ve = i(
254
+ () => Object.fromEntries(
255
+ Object.entries(e.digitAnimations ?? {}).flatMap(([t, a]) => {
256
+ const n = ne(a, e.animationPresets);
257
+ return n.length ? [[t, n]] : [];
258
+ })
259
+ )
260
+ ), fe = i(() => ke(e.motionIntensity, 1, 0, 2)), Z = i(
261
+ () => e.animationMotion !== "simplified" && e.animationMotion !== "off" && fe.value > 0
262
+ ), me = i(
263
+ () => !o.value && Z.value && !u.digit && (G.value.some(({ entry: t }) => t) || Object.keys(ve.value).length > 0)
264
+ ), $e = i(() => {
265
+ if (!Z.value) return [];
266
+ if (me.value) return [];
267
+ const t = G.value.flatMap(
268
+ ({ effect: a, entry: n }) => a ? [a] : o.value && (n == null ? void 0 : n.name) === "flip-clock" ? ["flip"] : []
269
+ );
270
+ return t.length ? t : typeof e.effect == "string" ? [e.effect] : e.effect ?? [];
271
+ }), {
272
+ from: we,
273
+ to: Ee,
274
+ status: Ie,
275
+ running: He,
276
+ digitEffect: J,
277
+ visualStyle: je,
278
+ outgoingStyle: pe,
279
+ sliding: Me
280
+ } = ut(
281
+ e,
282
+ g,
283
+ h,
284
+ F,
285
+ o,
286
+ $e,
287
+ Z
288
+ ), H = i(
289
+ () => o.value ? f.value : P.value.format(we.value)
290
+ ), Q = i(
291
+ () => o.value ? f.value : P.value.format(Ee.value)
292
+ ), X = i(
293
+ () => He.value || d.value.direction === "none" ? g.value.direction : d.value.direction
294
+ ), We = i(() => {
295
+ var t;
296
+ if (!o.value) {
297
+ if (e.colorByDirection && X.value !== "none")
298
+ return X.value;
299
+ if (e.colorBySign) {
300
+ const a = ((t = nt(g.value.value)) == null ? void 0 : t.units) ?? 0n;
301
+ return a > 0n ? "up" : a < 0n ? "down" : void 0;
302
+ }
303
+ }
304
+ }), ye = i(
305
+ () => !!J.value && F.value && !De.value
306
+ ), Y = i(() => {
307
+ if (!(!e.formatter || u.formatter || u.default))
308
+ try {
309
+ return { value: e.formatter(h.value) };
310
+ } catch {
311
+ return;
312
+ }
313
+ }), ge = i(
314
+ () => !!(u.formatter || u.default || Y.value || u.digit)
315
+ ), ze = i(
316
+ () => ye.value && !ge.value && !o.value
317
+ ), he = i(
318
+ () => !o.value && (c("click") || c("hover"))
319
+ );
320
+ function _(t) {
321
+ return [
322
+ e.title,
323
+ [e.prefix, t, e.suffix].filter(Boolean).join(" ")
324
+ ].filter(Boolean).join(" ");
325
+ }
326
+ function Re(t) {
327
+ t.target !== w.value || t.repeat || !c("click") || !["Enter", " "].includes(t.key) || (t.preventDefault(), A("click"));
328
+ }
329
+ function Fe(t) {
330
+ const a = xe(t);
331
+ e.modelValue === void 0 && e.value === void 0 && (le.value = a), T("update:modelValue", a);
332
+ }
333
+ const Le = ({ value: t }) => t;
334
+ return Be({
335
+ displayValue: U,
336
+ remaining: q,
337
+ frame: g,
338
+ trend: d,
339
+ setValue: Fe,
340
+ play: Se,
341
+ pause: Te,
342
+ resume: Pe,
343
+ stop: oe,
344
+ restart: L,
345
+ reset: Ve,
346
+ reverse: Ae,
347
+ seek: Ne,
348
+ finishAnimation: Ce
349
+ }), (t, a) => (s(), r("span", Ye({
350
+ ref_key: "root",
351
+ ref: w
352
+ }, m(ie), {
353
+ class: "hys-ui-motion-number",
354
+ "data-tone": We.value,
355
+ "data-direction": X.value,
356
+ "data-status": o.value ? void 0 : m(Ie),
357
+ "data-appearance": l.appearance,
358
+ role: he.value && c("click") ? "button" : void 0,
359
+ tabindex: he.value ? 0 : void 0,
360
+ onClick: a[0] || (a[0] = (n) => A("click")),
361
+ onPointerenter: a[1] || (a[1] = (n) => A("hover")),
362
+ onFocus: a[2] || (a[2] = (n) => A("hover")),
363
+ onKeydown: Re
364
+ }), [
365
+ l.title || u.title ? (s(), r("span", ct, [
366
+ k(t.$slots, "title", {}, () => [
367
+ W(b(l.title), 1)
368
+ ], !0)
369
+ ])) : B("", !0),
370
+ z("span", {
371
+ class: "hys-ui-motion-number-value",
372
+ style: ee(l.valueStyle),
373
+ role: o.value ? "timer" : void 0,
374
+ "aria-label": o.value && !ge.value ? _(U.value) : void 0
375
+ }, [
376
+ l.prefix || u.prefix ? (s(), r("span", ft, [
377
+ u.prefix ? k(t.$slots, "prefix", O(S(h.value)), void 0, !0, 0) : (s(), r($, { key: 1 }, [
378
+ W(b(l.prefix), 1)
379
+ ], 64))
380
+ ])) : B("", !0),
381
+ u.formatter ? k(t.$slots, "formatter", O(S(h.value)), void 0, !0, 1) : u.default ? k(t.$slots, "default", O(S(h.value)), void 0, !0, 2) : Y.value ? (s(), te(Le, {
382
+ key: 3,
383
+ value: Y.value.value
384
+ }, null, 8, ["value"])) : (s(), r("span", {
385
+ key: 4,
386
+ class: be(["hys-ui-motion-number-layout", {
387
+ "hys-number-stable": l.stableWidth,
388
+ "hys-number-sliding": m(Me)
389
+ }])
390
+ }, [
391
+ l.stableWidth && !o.value ? (s(), r($, { key: 0 }, [
392
+ z("span", mt, b(H.value.text), 1),
393
+ z("span", pt, b(Q.value.text), 1)
394
+ ], 64)) : B("", !0),
395
+ m(pe) ? (s(), r("span", {
396
+ key: 1,
397
+ class: "hys-ui-motion-number-outgoing",
398
+ "aria-hidden": "true",
399
+ style: ee(m(pe))
400
+ }, b(H.value.text), 5)) : B("", !0),
401
+ z("span", {
402
+ class: "hys-ui-motion-number-content",
403
+ style: ee(m(je))
404
+ }, [
405
+ me.value ? (s(), te(rt, {
406
+ key: 0,
407
+ current: f.value,
408
+ start: H.value,
409
+ end: Q.value,
410
+ glyphs: P.value.localized,
411
+ context: h.value,
412
+ plans: G.value,
413
+ "digit-plans": ve.value,
414
+ intensity: fe.value,
415
+ motion: m(F),
416
+ axis: l.axis,
417
+ theme: m(ie)["data-hys-theme"]
418
+ }, null, 8, ["current", "start", "end", "glyphs", "context", "plans", "digit-plans", "intensity", "motion", "axis", "theme"])) : m(J) || u.digit || l.appearance !== "plain" ? (s(), te(st, {
419
+ key: 1,
420
+ current: f.value,
421
+ start: H.value,
422
+ end: Q.value,
423
+ glyphs: P.value.localized,
424
+ context: h.value,
425
+ effect: m(J),
426
+ axis: l.axis,
427
+ order: l.digitOrder,
428
+ stagger: l.stagger,
429
+ duration: l.duration,
430
+ "digit-duration": l.digitDuration,
431
+ motion: ye.value,
432
+ timer: o.value,
433
+ accessible: ze.value,
434
+ split: l.appearance !== "plain"
435
+ }, _e({ _: 2 }, [
436
+ u.digit ? {
437
+ name: "digit",
438
+ fn: et((n) => [
439
+ k(t.$slots, "digit", O(S(n)), void 0, !0)
440
+ ]),
441
+ key: "0"
442
+ } : void 0
443
+ ]), 1032, ["current", "start", "end", "glyphs", "context", "effect", "axis", "order", "stagger", "duration", "digit-duration", "motion", "timer", "accessible", "split"])) : (s(!0), r($, { key: 2 }, tt(f.value.parts, ({ type: n, value: x }, qe) => (s(), r("span", {
444
+ key: qe,
445
+ class: be({
446
+ "hys-ui-motion-number-separator": n === "group" || n === "decimal"
447
+ })
448
+ }, b(x), 3))), 128)),
449
+ f.value.unit || u.unit ? (s(), r("span", yt, [
450
+ u.unit ? k(t.$slots, "unit", O(S(h.value)), void 0, !0, 0) : (s(), r($, { key: 1 }, [
451
+ W(b(f.value.unit), 1)
452
+ ], 64))
453
+ ])) : B("", !0)
454
+ ], 4)
455
+ ], 2)),
456
+ l.suffix || u.suffix ? (s(), r("span", gt, [
457
+ u.suffix ? k(t.$slots, "suffix", O(S(h.value)), void 0, !0, 0) : (s(), r($, { key: 1 }, [
458
+ W(b(l.suffix), 1)
459
+ ], 64))
460
+ ])) : B("", !0)
461
+ ], 12, vt),
462
+ u.trend ? k(t.$slots, "trend", O(S(d.value)), void 0, !0, 1) : B("", !0),
463
+ l.announce ? (s(), r("span", ht, b(R.value), 1)) : B("", !0)
464
+ ], 16, dt));
465
+ }
466
+ });
2
467
  export {
3
- f as default
468
+ Nt as default
4
469
  };
@@ -0,0 +1,7 @@
1
+ import a from "./NumberAnimationCanvas2.vue.js";
2
+ /* empty css */
3
+ import o from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const f = /* @__PURE__ */ o(a, [["__scopeId", "data-v-fa57fa14"]]);
5
+ export {
6
+ f as default
7
+ };
@@ -0,0 +1,166 @@
1
+ import { defineComponent as it, useTemplateRef as G, ref as ot, computed as z, watch as ct, onMounted as rt, onActivated as lt, onDeactivated as dt, onBeforeUnmount as pt, openBlock as ht, createElementBlock as ut, createElementVNode as J, toDisplayString as mt } from "vue";
2
+ import { numberTokens as A, digitCount as ft } from "../../../composables/animatedNumberDigits.js";
3
+ import { persistentDisplay as E } from "../animation/digital.js";
4
+ import { glyph as O, clamp as gt, localProgress as xt } from "../animation/paint.js";
5
+ import { paintNumberAnimation as vt } from "../animation/render.js";
6
+ const yt = ["data-painted"], wt = { class: "hys-number-canvas-text" }, zt = /* @__PURE__ */ it({
7
+ __name: "NumberAnimationCanvas",
8
+ props: {
9
+ current: {},
10
+ start: {},
11
+ end: {},
12
+ glyphs: {},
13
+ context: {},
14
+ plans: {},
15
+ digitPlans: {},
16
+ intensity: {},
17
+ motion: { type: Boolean },
18
+ axis: {},
19
+ theme: {}
20
+ },
21
+ setup(K) {
22
+ const t = K, m = G("root"), R = G("canvas"), c = ot(!1), Q = z(
23
+ () => t.current.parts.map(({ value: a }) => a).join("")
24
+ ), X = z(
25
+ () => new Map(
26
+ A(t.start.parts, !0).map(({ key: a, text: i }) => [a, i])
27
+ )
28
+ ), Y = z(
29
+ () => new Map(
30
+ A(t.end.parts, !0).map(({ key: a, text: i }) => [a, i])
31
+ )
32
+ );
33
+ let r, f = !1;
34
+ function l() {
35
+ const a = R.value, i = m.value, d = ["playing", "paused"].includes(t.context.status) && t.context.progress < 1, g = ft(t.current.parts), Z = t.motion && t.intensity > 0 && g <= 48 && g > 0;
36
+ if (!f || !a || !i || !Z || typeof window.CanvasRenderingContext2D > "u") {
37
+ c.value = !1;
38
+ return;
39
+ }
40
+ const k = [
41
+ ...t.plans,
42
+ ...Object.values(t.digitPlans).flat()
43
+ ].some(
44
+ ({ entry: s }) => (s == null ? void 0 : s.category) === "digital" && E(s.variant)
45
+ );
46
+ if (!d && !k) {
47
+ c.value = !1;
48
+ return;
49
+ }
50
+ try {
51
+ const s = a.getContext("2d"), x = a.clientWidth, v = a.clientHeight;
52
+ if (!s || !x || !v) {
53
+ c.value = !1;
54
+ return;
55
+ }
56
+ const y = Math.min(3, window.devicePixelRatio || 1), N = Math.round(x * y), S = Math.round(v * y);
57
+ a.width !== N && (a.width = N), a.height !== S && (a.height = S), s.setTransform(y, 0, 0, y, 0, 0), s.clearRect(0, 0, x, v);
58
+ const o = getComputedStyle(i), D = Number.parseFloat(o.fontSize) || 16;
59
+ s.font = `${o.fontStyle} ${o.fontWeight} ${D}px ${o.fontFamily}`, s.textAlign = "center", s.textBaseline = "middle";
60
+ const I = o.color, tt = o.getPropertyValue("--hys-ui-theme-primary").trim() || I, et = Number.parseFloat(o.letterSpacing) || 0, F = A(t.current.parts, !0), st = Math.max(
61
+ ...t.glyphs.map((e) => s.measureText(e).width)
62
+ ), H = F.map(
63
+ ({ text: e, section: p }) => (p ? st : s.measureText(e).width) + et
64
+ ), M = H.reduce((e, p) => e + p, 0), w = M > i.clientWidth + 1 && i.clientWidth > 0 ? i.clientWidth / M : 1;
65
+ let j = (x - M * w) / 2, nt = 0;
66
+ F.forEach((e, p) => {
67
+ const _ = H[p], P = e.section ? nt++ : 0, L = ((e.section ? t.digitPlans[`${e.section}:${e.position}`] ?? t.digitPlans["*"] : void 0) ?? t.plans).filter(
68
+ ({ entry: n }) => e.section || (n == null ? void 0 : n.category) === "data" && [3, 4, 5].includes(n.variant)
69
+ ), W = X.value.get(e.key) ?? (e.section ? t.glyphs[0] : e.text), C = Y.value.get(e.key) ?? e.text, b = {
70
+ ctx: s,
71
+ from: W,
72
+ to: C,
73
+ digit: e.text,
74
+ section: e.section,
75
+ glyphs: t.glyphs,
76
+ fromIndex: Math.max(0, t.glyphs.indexOf(W)),
77
+ toIndex: Math.max(0, t.glyphs.indexOf(C)),
78
+ color: I,
79
+ accent: tt,
80
+ size: D,
81
+ width: _,
82
+ count: g,
83
+ index: P
84
+ };
85
+ s.save(), s.translate(j + _ * w / 2, v / 2), s.scale(w, 1);
86
+ const V = d ? L : L.filter(
87
+ ({ entry: n }) => (n == null ? void 0 : n.category) === "digital" && E(n.variant)
88
+ );
89
+ V.length || O(
90
+ {
91
+ ...b,
92
+ p: 1,
93
+ axis: t.axis ?? "vertical",
94
+ seed: 0,
95
+ strength: 1,
96
+ cycles: 1,
97
+ plan: {}
98
+ },
99
+ e.text
100
+ ), V.forEach((n, U) => {
101
+ var q;
102
+ const h = d ? gt(
103
+ n.stagger ? xt(
104
+ t.context.progress,
105
+ P,
106
+ g,
107
+ n.stagger
108
+ ) : t.context.easedProgress
109
+ ) : 1, u = Math.min(2, (n.strength ?? 1) * t.intensity), at = ((q = n.entry) == null ? void 0 : q.category) === "digital" && E(n.entry.variant), T = {
110
+ ...b,
111
+ p: h,
112
+ strength: u,
113
+ plan: n,
114
+ cycles: n.cycles ?? 1,
115
+ seed: (n.seed ?? 37) + P * 97,
116
+ axis: n.axis ?? t.axis ?? "vertical",
117
+ to: d ? b.to : e.text,
118
+ toIndex: d ? b.toIndex : Math.max(0, t.glyphs.indexOf(e.text))
119
+ };
120
+ s.save(), s.globalAlpha *= U === 0 ? 1 : 0.62, U === 0 && u < 1 && O(T, e.text, { alpha: 1 - u }), s.globalAlpha *= Math.min(1, u), u > 0 && (h > 0 && h < 1 || at) ? vt(T) : O(T, h === 0 ? W : h === 1 ? C : e.text), s.restore();
121
+ }), s.restore(), j += _ * w;
122
+ }), c.value = !0;
123
+ } catch {
124
+ c.value = !1;
125
+ }
126
+ }
127
+ function $() {
128
+ var a;
129
+ f || (f = !0, m.value && typeof ResizeObserver < "u" && (r = new ResizeObserver(l), r.observe(m.value)), window.addEventListener("resize", l), (a = document.fonts) == null || a.ready.then(l), l());
130
+ }
131
+ function B() {
132
+ f = !1, r == null || r.disconnect(), r = void 0, window.removeEventListener("resize", l);
133
+ }
134
+ return ct(
135
+ () => [
136
+ t.current,
137
+ t.start,
138
+ t.end,
139
+ t.context,
140
+ t.plans,
141
+ t.digitPlans,
142
+ t.motion,
143
+ t.intensity,
144
+ t.axis,
145
+ t.theme
146
+ ],
147
+ l,
148
+ { flush: "post" }
149
+ ), rt($), lt($), dt(B), pt(B), (a, i) => (ht(), ut("span", {
150
+ ref_key: "root",
151
+ ref: m,
152
+ class: "hys-number-canvas",
153
+ "data-painted": c.value ? "" : void 0
154
+ }, [
155
+ J("span", wt, mt(Q.value), 1),
156
+ J("canvas", {
157
+ ref_key: "canvas",
158
+ ref: R,
159
+ "aria-hidden": "true"
160
+ }, null, 512)
161
+ ], 8, yt));
162
+ }
163
+ });
164
+ export {
165
+ zt as default
166
+ };
@@ -0,0 +1,7 @@
1
+ import o from "./NumberDigits2.vue.js";
2
+ /* empty css */
3
+ import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c4e6dfff"]]);
5
+ export {
6
+ e as default
7
+ };