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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0
4
+
5
+ - SortableList 增加垂直、水平和网格排序,支持跨列表和跨层级移动、克隆、批量排序、虚拟列表、撤销重做和异步保存回滚。拖拽结束后过渡到目标位置,临界区排序更稳定,列表文本仍可选中复制。
6
+ - Toast 增加全局调用、优先级队列、分组去重、Promise 状态与进度、异步操作、关闭拦截、拖动关闭和主题定制。新增可悬停或点击展开的层叠布局,并补充交互示例与 API。
7
+ - Tooltip 与 Popover 修复其他浮层打开时悬停退出或失焦后提示残留的问题,并调整尺寸控制示例布局。
8
+ - Search 调整带按钮的搜索框焦点边框。Modal 和 Drawer 的关闭按钮在鼠标悬停时保持位置稳定。
9
+
10
+ ## 0.5.0
11
+
12
+ - AnimatedNumber 增加逐位滚动、翻牌、进度跳转、可视区域触发和高频更新策略;支持地区格式、中文单位、精确金额、极小数值和倒计时。
13
+ - AnimatedNumber 增加 220 种动效,支持效果组合、自定义预设、按数位配置、动效减弱,以及多个指标的编排。新增可搜索的动效演示,整理实时趋势、播放控制和图表联动等示例的窄屏布局。
14
+ - Input 和 Textarea 补充提交时更新模型、原生输入属性、字符计数和表单校验集成;完善 Textarea 自动高度与示例。
15
+
3
16
  ## 0.4.0
4
17
 
5
18
  - 示例站点为新增能力补充交互示例,API 参考补全参数、事件、插槽和实例方法的具体说明。
@@ -1,7 +1,7 @@
1
1
  import o from "./HysAnimatedNumber2.vue.js";
2
- /* empty css */
2
+ /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-11d35ec9"]]);
4
+ const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-218a7172"]]);
5
5
  export {
6
- a as default
6
+ e as default
7
7
  };
@@ -1,148 +1,469 @@
1
- import { defineComponent as Z, useSlots as _, ref as G, watch as E, computed as c, onMounted as ee, onActivated as te, onDeactivated as ne, onBeforeUnmount as ae, openBlock as m, createElementBlock as v, mergeProps as ie, unref as b, renderSlot as x, createTextVNode as M, toDisplayString as N, createCommentVNode as V, createElementVNode as oe, normalizeStyle as re, normalizeProps as $, guardReactiveProps as C, createBlock as se, Fragment as ue } from "vue";
2
- import { useHysRootAttrs as le } from "../../config.js";
3
- import { useMotion as ce } from "../../motion/useMotion.js";
4
- import { decimal as me, decimalText as I, decimalRound as de } from "../../composables/numberInput.js";
5
- const fe = {
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 = {
6
12
  key: 0,
7
13
  class: "hys-ui-motion-number-title"
8
- }, ve = ["role"], pe = {
14
+ }, vt = ["role", "aria-label"], ft = {
9
15
  key: 0,
10
- class: "hys-ui-motion-number-affix"
11
- }, he = {
12
- key: 1,
13
- class: "hys-ui-motion-number-affix"
14
- }, xe = /* @__PURE__ */ Z({
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({
15
36
  __name: "HysAnimatedNumber",
16
37
  props: {
17
- value: { default: 0 },
18
- duration: { default: 650 },
19
- decimals: {},
20
- precision: {},
21
- groupSeparator: {},
22
- decimalSeparator: { default: "." },
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: {},
23
62
  title: {},
24
63
  prefix: {},
25
64
  suffix: {},
26
65
  valueStyle: { type: [Boolean, null, String, Object, Array] },
27
66
  formatter: {},
67
+ announce: { type: Boolean },
28
68
  deadline: {},
29
- format: { default: "HH:mm:ss" }
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: {}
30
104
  },
31
- emits: ["change", "finish"],
32
- setup(r, { expose: L, emit: U }) {
33
- const t = r, j = U, A = _(), X = le(), { effectiveMotion: P } = ce(), F = (e) => typeof e == "number" && !Number.isFinite(e) ? 0 : e, s = G(F(t.value));
34
- let p = 0, d = !1;
35
- function q() {
36
- if (cancelAnimationFrame(p), !d) return;
37
- const e = F(t.value), n = s.value, u = t.duration;
38
- if (typeof e != "number" || typeof n != "number" || n === e || t.deadline !== void 0 || P.value === "off" || !Number.isFinite(u) || u <= 0) {
39
- s.value = e;
40
- return;
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));
41
159
  }
42
- const a = performance.now(), o = (l) => {
43
- const R = Math.max(0, Math.min(1, (l - a) / u)), W = 1 - (1 - R) ** 3;
44
- s.value = R === 1 ? e : n * (1 - W) + e * W, R < 1 && (p = requestAnimationFrame(o));
45
- };
46
- p = requestAnimationFrame(o);
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);
47
178
  }
48
- E([() => t.value, () => t.duration, P], q);
49
- const f = c(() => {
50
- const e = t.deadline instanceof Date ? t.deadline.getTime() : t.deadline;
51
- return e !== void 0 && Number.isFinite(e) ? e : void 0;
52
- }), w = () => f.value === void 0 ? 0 : Math.max(
53
- 0,
54
- Math.min(Number.MAX_SAFE_INTEGER, f.value - Date.now())
55
- ), i = G(w()), D = c(
56
- () => t.format.match(/\[[^\]]*\]|SSS|DD?|HH?|mm?|ss?|[\s\S]/g) ?? []
57
- ), h = c(() => D.value.includes("SSS"));
58
- let H, T, k;
59
- function y() {
60
- if (clearTimeout(H), !d || f.value === void 0) return;
61
- const e = f.value;
62
- if (i.value = w(), i.value !== k && (k = i.value, j("change", i.value)), i.value === 0) {
63
- T !== e && (T = e, j("finish"));
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);
64
182
  return;
65
183
  }
66
- const n = h.value ? 16 : 1e3;
67
- H = setTimeout(
68
- y,
69
- h.value ? n : i.value % n || n
70
- );
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);
71
200
  }
