hys-ui 0.4.0 → 0.6.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 (152) hide show
  1. package/CHANGELOG.md +13 -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/HysDrawer/HysDrawer.vue.js +1 -1
  22. package/dist/components/HysDrawer/HysDrawer2.vue.js +2 -2
  23. package/dist/components/HysFormItem/HysFormItem.vue.js +1 -1
  24. package/dist/components/HysFormItem/HysFormItem2.vue.js +231 -229
  25. package/dist/components/HysInput/HysInput.vue.js +2 -2
  26. package/dist/components/HysInput/HysInput2.vue.js +327 -274
  27. package/dist/components/HysModal/HysModal.vue.js +2 -2
  28. package/dist/components/HysModal/HysModal2.vue.js +38 -38
  29. package/dist/components/HysSearch/HysSearch.vue.js +2 -2
  30. package/dist/components/HysSortableList/HysSortableList.vue.js +2 -2
  31. package/dist/components/HysSortableList/HysSortableList2.vue.js +498 -129
  32. package/dist/components/HysSortableList/SortableGhost/SortableGhost.vue.js +7 -0
  33. package/dist/components/HysSortableList/SortableGhost/SortableGhost2.vue.js +43 -0
  34. package/dist/components/HysSortableList/SortableGhost/useSortGhost.js +54 -0
  35. package/dist/components/HysSortableList/geometry.js +230 -0
  36. package/dist/components/HysSortableList/model.js +254 -0
  37. package/dist/components/HysSortableList/transactions.js +281 -0
  38. package/dist/components/HysSortableList/useSortDrag.js +270 -0
  39. package/dist/components/HysSortableList/useSortKeyboard.js +72 -0
  40. package/dist/components/HysSortableList/useSortWindow.js +144 -0
  41. package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
  42. package/dist/components/HysToast/HysToast.vue.js +3 -3
  43. package/dist/components/HysToast/HysToast2.vue.js +379 -107
  44. package/dist/components/HysToast/ToastViewport/ToastViewport.vue.js +7 -0
  45. package/dist/components/HysToast/ToastViewport/ToastViewport2.vue.js +211 -0
  46. package/dist/components/HysToast/ToastViewport/useToastStackDisclosure.js +71 -0
  47. package/dist/components/HysToast/toastPresentation.js +98 -0
  48. package/dist/components/HysToast/useToastActions.js +62 -0
  49. package/dist/components/HysToast/useToastSwipe.js +48 -0
  50. package/dist/components/HysToast/useToastTimer.js +90 -0
  51. package/dist/composables/animatedNumberDigits.js +106 -0
  52. package/dist/composables/animatedNumberFormat.js +222 -0
  53. package/dist/composables/animatedNumberTiming.js +66 -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/popupReferenceBinding.js +41 -0
  58. package/dist/composables/textInput.js +23 -14
  59. package/dist/composables/toastEscape.js +18 -10
  60. package/dist/composables/toastQueue.js +276 -0
  61. package/dist/composables/toastQueueModel.js +86 -0
  62. package/dist/composables/toastTasks.js +58 -0
  63. package/dist/composables/useHysAnimatedNumber.js +264 -0
  64. package/dist/composables/useHysNumberAnimationGroup.js +23 -0
  65. package/dist/composables/useHysToast.js +117 -135
  66. package/dist/composables/usePopupSurface.js +190 -356
  67. package/dist/composables/usePopupSurfaceInteractions.js +172 -0
  68. package/dist/composables/useTextareaSize.js +62 -46
  69. package/dist/index.js +125 -111
  70. package/dist/style.css +1 -1
  71. package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +88 -49
  72. package/dist/types/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.d.ts +19 -0
  73. package/dist/types/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.d.ts +31 -0
  74. package/dist/types/components/HysAnimatedNumber/animation/digital.d.ts +3 -0
  75. package/dist/types/components/HysAnimatedNumber/animation/morph.d.ts +2 -0
  76. package/dist/types/components/HysAnimatedNumber/animation/paint.d.ts +44 -0
  77. package/dist/types/components/HysAnimatedNumber/animation/particles.d.ts +5 -0
  78. package/dist/types/components/HysAnimatedNumber/animation/paths.d.ts +12 -0
  79. package/dist/types/components/HysAnimatedNumber/animation/physics.d.ts +2 -0
  80. package/dist/types/components/HysAnimatedNumber/animation/render.d.ts +2 -0
  81. package/dist/types/components/HysAnimatedNumber/animation/reveal.d.ts +2 -0
  82. package/dist/types/components/HysAnimatedNumber/animation/rolling.d.ts +2 -0
  83. package/dist/types/components/HysAnimatedNumber/animation/scenarios.d.ts +4 -0
  84. package/dist/types/components/HysAnimatedNumber/animation/spatial.d.ts +2 -0
  85. package/dist/types/components/HysAnimatedNumber/useNumberCountdown.d.ts +8 -0
  86. package/dist/types/components/HysAnimatedNumber/useNumberVisuals.d.ts +12 -0
  87. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +11 -2
  88. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
  89. package/dist/types/components/HysCard/HysCard.vue.d.ts +1 -1
  90. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +3 -3
  91. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +2 -2
  92. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +2 -2
  93. package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +3 -3
  94. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +5 -5
  95. package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
  96. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +1 -1
  97. package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
  98. package/dist/types/components/HysGantt/HysGantt.vue.d.ts +1 -1
  99. package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
  100. package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
  101. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
  102. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +1 -1
  103. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +1 -1
  104. package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
  105. package/dist/types/components/HysSortableList/HysSortableList.vue.d.ts +48 -25
  106. package/dist/types/components/HysSortableList/SortableGhost/SortableGhost.vue.d.ts +31 -0
  107. package/dist/types/components/HysSortableList/SortableGhost/useSortGhost.d.ts +23 -0
  108. package/dist/types/components/HysSortableList/geometry.d.ts +35 -0
  109. package/dist/types/components/HysSortableList/model.d.ts +61 -0
  110. package/dist/types/components/HysSortableList/sortableList.d.ts +151 -0
  111. package/dist/types/components/HysSortableList/transactions.d.ts +10 -0
  112. package/dist/types/components/HysSortableList/useSortDrag.d.ts +25 -0
  113. package/dist/types/components/HysSortableList/useSortKeyboard.d.ts +17 -0
  114. package/dist/types/components/HysSortableList/useSortWindow.d.ts +16 -0
  115. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
  116. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +1 -1
  117. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +1 -1
  118. package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +13 -2
  119. package/dist/types/components/HysToast/HysToast.vue.d.ts +44 -46
  120. package/dist/types/components/HysToast/ToastViewport/ToastViewport.vue.d.ts +25 -0
  121. package/dist/types/components/HysToast/ToastViewport/useToastStackDisclosure.d.ts +16 -0
  122. package/dist/types/components/HysToast/toastPresentation.d.ts +8 -0
  123. package/dist/types/components/HysToast/toastTypes.d.ts +212 -0
  124. package/dist/types/components/HysToast/useToastActions.d.ts +18 -0
  125. package/dist/types/components/HysToast/useToastSwipe.d.ts +11 -0
  126. package/dist/types/components/HysToast/useToastTimer.d.ts +22 -0
  127. package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
  128. package/dist/types/components/HysTour/HysTour.vue.d.ts +1 -1
  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/drawer.d.ts +1 -1
  136. package/dist/types/composables/numberAnimation.d.ts +29 -0
  137. package/dist/types/composables/numberAnimationCatalog.d.ts +58 -0
  138. package/dist/types/composables/numberAnimationSequence.d.ts +13 -0
  139. package/dist/types/composables/popupReferenceBinding.d.ts +9 -0
  140. package/dist/types/composables/textInput.d.ts +39 -4
  141. package/dist/types/composables/toastEscape.d.ts +1 -1
  142. package/dist/types/composables/toastQueue.d.ts +121 -0
  143. package/dist/types/composables/toastQueueModel.d.ts +116 -0
  144. package/dist/types/composables/toastTasks.d.ts +2 -0
  145. package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
  146. package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
  147. package/dist/types/composables/useHysToast.d.ts +4 -48
  148. package/dist/types/composables/usePopupSurface.d.ts +20 -20
  149. package/dist/types/composables/usePopupSurfaceInteractions.d.ts +33 -0
  150. package/dist/types/composables/useTextareaSize.d.ts +5 -2
  151. package/dist/types/index.d.ts +15 -6
  152. package/package.json +1 -1
