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
@@ -1,140 +1,412 @@
1
- import { defineComponent as X, useAttrs as j, useSlots as q, ref as d, computed as h, watch as N, onDeactivated as G, onActivated as J, nextTick as K, onBeforeUnmount as Q, openBlock as i, createBlock as H, Teleport as Y, createVNode as O, Transition as Z, withCtx as _, createElementBlock as m, mergeProps as ee, unref as x, renderSlot as A, resolveDynamicComponent as te, normalizeClass as ae, createCommentVNode as v, createElementVNode as oe, createTextVNode as se, toDisplayString as V } from "vue";
2
- import { LoaderCircle as le, TriangleAlert as ne, Info as ie, CircleAlert as ue, CircleCheck as re, X as fe } from "lucide-vue-next";
3
- import { useHysRootAttrs as ce } from "../../config.js";
4
- import { registerToastEscape as de } from "../../composables/toastEscape.js";
5
- const me = ["role", "aria-live"], ve = {
1
+ import { defineComponent as me, useSlots as he, getCurrentInstance as ge, useAttrs as be, ref as T, shallowRef as ke, computed as g, watch as Y, onDeactivated as we, onActivated as Ce, onBeforeUnmount as xe, openBlock as u, createBlock as j, Teleport as Be, createVNode as G, Transition as Te, withCtx as Se, createElementBlock as r, mergeProps as Me, unref as l, renderSlot as L, normalizeProps as z, guardReactiveProps as D, resolveDynamicComponent as Pe, normalizeClass as I, createCommentVNode as d, createElementVNode as N, createTextVNode as J, toDisplayString as S, Fragment as $e, renderList as Oe, normalizeStyle as Ae, nextTick as oe } from "vue";
2
+ import { LoaderCircle as le, TriangleAlert as Le, Info as ze, CircleAlert as De, CircleCheck as Ee, Copy as He, X as Ie } from "lucide-vue-next";
3
+ import { useHysRootAttrs as Ne } from "../../config.js";
4
+ import { registerToastEscape as Ve } from "../../composables/toastEscape.js";
5
+ import { toastLocale as Fe, normalizeToastPosition as Re, toastDuration as Ue, toastMotion as Xe, toastPlacement as qe } from "./toastPresentation.js";
6
+ import { useToastTimer as Ke } from "./useToastTimer.js";
7
+ import { useToastSwipe as Ye } from "./useToastSwipe.js";
8
+ import { useToastActions as je } from "./useToastActions.js";
9
+ const Ge = ["data-hys-theme", "tabindex"], Je = {
6
10
  key: 0,
7
11
  class: "hys-ui-toast-icon",
8
12
  "aria-hidden": "true"
9
- }, ye = { class: "hys-ui-toast-message" }, pe = ["aria-label"], he = {
10
- key: 2,
11
- class: "hys-ui-toast-action"
12
- }, ke = /* @__PURE__ */ X({
13
+ }, Qe = { class: "hys-ui-toast-content" }, We = ["role", "aria-live"], Ze = {
14
+ key: 0,
15
+ class: "hys-ui-toast-title"
16
+ }, _e = ["aria-expanded"], et = {
17
+ key: 1,
18
+ class: "hys-ui-toast-footer"
19
+ }, tt = ["aria-label"], at = ["disabled", "aria-busy", "onClick"], ot = ["aria-label", "title"], lt = {
20
+ key: 1,
21
+ role: "status",
22
+ class: "hys-ui-toast-copy-status"
23
+ }, st = ["title"], it = ["aria-label", "disabled"], ut = ["role", "aria-label", "aria-valuenow"], mt = /* @__PURE__ */ me({
13
24
  inheritAttrs: !1,
14
25
  __name: "HysToast",
15
26
  props: {
27
+ open: { type: Boolean, default: void 0 },
28
+ teleport: { type: Boolean, default: !0 },
29
+ appendTo: { default: "body" },
30
+ repeat: { default: 1 },
31
+ paused: { type: Boolean },
16
32
  message: { default: "" },
33
+ title: {},
17
34
  type: { default: "success" },
18
- duration: {},
35
+ duration: { default: void 0 },
36
+ persistent: { type: Boolean },
19
37
  closable: { type: Boolean, default: !0 },
38
+ closeOnClick: { type: Boolean },
39
+ closeOnEscape: { type: Boolean },
40
+ keyboardDismiss: { type: Boolean },
41
+ pauseOnHover: { type: Boolean, default: !0 },
42
+ pauseOnBlur: { type: Boolean, default: !0 },
43
+ swipe: { type: Boolean },
44
+ interactive: { type: Boolean, default: !0 },
20
45
  position: { default: "top-center" },
21
46
  offset: { default: 24 },
47
+ offsetX: {},
48
+ offsetY: {},
49
+ coordinates: {},
22
50
  zIndex: { default: 2e3 },
51
+ width: {},
23
52
  showIcon: { type: Boolean, default: !0 },
24
- pauseOnHover: { type: Boolean, default: !0 },
25
- closeOnEscape: { type: Boolean },
26
- repeat: { default: 1 },
27
53
  plain: { type: Boolean },
28
- teleport: { type: Boolean, default: !0 },
29
- appendTo: { default: "body" }
54
+ glass: { type: Boolean },
55
+ theme: {},
56
+ toastStyle: {},
57
+ progressStyle: {},
58
+ progress: {},
59
+ showProgress: { type: Boolean },
60
+ countdown: { type: Boolean },
61
+ maxLines: {},
62
+ copyable: { type: Boolean },
63
+ copyText: {},
64
+ actionLayout: { default: "inline" },
65
+ actions: {},
66
+ animation: {},
67
+ direction: {},
68
+ animationDuration: {},
69
+ easing: {},
70
+ live: {},
71
+ locale: {},
72
+ beforeClose: {}
30
73
  },
31
- emits: ["close", "afterClose"],
32
- setup(e, { expose: F, emit: S }) {
33
- const a = e, w = S, E = j(), $ = q(), L = ce(), b = d(), u = d(!0), o = d(!1), C = d(!1), T = d(!1), R = h(() => a.position === "top" ? "top-center" : a.position === "bottom" ? "bottom-center" : a.position), g = h(() => Math.max(0, Number.isFinite(a.duration ?? 3e3) ? a.duration ?? (a.type === "loading" ? 0 : 3e3) : 0)), P = h(() => !!a.message || !!$.default), U = h(() => ({ success: re, error: ue, info: ie, warning: ne, loading: le })[a.type]);
34
- let y, l, f = 0, z = 0, k = !1, I = !0;
35
- function D() {
36
- clearTimeout(y), y = void 0;
74
+ emits: ["update:open", "update", "show", "afterShow", "close", "afterClose", "click", "action", "stateChange"],
75
+ setup(k, { expose: se, emit: ie }) {
76
+ const M = k, c = ie, Q = he(), V = ge(), F = be(), W = Ne(), y = T(), p = T(!0), n = T(!1), A = T(!1), w = T(!1), m = T(!1), P = T(!1), R = ke({}), e = g(() => ({ ...M, ...R.value })), f = g(() => ({ ...Fe, ...e.value.locale })), ue = g(
77
+ () => Re(e.value.position)
78
+ ), E = g(() => Ue(e.value)), Z = g(
79
+ () => ({
80
+ success: Ee,
81
+ error: De,
82
+ info: ze,
83
+ warning: Le,
84
+ loading: le,
85
+ default: void 0,
86
+ custom: void 0
87
+ })[e.value.type]
88
+ ), U = g(
89
+ () => e.value.live ?? (e.value.type === "error" ? "assertive" : "polite")
90
+ );
91
+ let H, X, q, C, x, $ = 0;
92
+ function B() {
93
+ return {
94
+ id: typeof F["data-toast-id"] == "string" ? F["data-toast-id"] : void 0,
95
+ message: e.value.message,
96
+ title: e.value.title,
97
+ type: e.value.type
98
+ };
99
+ }
100
+ function ne(t) {
101
+ var a;
102
+ n.value && ((a = V == null ? void 0 : V.vnode.props) != null && a.onUpdate || (R.value = {
103
+ ...R.value,
104
+ ...typeof t == "string" ? { message: t } : t
105
+ }), c("update", t));
37
106
  }
38
- function r() {
39
- y && (f = Math.max(0, f - (Date.now() - z))), D();
107
+ const s = je({
108
+ available: () => p.value && n.value && e.value.interactive,
109
+ locale: () => f.value,
110
+ context: B,
111
+ close: () => b("action"),
112
+ update: ne,
113
+ copyText: () => {
114
+ var t, a;
115
+ return e.value.copyText ?? (e.value.message || ((a = (t = y.value) == null ? void 0 : t.querySelector(".hys-ui-toast-message")) == null ? void 0 : a.textContent) || "");
116
+ },
117
+ emit: (t) => c("action", t)
118
+ }), i = Ye(
119
+ y,
120
+ () => e.value.swipe && e.value.interactive && n.value && !m.value,
121
+ (t) => b("swipe", t)
122
+ ), v = Ke({
123
+ running: () => p.value && n.value && !e.value.paused && !m.value && !(e.value.pauseOnHover && A.value) && !w.value && !i.dragging.value && s.busy.value === void 0,
124
+ duration: () => E.value,
125
+ indicators: () => e.value.countdown || e.value.showProgress && e.value.progress === void 0,
126
+ pauseOnBlur: () => e.value.pauseOnBlur,
127
+ expire: () => {
128
+ b("timeout");
129
+ }
130
+ }), O = g(() => {
131
+ const t = e.value.progress;
132
+ if (t === "indeterminate") return t;
133
+ if (typeof t == "number")
134
+ return Number.isFinite(t) ? Math.max(0, Math.min(100, t)) : 0;
135
+ if (e.value.showProgress && E.value > 0 && v.total.value > 0)
136
+ return v.remaining.value / v.total.value * 100;
137
+ }), re = g(() => Xe(e.value)), ve = g(() => ({
138
+ ...M.teleport ? qe(e.value) : {},
139
+ ...re.value,
140
+ "--hys-toast-drag-x": i.shift.value + "px",
141
+ "--hys-toast-drag-opacity": Math.max(
142
+ 0.38,
143
+ 1 - Math.abs(i.shift.value) / 280
144
+ ),
145
+ "--hys-toast-lines": Math.max(1, Math.floor(e.value.maxLines ?? 1)),
146
+ width: typeof e.value.width == "number" ? Math.max(0, e.value.width) + "px" : e.value.width,
147
+ ...e.value.toastStyle
148
+ }));
149
+ function _() {
150
+ const t = H;
151
+ !t || n.value || !p.value || (H = void 0, i.reset(), C != null && C.isConnected && document.activeElement === document.body && C.focus({ preventScroll: !0 }), C = void 0, c("afterClose", t), c("stateChange", "closed", t));
40
152
  }
41
- function c() {
42
- if (D(), !(!u.value || !o.value || C.value || T.value || g.value <= 0)) {
43
- if (f <= 0) {
44
- n();
45
- return;
153
+ function ee(t) {
154
+ if (!n.value) return;
155
+ $++, H = t;
156
+ const a = !!y.value;
157
+ C = w.value ? q : void 0, n.value = !1, m.value = !1, A.value = w.value = !1, s.reset(), c("stateChange", "closing", t), c("close", t), a || oe(_);
158
+ }
159
+ async function b(t = "api", a, h = !1) {
160
+ if (!n.value || !p.value || m.value && !h)
161
+ return !1;
162
+ const o = { ...B(), reason: t, event: a }, ae = $;
163
+ if (!h && e.value.beforeClose) {
164
+ m.value = !0;
165
+ let K = !1;
166
+ try {
167
+ K = await e.value.beforeClose(o) !== !1;
168
+ } catch {
169
+ K = !1;
46
170
  }
47
- z = Date.now(), y = setTimeout(n, f);
171
+ if (ae !== $) return !1;
172
+ if (!K)
173
+ return m.value = !1, !1;
48
174
  }
175
+ return M.open !== void 0 && !h ? (X = o, c("update:open", !1), await oe(), X = void 0, m.value = !1, !n.value) : (ee(o), !0);
49
176
  }
50
- function B() {
51
- f = g.value, c();
177
+ function de() {
178
+ $++, H = void 0, C = void 0, P.value = !1, n.value = !0, v.restart(), c("show", B()), c("stateChange", "visible", B());
52
179
  }
53
- function n() {
54
- o.value && (r(), o.value = !1, k || (k = !0, w("close")));
180
+ function te() {
181
+ p.value && n.value && c("afterShow", B());
55
182
  }
56
- function W() {
57
- !o.value && u.value && w("afterClose");
183
+ function ce(t) {
184
+ !e.value.interactive || !e.value.keyboardDismiss || t.target !== y.value || (t.key === "Delete" || (t.key === "Enter" || t.key === " ") && e.value.closeOnClick) && (t.preventDefault(), b("keyboard", t));
58
185
  }
59
- return N(() => [a.message, g.value, a.repeat], (s, t) => {
60
- s[0] || !t && $.default ? (o.value = !0, k = !1, B()) : !P.value || t != null && t[0] ? n() : o.value && B();
61
- }, { immediate: !0 }), N(() => o.value && u.value && a.closeOnEscape, (s) => {
62
- l == null || l(), l = s ? de(n) : void 0;
63
- }, { immediate: !0 }), G(() => {
64
- u.value = !1, r();
65
- }), J(() => {
66
- u.value = !0, K(() => I && c());
67
- }), Q(() => {
68
- I = !1, r(), l == null || l();
69
- }), F({ close: n, pause: r, resume: c, restart: B, element: b }), (s, t) => (i(), H(Y, {
70
- to: e.appendTo,
71
- disabled: !e.teleport
186
+ function pe(t) {
187
+ var a;
188
+ !w.value && t.relatedTarget instanceof HTMLElement && !((a = y.value) != null && a.contains(t.relatedTarget)) && (q = t.relatedTarget), w.value = !0;
189
+ }
190
+ function fe(t) {
191
+ var a;
192
+ (a = y.value) != null && a.contains(t.relatedTarget) || (w.value = !1, q = void 0);
193
+ }
194
+ function ye(t) {
195
+ var a;
196
+ !e.value.interactive || i.suppressClick.value || (a = t.target) != null && a.closest(
197
+ "button,a,input,textarea,select,[role=button],[contenteditable=true]"
198
+ ) || (c("click", t, B()), e.value.closeOnClick && b("click", t));
199
+ }
200
+ return Y(
201
+ () => [
202
+ M.open ?? !!(e.value.message || e.value.title || Q.default || Q.header),
203
+ e.value.message,
204
+ e.value.title
205
+ ],
206
+ ([t, a, h], o) => {
207
+ t ? !n.value && (!(o != null && o[0]) || M.open === void 0 && (a && a !== o[1] || h && h !== o[2])) && de() : ee(X ?? { ...B(), reason: "model" });
208
+ },
209
+ { immediate: !0 }
210
+ ), Y(
211
+ () => [E.value, e.value.message, M.repeat],
212
+ () => {
213
+ n.value && v.restart();
214
+ }
215
+ ), Y(
216
+ () => n.value && p.value && e.value.interactive && e.value.closeOnEscape,
217
+ (t) => {
218
+ x == null || x(), x = t ? Ve(
219
+ (a) => void b("escape", a),
220
+ () => y.value
221
+ ) : void 0;
222
+ },
223
+ { immediate: !0, flush: "sync" }
224
+ ), we(() => {
225
+ p.value = !1, $++, m.value = !1, A.value = w.value = !1, s.reset(), i.reset();
226
+ }), Ce(() => {
227
+ p.value = !0;
228
+ }), xe(() => {
229
+ $++, p.value = !1, s.reset(), x == null || x();
230
+ }), se({
231
+ close: b,
232
+ pause: v.pause,
233
+ resume: v.resume,
234
+ restart: v.restart,
235
+ extend: v.extend,
236
+ element: y,
237
+ snapshotClock: v.snapshot,
238
+ restoreClock: v.restore
239
+ }), (t, a) => (u(), j(Be, {
240
+ to: k.appendTo,
241
+ disabled: !k.teleport
72
242
  }, [
73
- O(Z, {
74
- name: "hys-ui-toast-motion",
243
+ G(Te, {
244
+ name: "hys-toast-enter",
75
245
  appear: "",
76
- onAfterLeave: W
246
+ onAfterEnter: te,
247
+ onAfterAppear: te,
248
+ onAfterLeave: _
77
249
  }, {
78
- default: _(() => [
79
- o.value && u.value ? (i(), m("div", ee({
80
- key: 0,
81
- ref_key: "element",
82
- ref: b
83
- }, { ...x(L), ...x(E) }, {
84
- class: ["hys-ui-toast", ["hys-ui-toast-" + e.type, "hys-ui-toast-position-" + R.value, { "hys-ui-toast-inline": !e.teleport, "hys-ui-toast-plain": e.plain }]],
85
- style: { "--hys-ui-toast-offset": Math.max(0, e.offset) + "px", zIndex: e.zIndex },
86
- role: e.type === "error" ? "alert" : "status",
87
- "aria-live": e.type === "error" ? "assertive" : "polite",
88
- "aria-atomic": "true",
89
- onMouseenter: t[0] || (t[0] = (p) => e.pauseOnHover && (C.value = !0, r())),
90
- onMouseleave: t[1] || (t[1] = (p) => {
91
- C.value = !1, c();
92
- }),
93
- onFocusin: t[2] || (t[2] = (p) => {
94
- T.value = !0, r();
95
- }),
96
- onFocusout: t[3] || (t[3] = (p) => {
97
- var M;
98
- return !((M = b.value) != null && M.contains(p.relatedTarget)) && (T.value = !1, c());
99
- })
100
- }), [
101
- e.showIcon ? (i(), m("span", ve, [
102
- A(s.$slots, "icon", {}, () => [
103
- (i(), H(te(U.value), {
104
- size: 18,
105
- class: ae({ "hys-ui-toast-spinner": e.type === "loading" })
106
- }, null, 8, ["class"]))
107
- ], !0)
108
- ])) : v("", !0),
109
- oe("div", ye, [
110
- A(s.$slots, "default", {}, () => [
111
- se(V(e.message), 1)
112
- ], !0)
113
- ]),
114
- e.repeat > 1 ? (i(), m("span", {
115
- key: 1,
116
- class: "hys-ui-toast-repeat",
117
- "aria-label": "重复 " + e.repeat + " 次"
118
- }, "×" + V(e.repeat), 9, pe)) : v("", !0),
119
- s.$slots.action ? (i(), m("span", he, [
120
- A(s.$slots, "action", { close: n }, void 0, !0)
121
- ])) : v("", !0),
122
- e.closable ? (i(), m("button", {
123
- key: 3,
124
- class: "hys-ui-toast-close",
125
- type: "button",
126
- "aria-label": "关闭提示",
127
- onClick: n
128
- }, [
129
- O(x(fe), { size: 14 })
130
- ])) : v("", !0)
131
- ], 16, me)) : v("", !0)
132
- ]),
250
+ default: Se(() => {
251
+ var h;
252
+ return [
253
+ n.value && p.value ? (u(), r("div", Me({
254
+ key: 0,
255
+ ref_key: "element",
256
+ ref: y
257
+ }, { ...l(W), ...l(F) }, {
258
+ "data-hys-theme": e.value.theme ?? l(W)["data-hys-theme"],
259
+ class: ["hys-ui-toast", [
260
+ "hys-ui-toast-" + e.value.type,
261
+ "hys-ui-toast-position-" + ue.value,
262
+ {
263
+ "hys-ui-toast-inline": !k.teleport,
264
+ "hys-ui-toast-plain": e.value.plain,
265
+ "hys-ui-toast-glass": e.value.glass,
266
+ "hys-ui-toast-swipe": e.value.swipe && e.value.interactive,
267
+ "hys-ui-toast-dragging": l(i).dragging.value,
268
+ "hys-ui-toast-clickable": e.value.closeOnClick && e.value.interactive,
269
+ "hys-ui-toast-bounce": e.value.animation === "bounce"
270
+ }
271
+ ]],
272
+ style: ve.value,
273
+ tabindex: e.value.keyboardDismiss && e.value.interactive ? 0 : void 0,
274
+ onMouseenter: a[3] || (a[3] = (o) => A.value = !0),
275
+ onMouseleave: a[4] || (a[4] = (o) => A.value = !1),
276
+ onFocusin: pe,
277
+ onFocusout: fe,
278
+ onClick: ye,
279
+ onKeydown: ce,
280
+ onPointerdown: a[5] || (a[5] = //@ts-ignore
281
+ (...o) => l(i).start && l(i).start(...o)),
282
+ onPointermove: a[6] || (a[6] = //@ts-ignore
283
+ (...o) => l(i).move && l(i).move(...o)),
284
+ onPointerup: a[7] || (a[7] = //@ts-ignore
285
+ (...o) => l(i).end && l(i).end(...o)),
286
+ onPointerleave: a[8] || (a[8] = //@ts-ignore
287
+ (...o) => l(i).leave && l(i).leave(...o)),
288
+ onPointercancel: a[9] || (a[9] = //@ts-ignore
289
+ (...o) => l(i).reset && l(i).reset(...o))
290
+ }), [
291
+ e.value.showIcon && (Z.value || t.$slots.icon) ? (u(), r("span", Je, [
292
+ L(t.$slots, "icon", z(D(l(s).context())), () => [
293
+ (u(), j(Pe(Z.value), {
294
+ size: 18,
295
+ class: I({ "hys-ui-toast-spinner": e.value.type === "loading" })
296
+ }, null, 8, ["class"]))
297
+ ], !0)
298
+ ])) : d("", !0),
299
+ N("div", Qe, [
300
+ N("div", {
301
+ role: U.value === "off" ? void 0 : U.value === "assertive" ? "alert" : "status",
302
+ "aria-live": U.value,
303
+ "aria-atomic": "true"
304
+ }, [
305
+ e.value.title || t.$slots.header ? (u(), r("div", Ze, [
306
+ L(t.$slots, "header", z(D(l(s).context())), () => [
307
+ J(S(e.value.title), 1)
308
+ ], !0)
309
+ ])) : d("", !0),
310
+ N("div", {
311
+ class: I(["hys-ui-toast-message", { "hys-ui-toast-clamped": e.value.maxLines && !P.value }])
312
+ }, [
313
+ L(t.$slots, "default", z(D(l(s).context())), () => [
314
+ J(S(e.value.message), 1)
315
+ ], !0)
316
+ ], 2)
317
+ ], 8, We),
318
+ e.value.maxLines && e.value.interactive ? (u(), r("button", {
319
+ key: 0,
320
+ class: "hys-ui-toast-text-action",
321
+ type: "button",
322
+ "aria-expanded": P.value,
323
+ onClick: a[0] || (a[0] = (o) => P.value = !P.value)
324
+ }, S(P.value ? f.value.collapse : f.value.expand), 9, _e)) : d("", !0),
325
+ t.$slots.footer ? (u(), r("div", et, [
326
+ L(t.$slots, "footer", z(D(l(s).context())), void 0, !0)
327
+ ])) : d("", !0)
328
+ ]),
329
+ k.repeat > 1 ? (u(), r("span", {
330
+ key: 1,
331
+ class: "hys-ui-toast-repeat",
332
+ "aria-label": f.value.repeat(k.repeat)
333
+ }, "×" + S(k.repeat), 9, tt)) : d("", !0),
334
+ e.value.interactive && (t.$slots.action || (h = e.value.actions) != null && h.length || e.value.copyable) ? (u(), r("div", {
335
+ key: 2,
336
+ class: I(["hys-ui-toast-action", {
337
+ "hys-ui-toast-action-footer": e.value.actionLayout === "footer"
338
+ }])
339
+ }, [
340
+ L(t.$slots, "action", z(D(l(s).context())), () => [
341
+ (u(!0), r($e, null, Oe(e.value.actions, (o) => (u(), r("button", {
342
+ key: o.id,
343
+ class: "hys-ui-toast-text-action",
344
+ type: "button",
345
+ disabled: o.disabled || l(s).busy.value !== void 0 && l(s).busy.value !== o.id,
346
+ "aria-busy": l(s).busy.value === o.id || void 0,
347
+ onClick: (ae) => l(s).run(o)
348
+ }, [
349
+ l(s).busy.value === o.id ? (u(), j(l(le), {
350
+ key: 0,
351
+ class: "hys-ui-toast-spinner",
352
+ size: 14,
353
+ "aria-hidden": "true"
354
+ })) : d("", !0),
355
+ J(S(o.label), 1)
356
+ ], 8, at))), 128))
357
+ ], !0),
358
+ e.value.copyable ? (u(), r("button", {
359
+ key: 0,
360
+ class: "hys-ui-toast-close",
361
+ type: "button",
362
+ "aria-label": f.value.copy,
363
+ title: f.value.copy,
364
+ onClick: a[1] || (a[1] = //@ts-ignore
365
+ (...o) => l(s).copy && l(s).copy(...o))
366
+ }, [
367
+ G(l(He), { size: 15 })
368
+ ], 8, ot)) : d("", !0),
369
+ l(s).copyStatus.value ? (u(), r("span", lt, S(l(s).copyStatus.value), 1)) : d("", !0)
370
+ ], 2)) : d("", !0),
371
+ e.value.countdown && E.value > 0 ? (u(), r("span", {
372
+ key: 3,
373
+ class: "hys-ui-toast-countdown",
374
+ title: f.value.remaining(Math.ceil(l(v).remaining.value / 1e3))
375
+ }, S(f.value.remaining(Math.ceil(l(v).remaining.value / 1e3))), 9, st)) : d("", !0),
376
+ e.value.closable && e.value.interactive ? (u(), r("button", {
377
+ key: 4,
378
+ class: "hys-ui-toast-close hys-ui-toast-dismiss",
379
+ type: "button",
380
+ "aria-label": f.value.close,
381
+ disabled: m.value,
382
+ onClick: a[2] || (a[2] = (o) => b("button", o))
383
+ }, [
384
+ G(l(Ie), { size: 14 })
385
+ ], 8, it)) : d("", !0),
386
+ O.value !== void 0 ? (u(), r("div", {
387
+ key: 5,
388
+ class: I(["hys-ui-toast-progress", {
389
+ "hys-ui-toast-progress-indeterminate": O.value === "indeterminate"
390
+ }]),
391
+ role: e.value.progress !== void 0 ? "progressbar" : void 0,
392
+ "aria-label": f.value.progress,
393
+ "aria-valuenow": typeof O.value == "number" ? Math.round(O.value) : void 0
394
+ }, [
395
+ N("span", {
396
+ style: Ae({
397
+ inlineSize: O.value === "indeterminate" ? void 0 : O.value + "%",
398
+ ...e.value.progressStyle
399
+ })
400
+ }, null, 4)
401
+ ], 10, ut)) : d("", !0)
402
+ ], 16, Ge)) : d("", !0)
403
+ ];
404
+ }),
133
405
  _: 3
134
406
  })
135
407
  ], 8, ["to", "disabled"]));
136
408
  }
137
409
  });
138
410
  export {
139
- ke as default
411
+ mt as default
140
412
  };
@@ -0,0 +1,7 @@
1
+ import o from "./ToastViewport2.vue.js";
2
+ /* empty css */
3
+ import t from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-e6680215"]]);
5
+ export {
6
+ e as default
7
+ };