72
- E(f, () => {
73
- T = void 0, k = void 0, i.value = w(), q(), y();
74
- }), E(h, y);
75
- function z() {
76
- d || (d = !0, s.value = F(t.value), y());
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());
77
222
  }
78
- function O() {
79
- d = !1, clearTimeout(H), cancelAnimationFrame(p);
223
+ function ce() {
224
+ V = !1, v == null || v.disconnect(), v = void 0, D.value = !1;
80
225
  }
81
- ee(z), te(z), ne(O), ae(O);
82
- const J = c(() => {
83
- const e = t.precision ?? t.decimals;
84
- return e === void 0 && typeof s.value == "string" ? void 0 : e !== void 0 && Number.isFinite(e) ? Math.max(0, Math.min(20, Math.floor(e))) : 0;
85
- });
86
- function K() {
87
- const e = me(s.value);
88
- if (!e) return String(s.value);
89
- const n = J.value, u = n === void 0 ? I(e) : I(de(e, n), n), [a, o] = u.split("."), l = t.groupSeparator ? a.replace(/\B(?=(\d{3})+(?!\d))/g, () => t.groupSeparator) : a;
90
- return o === void 0 ? l : l + t.decimalSeparator + o;
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(" ");
91
325
  }
92
- function Q() {
93
- let e = h.value ? Math.floor(i.value) : Math.ceil(i.value / 1e3) * 1e3;
94
- const n = { D: 864e5, H: 36e5, m: 6e4, s: 1e3, S: 1 }, u = /* @__PURE__ */ new Map();
95
- for (const [a, o] of Object.entries(n))
96
- D.value.some(
97
- (l) => l[0] === a && /^(D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS)$/.test(l)
98
- ) && (u.set(a, Math.floor(e / o)), e %= o);
99
- return D.value.map((a) => {
100
- if (a.startsWith("[") && a.endsWith("]"))
101
- return a.slice(1, -1);
102
- const o = u.get(a[0]);
103
- return o === void 0 ? a : String(o).padStart(a.length, "0");
104
- }).join("");
326
+ function Re(t) {
327
+ t.target !== w.value || t.repeat || !c("click") || !["Enter", " "].includes(t.key) || (t.preventDefault(), A("click"));
105
328
  }
106
- const S = c(() => t.deadline !== void 0), B = c(
107
- () => S.value ? Q() : K()
108
- ), g = c(() => ({
109
- value: S.value ? i.value : s.value,
110
- displayValue: B.value,
111
- remaining: S.value ? i.value : void 0
112
- })), Y = ({ value: e }) => e;
113
- return L({ displayValue: B, remaining: i }), (e, n) => (m(), v("span", ie(b(X), { class: "hys-ui-motion-number" }), [
114
- r.title || b(A).title ? (m(), v("span", fe, [
115
- x(e.$slots, "title", {}, () => [
116
- M(N(r.title), 1)
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)
117
368
  ], !0)
118
- ])) : V("", !0),
119
- oe("span", {
369
+ ])) : B("", !0),
370
+ z("span", {
120
371
  class: "hys-ui-motion-number-value",
121
- style: re(r.valueStyle),
122
- role: S.value ? "timer" : void 0
372
+ style: ee(l.valueStyle),
373
+ role: o.value ? "timer" : void 0,
374
+ "aria-label": o.value && !ge.value ? _(U.value) : void 0
123
375
  }, [
124
- r.prefix || b(A).prefix ? (m(), v("span", pe, [
125
- x(e.$slots, "prefix", $(C(g.value)), () => [
126
- M(N(r.prefix), 1)
127
- ], !0)
128
- ])) : V("", !0),
129
- x(e.$slots, "formatter", $(C(g.value)), () => [
130
- r.formatter ? (m(), se(Y, {
131
- key: 0,
132
- value: r.formatter(g.value)
133
- }, null, 8, ["value"])) : (m(), v(ue, { key: 1 }, [
134
- M(N(B.value), 1)
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)
135
459
  ], 64))
136
- ], !0),
137
- r.suffix || b(A).suffix ? (m(), v("span", he, [
138
- x(e.$slots, "suffix", $(C(g.value)), () => [
139
- M(N(r.suffix), 1)
140
- ], !0)
141
- ])) : V("", !0)
142
- ], 12, ve)
143
- ], 16));
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));
144
465
  }
145
466
  });
146
467
  export {
147
- xe as default
468
+ Nt as default
148
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
+ };