@wow-two-beta/fe 0.0.49 → 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 +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,77 +1,118 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, useAttrs, useSlots, useTemplateRef, useId, shallowRef, computed, watch, onBeforeUpdate, onUpdated, openBlock, createElementBlock, mergeProps, unref, createElementVNode, renderSlot, createTextVNode, toDisplayString, normalizeClass, createCommentVNode, createVNode, Fragment, renderList, createBlock, createSlots, withCtx, nextTick } from "vue";
|
|
2
|
+
import { CheckCheck, ListX, X, Bell } from "lucide-vue-next";
|
|
2
3
|
import { useLocale } from "../../../foundation/i18n/providers/LocaleContext.js";
|
|
3
4
|
import { useLocaleDefaults } from "../../../foundation/i18n/UseLocaleDefaults.js";
|
|
4
|
-
import _sfc_main$2 from "./NotificationItem.vue.js";
|
|
5
|
-
import _sfc_main$3 from "../../feedback/reportAction/ReportAction.vue.js";
|
|
6
|
-
import { X, Bell } from "lucide-vue-next";
|
|
7
5
|
import { cn } from "../../../foundation/styles/Cn.js";
|
|
8
6
|
import { surfaceVariants } from "../../../foundation/styles/SurfaceStyles.js";
|
|
7
|
+
import _sfc_main$4 from "../../feedback/progressBar/ProgressBar.vue.js";
|
|
8
|
+
import _sfc_main$5 from "../../feedback/reportAction/ReportAction.vue.js";
|
|
9
|
+
import _sfc_main$3 from "../relativeTime/RelativeTime.vue.js";
|
|
10
|
+
import _sfc_main$2 from "./NotificationCenterGroupItem.vue.js";
|
|
9
11
|
import _sfc_main$1 from "../../../foundation/icons/icon/Icon.vue.js";
|
|
10
12
|
import { renderableChildren } from "../../../foundation/primitives/slot/Slot.js";
|
|
11
13
|
const _hoisted_1 = ["aria-label"];
|
|
12
14
|
const _hoisted_2 = { class: "flex items-center justify-between gap-2 border-b border-border px-3 py-2.5" };
|
|
13
|
-
const _hoisted_3 = { class: "flex items-center gap-2" };
|
|
14
|
-
const _hoisted_4 = { class: "text-sm font-semibold" };
|
|
15
|
+
const _hoisted_3 = { class: "flex min-w-0 items-center gap-2" };
|
|
16
|
+
const _hoisted_4 = { class: "truncate text-sm font-semibold" };
|
|
15
17
|
const _hoisted_5 = {
|
|
16
18
|
key: 0,
|
|
17
|
-
class: "
|
|
19
|
+
class: "flex shrink-0 items-center gap-1"
|
|
18
20
|
};
|
|
19
|
-
const _hoisted_6 =
|
|
21
|
+
const _hoisted_6 = ["aria-label", "title"];
|
|
22
|
+
const _hoisted_7 = ["aria-label", "title"];
|
|
23
|
+
const _hoisted_8 = ["aria-label"];
|
|
24
|
+
const _hoisted_9 = {
|
|
20
25
|
key: 0,
|
|
21
|
-
class: "flex items-center gap-2"
|
|
26
|
+
class: "flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-2 text-sm"
|
|
22
27
|
};
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
+
const _hoisted_10 = ["for"];
|
|
29
|
+
const _hoisted_11 = ["id", "value"];
|
|
30
|
+
const _hoisted_12 = { value: "on" };
|
|
31
|
+
const _hoisted_13 = {
|
|
32
|
+
key: 0,
|
|
33
|
+
value: "timed",
|
|
34
|
+
disabled: ""
|
|
35
|
+
};
|
|
36
|
+
const _hoisted_14 = { value: "15m" };
|
|
37
|
+
const _hoisted_15 = { value: "1h" };
|
|
38
|
+
const _hoisted_16 = { value: "manual" };
|
|
39
|
+
const _hoisted_17 = { class: "max-h-96 overflow-y-auto py-1" };
|
|
40
|
+
const _hoisted_18 = { class: "flex flex-col items-center gap-2 px-4 py-10 text-center text-muted-foreground" };
|
|
41
|
+
const _hoisted_19 = { class: "text-sm" };
|
|
42
|
+
const _hoisted_20 = {
|
|
28
43
|
key: 1,
|
|
29
44
|
class: "flex flex-col"
|
|
30
45
|
};
|
|
31
|
-
const
|
|
46
|
+
const _hoisted_21 = ["id"];
|
|
47
|
+
const _hoisted_22 = {
|
|
32
48
|
key: 0,
|
|
49
|
+
class: "mt-1 text-xs text-muted-foreground"
|
|
50
|
+
};
|
|
51
|
+
const _hoisted_23 = {
|
|
52
|
+
key: 1,
|
|
33
53
|
class: "border-t border-border px-3 py-2 text-center text-xs"
|
|
34
54
|
};
|
|
55
|
+
const HeaderActionClasses = [
|
|
56
|
+
"inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted",
|
|
57
|
+
"hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
|
|
58
|
+
"pointer-coarse:size-11"
|
|
59
|
+
];
|
|
60
|
+
const CountBadgeClasses = [
|
|
61
|
+
"inline-flex items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold leading-5",
|
|
62
|
+
"text-primary-foreground"
|
|
63
|
+
];
|
|
64
|
+
const PauseSelectClasses = [
|
|
65
|
+
"min-w-0 max-w-full rounded-md border border-border bg-background px-2 py-1",
|
|
66
|
+
"focus-visible:outline-2 focus-visible:outline-ring pointer-coarse:min-h-11"
|
|
67
|
+
];
|
|
68
|
+
const NoticeNodeView = defineComponent({
|
|
69
|
+
name: "NoticeNodeView",
|
|
70
|
+
props: { node: { type: [String, Object], required: true } },
|
|
71
|
+
setup: (nodeProps) => () => nodeProps.node
|
|
72
|
+
});
|
|
35
73
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
36
74
|
...{ name: "NotificationCenterGroup", inheritAttrs: false },
|
|
37
75
|
__name: "NotificationCenterGroup",
|
|
38
76
|
props: {
|
|
39
77
|
bus: {},
|
|
40
78
|
title: {},
|
|
41
|
-
count: {}
|
|
79
|
+
count: {},
|
|
80
|
+
canPause: { type: Boolean },
|
|
81
|
+
canClear: { type: Boolean, default: true },
|
|
82
|
+
onClose: {}
|
|
42
83
|
},
|
|
43
|
-
|
|
44
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
45
|
-
const locale = useLocale();
|
|
84
|
+
setup(__props, { expose: __expose }) {
|
|
46
85
|
const componentProps = __props;
|
|
47
86
|
const props = useLocaleDefaults(componentProps, "NotificationCenterGroup", { title: "Notifications" });
|
|
48
|
-
const
|
|
49
|
-
const instance = getCurrentInstance();
|
|
50
|
-
const hasClose = () => Boolean(instance?.vnode.props?.onClose);
|
|
87
|
+
const locale = useLocale();
|
|
51
88
|
const attrs = useAttrs();
|
|
52
89
|
const slots = useSlots();
|
|
53
90
|
const el = useTemplateRef("el");
|
|
91
|
+
const pauseLabelId = useId();
|
|
92
|
+
const rowId = useId();
|
|
93
|
+
const pausedUntil = shallowRef(null);
|
|
94
|
+
const unreadIds = shallowRef(/* @__PURE__ */ new Set());
|
|
54
95
|
const notices = shallowRef([]);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
(bus, _previous, onCleanup) => {
|
|
58
|
-
notices.value = bus?.retained() ?? [];
|
|
59
|
-
if (bus && typeof document !== "undefined")
|
|
60
|
-
onCleanup(
|
|
61
|
-
bus.subscribeRetained((snapshot) => {
|
|
62
|
-
notices.value = snapshot;
|
|
63
|
-
})
|
|
64
|
-
);
|
|
65
|
-
},
|
|
66
|
-
{ immediate: true }
|
|
67
|
-
);
|
|
68
|
-
const isEmpty = () => slots.default ? renderableChildren(slots.default()).length === 0 : notices.value.length === 0;
|
|
96
|
+
const now = shallowRef(Date.now());
|
|
97
|
+
let focusedRow;
|
|
69
98
|
const resolvedCount = computed(() => props.count ?? (props.bus ? notices.value.length : void 0));
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
99
|
+
const canMarkRead = computed(() => Boolean(props.bus) && unreadIds.value.size > 0);
|
|
100
|
+
const canClearAll = computed(() => Boolean(props.bus) && props.canClear && notices.value.length > 0);
|
|
101
|
+
const pauseChoice = computed(() => typeof pausedUntil.value === "number" ? "timed" : pausedUntil.value ?? "on");
|
|
102
|
+
const resumeTime = computed(() => {
|
|
103
|
+
if (typeof pausedUntil.value !== "number") return "";
|
|
104
|
+
return new Intl.DateTimeFormat(locale.locale.value, { hour: "numeric", minute: "2-digit" }).format(pausedUntil.value);
|
|
74
105
|
});
|
|
106
|
+
const rows = computed(
|
|
107
|
+
() => notices.value.map((notice) => ({
|
|
108
|
+
notice,
|
|
109
|
+
isUnread: unreadIds.value.has(notice.id),
|
|
110
|
+
progress: notice.progress ? barProgress(notice.progress) : void 0,
|
|
111
|
+
action: notice.expiresAtMs === void 0 || !Number.isFinite(notice.expiresAtMs) || notice.expiresAtMs > now.value ? notice.historyAction ?? notice.action : void 0
|
|
112
|
+
}))
|
|
113
|
+
);
|
|
114
|
+
const markAllReadLabel = computed(() => locale.t("NotificationCenterGroup.markAllRead", void 0, "Mark all read"));
|
|
115
|
+
const clearAllLabel = computed(() => locale.t("NotificationCenterGroup.clearAll", void 0, "Clear all"));
|
|
75
116
|
const classes = computed(
|
|
76
117
|
() => cn("flex w-80 flex-col", surfaceVariants({ variant: "surface", radius: "md" }), attrs.class)
|
|
77
118
|
);
|
|
@@ -80,11 +121,94 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
80
121
|
return others;
|
|
81
122
|
});
|
|
82
123
|
__expose({ el });
|
|
124
|
+
watch(
|
|
125
|
+
() => props.bus,
|
|
126
|
+
(bus, _previous, onCleanup) => {
|
|
127
|
+
notices.value = bus?.retained() ?? [];
|
|
128
|
+
const initial = bus?.notificationState();
|
|
129
|
+
pausedUntil.value = initial?.pausedUntil ?? null;
|
|
130
|
+
unreadIds.value = new Set(initial?.unreadIds);
|
|
131
|
+
if (!bus || typeof document === "undefined") return;
|
|
132
|
+
const stopHistory = bus.subscribeRetained((snapshot) => {
|
|
133
|
+
notices.value = snapshot;
|
|
134
|
+
});
|
|
135
|
+
const stopState = bus.subscribeNotificationState((state) => {
|
|
136
|
+
pausedUntil.value = state.pausedUntil;
|
|
137
|
+
unreadIds.value = new Set(state.unreadIds);
|
|
138
|
+
});
|
|
139
|
+
onCleanup(() => {
|
|
140
|
+
stopHistory();
|
|
141
|
+
stopState();
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
{ immediate: true }
|
|
145
|
+
);
|
|
146
|
+
watch(
|
|
147
|
+
notices,
|
|
148
|
+
(entries, _previous, onCleanup) => {
|
|
149
|
+
let timer;
|
|
150
|
+
function updateDeadlines() {
|
|
151
|
+
now.value = Date.now();
|
|
152
|
+
if (typeof window === "undefined") return;
|
|
153
|
+
let next = Infinity;
|
|
154
|
+
for (const entry of entries) {
|
|
155
|
+
const deadline = entry.expiresAtMs;
|
|
156
|
+
if (deadline !== void 0 && deadline > now.value) next = Math.min(next, deadline);
|
|
157
|
+
}
|
|
158
|
+
if (Number.isFinite(next)) timer = setTimeout(updateDeadlines, Math.min(next - now.value, 2147483647));
|
|
159
|
+
}
|
|
160
|
+
updateDeadlines();
|
|
161
|
+
onCleanup(() => clearTimeout(timer));
|
|
162
|
+
},
|
|
163
|
+
{ immediate: true }
|
|
164
|
+
);
|
|
165
|
+
onBeforeUpdate(() => {
|
|
166
|
+
const active = document.activeElement;
|
|
167
|
+
if (active && el.value?.contains(active))
|
|
168
|
+
focusedRow = active.closest("[data-notification-history-row]") ?? void 0;
|
|
169
|
+
});
|
|
170
|
+
onUpdated(() => {
|
|
171
|
+
if (focusedRow && document.activeElement === document.body) {
|
|
172
|
+
(focusedRow.isConnected ? focusedRow : el.value)?.focus({ preventScroll: true });
|
|
173
|
+
}
|
|
174
|
+
focusedRow = void 0;
|
|
175
|
+
});
|
|
176
|
+
function titleId(index) {
|
|
177
|
+
return `${rowId}-title-${index}`;
|
|
178
|
+
}
|
|
179
|
+
function isEmpty() {
|
|
180
|
+
return slots.default ? renderableChildren(slots.default()).length === 0 : notices.value.length === 0;
|
|
181
|
+
}
|
|
182
|
+
function changePause(event) {
|
|
183
|
+
const select = event.currentTarget;
|
|
184
|
+
const choice = select.value;
|
|
185
|
+
if (choice === "15m") props.bus?.setToastPause(Date.now() + 15 * 6e4);
|
|
186
|
+
else if (choice === "1h") props.bus?.setToastPause(Date.now() + 60 * 6e4);
|
|
187
|
+
else if (choice === "manual") props.bus?.setToastPause("manual");
|
|
188
|
+
else if (choice === "on") props.bus?.setToastPause(null);
|
|
189
|
+
void nextTick(() => {
|
|
190
|
+
select.value = pauseChoice.value;
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function barProgress(progress) {
|
|
194
|
+
const max = progress.max !== void 0 && Number.isFinite(progress.max) && progress.max > 0 ? progress.max : 1;
|
|
195
|
+
const value = typeof progress.value === "number" && Number.isFinite(progress.value) ? Math.min(Math.max(progress.value, 0), max) : void 0;
|
|
196
|
+
return { value, max, label: progress.label };
|
|
197
|
+
}
|
|
198
|
+
function runHeaderAction(event, action) {
|
|
199
|
+
const hadFocus = document.activeElement === event.currentTarget;
|
|
200
|
+
action();
|
|
201
|
+
if (!hadFocus) return;
|
|
202
|
+
void nextTick(() => {
|
|
203
|
+
if (!el.value?.contains(document.activeElement)) el.value?.focus({ preventScroll: true });
|
|
204
|
+
});
|
|
205
|
+
}
|
|
83
206
|
return (_ctx, _cache) => {
|
|
84
207
|
return openBlock(), createElementBlock("div", mergeProps({
|
|
85
208
|
ref_key: "el",
|
|
86
209
|
ref: el,
|
|
87
210
|
role: "region",
|
|
211
|
+
tabindex: "-1",
|
|
88
212
|
"aria-label": unref(locale).t("NotificationCenterGroup.notifications", void 0, "Notifications")
|
|
89
213
|
}, rest.value, { class: classes.value }), [
|
|
90
214
|
createElementVNode("header", _hoisted_2, [
|
|
@@ -94,46 +218,103 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
94
218
|
createTextVNode(toDisplayString(unref(props).title), 1)
|
|
95
219
|
])
|
|
96
220
|
]),
|
|
97
|
-
resolvedCount.value != null || _ctx.$slots.count ? (openBlock(), createElementBlock("span",
|
|
221
|
+
resolvedCount.value != null || _ctx.$slots.count ? (openBlock(), createElementBlock("span", {
|
|
222
|
+
key: 0,
|
|
223
|
+
class: normalizeClass(CountBadgeClasses)
|
|
224
|
+
}, [
|
|
98
225
|
renderSlot(_ctx.$slots, "count", {}, () => [
|
|
99
226
|
createTextVNode(toDisplayString(resolvedCount.value), 1)
|
|
100
227
|
])
|
|
101
228
|
])) : createCommentVNode("", true)
|
|
102
229
|
]),
|
|
103
|
-
_ctx.$slots.headerActions ||
|
|
230
|
+
_ctx.$slots.headerActions || canMarkRead.value || canClearAll.value || unref(props).onClose ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
104
231
|
renderSlot(_ctx.$slots, "headerActions"),
|
|
105
|
-
|
|
232
|
+
canMarkRead.value ? (openBlock(), createElementBlock("button", {
|
|
106
233
|
key: 0,
|
|
107
234
|
type: "button",
|
|
235
|
+
"aria-label": markAllReadLabel.value,
|
|
236
|
+
title: markAllReadLabel.value,
|
|
237
|
+
class: normalizeClass(HeaderActionClasses),
|
|
238
|
+
onClick: _cache[0] || (_cache[0] = ($event) => runHeaderAction($event, () => unref(props).bus?.markNotificationsRead()))
|
|
239
|
+
}, [
|
|
240
|
+
createVNode(unref(_sfc_main$1), {
|
|
241
|
+
icon: unref(CheckCheck),
|
|
242
|
+
size: 14
|
|
243
|
+
}, null, 8, ["icon"])
|
|
244
|
+
], 8, _hoisted_6)) : createCommentVNode("", true),
|
|
245
|
+
canClearAll.value ? (openBlock(), createElementBlock("button", {
|
|
246
|
+
key: 1,
|
|
247
|
+
type: "button",
|
|
248
|
+
"aria-label": clearAllLabel.value,
|
|
249
|
+
title: clearAllLabel.value,
|
|
250
|
+
class: normalizeClass(HeaderActionClasses),
|
|
251
|
+
onClick: _cache[1] || (_cache[1] = ($event) => runHeaderAction($event, () => unref(props).bus?.clearRetained()))
|
|
252
|
+
}, [
|
|
253
|
+
createVNode(unref(_sfc_main$1), {
|
|
254
|
+
icon: unref(ListX),
|
|
255
|
+
size: 14
|
|
256
|
+
}, null, 8, ["icon"])
|
|
257
|
+
], 8, _hoisted_7)) : createCommentVNode("", true),
|
|
258
|
+
unref(props).onClose ? (openBlock(), createElementBlock("button", {
|
|
259
|
+
key: 2,
|
|
260
|
+
type: "button",
|
|
108
261
|
"aria-label": unref(locale).t("NotificationCenterGroup.closeNotifications", void 0, "Close notifications"),
|
|
109
|
-
class:
|
|
110
|
-
onClick: _cache[
|
|
262
|
+
class: normalizeClass(HeaderActionClasses),
|
|
263
|
+
onClick: _cache[2] || (_cache[2] = ($event) => unref(props).onClose())
|
|
111
264
|
}, [
|
|
112
265
|
createVNode(unref(_sfc_main$1), {
|
|
113
266
|
icon: unref(X),
|
|
114
267
|
size: 14
|
|
115
268
|
}, null, 8, ["icon"])
|
|
116
|
-
], 8,
|
|
269
|
+
], 8, _hoisted_8)) : createCommentVNode("", true)
|
|
117
270
|
])) : createCommentVNode("", true)
|
|
118
271
|
]),
|
|
119
|
-
|
|
272
|
+
unref(props).canPause && unref(props).bus ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
273
|
+
createElementVNode("label", { for: unref(pauseLabelId) }, toDisplayString(unref(locale).t("NotificationCenterGroup.popups", void 0, "Toast pop-ups")), 9, _hoisted_10),
|
|
274
|
+
createElementVNode("select", {
|
|
275
|
+
id: unref(pauseLabelId),
|
|
276
|
+
value: pauseChoice.value,
|
|
277
|
+
class: normalizeClass(PauseSelectClasses),
|
|
278
|
+
onChange: changePause
|
|
279
|
+
}, [
|
|
280
|
+
createElementVNode("option", _hoisted_12, toDisplayString(unref(locale).t("NotificationCenterGroup.popupsOn", void 0, "On")), 1),
|
|
281
|
+
pauseChoice.value === "timed" ? (openBlock(), createElementBlock("option", _hoisted_13, toDisplayString(unref(locale).t("NotificationCenterGroup.pausedUntil", { time: resumeTime.value }, "Paused until {time}")), 1)) : createCommentVNode("", true),
|
|
282
|
+
createElementVNode("option", _hoisted_14, toDisplayString(unref(locale).t("NotificationCenterGroup.pause15", void 0, "Pause for 15 minutes")), 1),
|
|
283
|
+
createElementVNode("option", _hoisted_15, toDisplayString(unref(locale).t("NotificationCenterGroup.pause60", void 0, "Pause for 1 hour")), 1),
|
|
284
|
+
createElementVNode("option", _hoisted_16, toDisplayString(unref(locale).t("NotificationCenterGroup.pauseManual", void 0, "Off until resumed")), 1)
|
|
285
|
+
], 40, _hoisted_11)
|
|
286
|
+
])) : createCommentVNode("", true),
|
|
287
|
+
createElementVNode("div", _hoisted_17, [
|
|
120
288
|
isEmpty() ? renderSlot(_ctx.$slots, "emptyState", {}, () => [
|
|
121
|
-
createElementVNode("div",
|
|
289
|
+
createElementVNode("div", _hoisted_18, [
|
|
122
290
|
createVNode(unref(Bell), { class: "h-6 w-6" }),
|
|
123
|
-
createElementVNode("p",
|
|
291
|
+
createElementVNode("p", _hoisted_19, toDisplayString(unref(locale).t("NotificationCenterGroup.youreAllCaughtUp", void 0, "You're all caught up.")), 1)
|
|
124
292
|
])
|
|
125
|
-
], void 0, 0) : (openBlock(), createElementBlock("div",
|
|
293
|
+
], void 0, 0) : (openBlock(), createElementBlock("div", _hoisted_20, [
|
|
126
294
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
127
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
295
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, ({ notice, action, isUnread, progress }, index) => {
|
|
128
296
|
return openBlock(), createBlock(_sfc_main$2, {
|
|
129
297
|
key: notice.id,
|
|
130
298
|
severity: notice.tone,
|
|
299
|
+
"is-unread": isUnread,
|
|
300
|
+
"data-notification-history-row": "",
|
|
301
|
+
tabindex: "-1",
|
|
131
302
|
onDelete: ($event) => unref(props).bus?.remove(notice.id)
|
|
132
303
|
}, createSlots({
|
|
133
304
|
title: withCtx(() => [
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
},
|
|
305
|
+
createElementVNode("span", {
|
|
306
|
+
id: progress ? titleId(index) : void 0
|
|
307
|
+
}, [
|
|
308
|
+
createVNode(unref(NoticeNodeView), {
|
|
309
|
+
node: notice.title
|
|
310
|
+
}, null, 8, ["node"])
|
|
311
|
+
], 8, _hoisted_21)
|
|
312
|
+
]),
|
|
313
|
+
timestamp: withCtx(() => [
|
|
314
|
+
createVNode(_sfc_main$3, {
|
|
315
|
+
"is-live": "",
|
|
316
|
+
value: notice.publishedAtMs
|
|
317
|
+
}, null, 8, ["value"])
|
|
137
318
|
]),
|
|
138
319
|
_: 2
|
|
139
320
|
}, [
|
|
@@ -146,26 +327,39 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
146
327
|
]),
|
|
147
328
|
key: "0"
|
|
148
329
|
} : void 0,
|
|
149
|
-
|
|
330
|
+
progress ? {
|
|
331
|
+
name: "progress",
|
|
332
|
+
fn: withCtx(() => [
|
|
333
|
+
createVNode(_sfc_main$4, {
|
|
334
|
+
size: "sm",
|
|
335
|
+
value: progress.value,
|
|
336
|
+
max: progress.max,
|
|
337
|
+
"aria-labelledby": titleId(index)
|
|
338
|
+
}, null, 8, ["value", "max", "aria-labelledby"]),
|
|
339
|
+
progress.label ? (openBlock(), createElementBlock("p", _hoisted_22, toDisplayString(progress.label), 1)) : createCommentVNode("", true)
|
|
340
|
+
]),
|
|
341
|
+
key: "1"
|
|
342
|
+
} : void 0,
|
|
343
|
+
action || notice.report ? {
|
|
150
344
|
name: "actions",
|
|
151
345
|
fn: withCtx(() => [
|
|
152
|
-
|
|
346
|
+
action ? (openBlock(), createBlock(unref(NoticeNodeView), {
|
|
153
347
|
key: 0,
|
|
154
|
-
node:
|
|
348
|
+
node: action
|
|
155
349
|
}, null, 8, ["node"])) : createCommentVNode("", true),
|
|
156
|
-
notice.report ? (openBlock(), createBlock(_sfc_main$
|
|
350
|
+
notice.report ? (openBlock(), createBlock(_sfc_main$5, {
|
|
157
351
|
key: 1,
|
|
158
352
|
send: notice.report
|
|
159
353
|
}, null, 8, ["send"])) : createCommentVNode("", true)
|
|
160
354
|
]),
|
|
161
|
-
key: "
|
|
355
|
+
key: "2"
|
|
162
356
|
} : void 0
|
|
163
|
-
]), 1032, ["severity", "onDelete"]);
|
|
357
|
+
]), 1032, ["severity", "is-unread", "onDelete"]);
|
|
164
358
|
}), 128))
|
|
165
359
|
])
|
|
166
360
|
]))
|
|
167
361
|
]),
|
|
168
|
-
_ctx.$slots.footer ? (openBlock(), createElementBlock("div",
|
|
362
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_23, [
|
|
169
363
|
renderSlot(_ctx.$slots, "footer")
|
|
170
364
|
])) : createCommentVNode("", true)
|
|
171
365
|
], 16, _hoisted_1);
|
package/dist/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationCenterGroup.vue.js","sources":["../../../../src/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { FeedbackBus } from '../../../feedback';\nexport interface NotificationCenterGroupProps {\n /** Explicit bus to browse; omitted keeps the slot-only presentation contract. */\n readonly bus?: FeedbackBus;\n /** The header title. Default `\"Notifications\"`. Rich content → the `title` slot. */\n readonly title?: string;\n\n /** The badge / count rendered next to the title. Rich content → the `count` slot. */\n readonly count?: string | number;\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useLocale } from '../../../foundation/i18n';\nimport { useLocaleDefaults } from '../../../foundation/i18n';\nimport {\n computed,\n defineComponent,\n getCurrentInstance,\n shallowRef,\n useAttrs,\n useSlots,\n useTemplateRef,\n watch,\n type PropType,\n} from 'vue';\nimport type { NoticeNode, PublishedNotice } from '../../../feedback';\nimport NotificationItem from './NotificationItem.vue';\nimport ReportAction from '../../feedback/reportAction/ReportAction.vue';\nimport { Bell, X } from 'lucide-vue-next';\nimport { Icon } from '../../../foundation/icons';\nimport { cn, surfaceVariants } from '../../../foundation/styles';\nimport { renderableChildren } from '../../../foundation/primitives';\n\nconst locale = useLocale();\n\n/**\n * Renders a notification panel — title and count header, a scrolling item list, optional footer.\n * The default slot holds `NotificationItem` children.\n *\n * React's `headerActions` / `emptyState` / `footer` were `ReactNode` props with\n * no string form worth keeping; they are slots only. `title` / `count` keep\n * their prop form and gain same-named slots.\n */\ndefineOptions({ name: 'NotificationCenterGroup', inheritAttrs: false });\n\nconst componentProps = withDefaults(defineProps<NotificationCenterGroupProps>(), {});\nconst props = useLocaleDefaults(componentProps, 'NotificationCenterGroup', { title: 'Notifications' });\nconst emit = defineEmits<{\n /** Requests closing the containing panel; never deletes or clears retained notifications. */\n close: [];\n}>();\nconst instance = getCurrentInstance();\nconst hasClose = () => Boolean(instance?.vnode.props?.onClose);\n\ndefineSlots<{\n /** The `NotificationItem` children filling the scrolling list. */\n default?(): unknown;\n /** The header title. Falls back to the `title` prop. */\n title?(): unknown;\n /** The header badge. Falls back to the `count` prop. */\n count?(): unknown;\n /** The controls at the right of the header. */\n headerActions?(): unknown;\n /** Replaces the built-in \"all caught up\" placeholder shown with no items. */\n emptyState?(): unknown;\n /** The footer band under the list. Omitting it drops the band. */\n footer?(): unknown;\n}>();\n\nconst attrs = useAttrs();\nconst slots = useSlots();\nconst el = useTemplateRef<HTMLDivElement>('el');\n\n/**\n * Replaces React's `Children.toArray(children).filter(isValidElement)`. Called\n * per render rather than cached — a slot's content is only knowable at render\n * time, and `renderableChildren` drops the comment/whitespace vnodes that would\n * otherwise read as content.\n */\nconst notices = shallowRef<ReadonlyArray<PublishedNotice>>([]);\nwatch(\n () => props.bus,\n (bus, _previous, onCleanup) => {\n notices.value = bus?.retained() ?? [];\n if (bus && typeof document !== 'undefined')\n onCleanup(\n bus.subscribeRetained((snapshot) => {\n notices.value = snapshot;\n }),\n );\n },\n { immediate: true },\n);\nconst isEmpty = () => (slots.default ? renderableChildren(slots.default()).length === 0 : notices.value.length === 0);\nconst resolvedCount = computed(() => props.count ?? (props.bus ? notices.value.length : undefined));\n\nconst NoticeNodeView = defineComponent({\n name: 'NoticeNodeView',\n props: { node: { type: [String, Object] as PropType<NoticeNode>, required: true } },\n setup: (nodeProps) => () => nodeProps.node,\n});\n\nconst classes = computed(() =>\n cn('flex w-80 flex-col', surfaceVariants({ variant: 'surface', radius: 'md' }), attrs.class as string | undefined),\n);\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</script>\n\n<template>\n <div\n ref=\"el\"\n role=\"region\"\n :aria-label=\"locale.t('NotificationCenterGroup.notifications', undefined, 'Notifications')\"\n v-bind=\"rest\"\n :class=\"classes\"\n >\n <header class=\"flex items-center justify-between gap-2 border-b border-border px-3 py-2.5\">\n <div class=\"flex items-center gap-2\">\n <span class=\"text-sm font-semibold\">\n <slot name=\"title\">{{ props.title }}</slot>\n </span>\n <span\n v-if=\"resolvedCount != null || $slots.count\"\n class=\"inline-flex items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold leading-5 text-primary-foreground\"\n >\n <slot name=\"count\">{{ resolvedCount }}</slot>\n </span>\n </div>\n <div v-if=\"$slots.headerActions || hasClose()\" class=\"flex items-center gap-2\">\n <slot name=\"headerActions\" />\n <button\n v-if=\"hasClose()\"\n type=\"button\"\n :aria-label=\"locale.t('NotificationCenterGroup.closeNotifications', undefined, 'Close notifications')\"\n class=\"inline-flex h-6 w-6 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\"\n @click=\"emit('close')\"\n >\n <Icon :icon=\"X\" :size=\"14\" />\n </button>\n </div>\n </header>\n <div class=\"max-h-96 overflow-y-auto py-1\">\n <template v-if=\"isEmpty()\">\n <slot name=\"emptyState\">\n <div class=\"flex flex-col items-center gap-2 px-4 py-10 text-center text-muted-foreground\">\n <Bell class=\"h-6 w-6\" />\n <p class=\"text-sm\">\n {{ locale.t('NotificationCenterGroup.youreAllCaughtUp', undefined, \"You're all caught up.\") }}\n </p>\n </div>\n </slot>\n </template>\n <div v-else class=\"flex flex-col\">\n <slot>\n <NotificationItem\n v-for=\"notice in notices\"\n :key=\"notice.id\"\n :severity=\"notice.tone\"\n @delete=\"props.bus?.remove(notice.id)\"\n >\n <template #title><NoticeNodeView :node=\"notice.title\" /></template>\n <template v-if=\"notice.description\" #description><NoticeNodeView :node=\"notice.description\" /></template>\n <template v-if=\"notice.action || notice.report\" #actions>\n <NoticeNodeView v-if=\"notice.action\" :node=\"notice.action\" />\n <ReportAction v-if=\"notice.report\" :send=\"notice.report\" />\n </template>\n </NotificationItem>\n </slot>\n </div>\n </div>\n <div v-if=\"$slots.footer\" class=\"border-t border-border px-3 py-2 text-center text-xs\">\n <slot name=\"footer\" />\n </div>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_createElementVNode","_renderSlot","_createTextVNode","_toDisplayString","$slots","_createVNode","Icon","_Fragment","_renderList","_createBlock","NotificationItem","ReportAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,UAAM,SAAS,UAAA;AAYf,UAAM,iBAAiB;AACvB,UAAM,QAAQ,kBAAkB,gBAAgB,2BAA2B,EAAE,OAAO,iBAAiB;AACrG,UAAM,OAAO;AAIb,UAAM,WAAW,mBAAA;AACjB,UAAM,WAAW,MAAM,QAAQ,UAAU,MAAM,OAAO,OAAO;AAiB7D,UAAM,QAAQ,SAAA;AACd,UAAM,QAAQ,SAAA;AACd,UAAM,KAAK,eAA+B,IAAI;AAQ9C,UAAM,UAAU,WAA2C,EAAE;AAC7D;AAAA,MACE,MAAM,MAAM;AAAA,MACZ,CAAC,KAAK,WAAW,cAAc;AAC7B,gBAAQ,QAAQ,KAAK,SAAA,KAAc,CAAA;AACnC,YAAI,OAAO,OAAO,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;AAAA,sBAA7CM,YAA6CN,MAAA,cAAA,GAAA;AAAA,wBAA5B,MAAM,OAAO;AAAA,sBAAA;;;;kBAC/D,OAAO,UAAU,OAAO;0BAAS;AAAA,gCAC/C,MAA6D;AAAA,sBAAvC,OAAO,uBAA7BU,YAA6DV,MAAA,cAAA,GAAA;AAAA;wBAAvB,MAAM,OAAO;AAAA,sBAAA;sBAC/B,OAAO,uBAA3BU,YAA2DE,aAAA;AAAA;wBAAvB,MAAM,OAAO;AAAA,sBAAA;;;;;;;;;QAMhDP,KAAAA,OAAO,UAAlBR,aAAAC,mBAEM,OAFN,aAEM;AAAA,UADJI,WAAsB,KAAA,QAAA,QAAA;AAAA,QAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"NotificationCenterGroup.vue.js","sources":["../../../../src/presentation/display/notificationCenterGroup/NotificationCenterGroup.vue"],"sourcesContent":["<script lang=\"ts\">\nimport {\n computed,\n defineComponent,\n nextTick,\n onBeforeUpdate,\n onUpdated,\n shallowRef,\n useAttrs,\n useId,\n useSlots,\n useTemplateRef,\n watch,\n type PropType,\n} from 'vue';\n\nimport type { FeedbackBus, NoticeNode, NoticeProgress, PublishedNotice, ToastPauseUntil } from '../../../feedback';\n\n/** Defines props for the notification center panel. */\nexport interface NotificationCenterGroupProps {\n /** Explicit bus to browse; omitted keeps the slot-only presentation contract. */\n readonly bus?: FeedbackBus;\n\n /** The header title. Default `\"Notifications\"`. Rich content → the `title` slot. */\n readonly title?: string;\n\n /** The badge / count rendered next to the title. Rich content → the `count` slot. */\n readonly count?: string | number;\n\n /** Shows pause and resume controls for the supplied bus. */\n readonly canPause?: boolean;\n\n /** Shows the \"Clear all\" header action for the supplied bus. Default `true`. */\n readonly canClear?: boolean;\n\n /** Fires when the close button is activated; the button renders only when this is supplied. Never clears. */\n readonly onClose?: () => void;\n}\n\n/** @internal The progress a history row's bar renders — `max` repaired, `value` clamped. */\ninterface NoticeBarProgress {\n value?: number;\n max: number;\n label?: string;\n}\n\n/** @internal The classes shared by the header's icon buttons. */\nconst HeaderActionClasses = [\n 'inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted',\n 'hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring',\n 'pointer-coarse:size-11',\n];\n\n/** @internal The classes of the title's count badge. */\nconst CountBadgeClasses = [\n 'inline-flex items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold leading-5',\n 'text-primary-foreground',\n];\n\n/** @internal The classes of the pop-up pause select. */\nconst PauseSelectClasses = [\n 'min-w-0 max-w-full rounded-md border border-border bg-background px-2 py-1',\n 'focus-visible:outline-2 focus-visible:outline-ring pointer-coarse:min-h-11',\n];\n\n/** @internal Renders a `NoticeNode` — either a plain string or a caller-built VNode. */\nconst NoticeNodeView = defineComponent({\n name: 'NoticeNodeView',\n props: { node: { type: [String, Object] as PropType<NoticeNode>, required: true } },\n setup: (nodeProps) => () => nodeProps.node,\n});\n</script>\n\n<script setup lang=\"ts\">\nimport { Bell, CheckCheck, ListX, X } from 'lucide-vue-next';\n\nimport { useLocale, useLocaleDefaults } from '../../../foundation/i18n';\nimport { Icon } from '../../../foundation/icons';\nimport { renderableChildren } from '../../../foundation/primitives';\nimport { cn, surfaceVariants } from '../../../foundation/styles';\nimport ProgressBar from '../../feedback/progressBar/ProgressBar.vue';\nimport ReportAction from '../../feedback/reportAction/ReportAction.vue';\nimport RelativeTime from '../relativeTime/RelativeTime.vue';\nimport NotificationCenterGroupItem from './NotificationCenterGroupItem.vue';\n\n/** Renders a notification panel — title and count header, a scrolling item list, optional footer. */\ndefineOptions({ name: 'NotificationCenterGroup', inheritAttrs: false });\n\nconst componentProps = withDefaults(defineProps<NotificationCenterGroupProps>(), { canClear: true });\nconst props = useLocaleDefaults(componentProps, 'NotificationCenterGroup', { title: 'Notifications' });\n\ndefineSlots<{\n /** The `NotificationCenterGroupItem` children filling the scrolling list. */\n default?(): unknown;\n /** The header title. Falls back to the `title` prop. */\n title?(): unknown;\n /** The header badge. Falls back to the `count` prop. */\n count?(): unknown;\n /** The controls at the right of the header. */\n headerActions?(): unknown;\n /** Replaces the built-in \"all caught up\" placeholder shown with no items. */\n emptyState?(): unknown;\n /** The footer band under the list. Omitting it drops the band. */\n footer?(): unknown;\n}>();\n\nconst locale = useLocale();\nconst attrs = useAttrs();\nconst slots = useSlots();\nconst el = useTemplateRef<HTMLDivElement>('el');\nconst pauseLabelId = useId();\nconst rowId = useId();\n\nconst pausedUntil = shallowRef<ToastPauseUntil>(null);\nconst unreadIds = shallowRef<ReadonlySet<string>>(new Set());\n/** The retained notices of the bus, newest first. */\nconst notices = shallowRef<ReadonlyArray<PublishedNotice>>([]);\nconst now = shallowRef(Date.now());\nlet focusedRow: HTMLElement | undefined;\n\nconst resolvedCount = computed(() => props.count ?? (props.bus ? notices.value.length : undefined));\nconst canMarkRead = computed(() => Boolean(props.bus) && unreadIds.value.size > 0);\nconst canClearAll = computed(() => Boolean(props.bus) && props.canClear && notices.value.length > 0);\n\nconst pauseChoice = computed(() => (typeof pausedUntil.value === 'number' ? 'timed' : (pausedUntil.value ?? 'on')));\nconst resumeTime = computed(() => {\n if (typeof pausedUntil.value !== 'number') return '';\n return new Intl.DateTimeFormat(locale.locale.value, { hour: 'numeric', minute: '2-digit' }).format(pausedUntil.value);\n});\n\nconst rows = computed(() =>\n notices.value.map((notice) => ({\n notice,\n isUnread: unreadIds.value.has(notice.id),\n progress: notice.progress ? barProgress(notice.progress) : undefined,\n action:\n notice.expiresAtMs === undefined || !Number.isFinite(notice.expiresAtMs) || notice.expiresAtMs > now.value\n ? (notice.historyAction ?? notice.action)\n : undefined,\n })),\n);\n\nconst markAllReadLabel = computed(() => locale.t('NotificationCenterGroup.markAllRead', undefined, 'Mark all read'));\nconst clearAllLabel = computed(() => locale.t('NotificationCenterGroup.clearAll', undefined, 'Clear all'));\n\nconst classes = computed(() =>\n cn('flex w-80 flex-col', surfaceVariants({ variant: 'surface', radius: 'md' }), attrs.class as string | undefined),\n);\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\n/** Syncs the bus's retained notices, pause and unread ids into the panel. */\nwatch(\n () => props.bus,\n (bus, _previous, onCleanup) => {\n notices.value = bus?.retained() ?? [];\n const initial = bus?.notificationState();\n pausedUntil.value = initial?.pausedUntil ?? null;\n unreadIds.value = new Set(initial?.unreadIds);\n if (!bus || typeof document === 'undefined') return;\n const stopHistory = bus.subscribeRetained((snapshot) => {\n notices.value = snapshot;\n });\n const stopState = bus.subscribeNotificationState((state) => {\n pausedUntil.value = state.pausedUntil;\n unreadIds.value = new Set(state.unreadIds);\n });\n onCleanup(() => {\n stopHistory();\n stopState();\n });\n },\n { immediate: true },\n);\n\n/** Syncs the clock to the next retained deadline, so an expired action leaves its row on time. */\nwatch(\n notices,\n (entries, _previous, onCleanup) => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n function updateDeadlines(): void {\n now.value = Date.now();\n if (typeof window === 'undefined') return;\n let next = Infinity;\n for (const entry of entries) {\n const deadline = entry.expiresAtMs;\n if (deadline !== undefined && deadline > now.value) next = Math.min(next, deadline);\n }\n if (Number.isFinite(next)) timer = setTimeout(updateDeadlines, Math.min(next - now.value, 2_147_483_647));\n }\n updateDeadlines();\n onCleanup(() => clearTimeout(timer));\n },\n { immediate: true },\n);\n\nonBeforeUpdate(() => {\n const active = document.activeElement;\n if (active && el.value?.contains(active))\n focusedRow = active.closest<HTMLElement>('[data-notification-history-row]') ?? undefined;\n});\n\nonUpdated(() => {\n if (focusedRow && document.activeElement === document.body) {\n (focusedRow.isConnected ? focusedRow : el.value)?.focus({ preventScroll: true });\n }\n focusedRow = undefined;\n});\n\n/** Names a running row's progress bar after its title. */\nfunction titleId(index: number): string {\n return `${rowId}-title-${index}`;\n}\n\n/** Reports whether the panel has nothing to show — no renderable default slot, else no retained notices. */\nfunction isEmpty(): boolean {\n return slots.default ? renderableChildren(slots.default()).length === 0 : notices.value.length === 0;\n}\n\n/** Applies the pop-up pause the select chose, then restores the select to the state in effect. */\nfunction changePause(event: Event): void {\n const select = event.currentTarget as HTMLSelectElement;\n const choice = select.value;\n if (choice === '15m') props.bus?.setToastPause(Date.now() + 15 * 60_000);\n else if (choice === '1h') props.bus?.setToastPause(Date.now() + 60 * 60_000);\n else if (choice === 'manual') props.bus?.setToastPause('manual');\n else if (choice === 'on') props.bus?.setToastPause(null);\n // A timed selection inserts a new option that shows the actual resume time.\n void nextTick(() => {\n select.value = pauseChoice.value;\n });\n}\n\n/** Normalizes a running notice's progress for the bar: `max` defaults to 1, a bad `max` or `value` is repaired. */\nfunction barProgress(progress: NoticeProgress): NoticeBarProgress {\n const max = progress.max !== undefined && Number.isFinite(progress.max) && progress.max > 0 ? progress.max : 1;\n const value =\n typeof progress.value === 'number' && Number.isFinite(progress.value)\n ? Math.min(Math.max(progress.value, 0), max)\n : undefined;\n return { value, max, label: progress.label };\n}\n\n/** Runs a header action whose button leaves the header afterwards, keeping keyboard focus inside the panel. */\nfunction runHeaderAction(event: Event, action: () => void): void {\n const hadFocus = document.activeElement === event.currentTarget;\n action();\n if (!hadFocus) return;\n void nextTick(() => {\n if (!el.value?.contains(document.activeElement)) el.value?.focus({ preventScroll: true });\n });\n}\n</script>\n\n<template>\n <div\n ref=\"el\"\n role=\"region\"\n tabindex=\"-1\"\n :aria-label=\"locale.t('NotificationCenterGroup.notifications', undefined, 'Notifications')\"\n v-bind=\"rest\"\n :class=\"classes\"\n >\n <header class=\"flex items-center justify-between gap-2 border-b border-border px-3 py-2.5\">\n <div class=\"flex min-w-0 items-center gap-2\">\n <span class=\"truncate text-sm font-semibold\">\n <slot name=\"title\">{{ props.title }}</slot>\n </span>\n <span v-if=\"resolvedCount != null || $slots.count\" :class=\"CountBadgeClasses\">\n <slot name=\"count\">{{ resolvedCount }}</slot>\n </span>\n </div>\n <div\n v-if=\"$slots.headerActions || canMarkRead || canClearAll || props.onClose\"\n class=\"flex shrink-0 items-center gap-1\"\n >\n <slot name=\"headerActions\" />\n <button\n v-if=\"canMarkRead\"\n type=\"button\"\n :aria-label=\"markAllReadLabel\"\n :title=\"markAllReadLabel\"\n :class=\"HeaderActionClasses\"\n @click=\"runHeaderAction($event, () => props.bus?.markNotificationsRead())\"\n >\n <Icon :icon=\"CheckCheck\" :size=\"14\" />\n </button>\n <button\n v-if=\"canClearAll\"\n type=\"button\"\n :aria-label=\"clearAllLabel\"\n :title=\"clearAllLabel\"\n :class=\"HeaderActionClasses\"\n @click=\"runHeaderAction($event, () => props.bus?.clearRetained())\"\n >\n <Icon :icon=\"ListX\" :size=\"14\" />\n </button>\n <button\n v-if=\"props.onClose\"\n type=\"button\"\n :aria-label=\"locale.t('NotificationCenterGroup.closeNotifications', undefined, 'Close notifications')\"\n :class=\"HeaderActionClasses\"\n @click=\"props.onClose()\"\n >\n <Icon :icon=\"X\" :size=\"14\" />\n </button>\n </div>\n </header>\n <div\n v-if=\"props.canPause && props.bus\"\n class=\"flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-2 text-sm\"\n >\n <label :for=\"pauseLabelId\">{{ locale.t('NotificationCenterGroup.popups', undefined, 'Toast pop-ups') }}</label>\n <select :id=\"pauseLabelId\" :value=\"pauseChoice\" :class=\"PauseSelectClasses\" @change=\"changePause\">\n <option value=\"on\">{{ locale.t('NotificationCenterGroup.popupsOn', undefined, 'On') }}</option>\n <option v-if=\"pauseChoice === 'timed'\" value=\"timed\" disabled>\n {{ locale.t('NotificationCenterGroup.pausedUntil', { time: resumeTime }, 'Paused until {time}') }}\n </option>\n <option value=\"15m\">\n {{ locale.t('NotificationCenterGroup.pause15', undefined, 'Pause for 15 minutes') }}\n </option>\n <option value=\"1h\">{{ locale.t('NotificationCenterGroup.pause60', undefined, 'Pause for 1 hour') }}</option>\n <option value=\"manual\">\n {{ locale.t('NotificationCenterGroup.pauseManual', undefined, 'Off until resumed') }}\n </option>\n </select>\n </div>\n <div class=\"max-h-96 overflow-y-auto py-1\">\n <template v-if=\"isEmpty()\">\n <slot name=\"emptyState\">\n <div class=\"flex flex-col items-center gap-2 px-4 py-10 text-center text-muted-foreground\">\n <Bell class=\"h-6 w-6\" />\n <p class=\"text-sm\">\n {{ locale.t('NotificationCenterGroup.youreAllCaughtUp', undefined, \"You're all caught up.\") }}\n </p>\n </div>\n </slot>\n </template>\n <div v-else class=\"flex flex-col\">\n <slot>\n <NotificationCenterGroupItem\n v-for=\"({ notice, action, isUnread, progress }, index) in rows\"\n :key=\"notice.id\"\n :severity=\"notice.tone\"\n :is-unread=\"isUnread\"\n data-notification-history-row\n tabindex=\"-1\"\n @delete=\"props.bus?.remove(notice.id)\"\n >\n <template #title>\n <span :id=\"progress ? titleId(index) : undefined\"><NoticeNodeView :node=\"notice.title\" /></span>\n </template>\n <template #timestamp><RelativeTime is-live :value=\"notice.publishedAtMs\" /></template>\n <template v-if=\"notice.description\" #description><NoticeNodeView :node=\"notice.description\" /></template>\n <template v-if=\"progress\" #progress>\n <ProgressBar size=\"sm\" :value=\"progress.value\" :max=\"progress.max\" :aria-labelledby=\"titleId(index)\" />\n <p v-if=\"progress.label\" class=\"mt-1 text-xs text-muted-foreground\">{{ progress.label }}</p>\n </template>\n <template v-if=\"action || notice.report\" #actions>\n <NoticeNodeView v-if=\"action\" :node=\"action\" />\n <ReportAction v-if=\"notice.report\" :send=\"notice.report\" />\n </template>\n </NotificationCenterGroupItem>\n </slot>\n </div>\n </div>\n <div v-if=\"$slots.footer\" class=\"border-t border-border px-3 py-2 text-center text-xs\">\n <slot name=\"footer\" />\n </div>\n </div>\n</template>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_unref","_createElementVNode","_renderSlot","_createTextVNode","_toDisplayString","$slots","_createVNode","Icon","_Fragment","_renderList","_createBlock","NotificationCenterGroupItem","RelativeTime","ProgressBar","ReportAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAM,sBA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AAA,GAAAC,mBAA4F,KAA5F,aAA4FM,gBAArB,SAAS,KAAK,GAAA,CAAA;;;;kBAEvE,UAAU,OAAO;0BAAS;AAAA,gCACxC,MAA+C;AAAA,sBAAzB,uBAAtBM,YAA+CV,MAAA,cAAA,GAAA;AAAA;wBAAhB,MAAM;AAAA,sBAAA;sBACjB,OAAO,uBAA3BU,YAA2DI,aAAA;AAAA;wBAAvB,MAAM,OAAO;AAAA,sBAAA;;;;;;;;;QAMhDT,KAAAA,OAAO,UAAlBR,aAAAC,mBAEM,OAFN,aAEM;AAAA,UADJI,WAAsB,KAAA,QAAA,QAAA;AAAA,QAAA;;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Severity } from '../../../foundation/styles';
|
|
2
|
-
|
|
2
|
+
/** Defines props for one notification row of the notification center. */
|
|
3
|
+
export interface NotificationCenterGroupItemProps {
|
|
3
4
|
/** The semantic severity; supplies a leading glyph when no icon is provided. */
|
|
4
5
|
readonly severity?: Severity;
|
|
5
6
|
/** The leading icon / avatar. Rich content → the `icon` slot. */
|
|
@@ -10,22 +11,20 @@ export interface NotificationItemProps {
|
|
|
10
11
|
readonly description?: string;
|
|
11
12
|
/** The timestamp / relative time label. Rich content → the `timestamp` slot. */
|
|
12
13
|
readonly timestamp?: string;
|
|
13
|
-
/** The unread flag
|
|
14
|
+
/** The unread flag: bold title, a leading dot and visually hidden "Unread" text. */
|
|
14
15
|
readonly isUnread?: boolean;
|
|
15
16
|
/** The trailing actions. Rich content → the `actions` slot. */
|
|
16
17
|
readonly actions?: string;
|
|
18
|
+
/** Fires when the row is activated by click, Enter or Space; supplying it makes the row interactive. */
|
|
19
|
+
readonly onSelect?: () => void;
|
|
20
|
+
/** Fires when the dismiss button is pressed; the button renders on hover only when this is supplied. */
|
|
21
|
+
readonly onDismiss?: () => void;
|
|
22
|
+
/** Fires when the delete button is pressed; the button renders only when this is supplied. */
|
|
23
|
+
readonly onDelete?: () => void;
|
|
17
24
|
}
|
|
18
|
-
declare const _default: __VLS_WithSlots<import('vue').DefineComponent<
|
|
25
|
+
declare const _default: __VLS_WithSlots<import('vue').DefineComponent<NotificationCenterGroupItemProps, {
|
|
19
26
|
el: Readonly<import('vue').ShallowRef<HTMLDivElement | null>>;
|
|
20
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
21
|
-
select: () => any;
|
|
22
|
-
delete: () => any;
|
|
23
|
-
dismiss: () => any;
|
|
24
|
-
}, string, import('vue').PublicProps, Readonly<NotificationItemProps> & Readonly<{
|
|
25
|
-
onSelect?: (() => any) | undefined;
|
|
26
|
-
onDelete?: (() => any) | undefined;
|
|
27
|
-
onDismiss?: (() => any) | undefined;
|
|
28
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
27
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NotificationCenterGroupItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
29
28
|
/** The leading icon. Falls back to the `icon` prop. */
|
|
30
29
|
icon?(): unknown;
|
|
31
30
|
/** The title line. Falls back to the `title` prop. */
|
|
@@ -34,6 +33,8 @@ declare const _default: __VLS_WithSlots<import('vue').DefineComponent<Notificati
|
|
|
34
33
|
timestamp?(): unknown;
|
|
35
34
|
/** The body text under the title. Falls back to the `description` prop. */
|
|
36
35
|
description?(): unknown;
|
|
36
|
+
/** The running-progress indicator under the description. Omitting it drops the band. */
|
|
37
|
+
progress?(): unknown;
|
|
37
38
|
/** The action row under the description. Falls back to the `actions` prop. */
|
|
38
39
|
actions?(): unknown;
|
|
39
40
|
}>;
|