@@ -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
+ };
@@ -0,0 +1,105 @@
1
+ import { defineComponent as z, useSlots as A, computed as l, openBlock as r, createElementBlock as c, Fragment as b, renderList as I, normalizeStyle as L, renderSlot as j, mergeProps as w, createElementVNode as P, toDisplayString as g, normalizeClass as G } from "vue";
2
+ import { digitCount as v, numberTokens as R, createDigitTracks as V, digitMotion as X } from "../../../composables/animatedNumberDigits.js";
3
+ import { bounded as u } from "../../../composables/animatedNumberFormat.js";
4
+ const $ = ["role", "aria-label", "data-effect", "data-axis", "data-timer-motion"], q = { class: "hys-number-face hys-number-face-first" }, H = { class: "hys-number-face hys-number-face-second" }, Q = /* @__PURE__ */ z({
5
+ __name: "NumberDigits",
6
+ props: {
7
+ current: {},
8
+ start: {},
9
+ end: {},
10
+ glyphs: {},
11
+ context: {},
12
+ effect: {},
13
+ axis: {},
14
+ order: {},
15
+ stagger: {},
16
+ duration: {},
17
+ digitDuration: {},
18
+ motion: { type: Boolean },
19
+ timer: { type: Boolean },
20
+ accessible: { type: Boolean },
21
+ split: { type: Boolean }
22
+ },
23
+ setup(s) {
24
+ const e = s, p = A(), x = l(
25
+ () => e.motion && !e.timer && e.context.progress < 1 && ["delayed", "playing", "paused"].includes(e.context.status)
26
+ ), S = l(
27
+ () => e.effect === "appear" || e.effect === "disappear"
28
+ ), C = l(
29
+ () => v(e.start.parts) > v(e.end.parts) ? e.start : e.end
30
+ ), B = l(() => {
31
+ const n = x.value && S.value && !p.digit ? C.value : e.current;
32
+ return R(
33
+ n.parts,
34
+ v(n.parts) <= 48 && (!!e.effect || !!p.digit || e.split)
35
+ );
36
+ }), D = l(
37
+ () => e.effect && !e.timer && V(e.start, e.end, e.glyphs)
38
+ ), F = l(() => {
39
+ const n = B.value.filter((t) => t.section).length;
40
+ let E = 0;
41
+ return B.value.map((t) => {
42
+ if (!t.section) return { token: t };
43
+ const o = E++, y = e.order === "low-to-high" ? n - 1 - o : o, i = u(e.duration, 650, 1, Number.MAX_SAFE_INTEGER), m = u(e.stagger, 0, 0, i / Math.max(1, n)), h = y * m, M = u(
44
+ e.digitDuration,
45
+ i - h,
46
+ 1,
47
+ i - h
48
+ ), N = e.context.progress, f = m || e.digitDuration !== void 0 ? u((N * i - h) / M, 0, 0, 1) : u(e.context.easedProgress, N, 0, 1), d = x.value && D.value ? D.value(t) : void 0, a = d && (f < 1 || S.value) && e.effect ? X(e.effect, d, f, o, e.glyphs) : void 0, T = {
49
+ ...e.context,
50
+ digit: t.text,
51
+ index: o,
52
+ position: t.position,
53
+ section: t.section,
54
+ digitProgress: f
55
+ };
56
+ return {
57
+ token: t,
58
+ context: T,
59
+ face: d && f === 1 && d.toPresent ? e.glyphs[d.destination] : t.text,
60
+ track: a != null && a.changed ? a : void 0,
61
+ style: a ? {
62
+ "--number-phase": a.phase,
63
+ "--number-direction": a.direction
64
+ } : void 0
65
+ };
66
+ });
67
+ });
68
+ return (n, E) => (r(), c("span", {
69
+ class: "hys-number-digits",
70
+ role: s.accessible ? "img" : void 0,
71
+ "aria-label": s.accessible ? s.current.parts.map(({ value: t }) => t).join("") : void 0,
72
+ "data-effect": s.effect,
73
+ "data-axis": s.axis,
74
+ "data-timer-motion": s.timer && s.motion && s.effect ? "" : void 0
75
+ }, [
76
+ (r(!0), c(b, null, I(F.value, ({ token: t, context: o, face: y, track: i, style: m }) => (r(), c(b, {
77
+ key: t.key
78
+ }, [
79
+ o ? (r(), c("span", {
80
+ key: 0,
81
+ class: "hys-ui-motion-number-digit",
82
+ style: L(m)
83
+ }, [
84
+ p.digit ? j(n.$slots, "digit", w({ ref_for: !0 }, o), void 0, !0, 0) : i ? (r(), c(b, { key: 1 }, [
85
+ P("span", q, g(i.first), 1),
86
+ P("span", H, g(i.second), 1)
87
+ ], 64)) : (r(), c("span", {
88
+ key: s.timer ? t.text : void 0,
89
+ class: "hys-number-face hys-number-timer-face"
90
+ }, g(y), 1))
91
+ ], 4)) : (r(), c("span", {
92
+ key: 1,
93
+ class: G({
94
+ "hys-ui-motion-number-separator": t.type === "group" || t.type === "decimal",
95
+ "hys-ui-motion-number-currency": t.type === "currency",
96
+ "hys-ui-motion-number-sign": t.type === "plusSign" || t.type === "minusSign"
97
+ })
98
+ }, g(t.text), 3))
99
+ ], 64))), 128))
100
+ ], 8, $));
101
+ }
102
+ });
103
+ export {
104
+ Q as default
105
+ };
@@ -0,0 +1,186 @@
1
+ import { rollingGlyph as I, noise as k, glyph as d, rectangle as S, wave as W, smooth as _ } from "./paint.js";
2
+ import { glyphMask as C } from "./particles.js";
3
+ import { tracePath as E, digitPath as R } from "./paths.js";
4
+ const Z = [
5
+ "abcdef",
6
+ "bc",
7
+ "abged",
8
+ "abgcd",
9
+ "fgbc",
10
+ "afgcd",
11
+ "afgecd",
12
+ "abc",
13
+ "abcdefg",
14
+ "abfgcd"
15
+ ], j = {
16
+ a: [-0.2, -0.41, 0.2, -0.41],
17
+ b: [0.22, -0.37, 0.22, -0.04],
18
+ c: [0.22, 0.04, 0.22, 0.37],
19
+ d: [-0.2, 0.41, 0.2, 0.41],
20
+ e: [-0.22, 0.04, -0.22, 0.37],
21
+ f: [-0.22, -0.37, -0.22, -0.04],
22
+ g: [-0.2, 0, 0.2, 0]
23
+ };
24
+ function q(s, l, e) {
25
+ const { ctx: o, size: h, color: p, accent: f } = s;
26
+ o.save(), o.lineWidth = (e === 3 ? 0.045 : 0.075) * h, o.lineCap = e === 3 ? "butt" : "round";
27
+ const c = Z[l] ?? "";
28
+ for (const [b, [t, y, r, u]] of Object.entries(j))
29
+ o.globalAlpha = c.includes(b) ? 1 : 0.14, o.strokeStyle = e === 3 ? p : f, o.beginPath(), o.moveTo(t * h, y * h), e === 1 && y === u && (o.lineTo(-0.022 * h, u * h), o.moveTo(0.022 * h, u * h)), o.lineTo(r * h, u * h), o.stroke();
30
+ e === 1 && (o.lineWidth = 0.035 * h, [
31
+ [-0.18, -0.35, -0.025, -0.05],
32
+ [0.18, -0.35, 0.025, -0.05],
33
+ [-0.18, 0.35, -0.025, 0.05],
34
+ [0.18, 0.35, 0.025, 0.05],
35
+ [0, -0.37, 0, -0.05],
36
+ [0, 0.05, 0, 0.37]
37
+ ].forEach(([t, y, r, u], n) => {
38
+ o.globalAlpha = (l + n) % 4 === 0 ? 0.65 : 0.12, o.beginPath(), o.moveTo(t * h, y * h), o.lineTo(r * h, u * h), o.stroke();
39
+ })), o.restore();
40
+ }
41
+ function B(s, l, e) {
42
+ const { p: o, width: h, size: p, ctx: f, accent: c } = s, b = h / p / 2;
43
+ d(s, e, {
44
+ alpha: l === 14 ? 0.78 : 0.9,
45
+ color: l === 14 ? c : void 0
46
+ });
47
+ for (let t = 0; t < (l === 20 ? 12 : 8); t++) {
48
+ const y = -0.54 + t * (l === 20 ? 0.09 : 0.135);
49
+ (l !== 20 || Math.floor(o * 12) > t) && S(
50
+ s,
51
+ -b,
52
+ y,
53
+ b * 2,
54
+ 0.035,
55
+ () => d(s, e, { color: c, alpha: 0.55, glow: 0.09 })
56
+ );
57
+ }
58
+ S(
59
+ s,
60
+ -b,
61
+ -0.58 + o * 1.16,
62
+ b * 2,
63
+ 0.05,
64
+ () => d(s, e, { color: c, glow: 0.2 })
65
+ ), l === 19 && (f.save(), f.strokeStyle = c, f.globalAlpha *= 0.7 * W(o), f.lineWidth = 0.025 * p, f.beginPath(), f.arc(0, 0, 0.43 * p, 0, o * Math.PI * 2), f.stroke(), f.restore());
66
+ }
67
+ function X(s, l) {
68
+ const {
69
+ ctx: e,
70
+ p: o,
71
+ from: h,
72
+ to: p,
73
+ toIndex: f,
74
+ size: c,
75
+ width: b,
76
+ accent: t,
77
+ color: y,
78
+ seed: r,
79
+ strength: u
80
+ } = s, n = W(o) * u, w = o > 0.85 ? 1 : Math.floor(o * 28), T = Math.floor(k(r, w) * 10), P = o >= 0.84 ? p : I(s, T);
81
+ if (l <= 3) {
82
+ const x = o === 1 ? f : o < 0.24 ? s.fromIndex : o < 0.68 ? T : f;
83
+ if (l !== 2) q(s, x, l);
84
+ else {
85
+ e.save(), e.fillStyle = t;
86
+ for (const [g, i] of C(
87
+ I(s, x),
88
+ e.font,
89
+ c,
90
+ 5
91
+ ))
92
+ e.beginPath(), e.arc(g * c, i * c, c * 0.038, 0, Math.PI * 2), e.fill();
93
+ e.restore();
94
+ }
95
+ return;
96
+ }
97
+ if ([6, 7, 8, 9, 22, 23, 24, 25].includes(l)) {
98
+ const g = {
99
+ 6: "0101ヲヌ",
100
+ 7: "01",
101
+ 8: "ABCDEF0123456789",
102
+ 9: "#@?&XYZ",
103
+ 22: "9876543210",
104
+ 23: "01Zフォ",
105
+ 24: ">_0123456789",
106
+ 25: "_"
107
+ }[l], i = g[Math.floor(k(r + 6, w) * g.length)], M = o < (l === 24 ? 0.58 : 0.84) ? i : p;
108
+ (l === 23 || l === 22 || l === 6) && d(s, i, {
109
+ y: -0.5 + o * 0.55,
110
+ alpha: 0.35 * n,
111
+ color: t
112
+ }), d(s, M, {
113
+ color: t,
114
+ glow: 0.08 * n,
115
+ x: l === 22 ? -0.35 * (1 - o) : 0
116
+ }), l === 25 && w % 2 === 0 && d(s, "_", { x: 0.32, y: 0.04, alpha: n, color: t });
117
+ return;
118
+ }
119
+ if ([5, 13, 14, 19, 20, 21, 26, 29].includes(l)) {
120
+ if (B(s, l, o < 0.28 ? h : p), l === 5 && d(s, p, {
121
+ y: -0.08 * n,
122
+ sx: 0.92,
123
+ alpha: 0.45 * n,
124
+ color: t,
125
+ glow: 0.13
126
+ }), l === 21 || l === 29) {
127
+ e.save(), e.fillStyle = t, e.globalAlpha *= 0.24 * n;
128
+ const x = b / c / 5;
129
+ for (let g = 0; g < 8; g++)
130
+ for (let i = 0; i < 5; i++) {
131
+ const M = l === 21 ? g / 8 + i * 0.025 < o : k(r + i, g) < o, z = l === 29 ? (k(r + g, i) - 0.5) * 0.7 * (1 - o) : 0, D = l === 29 ? (k(r + i + 9, g) - 0.5) * 0.8 * (1 - o) : 0;
132
+ M && e.fillRect(
133
+ ((i - 2.5) * x + z) * c,
134
+ ((g - 4) * 0.13 + D) * c,
135
+ x * c - 1,
136
+ 0.13 * c - 1
137
+ );
138
+ }
139
+ e.restore();
140
+ }
141
+ l === 26 && (e.save(), e.strokeStyle = t, e.lineWidth = 0.018 * c, e.globalAlpha *= 0.6, e.strokeRect(-b * 0.5, -0.54 * c, b, 1.08 * c), e.restore());
142
+ return;
143
+ }
144
+ if ([10, 11, 12].includes(l)) {
145
+ d(s, P);
146
+ const x = (k(r, w) - 0.5) * n * 0.35;
147
+ if (l === 12)
148
+ d(s, P, { color: "#ff416b", x: -n * 0.09, alpha: 0.66 * n }), d(s, P, { color: "#04b7ff", x: n * 0.09, alpha: 0.7 * n });
149
+ else {
150
+ const g = b / c;
151
+ for (let i = 0; i < 4; i++)
152
+ S(s, -g, -0.46 + i * 0.24, g * 2, 0.1, () => {
153
+ d(s, l === 10 ? P : p, {
154
+ color: t,
155
+ alpha: 0.75 * n,
156
+ x: x * (i % 2 ? 1 : -1)
157
+ });
158
+ });
159
+ }
160
+ return;
161
+ }
162
+ (l === 28 || l === 16) && E(s, R(f), _(o), {
163
+ color: t,
164
+ alpha: 0.8 * n,
165
+ width: l === 28 ? 0.023 : 0.036
166
+ });
167
+ const A = l === 17 ? o : l === 18 ? 1 - o : n;
168
+ d(s, h, { alpha: (1 - o) ** 3 }), d(s, p, {
169
+ alpha: 0.4 + 0.6 * o,
170
+ color: l === 4 ? t : y,
171
+ glow: (l === 4 ? 0.18 : 0.28 * A) * u
172
+ }), [15, 17, 18, 27].includes(l) && (e.save(), e.strokeStyle = t, e.globalAlpha *= 0.65 * n, e.lineWidth = 0.021 * c, e.beginPath(), e.ellipse(
173
+ 0,
174
+ 0,
175
+ (0.25 + 0.23 * A) * c,
176
+ (0.37 + 0.25 * A) * c,
177
+ 0,
178
+ 0,
179
+ Math.PI * 2 * (l === 27 ? 1 : A)
180
+ ), e.stroke(), e.restore());
181
+ }
182
+ const Y = (s) => [0, 1, 2, 3, 4, 14, 26].includes(s);
183
+ export {
184
+ X as paintDigital,
185
+ Y as persistentDisplay
186
+ };
@@ -0,0 +1,110 @@
1
+ import { mix as d, noise as I, glyph as i, clamp as P, smooth as B, wave as z } from "./paint.js";
2
+ import { digitPath as _, tracePath as x } from "./paths.js";
3
+ function E(c, n) {
4
+ const { fromIndex: j, toIndex: k, from: g, to: w, p: o, strength: q, ctx: p, size: m, seed: y } = c, h = [8, 9, 16].includes(n) ? B(o) : o, t = z(h) * q, A = _(j), b = _(k), a = A.map(([u, M], r) => {
5
+ const s = d(u, b[r][0], h), e = d(M, b[r][1], h), f = I(y, r) - 0.5;
6
+ switch (n) {
7
+ case 3:
8
+ return [s + f * t * 0.25, e + (r % 3 - 1) * t * 0.1];
9
+ case 4:
10
+ return [s * (1 - t * 0.75), e];
11
+ case 5:
12
+ return [
13
+ s + Math.sin(e * 10 - h * 8) * 0.17 * t,
14
+ e + Math.cos(s * 8 + h * 6) * 0.12 * t
15
+ ];
16
+ case 6:
17
+ return [
18
+ s * (1 + t * 0.45),
19
+ e * (1 - t * 0.3) + Math.sin(r * 0.5) * 0.055 * t
20
+ ];
21
+ case 7:
22
+ return [s * (1 + t * 0.25), e + (e + 0.4) ** 2 * t * 0.52];
23
+ case 8:
24
+ return [s * (1 - t * 0.22), e * (1 + t * 0.55)];
25
+ case 9:
26
+ return [s * (1 + t * 0.43), e * (1 - t * 0.52)];
27
+ case 10:
28
+ return [s + Math.sin(e * 6) * 0.36 * t, e - s * 0.2 * t];
29
+ case 11:
30
+ return [
31
+ s * Math.cos(t) - e * Math.sin(t),
32
+ s * Math.sin(t) + e * Math.cos(t)
33
+ ];
34
+ case 12:
35
+ return [
36
+ s + 0.8 * f * t,
37
+ e + 0.5 * (I(y + 1, r) - 0.5) * t
38
+ ];
39
+ case 13:
40
+ return [
41
+ d(s, Math.round(s * 4) / 4, t),
42
+ d(e, Math.round(e * 4) / 4, t)
43
+ ];
44
+ case 14:
45
+ return [s + 0.06 * (r % 2 ? -1 : 1) * t, e];
46
+ case 15:
47
+ return [
48
+ s + e ** 2 * t * 0.85,
49
+ e + Math.sin(s * 10) * 0.1 * t
50
+ ];
51
+ case 16:
52
+ return [
53
+ s + Math.sin(r * 0.24) * t * 0.035,
54
+ e + Math.cos(r * 0.24) * t * 0.035
55
+ ];
56
+ case 17:
57
+ return [s + Math.sign(s) * t * 0.26, e];
58
+ case 19:
59
+ return [
60
+ s + Math.sin(r / 3 - h * 15) * 0.08 * t,
61
+ e + Math.cos(r / 3 - h * 15) * 0.08 * t
62
+ ];
63
+ default:
64
+ return [s, e];
65
+ }
66
+ }), l = Math.min(1, z(o) * 4);
67
+ if (i(c, g, { alpha: P(1 - o * 5) }), i(c, w, { alpha: P((o - 0.8) * 5) }), n === 12 || n === 3) {
68
+ for (let u = 0; u < a.length - 2; u += 3)
69
+ x(c, a.slice(u, u + 3), 1, {
70
+ alpha: l,
71
+ width: 0.065
72
+ });
73
+ return;
74
+ }
75
+ if (n === 18) {
76
+ i(c, g, {
77
+ alpha: (1 - o) * l,
78
+ sx: 1 + t * 0.15,
79
+ color: c.accent,
80
+ blur: 0.035 * t
81
+ }), i(c, w, {
82
+ alpha: o * l,
83
+ sy: 1 - t * 0.25,
84
+ blur: 0.025 * t
85
+ });
86
+ return;
87
+ }
88
+ if (n === 2 || n === 19) {
89
+ p.save(), p.translate(0.035 * m, 0), x(c, a, 1, {
90
+ alpha: l,
91
+ width: 0.035,
92
+ color: c.accent,
93
+ smooth: !0
94
+ }), p.translate(-0.07 * m, 0), x(c, a, 1, { alpha: l, width: 0.035, smooth: !0 }), p.restore();
95
+ return;
96
+ }
97
+ x(
98
+ c,
99
+ n === 14 ? a.filter((u, M) => M % 4 === 0 || M === a.length - 1) : a,
100
+ 1,
101
+ {
102
+ alpha: l,
103
+ width: n === 4 ? 0.035 : n === 6 ? 0.18 : n === 1 ? 0.075 : 0.11,
104
+ smooth: ![1, 13, 14].includes(n)
105
+ }
106
+ );
107
+ }
108
+ export {
109
+ E as paintMorph
110
+ };
@@ -0,0 +1,34 @@
1
+ const s = (t) => Math.min(1, Math.max(0, t)), M = (t, l, n) => t + (l - t) * n, p = (t) => Math.sin(Math.PI * s(t)), y = (t) => s(t) ** 2 * (3 - 2 * s(t)), b = (t, l) => ((Math.imul(l + 13, 2246822507) ^ Math.imul(t + 37, 3266489909)) >>> 0) / 4294967296;
2
+ function d(t, l, n = {}) {
3
+ const { ctx: o, color: r, size: a } = t, {
4
+ x: e = 0,
5
+ y: i = 0,
6
+ sx: c = 1,
7
+ sy: h = 1,
8
+ angle: u = 0,
9
+ alpha: x = 1,
10
+ blur: f = 0,
11
+ stroke: g = 0,
12
+ glow: m = 0
13
+ } = n;
14
+ !l || x <= 0 || c <= 0 || h <= 0 || (o.save(), o.globalAlpha *= s(x), o.translate(e * a, i * a), u && o.rotate(u), o.scale(c, h), o.fillStyle = o.strokeStyle = n.color ?? r, f && (o.filter = `blur(${a * f}px)`), m && (o.shadowBlur = a * m, o.shadowColor = n.color ?? r), g ? (o.lineJoin = "round", o.lineWidth = a * g, o.strokeText(l, 0, 0)) : o.fillText(l, 0, 0), o.restore());
15
+ }
16
+ function w(t, l, n, o, r, a) {
17
+ const { ctx: e, size: i } = t;
18
+ e.save(), e.beginPath(), e.rect(l * i, n * i, Math.max(0, o) * i, Math.max(0, r) * i), e.clip(), a(), e.restore();
19
+ }
20
+ function k(t, l, n, o) {
21
+ return s((t - l / Math.max(1, n - 1) * o) / (1 - o));
22
+ }
23
+ const v = (t, l) => t.glyphs[(l % 10 + 10) % 10] ?? t.digit;
24
+ export {
25
+ s as clamp,
26
+ d as glyph,
27
+ k as localProgress,
28
+ M as mix,
29
+ b as noise,
30
+ w as rectangle,
31
+ v as rollingGlyph,
32
+ y as smooth,
33
+ p as wave
34
+ };
@@ -0,0 +1,51 @@
1
+ import { glyph as S, clamp as P, mix as q, wave as D, noise as I, smooth as H } from "./paint.js";
2
+ const u = /* @__PURE__ */ new Map();
3
+ function E(i, t, d, p = 3) {
4
+ const o = t.replace(/\d+(?:\.\d+)?px/, "40px"), s = `${i}/${o}/${p}`, x = u.get(s);
5
+ if (x) return x;
6
+ const c = document.createElement("canvas");
7
+ c.width = c.height = 60;
8
+ const e = c.getContext("2d", { willReadFrequently: !0 });
9
+ if (!e || !d) return [];
10
+ e.font = o, e.textAlign = "center", e.textBaseline = "middle", e.fillText(i, 30, 30);
11
+ const f = e.getImageData(0, 0, 60, 60).data, a = [];
12
+ for (let g = 2; g < 59; g += p)
13
+ for (let n = 2; n < 59; n += p)
14
+ f[(g * 60 + n) * 4 + 3] > 110 && a.push([(n - 30) / 40, (g - 30) / 40]);
15
+ return u.size >= 128 && u.delete(u.keys().next().value), u.set(s, a), a;
16
+ }
17
+ function K(i, t) {
18
+ const { from: d, to: p, p: o, size: s, strength: x, seed: c, ctx: e, accent: f, color: a } = i, n = ![1, 4, 6, 9, 14, 18, 19].includes(t), T = n ? o : 1 - o, h = (1 - H(T)) * x, W = n ? p : d, m = [3, 4, 5, 6, 7].includes(t), z = [10, 11, 12, 13, 14, 15].includes(t), A = [16, 17, 18, 19].includes(t);
19
+ S(i, d, {
20
+ alpha: n ? (1 - o) ** 4 : P(1 - o * 5),
21
+ blur: t === 10 ? 0.07 : 0
22
+ }), S(i, p, { alpha: n ? P((o - 0.63) / 0.37) : o ** 3 });
23
+ const $ = E(
24
+ W,
25
+ e.font,
26
+ s,
27
+ t === 5 ? 7 : m ? 5 : 3
28
+ ), j = P(D(o) * 2.5), B = [2, 5, 15].includes(t) ? E(d, e.font, s, m ? 5 : 3) : [];
29
+ for (let l = 0; l < $.length; l++) {
30
+ const [w, k] = $[l], b = I(c + t * 31, l) * 2 * Math.PI, C = 0.28 + I(c + 79, l) * 0.73, G = t === 9 ? 0.94 * o ** 2 : t === 8 ? -0.62 * h : 0, y = z ? Math.sin(w * 11 + k * 4 + o * 8) * h * 0.28 : 0, M = B[l % B.length], F = M ? q(M[0], w, o) + y : w + Math.cos(b) * C * h * (t === 19 ? 1.8 : 1) + y, R = M ? q(M[1], k, o) - y : k + Math.sin(b) * C * h + G - y, r = m ? t === 5 ? 0.09 : 0.057 : z ? 0.034 + 0.025 * h : 0.02 + I(c + 11, l) * 0.024;
31
+ e.save(), e.globalAlpha *= j * (t === 17 ? 0.55 + 0.45 * Math.sin(o * 16 + l) ** 2 : 1), e.fillStyle = A || l % 6 === 0 ? f : a, A && (e.shadowColor = f, e.shadowBlur = s * 0.11), m ? (e.translate(F * s, R * s), (t === 6 || t === 7) && e.rotate(b * h), e.fillRect(-r * s / 2, -r * s / 2, r * s, r * s)) : (e.beginPath(), e.ellipse(
32
+ F * s,
33
+ R * s,
34
+ r * s,
35
+ r * s * (t === 13 ? 2 : 1),
36
+ 0,
37
+ 0,
38
+ Math.PI * 2
39
+ ), e.fill()), e.restore();
40
+ }
41
+ if (t === 11 || t === 19) {
42
+ e.save(), e.strokeStyle = f, e.globalAlpha *= 0.5 * D(o), e.lineWidth = 0.018 * s;
43
+ for (let l = 0; l < (t === 11 ? 3 : 1); l++)
44
+ e.beginPath(), e.arc(0, 0, (0.1 + o * (0.63 + l * 0.21)) * s, 0, Math.PI * 2), e.stroke();
45
+ e.restore();
46
+ }
47
+ }
48
+ export {
49
+ E as glyphMask,
50
+ K as paintParticles
51
+ };