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,211 @@
1
+ import { defineComponent as T, reactive as W, computed as A, watch as P, h as v, TransitionGroup as z, Transition as H, withDirectives as I, vShow as O } from "vue";
2
+ import { provideHysConfig as B } from "../../../config.js";
3
+ import { toastStackKey as F, presentation as L } from "../../../composables/toastQueueModel.js";
4
+ import _ from "../HysToast.vue.js";
5
+ import { finite as w, toastLocale as j, normalizeToastPosition as x, toastPlacement as G } from "../toastPresentation.js";
6
+ import { useToastStackDisclosure as K } from "./useToastStackDisclosure.js";
7
+ function S(a) {
8
+ var s;
9
+ const c = x(a.options.position);
10
+ return c.startsWith("bottom") || c === "custom" && ((s = a.options.coordinates) == null ? void 0 : s.bottom) !== void 0 && a.options.coordinates.top === void 0;
11
+ }
12
+ function R(a) {
13
+ const c = x(a.options.position), s = G(a.options), l = "calc(-1 * var(--hys-toast-stack-padding))", m = c === "center" || c.endsWith("center");
14
+ return {
15
+ ...s,
16
+ maxWidth: `calc(${s.maxWidth} + var(--hys-toast-stack-padding) * 2)`,
17
+ marginTop: s.top !== void 0 && c !== "center" ? l : void 0,
18
+ marginBottom: s.bottom !== void 0 ? l : void 0,
19
+ marginLeft: s.left !== void 0 && !m ? l : void 0,
20
+ marginRight: s.right !== void 0 ? l : void 0
21
+ };
22
+ }
23
+ function U(a, c, s) {
24
+ const l = x(a.options.position);
25
+ return {
26
+ flexDirection: c === "horizontal" ? "row" : S(a) ? "column-reverse" : "column",
27
+ flexWrap: c === "horizontal" ? "wrap" : "nowrap",
28
+ justifyContent: c === "horizontal" ? l.endsWith("right") ? "flex-end" : l.endsWith("left") ? "flex-start" : "center" : void 0,
29
+ alignItems: l.endsWith("left") ? "flex-start" : l.endsWith("right") ? "flex-end" : "center",
30
+ gap: Math.max(0, s) + "px"
31
+ };
32
+ }
33
+ const X = T({
34
+ name: "HysToastViewport",
35
+ props: {
36
+ queue: {
37
+ type: Object,
38
+ required: !0
39
+ },
40
+ skin: {
41
+ type: Function,
42
+ required: !0
43
+ }
44
+ },
45
+ setup(a) {
46
+ const c = W(/* @__PURE__ */ new Set()), s = K(), l = A(() => {
47
+ const t = /* @__PURE__ */ new Map();
48
+ for (const e of a.queue.records.values()) {
49
+ if (e.status === "queued") continue;
50
+ const o = F(e.options), d = t.get(o);
51
+ d ? d.push(e) : t.set(o, [e]);
52
+ }
53
+ return t;
54
+ });
55
+ P(
56
+ [l, () => a.queue.settings.value.layout],
57
+ ([t, e]) => {
58
+ s.retain(
59
+ e === "layered" ? [...t].filter(([, o]) => o.length > 1).map(([o]) => o) : []
60
+ );
61
+ for (const o of c) t.has(o) || c.delete(o);
62
+ }
63
+ ), B({
64
+ theme: () => a.skin()["data-hys-theme"],
65
+ motion: () => a.skin()["data-hys-motion"]
66
+ });
67
+ const m = (t) => (e) => typeof t == "function" ? t(e) : t;
68
+ function q(t, e, o, d, f) {
69
+ const { queue: u } = a, i = t.options, h = S(t), r = Array.from(
70
+ { length: d },
71
+ (n, p) => v("span", {
72
+ key: "layer-" + p,
73
+ class: "hys-ui-toast-layer-preview",
74
+ "aria-hidden": "true",
75
+ style: { "--hys-toast-layer-depth": p + 1, zIndex: -(p + 1) },
76
+ onClick: a.queue.settings.value.layerTrigger === "hover" ? void 0 : () => s.toggle(o)
77
+ })
78
+ ), g = v(
79
+ "div",
80
+ {
81
+ class: [
82
+ "hys-ui-toast-stack-item",
83
+ {
84
+ "hys-ui-toast-layered-front": d,
85
+ "hys-ui-toast-layered-bottom": d && h
86
+ }
87
+ ],
88
+ style: d ? { "--hys-toast-stack-depth": d } : void 0,
89
+ ...d && i.theme ? { "data-hys-ui": "", "data-hys-theme": i.theme } : {},
90
+ inert: e || void 0,
91
+ "aria-hidden": e || void 0
92
+ },
93
+ [
94
+ ...r,
95
+ v(
96
+ _,
97
+ {
98
+ ...L(i),
99
+ teleport: !1,
100
+ repeat: t.repeat,
101
+ paused: t.paused || f && i.pauseOnHover !== !1,
102
+ interactive: !e && i.interactive !== !1,
103
+ ref: (n) => u.setInstance(
104
+ t,
105
+ n,
106
+ o
107
+ ),
108
+ "data-toast-id": t.id,
109
+ onUpdate: t.handle.update,
110
+ onShow: (n) => {
111
+ t.shown || t.status !== "visible" || (t.shown = !0, u.notify(t.options.onShow, n));
112
+ },
113
+ onAfterShow: (n) => {
114
+ t.entered || t.status !== "visible" || (t.entered = !0, u.notify(t.options.onAfterShow, n));
115
+ },
116
+ onClose: (n) => u.begin(t, n),
117
+ onAfterClose: () => u.finish(t),
118
+ onClick: (n, p) => u.notify(t.options.onClick, n, p),
119
+ onAction: (n) => u.notify(t.options.onAction, n)
120
+ },
121
+ {
122
+ ...i.content !== void 0 ? { default: m(i.content) } : {},
123
+ ...i.icon !== void 0 ? { icon: m(i.icon) } : {},
124
+ ...i.header !== void 0 ? { header: m(i.header) } : {},
125
+ ...i.footer !== void 0 ? { footer: m(i.footer) } : {},
126
+ ...i.renderActions !== void 0 ? { action: m(i.renderActions) } : {}
127
+ }
128
+ )
129
+ ]
130
+ );
131
+ return v(
132
+ H,
133
+ { key: t.serial, name: "hys-ui-toast-stack-expand" },
134
+ {
135
+ default: () => I(g, [[O, !e]])
136
+ }
137
+ );
138
+ }
139
+ return () => {
140
+ const { queue: t } = a, e = t.settings.value;
141
+ return [...l.value].map(([o, d]) => {
142
+ const f = e.layout === "layered", u = f ? 1 : Math.max(0, Math.floor(w(e.collapsedCount, 0))), i = d.sort(t.order), h = u ? Math.max(0, i.length - u) : 0, r = s.stacks.get(o), g = f && e.layerTrigger !== "click", n = f ? !!(r != null && r.pinned || g && (r != null && r.preview || r != null && r.focused)) : c.has(o), p = f && !n ? Math.min(
143
+ h,
144
+ Math.min(
145
+ 4,
146
+ Math.max(1, Math.floor(w(e.layerCount, 3)) - 1)
147
+ )
148
+ ) : 0, k = { ...j, ...e.locale }, C = i.map(
149
+ (y, b) => q(
150
+ y,
151
+ !n && !!h && b >= u,
152
+ o,
153
+ b === 0 ? p : 0,
154
+ !!(g && (r != null && r.preview))
155
+ )
156
+ );
157
+ h && C.push(
158
+ v(
159
+ "button",
160
+ {
161
+ key: "stack-toggle",
162
+ type: "button",
163
+ class: "hys-ui-toast-stack-toggle",
164
+ "aria-expanded": n,
165
+ onClick: () => {
166
+ f ? s.toggle(o) : n ? c.delete(o) : c.add(o);
167
+ }
168
+ },
169
+ (f ? r != null && r.pinned : n) ? k.collapseStack : f && n ? k.pinStack : k.more(h)
170
+ )
171
+ );
172
+ const M = v(
173
+ z,
174
+ {
175
+ tag: "div",
176
+ moveClass: "hys-ui-toast-stack-move",
177
+ class: [
178
+ "hys-ui-toast-stack-items",
179
+ { "hys-ui-toast-stack-hover": g && h }
180
+ ],
181
+ ...g && h ? {
182
+ onPointerenter: (y) => s.enter(o, y),
183
+ onPointerleave: () => s.leave(o),
184
+ onFocusin: () => s.focusIn(o),
185
+ onFocusout: (y) => s.focusOut(o, y)
186
+ } : {},
187
+ style: U(
188
+ i[0],
189
+ e.layout ?? "vertical",
190
+ w(e.gap, 10)
191
+ )
192
+ },
193
+ { default: () => C }
194
+ );
195
+ return v(
196
+ "div",
197
+ {
198
+ key: o,
199
+ ...a.skin(),
200
+ class: "hys-ui-toast-stack",
201
+ style: R(i[0])
202
+ },
203
+ [M]
204
+ );
205
+ });
206
+ };
207
+ }
208
+ });
209
+ export {
210
+ X as default
211
+ };
@@ -0,0 +1,71 @@
1
+ import { reactive as v, onBeforeUnmount as g } from "vue";
2
+ function m() {
3
+ const r = v(/* @__PURE__ */ new Map()), s = /* @__PURE__ */ new Map();
4
+ function o(e) {
5
+ clearTimeout(s.get(e)), s.delete(e);
6
+ }
7
+ function u(e, t, n) {
8
+ s.set(
9
+ e,
10
+ setTimeout(() => {
11
+ s.delete(e), t();
12
+ }, n)
13
+ );
14
+ }
15
+ function c(e) {
16
+ return r.has(e) || r.set(e, {
17
+ pinned: !1,
18
+ preview: !1,
19
+ focused: !1,
20
+ suppressHover: !1
21
+ }), r.get(e);
22
+ }
23
+ function f(e, t) {
24
+ if (t.pointerType === "touch") return;
25
+ const n = c(e);
26
+ o(e), n.suppressHover || u(
27
+ e,
28
+ () => {
29
+ n.preview = !0;
30
+ },
31
+ 110
32
+ );
33
+ }
34
+ function a(e) {
35
+ const t = r.get(e);
36
+ t && (o(e), t.suppressHover = !1, u(
37
+ e,
38
+ () => {
39
+ t.preview = !1;
40
+ },
41
+ 140
42
+ ));
43
+ }
44
+ function p(e) {
45
+ const t = c(e);
46
+ if (!t.pinned) {
47
+ t.pinned = !0;
48
+ return;
49
+ }
50
+ o(e), t.pinned = t.preview = t.focused = !1, t.suppressHover = !0;
51
+ }
52
+ function l(e) {
53
+ const t = r.get(e);
54
+ t && (t.pinned || t.preview) && (t.focused = !0);
55
+ }
56
+ function d(e, t) {
57
+ const n = r.get(e);
58
+ n && !t.currentTarget.contains(
59
+ t.relatedTarget
60
+ ) && (n.focused = !1);
61
+ }
62
+ function i(e) {
63
+ const t = new Set(e);
64
+ for (const n of r.keys())
65
+ t.has(n) || (o(n), r.delete(n));
66
+ }
67
+ return g(() => i([])), { stacks: r, enter: f, leave: a, toggle: p, focusIn: l, focusOut: d, retain: i };
68
+ }
69
+ export {
70
+ m as useToastStackDisclosure
71
+ };
@@ -0,0 +1,98 @@
1
+ const m = {
2
+ close: "关闭提示",
3
+ copy: "复制消息",
4
+ copied: "已复制",
5
+ copyFailed: "无法复制消息",
6
+ expand: "展开内容",
7
+ collapse: "收起内容",
8
+ collapseStack: "收起提示列表",
9
+ pinStack: "固定展开提示列表",
10
+ remaining: (t) => t + " 秒后关闭",
11
+ repeat: (t) => "重复 " + t + " 次",
12
+ more: (t) => "展开其余 " + t + " 条提示",
13
+ actionFailed: "操作失败,请重试",
14
+ progress: "任务进度"
15
+ };
16
+ function c(t = "top-center") {
17
+ return t === "top" ? "top-center" : t === "bottom" ? "bottom-center" : t;
18
+ }
19
+ const r = (t, e) => Number.isFinite(t) ? t : e, p = (t) => t.persistent ? 0 : Math.min(
20
+ 2147483647,
21
+ Math.max(
22
+ 0,
23
+ r(t.duration, t.type === "loading" ? 0 : 3e3)
24
+ )
25
+ );
26
+ function u(t) {
27
+ const e = c(t.position), n = Math.max(0, r(t.offsetX, r(t.offset, 24))), i = Math.max(0, r(t.offsetY, r(t.offset, 24))), o = {
28
+ position: "fixed",
29
+ zIndex: t.zIndex ?? 2e3,
30
+ maxWidth: `min(calc(100vw - ${Math.min(48, Math.max(16, n)) * 2}px), calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 16px))`
31
+ };
32
+ if (e === "custom") {
33
+ const a = t.coordinates;
34
+ return {
35
+ ...o,
36
+ top: (a == null ? void 0 : a.bottom) === void 0 ? `${i}px` : void 0,
37
+ left: (a == null ? void 0 : a.right) === void 0 ? `${n}px` : void 0,
38
+ ...a
39
+ };
40
+ }
41
+ if (e === "center")
42
+ return { ...o, top: "50%", left: "50%", translate: "-50% -50%" };
43
+ const s = e.startsWith("bottom") ? "bottom" : "top";
44
+ return o[s] = `max(${i}px, env(safe-area-inset-${s}, 0px))`, e.endsWith("left") ? o.left = `max(${n}px, env(safe-area-inset-left, 0px))` : e.endsWith("right") ? o.right = `max(${n}px, env(safe-area-inset-right, 0px))` : Object.assign(o, { left: "50%", translate: "-50% 0" }), o;
45
+ }
46
+ function f(t) {
47
+ const e = c(t.position);
48
+ return t.direction ? t.direction : e.endsWith("left") ? "left" : e.endsWith("right") ? "right" : e.startsWith("bottom") ? "bottom" : "top";
49
+ }
50
+ function l(t, e) {
51
+ if (typeof t != "function") return t ?? e;
52
+ try {
53
+ const i = `linear(${Array.from(
54
+ { length: 21 },
55
+ (o, s) => r(t(s / 20), s / 20)
56
+ ).join(",")})`;
57
+ return typeof CSS > "u" || CSS.supports("animation-timing-function", i) ? i : e;
58
+ } catch {
59
+ return e;
60
+ }
61
+ }
62
+ function x(t) {
63
+ const e = f(t), n = t.animation ?? "scale", i = {
64
+ top: "translateY(-16px)",
65
+ bottom: "translateY(16px)",
66
+ left: "translateX(-20px)",
67
+ right: "translateX(20px)"
68
+ }[e], o = typeof n == "object" ? n.enterFrom : {
69
+ fade: "none",
70
+ slide: i,
71
+ scale: "scale(.96)",
72
+ spring: i + " scale(.92)",
73
+ bounce: i + " scale(.93)",
74
+ rotate: "rotate(-6deg) scale(.96)",
75
+ none: "none"
76
+ }[n], s = n === "spring" ? "cubic-bezier(.18,.9,.32,1.45)" : n === "bounce" ? "cubic-bezier(.34,1.56,.64,1)" : "var(--hys-ui-motion-ease, ease)", a = typeof n == "object" ? n.leaveTo ?? o : o;
77
+ return {
78
+ "--hys-toast-enter": o,
79
+ "--hys-toast-recoil": {
80
+ top: "translateY(4px)",
81
+ bottom: "translateY(-4px)",
82
+ left: "translateX(4px)",
83
+ right: "translateX(-4px)"
84
+ }[e],
85
+ "--hys-toast-leave": a === "none" ? "translate(0)" : a,
86
+ "--hys-toast-motion-opacity": typeof n == "object" ? n.opacity ?? 0 : 0,
87
+ "--hys-toast-motion-duration": n === "none" ? "0ms" : t.animationDuration === void 0 ? "var(--hys-ui-motion-base, 200ms)" : Math.max(0, r(t.animationDuration, 200)) + "ms",
88
+ "--hys-toast-motion-easing": l(t.easing, s)
89
+ };
90
+ }
91
+ export {
92
+ r as finite,
93
+ c as normalizeToastPosition,
94
+ p as toastDuration,
95
+ m as toastLocale,
96
+ x as toastMotion,
97
+ u as toastPlacement
98
+ };
@@ -0,0 +1,62 @@
1
+ import { ref as v } from "vue";
2
+ function y(e, u) {
3
+ const r = typeof e == "function" ? e(u) : e;
4
+ return typeof r == "string" ? { message: r } : r;
5
+ }
6
+ function x(e) {
7
+ const u = v(), r = v("");
8
+ let a = 0;
9
+ async function d() {
10
+ if (!e.available()) return !1;
11
+ const t = a;
12
+ try {
13
+ return await navigator.clipboard.writeText(e.copyText()), t === a && (r.value = e.locale().copied), !0;
14
+ } catch {
15
+ return t === a && (r.value = e.locale().copyFailed), !1;
16
+ }
17
+ }
18
+ function i() {
19
+ return {
20
+ ...e.context(),
21
+ close: e.close,
22
+ update: e.update,
23
+ copy: d
24
+ };
25
+ }
26
+ async function b(t) {
27
+ var n;
28
+ if (!e.available() || u.value !== void 0 || t.disabled)
29
+ return;
30
+ const s = a, f = e.context();
31
+ u.value = t.id, e.emit({ ...f, action: t, status: "start" });
32
+ try {
33
+ const l = await ((n = t.run) == null ? void 0 : n.call(t, i()));
34
+ if (s !== a || !e.available()) return;
35
+ const c = y(t.success, l);
36
+ c && e.update({ type: "success", ...c }), e.emit({ ...f, action: t, status: "success", result: l }), t.closeOnSuccess !== !1 && await e.close();
37
+ } catch (l) {
38
+ if (s !== a || !e.available()) return;
39
+ let c;
40
+ try {
41
+ c = y(t.error, l);
42
+ } catch {
43
+ c = void 0;
44
+ }
45
+ e.update({
46
+ type: "error",
47
+ message: e.locale().actionFailed,
48
+ ...c
49
+ }), e.emit({ ...f, action: t, status: "error", result: l });
50
+ } finally {
51
+ s === a && (u.value = void 0);
52
+ }
53
+ }
54
+ function m() {
55
+ a++, u.value = void 0, r.value = "";
56
+ }
57
+ return { busy: u, copyStatus: r, copy: d, context: i, run: b, reset: m };
58
+ }
59
+ export {
60
+ y as feedback,
61
+ x as useToastActions
62
+ };
@@ -0,0 +1,48 @@
1
+ import { ref as f } from "vue";
2
+ function y(s, d, h) {
3
+ const o = f(0), u = f(!1), n = f(!1);
4
+ let a;
5
+ function l() {
6
+ var e, r;
7
+ const t = a == null ? void 0 : a.id;
8
+ a = void 0, t !== void 0 && ((r = (e = s.value) == null ? void 0 : e.hasPointerCapture) != null && r.call(e, t)) && s.value.releasePointerCapture(t), u.value = !1, o.value = 0;
9
+ }
10
+ function v(t) {
11
+ var e;
12
+ n.value = !1, !(a || !d() || t.button !== 0 || (e = t.target) != null && e.closest(
13
+ "button,a,input,textarea,select,[role=button],[contenteditable=true]"
14
+ )) && (a = { id: t.pointerId, x: t.clientX, y: t.clientY });
15
+ }
16
+ function p(t) {
17
+ var i, c;
18
+ if (t.pointerId !== (a == null ? void 0 : a.id)) return;
19
+ const e = t.clientX - a.x, r = t.clientY - a.y;
20
+ if (!(!u.value && Math.hypot(e, r) < 7)) {
21
+ if (!u.value && Math.abs(r) > Math.abs(e)) {
22
+ l();
23
+ return;
24
+ }
25
+ u.value || ((c = (i = s.value) == null ? void 0 : i.setPointerCapture) == null || c.call(i, t.pointerId), u.value = !0, n.value = !0), o.value = e, t.cancelable && t.preventDefault();
26
+ }
27
+ }
28
+ async function b(t) {
29
+ var i;
30
+ if (t.pointerId !== (a == null ? void 0 : a.id)) return;
31
+ const e = Math.min(
32
+ 110,
33
+ Math.max(44, (((i = s.value) == null ? void 0 : i.offsetWidth) ?? 240) * 0.26)
34
+ );
35
+ if (!u.value || Math.abs(o.value) < e) {
36
+ l();
37
+ return;
38
+ }
39
+ await h(t) ? a = void 0 : l();
40
+ }
41
+ function x(t) {
42
+ (a == null ? void 0 : a.id) === t.pointerId && !u.value && l();
43
+ }
44
+ return { shift: o, dragging: u, suppressClick: n, reset: l, start: v, move: p, end: b, leave: x };
45
+ }
46
+ export {
47
+ y as useToastSwipe
48
+ };
@@ -0,0 +1,90 @@
1
+ import { ref as m, watch as E, onMounted as L, onBeforeUnmount as p } from "vue";
2
+ const f = /* @__PURE__ */ new Set();
3
+ let o = !1;
4
+ function c() {
5
+ for (const e of f) e(o || document.hidden);
6
+ }
7
+ function x() {
8
+ o = !0, c();
9
+ }
10
+ function b() {
11
+ o = !1, c();
12
+ }
13
+ function y(e) {
14
+ return f.size || (window.addEventListener("blur", x), window.addEventListener("focus", b), document.addEventListener("visibilitychange", c)), f.add(e), e(o || document.hidden), () => {
15
+ f.delete(e), !f.size && (o = !1, window.removeEventListener("blur", x), window.removeEventListener("focus", b), document.removeEventListener("visibilitychange", c));
16
+ };
17
+ }
18
+ function D(e) {
19
+ const t = m(0), u = m(0), v = m(!1), w = m(!1);
20
+ let l, a = 0, r = !1, s;
21
+ function i() {
22
+ clearTimeout(l), l = void 0, a && (t.value = Math.max(0, a - Date.now())), a = 0;
23
+ }
24
+ function h() {
25
+ const n = Math.max(0, a - Date.now());
26
+ if (t.value = n, n === 0) {
27
+ a = 0, l = void 0, r = !0, e.expire();
28
+ return;
29
+ }
30
+ l = setTimeout(h, e.indicators() ? Math.min(n, 100) : n);
31
+ }
32
+ function d() {
33
+ if (i(), !(typeof window > "u") && !(!e.running() || v.value || e.pauseOnBlur() && w.value || !u.value || r)) {
34
+ if (t.value <= 0) {
35
+ r = !0, e.expire();
36
+ return;
37
+ }
38
+ a = Date.now() + t.value, l = setTimeout(
39
+ h,
40
+ e.indicators() ? Math.min(t.value, 100) : t.value
41
+ );
42
+ }
43
+ }
44
+ function g() {
45
+ i(), r = !1, t.value = u.value = e.duration(), d();
46
+ }
47
+ function M(n) {
48
+ !u.value || !Number.isFinite(n) || n <= 0 || (i(), r = !1, t.value = Math.min(2147483647, t.value + n), u.value = Math.min(2147483647, u.value + n), d());
49
+ }
50
+ return E(
51
+ [
52
+ e.running,
53
+ e.indicators,
54
+ e.pauseOnBlur,
55
+ v,
56
+ w
57
+ ],
58
+ d,
59
+ { flush: "sync" }
60
+ ), L(() => {
61
+ s = y((n) => {
62
+ w.value = n;
63
+ });
64
+ }), p(() => {
65
+ s == null || s(), i();
66
+ }), {
67
+ remaining: t,
68
+ total: u,
69
+ restart: g,
70
+ extend: M,
71
+ stop: i,
72
+ snapshot: () => ({
73
+ remaining: a ? Math.max(0, a - Date.now()) : t.value,
74
+ total: u.value,
75
+ expired: r
76
+ }),
77
+ restore(n) {
78
+ i(), t.value = n.remaining, u.value = n.total, r = n.expired, d();
79
+ },
80
+ pause: () => {
81
+ v.value = !0;
82
+ },
83
+ resume: () => {
84
+ v.value = !1;
85
+ }
86
+ };
87
+ }
88
+ export {
89
+ D as useToastTimer
90
+ };
@@ -0,0 +1,106 @@
1
+ const I = [
2
+ "odometer",
3
+ "wheel",
4
+ "flip",
5
+ "slot",
6
+ "random",
7
+ "scramble",
8
+ "appear",
9
+ "disappear"
10
+ ];
11
+ function w(t) {
12
+ return t.reduce(
13
+ (i, { type: r, value: a }) => i + (r === "integer" || r === "fraction" ? [...a].length : 0),
14
+ 0
15
+ );
16
+ }
17
+ function $(t, i) {
18
+ let r = t.filter(({ type: n }) => n === "integer").reduce((n, s) => n + [...s.value].length, 0), a = 0;
19
+ return t.flatMap(({ type: n, value: s }, l) => !i || n !== "integer" && n !== "fraction" ? [{ key: `${n}-${l}`, text: s, type: n, position: 0 }] : [...s].map((f) => {
20
+ const d = n === "integer" ? --r : ++a;
21
+ return {
22
+ key: `${n}-digit-${d}`,
23
+ text: f,
24
+ type: n,
25
+ position: d,
26
+ section: n
27
+ };
28
+ }));
29
+ }
30
+ function N(t, i) {
31
+ const r = { integer: "", fraction: "" };
32
+ for (const a of t.parts)
33
+ (a.type === "integer" || a.type === "fraction") && (r[a.type] += [...a.value].map((n) => Math.max(0, i.indexOf(n))).join(""));
34
+ return r;
35
+ }
36
+ function B(t, i, r) {
37
+ var p, M;
38
+ const a = N(t, r), n = N(i, r), s = Math.max(a.fraction.length, n.fraction.length), l = (e) => BigInt(e.integer + e.fraction.padEnd(s, "0")), f = l(a), d = l(n), g = t.unit === i.unit && ((p = t.parts.find(({ type: e }) => e === "exponentInteger")) == null ? void 0 : p.value) === ((M = i.parts.find(({ type: e }) => e === "exponentInteger")) == null ? void 0 : M.value);
39
+ return (e) => {
40
+ const u = e.section === "integer" ? s + e.position : s - e.position, o = 10n ** BigInt(Math.max(0, u)), h = f / o, m = d / o, c = m - h, x = Number(h % 10n), v = Number(m % 10n), P = c > 40n ? 30 + Number(c % 10n) : c < -40n ? -30 + Number(c % 10n) : Number(c);
41
+ return {
42
+ offset: x,
43
+ destination: v,
44
+ steps: g ? P : v - x,
45
+ carry: g && o > 1n && c !== 0n && c >= -40n && c <= 40n ? {
46
+ start: Number(f % o * 1000000n / o) / 1e6,
47
+ end: Number(d % o * 1000000n / o) / 1e6
48
+ } : void 0,
49
+ fromPresent: e.position < a.integer.length && e.section === "integer" || e.position <= a.fraction.length && e.section === "fraction",
50
+ toPresent: e.position < n.integer.length && e.section === "integer" || e.position <= n.fraction.length && e.section === "fraction"
51
+ };
52
+ };
53
+ }
54
+ const b = (t) => (t % 10 + 10) % 10;
55
+ function E(t, i, r, a, n) {
56
+ const { offset: s, destination: l, steps: f } = i, d = f < 0 ? -1 : 1, g = (u) => (Math.imul(u + 23, 2246822519) ^ Math.imul(a + 17, 3266489917)) >>> 0;
57
+ if (t === "scramble") {
58
+ const u = r * 24, o = Math.floor(u);
59
+ return {
60
+ first: n[o === 0 ? s : g(o) % 10],
61
+ second: n[o >= 23 ? l : g(o + 1) % 10],
62
+ phase: u - o,
63
+ direction: d,
64
+ changed: !0
65
+ };
66
+ }
67
+ if (t === "odometer" && i.carry) {
68
+ const { start: u, end: o } = i.carry, h = u + (f + o - u) * r, m = Math.floor(h), c = Math.max(
69
+ 0.9,
70
+ m === 0 ? u : 0,
71
+ m === f ? o : 0
72
+ );
73
+ return {
74
+ first: n[b(s + m)],
75
+ second: n[b(s + m + 1)],
76
+ phase: Math.max(0, (h - m - c) / (1 - c)),
77
+ direction: 1,
78
+ changed: !0
79
+ };
80
+ }
81
+ if (t === "odometer" || t === "wheel" || t === "slot") {
82
+ const u = (l - s + 10 * d) % 10, o = t === "slot" ? 20 * d + u : t === "wheel" ? u : f, h = Math.abs(o) * r, m = Math.floor(h), c = s + m * d;
83
+ return {
84
+ first: n[b(c)],
85
+ second: n[b(c + d)],
86
+ phase: h - m,
87
+ direction: d,
88
+ changed: o !== 0
89
+ };
90
+ }
91
+ const p = Math.floor(Math.min(r, 0.87) * 37), M = t === "random" && p > 0 ? g(p) % 10 : s, e = t === "appear" || t === "disappear";
92
+ return {
93
+ first: e && !i.fromPresent ? "" : n[M],
94
+ second: e && !i.toPresent ? "" : n[l],
95
+ phase: t === "random" ? Math.max(0, (r - 0.87) / 0.13) : r,
96
+ direction: d,
97
+ changed: s !== l || t === "random" || e && i.fromPresent !== i.toPresent
98
+ };
99
+ }
100
+ export {
101
+ B as createDigitTracks,
102
+ w as digitCount,
103
+ I as digitEffects,
104
+ E as digitMotion,
105
+ $ as numberTokens
106
+ };