@wow-two-beta/fe 0.0.49 → 0.0.51

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 (195) hide show
  1. package/dist/feedback/FeedbackBus.d.ts +154 -29
  2. package/dist/feedback/FeedbackBus.js +264 -27
  3. package/dist/feedback/FeedbackBus.js.map +1 -1
  4. package/dist/feedback/index.d.ts +1 -1
  5. package/dist/feedback/index.js +3 -1
  6. package/dist/foundation/dom/enums/ElementTag.d.ts +2 -0
  7. package/dist/foundation/dom/enums/ElementTag.js +3 -1
  8. package/dist/foundation/dom/enums/ElementTag.js.map +1 -1
  9. package/dist/index.js +404 -382
  10. package/dist/index.js.map +1 -1
  11. package/dist/presentation/actions/button/Button.variants.d.ts +12 -0
  12. package/dist/presentation/actions/button/Button.variants.js +18 -2
  13. package/dist/presentation/actions/button/Button.variants.js.map +1 -1
  14. package/dist/presentation/actions/button/Button.vue.d.ts +8 -1
  15. package/dist/presentation/actions/button/Button.vue.js +106 -58
  16. package/dist/presentation/actions/button/Button.vue.js.map +1 -1
  17. package/dist/presentation/actions/refreshButton/RefreshButton.vue.js.map +1 -1
  18. package/dist/presentation/display/badge/Badge.variants.d.ts +23 -1
  19. package/dist/presentation/display/badge/Badge.variants.js +18 -3
  20. package/dist/presentation/display/badge/Badge.variants.js.map +1 -1
  21. package/dist/presentation/display/badge/Badge.vue.d.ts +3 -0
  22. package/dist/presentation/display/badge/Badge.vue.js +10 -4
  23. package/dist/presentation/display/badge/Badge.vue.js.map +1 -1
  24. package/dist/presentation/display/carousel/Carousel.variants.d.ts +65 -0
  25. package/dist/presentation/display/carousel/Carousel.variants.js +56 -0
  26. package/dist/presentation/display/carousel/Carousel.variants.js.map +1 -0
  27. package/dist/presentation/display/carousel/Carousel.vue.d.ts +7 -0
  28. package/dist/presentation/display/carousel/Carousel.vue.js +7 -2
  29. package/dist/presentation/display/carousel/Carousel.vue.js.map +1 -1
  30. package/dist/presentation/display/carousel/CarouselContext.d.ts +10 -0
  31. package/dist/presentation/display/carousel/CarouselContext.js.map +1 -1
  32. package/dist/presentation/display/carousel/CarouselNext.vue.d.ts +6 -2
  33. package/dist/presentation/display/carousel/CarouselNext.vue.js +12 -4
  34. package/dist/presentation/display/carousel/CarouselNext.vue.js.map +1 -1
  35. package/dist/presentation/display/carousel/CarouselPrev.vue.d.ts +6 -2
  36. package/dist/presentation/display/carousel/CarouselPrev.vue.js +12 -4
  37. package/dist/presentation/display/carousel/CarouselPrev.vue.js.map +1 -1
  38. package/dist/presentation/display/carousel/CarouselViewport.vue.d.ts +13 -2
  39. package/dist/presentation/display/carousel/CarouselViewport.vue.js +54 -2
  40. package/dist/presentation/display/carousel/CarouselViewport.vue.js.map +1 -1
  41. package/dist/presentation/display/carousel/index.d.ts +1 -0
  42. package/dist/presentation/display/index.d.ts +1 -0
  43. package/dist/presentation/display/index.js +120 -108
  44. package/dist/presentation/display/index.js.map +1 -1
  45. package/dist/presentation/display/mediaCard/MediaCard.vue.d.ts +41 -0
  46. package/dist/presentation/display/mediaCard/MediaCard.vue.js +108 -0
  47. package/dist/presentation/display/mediaCard/MediaCard.vue.js.map +1 -0
  48. package/dist/presentation/display/mediaCard/MediaCard2.vue.js +5 -0
  49. package/dist/presentation/display/mediaCard/MediaCard2.vue.js.map +1 -0
  50. package/dist/presentation/display/mediaCard/index.d.ts +1 -0
  51. package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.d.ts +37 -0
  52. package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.js +72 -0
  53. package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.js.map +1 -0
  54. package/dist/presentation/display/metaInlineText/MetaInlineItem2.vue.js +7 -0
  55. package/dist/presentation/display/metaInlineText/MetaInlineItem2.vue.js.map +1 -0
  56. package/dist/presentation/display/metaInlineText/index.d.ts +1 -0
  57. package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.d.ts +18 -0
  58. package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.js +120 -0
  59. package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.js.map +1 -0
  60. package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton2.vue.js +5 -0
  61. package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton2.vue.js.map +1 -0
  62. package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.d.ts +11 -6
  63. package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.js +255 -61
  64. package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.js.map +1 -1
  65. package/dist/presentation/display/notificationCenterGroup/{NotificationItem.vue.d.ts → NotificationCenterGroupItem.vue.d.ts} +13 -12
  66. package/dist/presentation/display/notificationCenterGroup/{NotificationItem.vue.js → NotificationCenterGroupItem.vue.js} +81 -58
  67. package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem.vue.js.map +1 -0
  68. package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem2.vue.js +5 -0
  69. package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem2.vue.js.map +1 -0
  70. package/dist/presentation/display/notificationCenterGroup/index.d.ts +6 -1
  71. package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.d.ts +1 -9
  72. package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.js +165 -20
  73. package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.js.map +1 -1
  74. package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.d.ts +7 -0
  75. package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.js +56 -0
  76. package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.js.map +1 -0
  77. package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton2.vue.js +5 -0
  78. package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton2.vue.js.map +1 -0
  79. package/dist/presentation/feedback/index.js +9 -1
  80. package/dist/presentation/feedback/index.js.map +1 -1
  81. package/dist/presentation/feedback/toast/Toast.vue.d.ts +34 -8
  82. package/dist/presentation/feedback/toast/Toast.vue.js +290 -85
  83. package/dist/presentation/feedback/toast/Toast.vue.js.map +1 -1
  84. package/dist/presentation/feedback/toast/ToastContent.vue.d.ts +25 -0
  85. package/dist/presentation/feedback/toast/ToastContent.vue.js +78 -0
  86. package/dist/presentation/feedback/toast/ToastContent.vue.js.map +1 -0
  87. package/dist/presentation/feedback/toast/ToastContent2.vue.js +5 -0
  88. package/dist/presentation/feedback/toast/ToastContent2.vue.js.map +1 -0
  89. package/dist/presentation/feedback/toast/ToastRunningProgress.vue.d.ts +15 -0
  90. package/dist/presentation/feedback/toast/ToastRunningProgress.vue.js +88 -0
  91. package/dist/presentation/feedback/toast/ToastRunningProgress.vue.js.map +1 -0
  92. package/dist/presentation/feedback/toast/ToastRunningProgress2.vue.js +5 -0
  93. package/dist/presentation/feedback/toast/ToastRunningProgress2.vue.js.map +1 -0
  94. package/dist/presentation/feedback/toast/ToastSurface.d.ts +8 -0
  95. package/dist/presentation/feedback/toast/ToastSurface.js +10 -0
  96. package/dist/presentation/feedback/toast/ToastSurface.js.map +1 -0
  97. package/dist/presentation/feedback/toast/index.d.ts +1 -0
  98. package/dist/presentation/feedback/toastHost/ToastContent.d.ts +3 -0
  99. package/dist/presentation/feedback/toastHost/ToastEntry.d.ts +12 -0
  100. package/dist/presentation/feedback/toastHost/ToastFocusExtensions.d.ts +2 -0
  101. package/dist/presentation/feedback/toastHost/ToastFocusExtensions.js +11 -0
  102. package/dist/presentation/feedback/toastHost/ToastFocusExtensions.js.map +1 -0
  103. package/dist/presentation/feedback/toastHost/ToastGroup.d.ts +8 -0
  104. package/dist/presentation/feedback/toastHost/ToastGroupLatest.d.ts +10 -0
  105. package/dist/presentation/feedback/toastHost/ToastHost.vue.d.ts +55 -110
  106. package/dist/presentation/feedback/toastHost/ToastHost.vue.js +394 -399
  107. package/dist/presentation/feedback/toastHost/ToastHost.vue.js.map +1 -1
  108. package/dist/presentation/feedback/toastHost/ToastHost2.vue.js +4 -5
  109. package/dist/presentation/feedback/toastHost/ToastHostStore.d.ts +37 -0
  110. package/dist/presentation/feedback/toastHost/ToastHostStore.js +98 -0
  111. package/dist/presentation/feedback/toastHost/ToastHostStore.js.map +1 -0
  112. package/dist/presentation/feedback/toastHost/ToastHostStyles.d.ts +34 -0
  113. package/dist/presentation/feedback/toastHost/ToastHostStyles.js +44 -0
  114. package/dist/presentation/feedback/toastHost/ToastHostStyles.js.map +1 -0
  115. package/dist/presentation/feedback/toastHost/ToastNode.d.ts +3 -0
  116. package/dist/presentation/feedback/toastHost/ToastOptions.d.ts +72 -0
  117. package/dist/presentation/feedback/toastHost/ToastProgress.vue.d.ts +11 -0
  118. package/dist/presentation/feedback/toastHost/ToastProgress.vue.js +44 -0
  119. package/dist/presentation/feedback/toastHost/ToastProgress.vue.js.map +1 -0
  120. package/dist/presentation/feedback/toastHost/ToastProgress2.vue.js +5 -0
  121. package/dist/presentation/feedback/toastHost/ToastProgress2.vue.js.map +1 -0
  122. package/dist/presentation/feedback/toastHost/ToastPromiseOptions.d.ts +12 -0
  123. package/dist/presentation/feedback/toastHost/ToastRing.vue.d.ts +14 -0
  124. package/dist/presentation/feedback/toastHost/ToastRing.vue.js +65 -0
  125. package/dist/presentation/feedback/toastHost/ToastRing.vue.js.map +1 -0
  126. package/dist/presentation/feedback/toastHost/ToastRing2.vue.js +5 -0
  127. package/dist/presentation/feedback/toastHost/ToastRing2.vue.js.map +1 -0
  128. package/dist/presentation/feedback/toastHost/ToastSeconds.vue.d.ts +9 -0
  129. package/dist/presentation/feedback/toastHost/ToastSeconds.vue.js +56 -0
  130. package/dist/presentation/feedback/toastHost/ToastSeconds.vue.js.map +1 -0
  131. package/dist/presentation/feedback/toastHost/ToastSeconds2.vue.js +5 -0
  132. package/dist/presentation/feedback/toastHost/ToastSeconds2.vue.js.map +1 -0
  133. package/dist/presentation/feedback/toastHost/ToastSeverity.d.ts +3 -0
  134. package/dist/presentation/feedback/toastHost/UseResolvedToasts.d.ts +27 -0
  135. package/dist/presentation/feedback/toastHost/UseResolvedToasts.js +34 -0
  136. package/dist/presentation/feedback/toastHost/UseResolvedToasts.js.map +1 -0
  137. package/dist/presentation/feedback/toastHost/UseToastAnnouncer.d.ts +14 -0
  138. package/dist/presentation/feedback/toastHost/UseToastAnnouncer.js +106 -0
  139. package/dist/presentation/feedback/toastHost/UseToastAnnouncer.js.map +1 -0
  140. package/dist/presentation/feedback/toastHost/UseToastCapacity.d.ts +34 -0
  141. package/dist/presentation/feedback/toastHost/UseToastCapacity.js +128 -0
  142. package/dist/presentation/feedback/toastHost/UseToastCapacity.js.map +1 -0
  143. package/dist/presentation/feedback/toastHost/UseToastClock.d.ts +44 -0
  144. package/dist/presentation/feedback/toastHost/UseToastClock.js +134 -0
  145. package/dist/presentation/feedback/toastHost/UseToastClock.js.map +1 -0
  146. package/dist/presentation/feedback/toastHost/UseToastCountdown.d.ts +26 -0
  147. package/dist/presentation/feedback/toastHost/UseToastCountdown.js +23 -0
  148. package/dist/presentation/feedback/toastHost/UseToastCountdown.js.map +1 -0
  149. package/dist/presentation/feedback/toastHost/UseToastEntries.d.ts +4 -0
  150. package/dist/presentation/feedback/toastHost/UseToastEntries.js +17 -0
  151. package/dist/presentation/feedback/toastHost/UseToastEntries.js.map +1 -0
  152. package/dist/presentation/feedback/toastHost/UseToastExits.d.ts +11 -0
  153. package/dist/presentation/feedback/toastHost/UseToastExits.js +52 -0
  154. package/dist/presentation/feedback/toastHost/UseToastExits.js.map +1 -0
  155. package/dist/presentation/feedback/toastHost/UseToastGroupMotion.d.ts +43 -0
  156. package/dist/presentation/feedback/toastHost/UseToastGroupMotion.js +173 -0
  157. package/dist/presentation/feedback/toastHost/UseToastGroupMotion.js.map +1 -0
  158. package/dist/presentation/feedback/toastHost/UseToastHost.d.ts +10 -0
  159. package/dist/presentation/feedback/toastHost/UseToastHost.js +14 -0
  160. package/dist/presentation/feedback/toastHost/UseToastHost.js.map +1 -0
  161. package/dist/presentation/feedback/toastHost/UseToastHotkey.d.ts +20 -0
  162. package/dist/presentation/feedback/toastHost/UseToastHotkey.js +66 -0
  163. package/dist/presentation/feedback/toastHost/UseToastHotkey.js.map +1 -0
  164. package/dist/presentation/feedback/toastHost/UseToastPins.d.ts +26 -0
  165. package/dist/presentation/feedback/toastHost/UseToastPins.js +35 -0
  166. package/dist/presentation/feedback/toastHost/UseToastPins.js.map +1 -0
  167. package/dist/presentation/feedback/toastHost/UseToastStackMotion.d.ts +27 -0
  168. package/dist/presentation/feedback/toastHost/UseToastStackMotion.js +96 -0
  169. package/dist/presentation/feedback/toastHost/UseToastStackMotion.js.map +1 -0
  170. package/dist/presentation/feedback/toastHost/UseToastSwipe.d.ts +19 -0
  171. package/dist/presentation/feedback/toastHost/UseToastSwipe.js +173 -0
  172. package/dist/presentation/feedback/toastHost/UseToastSwipe.js.map +1 -0
  173. package/dist/presentation/feedback/toastHost/index.d.ts +8 -1
  174. package/dist/presentation/feedback/toastHost/index.js +7 -1
  175. package/dist/presentation/feedback/toastHost/index.js.map +1 -1
  176. package/dist/presentation/feedback/toastHost/styles.css +14 -2
  177. package/dist/presentation/layout/grid/Grid.variants.d.ts +7 -0
  178. package/dist/presentation/layout/grid/Grid.variants.js +4 -0
  179. package/dist/presentation/layout/grid/Grid.variants.js.map +1 -1
  180. package/dist/presentation/layout/grid/Grid.vue.d.ts +5 -0
  181. package/dist/presentation/layout/grid/Grid.vue.js +16 -4
  182. package/dist/presentation/layout/grid/Grid.vue.js.map +1 -1
  183. package/dist/presentation/layout/grid/index.d.ts +1 -1
  184. package/dist/presentation/layout/index.js +3 -1
  185. package/dist/presentation/nav/accountMenu/AccountMenu.vue.d.ts +1 -1
  186. package/dist/presentation/overlays/hoverCard/HoverCard.vue.d.ts +1 -1
  187. package/dist/presentation/overlays/popover/PopoverContent.vue.js +4 -4
  188. package/dist/presentation/overlays/popover/PopoverContent.vue.js.map +1 -1
  189. package/dist/presentation/overlays/tooltip/Tooltip.vue.d.ts +1 -1
  190. package/dist/presentation/overlays/tooltip/Tooltip.vue.js +8 -9
  191. package/dist/presentation/overlays/tooltip/Tooltip.vue.js.map +1 -1
  192. package/package.json +1 -1
  193. package/dist/presentation/display/notificationCenterGroup/NotificationItem.vue.js.map +0 -1
  194. package/dist/presentation/display/notificationCenterGroup/NotificationItem2.vue.js +0 -5
  195. package/dist/presentation/display/notificationCenterGroup/NotificationItem2.vue.js.map +0 -1
