@wow-two-beta/fe 0.0.48 → 0.0.50
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 +325 -312
- package/dist/index.js.map +1 -1
- package/dist/presentation/display/index.js +105 -102
- package/dist/presentation/display/index.js.map +1 -1
- 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/layout/navbar/Navbar.vue.js.map +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.js +52 -63
- 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,38 +1,50 @@
|
|
|
1
|
-
import { defineComponent, useAttrs, useSlots,
|
|
2
|
-
import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
|
|
1
|
+
import { defineComponent, useAttrs, useSlots, useTemplateRef, computed, openBlock, createElementBlock, mergeProps, unref, createCommentVNode, toDisplayString, renderSlot, Fragment, createTextVNode, createBlock, normalizeClass, createElementVNode, withModifiers, createVNode } from "vue";
|
|
3
2
|
import { Trash2, X } from "lucide-vue-next";
|
|
3
|
+
import { dataAttr } from "../../../foundation/dom/DataAttr.js";
|
|
4
|
+
import { Key } from "../../../foundation/dom/enums/Key.js";
|
|
5
|
+
import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
|
|
4
6
|
import { SeverityIcons, SeverityIconClasses } from "../../../foundation/icons/SeverityIcons.js";
|
|
5
7
|
import { cn } from "../../../foundation/styles/Cn.js";
|
|
6
|
-
import { Key } from "../../../foundation/dom/enums/Key.js";
|
|
7
8
|
import _sfc_main$1 from "../../../foundation/icons/icon/Icon.vue.js";
|
|
8
9
|
const _hoisted_1 = ["role", "tabindex", "data-unread"];
|
|
9
10
|
const _hoisted_2 = {
|
|
10
11
|
key: 0,
|
|
11
12
|
"aria-hidden": "true",
|
|
12
|
-
class: "absolute left-1 top-3 inline-block h-2 w-2 rounded-full bg-primary"
|
|
13
|
+
class: "absolute left-1 top-3 inline-block h-2 w-2 rounded-full bg-primary forced-colors:bg-[Highlight]"
|
|
13
14
|
};
|
|
14
15
|
const _hoisted_3 = {
|
|
15
16
|
key: 1,
|
|
17
|
+
class: "sr-only"
|
|
18
|
+
};
|
|
19
|
+
const _hoisted_4 = {
|
|
20
|
+
key: 2,
|
|
16
21
|
class: "shrink-0 self-start pl-3"
|
|
17
22
|
};
|
|
18
|
-
const
|
|
19
|
-
const
|
|
23
|
+
const _hoisted_5 = { class: "flex items-baseline gap-2" };
|
|
24
|
+
const _hoisted_6 = {
|
|
20
25
|
key: 0,
|
|
21
26
|
class: "ml-auto whitespace-nowrap text-xs text-muted-foreground"
|
|
22
27
|
};
|
|
23
|
-
const
|
|
28
|
+
const _hoisted_7 = {
|
|
24
29
|
key: 0,
|
|
25
30
|
class: "mt-0.5 line-clamp-2 text-xs text-muted-foreground"
|
|
26
31
|
};
|
|
27
|
-
const
|
|
32
|
+
const _hoisted_8 = {
|
|
28
33
|
key: 1,
|
|
34
|
+
class: "mt-1.5"
|
|
35
|
+
};
|
|
36
|
+
const _hoisted_9 = {
|
|
37
|
+
key: 2,
|
|
29
38
|
class: "mt-1.5 flex items-center gap-2"
|
|
30
39
|
};
|
|
31
|
-
const
|
|
32
|
-
const
|
|
40
|
+
const _hoisted_10 = ["aria-label"];
|
|
41
|
+
const _hoisted_11 = ["aria-label"];
|
|
42
|
+
const DismissRestingClasses = "absolute right-2 top-2 inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground opacity-0";
|
|
43
|
+
const DismissInteractionClasses = "hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring";
|
|
44
|
+
const DeleteButtonClasses = "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring";
|
|
33
45
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
34
|
-
...{ name: "
|
|
35
|
-
__name: "
|
|
46
|
+
...{ name: "NotificationCenterGroupItem", inheritAttrs: false },
|
|
47
|
+
__name: "NotificationCenterGroupItem",
|
|
36
48
|
props: {
|
|
37
49
|
severity: {},
|
|
38
50
|
icon: {},
|
|
@@ -40,68 +52,76 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40
52
|
description: {},
|
|
41
53
|
timestamp: {},
|
|
42
54
|
isUnread: { type: Boolean },
|
|
43
|
-
actions: {}
|
|
55
|
+
actions: {},
|
|
56
|
+
onSelect: { type: Function },
|
|
57
|
+
onDismiss: { type: Function },
|
|
58
|
+
onDelete: { type: Function }
|
|
44
59
|
},
|
|
45
|
-
|
|
46
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
47
|
-
const locale = useLocale();
|
|
60
|
+
setup(__props, { expose: __expose }) {
|
|
48
61
|
const props = __props;
|
|
49
|
-
const
|
|
62
|
+
const locale = useLocale();
|
|
50
63
|
const attrs = useAttrs();
|
|
51
64
|
const slots = useSlots();
|
|
52
|
-
const instance = getCurrentInstance();
|
|
53
65
|
const el = useTemplateRef("el");
|
|
54
|
-
const
|
|
55
|
-
const hasDismiss = () => Boolean(instance?.vnode.props?.onDismiss);
|
|
56
|
-
const hasDelete = () => Boolean(instance?.vnode.props?.onDelete);
|
|
66
|
+
const isInteractive = computed(() => Boolean(props.onSelect));
|
|
57
67
|
const severityIcon = computed(() => props.severity ? SeverityIcons[props.severity] : null);
|
|
58
|
-
const hasIcon = () => Boolean(props.icon) || Boolean(slots.icon) || Boolean(severityIcon.value);
|
|
59
|
-
const hasTimestamp = () => Boolean(props.timestamp) || Boolean(slots.timestamp);
|
|
60
|
-
const hasDescription = () => Boolean(props.description) || Boolean(slots.description);
|
|
61
|
-
const hasActions = () => Boolean(props.actions) || Boolean(slots.actions);
|
|
62
68
|
const classes = computed(
|
|
63
69
|
() => cn(
|
|
64
70
|
"group/notif relative flex gap-3 rounded-md px-3 py-2.5 text-sm",
|
|
65
|
-
|
|
71
|
+
isInteractive.value && "cursor-pointer hover:bg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
|
|
66
72
|
props.isUnread && "bg-primary-soft/30",
|
|
67
73
|
attrs.class
|
|
68
74
|
)
|
|
69
75
|
);
|
|
70
76
|
const titleClasses = computed(() => cn("truncate text-foreground", props.isUnread ? "font-semibold" : "font-medium"));
|
|
71
77
|
const bodyClasses = computed(() => cn("min-w-0 flex-1", !hasIcon() && "pl-3"));
|
|
72
|
-
const DismissRestingClasses = "absolute right-2 top-2 inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground opacity-0";
|
|
73
|
-
const DismissInteractionClasses = "hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring";
|
|
74
|
-
const onKeyDown = (event) => {
|
|
75
|
-
if (!interactive()) return;
|
|
76
|
-
if (event.target !== event.currentTarget) return;
|
|
77
|
-
if (event.key === Key.Enter || event.key === Key.Space) {
|
|
78
|
-
event.preventDefault();
|
|
79
|
-
emit("select");
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const onDismissClick = (event) => {
|
|
83
|
-
event.stopPropagation();
|
|
84
|
-
emit("dismiss");
|
|
85
|
-
};
|
|
86
78
|
const rest = computed(() => {
|
|
87
79
|
const { class: _class, ...others } = attrs;
|
|
88
80
|
return others;
|
|
89
81
|
});
|
|
90
82
|
__expose({ el });
|
|
83
|
+
function hasIcon() {
|
|
84
|
+
return Boolean(props.icon) || Boolean(slots.icon) || Boolean(severityIcon.value);
|
|
85
|
+
}
|
|
86
|
+
function hasTimestamp() {
|
|
87
|
+
return Boolean(props.timestamp) || Boolean(slots.timestamp);
|
|
88
|
+
}
|
|
89
|
+
function hasDescription() {
|
|
90
|
+
return Boolean(props.description) || Boolean(slots.description);
|
|
91
|
+
}
|
|
92
|
+
function hasProgress() {
|
|
93
|
+
return Boolean(slots.progress);
|
|
94
|
+
}
|
|
95
|
+
function hasActions() {
|
|
96
|
+
return Boolean(props.actions) || Boolean(slots.actions);
|
|
97
|
+
}
|
|
98
|
+
function onKeyDown(event) {
|
|
99
|
+
if (!props.onSelect) return;
|
|
100
|
+
if (event.target !== event.currentTarget) return;
|
|
101
|
+
if (event.key === Key.Enter || event.key === Key.Space) {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
props.onSelect();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function onDismissClick(event) {
|
|
107
|
+
event.stopPropagation();
|
|
108
|
+
props.onDismiss?.();
|
|
109
|
+
}
|
|
91
110
|
return (_ctx, _cache) => {
|
|
92
111
|
return openBlock(), createElementBlock("div", mergeProps({
|
|
93
112
|
ref_key: "el",
|
|
94
113
|
ref: el,
|
|
95
|
-
role:
|
|
96
|
-
tabindex:
|
|
97
|
-
"data-unread": props.isUnread
|
|
114
|
+
role: isInteractive.value ? "button" : void 0,
|
|
115
|
+
tabindex: isInteractive.value ? 0 : void 0,
|
|
116
|
+
"data-unread": unref(dataAttr)(props.isUnread)
|
|
98
117
|
}, rest.value, {
|
|
99
118
|
class: classes.value,
|
|
100
|
-
onClick: _cache[1] || (_cache[1] = ($event) =>
|
|
119
|
+
onClick: _cache[1] || (_cache[1] = ($event) => props.onSelect?.()),
|
|
101
120
|
onKeydown: onKeyDown
|
|
102
121
|
}), [
|
|
103
122
|
props.isUnread ? (openBlock(), createElementBlock("span", _hoisted_2)) : createCommentVNode("", true),
|
|
104
|
-
|
|
123
|
+
props.isUnread ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(unref(locale).t("NotificationItem.unread", void 0, "Unread")), 1)) : createCommentVNode("", true),
|
|
124
|
+
hasIcon() ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
105
125
|
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
106
126
|
props.icon ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
107
127
|
createTextVNode(toDisplayString(props.icon), 1)
|
|
@@ -116,7 +136,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
116
136
|
createElementVNode("div", {
|
|
117
137
|
class: normalizeClass(bodyClasses.value)
|
|
118
138
|
}, [
|
|
119
|
-
createElementVNode("div",
|
|
139
|
+
createElementVNode("div", _hoisted_5, [
|
|
120
140
|
createElementVNode("span", {
|
|
121
141
|
class: normalizeClass(titleClasses.value)
|
|
122
142
|
}, [
|
|
@@ -124,37 +144,40 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
124
144
|
createTextVNode(toDisplayString(props.title), 1)
|
|
125
145
|
])
|
|
126
146
|
], 2),
|
|
127
|
-
hasTimestamp() ? (openBlock(), createElementBlock("span",
|
|
147
|
+
hasTimestamp() ? (openBlock(), createElementBlock("span", _hoisted_6, [
|
|
128
148
|
renderSlot(_ctx.$slots, "timestamp", {}, () => [
|
|
129
149
|
createTextVNode(toDisplayString(props.timestamp), 1)
|
|
130
150
|
])
|
|
131
151
|
])) : createCommentVNode("", true)
|
|
132
152
|
]),
|
|
133
|
-
hasDescription() ? (openBlock(), createElementBlock("div",
|
|
153
|
+
hasDescription() ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
134
154
|
renderSlot(_ctx.$slots, "description", {}, () => [
|
|
135
155
|
createTextVNode(toDisplayString(props.description), 1)
|
|
136
156
|
])
|
|
137
157
|
])) : createCommentVNode("", true),
|
|
138
|
-
|
|
158
|
+
hasProgress() ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
159
|
+
renderSlot(_ctx.$slots, "progress")
|
|
160
|
+
])) : createCommentVNode("", true),
|
|
161
|
+
hasActions() ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
139
162
|
renderSlot(_ctx.$slots, "actions", {}, () => [
|
|
140
163
|
createTextVNode(toDisplayString(props.actions), 1)
|
|
141
164
|
])
|
|
142
165
|
])) : createCommentVNode("", true)
|
|
143
166
|
], 2),
|
|
144
|
-
|
|
145
|
-
key:
|
|
167
|
+
props.onDelete ? (openBlock(), createElementBlock("button", {
|
|
168
|
+
key: 3,
|
|
146
169
|
type: "button",
|
|
147
170
|
"aria-label": unref(locale).t("NotificationItem.deleteNotification", void 0, "Delete notification"),
|
|
148
|
-
class:
|
|
149
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(($event) =>
|
|
171
|
+
class: normalizeClass(DeleteButtonClasses),
|
|
172
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => props.onDelete(), ["stop"]))
|
|
150
173
|
}, [
|
|
151
174
|
createVNode(unref(_sfc_main$1), {
|
|
152
175
|
icon: unref(Trash2),
|
|
153
176
|
size: 14
|
|
154
177
|
}, null, 8, ["icon"])
|
|
155
|
-
], 8,
|
|
156
|
-
|
|
157
|
-
key:
|
|
178
|
+
], 8, _hoisted_10)) : createCommentVNode("", true),
|
|
179
|
+
props.onDismiss ? (openBlock(), createElementBlock("button", {
|
|
180
|
+
key: 4,
|
|
158
181
|
type: "button",
|
|
159
182
|
"aria-label": unref(locale).t("NotificationItem.dismissNotification", void 0, "Dismiss notification"),
|
|
160
183
|
class: normalizeClass(
|
|
@@ -167,7 +190,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
167
190
|
onClick: onDismissClick
|
|
168
191
|
}, [
|
|
169
192
|
createVNode(unref(X), { class: "h-3.5 w-3.5" })
|
|
170
|
-
], 10,
|
|
193
|
+
], 10, _hoisted_11)) : createCommentVNode("", true)
|
|
171
194
|
], 16, _hoisted_1);
|
|
172
195
|
};
|
|
173
196
|
}
|
|
@@ -175,4 +198,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
175
198
|
export {
|
|
176
199
|
_sfc_main as default
|
|
177
200
|
};
|
|
178
|
-
//# sourceMappingURL=
|
|
201
|
+
//# sourceMappingURL=NotificationCenterGroupItem.vue.js.map
|
package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem.vue.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationCenterGroupItem.vue.js","sources":["../../../../src/presentation/display/notificationCenterGroup/NotificationCenterGroupItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { cn, type Severity } from '../../../foundation/styles';\n\n/** Defines props for one notification row of the notification center. */\nexport interface NotificationCenterGroupItemProps {\n /** The semantic severity; supplies a leading glyph when no icon is provided. */\n readonly severity?: Severity;\n\n /** The leading icon / avatar. Rich content → the `icon` slot. */\n readonly icon?: string;\n\n /** The primary title. Rich content → the `title` slot. Supply this or the slot. */\n readonly title?: string;\n\n /** The body / description. Rich content → the `description` slot. */\n readonly description?: string;\n\n /** The timestamp / relative time label. Rich content → the `timestamp` slot. */\n readonly timestamp?: string;\n\n /** The unread flag: bold title, a leading dot and visually hidden \"Unread\" text. */\n readonly isUnread?: boolean;\n\n /** The trailing actions. Rich content → the `actions` slot. */\n readonly actions?: string;\n\n /** Fires when the row is activated by click, Enter or Space; supplying it makes the row interactive. */\n readonly onSelect?: () => void;\n\n /** Fires when the dismiss button is pressed; the button renders on hover only when this is supplied. */\n readonly onDismiss?: () => void;\n\n /** Fires when the delete button is pressed; the button renders only when this is supplied. */\n readonly onDelete?: () => void;\n}\n\n/** @internal The dismiss button's resting classes — corner placement, box, and the hidden-until-hover opacity. */\nconst DismissRestingClasses =\n 'absolute right-2 top-2 inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground opacity-0';\n\n/** @internal The dismiss button's hover / focus classes — the raised surface and the focus ring. */\nconst DismissInteractionClasses =\n 'hover:bg-background hover:text-foreground focus-visible:opacity-100 ' +\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring';\n\n/** @internal The delete button's classes. */\nconst DeleteButtonClasses =\n 'inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground ' +\n 'hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring';\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, useAttrs, useSlots, useTemplateRef } from 'vue';\nimport { Trash2, X } from 'lucide-vue-next';\n\nimport { dataAttr, Key } from '../../../foundation/dom';\nimport { useLocale } from '../../../foundation/i18n';\nimport { Icon, SeverityIcons, SeverityIconClasses } from '../../../foundation/icons';\n\n/** Renders one notification row — icon, title, description, timestamp, and an unread dot. */\ndefineOptions({ name: 'NotificationCenterGroupItem', inheritAttrs: false });\n\nconst props = defineProps<NotificationCenterGroupItemProps>();\n\ndefineSlots<{\n /** The leading icon. Falls back to the `icon` prop. */\n icon?(): unknown;\n /** The title line. Falls back to the `title` prop. */\n title?(): unknown;\n /** The right-aligned timestamp. Falls back to the `timestamp` prop. */\n timestamp?(): unknown;\n /** The body text under the title. Falls back to the `description` prop. */\n description?(): unknown;\n /** The running-progress indicator under the description. Omitting it drops the band. */\n progress?(): unknown;\n /** The action row under the description. Falls back to the `actions` prop. */\n actions?(): unknown;\n}>();\n\nconst locale = useLocale();\nconst attrs = useAttrs();\nconst slots = useSlots();\nconst el = useTemplateRef<HTMLDivElement>('el');\n\n/** Whether the row is interactive — it has a select handler. */\nconst isInteractive = computed(() => Boolean(props.onSelect));\nconst severityIcon = computed(() => (props.severity ? SeverityIcons[props.severity] : null));\n\nconst classes = computed(() =>\n cn(\n 'group/notif relative flex gap-3 rounded-md px-3 py-2.5 text-sm',\n isInteractive.value &&\n 'cursor-pointer hover:bg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n props.isUnread && 'bg-primary-soft/30',\n attrs.class as string | undefined,\n ),\n);\n\nconst titleClasses = computed(() => cn('truncate text-foreground', props.isUnread ? 'font-semibold' : 'font-medium'));\n\nconst bodyClasses = computed(() => cn('min-w-0 flex-1', !hasIcon() && 'pl-3'));\n\n/** Everything but `class`, which is re-applied through `cn` above. */\nconst rest = computed(() => {\n const { class: _class, ...others } = attrs;\n return others;\n});\n\ndefineExpose({ el });\n\nfunction hasIcon(): boolean {\n return Boolean(props.icon) || Boolean(slots.icon) || Boolean(severityIcon.value);\n}\n\nfunction hasTimestamp(): boolean {\n return Boolean(props.timestamp) || Boolean(slots.timestamp);\n}\n\nfunction hasDescription(): boolean {\n return Boolean(props.description) || Boolean(slots.description);\n}\n\nfunction hasProgress(): boolean {\n return Boolean(slots.progress);\n}\n\nfunction hasActions(): boolean {\n return Boolean(props.actions) || Boolean(slots.actions);\n}\n\n/** Selects an interactive row on Enter or Space pressed on the row itself. */\nfunction onKeyDown(event: KeyboardEvent): void {\n if (!props.onSelect) return;\n if (event.target !== event.currentTarget) return;\n if (event.key === Key.Enter || event.key === Key.Space) {\n event.preventDefault();\n props.onSelect();\n }\n}\n\n/** Dismisses the row without also selecting it. */\nfunction onDismissClick(event: MouseEvent): void {\n event.stopPropagation();\n props.onDismiss?.();\n}\n</script>\n\n<template>\n <div\n ref=\"el\"\n :role=\"isInteractive ? 'button' : undefined\"\n :tabindex=\"isInteractive ? 0 : undefined\"\n :data-unread=\"dataAttr(props.isUnread)\"\n v-bind=\"rest\"\n :class=\"classes\"\n @click=\"props.onSelect?.()\"\n @keydown=\"onKeyDown\"\n >\n <span\n v-if=\"props.isUnread\"\n aria-hidden=\"true\"\n class=\"absolute left-1 top-3 inline-block h-2 w-2 rounded-full bg-primary forced-colors:bg-[Highlight]\"\n />\n <span v-if=\"props.isUnread\" class=\"sr-only\">{{ locale.t('NotificationItem.unread', undefined, 'Unread') }}</span>\n <div v-if=\"hasIcon()\" class=\"shrink-0 self-start pl-3\">\n <slot name=\"icon\">\n <template v-if=\"props.icon\">{{ props.icon }}</template>\n <Icon v-else-if=\"severityIcon\" :icon=\"severityIcon\" :size=\"16\" :class=\"SeverityIconClasses[props.severity!]\" />\n </slot>\n </div>\n <div :class=\"bodyClasses\">\n <div class=\"flex items-baseline gap-2\">\n <span :class=\"titleClasses\">\n <slot name=\"title\">{{ props.title }}</slot>\n </span>\n <span v-if=\"hasTimestamp()\" class=\"ml-auto whitespace-nowrap text-xs text-muted-foreground\">\n <slot name=\"timestamp\">{{ props.timestamp }}</slot>\n </span>\n </div>\n <div v-if=\"hasDescription()\" class=\"mt-0.5 line-clamp-2 text-xs text-muted-foreground\">\n <slot name=\"description\">{{ props.description }}</slot>\n </div>\n <div v-if=\"hasProgress()\" class=\"mt-1.5\">\n <slot name=\"progress\" />\n </div>\n <div v-if=\"hasActions()\" class=\"mt-1.5 flex items-center gap-2\">\n <slot name=\"actions\">{{ props.actions }}</slot>\n </div>\n </div>\n <button\n v-if=\"props.onDelete\"\n type=\"button\"\n :aria-label=\"locale.t('NotificationItem.deleteNotification', undefined, 'Delete notification')\"\n :class=\"DeleteButtonClasses\"\n @click.stop=\"props.onDelete()\"\n >\n <Icon :icon=\"Trash2\" :size=\"14\" />\n </button>\n <button\n v-if=\"props.onDismiss\"\n type=\"button\"\n :aria-label=\"locale.t('NotificationItem.dismissNotification', undefined, 'Dismiss notification')\"\n :class=\"\n cn(\n DismissRestingClasses,\n 'group-hover/notif:opacity-100 group-focus-within/notif:opacity-100',\n DismissInteractionClasses,\n )\n \"\n @click=\"onDismissClick\"\n >\n <X class=\"h-3.5 w-3.5\" />\n </button>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_toDisplayString","_renderSlot","_Fragment","_createTextVNode","_createBlock","Icon","_normalizeClass","_createElementVNode","_withModifiers","_createVNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,wBACJ;AAGF,MAAM,4BACJ;AAIF,MAAM,sBACJ;;;;;;;;;;;;;;;;;AAeF,UAAM,QAAQ;AAiBd,UAAM,SAAS,UAAA;AACf,UAAM,QAAQ,SAAA;AACd,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAA+B,IAAI;AAG9C,UAAM,gBAAgB,SAAS,MAAM,QAAQ,MAAM,QAAQ,CAAC;AAC5D,UAAM,eAAe,SAAS,MAAO,MAAM,WAAW,cAAc,MAAM,QAAQ,IAAI,IAAK;AAE3F,UAAM,UAAU;AAA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AEM,OAFN,YAEM;AAAA,YADJI,WAAuD,gCAAvD,MAAuD;AAAA,cAA3BE,gBAAAH,gBAAA,MAAM,WAAW,GAAA,CAAA;AAAA,YAAA;;UAEpC,iBAAXJ,UAAA,GAAAC,mBAEM,OAFN,YAEM;AAAA,YADJI,WAAwB,KAAA,QAAA,UAAA;AAAA,UAAA;UAEf,gBAAXL,UAAA,GAAAC,mBAEM,OAFN,YAEM;AAAA,YADJI,WAA+C,4BAA/C,MAA+C;AAAA,cAAvBE,gBAAAH,gBAAA,MAAM,OAAO,GAAA,CAAA;AAAA,YAAA;;;QAIjC,MAAM,yBADdH,mBAQS,UAAA;AAAA;UANP,MAAK;AAAA,UACJ,cAAYE,MAAA,MAAA,EAAO,yCAAyC,QAAS,qBAAA;AAAA,UACrE,sBAAO,mBAAmB;AAAA,UAC1B,SAAK,OAAA,CAAA,MAAA,OAAA,CAAA,IAAAS,cAAA,CAAA,WAAO,MAAM,SAAA,GAAQ,CAAA,MAAA,CAAA;AAAA,QAAA;UAE3BC,YAAkCV,MAAAM,WAAA,GAAA;AAAA,YAA3B,MAAMN,MAAA,MAAA;AAAA,YAAS,MAAM;AAAA,UAAA;;QAGtB,MAAM,0BADdF,mBAcS,UAAA;AAAA;UAZP,MAAK;AAAA,UACJ,cAAYE,MAAA,MAAA,EAAO,0CAA0C,QAAS,sBAAA;AAAA,UACtE,OAAKO;AAAAA,YAAWP,MAAA,EAAA;AAAA,cAAc;AAAA;cAAiH;AAAA,YAAA;AAAA;UAO/I,SAAO;AAAA,QAAA;UAERU,YAAyBV,MAAA,CAAA,GAAA,EAAtB,OAAM,eAAa;AAAA,QAAA;;;;;"}
|
package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroupItem2.vue.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationCenterGroupItem2.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
export { default as NotificationCenterButton, type NotificationCenterButtonProps, } from './NotificationCenterButton.vue';
|
|
1
2
|
export { default as NotificationCenterGroup, type NotificationCenterGroupProps } from './NotificationCenterGroup.vue';
|
|
2
|
-
export { default as
|
|
3
|
+
export { default as NotificationCenterGroupItem, type NotificationCenterGroupItemProps, } from './NotificationCenterGroupItem.vue';
|
|
4
|
+
/** @deprecated Use `NotificationCenterGroupItem`; this alias is removed next release. */
|
|
5
|
+
export { default as NotificationItem } from './NotificationCenterGroupItem.vue';
|
|
6
|
+
/** @deprecated Use `NotificationCenterGroupItemProps`; this alias is removed next release. */
|
|
7
|
+
export type { NotificationCenterGroupItemProps as NotificationItemProps } from './NotificationCenterGroupItem.vue';
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { FeedbackBus } from '../../../feedback';
|
|
2
2
|
import { ToastHostProps } from '../toastHost';
|
|
3
|
-
/**
|
|
4
|
-
* The prop surface of `FeedbackToastHost` — `bus`, plus every `ToastHost` prop.
|
|
5
|
-
*
|
|
6
|
-
* The `ToastHostProps` heritage is marked `@vue-ignore` so only `bus` becomes a
|
|
7
|
-
* runtime prop and the rest arrive as attrs; the template hands those to
|
|
8
|
-
* `<ToastHost>`, which declares them and resolves them back into props. Consumers
|
|
9
|
-
* still get the full checked surface, because the heritage is real to
|
|
10
|
-
* TypeScript — it is only the SFC compiler's runtime-props pass that skips it.
|
|
11
|
-
*/
|
|
3
|
+
/** Defines props for the bus-fed toast viewport — `bus` plus every `ToastHost` prop. */
|
|
12
4
|
export interface FeedbackToastHostProps extends /* @vue-ignore */ ToastHostProps {
|
|
13
5
|
/** The bus to render. Default: the app-wide `feedbackBus` singleton (what `notify()` publishes on). */
|
|
14
6
|
readonly bus?: FeedbackBus;
|
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import { defineComponent, useAttrs, computed, watch, openBlock, createBlock, normalizeProps, guardReactiveProps, unref } from "vue";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent, useAttrs, useId, computed, watch, shallowRef, openBlock, createBlock, normalizeProps, guardReactiveProps, unref, h, Fragment, TransitionGroup } from "vue";
|
|
2
|
+
import { ElementTag } from "../../../foundation/dom/enums/ElementTag.js";
|
|
3
|
+
import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
|
|
4
|
+
import _sfc_main$3 from "../reportAction/ReportAction.vue.js";
|
|
5
|
+
import _sfc_main$4 from "../toast/ToastContent.vue.js";
|
|
6
|
+
import _sfc_main$5 from "../toast/ToastRunningProgress.vue.js";
|
|
7
|
+
import _sfc_main$1 from "../toastHost/ToastHost.vue.js";
|
|
8
|
+
import _sfc_main$2 from "./RemindLaterButton.vue.js";
|
|
9
|
+
import { feedbackBus, NoticeCategory, NoticePriorityRank, NoticeTone } from "../../../feedback/FeedbackBus.js";
|
|
10
|
+
import { toastHost } from "../toastHost/ToastHostStore.js";
|
|
4
11
|
function toToastOptions(notice) {
|
|
5
12
|
return {
|
|
6
13
|
title: notice.title,
|
|
7
14
|
description: notice.description,
|
|
15
|
+
compact: notice.compact,
|
|
16
|
+
details: notice.details,
|
|
8
17
|
severity: notice.tone,
|
|
18
|
+
priority: notice.priority,
|
|
9
19
|
duration: notice.durationMs,
|
|
20
|
+
expiresAtMs: notice.expiresAtMs,
|
|
21
|
+
canPin: notice.canPin,
|
|
10
22
|
action: notice.action,
|
|
11
|
-
report: notice.report
|
|
23
|
+
report: notice.report,
|
|
24
|
+
progress: notice.progress
|
|
12
25
|
};
|
|
13
26
|
}
|
|
14
27
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -20,34 +33,166 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
20
33
|
setup(__props) {
|
|
21
34
|
const props = __props;
|
|
22
35
|
const attrs = useAttrs();
|
|
36
|
+
const locale = useLocale();
|
|
37
|
+
const rowIdBase = useId();
|
|
23
38
|
const bus = computed(() => props.bus ?? feedbackBus);
|
|
24
39
|
watch(
|
|
25
40
|
bus,
|
|
26
41
|
(current, _previous, onCleanup) => {
|
|
27
42
|
if (typeof document === "undefined") return;
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
const members = /* @__PURE__ */ new Map();
|
|
44
|
+
const groups = /* @__PURE__ */ new Map();
|
|
45
|
+
let active = true;
|
|
46
|
+
function forget(entry) {
|
|
47
|
+
if (entry.groupKey && groups.get(entry.groupKey) === entry) groups.delete(entry.groupKey);
|
|
48
|
+
for (const id of entry.notices.keys()) {
|
|
49
|
+
if (members.get(id) === entry) members.delete(id);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function reminderFor(entry, notice) {
|
|
53
|
+
const remind = current.remindLater;
|
|
54
|
+
if (!remind || !notice.reminderKey || Number.isFinite(notice.expiresAtMs)) return void 0;
|
|
55
|
+
return h(_sfc_main$2, {
|
|
56
|
+
key: notice.id,
|
|
57
|
+
schedule: async () => {
|
|
58
|
+
entry.pending.value += 1;
|
|
59
|
+
try {
|
|
60
|
+
await remind(notice);
|
|
61
|
+
if (active) {
|
|
62
|
+
current.notify({
|
|
63
|
+
tone: NoticeTone.Info,
|
|
64
|
+
title: locale.t("FeedbackToastHost.reminderScheduled", void 0, "Reminder scheduled."),
|
|
65
|
+
canPin: false
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
} finally {
|
|
69
|
+
entry.pending.value -= 1;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function renderGroup(entry, rows) {
|
|
75
|
+
return h(
|
|
76
|
+
TransitionGroup,
|
|
77
|
+
{
|
|
78
|
+
tag: ElementTag.Ul,
|
|
79
|
+
class: "divide-y divide-border px-3",
|
|
80
|
+
enterActiveClass: "motion-safe:transition-[opacity,translate] motion-safe:duration-(--toast-group-duration) ease-out",
|
|
81
|
+
enterFromClass: "motion-safe:translate-y-2 motion-safe:opacity-0"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
default: () => [...rows].reverse().map((notice) => {
|
|
85
|
+
const reminder = reminderFor(entry, notice);
|
|
86
|
+
const report = notice.report ? h(_sfc_main$3, { send: notice.report }) : void 0;
|
|
87
|
+
const copy = notice.compact ?? notice;
|
|
88
|
+
const running = notice.progress;
|
|
89
|
+
const titleId = `${rowIdBase}-title-${notice.id}`;
|
|
90
|
+
return h(ElementTag.Li, { key: notice.id, "data-toast-group-row": notice.id, class: "py-1.5" }, [
|
|
91
|
+
h(
|
|
92
|
+
_sfc_main$4,
|
|
93
|
+
{ isCompact: true, titleId },
|
|
94
|
+
{
|
|
95
|
+
title: () => copy.title,
|
|
96
|
+
description: copy.description ? () => copy.description : void 0,
|
|
97
|
+
progress: running ? () => h(_sfc_main$5, {
|
|
98
|
+
progress: running,
|
|
99
|
+
severity: notice.tone,
|
|
100
|
+
isCompact: true,
|
|
101
|
+
"aria-labelledby": titleId
|
|
102
|
+
}) : void 0,
|
|
103
|
+
actions: notice.action || reminder || report ? () => [notice.action, reminder, report] : void 0,
|
|
104
|
+
default: notice.details ? () => notice.details : void 0
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
]);
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
function render(entry) {
|
|
113
|
+
const rows = [...entry.notices.values()];
|
|
114
|
+
const first = rows[0];
|
|
115
|
+
if (!first) {
|
|
116
|
+
forget(entry);
|
|
117
|
+
if (entry.id) toastHost.dismiss(entry.id);
|
|
33
118
|
return;
|
|
34
119
|
}
|
|
35
|
-
for (const toastId of [...toastIds.values()]) toastHost.dismiss(toastId);
|
|
36
|
-
};
|
|
37
|
-
const unsubscribe = current.subscribe((notice) => {
|
|
38
120
|
const options = {
|
|
39
|
-
...toToastOptions(
|
|
40
|
-
|
|
41
|
-
onDismiss: () =>
|
|
42
|
-
toastIds.delete(notice.id);
|
|
43
|
-
}
|
|
121
|
+
...toToastOptions(first),
|
|
122
|
+
pauseExpiry: () => entry.pending.value > 0,
|
|
123
|
+
onDismiss: () => forget(entry)
|
|
44
124
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
125
|
+
if (entry.groupKey) {
|
|
126
|
+
const latest = rows.at(-1) ?? first;
|
|
127
|
+
options.group = {
|
|
128
|
+
count: rows.length,
|
|
129
|
+
latest: {
|
|
130
|
+
title: typeof latest.title === "string" ? latest.title : void 0,
|
|
131
|
+
description: typeof latest.description === "string" ? latest.description : void 0,
|
|
132
|
+
severity: latest.tone
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (rows.length === 1) {
|
|
137
|
+
const reminder = reminderFor(entry, first);
|
|
138
|
+
if (reminder) options.action = h(Fragment, null, [first.action, reminder]);
|
|
139
|
+
options.onDelete = first.category === NoticeCategory.Retained ? () => current.remove(first.id) : void 0;
|
|
140
|
+
} else {
|
|
141
|
+
options.title = first.group?.title ?? first.title;
|
|
142
|
+
options.description = locale.t(
|
|
143
|
+
"FeedbackToastHost.groupedCount",
|
|
144
|
+
{ count: rows.length },
|
|
145
|
+
"{count} notifications"
|
|
146
|
+
);
|
|
147
|
+
options.details = renderGroup(entry, rows);
|
|
148
|
+
options.compact = void 0;
|
|
149
|
+
options.canPin = rows.some((notice) => notice.canPin === false) ? false : first.canPin;
|
|
150
|
+
options.priority = rows.reduce((highest, { priority }) => {
|
|
151
|
+
if (priority === void 0) return highest;
|
|
152
|
+
return highest === void 0 || NoticePriorityRank[priority] > NoticePriorityRank[highest] ? priority : highest;
|
|
153
|
+
}, void 0);
|
|
154
|
+
options.action = void 0;
|
|
155
|
+
options.report = void 0;
|
|
156
|
+
options.progress = void 0;
|
|
157
|
+
options.onDelete = void 0;
|
|
158
|
+
if (rows.some((notice) => notice.progress)) options.duration = Infinity;
|
|
159
|
+
}
|
|
160
|
+
if (entry.id) toastHost.update(entry.id, options);
|
|
161
|
+
else entry.id = toastHost.toast(options);
|
|
162
|
+
}
|
|
163
|
+
function removeMember(id, entry) {
|
|
164
|
+
members.delete(id);
|
|
165
|
+
entry.notices.delete(id);
|
|
166
|
+
render(entry);
|
|
167
|
+
}
|
|
168
|
+
function close(id) {
|
|
169
|
+
if (id !== null) {
|
|
170
|
+
const entry = members.get(id);
|
|
171
|
+
if (entry) removeMember(id, entry);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
for (const entry of new Set(members.values())) if (entry.id) toastHost.dismiss(entry.id);
|
|
175
|
+
}
|
|
176
|
+
const unsubscribe = current.subscribe((notice) => {
|
|
177
|
+
if (current.suppresses(notice)) return;
|
|
178
|
+
const groupKey = Number.isFinite(notice.expiresAtMs) ? void 0 : notice.group?.key || void 0;
|
|
179
|
+
let entry = members.get(notice.id);
|
|
180
|
+
if (entry && entry.groupKey !== groupKey) {
|
|
181
|
+
removeMember(notice.id, entry);
|
|
182
|
+
entry = void 0;
|
|
183
|
+
}
|
|
184
|
+
entry ??= groupKey ? groups.get(groupKey) : void 0;
|
|
185
|
+
if (!entry) {
|
|
186
|
+
entry = { groupKey, notices: /* @__PURE__ */ new Map(), pending: shallowRef(0) };
|
|
187
|
+
if (groupKey) groups.set(groupKey, entry);
|
|
188
|
+
}
|
|
189
|
+
members.set(notice.id, entry);
|
|
190
|
+
entry.notices.set(notice.id, notice);
|
|
191
|
+
render(entry);
|
|
48
192
|
});
|
|
49
193
|
const unsubscribeDismiss = current.subscribeDismiss(close);
|
|
50
194
|
onCleanup(() => {
|
|
195
|
+
active = false;
|
|
51
196
|
unsubscribe();
|
|
52
197
|
unsubscribeDismiss();
|
|
53
198
|
close(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeedbackToastHost.vue.js","sources":["../../../../src/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { FeedbackBus, PublishedNotice } from '../../../feedback';\nimport type { ToastHostProps, ToastOptions } from '../toastHost';\n\n/**\n * The prop surface of `FeedbackToastHost` — `bus`, plus every `ToastHost` prop.\n *\n * The `ToastHostProps` heritage is marked `@vue-ignore` so only `bus` becomes a\n * runtime prop and the rest arrive as attrs; the template hands those to\n * `<ToastHost>`, which declares them and resolves them back into props. Consumers\n * still get the full checked surface, because the heritage is real to\n * TypeScript — it is only the SFC compiler's runtime-props pass that skips it.\n */\nexport interface FeedbackToastHostProps extends /* @vue-ignore */ ToastHostProps {\n /** The bus to render. Default: the app-wide `feedbackBus` singleton (what `notify()` publishes on). */\n readonly bus?: FeedbackBus;\n}\n\n/**\n * Maps a bus notice onto the imperative toast payload. `NoticeTone` is a subset of the toast\n * `Severity` vocabulary and `NoticeNode` is `ToastNode` — drift in either is a compile error.\n */\nfunction toToastOptions(notice: PublishedNotice): ToastOptions {\n return {\n title: notice.title,\n description: notice.description,\n severity: notice.tone,\n duration: notice.durationMs,\n action: notice.action,\n report: notice.report,\n };\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, useAttrs, watch } from 'vue';\nimport { feedbackBus, NoticeCategory } from '../../../feedback';\nimport ToastHost from '../toastHost/ToastHost.vue';\nimport { toastHost } from '../toastHost';\n\n/**\n * Renders the toast viewport and forwards every `/feedback` bus notice into `toastHost.toast()`.\n * All `ToastHostProps` pass through. Mount once per app **in place of** a bare `<ToastHost/>` —\n * mounting both would render every toast twice. Nothing toasts until this (or another subscriber)\n * is mounted; notices published before mount are dropped, so mount it at the app root.\n */\ndefineOptions({ name: 'FeedbackToastHost', inheritAttrs: false });\n\nconst props = defineProps<FeedbackToastHostProps>();\n\nconst attrs = useAttrs();\n\n/** A `computed` keeps the fallback reactive, so a swapped `bus` re-subscribes. */\nconst bus = computed(() => props.bus ?? feedbackBus);\n\n/*\n * React's `useEffect(() => bus.subscribe(...), [bus])`: `onCleanup` receives the\n * unsubscribe, so a changed `bus` drops the old subscription before opening the\n * new one, and scope disposal drops the last.\n */\nwatch(\n bus,\n (current, _previous, onCleanup) => {\n // Client-only, as the effect was: a server render has no viewport to forward into.\n if (typeof document === 'undefined') return;\n const toastIds = new Map<string, string>();\n const close = (id: string | null): void => {\n if (id !== null) {\n const toastId = toastIds.get(id);\n if (toastId) toastHost.dismiss(toastId);\n return;\n }\n for (const toastId of [...toastIds.values()]) toastHost.dismiss(toastId);\n };\n const unsubscribe = current.subscribe((notice) => {\n const options: ToastOptions = {\n ...toToastOptions(notice),\n onDelete: notice.category === NoticeCategory.Retained ? () => current.remove(notice.id) : undefined,\n onDismiss: () => {\n toastIds.delete(notice.id);\n },\n };\n const existing = toastIds.get(notice.id);\n if (existing) toastHost.update(existing, options);\n else toastIds.set(notice.id, toastHost.toast(options));\n });\n const unsubscribeDismiss = current.subscribeDismiss(close);\n onCleanup(() => {\n unsubscribe();\n unsubscribeDismiss();\n close(null);\n });\n },\n { immediate: true },\n);\n</script>\n\n<template>\n <!-- Every non-`bus` attr is a `ToastHost` prop by construction — see `FeedbackToastHostProps`. -->\n <ToastHost v-bind=\"attrs\" />\n</template>\n"],"names":["_openBlock","_createBlock","ToastHost","_unref"],"mappings":";;;AAsBA,SAAS,eAAe,QAAuC;AAC7D,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,IACd,aAAa,OAAO;AAAA,IACpB,UAAU,OAAO;AAAA,IACjB,UAAU,OAAO;AAAA,IACjB,QAAQ,OAAO;AAAA,IACf,QAAQ,OAAO;AAAA,EAAA;AAEnB;;;;;;;;AAiBA,UAAM,QAAQ;AAEd,UAAM,QAAQ,SAAA;AAGd,UAAM,MAAM,SAAS,MAAM,MAAM,OAAO,WAAW;AAOnD;AAAA,MACE;AAAA,MACA,CAAC,SAAS,WAAW,cAAc;AAEjC,YAAI,OAAO,aAAa,YAAa;AACrC,cAAM,+BAAe,IAAA;AACrB,cAAM,QAAQ,CAAC,OAA4B;AACzC,cAAI,OAAO,MAAM;AACf,kBAAM,UAAU,SAAS,IAAI,EAAE;AAC/B,gBAAI,QAAS,WAAU,QAAQ,OAAO;AACtC;AAAA,UACF;AACA,qBAAW,WAAW,CAAC,GAAG,SAAS,QAAQ,EAAG,WAAU,QAAQ,OAAO;AAAA,QACzE;AACA,cAAM,cAAc,QAAQ,UAAU,CAAC,WAAW;AAChD,gBAAM,UAAwB;AAAA,YAC5B,GAAG,eAAe,MAAM;AAAA,YACxB,UAAU,OAAO,aAAa,eAAe,WAAW,MAAM,QAAQ,OAAO,OAAO,EAAE,IAAI;AAAA,YAC1F,WAAW,MAAM;AACf,uBAAS,OAAO,OAAO,EAAE;AAAA,YAC3B;AAAA,UAAA;AAEF,gBAAM,WAAW,SAAS,IAAI,OAAO,EAAE;AACvC,cAAI,SAAU,WAAU,OAAO,UAAU,OAAO;AAAA,wBAClC,IAAI,OAAO,IAAI,UAAU,MAAM,OAAO,CAAC;AAAA,QACvD,CAAC;AACD,cAAM,qBAAqB,QAAQ,iBAAiB,KAAK;AACzD,kBAAU,MAAM;AACd,sBAAA;AACA,6BAAA;AACA,gBAAM,IAAI;AAAA,QACZ,CAAC;AAAA,MACH;AAAA,MACA,EAAE,WAAW,KAAA;AAAA,IAAK;;AAMlB,aAAAA,UAAA,GAAAC,YAA4BC,+CAATC,MAAA,KAAA,CAAK,CAAA,GAAA,MAAA,EAAA;AAAA;;;"}
|
|
1
|
+
{"version":3,"file":"FeedbackToastHost.vue.js","sources":["../../../../src/presentation/feedback/feedbackToastHost/FeedbackToastHost.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { computed, Fragment, h, shallowRef, TransitionGroup, useAttrs, useId, watch, type ShallowRef } from 'vue';\n\nimport {\n feedbackBus,\n NoticeCategory,\n NoticePriority,\n NoticePriorityRank,\n NoticeTone,\n type FeedbackBus,\n type PublishedNotice,\n} from '../../../feedback';\nimport { toastHost, type ToastHostProps, type ToastOptions } from '../toastHost';\n\n/** Defines props for the bus-fed toast viewport — `bus` plus every `ToastHost` prop. */\nexport interface FeedbackToastHostProps extends /* @vue-ignore */ ToastHostProps {\n /** The bus to render. Default: the app-wide `feedbackBus` singleton (what `notify()` publishes on). */\n readonly bus?: FeedbackBus;\n}\n\n/** @internal A live toast and the notices it stands for. */\ninterface LiveToast {\n id?: string;\n readonly groupKey?: string;\n readonly notices: Map<string, PublishedNotice>;\n readonly pending: ShallowRef<number>;\n}\n\n/** @internal Maps a bus notice onto the toast payload. */\nfunction toToastOptions(notice: PublishedNotice): ToastOptions {\n return {\n title: notice.title,\n description: notice.description,\n compact: notice.compact,\n details: notice.details,\n severity: notice.tone,\n priority: notice.priority,\n duration: notice.durationMs,\n expiresAtMs: notice.expiresAtMs,\n canPin: notice.canPin,\n action: notice.action,\n report: notice.report,\n progress: notice.progress,\n };\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ElementTag } from '../../../foundation/dom';\nimport { useLocale } from '../../../foundation/i18n';\nimport ReportAction from '../reportAction/ReportAction.vue';\nimport ToastContent from '../toast/ToastContent.vue';\nimport ToastRunningProgress from '../toast/ToastRunningProgress.vue';\nimport ToastHost from '../toastHost/ToastHost.vue';\nimport RemindLaterButton from './RemindLaterButton.vue';\n\n/**\n * Renders the app's transient notification stack from the feedback bus; every `ToastHostProps` prop passes through.\n * Mount once per app at the root, in place of a bare `<ToastHost/>`; notices published before mount are dropped.\n */\ndefineOptions({ name: 'FeedbackToastHost', inheritAttrs: false });\n\nconst props = defineProps<FeedbackToastHostProps>();\n\nconst attrs = useAttrs();\nconst locale = useLocale();\nconst rowIdBase = useId();\n\n/** The bus in use — the prop, else the app-wide `feedbackBus`. */\nconst bus = computed(() => props.bus ?? feedbackBus);\n\n/** Syncs the bus's notices into the toast store, resubscribing when `bus` changes. */\nwatch(\n bus,\n (current, _previous, onCleanup) => {\n // Client-only — a server render has no viewport to forward into.\n if (typeof document === 'undefined') return;\n const members = new Map<string, LiveToast>();\n const groups = new Map<string, LiveToast>();\n let active = true;\n\n function forget(entry: LiveToast): void {\n if (entry.groupKey && groups.get(entry.groupKey) === entry) groups.delete(entry.groupKey);\n for (const id of entry.notices.keys()) {\n if (members.get(id) === entry) members.delete(id);\n }\n }\n\n function reminderFor(entry: LiveToast, notice: PublishedNotice) {\n const remind = current.remindLater;\n if (!remind || !notice.reminderKey || Number.isFinite(notice.expiresAtMs)) return undefined;\n return h(RemindLaterButton, {\n key: notice.id,\n schedule: async () => {\n entry.pending.value += 1;\n try {\n await remind(notice);\n if (active) {\n current.notify({\n tone: NoticeTone.Info,\n title: locale.t('FeedbackToastHost.reminderScheduled', undefined, 'Reminder scheduled.'),\n canPin: false,\n });\n }\n } finally {\n entry.pending.value -= 1;\n }\n },\n });\n }\n\n function renderGroup(entry: LiveToast, rows: ReadonlyArray<PublishedNotice>) {\n return h(\n TransitionGroup,\n {\n tag: ElementTag.Ul,\n class: 'divide-y divide-border px-3',\n enterActiveClass:\n 'motion-safe:transition-[opacity,translate] motion-safe:duration-(--toast-group-duration) ease-out',\n enterFromClass: 'motion-safe:translate-y-2 motion-safe:opacity-0',\n },\n {\n default: () =>\n [...rows].reverse().map((notice) => {\n const reminder = reminderFor(entry, notice);\n const report = notice.report ? h(ReportAction, { send: notice.report }) : undefined;\n const copy = notice.compact ?? notice;\n const running = notice.progress;\n const titleId = `${rowIdBase}-title-${notice.id}`;\n return h(ElementTag.Li, { key: notice.id, 'data-toast-group-row': notice.id, class: 'py-1.5' }, [\n h(\n ToastContent,\n { isCompact: true, titleId },\n {\n title: () => copy.title,\n description: copy.description ? () => copy.description : undefined,\n progress: running\n ? () =>\n h(ToastRunningProgress, {\n progress: running,\n severity: notice.tone,\n isCompact: true,\n 'aria-labelledby': titleId,\n })\n : undefined,\n actions: notice.action || reminder || report ? () => [notice.action, reminder, report] : undefined,\n default: notice.details ? () => notice.details : undefined,\n },\n ),\n ]);\n }),\n },\n );\n }\n\n function render(entry: LiveToast): void {\n const rows = [...entry.notices.values()];\n const first = rows[0];\n if (!first) {\n forget(entry);\n if (entry.id) toastHost.dismiss(entry.id);\n return;\n }\n const options: ToastOptions = {\n ...toToastOptions(first),\n pauseExpiry: () => entry.pending.value > 0,\n onDismiss: () => forget(entry),\n };\n if (entry.groupKey) {\n const latest = rows.at(-1) ?? first;\n options.group = {\n count: rows.length,\n latest: {\n title: typeof latest.title === 'string' ? latest.title : undefined,\n description: typeof latest.description === 'string' ? latest.description : undefined,\n severity: latest.tone,\n },\n };\n }\n if (rows.length === 1) {\n const reminder = reminderFor(entry, first);\n if (reminder) options.action = h(Fragment, null, [first.action, reminder]);\n options.onDelete = first.category === NoticeCategory.Retained ? () => current.remove(first.id) : undefined;\n } else {\n options.title = first.group?.title ?? first.title;\n options.description = locale.t(\n 'FeedbackToastHost.groupedCount',\n { count: rows.length },\n '{count} notifications',\n );\n options.details = renderGroup(entry, rows);\n options.compact = undefined;\n options.canPin = rows.some((notice) => notice.canPin === false) ? false : first.canPin;\n // The highest explicit priority; unclassified members leave the host's severity durations in charge.\n options.priority = rows.reduce<NoticePriority | undefined>((highest, { priority }) => {\n if (priority === undefined) return highest;\n return highest === undefined || NoticePriorityRank[priority] > NoticePriorityRank[highest]\n ? priority\n : highest;\n }, undefined);\n options.action = undefined;\n options.report = undefined;\n options.progress = undefined;\n options.onDelete = undefined;\n // Rows own their progress; the card stays up while any member runs and takes its duration back after.\n if (rows.some((notice) => notice.progress)) options.duration = Infinity;\n }\n if (entry.id) toastHost.update(entry.id, options);\n else entry.id = toastHost.toast(options);\n }\n\n function removeMember(id: string, entry: LiveToast): void {\n members.delete(id);\n entry.notices.delete(id);\n render(entry);\n }\n\n function close(id: string | null): void {\n if (id !== null) {\n const entry = members.get(id);\n if (entry) removeMember(id, entry);\n return;\n }\n for (const entry of new Set(members.values())) if (entry.id) toastHost.dismiss(entry.id);\n }\n\n const unsubscribe = current.subscribe((notice) => {\n if (current.suppresses(notice)) return;\n const groupKey = Number.isFinite(notice.expiresAtMs) ? undefined : notice.group?.key || undefined;\n let entry = members.get(notice.id);\n if (entry && entry.groupKey !== groupKey) {\n removeMember(notice.id, entry);\n entry = undefined;\n }\n entry ??= groupKey ? groups.get(groupKey) : undefined;\n if (!entry) {\n entry = { groupKey, notices: new Map(), pending: shallowRef(0) };\n if (groupKey) groups.set(groupKey, entry);\n }\n members.set(notice.id, entry);\n entry.notices.set(notice.id, notice);\n render(entry);\n });\n const unsubscribeDismiss = current.subscribeDismiss(close);\n onCleanup(() => {\n active = false;\n unsubscribe();\n unsubscribeDismiss();\n close(null);\n });\n },\n { immediate: true },\n);\n</script>\n\n<template>\n <!-- Every non-`bus` attr is a `ToastHost` prop by construction — see `FeedbackToastHostProps`. -->\n <ToastHost v-bind=\"attrs\" />\n</template>\n"],"names":["RemindLaterButton","ReportAction","ToastContent","ToastRunningProgress","_openBlock","_createBlock","ToastHost","_unref"],"mappings":";;;;;;;;;;AA6BA,SAAS,eAAe,QAAuC;AAC7D,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,IACd,aAAa,OAAO;AAAA,IACpB,SAAS,OAAO;AAAA,IAChB,SAAS,OAAO;AAAA,IAChB,UAAU,OAAO;AAAA,IACjB,UAAU,OAAO;AAAA,IACjB,UAAU,OAAO;AAAA,IACjB,aAAa,OAAO;AAAA,IACpB,QAAQ,OAAO;AAAA,IACf,QAAQ,OAAO;AAAA,IACf,QAAQ,OAAO;AAAA,IACf,UAAU,OAAO;AAAA,EAAA;AAErB;;;;;;;;AAkBA,UAAM,QAAQ;AAEd,UAAM,QAAQ,SAAA;AACd,UAAM,SAAS,UAAA;AACf,UAAM,YAAY,MAAA;AAGlB,UAAM,MAAM,SAAS,MAAM,MAAM,OAAO,WAAW;AAGnD;AAAA,MACE;AAAA,MACA,CAAC,SAAS,WAAW,cAAc;AAEjC,YAAI,OAAO,aAAa,YAAa;AACrC,cAAM,8BAAc,IAAA;AACpB,cAAM,6BAAa,IAAA;AACnB,YAAI,SAAS;AAEb,iBAAS,OAAO,OAAwB;AACtC,cAAI,MAAM,YAAY,OAAO,IAAI,MAAM,QAAQ,MAAM,MAAO,QAAO,OAAO,MAAM,QAAQ;AACxF,qBAAW,MAAM,MAAM,QAAQ,KAAA,GAAQ;AACrC,gBAAI,QAAQ,IAAI,EAAE,MAAM,MAAO,SAAQ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AAM,EAAE;AAAA,QACzF;AAEA,cAAM,cAAc,QAAQ,UAAU,CAAC,WAAW;AAChD,cAAI,QAAQ,WAAW,MAAM,EAAG;AAChC,gBAAM,WAAW,OAAO,SAAS,OAAO,WAAW,IAAI,SAAY,OAAO,OAAO,OAAO;AACxF,cAAI,QAAQ,QAAQ,IAAI,OAAO,EAAE;AACjC,cAAI,SAAS,MAAM,aAAa,UAAU;AACxC,yBAAa,OAAO,IAAI,KAAK;AAC7B,oBAAQ;AAAA,UACV;AACA,oBAAU,WAAW,OAAO,IAAI,QAAQ,IAAI;AAC5C,cAAI,CAAC,OAAO;AACV,oBAAQ,EAAE,UAAU,SAAS,oBAAI,OAAO,SAAS,WAAW,CAAC,EAAA;AAC7D,gBAAI,SAAU,QAAO,IAAI,UAAU,KAAK;AAAA,UAC1C;AACA,kBAAQ,IAAI,OAAO,IAAI,KAAK;AAC5B,gBAAM,QAAQ,IAAI,OAAO,IAAI,MAAM;AACnC,iBAAO,KAAK;AAAA,QACd,CAAC;AACD,cAAM,qBAAqB,QAAQ,iBAAiB,KAAK;AACzD,kBAAU,MAAM;AACd,mBAAS;AACT,sBAAA;AACA,6BAAA;AACA,gBAAM,IAAI;AAAA,QACZ,CAAC;AAAA,MACH;AAAA,MACA,EAAE,WAAW,KAAA;AAAA,IAAK;;AAMlB,aAAAC,UAAA,GAAAC,YAA4BC,+CAATC,MAAA,KAAA,CAAK,CAAA,GAAA,MAAA,EAAA;AAAA;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Defines props for the Remind later button of a bus notice. */
|
|
2
|
+
export interface RemindLaterButtonProps {
|
|
3
|
+
/** Schedules the reminder. A rejection shows the retry hint and keeps the button available. */
|
|
4
|
+
readonly schedule: () => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: import('vue').DefineComponent<RemindLaterButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<RemindLaterButtonProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
export default _default;
|