@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.
- package/dist/feedback/FeedbackBus.d.ts +154 -29
- package/dist/feedback/FeedbackBus.js +264 -27
- package/dist/feedback/FeedbackBus.js.map +1 -1
- package/dist/feedback/index.d.ts +1 -1
- package/dist/feedback/index.js +3 -1
- package/dist/foundation/dom/enums/ElementTag.d.ts +2 -0
- package/dist/foundation/dom/enums/ElementTag.js +3 -1
- package/dist/foundation/dom/enums/ElementTag.js.map +1 -1
- package/dist/index.js +404 -382
- package/dist/index.js.map +1 -1
- package/dist/presentation/actions/button/Button.variants.d.ts +12 -0
- package/dist/presentation/actions/button/Button.variants.js +18 -2
- package/dist/presentation/actions/button/Button.variants.js.map +1 -1
- package/dist/presentation/actions/button/Button.vue.d.ts +8 -1
- package/dist/presentation/actions/button/Button.vue.js +106 -58
- package/dist/presentation/actions/button/Button.vue.js.map +1 -1
- package/dist/presentation/actions/refreshButton/RefreshButton.vue.js.map +1 -1
- package/dist/presentation/display/badge/Badge.variants.d.ts +23 -1
- package/dist/presentation/display/badge/Badge.variants.js +18 -3
- package/dist/presentation/display/badge/Badge.variants.js.map +1 -1
- package/dist/presentation/display/badge/Badge.vue.d.ts +3 -0
- package/dist/presentation/display/badge/Badge.vue.js +10 -4
- package/dist/presentation/display/badge/Badge.vue.js.map +1 -1
- package/dist/presentation/display/carousel/Carousel.variants.d.ts +65 -0
- package/dist/presentation/display/carousel/Carousel.variants.js +56 -0
- package/dist/presentation/display/carousel/Carousel.variants.js.map +1 -0
- package/dist/presentation/display/carousel/Carousel.vue.d.ts +7 -0
- package/dist/presentation/display/carousel/Carousel.vue.js +7 -2
- package/dist/presentation/display/carousel/Carousel.vue.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselContext.d.ts +10 -0
- package/dist/presentation/display/carousel/CarouselContext.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselNext.vue.d.ts +6 -2
- package/dist/presentation/display/carousel/CarouselNext.vue.js +12 -4
- package/dist/presentation/display/carousel/CarouselNext.vue.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselPrev.vue.d.ts +6 -2
- package/dist/presentation/display/carousel/CarouselPrev.vue.js +12 -4
- package/dist/presentation/display/carousel/CarouselPrev.vue.js.map +1 -1
- package/dist/presentation/display/carousel/CarouselViewport.vue.d.ts +13 -2
- package/dist/presentation/display/carousel/CarouselViewport.vue.js +54 -2
- package/dist/presentation/display/carousel/CarouselViewport.vue.js.map +1 -1
- package/dist/presentation/display/carousel/index.d.ts +1 -0
- package/dist/presentation/display/index.d.ts +1 -0
- package/dist/presentation/display/index.js +120 -108
- package/dist/presentation/display/index.js.map +1 -1
- package/dist/presentation/display/mediaCard/MediaCard.vue.d.ts +41 -0
- package/dist/presentation/display/mediaCard/MediaCard.vue.js +108 -0
- package/dist/presentation/display/mediaCard/MediaCard.vue.js.map +1 -0
- package/dist/presentation/display/mediaCard/MediaCard2.vue.js +5 -0
- package/dist/presentation/display/mediaCard/MediaCard2.vue.js.map +1 -0
- package/dist/presentation/display/mediaCard/index.d.ts +1 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.d.ts +37 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.js +72 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem.vue.js.map +1 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem2.vue.js +7 -0
- package/dist/presentation/display/metaInlineText/MetaInlineItem2.vue.js.map +1 -0
- package/dist/presentation/display/metaInlineText/index.d.ts +1 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.d.ts +18 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.js +120 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton2.vue.js +5 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterButton2.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.d.ts +11 -6
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.js +255 -61
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.js.map +1 -1
- package/dist/presentation/display/notificationCenterGroup/{NotificationItem.vue.d.ts → NotificationCenterGroupItem.vue.d.ts} +13 -12
- package/dist/presentation/display/notificationCenterGroup/{NotificationItem.vue.js → NotificationCenterGroupItem.vue.js} +81 -58
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem2.vue.js +5 -0
- package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem2.vue.js.map +1 -0
- package/dist/presentation/display/notificationCenterGroup/index.d.ts +6 -1
- package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.d.ts +1 -9
- package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.js +165 -20
- package/dist/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue.js.map +1 -1
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.d.ts +7 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.js +56 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton.vue.js.map +1 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton2.vue.js +5 -0
- package/dist/presentation/feedback/feedbackToastHost/RemindLaterButton2.vue.js.map +1 -0
- package/dist/presentation/feedback/index.js +9 -1
- package/dist/presentation/feedback/index.js.map +1 -1
- package/dist/presentation/feedback/toast/Toast.vue.d.ts +34 -8
- package/dist/presentation/feedback/toast/Toast.vue.js +290 -85
- package/dist/presentation/feedback/toast/Toast.vue.js.map +1 -1
- package/dist/presentation/feedback/toast/ToastContent.vue.d.ts +25 -0
- package/dist/presentation/feedback/toast/ToastContent.vue.js +78 -0
- package/dist/presentation/feedback/toast/ToastContent.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastContent2.vue.js +5 -0
- package/dist/presentation/feedback/toast/ToastContent2.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress.vue.d.ts +15 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress.vue.js +88 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress2.vue.js +5 -0
- package/dist/presentation/feedback/toast/ToastRunningProgress2.vue.js.map +1 -0
- package/dist/presentation/feedback/toast/ToastSurface.d.ts +8 -0
- package/dist/presentation/feedback/toast/ToastSurface.js +10 -0
- package/dist/presentation/feedback/toast/ToastSurface.js.map +1 -0
- package/dist/presentation/feedback/toast/index.d.ts +1 -0
- package/dist/presentation/feedback/toastHost/ToastContent.d.ts +3 -0
- package/dist/presentation/feedback/toastHost/ToastEntry.d.ts +12 -0
- package/dist/presentation/feedback/toastHost/ToastFocusExtensions.d.ts +2 -0
- package/dist/presentation/feedback/toastHost/ToastFocusExtensions.js +11 -0
- package/dist/presentation/feedback/toastHost/ToastFocusExtensions.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastGroup.d.ts +8 -0
- package/dist/presentation/feedback/toastHost/ToastGroupLatest.d.ts +10 -0
- package/dist/presentation/feedback/toastHost/ToastHost.vue.d.ts +55 -110
- package/dist/presentation/feedback/toastHost/ToastHost.vue.js +394 -399
- package/dist/presentation/feedback/toastHost/ToastHost.vue.js.map +1 -1
- package/dist/presentation/feedback/toastHost/ToastHost2.vue.js +4 -5
- package/dist/presentation/feedback/toastHost/ToastHostStore.d.ts +37 -0
- package/dist/presentation/feedback/toastHost/ToastHostStore.js +98 -0
- package/dist/presentation/feedback/toastHost/ToastHostStore.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastHostStyles.d.ts +34 -0
- package/dist/presentation/feedback/toastHost/ToastHostStyles.js +44 -0
- package/dist/presentation/feedback/toastHost/ToastHostStyles.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastNode.d.ts +3 -0
- package/dist/presentation/feedback/toastHost/ToastOptions.d.ts +72 -0
- package/dist/presentation/feedback/toastHost/ToastProgress.vue.d.ts +11 -0
- package/dist/presentation/feedback/toastHost/ToastProgress.vue.js +44 -0
- package/dist/presentation/feedback/toastHost/ToastProgress.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastProgress2.vue.js +5 -0
- package/dist/presentation/feedback/toastHost/ToastProgress2.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastPromiseOptions.d.ts +12 -0
- package/dist/presentation/feedback/toastHost/ToastRing.vue.d.ts +14 -0
- package/dist/presentation/feedback/toastHost/ToastRing.vue.js +65 -0
- package/dist/presentation/feedback/toastHost/ToastRing.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastRing2.vue.js +5 -0
- package/dist/presentation/feedback/toastHost/ToastRing2.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds.vue.d.ts +9 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds.vue.js +56 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds2.vue.js +5 -0
- package/dist/presentation/feedback/toastHost/ToastSeconds2.vue.js.map +1 -0
- package/dist/presentation/feedback/toastHost/ToastSeverity.d.ts +3 -0
- package/dist/presentation/feedback/toastHost/UseResolvedToasts.d.ts +27 -0
- package/dist/presentation/feedback/toastHost/UseResolvedToasts.js +34 -0
- package/dist/presentation/feedback/toastHost/UseResolvedToasts.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastAnnouncer.d.ts +14 -0
- package/dist/presentation/feedback/toastHost/UseToastAnnouncer.js +106 -0
- package/dist/presentation/feedback/toastHost/UseToastAnnouncer.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastCapacity.d.ts +34 -0
- package/dist/presentation/feedback/toastHost/UseToastCapacity.js +128 -0
- package/dist/presentation/feedback/toastHost/UseToastCapacity.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastClock.d.ts +44 -0
- package/dist/presentation/feedback/toastHost/UseToastClock.js +134 -0
- package/dist/presentation/feedback/toastHost/UseToastClock.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastCountdown.d.ts +26 -0
- package/dist/presentation/feedback/toastHost/UseToastCountdown.js +23 -0
- package/dist/presentation/feedback/toastHost/UseToastCountdown.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastEntries.d.ts +4 -0
- package/dist/presentation/feedback/toastHost/UseToastEntries.js +17 -0
- package/dist/presentation/feedback/toastHost/UseToastEntries.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastExits.d.ts +11 -0
- package/dist/presentation/feedback/toastHost/UseToastExits.js +52 -0
- package/dist/presentation/feedback/toastHost/UseToastExits.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastGroupMotion.d.ts +43 -0
- package/dist/presentation/feedback/toastHost/UseToastGroupMotion.js +173 -0
- package/dist/presentation/feedback/toastHost/UseToastGroupMotion.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastHost.d.ts +10 -0
- package/dist/presentation/feedback/toastHost/UseToastHost.js +14 -0
- package/dist/presentation/feedback/toastHost/UseToastHost.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastHotkey.d.ts +20 -0
- package/dist/presentation/feedback/toastHost/UseToastHotkey.js +66 -0
- package/dist/presentation/feedback/toastHost/UseToastHotkey.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastPins.d.ts +26 -0
- package/dist/presentation/feedback/toastHost/UseToastPins.js +35 -0
- package/dist/presentation/feedback/toastHost/UseToastPins.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastStackMotion.d.ts +27 -0
- package/dist/presentation/feedback/toastHost/UseToastStackMotion.js +96 -0
- package/dist/presentation/feedback/toastHost/UseToastStackMotion.js.map +1 -0
- package/dist/presentation/feedback/toastHost/UseToastSwipe.d.ts +19 -0
- package/dist/presentation/feedback/toastHost/UseToastSwipe.js +173 -0
- package/dist/presentation/feedback/toastHost/UseToastSwipe.js.map +1 -0
- package/dist/presentation/feedback/toastHost/index.d.ts +8 -1
- package/dist/presentation/feedback/toastHost/index.js +7 -1
- package/dist/presentation/feedback/toastHost/index.js.map +1 -1
- package/dist/presentation/feedback/toastHost/styles.css +14 -2
- package/dist/presentation/layout/grid/Grid.variants.d.ts +7 -0
- package/dist/presentation/layout/grid/Grid.variants.js +4 -0
- package/dist/presentation/layout/grid/Grid.variants.js.map +1 -1
- package/dist/presentation/layout/grid/Grid.vue.d.ts +5 -0
- package/dist/presentation/layout/grid/Grid.vue.js +16 -4
- package/dist/presentation/layout/grid/Grid.vue.js.map +1 -1
- package/dist/presentation/layout/grid/index.d.ts +1 -1
- package/dist/presentation/layout/index.js +3 -1
- package/dist/presentation/nav/accountMenu/AccountMenu.vue.d.ts +1 -1
- package/dist/presentation/overlays/hoverCard/HoverCard.vue.d.ts +1 -1
- package/dist/presentation/overlays/popover/PopoverContent.vue.js +4 -4
- package/dist/presentation/overlays/popover/PopoverContent.vue.js.map +1 -1
- package/dist/presentation/overlays/tooltip/Tooltip.vue.d.ts +1 -1
- package/dist/presentation/overlays/tooltip/Tooltip.vue.js +8 -9
- package/dist/presentation/overlays/tooltip/Tooltip.vue.js.map +1 -1
- package/package.json +1 -1
- package/dist/presentation/display/notificationCenterGroup/NotificationItem.vue.js.map +0 -1
- package/dist/presentation/display/notificationCenterGroup/NotificationItem2.vue.js +0 -5
- package/dist/presentation/display/notificationCenterGroup/NotificationItem2.vue.js.map +0 -1
|
@@ -1,14 +1,41 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, useAttrs, useTemplateRef, shallowRef, computed, watch, openBlock, createBlock, unref, withCtx, createElementBlock, normalizeClass, normalizeStyle, Fragment, renderList, createElementVNode, createSlots, createVNode, createCommentVNode, mergeProps, toDisplayString, createTextVNode } from "vue";
|
|
2
|
+
import { ChevronDown } from "lucide-vue-next";
|
|
3
|
+
import { AnimationDefaults } from "../../../foundation/animation/Animate.js";
|
|
4
|
+
import { useReducedMotion } from "../../../foundation/device/hooks/UseReducedMotion.js";
|
|
5
|
+
import { dataAttr } from "../../../foundation/dom/DataAttr.js";
|
|
6
|
+
import { Key } from "../../../foundation/dom/enums/Key.js";
|
|
2
7
|
import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
|
|
8
|
+
import _sfc_main$3 from "../reportAction/ReportAction.vue.js";
|
|
9
|
+
import _sfc_main$2 from "../toast/Toast.vue.js";
|
|
10
|
+
import { compareOrder, toastHost } from "./ToastHostStore.js";
|
|
11
|
+
import { PositionClasses, StackClass, VerticalSlideClass, SideSlideClasses, ItemClass, StackInsets, GroupCountClass, UpdateHighlightClass, GroupArrivalClass, OverflowButtonClass } from "./ToastHostStyles.js";
|
|
12
|
+
import _sfc_main$6 from "./ToastProgress.vue.js";
|
|
13
|
+
import _sfc_main$4 from "./ToastRing.vue.js";
|
|
14
|
+
import _sfc_main$5 from "./ToastSeconds.vue.js";
|
|
15
|
+
import { DefaultToastDurations, useResolvedToasts } from "./UseResolvedToasts.js";
|
|
16
|
+
import { useToastAnnouncer } from "./UseToastAnnouncer.js";
|
|
17
|
+
import { useToastCapacity } from "./UseToastCapacity.js";
|
|
18
|
+
import { useToastClock } from "./UseToastClock.js";
|
|
19
|
+
import { useToastEntries } from "./UseToastEntries.js";
|
|
20
|
+
import { useToastExits } from "./UseToastExits.js";
|
|
21
|
+
import { useToastGroupMotion, ToastChange } from "./UseToastGroupMotion.js";
|
|
22
|
+
import { useToastHotkey } from "./UseToastHotkey.js";
|
|
23
|
+
import { useToastPins } from "./UseToastPins.js";
|
|
24
|
+
import { useToastStackMotion } from "./UseToastStackMotion.js";
|
|
25
|
+
import { useToastSwipe } from "./UseToastSwipe.js";
|
|
3
26
|
import { cn } from "../../../foundation/styles/Cn.js";
|
|
27
|
+
import { Severity } from "../../../foundation/styles/enums/Severity.js";
|
|
28
|
+
import { Side } from "../../../foundation/styles/enums/Side.js";
|
|
4
29
|
import { OverlayPosition } from "../../../foundation/styles/enums/OverlayPosition.js";
|
|
5
|
-
import
|
|
6
|
-
import _sfc_main$3 from "../reportAction/ReportAction.vue.js";
|
|
30
|
+
import { ToastSurface } from "../toast/ToastSurface.js";
|
|
7
31
|
import _sfc_main$1 from "../../../foundation/primitives/portal/Portal.vue.js";
|
|
8
32
|
import { Presence } from "../../../foundation/primitives/presence/Presence.js";
|
|
9
|
-
import _sfc_main$
|
|
10
|
-
|
|
11
|
-
|
|
33
|
+
import _sfc_main$7 from "../../actions/button/Button.vue.js";
|
|
34
|
+
import _sfc_main$8 from "../../../foundation/icons/icon/Icon.vue.js";
|
|
35
|
+
import _sfc_main$9 from "../../../foundation/primitives/announce/Announce.vue.js";
|
|
36
|
+
const _hoisted_1 = ["data-toast-position", "aria-label", "data-toast-expanded"];
|
|
37
|
+
const _hoisted_2 = ["data-toast-exiting", "data-toast-id", "data-toast-swiping", "inert", "onVnodeBeforeUnmount", "onVnodeUnmounted"];
|
|
38
|
+
const _hoisted_3 = { class: "min-w-0 [overflow-wrap:anywhere]" };
|
|
12
39
|
const ToastTimer = {
|
|
13
40
|
/** Refers to no countdown — the toast still expires on time. */
|
|
14
41
|
None: "none",
|
|
@@ -16,408 +43,268 @@ const ToastTimer = {
|
|
|
16
43
|
Bar: "bar",
|
|
17
44
|
/** Refers to a ring draining beside the close button. */
|
|
18
45
|
Ring: "ring",
|
|
46
|
+
/** Refers to a ring around the close button, with a dim arc for elapsed time. */
|
|
47
|
+
CloseRing: "closeRing",
|
|
19
48
|
/** Refers to the whole seconds left, counted beside the close button. */
|
|
20
49
|
Seconds: "seconds"
|
|
21
50
|
};
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
idSeq = 0;
|
|
32
|
-
toast(opts) {
|
|
33
|
-
if (opts.key !== void 0) {
|
|
34
|
-
const existing = this.items.find((t) => t.key === opts.key);
|
|
35
|
-
if (existing) {
|
|
36
|
-
this.update(existing.id, opts);
|
|
37
|
-
return existing.id;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const id = `t_${++this.idSeq}`;
|
|
41
|
-
this.items = [...this.items, { id, ...opts, nonce: 0 }];
|
|
42
|
-
this.emit();
|
|
43
|
-
return id;
|
|
44
|
-
}
|
|
45
|
-
/** Merges a patch into an existing toast (content + severity + duration), refreshing its timer. */
|
|
46
|
-
update(id, patch) {
|
|
47
|
-
this.items = this.items.map((t) => t.id === id ? { ...t, ...patch, nonce: t.nonce + 1 } : t);
|
|
48
|
-
this.emit();
|
|
49
|
-
}
|
|
50
|
-
/** Shows a sticky loading toast; returns the full content-update and promise settlement chain. */
|
|
51
|
-
promise(promise, opts) {
|
|
52
|
-
const id = this.toast({ ...normalizeContent(opts.loading), severity: "info", duration: Infinity });
|
|
53
|
-
const settle = (content, severity) => this.update(id, { ...normalizeContent(content), severity, duration: opts.duration });
|
|
54
|
-
return promise.then(
|
|
55
|
-
(value) => {
|
|
56
|
-
settle(typeof opts.success === "function" ? opts.success(value) : opts.success, "success");
|
|
57
|
-
return value;
|
|
58
|
-
},
|
|
59
|
-
(err) => {
|
|
60
|
-
settle(typeof opts.error === "function" ? opts.error(err) : opts.error, "danger");
|
|
61
|
-
throw err;
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
dismiss(id) {
|
|
66
|
-
const entry = this.items.find((t) => t.id === id);
|
|
67
|
-
this.items = this.items.filter((t) => t.id !== id);
|
|
68
|
-
try {
|
|
69
|
-
entry?.onDismiss?.();
|
|
70
|
-
} finally {
|
|
71
|
-
this.emit();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
dismissAll() {
|
|
75
|
-
const gone = this.items;
|
|
76
|
-
this.items = [];
|
|
77
|
-
try {
|
|
78
|
-
for (const t of gone) t.onDismiss?.();
|
|
79
|
-
} finally {
|
|
80
|
-
this.emit();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
subscribe(fn) {
|
|
84
|
-
this.listeners.add(fn);
|
|
85
|
-
fn(this.items);
|
|
86
|
-
return () => {
|
|
87
|
-
this.listeners.delete(fn);
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
emit() {
|
|
91
|
-
for (const fn of this.listeners) fn(this.items);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const toastHost = new ToastHostStore();
|
|
95
|
-
function useToastHost() {
|
|
96
|
-
return {
|
|
97
|
-
toast: (opts) => toastHost.toast(opts),
|
|
98
|
-
update: (id, patch) => toastHost.update(id, patch),
|
|
99
|
-
promise: (promise, opts) => toastHost.promise(promise, opts),
|
|
100
|
-
dismiss: (id) => toastHost.dismiss(id),
|
|
101
|
-
dismissAll: () => toastHost.dismissAll()
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
const PositionClasses = "top-4 right-4 items-end";
|
|
105
|
-
const MotionClasses = "motion-safe:data-[state=open]:animate-(--animate-slide-in-right) motion-safe:data-[state=closed]:animate-(--animate-slide-out-right) motion-reduce:animate-none";
|
|
106
|
-
const ProgressClasses = {
|
|
107
|
-
neutral: "bg-primary",
|
|
108
|
-
info: "bg-info",
|
|
109
|
-
success: "bg-success",
|
|
110
|
-
warning: "bg-warning",
|
|
111
|
-
danger: "bg-destructive"
|
|
51
|
+
const ToastMotion = {
|
|
52
|
+
/** Refers to a horizontal slide in from the side of the selected corner. */
|
|
53
|
+
SideSlide: "sideSlide",
|
|
54
|
+
/** Refers to a short move toward the selected top or bottom edge. */
|
|
55
|
+
ShortSlide: "shortSlide",
|
|
56
|
+
/** Refers to a move by the card's height toward the selected top or bottom edge. */
|
|
57
|
+
EdgeSlide: "edgeSlide",
|
|
58
|
+
/** Refers to a move toward the edge while scaling to full size. */
|
|
59
|
+
SlideAndSettle: "slideAndSettle"
|
|
112
60
|
};
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
danger: "stroke-destructive"
|
|
61
|
+
const ToastGroupMotion = {
|
|
62
|
+
/** Refers to a preview that passes over the stack and merges into its group. */
|
|
63
|
+
Card: "card",
|
|
64
|
+
/** Refers to an in-place update whose count briefly glows. */
|
|
65
|
+
Highlight: "highlight"
|
|
119
66
|
};
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
67
|
+
const VerticalMotions = {
|
|
68
|
+
[ToastMotion.ShortSlide]: {
|
|
69
|
+
offset: "12px",
|
|
70
|
+
scale: 1,
|
|
71
|
+
enter: "200ms",
|
|
72
|
+
exit: "150ms",
|
|
73
|
+
easing: "cubic-bezier(0, 0, 0.2, 1)"
|
|
74
|
+
},
|
|
75
|
+
[ToastMotion.EdgeSlide]: {
|
|
76
|
+
offset: "calc(100% + 1rem)",
|
|
77
|
+
scale: 1,
|
|
78
|
+
enter: "260ms",
|
|
79
|
+
exit: "180ms",
|
|
80
|
+
easing: "cubic-bezier(0.16, 1, 0.3, 1)"
|
|
81
|
+
},
|
|
82
|
+
[ToastMotion.SlideAndSettle]: {
|
|
83
|
+
offset: "24px",
|
|
84
|
+
scale: 0.97,
|
|
85
|
+
enter: "240ms",
|
|
86
|
+
exit: "140ms",
|
|
87
|
+
easing: "cubic-bezier(0.2, 0.8, 0.2, 1)"
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const ToastNodeView = defineComponent({
|
|
91
|
+
name: "ToastNodeView",
|
|
92
|
+
props: { node: { type: [String, Object], required: true } },
|
|
93
|
+
setup: (nodeProps) => () => nodeProps.node
|
|
94
|
+
});
|
|
123
95
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
124
96
|
...{ name: "ToastHost", inheritAttrs: false },
|
|
125
97
|
__name: "ToastHost",
|
|
126
98
|
props: {
|
|
127
99
|
position: { default: OverlayPosition.TopRight },
|
|
100
|
+
motion: { default: ToastMotion.SideSlide },
|
|
101
|
+
groupMotion: { default: ToastGroupMotion.Highlight },
|
|
128
102
|
max: { default: 5 },
|
|
103
|
+
moveDuration: { default: AnimationDefaults.duration },
|
|
129
104
|
defaultDuration: { default: 5e3 },
|
|
130
105
|
durations: { default: () => DefaultToastDurations },
|
|
106
|
+
priorityDurations: {},
|
|
131
107
|
canPauseOnHover: { type: Boolean, default: true },
|
|
108
|
+
canPin: { type: Boolean, default: true },
|
|
132
109
|
gap: { default: 8 },
|
|
133
110
|
timer: { default: void 0 },
|
|
134
|
-
|
|
135
|
-
|
|
111
|
+
showSeverityIcon: { type: Boolean, default: true },
|
|
112
|
+
surface: { default: void 0 },
|
|
113
|
+
hotkey: { type: [String, Boolean], default: "F8" }
|
|
136
114
|
},
|
|
137
115
|
setup(__props) {
|
|
138
|
-
const locale = useLocale();
|
|
139
|
-
const ToastNodeView = defineComponent({
|
|
140
|
-
name: "ToastNodeView",
|
|
141
|
-
props: { node: { type: [String, Object], required: true } },
|
|
142
|
-
setup: (nodeProps) => () => nodeProps.node
|
|
143
|
-
});
|
|
144
|
-
const CountdownProps = {
|
|
145
|
-
duration: { type: Number, required: true },
|
|
146
|
-
paused: { type: Boolean, default: false },
|
|
147
|
-
severity: { type: String, default: "neutral" }
|
|
148
|
-
};
|
|
149
|
-
function useCountdownAnimation(element, keyframes, countdown) {
|
|
150
|
-
let animation;
|
|
151
|
-
onMounted(() => {
|
|
152
|
-
const target = element();
|
|
153
|
-
if (!target || typeof target.animate !== "function") return;
|
|
154
|
-
animation = target.animate(keyframes, { duration: countdown.duration, easing: "linear", fill: "forwards" });
|
|
155
|
-
if (countdown.paused) animation.pause();
|
|
156
|
-
});
|
|
157
|
-
watch(
|
|
158
|
-
() => countdown.paused,
|
|
159
|
-
(isPaused) => {
|
|
160
|
-
if (isPaused) animation?.pause();
|
|
161
|
-
else animation?.play();
|
|
162
|
-
}
|
|
163
|
-
);
|
|
164
|
-
onUnmounted(() => animation?.cancel());
|
|
165
|
-
}
|
|
166
|
-
const ToastProgress = defineComponent({
|
|
167
|
-
name: "ToastProgress",
|
|
168
|
-
props: CountdownProps,
|
|
169
|
-
setup(countdown) {
|
|
170
|
-
const fill = ref(null);
|
|
171
|
-
useCountdownAnimation(() => fill.value, [{ transform: "scaleX(1)" }, { transform: "scaleX(0)" }], countdown);
|
|
172
|
-
return () => h(
|
|
173
|
-
"div",
|
|
174
|
-
{
|
|
175
|
-
"aria-hidden": "true",
|
|
176
|
-
"data-toast-progress": "",
|
|
177
|
-
class: "absolute inset-x-0 bottom-0 h-1 motion-reduce:hidden"
|
|
178
|
-
},
|
|
179
|
-
[
|
|
180
|
-
h("div", {
|
|
181
|
-
ref: fill,
|
|
182
|
-
class: cn("h-full w-full origin-left opacity-80", ProgressClasses[countdown.severity])
|
|
183
|
-
})
|
|
184
|
-
]
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
const ToastRing = defineComponent({
|
|
189
|
-
name: "ToastRing",
|
|
190
|
-
props: CountdownProps,
|
|
191
|
-
setup(countdown) {
|
|
192
|
-
const arc = ref(null);
|
|
193
|
-
useCountdownAnimation(
|
|
194
|
-
() => arc.value,
|
|
195
|
-
[{ strokeDashoffset: "0" }, { strokeDashoffset: `${RingCircumference}` }],
|
|
196
|
-
countdown
|
|
197
|
-
);
|
|
198
|
-
return () => h(
|
|
199
|
-
"svg",
|
|
200
|
-
{
|
|
201
|
-
"aria-hidden": "true",
|
|
202
|
-
"data-toast-timer": ToastTimer.Ring,
|
|
203
|
-
viewBox: "0 0 16 16",
|
|
204
|
-
class: "size-4 -rotate-90 motion-reduce:hidden"
|
|
205
|
-
},
|
|
206
|
-
[
|
|
207
|
-
h("circle", { cx: 8, cy: 8, r: RingRadius, fill: "none", "stroke-width": 2, class: "stroke-border" }),
|
|
208
|
-
h("circle", {
|
|
209
|
-
ref: arc,
|
|
210
|
-
cx: 8,
|
|
211
|
-
cy: 8,
|
|
212
|
-
r: RingRadius,
|
|
213
|
-
fill: "none",
|
|
214
|
-
"stroke-width": 2,
|
|
215
|
-
"stroke-linecap": "round",
|
|
216
|
-
"stroke-dasharray": `${RingCircumference}`,
|
|
217
|
-
class: RingClasses[countdown.severity]
|
|
218
|
-
})
|
|
219
|
-
]
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
const ToastSeconds = defineComponent({
|
|
224
|
-
name: "ToastSeconds",
|
|
225
|
-
props: CountdownProps,
|
|
226
|
-
setup(countdown) {
|
|
227
|
-
const left = ref(countdown.duration);
|
|
228
|
-
let lastTick = 0;
|
|
229
|
-
let handle;
|
|
230
|
-
const tick = () => {
|
|
231
|
-
const now = Date.now();
|
|
232
|
-
left.value = Math.max(0, left.value - (now - lastTick));
|
|
233
|
-
lastTick = now;
|
|
234
|
-
};
|
|
235
|
-
const start = () => {
|
|
236
|
-
if (handle !== void 0) return;
|
|
237
|
-
lastTick = Date.now();
|
|
238
|
-
handle = window.setInterval(tick, SecondsTickMs);
|
|
239
|
-
};
|
|
240
|
-
const stop = () => {
|
|
241
|
-
if (handle === void 0) return;
|
|
242
|
-
tick();
|
|
243
|
-
window.clearInterval(handle);
|
|
244
|
-
handle = void 0;
|
|
245
|
-
};
|
|
246
|
-
onMounted(() => {
|
|
247
|
-
if (!countdown.paused) start();
|
|
248
|
-
});
|
|
249
|
-
watch(
|
|
250
|
-
() => countdown.paused,
|
|
251
|
-
(isPaused) => isPaused ? stop() : start()
|
|
252
|
-
);
|
|
253
|
-
onUnmounted(() => {
|
|
254
|
-
if (handle !== void 0) window.clearInterval(handle);
|
|
255
|
-
});
|
|
256
|
-
return () => h(
|
|
257
|
-
"span",
|
|
258
|
-
{
|
|
259
|
-
"aria-hidden": "true",
|
|
260
|
-
"data-toast-timer": ToastTimer.Seconds,
|
|
261
|
-
class: "text-xs tabular-nums text-muted-foreground"
|
|
262
|
-
},
|
|
263
|
-
`${Math.ceil(left.value / 1e3)}s`
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
116
|
const props = __props;
|
|
268
117
|
const attrs = useAttrs();
|
|
269
|
-
const
|
|
270
|
-
const
|
|
271
|
-
const
|
|
272
|
-
const
|
|
273
|
-
const
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
118
|
+
const locale = useLocale();
|
|
119
|
+
const reducedMotion = useReducedMotion();
|
|
120
|
+
const stack = useTemplateRef("stack");
|
|
121
|
+
const overflowButton = useTemplateRef("overflowButton");
|
|
122
|
+
const expandedDetails = shallowRef(/* @__PURE__ */ new Set());
|
|
123
|
+
const position = computed(
|
|
124
|
+
() => Object.hasOwn(PositionClasses, props.position) ? props.position : OverlayPosition.TopRight
|
|
125
|
+
);
|
|
126
|
+
const verticalMotion = computed(
|
|
127
|
+
() => props.motion === ToastMotion.SideSlide ? void 0 : VerticalMotions[props.motion]
|
|
128
|
+
);
|
|
129
|
+
const resolved = useResolvedToasts(useToastEntries(), props);
|
|
130
|
+
const pins = useToastPins(resolved, props);
|
|
131
|
+
const { overflowOpen, needsScroll, overflowCount, visible, copyOf, measureCapacity, toggleOverflow, ...capacity } = useToastCapacity(
|
|
132
|
+
{ stack, overflowButton: () => overflowButton.value?.el, cards: resolved, ordered: pins.ordered },
|
|
133
|
+
props
|
|
134
|
+
);
|
|
135
|
+
const activeIds = computed(() => new Set(resolved.value.map((card) => card.id)));
|
|
136
|
+
const visibleIds = computed(() => new Set(visible.value.map((card) => card.id)));
|
|
137
|
+
const { exiting, removeExiting } = useToastExits(stack, visible, visibleIds, activeIds);
|
|
138
|
+
const { swiping, onPointerDown: onSwipeStart } = useToastSwipe({
|
|
139
|
+
stack,
|
|
140
|
+
position: () => position.value,
|
|
141
|
+
reducedMotion,
|
|
142
|
+
dismiss: (id) => toastHost.dismiss(id)
|
|
282
143
|
});
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
144
|
+
const { pausedIds, hasCountdown, countdownKey, timerElapsed, ...clock } = useToastClock(
|
|
145
|
+
{
|
|
146
|
+
stack,
|
|
147
|
+
cards: resolved,
|
|
148
|
+
visible,
|
|
149
|
+
activeIds,
|
|
150
|
+
visibleIds,
|
|
151
|
+
exiting,
|
|
152
|
+
expandedDetails,
|
|
153
|
+
pins,
|
|
154
|
+
browsing: () => overflowOpen.value,
|
|
155
|
+
swiping: () => swiping.value,
|
|
156
|
+
expire: (id) => toastHost.dismiss(id)
|
|
157
|
+
},
|
|
158
|
+
props
|
|
288
159
|
);
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const merged = [...current, ...gone.filter((g) => !known.has(g.id))].filter((e) => !ids.has(e.id));
|
|
300
|
-
if (merged.length !== current.length || !merged.every((e, i) => e.id === current[i]?.id)) {
|
|
301
|
-
exiting.value = merged;
|
|
302
|
-
}
|
|
160
|
+
const { captureToastChange } = useToastGroupMotion(
|
|
161
|
+
{
|
|
162
|
+
stack,
|
|
163
|
+
visible,
|
|
164
|
+
position: () => position.value,
|
|
165
|
+
groupMotion: () => props.groupMotion,
|
|
166
|
+
reducedMotion,
|
|
167
|
+
scrolls: () => overflowOpen.value || needsScroll.value,
|
|
168
|
+
isExpanded: (id) => expandedDetails.value.has(id),
|
|
169
|
+
copyOf
|
|
303
170
|
},
|
|
304
|
-
|
|
171
|
+
props
|
|
305
172
|
);
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
if (typeof last?.title === "string") return last.title;
|
|
316
|
-
if (typeof last?.description === "string") return last.description;
|
|
317
|
-
return "";
|
|
173
|
+
const { captureGap } = useToastStackMotion(
|
|
174
|
+
{ stack, visible, position: () => position.value, reducedMotion, browsing: () => overflowOpen.value },
|
|
175
|
+
props
|
|
176
|
+
);
|
|
177
|
+
const { polite: politeMessage, assertive: assertiveMessage } = useToastAnnouncer(resolved, locale);
|
|
178
|
+
const hotkey = useToastHotkey({
|
|
179
|
+
stack,
|
|
180
|
+
hotkey: () => props.hotkey,
|
|
181
|
+
hasCards: () => visible.value.length > 0
|
|
318
182
|
});
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
remaining.delete(v.id);
|
|
342
|
-
startedAt.delete(v.id);
|
|
343
|
-
}
|
|
344
|
-
nonces.set(v.id, v.nonce);
|
|
345
|
-
}
|
|
346
|
-
for (const v of visible.value) {
|
|
347
|
-
if (v.resolvedDuration === Infinity) continue;
|
|
348
|
-
if (timers.has(v.id)) continue;
|
|
349
|
-
const left = remaining.get(v.id) ?? v.resolvedDuration;
|
|
350
|
-
const handle = window.setTimeout(() => {
|
|
351
|
-
toastHost.dismiss(v.id);
|
|
352
|
-
}, left);
|
|
353
|
-
timers.set(v.id, handle);
|
|
354
|
-
startedAt.set(v.id, Date.now());
|
|
355
|
-
remaining.set(v.id, left);
|
|
356
|
-
}
|
|
357
|
-
},
|
|
358
|
-
{ immediate: true, flush: "post" }
|
|
183
|
+
const rendered = computed(
|
|
184
|
+
() => [
|
|
185
|
+
...visible.value.map((toast) => ({ ...toast, present: true, copy: copyOf(toast) })),
|
|
186
|
+
...exiting.value.map((toast) => ({ ...toast, present: false, copy: copyOf(toast) }))
|
|
187
|
+
].sort(compareOrder)
|
|
188
|
+
);
|
|
189
|
+
const regionLabel = computed(() => {
|
|
190
|
+
const label = locale.t("ToastHost.notifications", void 0, "Notifications");
|
|
191
|
+
const key = hotkey.label.value;
|
|
192
|
+
return key ? locale.t("ToastHost.notificationsHotkey", { label, hotkey: key }, "{label} ({hotkey})") : label;
|
|
193
|
+
});
|
|
194
|
+
const overflowLabel = computed(
|
|
195
|
+
() => overflowOpen.value ? locale.t("ToastHost.showFewer", void 0, "Show fewer notifications") : locale.t("ToastHost.showMore", { count: overflowCount.value }, "Show {count} more notifications")
|
|
196
|
+
);
|
|
197
|
+
const stackClasses = computed(
|
|
198
|
+
() => cn(
|
|
199
|
+
StackClass,
|
|
200
|
+
PositionClasses[position.value],
|
|
201
|
+
(overflowOpen.value || needsScroll.value) && "overflow-y-auto overscroll-contain",
|
|
202
|
+
overflowOpen.value && (position.value.startsWith("top") ? "scroll-pb-(--toast-overflow-control-height)" : "scroll-pt-(--toast-overflow-control-height)"),
|
|
203
|
+
attrs.class
|
|
204
|
+
)
|
|
359
205
|
);
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
206
|
+
const itemClasses = computed(() => {
|
|
207
|
+
const [vertical, horizontal] = position.value.split("-");
|
|
208
|
+
const edge = horizontal === Side.Left || horizontal === Side.Right ? horizontal : vertical === Side.Bottom ? Side.Bottom : Side.Top;
|
|
209
|
+
return cn(ItemClass, verticalMotion.value ? VerticalSlideClass : SideSlideClasses[edge]);
|
|
364
210
|
});
|
|
211
|
+
const ownStyle = computed(() => {
|
|
212
|
+
const base = { ...StackInsets, gap: `${props.gap}px`, "--toast-group-duration": `${props.moveDuration}ms` };
|
|
213
|
+
const slide = verticalMotion.value;
|
|
214
|
+
if (!slide) return base;
|
|
215
|
+
const bottom = position.value.startsWith("bottom");
|
|
216
|
+
const offset = bottom ? `calc(-1 * ${slide.offset})` : slide.offset;
|
|
217
|
+
return {
|
|
218
|
+
...base,
|
|
219
|
+
"--toast-motion-origin": bottom ? "center bottom" : "center top",
|
|
220
|
+
"--toast-motion-transform": `translateY(${offset}) scale(${slide.scale})`,
|
|
221
|
+
"--toast-motion-enter": slide.enter,
|
|
222
|
+
"--toast-motion-exit": slide.exit,
|
|
223
|
+
"--toast-motion-ease": slide.easing
|
|
224
|
+
};
|
|
225
|
+
});
|
|
226
|
+
const stackStyle = computed(() => [ownStyle.value, attrs.style]);
|
|
365
227
|
watch(
|
|
366
|
-
|
|
367
|
-
(
|
|
368
|
-
if (
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
remaining.set(id, Math.max(0, (remaining.get(id) ?? 0) - (Date.now() - start)));
|
|
373
|
-
}
|
|
374
|
-
timers.clear();
|
|
228
|
+
[resolved, exiting],
|
|
229
|
+
([cards, leaving]) => {
|
|
230
|
+
if (expandedDetails.value.size === 0) return;
|
|
231
|
+
const open = new Set([...cards.filter((card) => card.details), ...leaving].map((card) => card.id));
|
|
232
|
+
const kept = [...expandedDetails.value].filter((id) => open.has(id));
|
|
233
|
+
if (kept.length !== expandedDetails.value.size) expandedDetails.value = new Set(kept);
|
|
375
234
|
},
|
|
376
|
-
{ flush: "
|
|
235
|
+
{ flush: "post" }
|
|
377
236
|
);
|
|
378
237
|
watch(
|
|
379
238
|
() => rendered.value.length,
|
|
380
239
|
(count) => {
|
|
381
|
-
if (count
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
240
|
+
if (count > 0) return;
|
|
241
|
+
clock.release();
|
|
242
|
+
capacity.reset();
|
|
385
243
|
}
|
|
386
244
|
);
|
|
245
|
+
watch(
|
|
246
|
+
() => visible.value.length === 0,
|
|
247
|
+
(empty) => {
|
|
248
|
+
if (empty) hotkey.release();
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
function setDetails(id, expanded) {
|
|
252
|
+
const next = new Set(expandedDetails.value);
|
|
253
|
+
if (expanded) next.add(id);
|
|
254
|
+
else next.delete(id);
|
|
255
|
+
expandedDetails.value = next;
|
|
256
|
+
if (visible.value.some((card) => card.id === id && card.group && card.group.count > 1)) {
|
|
257
|
+
captureToastChange(id, ToastChange.Resize);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function onKeydown(event) {
|
|
261
|
+
if (event.key !== Key.Escape) return;
|
|
262
|
+
if (overflowOpen.value) capacity.onEscape(event);
|
|
263
|
+
else hotkey.returnFocus(event);
|
|
264
|
+
}
|
|
387
265
|
function onFocusout(event) {
|
|
388
|
-
|
|
389
|
-
|
|
266
|
+
clock.onFocusout(event);
|
|
267
|
+
hotkey.onFocusout(event);
|
|
390
268
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
);
|
|
394
|
-
const itemClasses = computed(() => cn("pointer-events-auto relative w-80 overflow-hidden rounded-md", MotionClasses));
|
|
395
|
-
function requestedTimer(t) {
|
|
396
|
-
if (t.timer !== void 0) return t.timer;
|
|
397
|
-
if (t.progress !== void 0) return t.progress ? ToastTimer.Bar : ToastTimer.None;
|
|
398
|
-
if (props.timer !== void 0) return props.timer;
|
|
399
|
-
return props.showProgress ? ToastTimer.Bar : ToastTimer.None;
|
|
269
|
+
function surfaceOf(t) {
|
|
270
|
+
return t.surface ?? props.surface ?? ToastSurface.Solid;
|
|
400
271
|
}
|
|
401
272
|
function timerFor(t) {
|
|
402
|
-
if (!
|
|
403
|
-
const requested =
|
|
273
|
+
if (!hasCountdown(t)) return ToastTimer.None;
|
|
274
|
+
const requested = t.timer ?? props.timer ?? ToastTimer.None;
|
|
404
275
|
return t.content && requested !== ToastTimer.None ? ToastTimer.Bar : requested;
|
|
405
276
|
}
|
|
406
|
-
|
|
407
|
-
|
|
277
|
+
function countdownOf(t) {
|
|
278
|
+
return {
|
|
279
|
+
duration: t.resolvedDuration,
|
|
280
|
+
elapsed: timerElapsed(t),
|
|
281
|
+
isPaused: !t.present || pausedIds.value.has(t.id),
|
|
282
|
+
severity: t.severity ?? Severity.Neutral
|
|
283
|
+
};
|
|
284
|
+
}
|
|
408
285
|
return (_ctx, _cache) => {
|
|
409
286
|
return openBlock(), createBlock(unref(_sfc_main$1), null, {
|
|
410
287
|
default: withCtx(() => [
|
|
411
288
|
rendered.value.length > 0 ? (openBlock(), createElementBlock("div", {
|
|
412
289
|
key: 0,
|
|
290
|
+
ref_key: "stack",
|
|
291
|
+
ref: stack,
|
|
413
292
|
role: "region",
|
|
414
|
-
"
|
|
293
|
+
"data-toast-position": position.value,
|
|
294
|
+
"aria-label": regionLabel.value,
|
|
415
295
|
style: normalizeStyle(stackStyle.value),
|
|
416
296
|
class: normalizeClass(stackClasses.value),
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
297
|
+
"data-toast-expanded": unref(dataAttr)(unref(overflowOpen)),
|
|
298
|
+
onPointerenter: _cache[1] || (_cache[1] = //@ts-ignore
|
|
299
|
+
(...args) => clock.onPointerEnter && clock.onPointerEnter(...args)),
|
|
300
|
+
onPointerleave: _cache[2] || (_cache[2] = //@ts-ignore
|
|
301
|
+
(...args) => clock.onPointerLeave && clock.onPointerLeave(...args)),
|
|
302
|
+
onPointerdown: _cache[3] || (_cache[3] = //@ts-ignore
|
|
303
|
+
(...args) => unref(onSwipeStart) && unref(onSwipeStart)(...args)),
|
|
304
|
+
onFocusin: _cache[4] || (_cache[4] = //@ts-ignore
|
|
305
|
+
(...args) => clock.onFocusin && clock.onFocusin(...args)),
|
|
306
|
+
onFocusout,
|
|
307
|
+
onKeydown
|
|
421
308
|
}, [
|
|
422
309
|
(openBlock(true), createElementBlock(Fragment, null, renderList(rendered.value, (t) => {
|
|
423
310
|
return openBlock(), createBlock(unref(Presence), {
|
|
@@ -426,19 +313,40 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
426
313
|
}, {
|
|
427
314
|
default: withCtx(() => [
|
|
428
315
|
createElementVNode("div", {
|
|
429
|
-
class: normalizeClass(
|
|
430
|
-
|
|
316
|
+
class: normalizeClass([
|
|
317
|
+
itemClasses.value,
|
|
318
|
+
t.present ? "pointer-events-auto motion-safe:data-[state=closed]:opacity-0" : "pointer-events-none",
|
|
319
|
+
t.group && props.groupMotion === ToastGroupMotion.Card ? "overflow-visible" : "overflow-hidden"
|
|
320
|
+
]),
|
|
321
|
+
"data-toast-exiting": unref(dataAttr)(!t.present),
|
|
322
|
+
"data-toast-id": t.id,
|
|
323
|
+
"data-toast-swiping": unref(dataAttr)(t.present && unref(swiping) === t.id),
|
|
324
|
+
tabindex: "-1",
|
|
325
|
+
inert: t.present ? void 0 : true,
|
|
326
|
+
onVnodeMounted: _cache[0] || (_cache[0] = ($event) => unref(measureCapacity)()),
|
|
327
|
+
onVnodeBeforeUnmount: ($event) => t.present ? void 0 : unref(captureGap)(),
|
|
328
|
+
onVnodeUnmounted: ($event) => t.present ? void 0 : unref(removeExiting)(t.id)
|
|
431
329
|
}, [
|
|
432
330
|
t.content ? (openBlock(), createBlock(unref(ToastNodeView), {
|
|
433
331
|
key: 0,
|
|
434
332
|
node: t.content
|
|
435
|
-
}, null, 8, ["node"])) : (openBlock(), createBlock(_sfc_main$2,
|
|
333
|
+
}, null, 8, ["node"])) : (openBlock(), createBlock(_sfc_main$2, {
|
|
436
334
|
key: 1,
|
|
335
|
+
role: void 0,
|
|
336
|
+
"aria-live": "off",
|
|
437
337
|
severity: t.severity,
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
338
|
+
surface: surfaceOf(t),
|
|
339
|
+
progress: t.progress,
|
|
340
|
+
"show-severity-icon": t.showSeverityIcon ?? props.showSeverityIcon,
|
|
341
|
+
"is-pinned": unref(pins).canPin(t) ? unref(pins).isPinned(t) : void 0,
|
|
342
|
+
"details-open": expandedDetails.value.has(t.id),
|
|
343
|
+
"is-compact": unref(overflowOpen),
|
|
344
|
+
"is-grouped": !!t.group && t.group.count > 1,
|
|
345
|
+
"on-delete": t.onDelete,
|
|
346
|
+
onClose: ($event) => unref(toastHost).dismiss(t.id),
|
|
347
|
+
onTogglePin: ($event) => unref(pins).toggle(t.id),
|
|
348
|
+
"onUpdate:detailsOpen": ($event) => setDetails(t.id, $event)
|
|
349
|
+
}, createSlots({ _: 2 }, [
|
|
442
350
|
t.icon ? {
|
|
443
351
|
name: "icon",
|
|
444
352
|
fn: withCtx(() => [
|
|
@@ -448,21 +356,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
448
356
|
]),
|
|
449
357
|
key: "0"
|
|
450
358
|
} : void 0,
|
|
451
|
-
t.title ? {
|
|
359
|
+
t.copy.title ? {
|
|
452
360
|
name: "title",
|
|
453
361
|
fn: withCtx(() => [
|
|
454
362
|
createVNode(unref(ToastNodeView), {
|
|
455
|
-
node: t.title
|
|
363
|
+
node: t.copy.title
|
|
456
364
|
}, null, 8, ["node"])
|
|
457
365
|
]),
|
|
458
366
|
key: "1"
|
|
459
367
|
} : void 0,
|
|
460
|
-
t.description ? {
|
|
368
|
+
t.copy.description ? {
|
|
461
369
|
name: "description",
|
|
462
370
|
fn: withCtx(() => [
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
371
|
+
t.group && t.group.count > 1 ? (openBlock(), createElementBlock("span", {
|
|
372
|
+
key: 0,
|
|
373
|
+
"data-toast-group-count-highlight": "",
|
|
374
|
+
class: normalizeClass(unref(GroupCountClass))
|
|
375
|
+
}, [
|
|
376
|
+
createVNode(unref(ToastNodeView), {
|
|
377
|
+
node: t.copy.description
|
|
378
|
+
}, null, 8, ["node"])
|
|
379
|
+
], 2)) : (openBlock(), createBlock(unref(ToastNodeView), {
|
|
380
|
+
key: 1,
|
|
381
|
+
node: t.copy.description
|
|
382
|
+
}, null, 8, ["node"]))
|
|
466
383
|
]),
|
|
467
384
|
key: "2"
|
|
468
385
|
} : void 0,
|
|
@@ -480,39 +397,118 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
480
397
|
]),
|
|
481
398
|
key: "3"
|
|
482
399
|
} : void 0,
|
|
483
|
-
|
|
484
|
-
name: "
|
|
400
|
+
t.details ? {
|
|
401
|
+
name: "details",
|
|
485
402
|
fn: withCtx(() => [
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
paused: paused.value,
|
|
490
|
-
severity: t.severity ?? "neutral"
|
|
491
|
-
}, null, 8, ["duration", "paused", "severity"])) : (openBlock(), createBlock(unref(ToastSeconds), {
|
|
492
|
-
key: `${t.id}:${t.nonce}`,
|
|
493
|
-
duration: t.resolvedDuration,
|
|
494
|
-
paused: paused.value,
|
|
495
|
-
severity: t.severity ?? "neutral"
|
|
496
|
-
}, null, 8, ["duration", "paused", "severity"]))
|
|
403
|
+
createVNode(unref(ToastNodeView), {
|
|
404
|
+
node: t.details
|
|
405
|
+
}, null, 8, ["node"])
|
|
497
406
|
]),
|
|
498
407
|
key: "4"
|
|
408
|
+
} : void 0,
|
|
409
|
+
timerFor(t) === ToastTimer.Ring ? {
|
|
410
|
+
name: "trailing",
|
|
411
|
+
fn: withCtx(() => [
|
|
412
|
+
(openBlock(), createBlock(_sfc_main$4, mergeProps({
|
|
413
|
+
key: unref(countdownKey)(t)
|
|
414
|
+
}, { ref_for: true }, countdownOf(t), {
|
|
415
|
+
"data-toast-timer": ToastTimer.Ring
|
|
416
|
+
}), null, 16, ["data-toast-timer"]))
|
|
417
|
+
]),
|
|
418
|
+
key: "5"
|
|
419
|
+
} : timerFor(t) === ToastTimer.Seconds ? {
|
|
420
|
+
name: "trailing",
|
|
421
|
+
fn: withCtx(() => [
|
|
422
|
+
(openBlock(), createBlock(_sfc_main$5, mergeProps({
|
|
423
|
+
key: unref(countdownKey)(t)
|
|
424
|
+
}, { ref_for: true }, countdownOf(t), {
|
|
425
|
+
"data-toast-timer": ToastTimer.Seconds
|
|
426
|
+
}), null, 16, ["data-toast-timer"]))
|
|
427
|
+
]),
|
|
428
|
+
key: "6"
|
|
429
|
+
} : void 0,
|
|
430
|
+
timerFor(t) === ToastTimer.CloseRing ? {
|
|
431
|
+
name: "closeIndicator",
|
|
432
|
+
fn: withCtx(() => [
|
|
433
|
+
(openBlock(), createBlock(_sfc_main$4, mergeProps({
|
|
434
|
+
key: unref(countdownKey)(t)
|
|
435
|
+
}, { ref_for: true }, countdownOf(t), {
|
|
436
|
+
"data-toast-timer": ToastTimer.CloseRing,
|
|
437
|
+
"is-around-close": ""
|
|
438
|
+
}), null, 16, ["data-toast-timer"]))
|
|
439
|
+
]),
|
|
440
|
+
key: "7"
|
|
499
441
|
} : void 0
|
|
500
|
-
]),
|
|
501
|
-
timerFor(t) === ToastTimer.Bar ? (openBlock(), createBlock(
|
|
502
|
-
key:
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
442
|
+
]), 1032, ["severity", "surface", "progress", "show-severity-icon", "is-pinned", "details-open", "is-compact", "is-grouped", "on-delete", "onClose", "onTogglePin", "onUpdate:detailsOpen"])),
|
|
443
|
+
timerFor(t) === ToastTimer.Bar ? (openBlock(), createBlock(_sfc_main$6, mergeProps({
|
|
444
|
+
key: unref(countdownKey)(t)
|
|
445
|
+
}, { ref_for: true }, countdownOf(t)), null, 16)) : createCommentVNode("", true),
|
|
446
|
+
!t.content ? (openBlock(), createElementBlock("span", {
|
|
447
|
+
key: 3,
|
|
448
|
+
"aria-hidden": "true",
|
|
449
|
+
"data-toast-update-highlight": "",
|
|
450
|
+
class: normalizeClass(unref(UpdateHighlightClass))
|
|
451
|
+
}, null, 2)) : createCommentVNode("", true),
|
|
452
|
+
t.group && t.group.count > 1 && props.groupMotion === ToastGroupMotion.Card ? (openBlock(), createBlock(_sfc_main$2, {
|
|
453
|
+
key: 4,
|
|
454
|
+
"data-toast-group-arrival": "",
|
|
455
|
+
"aria-hidden": "true",
|
|
456
|
+
"aria-live": "off",
|
|
457
|
+
role: "presentation",
|
|
458
|
+
inert: "",
|
|
459
|
+
class: normalizeClass(unref(GroupArrivalClass)),
|
|
460
|
+
title: t.group.latest.title ?? unref(locale).t("ToastHost.groupArrival", void 0, "New notification"),
|
|
461
|
+
description: t.group.latest.description,
|
|
462
|
+
severity: t.group.latest.severity,
|
|
463
|
+
surface: surfaceOf(t),
|
|
464
|
+
progress: t.progress,
|
|
465
|
+
"show-severity-icon": props.showSeverityIcon
|
|
466
|
+
}, null, 8, ["class", "title", "description", "severity", "surface", "progress", "show-severity-icon"])) : createCommentVNode("", true)
|
|
507
467
|
], 10, _hoisted_2)
|
|
508
468
|
]),
|
|
509
469
|
_: 2
|
|
510
470
|
}, 1032, ["is-present"]);
|
|
511
|
-
}), 128))
|
|
471
|
+
}), 128)),
|
|
472
|
+
unref(overflowCount) > 0 || unref(overflowOpen) ? (openBlock(), createBlock(unref(_sfc_main$7), {
|
|
473
|
+
key: 0,
|
|
474
|
+
ref_key: "overflowButton",
|
|
475
|
+
ref: overflowButton,
|
|
476
|
+
variant: "outline",
|
|
477
|
+
size: "sm",
|
|
478
|
+
"data-toast-overflow": "",
|
|
479
|
+
"data-toast-surface": props.surface === unref(ToastSurface).Glass ? unref(ToastSurface).Glass : void 0,
|
|
480
|
+
"aria-expanded": unref(overflowOpen),
|
|
481
|
+
class: normalizeClass([unref(OverflowButtonClass), position.value.startsWith("top") ? "bottom-0" : "top-0"]),
|
|
482
|
+
onClick: unref(toggleOverflow)
|
|
483
|
+
}, {
|
|
484
|
+
trailing: withCtx(() => [
|
|
485
|
+
createVNode(unref(_sfc_main$8), {
|
|
486
|
+
icon: unref(ChevronDown),
|
|
487
|
+
size: 14,
|
|
488
|
+
class: normalizeClass(["shrink-0", { "rotate-180": position.value.startsWith("bottom") !== unref(overflowOpen) }])
|
|
489
|
+
}, null, 8, ["icon", "class"])
|
|
490
|
+
]),
|
|
491
|
+
default: withCtx(() => [
|
|
492
|
+
createElementVNode("span", _hoisted_3, toDisplayString(overflowLabel.value), 1)
|
|
493
|
+
]),
|
|
494
|
+
_: 1
|
|
495
|
+
}, 8, ["data-toast-surface", "aria-expanded", "class", "onClick"])) : createCommentVNode("", true)
|
|
512
496
|
], 46, _hoisted_1)) : createCommentVNode("", true),
|
|
513
|
-
createVNode(unref(_sfc_main$
|
|
497
|
+
createVNode(unref(_sfc_main$9), {
|
|
498
|
+
politeness: "polite",
|
|
499
|
+
"data-toast-announcer": "polite"
|
|
500
|
+
}, {
|
|
501
|
+
default: withCtx(() => [
|
|
502
|
+
createTextVNode(toDisplayString(unref(politeMessage)), 1)
|
|
503
|
+
]),
|
|
504
|
+
_: 1
|
|
505
|
+
}),
|
|
506
|
+
createVNode(unref(_sfc_main$9), {
|
|
507
|
+
politeness: "assertive",
|
|
508
|
+
"data-toast-announcer": "assertive"
|
|
509
|
+
}, {
|
|
514
510
|
default: withCtx(() => [
|
|
515
|
-
createTextVNode(toDisplayString(
|
|
511
|
+
createTextVNode(toDisplayString(unref(assertiveMessage)), 1)
|
|
516
512
|
]),
|
|
517
513
|
_: 1
|
|
518
514
|
})
|
|
@@ -523,10 +519,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
523
519
|
}
|
|
524
520
|
});
|
|
525
521
|
export {
|
|
526
|
-
|
|
522
|
+
ToastGroupMotion,
|
|
523
|
+
ToastMotion,
|
|
527
524
|
ToastTimer,
|
|
528
|
-
_sfc_main as default
|
|
529
|
-
toastHost,
|
|
530
|
-
useToastHost
|
|
525
|
+
_sfc_main as default
|
|
531
526
|
};
|
|
532
527
|
//# sourceMappingURL=ToastHost.vue.js.map
|