@@ -0,0 +1,14 @@
1
+ import { toastHost } from "./ToastHostStore.js";
2
+ function useToastHost() {
3
+ return {
4
+ toast: (opts) => toastHost.toast(opts),
5
+ update: (id, patch) => toastHost.update(id, patch),
6
+ promise: (promise, opts) => toastHost.promise(promise, opts),
7
+ dismiss: (id) => toastHost.dismiss(id),
8
+ dismissAll: () => toastHost.dismissAll()
9
+ };
10
+ }
11
+ export {
12
+ useToastHost
13
+ };
14
+ //# sourceMappingURL=UseToastHost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UseToastHost.js","sources":["../../../../src/presentation/feedback/toastHost/UseToastHost.ts"],"sourcesContent":["import { toastHost } from './ToastHostStore';\nimport type { ToastOptions } from './ToastOptions';\nimport type { ToastPromiseOptions } from './ToastPromiseOptions';\n\n/** Manages the imperative toast API, bound to the app-wide store. */\nexport function useToastHost() {\n return {\n toast: (opts: ToastOptions) => toastHost.toast(opts),\n update: (id: string, patch: Partial<ToastOptions>) => toastHost.update(id, patch),\n promise: <T>(promise: Promise<T>, opts: ToastPromiseOptions<T>) => toastHost.promise(promise, opts),\n dismiss: (id: string) => toastHost.dismiss(id),\n dismissAll: () => toastHost.dismissAll(),\n };\n}\n"],"names":[],"mappings":";AAKO,SAAS,eAAe;AAC7B,SAAO;AAAA,IACL,OAAO,CAAC,SAAuB,UAAU,MAAM,IAAI;AAAA,IACnD,QAAQ,CAAC,IAAY,UAAiC,UAAU,OAAO,IAAI,KAAK;AAAA,IAChF,SAAS,CAAI,SAAqB,SAAiC,UAAU,QAAQ,SAAS,IAAI;AAAA,IAClG,SAAS,CAAC,OAAe,UAAU,QAAQ,EAAE;AAAA,IAC7C,YAAY,MAAM,UAAU,WAAA;AAAA,EAAW;AAE3C;"}
@@ -0,0 +1,20 @@
1
+ import { Ref } from 'vue';
2
+ /** Defines the stack and host state the hotkey reads. */
3
+ export interface ToastHotkeySources {
4
+ readonly stack: Readonly<Ref<HTMLElement | null>>;
5
+ /** The chord that moves focus to the stack, or `false` for none. */
6
+ readonly hotkey: () => string | false;
7
+ /** Whether a present card is showing; the key is left to the page otherwise. */
8
+ readonly hasCards: () => boolean;
9
+ }
10
+ /**
11
+ * Manages the hotkey that moves focus from anywhere on the page to the card nearest the stack's anchor, and back.
12
+ * The key is ignored while a text field has focus. Escape inside the stack returns focus to where the key was
13
+ * pressed; so does the stack emptying while it holds focus.
14
+ */
15
+ export declare function useToastHotkey(sources: ToastHotkeySources): {
16
+ label: import('vue').ComputedRef<string | undefined>;
17
+ returnFocus: (event: KeyboardEvent) => void;
18
+ onFocusout: (event: FocusEvent) => void;
19
+ release: () => void;
20
+ };
@@ -0,0 +1,66 @@
1
+ import { computed, nextTick } from "vue";
2
+ import { formatChordString } from "../../../foundation/shortcuts/Chord.js";
3
+ import { useHotkeys } from "../../../foundation/shortcuts/hooks/UseHotkeys.js";
4
+ function formatToastHotkey(chord) {
5
+ return formatChordString(chord).replace(/(^|[^a-z])f(\d{1,2})$/i, "$1F$2");
6
+ }
7
+ function useToastHotkey(sources) {
8
+ const { stack, hotkey, hasCards } = sources;
9
+ let origin;
10
+ let jumped = false;
11
+ const label = computed(() => {
12
+ const chord = hotkey();
13
+ return chord ? formatToastHotkey(chord) : void 0;
14
+ });
15
+ function focusStack() {
16
+ const host = stack.value;
17
+ const card = host?.querySelector(":scope > [data-toast-id]:not([data-toast-exiting])");
18
+ if (!host || !card) return;
19
+ const active = document.activeElement;
20
+ if (active instanceof HTMLElement && active !== document.body && !host.contains(active)) origin = active;
21
+ jumped = true;
22
+ card.focus({ preventScroll: true });
23
+ card.scrollIntoView?.({ block: "nearest" });
24
+ }
25
+ useHotkeys(() => hotkey() || [], focusStack, { enabled: () => hotkey() !== false && hasCards() });
26
+ function returnFocus(event) {
27
+ const target = origin;
28
+ const fromHotkey = jumped;
29
+ origin = void 0;
30
+ jumped = false;
31
+ if (target?.isConnected) {
32
+ event.stopPropagation();
33
+ target.focus({ preventScroll: true });
34
+ return;
35
+ }
36
+ const active = document.activeElement;
37
+ if (fromHotkey && active instanceof HTMLElement && stack.value?.contains(active)) {
38
+ event.stopPropagation();
39
+ active.blur();
40
+ }
41
+ }
42
+ function onFocusout(event) {
43
+ const host = event.currentTarget;
44
+ if (event.relatedTarget instanceof Node && !host.contains(event.relatedTarget)) {
45
+ origin = void 0;
46
+ jumped = false;
47
+ }
48
+ }
49
+ function release() {
50
+ const target = origin;
51
+ origin = void 0;
52
+ jumped = false;
53
+ if (!target) return;
54
+ const host = stack.value;
55
+ void nextTick(() => {
56
+ const active = document.activeElement;
57
+ const lost = active === null || active === document.body || (host?.contains(active) ?? false);
58
+ if (lost && target.isConnected) target.focus({ preventScroll: true });
59
+ });
60
+ }
61
+ return { label, returnFocus, onFocusout, release };
62
+ }
63
+ export {
64
+ useToastHotkey
65
+ };
66
+ //# sourceMappingURL=UseToastHotkey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UseToastHotkey.js","sources":["../../../../src/presentation/feedback/toastHost/UseToastHotkey.ts"],"sourcesContent":["import { computed, nextTick, type Ref } from 'vue';\n\nimport { formatChordString, useHotkeys } from '../../../foundation/shortcuts';\n\n/** Defines the stack and host state the hotkey reads. */\nexport interface ToastHotkeySources {\n readonly stack: Readonly<Ref<HTMLElement | null>>;\n /** The chord that moves focus to the stack, or `false` for none. */\n readonly hotkey: () => string | false;\n /** Whether a present card is showing; the key is left to the page otherwise. */\n readonly hasCards: () => boolean;\n}\n\n/** @internal Reads a chord the way the platform prints it, with function keys in capitals (`F8`, `⌥F8`, `Alt+F8`). */\nfunction formatToastHotkey(chord: string): string {\n return formatChordString(chord).replace(/(^|[^a-z])f(\\d{1,2})$/i, '$1F$2');\n}\n\n/**\n * Manages the hotkey that moves focus from anywhere on the page to the card nearest the stack's anchor, and back.\n * The key is ignored while a text field has focus. Escape inside the stack returns focus to where the key was\n * pressed; so does the stack emptying while it holds focus.\n */\nexport function useToastHotkey(sources: ToastHotkeySources) {\n const { stack, hotkey, hasCards } = sources;\n /** The element focus came from; cleared once focus moves elsewhere on its own. */\n let origin: HTMLElement | undefined;\n /** Whether the hotkey put focus in the stack, so Escape can hand it back even without an origin. */\n let jumped = false;\n\n const label = computed(() => {\n const chord = hotkey();\n return chord ? formatToastHotkey(chord) : undefined;\n });\n\n function focusStack(): void {\n const host = stack.value;\n const card = host?.querySelector<HTMLElement>(':scope > [data-toast-id]:not([data-toast-exiting])');\n if (!host || !card) return;\n const active = document.activeElement;\n if (active instanceof HTMLElement && active !== document.body && !host.contains(active)) origin = active;\n jumped = true;\n card.focus({ preventScroll: true });\n card.scrollIntoView?.({ block: 'nearest' });\n }\n\n useHotkeys(() => hotkey() || [], focusStack, { enabled: () => hotkey() !== false && hasCards() });\n\n /** Handles Escape inside the stack: focus returns to its origin, if the hotkey brought it here. */\n function returnFocus(event: KeyboardEvent): void {\n const target = origin;\n const fromHotkey = jumped;\n origin = undefined;\n jumped = false;\n if (target?.isConnected) {\n event.stopPropagation();\n target.focus({ preventScroll: true });\n return;\n }\n // Pressed from the page itself: let focus go back to the document, which also resumes the clocks.\n const active = document.activeElement;\n if (fromHotkey && active instanceof HTMLElement && stack.value?.contains(active)) {\n event.stopPropagation();\n active.blur();\n }\n }\n\n /** Forgets the origin once focus leaves the stack for another element. */\n function onFocusout(event: FocusEvent): void {\n const host = event.currentTarget as HTMLElement;\n if (event.relatedTarget instanceof Node && !host.contains(event.relatedTarget)) {\n origin = undefined;\n jumped = false;\n }\n }\n\n /** Returns focus to its origin when the last card leaves while focus is still in the stack, or lost. */\n function release(): void {\n const target = origin;\n origin = undefined;\n jumped = false;\n if (!target) return;\n const host = stack.value;\n void nextTick(() => {\n const active = document.activeElement;\n const lost = active === null || active === document.body || (host?.contains(active) ?? false);\n if (lost && target.isConnected) target.focus({ preventScroll: true });\n });\n }\n\n return { label, returnFocus, onFocusout, release };\n}\n"],"names":[],"mappings":";;;AAcA,SAAS,kBAAkB,OAAuB;AAChD,SAAO,kBAAkB,KAAK,EAAE,QAAQ,0BAA0B,OAAO;AAC3E;AAOO,SAAS,eAAe,SAA6B;AAC1D,QAAM,EAAE,OAAO,QAAQ,SAAA,IAAa;AAEpC,MAAI;AAEJ,MAAI,SAAS;AAEb,QAAM,QAAQ,SAAS,MAAM;AAC3B,UAAM,QAAQ,OAAA;AACd,WAAO,QAAQ,kBAAkB,KAAK,IAAI;AAAA,EAC5C,CAAC;AAED,WAAS,aAAmB;AAC1B,UAAM,OAAO,MAAM;AACnB,UAAM,OAAO,MAAM,cAA2B,oDAAoD;AAClG,QAAI,CAAC,QAAQ,CAAC,KAAM;AACpB,UAAM,SAAS,SAAS;AACxB,QAAI,kBAAkB,eAAe,WAAW,SAAS,QAAQ,CAAC,KAAK,SAAS,MAAM,EAAG,UAAS;AAClG,aAAS;AACT,SAAK,MAAM,EAAE,eAAe,KAAA,CAAM;AAClC,SAAK,iBAAiB,EAAE,OAAO,UAAA,CAAW;AAAA,EAC5C;AAEA,aAAW,MAAM,YAAY,CAAA,GAAI,YAAY,EAAE,SAAS,MAAM,OAAA,MAAa,SAAS,SAAA,GAAY;AAGhG,WAAS,YAAY,OAA4B;AAC/C,UAAM,SAAS;AACf,UAAM,aAAa;AACnB,aAAS;AACT,aAAS;AACT,QAAI,QAAQ,aAAa;AACvB,YAAM,gBAAA;AACN,aAAO,MAAM,EAAE,eAAe,KAAA,CAAM;AACpC;AAAA,IACF;AAEA,UAAM,SAAS,SAAS;AACxB,QAAI,cAAc,kBAAkB,eAAe,MAAM,OAAO,SAAS,MAAM,GAAG;AAChF,YAAM,gBAAA;AACN,aAAO,KAAA;AAAA,IACT;AAAA,EACF;AAGA,WAAS,WAAW,OAAyB;AAC3C,UAAM,OAAO,MAAM;AACnB,QAAI,MAAM,yBAAyB,QAAQ,CAAC,KAAK,SAAS,MAAM,aAAa,GAAG;AAC9E,eAAS;AACT,eAAS;AAAA,IACX;AAAA,EACF;AAGA,WAAS,UAAgB;AACvB,UAAM,SAAS;AACf,aAAS;AACT,aAAS;AACT,QAAI,CAAC,OAAQ;AACb,UAAM,OAAO,MAAM;AACnB,SAAK,SAAS,MAAM;AAClB,YAAM,SAAS,SAAS;AACxB,YAAM,OAAO,WAAW,QAAQ,WAAW,SAAS,SAAS,MAAM,SAAS,MAAM,KAAK;AACvF,UAAI,QAAQ,OAAO,YAAa,QAAO,MAAM,EAAE,eAAe,MAAM;AAAA,IACtE,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,OAAO,aAAa,YAAY,QAAA;AAC3C;"}
@@ -0,0 +1,26 @@
1
+ import { ComputedRef, Ref, ShallowRef } from 'vue';
2
+ import { VisibleToast } from './UseResolvedToasts';
3
+ /** Defines the pin state of a host's toasts and the operations that change it. */
4
+ export interface ToastPinControls {
5
+ /** The ids the reader pinned, whether or not the pin is in effect. */
6
+ readonly pinned: Readonly<ShallowRef<ReadonlySet<string>>>;
7
+ /** The ids whose pin is in effect — a pin lapses while its toast, or the host's default, forbids pinning. */
8
+ readonly effective: ComputedRef<ReadonlySet<string>>;
9
+ /** The toasts in the order the collapsed window fills — a pinned toast first within its priority. */
10
+ readonly ordered: ComputedRef<ReadonlyArray<VisibleToast>>;
11
+ /** Reports whether a toast may be pinned at all. */
12
+ canPin(t: VisibleToast): boolean;
13
+ /** Reports whether a toast's pin is in effect. */
14
+ isPinned(t: VisibleToast): boolean;
15
+ /** Pins an unpinned toast, or unpins a pinned one. */
16
+ toggle(id: string): void;
17
+ /** Drops every pin whose toast is gone or can no longer be pinned. */
18
+ retain(candidates: Iterable<VisibleToast>): void;
19
+ }
20
+ /** Defines the host setting pinning reads. */
21
+ export interface ToastPinSettings {
22
+ /** Whether timed toasts may be pinned by default; a toast's own `canPin` overrides. */
23
+ readonly canPin: boolean;
24
+ }
25
+ /** Manages which timed toasts the reader pinned. A pinned toast has no clock until it is unpinned. */
26
+ export declare function useToastPins(cards: Readonly<Ref<ReadonlyArray<VisibleToast>>>, settings: ToastPinSettings): ToastPinControls;
@@ -0,0 +1,35 @@
1
+ import { shallowRef, computed } from "vue";
2
+ import { comparePriority, hasDeadline } from "./ToastHostStore.js";
3
+ function useToastPins(cards, settings) {
4
+ const pinned = shallowRef(/* @__PURE__ */ new Set());
5
+ function canPin(t) {
6
+ return (t.canPin ?? settings.canPin) && !hasDeadline(t) && !t.content && Number.isFinite(t.resolvedDuration) && t.resolvedDuration > 0;
7
+ }
8
+ function isPinned(t) {
9
+ return canPin(t) && pinned.value.has(t.id);
10
+ }
11
+ function toggle(id) {
12
+ const next = new Set(pinned.value);
13
+ if (!next.delete(id)) next.add(id);
14
+ pinned.value = next;
15
+ }
16
+ function retain(candidates) {
17
+ if (pinned.value.size === 0) return;
18
+ const eligible = /* @__PURE__ */ new Set();
19
+ for (const t of candidates) if (canPin(t)) eligible.add(t.id);
20
+ const kept = [...pinned.value].filter((id) => eligible.has(id));
21
+ if (kept.length !== pinned.value.size) pinned.value = new Set(kept);
22
+ }
23
+ const effective = computed(() => new Set(cards.value.filter(isPinned).map((t) => t.id)));
24
+ const ordered = computed(() => {
25
+ if (pinned.value.size === 0) return cards.value;
26
+ return [...cards.value].sort(
27
+ (a, b) => comparePriority(a, b) || Number(isPinned(b)) - Number(isPinned(a)) || a.sequence - b.sequence
28
+ );
29
+ });
30
+ return { pinned, effective, ordered, canPin, isPinned, toggle, retain };
31
+ }
32
+ export {
33
+ useToastPins
34
+ };
35
+ //# sourceMappingURL=UseToastPins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UseToastPins.js","sources":["../../../../src/presentation/feedback/toastHost/UseToastPins.ts"],"sourcesContent":["import { computed, shallowRef, type ComputedRef, type Ref, type ShallowRef } from 'vue';\n\nimport { comparePriority, hasDeadline } from './ToastHostStore';\nimport type { VisibleToast } from './UseResolvedToasts';\n\n/** Defines the pin state of a host's toasts and the operations that change it. */\nexport interface ToastPinControls {\n /** The ids the reader pinned, whether or not the pin is in effect. */\n readonly pinned: Readonly<ShallowRef<ReadonlySet<string>>>;\n\n /** The ids whose pin is in effect — a pin lapses while its toast, or the host's default, forbids pinning. */\n readonly effective: ComputedRef<ReadonlySet<string>>;\n\n /** The toasts in the order the collapsed window fills — a pinned toast first within its priority. */\n readonly ordered: ComputedRef<ReadonlyArray<VisibleToast>>;\n\n /** Reports whether a toast may be pinned at all. */\n canPin(t: VisibleToast): boolean;\n\n /** Reports whether a toast's pin is in effect. */\n isPinned(t: VisibleToast): boolean;\n\n /** Pins an unpinned toast, or unpins a pinned one. */\n toggle(id: string): void;\n\n /** Drops every pin whose toast is gone or can no longer be pinned. */\n retain(candidates: Iterable<VisibleToast>): void;\n}\n\n/** Defines the host setting pinning reads. */\nexport interface ToastPinSettings {\n /** Whether timed toasts may be pinned by default; a toast's own `canPin` overrides. */\n readonly canPin: boolean;\n}\n\n/** Manages which timed toasts the reader pinned. A pinned toast has no clock until it is unpinned. */\nexport function useToastPins(\n cards: Readonly<Ref<ReadonlyArray<VisibleToast>>>,\n settings: ToastPinSettings,\n): ToastPinControls {\n const pinned = shallowRef<ReadonlySet<string>>(new Set());\n\n function canPin(t: VisibleToast): boolean {\n return (\n (t.canPin ?? settings.canPin) &&\n !hasDeadline(t) &&\n !t.content &&\n Number.isFinite(t.resolvedDuration) &&\n t.resolvedDuration > 0\n );\n }\n\n function isPinned(t: VisibleToast): boolean {\n return canPin(t) && pinned.value.has(t.id);\n }\n\n function toggle(id: string): void {\n const next = new Set(pinned.value);\n if (!next.delete(id)) next.add(id);\n pinned.value = next;\n }\n\n function retain(candidates: Iterable<VisibleToast>): void {\n if (pinned.value.size === 0) return;\n const eligible = new Set<string>();\n for (const t of candidates) if (canPin(t)) eligible.add(t.id);\n const kept = [...pinned.value].filter((id) => eligible.has(id));\n if (kept.length !== pinned.value.size) pinned.value = new Set(kept);\n }\n\n const effective = computed(() => new Set(cards.value.filter(isPinned).map((t) => t.id)));\n\n const ordered = computed(() => {\n if (pinned.value.size === 0) return cards.value;\n return [...cards.value].sort(\n (a, b) => comparePriority(a, b) || Number(isPinned(b)) - Number(isPinned(a)) || a.sequence - b.sequence,\n );\n });\n\n return { pinned, effective, ordered, canPin, isPinned, toggle, retain };\n}\n"],"names":[],"mappings":";;AAoCO,SAAS,aACd,OACA,UACkB;AAClB,QAAM,SAAS,WAAgC,oBAAI,KAAK;AAExD,WAAS,OAAO,GAA0B;AACxC,YACG,EAAE,UAAU,SAAS,WACtB,CAAC,YAAY,CAAC,KACd,CAAC,EAAE,WACH,OAAO,SAAS,EAAE,gBAAgB,KAClC,EAAE,mBAAmB;AAAA,EAEzB;AAEA,WAAS,SAAS,GAA0B;AAC1C,WAAO,OAAO,CAAC,KAAK,OAAO,MAAM,IAAI,EAAE,EAAE;AAAA,EAC3C;AAEA,WAAS,OAAO,IAAkB;AAChC,UAAM,OAAO,IAAI,IAAI,OAAO,KAAK;AACjC,QAAI,CAAC,KAAK,OAAO,EAAE,EAAG,MAAK,IAAI,EAAE;AACjC,WAAO,QAAQ;AAAA,EACjB;AAEA,WAAS,OAAO,YAA0C;AACxD,QAAI,OAAO,MAAM,SAAS,EAAG;AAC7B,UAAM,+BAAe,IAAA;AACrB,eAAW,KAAK,WAAY,KAAI,OAAO,CAAC,EAAG,UAAS,IAAI,EAAE,EAAE;AAC5D,UAAM,OAAO,CAAC,GAAG,OAAO,KAAK,EAAE,OAAO,CAAC,OAAO,SAAS,IAAI,EAAE,CAAC;AAC9D,QAAI,KAAK,WAAW,OAAO,MAAM,KAAM,QAAO,QAAQ,IAAI,IAAI,IAAI;AAAA,EACpE;AAEA,QAAM,YAAY,SAAS,MAAM,IAAI,IAAI,MAAM,MAAM,OAAO,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAEvF,QAAM,UAAU,SAAS,MAAM;AAC7B,QAAI,OAAO,MAAM,SAAS,UAAU,MAAM;AAC1C,WAAO,CAAC,GAAG,MAAM,KAAK,EAAE;AAAA,MACtB,CAAC,GAAG,MAAM,gBAAgB,GAAG,CAAC,KAAK,OAAO,SAAS,CAAC,CAAC,IAAI,OAAO,SAAS,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE;AAAA,IAAA;AAAA,EAEnG,CAAC;AAED,SAAO,EAAE,QAAQ,WAAW,SAAS,QAAQ,UAAU,QAAQ,OAAA;AACjE;"}
@@ -0,0 +1,27 @@
1
+ import { Ref } from 'vue';
2
+ import { OverlayPosition } from '../../../foundation/styles';
3
+ import { VisibleToast } from './UseResolvedToasts';
4
+ /** Defines the elements, lists and host state stack motion reads. */
5
+ export interface ToastStackMotionSources {
6
+ readonly stack: Readonly<Ref<HTMLElement | null>>;
7
+ readonly visible: Readonly<Ref<ReadonlyArray<VisibleToast>>>;
8
+ readonly position: () => OverlayPosition;
9
+ readonly reducedMotion: Readonly<Ref<boolean>>;
10
+ /** Whether the reader is browsing the overflow list, where cards keep still. */
11
+ readonly browsing: () => boolean;
12
+ }
13
+ /** Defines the host settings stack motion reads. */
14
+ export interface ToastStackMotionSettings {
15
+ /** The time cards take to slide together, in ms; 0 is an instant reflow. */
16
+ readonly moveDuration: number;
17
+ /** The space between cards, in px. */
18
+ readonly gap: number;
19
+ }
20
+ /**
21
+ * Manages the slide of the remaining cards into the slot an exit vacates, and carries a higher-priority arrival
22
+ * past the cards it outranks. Each card's slot is measured apart from its entry and exit transform; an
23
+ * interrupted slide restarts from its current translation, so another dismissal retargets it without a jump.
24
+ */
25
+ export declare function useToastStackMotion(sources: ToastStackMotionSources, settings: ToastStackMotionSettings): {
26
+ captureGap: (promoted?: ReadonlySet<string>) => void;
27
+ };
@@ -0,0 +1,96 @@
1
+ import { watch, onScopeDispose, nextTick } from "vue";
2
+ import { animate } from "../../../foundation/animation/Animate.js";
3
+ import { comparePriority } from "./ToastHostStore.js";
4
+ function useToastStackMotion(sources, settings) {
5
+ const { stack, visible, position, reducedMotion, browsing } = sources;
6
+ const moving = /* @__PURE__ */ new Map();
7
+ let isClosingGap = false;
8
+ function stop() {
9
+ for (const animation of moving.values()) animation.cancel();
10
+ moving.clear();
11
+ }
12
+ function captureGap(promoted = /* @__PURE__ */ new Set()) {
13
+ const host = stack.value;
14
+ if (!host || browsing() || isClosingGap || reducedMotion.value || settings.moveDuration <= 0) return;
15
+ const placement = position();
16
+ const top = host.getBoundingClientRect().top;
17
+ const positions = /* @__PURE__ */ new Map();
18
+ for (const node of host.children) {
19
+ if (!(node instanceof HTMLElement) || !node.dataset.toastId || node.hasAttribute("data-toast-exiting")) continue;
20
+ const translateY = moving.has(node) ? getComputedStyle(node).translate?.split(" ")[1] : void 0;
21
+ positions.set(node, {
22
+ top: top + node.offsetTop,
23
+ height: node.offsetHeight,
24
+ translation: Number.parseFloat(translateY ?? "0") || 0
25
+ });
26
+ }
27
+ if (positions.size === 0) return;
28
+ isClosingGap = true;
29
+ void nextTick(() => {
30
+ isClosingGap = false;
31
+ if (stack.value !== host || position() !== placement || reducedMotion.value || settings.moveDuration <= 0) {
32
+ return;
33
+ }
34
+ slideTogether(host, positions, promoted);
35
+ });
36
+ }
37
+ function slideTogether(host, positions, promoted) {
38
+ const box = host.getBoundingClientRect();
39
+ const moves = [];
40
+ for (const [node, previous] of positions) {
41
+ if (node.parentElement !== host || node.hasAttribute("data-toast-exiting")) continue;
42
+ const distance = previous.top - (box.top + node.offsetTop);
43
+ if (Math.abs(distance) < 0.5) continue;
44
+ moves.push({ node, offset: distance + previous.translation });
45
+ }
46
+ if (promoted.size > 0) {
47
+ const previous = [...positions.values()];
48
+ const room = Number.parseFloat(getComputedStyle(host).maxHeight) || window.innerHeight;
49
+ const bottom = position().startsWith("bottom");
50
+ const tail = bottom ? Math.min(...previous.map((slot) => slot.top)) - settings.gap : Math.max(...previous.map((slot) => slot.top + slot.height)) + settings.gap;
51
+ for (const node of host.children) {
52
+ if (!(node instanceof HTMLElement) || positions.has(node) || !promoted.has(node.dataset.toastId ?? "")) {
53
+ continue;
54
+ }
55
+ const target = box.top + node.offsetTop;
56
+ const origin = bottom ? Math.max(box.bottom - room, tail - node.offsetHeight) : Math.min(box.top + room - node.offsetHeight, tail);
57
+ moves.push({ node, offset: origin - target, inFront: true });
58
+ }
59
+ }
60
+ for (const { node, offset, inFront } of moves) {
61
+ moving.get(node)?.cancel();
62
+ const layer = inFront ? { zIndex: 1 } : {};
63
+ const animation = animate(
64
+ node,
65
+ [
66
+ { translate: `0 ${offset}px`, ...layer },
67
+ { translate: "none", ...layer }
68
+ ],
69
+ { duration: settings.moveDuration }
70
+ );
71
+ moving.set(node, animation);
72
+ void animation.finished.then(() => {
73
+ if (moving.get(node) === animation) moving.delete(node);
74
+ });
75
+ }
76
+ }
77
+ watch(visible, (next, previous) => {
78
+ if (previous.length === 0 || browsing()) return;
79
+ const earlier = new Map(previous.map((card) => [card.id, card]));
80
+ const promoted = new Set(
81
+ next.filter((card) => !earlier.has(card.id) && previous.some((other) => comparePriority(card, other) < 0)).map((card) => card.id)
82
+ );
83
+ const reprioritized = next.some((card) => {
84
+ const prior = earlier.get(card.id);
85
+ return prior && comparePriority(card, prior) !== 0;
86
+ });
87
+ if (promoted.size > 0 || reprioritized) captureGap(promoted);
88
+ });
89
+ watch([reducedMotion, position, () => settings.moveDuration], stop);
90
+ onScopeDispose(stop);
91
+ return { captureGap };
92
+ }
93
+ export {
94
+ useToastStackMotion
95
+ };
96
+ //# sourceMappingURL=UseToastStackMotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UseToastStackMotion.js","sources":["../../../../src/presentation/feedback/toastHost/UseToastStackMotion.ts"],"sourcesContent":["import { nextTick, onScopeDispose, watch, type Ref } from 'vue';\n\nimport { animate, type AnimationHandle } from '../../../foundation/animation';\nimport type { OverlayPosition } from '../../../foundation/styles';\nimport { comparePriority } from './ToastHostStore';\nimport type { VisibleToast } from './UseResolvedToasts';\n\n/** @internal A card's measured slot before a patch — its top, height and in-flight translation, in px. */\ninterface SlotPosition {\n top: number;\n height: number;\n translation: number;\n}\n\n/** @internal A card that slides, from its offset to its place; `inFront` lifts a promoted arrival over its peers. */\ninterface SlotMove {\n node: HTMLElement;\n offset: number;\n inFront?: boolean;\n}\n\n/** Defines the elements, lists and host state stack motion reads. */\nexport interface ToastStackMotionSources {\n readonly stack: Readonly<Ref<HTMLElement | null>>;\n readonly visible: Readonly<Ref<ReadonlyArray<VisibleToast>>>;\n readonly position: () => OverlayPosition;\n readonly reducedMotion: Readonly<Ref<boolean>>;\n /** Whether the reader is browsing the overflow list, where cards keep still. */\n readonly browsing: () => boolean;\n}\n\n/** Defines the host settings stack motion reads. */\nexport interface ToastStackMotionSettings {\n /** The time cards take to slide together, in ms; 0 is an instant reflow. */\n readonly moveDuration: number;\n\n /** The space between cards, in px. */\n readonly gap: number;\n}\n\n/**\n * Manages the slide of the remaining cards into the slot an exit vacates, and carries a higher-priority arrival\n * past the cards it outranks. Each card's slot is measured apart from its entry and exit transform; an\n * interrupted slide restarts from its current translation, so another dismissal retargets it without a jump.\n */\nexport function useToastStackMotion(sources: ToastStackMotionSources, settings: ToastStackMotionSettings) {\n const { stack, visible, position, reducedMotion, browsing } = sources;\n const moving = new Map<HTMLElement, AnimationHandle>();\n let isClosingGap = false;\n\n function stop(): void {\n for (const animation of moving.values()) animation.cancel();\n moving.clear();\n }\n\n /** Measures every present card before Vue patches the stack, then slides them from there. */\n function captureGap(promoted: ReadonlySet<string> = new Set()): void {\n const host = stack.value;\n if (!host || browsing() || isClosingGap || reducedMotion.value || settings.moveDuration <= 0) return;\n const placement = position();\n const top = host.getBoundingClientRect().top;\n const positions = new Map<HTMLElement, SlotPosition>();\n for (const node of host.children) {\n if (!(node instanceof HTMLElement) || !node.dataset.toastId || node.hasAttribute('data-toast-exiting')) continue;\n const translateY = moving.has(node) ? getComputedStyle(node).translate?.split(' ')[1] : undefined;\n positions.set(node, {\n top: top + node.offsetTop,\n height: node.offsetHeight,\n translation: Number.parseFloat(translateY ?? '0') || 0,\n });\n }\n if (positions.size === 0) return;\n isClosingGap = true;\n void nextTick(() => {\n isClosingGap = false;\n if (stack.value !== host || position() !== placement || reducedMotion.value || settings.moveDuration <= 0) {\n return;\n }\n slideTogether(host, positions, promoted);\n });\n }\n\n function slideTogether(\n host: HTMLElement,\n positions: ReadonlyMap<HTMLElement, SlotPosition>,\n promoted: ReadonlySet<string>,\n ): void {\n const box = host.getBoundingClientRect();\n const moves: Array<SlotMove> = [];\n for (const [node, previous] of positions) {\n if (node.parentElement !== host || node.hasAttribute('data-toast-exiting')) continue;\n const distance = previous.top - (box.top + node.offsetTop);\n if (Math.abs(distance) < 0.5) continue;\n moves.push({ node, offset: distance + previous.translation });\n }\n if (promoted.size > 0) {\n const previous = [...positions.values()];\n const room = Number.parseFloat(getComputedStyle(host).maxHeight) || window.innerHeight;\n const bottom = position().startsWith('bottom');\n const tail = bottom\n ? Math.min(...previous.map((slot) => slot.top)) - settings.gap\n : Math.max(...previous.map((slot) => slot.top + slot.height)) + settings.gap;\n for (const node of host.children) {\n if (!(node instanceof HTMLElement) || positions.has(node) || !promoted.has(node.dataset.toastId ?? '')) {\n continue;\n }\n const target = box.top + node.offsetTop;\n const origin = bottom\n ? Math.max(box.bottom - room, tail - node.offsetHeight)\n : Math.min(box.top + room - node.offsetHeight, tail);\n moves.push({ node, offset: origin - target, inFront: true });\n }\n }\n for (const { node, offset, inFront } of moves) {\n moving.get(node)?.cancel();\n const layer = inFront ? { zIndex: 1 } : {};\n const animation = animate(\n node,\n [\n { translate: `0 ${offset}px`, ...layer },\n { translate: 'none', ...layer },\n ],\n { duration: settings.moveDuration },\n );\n moving.set(node, animation);\n void animation.finished.then(() => {\n if (moving.get(node) === animation) moving.delete(node);\n });\n }\n }\n\n // A new arrival that outranks a card already showing, or a card whose priority changed, moves the stack.\n watch(visible, (next, previous) => {\n if (previous.length === 0 || browsing()) return;\n const earlier = new Map(previous.map((card) => [card.id, card]));\n const promoted = new Set(\n next\n .filter((card) => !earlier.has(card.id) && previous.some((other) => comparePriority(card, other) < 0))\n .map((card) => card.id),\n );\n const reprioritized = next.some((card) => {\n const prior = earlier.get(card.id);\n return prior && comparePriority(card, prior) !== 0;\n });\n if (promoted.size > 0 || reprioritized) captureGap(promoted);\n });\n\n watch([reducedMotion, position, () => settings.moveDuration], stop);\n onScopeDispose(stop);\n\n return { captureGap };\n}\n"],"names":[],"mappings":";;;AA6CO,SAAS,oBAAoB,SAAkC,UAAoC;AACxG,QAAM,EAAE,OAAO,SAAS,UAAU,eAAe,aAAa;AAC9D,QAAM,6BAAa,IAAA;AACnB,MAAI,eAAe;AAEnB,WAAS,OAAa;AACpB,eAAW,aAAa,OAAO,OAAA,aAAoB,OAAA;AACnD,WAAO,MAAA;AAAA,EACT;AAGA,WAAS,WAAW,WAAgC,oBAAI,OAAa;AACnE,UAAM,OAAO,MAAM;AACnB,QAAI,CAAC,QAAQ,SAAA,KAAc,gBAAgB,cAAc,SAAS,SAAS,gBAAgB,EAAG;AAC9F,UAAM,YAAY,SAAA;AAClB,UAAM,MAAM,KAAK,sBAAA,EAAwB;AACzC,UAAM,gCAAgB,IAAA;AACtB,eAAW,QAAQ,KAAK,UAAU;AAChC,UAAI,EAAE,gBAAgB,gBAAgB,CAAC,KAAK,QAAQ,WAAW,KAAK,aAAa,oBAAoB,EAAG;AACxG,YAAM,aAAa,OAAO,IAAI,IAAI,IAAI,iBAAiB,IAAI,EAAE,WAAW,MAAM,GAAG,EAAE,CAAC,IAAI;AACxF,gBAAU,IAAI,MAAM;AAAA,QAClB,KAAK,MAAM,KAAK;AAAA,QAChB,QAAQ,KAAK;AAAA,QACb,aAAa,OAAO,WAAW,cAAc,GAAG,KAAK;AAAA,MAAA,CACtD;AAAA,IACH;AACA,QAAI,UAAU,SAAS,EAAG;AAC1B,mBAAe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YAAY,GAAG,IAAI;AAClE,iBAAe,IAAI;AAEnB,SAAO,EAAE,WAAA;AACX;"}
@@ -0,0 +1,19 @@
1
+ import { Ref } from 'vue';
2
+ import { OverlayPosition } from '../../../foundation/styles';
3
+ /** Defines the stack and host state a swipe reads. */
4
+ export interface ToastSwipeSources {
5
+ readonly stack: Readonly<Ref<HTMLElement | null>>;
6
+ readonly position: () => OverlayPosition;
7
+ readonly reducedMotion: Readonly<Ref<boolean>>;
8
+ readonly dismiss: (id: string) => void;
9
+ }
10
+ /**
11
+ * Manages swiping a present card off the stack with a finger or stylus. The card follows a horizontal drag and
12
+ * fades toward the dismiss point; a release past 40% of its width, or a flick, toward a side it may leave by
13
+ * sends it off that side and dismisses it. Anything short springs back. A press on a control, a mouse, and a
14
+ * vertical pan stay theirs. Reduced motion drops the follow and the spring, never the dismissal.
15
+ */
16
+ export declare function useToastSwipe(sources: ToastSwipeSources): {
17
+ swiping: import('vue').ShallowRef<string | undefined, string | undefined>;
18
+ onPointerDown: (event: PointerEvent) => void;
19
+ };
@@ -0,0 +1,173 @@
1
+ import { shallowRef, onScopeDispose } from "vue";
2
+ import { animate } from "../../../foundation/animation/Animate.js";
3
+ import { GestureAxis } from "../../../foundation/gestures/enums/GestureAxis.js";
4
+ import { acceptsPointerType, exceedsThreshold, windowedVelocity } from "../../../foundation/gestures/GestureMath.js";
5
+ import { Side } from "../../../foundation/styles/enums/Side.js";
6
+ const SwipePointerTypes = ["touch", "pen"];
7
+ const SwipeSlop = 8;
8
+ const DismissFraction = 0.4;
9
+ const FlickDistance = 50;
10
+ const FlickVelocity = 0.3;
11
+ const VelocityWindowMs = 80;
12
+ const MaxSamples = 16;
13
+ const FadeFloor = 0.4;
14
+ const Resistance = 0.2;
15
+ const FallbackWidth = 320;
16
+ const SettleMs = 200;
17
+ const FlyOffMs = 160;
18
+ const InteractiveSelector = 'button, a[href], input, select, textarea, label, summary, [contenteditable]:not([contenteditable="false"]), [role="button"], [role="link"], [role="checkbox"], [role="switch"], [role="slider"], [role="menuitem"]';
19
+ function sidesFor(position) {
20
+ if (position.endsWith("right")) return /* @__PURE__ */ new Set([Side.Right]);
21
+ if (position.endsWith("left")) return /* @__PURE__ */ new Set([Side.Left]);
22
+ return /* @__PURE__ */ new Set([Side.Left, Side.Right]);
23
+ }
24
+ function widthOf(card) {
25
+ return card.offsetWidth || FallbackWidth;
26
+ }
27
+ function clearDrag(card) {
28
+ card.style.translate = "";
29
+ card.style.opacity = "";
30
+ card.style.transition = "";
31
+ }
32
+ function useToastSwipe(sources) {
33
+ const { stack, position, reducedMotion, dismiss } = sources;
34
+ const swiping = shallowRef();
35
+ let gesture = null;
36
+ function sample(active, event) {
37
+ active.samples.push({ x: event.clientX, y: event.clientY, t: event.timeStamp });
38
+ if (active.samples.length > MaxSamples) active.samples.shift();
39
+ }
40
+ function finish() {
41
+ window.removeEventListener("pointermove", onPointerMove);
42
+ window.removeEventListener("pointerup", onPointerEnd);
43
+ window.removeEventListener("pointercancel", onPointerEnd);
44
+ const active = gesture;
45
+ gesture = null;
46
+ if (!active) return;
47
+ try {
48
+ if (active.card.hasPointerCapture(active.pointerId)) active.card.releasePointerCapture(active.pointerId);
49
+ } catch {
50
+ }
51
+ }
52
+ function paint(active) {
53
+ if (reducedMotion.value) return;
54
+ const progress = Math.min(1, Math.abs(active.offset) / (widthOf(active.card) * DismissFraction));
55
+ active.card.style.transition = "none";
56
+ active.card.style.translate = `${active.offset}px 0`;
57
+ active.card.style.opacity = String(1 - (1 - FadeFloor) * progress);
58
+ }
59
+ function springBack(active) {
60
+ const { card, offset } = active;
61
+ const opacity = card.style.opacity || "1";
62
+ clearDrag(card);
63
+ if (reducedMotion.value || offset === 0 || typeof card.animate !== "function") return;
64
+ animate(
65
+ card,
66
+ [
67
+ { translate: `${offset}px 0`, opacity },
68
+ { translate: "0px 0", opacity: 1 }
69
+ ],
70
+ { duration: SettleMs, easing: "cubic-bezier(0.2, 0.8, 0.2, 1)" }
71
+ );
72
+ }
73
+ function flyOff(active, side) {
74
+ const { card, offset } = active;
75
+ if (reducedMotion.value) {
76
+ clearDrag(card);
77
+ return;
78
+ }
79
+ const opacity = card.style.opacity || "1";
80
+ const distance = (widthOf(card) + 32) * (side === Side.Left ? -1 : 1);
81
+ card.style.translate = `${distance}px 0`;
82
+ card.style.opacity = "0";
83
+ if (typeof card.animate !== "function") return;
84
+ animate(
85
+ card,
86
+ [
87
+ { translate: `${offset}px 0`, opacity },
88
+ { translate: `${distance}px 0`, opacity: 0 }
89
+ ],
90
+ { duration: FlyOffMs, easing: "ease-out" }
91
+ );
92
+ }
93
+ function onPointerMove(event) {
94
+ const active = gesture;
95
+ if (!active || event.pointerId !== active.pointerId) return;
96
+ if (!active.card.isConnected || active.card.hasAttribute("data-toast-exiting")) {
97
+ finish();
98
+ active.card.style.transition = "";
99
+ swiping.value = void 0;
100
+ return;
101
+ }
102
+ sample(active, event);
103
+ const dx = event.clientX - active.originX;
104
+ const dy = event.clientY - active.originY;
105
+ if (!active.recognized) {
106
+ if (Math.abs(dy) > Math.abs(dx) && exceedsThreshold(dx, dy, SwipeSlop, GestureAxis.Both)) {
107
+ finish();
108
+ return;
109
+ }
110
+ if (!exceedsThreshold(dx, dy, SwipeSlop, GestureAxis.X)) return;
111
+ active.recognized = true;
112
+ try {
113
+ active.card.setPointerCapture(active.pointerId);
114
+ } catch {
115
+ }
116
+ swiping.value = active.id;
117
+ }
118
+ const side = dx < 0 ? Side.Left : Side.Right;
119
+ active.offset = sidesFor(position()).has(side) ? dx : dx * Resistance;
120
+ paint(active);
121
+ }
122
+ function onPointerEnd(event) {
123
+ const active = gesture;
124
+ if (!active || event.pointerId !== active.pointerId) return;
125
+ const cancelled = event.type === "pointercancel";
126
+ if (!cancelled) sample(active, event);
127
+ finish();
128
+ if (!active.recognized) return;
129
+ const last = active.samples.at(-1);
130
+ const dx = (last?.x ?? active.originX) - active.originX;
131
+ const side = dx < 0 ? Side.Left : Side.Right;
132
+ const { velocityX } = windowedVelocity(active.samples, VelocityWindowMs);
133
+ const passed = Math.abs(dx) >= widthOf(active.card) * DismissFraction;
134
+ const flicked = Math.abs(dx) >= FlickDistance && Math.abs(velocityX) >= FlickVelocity && velocityX * dx > 0;
135
+ const leaves = !cancelled && (passed || flicked) && sidesFor(position()).has(side) && active.card.isConnected && !active.card.hasAttribute("data-toast-exiting");
136
+ if (leaves) {
137
+ flyOff(active, side);
138
+ dismiss(active.id);
139
+ } else {
140
+ springBack(active);
141
+ }
142
+ swiping.value = void 0;
143
+ }
144
+ function onPointerDown(event) {
145
+ if (gesture || event.button !== 0 || !acceptsPointerType(event.pointerType, SwipePointerTypes)) return;
146
+ const host = stack.value;
147
+ const target = event.target;
148
+ if (!host || !(target instanceof Element)) return;
149
+ const card = target.closest("[data-toast-id]");
150
+ if (!card?.dataset.toastId || card.parentElement !== host || card.hasAttribute("data-toast-exiting")) return;
151
+ const control = target.closest(InteractiveSelector);
152
+ if (control && card.contains(control)) return;
153
+ gesture = {
154
+ pointerId: event.pointerId,
155
+ id: card.dataset.toastId,
156
+ card,
157
+ originX: event.clientX,
158
+ originY: event.clientY,
159
+ samples: [{ x: event.clientX, y: event.clientY, t: event.timeStamp }],
160
+ recognized: false,
161
+ offset: 0
162
+ };
163
+ window.addEventListener("pointermove", onPointerMove);
164
+ window.addEventListener("pointerup", onPointerEnd);
165
+ window.addEventListener("pointercancel", onPointerEnd);
166
+ }
167
+ onScopeDispose(finish);
168
+ return { swiping, onPointerDown };
169
+ }
170
+ export {
171
+ useToastSwipe
172
+ };
173
+ //# sourceMappingURL=UseToastSwipe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UseToastSwipe.js","sources":["../../../../src/presentation/feedback/toastHost/UseToastSwipe.ts"],"sourcesContent":["import { onScopeDispose, shallowRef, type Ref } from 'vue';\n\nimport { animate } from '../../../foundation/animation';\nimport {\n acceptsPointerType,\n exceedsThreshold,\n GestureAxis,\n windowedVelocity,\n type GestureSample,\n} from '../../../foundation/gestures';\nimport { Side, type OverlayPosition } from '../../../foundation/styles';\n\n/** @internal The pointers a card follows — a finger or a stylus; a mouse keeps its text selection. */\nconst SwipePointerTypes = ['touch', 'pen'] as const;\n\n/** @internal The horizontal travel before a press becomes a swipe (px); below it a tap stays a tap. */\nconst SwipeSlop = 8;\n\n/** @internal The share of the card's width a release must pass to dismiss it (0..1). */\nconst DismissFraction = 0.4;\n\n/** @internal The distance a flick must cover to dismiss short of the dismiss point (px). */\nconst FlickDistance = 50;\n\n/** @internal The speed a flick must reach to dismiss short of the dismiss point (px/ms). */\nconst FlickVelocity = 0.3;\n\n/** @internal The window the release velocity is measured over (ms). */\nconst VelocityWindowMs = 80;\n\n/** @internal The most pointer samples a gesture keeps. */\nconst MaxSamples = 16;\n\n/** @internal The card's opacity at the dismiss point (0..1). */\nconst FadeFloor = 0.4;\n\n/** @internal The share of a drag kept toward a side the card cannot leave by (0..1). */\nconst Resistance = 0.2;\n\n/** @internal The width a card without layout counts as — the default `--toast-width` (px). */\nconst FallbackWidth = 320;\n\n/** @internal The duration of the spring back to rest (ms). */\nconst SettleMs = 200;\n\n/** @internal The duration of the fly-off after a dismissing release (ms). */\nconst FlyOffMs = 160;\n\n/** @internal A press on one of these acts on the control, never the card. */\nconst InteractiveSelector =\n 'button, a[href], input, select, textarea, label, summary, [contenteditable]:not([contenteditable=\"false\"]), ' +\n '[role=\"button\"], [role=\"link\"], [role=\"checkbox\"], [role=\"switch\"], [role=\"slider\"], [role=\"menuitem\"]';\n\n/** @internal The pointer gesture in progress on one card. */\ninterface SwipeGesture {\n readonly pointerId: number;\n readonly id: string;\n readonly card: HTMLElement;\n readonly originX: number;\n readonly originY: number;\n readonly samples: Array<GestureSample>;\n recognized: boolean;\n offset: number;\n}\n\n/** Defines the stack and host state a swipe reads. */\nexport interface ToastSwipeSources {\n readonly stack: Readonly<Ref<HTMLElement | null>>;\n readonly position: () => OverlayPosition;\n readonly reducedMotion: Readonly<Ref<boolean>>;\n readonly dismiss: (id: string) => void;\n}\n\n/** @internal The sides a card can leave by: toward its anchored side, or either side on a centered stack. */\nfunction sidesFor(position: OverlayPosition): ReadonlySet<Side> {\n if (position.endsWith('right')) return new Set<Side>([Side.Right]);\n if (position.endsWith('left')) return new Set<Side>([Side.Left]);\n return new Set<Side>([Side.Left, Side.Right]);\n}\n\n/** @internal Reads a card's width, or the fallback while it has no layout. */\nfunction widthOf(card: HTMLElement): number {\n return card.offsetWidth || FallbackWidth;\n}\n\n/** @internal Clears the inline styles a drag left on a card. */\nfunction clearDrag(card: HTMLElement): void {\n card.style.translate = '';\n card.style.opacity = '';\n card.style.transition = '';\n}\n\n/**\n * Manages swiping a present card off the stack with a finger or stylus. The card follows a horizontal drag and\n * fades toward the dismiss point; a release past 40% of its width, or a flick, toward a side it may leave by\n * sends it off that side and dismisses it. Anything short springs back. A press on a control, a mouse, and a\n * vertical pan stay theirs. Reduced motion drops the follow and the spring, never the dismissal.\n */\nexport function useToastSwipe(sources: ToastSwipeSources) {\n const { stack, position, reducedMotion, dismiss } = sources;\n /** The id of the card under a recognized drag. */\n const swiping = shallowRef<string>();\n let gesture: SwipeGesture | null = null;\n\n function sample(active: SwipeGesture, event: PointerEvent): void {\n active.samples.push({ x: event.clientX, y: event.clientY, t: event.timeStamp });\n if (active.samples.length > MaxSamples) active.samples.shift();\n }\n\n function finish(): void {\n window.removeEventListener('pointermove', onPointerMove);\n window.removeEventListener('pointerup', onPointerEnd);\n window.removeEventListener('pointercancel', onPointerEnd);\n const active = gesture;\n gesture = null;\n if (!active) return;\n try {\n if (active.card.hasPointerCapture(active.pointerId)) active.card.releasePointerCapture(active.pointerId);\n } catch {\n // The pointer is gone, or capture was never held.\n }\n }\n\n function paint(active: SwipeGesture): void {\n if (reducedMotion.value) return;\n const progress = Math.min(1, Math.abs(active.offset) / (widthOf(active.card) * DismissFraction));\n active.card.style.transition = 'none';\n active.card.style.translate = `${active.offset}px 0`;\n active.card.style.opacity = String(1 - (1 - FadeFloor) * progress);\n }\n\n function springBack(active: SwipeGesture): void {\n const { card, offset } = active;\n const opacity = card.style.opacity || '1';\n clearDrag(card);\n if (reducedMotion.value || offset === 0 || typeof card.animate !== 'function') return;\n animate(\n card,\n [\n { translate: `${offset}px 0`, opacity },\n { translate: '0px 0', opacity: 1 },\n ],\n { duration: SettleMs, easing: 'cubic-bezier(0.2, 0.8, 0.2, 1)' },\n );\n }\n\n function flyOff(active: SwipeGesture, side: Side): void {\n const { card, offset } = active;\n if (reducedMotion.value) {\n clearDrag(card);\n return;\n }\n const opacity = card.style.opacity || '1';\n const distance = (widthOf(card) + 32) * (side === Side.Left ? -1 : 1);\n // The card stays off-screen while its ordinary exit plays out invisibly in place.\n card.style.translate = `${distance}px 0`;\n card.style.opacity = '0';\n if (typeof card.animate !== 'function') return;\n animate(\n card,\n [\n { translate: `${offset}px 0`, opacity },\n { translate: `${distance}px 0`, opacity: 0 },\n ],\n { duration: FlyOffMs, easing: 'ease-out' },\n );\n }\n\n function onPointerMove(event: PointerEvent): void {\n const active = gesture;\n if (!active || event.pointerId !== active.pointerId) return;\n if (!active.card.isConnected || active.card.hasAttribute('data-toast-exiting')) {\n // Dismissed mid-drag: the card leaves from where the finger held it, with its own exit motion.\n finish();\n active.card.style.transition = '';\n swiping.value = undefined;\n return;\n }\n sample(active, event);\n const dx = event.clientX - active.originX;\n const dy = event.clientY - active.originY;\n if (!active.recognized) {\n // A pan that starts vertical belongs to the page.\n if (Math.abs(dy) > Math.abs(dx) && exceedsThreshold(dx, dy, SwipeSlop, GestureAxis.Both)) {\n finish();\n return;\n }\n if (!exceedsThreshold(dx, dy, SwipeSlop, GestureAxis.X)) return;\n active.recognized = true;\n try {\n active.card.setPointerCapture(active.pointerId);\n } catch {\n // The window listeners still deliver every move.\n }\n swiping.value = active.id;\n }\n const side: Side = dx < 0 ? Side.Left : Side.Right;\n active.offset = sidesFor(position()).has(side) ? dx : dx * Resistance;\n paint(active);\n }\n\n function onPointerEnd(event: PointerEvent): void {\n const active = gesture;\n if (!active || event.pointerId !== active.pointerId) return;\n const cancelled = event.type === 'pointercancel';\n if (!cancelled) sample(active, event);\n finish();\n if (!active.recognized) return;\n const last = active.samples.at(-1);\n const dx = (last?.x ?? active.originX) - active.originX;\n const side: Side = dx < 0 ? Side.Left : Side.Right;\n const { velocityX } = windowedVelocity(active.samples, VelocityWindowMs);\n const passed = Math.abs(dx) >= widthOf(active.card) * DismissFraction;\n const flicked = Math.abs(dx) >= FlickDistance && Math.abs(velocityX) >= FlickVelocity && velocityX * dx > 0;\n const leaves =\n !cancelled &&\n (passed || flicked) &&\n sidesFor(position()).has(side) &&\n active.card.isConnected &&\n !active.card.hasAttribute('data-toast-exiting');\n if (leaves) {\n flyOff(active, side);\n dismiss(active.id);\n } else {\n springBack(active);\n }\n swiping.value = undefined;\n }\n\n /** Starts tracking a press on a present card; bound to the stack's `pointerdown`. */\n function onPointerDown(event: PointerEvent): void {\n if (gesture || event.button !== 0 || !acceptsPointerType(event.pointerType, SwipePointerTypes)) return;\n const host = stack.value;\n const target = event.target;\n if (!host || !(target instanceof Element)) return;\n const card = target.closest<HTMLElement>('[data-toast-id]');\n if (!card?.dataset.toastId || card.parentElement !== host || card.hasAttribute('data-toast-exiting')) return;\n const control = target.closest(InteractiveSelector);\n if (control && card.contains(control)) return;\n gesture = {\n pointerId: event.pointerId,\n id: card.dataset.toastId,\n card,\n originX: event.clientX,\n originY: event.clientY,\n samples: [{ x: event.clientX, y: event.clientY, t: event.timeStamp }],\n recognized: false,\n offset: 0,\n };\n window.addEventListener('pointermove', onPointerMove);\n window.addEventListener('pointerup', onPointerEnd);\n window.addEventListener('pointercancel', onPointerEnd);\n }\n\n onScopeDispose(finish);\n\n return { swiping, onPointerDown };\n}\n"],"names":[],"mappings":";;;;;AAaA,MAAM,oBAAoB,CAAC,SAAS,KAAK;AAGzC,MAAM,YAAY;AAGlB,MAAM,kBAAkB;AAGxB,MAAM,gBAAgB;AAGtB,MAAM,gBAAgB;AAGtB,MAAM,mBAAmB;AAGzB,MAAM,aAA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astHost, useToastHost, ToastTimer, DefaultToastDurations, type ToastHostProps, type ToastOptions, type ToastContent, type ToastPromiseOptions, type ToastSeverity, } from './ToastHost.vue';
1
+ export { default as ToastHost, ToastTimer, ToastMotion, ToastGroupMotion, type ToastHostProps } from './ToastHost.vue';
2
+ export type { ToastContent } from './ToastContent';
3
+ export { toastHost } from './ToastHostStore';
4
+ export type { ToastOptions } from './ToastOptions';
5
+ export type { ToastPromiseOptions } from './ToastPromiseOptions';
6
+ export type { ToastSeverity } from './ToastSeverity';
7
+ export { DefaultToastDurations, DefaultToastPriorityDurations } from './UseResolvedToasts';
8
+ export { useToastHost } from './UseToastHost';
@@ -1,7 +1,13 @@
1
- import { DefaultToastDurations, default as default2, ToastTimer, toastHost, useToastHost } from "./ToastHost.vue.js";
1
+ import { ToastGroupMotion, default as default2, ToastMotion, ToastTimer } from "./ToastHost.vue.js";
2
+ import { toastHost } from "./ToastHostStore.js";
3
+ import { DefaultToastDurations, DefaultToastPriorityDurations } from "./UseResolvedToasts.js";
4
+ import { useToastHost } from "./UseToastHost.js";
2
5
  export {
3
6
  DefaultToastDurations,
7
+ DefaultToastPriorityDurations,
8
+ ToastGroupMotion,
4
9
  default2 as ToastHost,
10
+ ToastMotion,
5
11
  ToastTimer,
6
12
  toastHost,
7
13
  useToastHost
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,5 +1,7 @@
1
- /* Scan the compiled host and card modules; consumers provide Tailwind and semantic theme tokens. */
2
- @source './ToastHost*.vue.js';
1
+ /* Scan the compiled host, countdown and card modules; consumers provide Tailwind and semantic theme tokens. */
2
+ @source './Toast*.vue.js';
3
+ @source './ToastHostStyles.js';
4
+ @source '../feedbackToastHost/FeedbackToastHost*.vue.js';
3
5
  @source '../toast/Toast*.vue.js';
4
6
  @source '../toastSimple/ToastSimple*.vue.js';
5
7
  /* The severity glyph colours, and the Report action's button with its busy spinner, compile to their own modules. */
@@ -78,3 +80,13 @@
78
80
  transform: translateY(-8px);
79
81
  }
80
82
  }
83
+
84
+ /* The running bar's indeterminate sweep (`animate-[indeterminate_…]`); the same frames as the package-wide theme. */
85
+ @keyframes indeterminate {
86
+ 0% {
87
+ transform: translateX(-100%);
88
+ }
89
+ 100% {
90
+ transform: translateX(300%);
91
+ }
92
+ }