@vokril/ui-solid 0.27.1 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +19 -1
- package/dist/{AttributeGrid-XTVaiwLe.js → AttributeGrid-CASILa4u.js} +3 -3
- package/dist/{AttributeGrid-Qzt5LYnu.cjs → AttributeGrid-eND8YDby.cjs} +1 -1
- package/dist/{Button-U95Tz8F5.cjs → Button-Bb68ymNP.cjs} +1 -1
- package/dist/{Button-qtxB2SYf.js → Button-D-T0tyGF.js} +1 -1
- package/dist/CommandPalette-5FQRgPG9.cjs +2 -0
- package/dist/CommandPalette-Cj618AOz.js +4017 -0
- package/dist/{CopyButton-CsM8UeX5.cjs → CopyButton-B5gS2ft3.cjs} +1 -1
- package/dist/{CopyButton-NfxWzVHT.js → CopyButton-g-WSiBDZ.js} +1 -1
- package/dist/{DateRangePicker-C8IVJRT2.js → DateRangePicker-CJD9ADgB.js} +3 -3
- package/dist/{DateRangePicker-BKHxyHL4.cjs → DateRangePicker-Frc0HVxp.cjs} +1 -1
- package/dist/{GuidedTour-B61cbsdy.cjs → GuidedTour-B6q7lYhn.cjs} +1 -1
- package/dist/{GuidedTour-Dj41FCdE.js → GuidedTour-CFCvRJN4.js} +3 -3
- package/dist/{IconPicker-BZCQG8SO.cjs → IconPicker-CIbJb1ei.cjs} +1 -1
- package/dist/{IconPicker-DC9E35Ou.js → IconPicker-DYqNi5ud.js} +3 -3
- package/dist/{Modal-CaurOG_K.cjs → Modal-CY6ePolt.cjs} +1 -1
- package/dist/{Modal-DJpQqqTJ.js → Modal-NzZzHSwb.js} +2 -2
- package/dist/{PageSkeleton-DICmahMs.cjs → PageSkeleton-BPbb28-H.cjs} +1 -1
- package/dist/{PageSkeleton-C0eVQO20.js → PageSkeleton-CLnJO6uD.js} +3 -3
- package/dist/{SearchableSelect-DayP1Qs6.js → SearchableSelect-BvCm4enQ.js} +2 -2
- package/dist/{SearchableSelect-ClrAX2hK.cjs → SearchableSelect-CVqdVMOC.cjs} +1 -1
- package/dist/StatusBarNotificationBell-CJ3HuhRu.cjs +50 -0
- package/dist/{StatusBarNotificationBell-BRnCKU72.js → StatusBarNotificationBell-yryWdwyX.js} +4324 -3998
- package/dist/{Stepper-DTuchuOX.cjs → Stepper-Ci5JpLbS.cjs} +1 -1
- package/dist/{Stepper-aiuAdbkl.js → Stepper-D9i1Xclm.js} +1 -1
- package/dist/{TimeSeriesChart-SHx_cp8y.js → TimeSeriesChart-DOwi2lJs.js} +1 -1
- package/dist/{TimeSeriesChart-CvU0lxar.cjs → TimeSeriesChart-huvheefm.cjs} +1 -1
- package/dist/{ToggleButton-BcHNAGPy.cjs → ToggleButton-BFWh1_o5.cjs} +1 -1
- package/dist/{ToggleButton-BhP17bvW.js → ToggleButton-CFM8P3JY.js} +4 -4
- package/dist/_internal/contract/browser/workspace.d.cts +4 -0
- package/dist/_internal/contract/browser/workspace.d.ts +4 -0
- package/dist/_internal/contract/notification.d.cts +63 -4
- package/dist/_internal/contract/notification.d.ts +63 -4
- package/dist/_internal/contract/notificationCatalog.d.cts +7 -1
- package/dist/_internal/contract/notificationCatalog.d.ts +7 -1
- package/dist/charts/index.cjs +1 -1
- package/dist/charts/index.js +1 -1
- package/dist/{createDialogShellFocus-Vv3hhW-I.js → createDialogShellFocus-B4piXDU4.js} +1 -1
- package/dist/{createDialogShellFocus-CsrZ2GDZ.cjs → createDialogShellFocus-CJaw9-B9.cjs} +1 -1
- package/dist/{createResizableSidebar-DnHgvr7P.js → createResizableSidebar-BDUlX9-G.js} +3 -3
- package/dist/{createResizableSidebar-CeksJQ9Q.cjs → createResizableSidebar-BVJBU2kP.cjs} +1 -1
- package/dist/de-BqFZ0Ac8.cjs +1 -0
- package/dist/{server/de-CEltsqV5.js → de-q3NXnC0J.js} +27 -25
- package/dist/desktop/index.cjs +1 -1
- package/dist/desktop/index.js +1 -1
- package/dist/feedback/index.cjs +1 -1
- package/dist/feedback/index.js +2 -2
- package/dist/forms/index.cjs +1 -1
- package/dist/forms/index.js +7 -7
- package/dist/grid/index.cjs +1 -1
- package/dist/grid/index.js +1 -1
- package/dist/host/index.cjs +1 -1
- package/dist/host/index.js +1 -1
- package/dist/i18n/index.cjs +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/messageKeys.d.cts +1 -1
- package/dist/i18n/messageKeys.d.ts +1 -1
- package/dist/{i18n-DW9kcu0G.js → i18n-CBlUGOyu.js} +2 -2
- package/dist/{server/i18n-DZ0JlZal.cjs → i18n-D3s-a2a0.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +199 -196
- package/dist/layout/index.cjs +1 -1
- package/dist/layout/index.js +2 -2
- package/dist/navigation/index.cjs +1 -1
- package/dist/navigation/index.js +1 -1
- package/dist/notifications/NotificationItem.d.cts +15 -1
- package/dist/notifications/NotificationItem.d.ts +15 -1
- package/dist/notifications/RunningProgressCards.d.cts +20 -0
- package/dist/notifications/RunningProgressCards.d.ts +20 -0
- package/dist/notifications/StatusBarNotificationBell.d.cts +17 -5
- package/dist/notifications/StatusBarNotificationBell.d.ts +17 -5
- package/dist/notifications/createNotificationPreviewRuntime.d.cts +2 -2
- package/dist/notifications/createNotificationPreviewRuntime.d.ts +2 -2
- package/dist/notifications/dismissableToastIds.d.cts +4 -1
- package/dist/notifications/dismissableToastIds.d.ts +4 -1
- package/dist/notifications/fireNotification.d.cts +33 -1
- package/dist/notifications/fireNotification.d.ts +33 -1
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.d.cts +1 -1
- package/dist/notifications/index.d.ts +1 -1
- package/dist/notifications/index.js +43 -40
- package/dist/notifications/nativeEngine.d.cts +88 -5
- package/dist/notifications/nativeEngine.d.ts +88 -5
- package/dist/notifications/notificationCardServices.d.cts +4 -1
- package/dist/notifications/notificationCardServices.d.ts +4 -1
- package/dist/notifications/notificationCommands.d.cts +16 -4
- package/dist/notifications/notificationCommands.d.ts +16 -4
- package/dist/notifications/notificationOverlaySnapshot.d.cts +1 -0
- package/dist/notifications/notificationOverlaySnapshot.d.ts +1 -0
- package/dist/notifications/notificationService.d.cts +26 -0
- package/dist/notifications/notificationService.d.ts +26 -0
- package/dist/notifications/quietHours.d.cts +10 -0
- package/dist/notifications/quietHours.d.ts +10 -0
- package/dist/notifications/toast.d.cts +32 -1
- package/dist/notifications/toast.d.ts +32 -1
- package/dist/overlay/ConfirmDialog.d.cts +68 -2
- package/dist/overlay/ConfirmDialog.d.ts +68 -2
- package/dist/overlay/index.cjs +1 -1
- package/dist/overlay/index.js +4 -4
- package/dist/{rowSource-C43bEUD4.js → rowSource-D__7o4h0.js} +1 -1
- package/dist/{rowSource-Dg-jndEu.cjs → rowSource-DiwTu_r8.cjs} +1 -1
- package/dist/server/{AttributeGrid-C_CvCXpC.cjs → AttributeGrid-B7sb3btp.cjs} +1 -1
- package/dist/server/{AttributeGrid-D8QYVZDq.js → AttributeGrid-CMi-UtWb.js} +3 -3
- package/dist/server/{Button-VKl-_GaO.cjs → Button-0AXWRw9Q.cjs} +1 -1
- package/dist/server/{Button-BPNNFcHc.js → Button-3yNrnn4P.js} +1 -1
- package/dist/server/{CommandPalette-COVjWlx9.js → CommandPalette-CozogFlk.js} +980 -947
- package/dist/server/CommandPalette-DQK6N98N.cjs +1 -0
- package/dist/server/{CopyButton-HDffWzaN.js → CopyButton-B6xd9Z6j.js} +1 -1
- package/dist/server/{CopyButton-rWDnbTBF.cjs → CopyButton-D8IN6Vnd.cjs} +1 -1
- package/dist/server/{DateRangePicker-Dl3zr-PD.js → DateRangePicker-C35q8BTw.js} +2 -2
- package/dist/server/{DateRangePicker-Dq0HGz27.cjs → DateRangePicker-KLZzyuPJ.cjs} +1 -1
- package/dist/server/{GuidedTour-BoPGRyX5.cjs → GuidedTour-DfV0yzqh.cjs} +1 -1
- package/dist/server/{GuidedTour-CIlHyRcR.js → GuidedTour-DmLbBttx.js} +3 -3
- package/dist/server/{IconPicker-BDS92veL.cjs → IconPicker-B1soopAp.cjs} +1 -1
- package/dist/server/{IconPicker-CZxYKJOT.js → IconPicker-B4aXspLw.js} +4 -4
- package/dist/server/{Modal-j54-C2Md.js → Modal-BheFQLs1.js} +2 -2
- package/dist/server/{Modal-CtJFoR96.cjs → Modal-BswxV8Pn.cjs} +1 -1
- package/dist/server/{PageSkeleton-B0V43uDV.cjs → PageSkeleton-DBo7hQq-.cjs} +1 -1
- package/dist/server/{PageSkeleton-BfGfda9G.js → PageSkeleton-DoxlE_bD.js} +3 -3
- package/dist/server/{SearchableSelect-ClQzcYdL.cjs → SearchableSelect-09ECcDlB.cjs} +1 -1
- package/dist/server/{SearchableSelect-DtcMC7Xu.js → SearchableSelect-vjhS4c-H.js} +2 -2
- package/dist/server/{StatusBarNotificationBell-FFpOkyUk.js → StatusBarNotificationBell-DdAdsduo.js} +4340 -4011
- package/dist/server/StatusBarNotificationBell-Z2LmIkM1.cjs +49 -0
- package/dist/server/{Stepper-CCEItuZb.cjs → Stepper-DxNrskdq.cjs} +1 -1
- package/dist/server/{Stepper-B7wf8h9G.js → Stepper-n5f9r-ye.js} +1 -1
- package/dist/server/{TimeSeriesChart-TsaZS7YU.cjs → TimeSeriesChart-BQVXUFoj.cjs} +1 -1
- package/dist/server/{TimeSeriesChart-DjNQiCn_.js → TimeSeriesChart-PAb95s6x.js} +1 -1
- package/dist/server/{ToggleButton-CHaIvApv.js → ToggleButton-FywO2CCI.js} +3 -3
- package/dist/server/{ToggleButton-D6Tux9wG.cjs → ToggleButton-TE3Xf2yD.cjs} +1 -1
- package/dist/server/charts/index.cjs +1 -1
- package/dist/server/charts/index.js +1 -1
- package/dist/server/{createResizableSidebar-Dn9UMUf_.js → createResizableSidebar-BImbKlLe.js} +3 -3
- package/dist/server/{createResizableSidebar-B0NDaq7D.cjs → createResizableSidebar-GFgZIj-5.cjs} +1 -1
- package/dist/server/de-BqFZ0Ac8.cjs +1 -0
- package/dist/{de-CEltsqV5.js → server/de-q3NXnC0J.js} +27 -25
- package/dist/server/desktop/index.cjs +1 -1
- package/dist/server/desktop/index.js +1 -1
- package/dist/server/feedback/index.cjs +1 -1
- package/dist/server/feedback/index.js +2 -2
- package/dist/server/forms/index.cjs +1 -1
- package/dist/server/forms/index.js +6 -6
- package/dist/server/grid/index.cjs +1 -1
- package/dist/server/grid/index.js +1 -1
- package/dist/server/host/index.cjs +1 -1
- package/dist/server/host/index.js +1 -1
- package/dist/server/i18n/index.cjs +1 -1
- package/dist/server/i18n/index.js +1 -1
- package/dist/server/{i18n-DW9kcu0G.js → i18n-CBlUGOyu.js} +2 -2
- package/dist/{i18n-DZ0JlZal.cjs → server/i18n-D3s-a2a0.cjs} +1 -1
- package/dist/server/{index-BfR3Xipt.cjs → index-2mQPVEDR.cjs} +1 -1
- package/dist/server/{index-Wv18Fcu8.js → index-UIjsx3oJ.js} +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +143 -140
- package/dist/server/layout/index.cjs +1 -1
- package/dist/server/layout/index.js +2 -2
- package/dist/server/navigation/index.cjs +1 -1
- package/dist/server/navigation/index.js +1 -1
- package/dist/server/notifications/index.cjs +1 -1
- package/dist/server/notifications/index.js +43 -40
- package/dist/server/overlay/index.cjs +1 -1
- package/dist/server/overlay/index.js +3 -3
- package/dist/server/{rowSource-CYYdnUFl.js → rowSource-D-wcDmFU.js} +1 -1
- package/dist/server/{rowSource-DoBeEg9N.cjs → rowSource-DltiY0o3.cjs} +1 -1
- package/dist/server/{tr-CxuAFkCi.js → tr-C_dUz00P.js} +32 -30
- package/dist/server/tr-D7bwe7tl.cjs +1 -0
- package/dist/server/tree/index.cjs +1 -1
- package/dist/server/tree/index.js +1 -1
- package/dist/solid/i18n/locales/de.json +2 -0
- package/dist/solid/i18n/locales/tr.json +2 -0
- package/dist/solid/notifications/NotificationHost.jsx +5 -4
- package/dist/solid/notifications/NotificationItem.jsx +40 -15
- package/dist/solid/notifications/NotificationPanel.jsx +8 -3
- package/dist/solid/notifications/NotificationsCenter.jsx +4 -1
- package/dist/solid/notifications/RunningProgressCards.jsx +29 -0
- package/dist/solid/notifications/StatusBarNotificationBell.jsx +44 -17
- package/dist/solid/notifications/StatusBarNotificationBell.module.css.js +1 -0
- package/dist/solid/notifications/catalogAdapter.js +2 -1
- package/dist/solid/notifications/createNotificationPreviewRuntime.js +49 -35
- package/dist/solid/notifications/fireNotification.js +53 -27
- package/dist/solid/notifications/index.js +1 -1
- package/dist/solid/notifications/nativeEngine.js +129 -26
- package/dist/solid/notifications/notificationCardServices.js +1 -1
- package/dist/solid/notifications/notificationOverlaySnapshot.js +2 -0
- package/dist/solid/notifications/notificationOverlaySync.js +1 -0
- package/dist/solid/notifications/notificationService.js +46 -0
- package/dist/solid/notifications/quietHours.js +18 -0
- package/dist/solid/notifications/toast.js +30 -11
- package/dist/solid/overlay/ConfirmDialog.jsx +57 -17
- package/dist/solid/overlay/ConfirmDialog.module.css.js +1 -0
- package/dist/style.css +1 -1
- package/dist/{tr-CxuAFkCi.js → tr-C_dUz00P.js} +32 -30
- package/dist/tr-D7bwe7tl.cjs +1 -0
- package/dist/tree/index.cjs +1 -1
- package/dist/tree/index.js +1 -1
- package/dist/ui.css +1 -1
- package/package.json +1 -1
- package/dist/CommandPalette-Bf8flX2t.cjs +0 -2
- package/dist/CommandPalette-CoIdCmZ0.js +0 -3977
- package/dist/StatusBarNotificationBell-B4v__j6s.cjs +0 -50
- package/dist/de-DRobPEJV.cjs +0 -1
- package/dist/server/CommandPalette-C_9Z8gVc.cjs +0 -1
- package/dist/server/StatusBarNotificationBell-D9oc6WVf.cjs +0 -49
- package/dist/server/de-DRobPEJV.cjs +0 -1
- package/dist/server/tr-BDbiY5YD.cjs +0 -1
- package/dist/tr-BDbiY5YD.cjs +0 -1
|
@@ -4,6 +4,7 @@ import { createDialogShellFocus } from '../overlay/createDialogShellFocus';
|
|
|
4
4
|
import { OverlayScrollArea } from '../overlay/OverlayScrollArea';
|
|
5
5
|
import { HostPortal } from '../_internal/app/windows/window/HostPortal';
|
|
6
6
|
import { useHostWindow } from '../_internal/app/windows/window/HostWindowContext';
|
|
7
|
+
import { isOnToastStack, isProgressRunning, } from './nativeEngine';
|
|
7
8
|
import { dismissableToastIds } from './dismissableToastIds';
|
|
8
9
|
import { notificationSettings } from '../_internal/app/settings/descriptors/notification';
|
|
9
10
|
import { useSettingsSubscription } from '../_internal/app/settings/useSettingsSubscription';
|
|
@@ -46,7 +47,7 @@ export const NotificationHost = (props) => {
|
|
|
46
47
|
const ackItems = () => store.items.filter((it) => it.priority === 'acknowledgment-required');
|
|
47
48
|
const visible = () => {
|
|
48
49
|
const cap = Math.max(1, maxVisible());
|
|
49
|
-
const items = store.items.filter(
|
|
50
|
+
const items = store.items.filter(isOnToastStack);
|
|
50
51
|
if (items.length <= cap)
|
|
51
52
|
return items;
|
|
52
53
|
return items.slice(items.length - cap);
|
|
@@ -90,15 +91,15 @@ export const NotificationHost = (props) => {
|
|
|
90
91
|
if (idx === null)
|
|
91
92
|
return;
|
|
92
93
|
const target = list[idx];
|
|
93
|
-
if (!target)
|
|
94
|
+
if (!target || isProgressRunning(target))
|
|
94
95
|
return;
|
|
95
|
-
stack.
|
|
96
|
+
stack.dismiss(target.id);
|
|
96
97
|
setFocusIndex(list.length <= 1 ? null : Math.min(idx, list.length - 2));
|
|
97
98
|
};
|
|
98
99
|
const hideToasts = () => {
|
|
99
100
|
if (visible().length === 0)
|
|
100
101
|
return;
|
|
101
|
-
dismissableToastIds(store.items).forEach((id) => stack.
|
|
102
|
+
dismissableToastIds(store.items).forEach((id) => stack.dismiss(id));
|
|
102
103
|
setFocusIndex(null);
|
|
103
104
|
};
|
|
104
105
|
const keybindings = useKeybindingsOptional();
|
|
@@ -11,6 +11,7 @@ import { VpInfo, VpWarning, VpError, VpPass, VpTreeClose, VpGear, VpTreePlug, Vp
|
|
|
11
11
|
import { t } from '../i18n/i18n';
|
|
12
12
|
import { formatDateTime } from '../_internal/platform/intl/format';
|
|
13
13
|
import { relativeAgeLabel } from '../_internal/platform/intl/relativeAgeLabel';
|
|
14
|
+
import { isProgressRunning, } from './nativeEngine';
|
|
14
15
|
import { renderNotificationMarkdown } from './markdownRender';
|
|
15
16
|
import { NOTIFICATION_SEVERITY_LABELS } from './notificationSeverityLabels';
|
|
16
17
|
import { getGoogleSearchUrl, } from '../_internal/platform/vendorErrors';
|
|
@@ -60,10 +61,11 @@ export const NotificationItem = (props) => {
|
|
|
60
61
|
if (exitTimer !== undefined)
|
|
61
62
|
clearTimeout(exitTimer);
|
|
62
63
|
});
|
|
64
|
+
const closable = createMemo(() => !isProgressRunning(props.item));
|
|
63
65
|
const close = () => {
|
|
64
66
|
if (isExiting())
|
|
65
67
|
return;
|
|
66
|
-
if (prefersReducedMotion(document)) {
|
|
68
|
+
if (!closable() || prefersReducedMotion(document)) {
|
|
67
69
|
props.controller.close(props.item.id);
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
@@ -93,6 +95,23 @@ export const NotificationItem = (props) => {
|
|
|
93
95
|
});
|
|
94
96
|
const [isHovered, setIsHovered] = createSignal(false);
|
|
95
97
|
const [isFocused, setIsFocused] = createSignal(false);
|
|
98
|
+
onCleanup(() => {
|
|
99
|
+
const hovered = isHovered();
|
|
100
|
+
const focused = isFocused();
|
|
101
|
+
if (!hovered && !focused)
|
|
102
|
+
return;
|
|
103
|
+
const item = props.item;
|
|
104
|
+
if (item === undefined)
|
|
105
|
+
return;
|
|
106
|
+
const { id } = item;
|
|
107
|
+
const controller = props.controller;
|
|
108
|
+
queueMicrotask(() => {
|
|
109
|
+
if (hovered)
|
|
110
|
+
controller.setHover(id, false);
|
|
111
|
+
if (focused)
|
|
112
|
+
controller.setFocus(id, false);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
96
115
|
const [runCounter, setRunCounter] = createSignal(0);
|
|
97
116
|
const isPaused = createMemo(() => isHovered() ||
|
|
98
117
|
isFocused() ||
|
|
@@ -117,6 +136,8 @@ export const NotificationItem = (props) => {
|
|
|
117
136
|
const announcement = () => props.item.announce ??
|
|
118
137
|
(props.item.severity === 'error' ? 'assertive' : 'polite');
|
|
119
138
|
createEffect(() => {
|
|
139
|
+
if (props.inCenter)
|
|
140
|
+
return;
|
|
120
141
|
const title = props.item.title;
|
|
121
142
|
const body = props.item.body;
|
|
122
143
|
const text = body ? `${title}: ${body}` : title;
|
|
@@ -219,8 +240,9 @@ export const NotificationItem = (props) => {
|
|
|
219
240
|
const gearTrigger = event.currentTarget;
|
|
220
241
|
const source = props.item.source;
|
|
221
242
|
const dontShowKey = props.item.neverShowAgainKey;
|
|
222
|
-
const
|
|
223
|
-
|
|
243
|
+
const remindKey = dontShowKey ??
|
|
244
|
+
props.item.remindKey ??
|
|
245
|
+
deriveImplicitRemindKey(source ?? 'general', props.item.title);
|
|
224
246
|
const items = [];
|
|
225
247
|
if (dontShowKey) {
|
|
226
248
|
items.push({
|
|
@@ -301,7 +323,7 @@ export const NotificationItem = (props) => {
|
|
|
301
323
|
close();
|
|
302
324
|
}
|
|
303
325
|
};
|
|
304
|
-
return (<div class={`${styles.item} card ${isExiting() ? styles.itemExiting : ''}`} id={`notification-card-${props.item.id}`} tabIndex={-1} data-severity={props.item.severity} data-expanded={props.item.expanded} data-has-actions={props.item.actions && props.item.actions.length > 0 ? 'true' : 'false'} data-has-timer={hasTimer() ? 'true' : 'false'} {...{ 'aria-live': announcement() }} aria-atomic=
|
|
326
|
+
return (<div class={`${styles.item} card ${isExiting() ? styles.itemExiting : ''}`} id={props.inCenter ? undefined : `notification-card-${props.item.id}`} tabIndex={-1} data-severity={props.item.severity} data-expanded={props.item.expanded} data-has-actions={props.item.actions && props.item.actions.length > 0 ? 'true' : 'false'} data-has-timer={hasTimer() ? 'true' : 'false'} {...(props.inCenter ? {} : { 'aria-live': announcement() })} aria-atomic={props.inCenter ? undefined : 'true'} aria-label={t('{severity}: {title}', {
|
|
305
327
|
severity: t(NOTIFICATION_SEVERITY_LABELS[props.item.severity]),
|
|
306
328
|
title: props.item.title,
|
|
307
329
|
})} onMouseEnter={() => {
|
|
@@ -348,17 +370,20 @@ export const NotificationItem = (props) => {
|
|
|
348
370
|
<VpGear class={iconScale.iconMd}/>
|
|
349
371
|
</Button>
|
|
350
372
|
</Show>
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
373
|
+
|
|
374
|
+
<Show when={closable()}>
|
|
375
|
+
<div class={styles.closeWrapper}>
|
|
376
|
+
<Button variant="ghost" size="sm" iconOnly class={`${styles.closeButton} close-btn`} data-testid="notification-close-btn" aria-label={t('Close')} title={t('Close')} onClick={close}>
|
|
377
|
+
<VpTreeClose class={iconScale.iconMd}/>
|
|
378
|
+
</Button>
|
|
379
|
+
<Show keyed when={fuseKey()}>
|
|
380
|
+
{(key) => (<svg class={styles.closeFuse} viewBox="0 0 100 100" aria-hidden="true" data-fuse-key={key} style={{ '--fuse-duration': `${duration()}ms` }}>
|
|
381
|
+
<path class={styles.fuseTrack} d="M 50 3 H 79 A 18 18 0 0 1 97 21 V 79 A 18 18 0 0 1 79 97 H 21 A 18 18 0 0 1 3 79 V 21 A 18 18 0 0 1 21 3 Z"/>
|
|
382
|
+
<path class={styles.fusePath} pathLength="100" stroke-dasharray="100 100" stroke-dashoffset="0" d="M 50 3 H 79 A 18 18 0 0 1 97 21 V 79 A 18 18 0 0 1 79 97 H 21 A 18 18 0 0 1 3 79 V 21 A 18 18 0 0 1 21 3 Z"/>
|
|
383
|
+
</svg>)}
|
|
384
|
+
</Show>
|
|
385
|
+
</div>
|
|
386
|
+
</Show>
|
|
362
387
|
</Panel.Toolbar>
|
|
363
388
|
</div>
|
|
364
389
|
|
|
@@ -18,6 +18,7 @@ import { isSourceMuted } from './notificationSuppressions';
|
|
|
18
18
|
import { openExternalUrl } from '../_internal/app/platform/electronBridge';
|
|
19
19
|
import { useKitHost } from '../host/kitHost';
|
|
20
20
|
import { realmNotificationShell } from './notificationCardServices';
|
|
21
|
+
import { RunningProgressCards, useRunningProgressCards, } from './RunningProgressCards';
|
|
21
22
|
import { notificationSettings } from '../_internal/app/settings/descriptors/notification';
|
|
22
23
|
import { useSettingsSubscription } from '../_internal/app/settings/useSettingsSubscription';
|
|
23
24
|
import { useDesktopContextMenu } from '../context/DesktopContextMenuContext';
|
|
@@ -88,6 +89,7 @@ export function NotificationPanel(props) {
|
|
|
88
89
|
let copiedStateTimer = null;
|
|
89
90
|
let headerEl;
|
|
90
91
|
const desktopMenu = useDesktopContextMenu();
|
|
92
|
+
const running = useRunningProgressCards();
|
|
91
93
|
const compiledSearch = createMemo(() => compileNotificationSearchMatcher(searchQuery(), regexMode()));
|
|
92
94
|
const filteredEntries = createMemo(() => filterNotificationTimeline(props.notificationTimeline(), {
|
|
93
95
|
tones: toneSelection(),
|
|
@@ -639,11 +641,14 @@ export function NotificationPanel(props) {
|
|
|
639
641
|
</Show>
|
|
640
642
|
</LogFilterBar>
|
|
641
643
|
<OverlayScrollArea viewportClass={styles.notificationTimeline} data-tour-target="notifications-timeline">
|
|
642
|
-
<
|
|
643
|
-
|
|
644
|
+
<RunningProgressCards items={running()}/>
|
|
645
|
+
<Show when={filteredEntries().length > 0} fallback={<Show when={hasActiveFilter() || running().length === 0}>
|
|
646
|
+
<p class={styles.notificationEmpty}>
|
|
647
|
+
{hasActiveFilter()
|
|
644
648
|
? t('No notifications match the current filter.')
|
|
645
649
|
: t('No notifications yet.')}
|
|
646
|
-
|
|
650
|
+
</p>
|
|
651
|
+
</Show>}>
|
|
647
652
|
<Show when={pinnedEntries().length > 0}>
|
|
648
653
|
<Panel.Header class={styles.notificationItemTop}>
|
|
649
654
|
<span class={styles.notificationSourceLabel}>
|
|
@@ -12,6 +12,7 @@ import { resolveNotificationSource } from './notificationSources';
|
|
|
12
12
|
import { openExternalUrl } from '../_internal/app/platform/electronBridge';
|
|
13
13
|
import { useKitHost } from '../host/kitHost';
|
|
14
14
|
import { realmNotificationShell } from './notificationCardServices';
|
|
15
|
+
import { RunningProgressCards, useRunningProgressCards, } from './RunningProgressCards';
|
|
15
16
|
import { useDesktopContextMenu } from '../context/DesktopContextMenuContext';
|
|
16
17
|
import { OverlayScrollArea } from '../overlay/OverlayScrollArea';
|
|
17
18
|
import { Button } from '../forms/Button';
|
|
@@ -50,6 +51,7 @@ export function NotificationsCenter(props) {
|
|
|
50
51
|
const [entries, setEntries] = createSignal([]);
|
|
51
52
|
const [dnd, setDnd] = createSignal(notificationSettings.get().doNotDisturb);
|
|
52
53
|
const desktopMenu = useDesktopContextMenu();
|
|
54
|
+
const running = useRunningProgressCards();
|
|
53
55
|
onMount(() => {
|
|
54
56
|
const unsubscribe = notifications.timeline.subscribe(setEntries);
|
|
55
57
|
onCleanup(unsubscribe);
|
|
@@ -158,8 +160,9 @@ export function NotificationsCenter(props) {
|
|
|
158
160
|
</Button>
|
|
159
161
|
</div>
|
|
160
162
|
</Panel.Header>
|
|
161
|
-
<Show when={ordered().length > 0} fallback={<EmptyState size="sm" title={t('No new notifications')}/>}>
|
|
163
|
+
<Show when={running().length > 0 || ordered().length > 0} fallback={<EmptyState size="sm" title={t('No new notifications')}/>}>
|
|
162
164
|
<OverlayScrollArea viewportClass={styles.list}>
|
|
165
|
+
<RunningProgressCards items={running()}/>
|
|
163
166
|
<For each={ordered()}>
|
|
164
167
|
{(entry) => {
|
|
165
168
|
const source = resolveNotificationSource(entry.source);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { For, onCleanup, onMount } from 'solid-js';
|
|
2
|
+
import { createStore, reconcile } from 'solid-js/store';
|
|
3
|
+
import { useKitHost } from '../host/kitHost';
|
|
4
|
+
import { notificationSettings } from '../_internal/app/settings/descriptors/notification';
|
|
5
|
+
import { isProgressRunning, } from './nativeEngine';
|
|
6
|
+
import { realmCardController, realmNotificationShell, } from './notificationCardServices';
|
|
7
|
+
import { NotificationItem } from './NotificationItem';
|
|
8
|
+
const isCenterCard = (item) => isProgressRunning(item) && item.priority !== 'acknowledgment-required';
|
|
9
|
+
export function useRunningProgressCards() {
|
|
10
|
+
const { stack } = useKitHost().notifications;
|
|
11
|
+
const [store, setStore] = createStore({
|
|
12
|
+
items: [],
|
|
13
|
+
});
|
|
14
|
+
onMount(() => {
|
|
15
|
+
const unsubscribe = stack.subscribe((items) => {
|
|
16
|
+
setStore('items', reconcile(items.filter(isCenterCard), { key: 'id', merge: true }));
|
|
17
|
+
});
|
|
18
|
+
onCleanup(unsubscribe);
|
|
19
|
+
});
|
|
20
|
+
return () => store.items;
|
|
21
|
+
}
|
|
22
|
+
export function RunningProgressCards(props) {
|
|
23
|
+
const host = useKitHost();
|
|
24
|
+
const controller = realmCardController(host, () => notificationSettings.get());
|
|
25
|
+
const shell = realmNotificationShell(host);
|
|
26
|
+
return (<For each={props.items}>
|
|
27
|
+
{(item) => (<NotificationItem item={item} controller={controller} shell={shell} inCenter/>)}
|
|
28
|
+
</For>);
|
|
29
|
+
}
|
|
@@ -4,42 +4,69 @@ import { VpBell, VpBellOff } from '@vokril/icons';
|
|
|
4
4
|
import { Popover } from '../overlay/popover/Popover';
|
|
5
5
|
import { NotificationsCenter } from './NotificationsCenter';
|
|
6
6
|
import { useKitHost } from '../host/kitHost';
|
|
7
|
+
import { useHostWindow } from '../_internal/app/windows/window/HostWindowContext';
|
|
7
8
|
import { notificationSettings } from '../_internal/app/settings/descriptors/notification';
|
|
8
9
|
import { useSettingsSubscription } from '../_internal/app/settings/useSettingsSubscription';
|
|
10
|
+
import { isOnToastStack } from './nativeEngine';
|
|
11
|
+
import { useRunningProgressCards } from './RunningProgressCards';
|
|
9
12
|
import { t } from '../i18n/i18n';
|
|
10
13
|
import styles from './StatusBarNotificationBell.module.css.js';
|
|
11
|
-
export function StatusBarNotificationBell() {
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
+
export function StatusBarNotificationBell(props) {
|
|
15
|
+
const host = useKitHost();
|
|
16
|
+
const { timeline, stack } = host.notifications;
|
|
17
|
+
const display = host.displayOwner.register(useHostWindow().window);
|
|
18
|
+
onCleanup(display.dispose);
|
|
19
|
+
const [open, setOpenSignal] = createSignal(false);
|
|
14
20
|
const [unread, setUnread] = createSignal(0);
|
|
15
21
|
const [dnd, setDnd] = createSignal(notificationSettings.get().doNotDisturb);
|
|
22
|
+
const [stackHasToasts, setStackHasToasts] = createSignal(false);
|
|
23
|
+
const running = useRunningProgressCards();
|
|
16
24
|
let buttonRef;
|
|
17
25
|
onMount(() => {
|
|
18
26
|
const unsubscribeUnread = timeline.subscribeUnread(setUnread);
|
|
19
|
-
|
|
27
|
+
const unsubscribeStack = stack.subscribe((items) => setStackHasToasts(items.some(isOnToastStack)));
|
|
28
|
+
onCleanup(() => {
|
|
29
|
+
unsubscribeUnread();
|
|
30
|
+
unsubscribeStack();
|
|
31
|
+
});
|
|
20
32
|
});
|
|
33
|
+
const toastsShown = () => stackHasToasts() && display.ownsDisplay();
|
|
21
34
|
useSettingsSubscription(notificationSettings, () => {
|
|
22
35
|
setDnd(notificationSettings.get().doNotDisturb);
|
|
23
36
|
});
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
const setOpen = (next) => {
|
|
38
|
+
if (next === open())
|
|
39
|
+
return;
|
|
40
|
+
if (next)
|
|
41
|
+
timeline.markSeen();
|
|
42
|
+
setOpenSignal(next);
|
|
43
|
+
props.onOpenChange?.(next);
|
|
44
|
+
};
|
|
45
|
+
onCleanup(() => setOpen(false));
|
|
46
|
+
const inProgress = () => open() || toastsShown() ? 0 : running().length;
|
|
47
|
+
const label = () => {
|
|
48
|
+
const count = inProgress();
|
|
49
|
+
if (dnd()) {
|
|
50
|
+
return count > 0
|
|
51
|
+
? t('Notifications (Do Not Disturb on, {count} in progress)', { count })
|
|
52
|
+
: t('Notifications (Do Not Disturb on)');
|
|
53
|
+
}
|
|
54
|
+
if (open())
|
|
55
|
+
return t('Hide notifications');
|
|
56
|
+
return count > 0
|
|
57
|
+
? t('Notifications ({count} in progress)', { count })
|
|
58
|
+
: t('Show notifications');
|
|
31
59
|
};
|
|
32
60
|
const badgeLabel = () => (unread() > 99 ? '99+' : String(unread()));
|
|
33
61
|
return (<>
|
|
34
|
-
<PressableSurface ref={buttonRef} type="button" class={styles.bell} data-status-bar-bell data-open={open() ? 'true' : 'false'} onClick={
|
|
35
|
-
? t('Notifications (Do Not Disturb on)')
|
|
36
|
-
: t('Show notifications')} aria-label={dnd()
|
|
37
|
-
? t('Notifications (Do Not Disturb on)')
|
|
38
|
-
: t('Show notifications')} aria-haspopup="dialog" aria-expanded={open()}>
|
|
62
|
+
<PressableSurface ref={buttonRef} type="button" class={styles.bell} data-status-bar-bell data-open={open() ? 'true' : 'false'} onClick={() => setOpen(!open())} title={label()} aria-label={label()} aria-haspopup="dialog" aria-expanded={open()}>
|
|
39
63
|
<Show when={dnd()} fallback={<VpBell class={styles.bellIcon}/>}>
|
|
40
64
|
<VpBellOff class={styles.bellIcon}/>
|
|
41
65
|
</Show>
|
|
42
|
-
|
|
66
|
+
|
|
67
|
+
<Show when={unread() > 0} fallback={<Show when={inProgress() > 0}>
|
|
68
|
+
<span class={styles.progressDot} aria-hidden="true"/>
|
|
69
|
+
</Show>}>
|
|
43
70
|
<span class={styles.badge}>{badgeLabel()}</span>
|
|
44
71
|
</Show>
|
|
45
72
|
</PressableSurface>
|
|
@@ -28,6 +28,7 @@ function toToastOptions(definition, payload) {
|
|
|
28
28
|
: {}),
|
|
29
29
|
...(payload.id !== undefined ? { id: payload.id } : {}),
|
|
30
30
|
...(payload.announce !== undefined ? { announce: payload.announce } : {}),
|
|
31
|
+
...(definition.delivery === 'in-app-only' ? { inAppOnly: true } : {}),
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
export function createCatalogDelivery(deps) {
|
|
@@ -73,7 +74,7 @@ export function createCatalogDelivery(deps) {
|
|
|
73
74
|
},
|
|
74
75
|
progress(definition, built) {
|
|
75
76
|
const payload = withButtons(built);
|
|
76
|
-
if (definition.delivery
|
|
77
|
+
if (definition.delivery === 'os-only') {
|
|
77
78
|
throw new BugIndicatingError('Progress notifications require an in-app catalog definition.');
|
|
78
79
|
}
|
|
79
80
|
return deps.toast.progress(payload.message, {
|
|
@@ -4,7 +4,7 @@ import { applyNotificationRules } from './notificationRules';
|
|
|
4
4
|
import { decideFilter, } from './toastFilterPolicy';
|
|
5
5
|
import { DEFAULT_NOTIFICATION_SETTINGS } from '../_internal/app/settings/descriptors/notification';
|
|
6
6
|
import { createNativeNotificationEngine, isNotificationSticky, resolveNotificationDuration, } from './nativeEngine';
|
|
7
|
-
import { enrichErrorToast } from './toast';
|
|
7
|
+
import { enrichErrorToast, suppressedProgressHandle } from './toast';
|
|
8
8
|
import { resolveCatalogPreviewPriority } from './catalogAdapter';
|
|
9
9
|
import { withErrorActionButtons } from './errorActionButtons';
|
|
10
10
|
function progressHandle(handle, payload) {
|
|
@@ -32,6 +32,11 @@ function progressHandle(handle, payload) {
|
|
|
32
32
|
durationMs: Infinity,
|
|
33
33
|
}),
|
|
34
34
|
dismiss: () => handle.close(),
|
|
35
|
+
updateActions: (next) => handle.update({
|
|
36
|
+
actions: previewActions(next.action ? inertAction(next.action) : undefined, next.actions?.map(inertAction), () => handle.close()),
|
|
37
|
+
}),
|
|
38
|
+
state: () => handle.state(),
|
|
39
|
+
onDidChangeState: handle.onDidChangeState,
|
|
35
40
|
};
|
|
36
41
|
}
|
|
37
42
|
const inert = () => undefined;
|
|
@@ -44,6 +49,30 @@ function inertAction(action) {
|
|
|
44
49
|
: {}),
|
|
45
50
|
};
|
|
46
51
|
}
|
|
52
|
+
function previewActions(primary, others, end) {
|
|
53
|
+
const actions = [primary, ...(others ?? [])].filter((action) => action !== undefined);
|
|
54
|
+
if (actions.length === 0)
|
|
55
|
+
return undefined;
|
|
56
|
+
return actions.map((action, index) => ({
|
|
57
|
+
label: action.label,
|
|
58
|
+
primary: index === 0,
|
|
59
|
+
keepOpen: action.expireOnAction === false,
|
|
60
|
+
onClick: () => {
|
|
61
|
+
void action.onClick();
|
|
62
|
+
if (action.expireOnAction !== false)
|
|
63
|
+
end();
|
|
64
|
+
},
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
function previewPresentation(payload, body) {
|
|
68
|
+
return {
|
|
69
|
+
...(body ? { body: scrubSecrets(body) } : {}),
|
|
70
|
+
...(payload.duration !== undefined ? { durationMs: payload.duration } : {}),
|
|
71
|
+
...(payload.icon ? { icon: payload.icon } : {}),
|
|
72
|
+
...(payload.markdown ? { markdown: true } : {}),
|
|
73
|
+
...(payload.announce ? { announce: payload.announce } : {}),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
47
76
|
function toPreviewPayload(built, errorActions) {
|
|
48
77
|
const payload = withErrorActionButtons(built, errorActions, inertAction);
|
|
49
78
|
return {
|
|
@@ -77,7 +106,7 @@ export function createNotificationPreviewRuntime(deps) {
|
|
|
77
106
|
activeItems = items;
|
|
78
107
|
});
|
|
79
108
|
const controller = {
|
|
80
|
-
close: (id) => engine.
|
|
109
|
+
close: (id) => engine.dismiss(id),
|
|
81
110
|
setFocus: (id, focused) => engine.setFocus(id, focused),
|
|
82
111
|
setHover: (id, hovered) => engine.setHover(id, hovered),
|
|
83
112
|
toggleExpanded: (id) => engine.toggleExpanded(id),
|
|
@@ -161,38 +190,21 @@ export function createNotificationPreviewRuntime(deps) {
|
|
|
161
190
|
const body = errorEnrichment?.bodyText ??
|
|
162
191
|
previewPayload.subtitle ??
|
|
163
192
|
previewPayload.description;
|
|
164
|
-
|
|
193
|
+
let shown;
|
|
194
|
+
const actions = previewActions(errorEnrichment?.primaryAction ?? previewPayload.action, previewPayload.actions, () => shown?.close());
|
|
165
195
|
const handle = engine.notify({
|
|
166
196
|
severity: ruled.severity,
|
|
167
197
|
title: scrubSecrets(ruled.title),
|
|
168
|
-
...(
|
|
198
|
+
...previewPresentation(previewPayload, body),
|
|
169
199
|
source: ruled.source,
|
|
170
200
|
priority: ruled.priority,
|
|
171
|
-
|
|
172
|
-
? { durationMs: previewPayload.duration }
|
|
173
|
-
: {}),
|
|
201
|
+
isolated: true,
|
|
174
202
|
...(previewPayload.id !== undefined
|
|
175
203
|
? { id: String(previewPayload.id) }
|
|
176
204
|
: {}),
|
|
177
|
-
...(
|
|
178
|
-
...(previewPayload.markdown ? { markdown: true } : {}),
|
|
179
|
-
...(previewPayload.announce
|
|
180
|
-
? { announce: previewPayload.announce }
|
|
181
|
-
: {}),
|
|
182
|
-
...(primaryAction || previewPayload.actions?.length
|
|
183
|
-
? {
|
|
184
|
-
actions: [primaryAction, ...(previewPayload.actions ?? [])]
|
|
185
|
-
.filter((action) => action !== undefined)
|
|
186
|
-
.map((action, index) => ({
|
|
187
|
-
label: action.label,
|
|
188
|
-
primary: index === 0,
|
|
189
|
-
onClick: () => {
|
|
190
|
-
void action.onClick();
|
|
191
|
-
},
|
|
192
|
-
})),
|
|
193
|
-
}
|
|
194
|
-
: {}),
|
|
205
|
+
...(actions ? { actions } : {}),
|
|
195
206
|
});
|
|
207
|
+
shown = handle;
|
|
196
208
|
deliveries.push(handle.id ? delivery : { ...delivery, outcome: 'spam-dropped' });
|
|
197
209
|
return handle.id;
|
|
198
210
|
},
|
|
@@ -205,7 +217,7 @@ export function createNotificationPreviewRuntime(deps) {
|
|
|
205
217
|
deliveries.push({
|
|
206
218
|
definition,
|
|
207
219
|
payload: previewPayload,
|
|
208
|
-
channel:
|
|
220
|
+
channel: definition.delivery,
|
|
209
221
|
decision,
|
|
210
222
|
outcome: decision.showToast
|
|
211
223
|
? 'shown'
|
|
@@ -213,27 +225,29 @@ export function createNotificationPreviewRuntime(deps) {
|
|
|
213
225
|
? 'timeline-only'
|
|
214
226
|
: 'suppressed',
|
|
215
227
|
});
|
|
228
|
+
const id = previewPayload.id !== undefined ? String(previewPayload.id) : undefined;
|
|
216
229
|
if (!decision.showToast) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
fail: () => undefined,
|
|
221
|
-
dismiss: () => undefined,
|
|
222
|
-
};
|
|
230
|
+
if (id !== undefined)
|
|
231
|
+
engine.suppress((item) => item.id === id);
|
|
232
|
+
return suppressedProgressHandle;
|
|
223
233
|
}
|
|
234
|
+
let shown;
|
|
235
|
+
const actions = previewActions(previewPayload.action, previewPayload.actions, () => shown?.close());
|
|
224
236
|
const handle = engine.notify({
|
|
225
237
|
severity: definition.severity,
|
|
226
238
|
title: scrubSecrets(previewPayload.message),
|
|
239
|
+
...previewPresentation(previewPayload, previewPayload.subtitle ?? previewPayload.description),
|
|
227
240
|
source: definition.source,
|
|
228
241
|
priority: definition.priority,
|
|
242
|
+
isolated: true,
|
|
229
243
|
sticky: true,
|
|
230
244
|
progress: previewPayload.onCancel
|
|
231
245
|
? { onCancel: previewPayload.onCancel }
|
|
232
246
|
: {},
|
|
233
|
-
...(
|
|
234
|
-
|
|
235
|
-
: {}),
|
|
247
|
+
...(id !== undefined ? { id } : {}),
|
|
248
|
+
...(actions ? { actions } : {}),
|
|
236
249
|
});
|
|
250
|
+
shown = handle;
|
|
237
251
|
return progressHandle(handle, previewPayload);
|
|
238
252
|
},
|
|
239
253
|
};
|
|
@@ -9,18 +9,40 @@ import { isSpamDropHandle, } from './nativeEngine';
|
|
|
9
9
|
function inQuietHoursNow() {
|
|
10
10
|
return isInQuietHours(notificationSettings.get(), new Date());
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const implicitKey = deriveImplicitRemindKey(source, title);
|
|
15
|
-
return decideToastFilter({ priority, recordTimeline }, settings, {
|
|
12
|
+
function choiceGates(source, title, dontShowAgainKey) {
|
|
13
|
+
return {
|
|
16
14
|
dismissed: dontShowAgainKey !== undefined && isKeyDismissed(dontShowAgainKey),
|
|
17
15
|
remindSuppressed: (dontShowAgainKey !== undefined &&
|
|
18
16
|
isKeyRemindSuppressed(dontShowAgainKey)) ||
|
|
19
|
-
isKeyRemindSuppressed(
|
|
17
|
+
isKeyRemindSuppressed(deriveImplicitRemindKey(source, title)),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function decideFilter(source, title, priority, dontShowAgainKey, recordTimeline) {
|
|
21
|
+
return decideToastFilter({ priority, recordTimeline }, notificationSettings.get(), {
|
|
22
|
+
...choiceGates(source, title, dontShowAgainKey),
|
|
20
23
|
sourceMuted: isSourceMuted(source),
|
|
21
24
|
inQuietHours: inQuietHoursNow(),
|
|
22
25
|
});
|
|
23
26
|
}
|
|
27
|
+
export function turnedDownOnCard(source, title, dontShowAgainKey) {
|
|
28
|
+
const gates = choiceGates(source, title, dontShowAgainKey);
|
|
29
|
+
return gates.dismissed || gates.remindSuppressed;
|
|
30
|
+
}
|
|
31
|
+
export function turnedDownCard(item) {
|
|
32
|
+
const dontShowAgainKey = item.neverShowAgainKey;
|
|
33
|
+
return ((dontShowAgainKey !== undefined && isKeyDismissed(dontShowAgainKey)) ||
|
|
34
|
+
isKeyRemindSuppressed(dontShowAgainKey ??
|
|
35
|
+
item.remindKey ??
|
|
36
|
+
deriveImplicitRemindKey(item.source ?? 'general', item.title)));
|
|
37
|
+
}
|
|
38
|
+
export function silencedBySettings(source, priority) {
|
|
39
|
+
return !decideToastFilter({ priority, recordTimeline: undefined }, notificationSettings.get(), {
|
|
40
|
+
dismissed: false,
|
|
41
|
+
remindSuppressed: false,
|
|
42
|
+
sourceMuted: isSourceMuted(source),
|
|
43
|
+
inQuietHours: inQuietHoursNow(),
|
|
44
|
+
}).showToast;
|
|
45
|
+
}
|
|
24
46
|
function mapAction(sinks, action, handleId, source, primary) {
|
|
25
47
|
return {
|
|
26
48
|
label: action.label,
|
|
@@ -39,6 +61,25 @@ function mapAction(sinks, action, handleId, source, primary) {
|
|
|
39
61
|
},
|
|
40
62
|
};
|
|
41
63
|
}
|
|
64
|
+
export function nativeActionsOf(sinks, primary, others, cardId, source) {
|
|
65
|
+
return [...(primary ? [primary] : []), ...(others ?? [])].map((action, index) => mapAction(sinks, action, cardId, source, index === 0));
|
|
66
|
+
}
|
|
67
|
+
export function cardPresentation(options) {
|
|
68
|
+
const description = options.subtitle?.trim() || options.description?.trim();
|
|
69
|
+
const useMarkdown = options.markdown ?? notificationSettings.get().markdownEnabled;
|
|
70
|
+
const resolvedRoute = resolveDefaultRoute(options.source, options.defaultRoute);
|
|
71
|
+
return {
|
|
72
|
+
...(description ? { body: description } : {}),
|
|
73
|
+
...(useMarkdown ? { markdown: true } : {}),
|
|
74
|
+
...(options.duration !== undefined ? { durationMs: options.duration } : {}),
|
|
75
|
+
...(options.dontShowAgainKey
|
|
76
|
+
? { neverShowAgainKey: options.dontShowAgainKey }
|
|
77
|
+
: {}),
|
|
78
|
+
...(options.icon ? { icon: options.icon } : {}),
|
|
79
|
+
...(options.announce ? { announce: options.announce } : {}),
|
|
80
|
+
...(resolvedRoute ? { defaultRoute: resolvedRoute } : {}),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
42
83
|
export function fire(sinks, opts) {
|
|
43
84
|
const fireSource = opts.options.source ?? 'general';
|
|
44
85
|
sinks.analytics.recordFire(fireSource, opts.decision.showToast, isSourceMuted(fireSource));
|
|
@@ -46,41 +87,26 @@ export function fire(sinks, opts) {
|
|
|
46
87
|
return null;
|
|
47
88
|
sinks.audio.playSeverityToneIfEnabled(opts.severity, inQuietHoursNow());
|
|
48
89
|
const { options } = opts;
|
|
49
|
-
const
|
|
90
|
+
const presentation = cardPresentation(options);
|
|
91
|
+
const description = presentation.body;
|
|
50
92
|
const id = options.id !== undefined ? String(options.id) : undefined;
|
|
51
|
-
const settings = notificationSettings.get();
|
|
52
|
-
const useMarkdown = options.markdown ?? settings.markdownEnabled;
|
|
53
|
-
const toastActions = [
|
|
54
|
-
...(opts.primaryAction ? [opts.primaryAction] : []),
|
|
55
|
-
...(options.actions ?? []),
|
|
56
|
-
];
|
|
57
|
-
const resolvedRoute = resolveDefaultRoute(options.source, options.defaultRoute);
|
|
58
93
|
let resolved = null;
|
|
94
|
+
const actions = nativeActionsOf(sinks, opts.primaryAction, options.actions, () => resolved?.id, fireSource);
|
|
59
95
|
const handle = sinks.engine.notify({
|
|
60
96
|
severity: opts.severity,
|
|
61
97
|
title: opts.title,
|
|
62
|
-
...
|
|
63
|
-
...(useMarkdown ? { markdown: true } : {}),
|
|
98
|
+
...presentation,
|
|
64
99
|
source: options.source ?? 'general',
|
|
65
100
|
priority: options.priority ?? 'default',
|
|
66
|
-
...(options.duration !== undefined ? { durationMs: options.duration } : {}),
|
|
67
|
-
...(options.dontShowAgainKey
|
|
68
|
-
? { neverShowAgainKey: options.dontShowAgainKey }
|
|
69
|
-
: {}),
|
|
70
101
|
...(id ? { id } : {}),
|
|
71
|
-
...(options.icon ? { icon: options.icon } : {}),
|
|
72
|
-
...(options.announce ? { announce: options.announce } : {}),
|
|
73
|
-
...(resolvedRoute ? { defaultRoute: resolvedRoute } : {}),
|
|
74
102
|
...(opts.vendorError ? { vendorError: opts.vendorError } : {}),
|
|
75
|
-
...(
|
|
76
|
-
? {
|
|
77
|
-
actions: toastActions.map((action, index) => mapAction(sinks, action, () => resolved?.id, fireSource, index === 0)),
|
|
78
|
-
}
|
|
79
|
-
: {}),
|
|
103
|
+
...(actions.length > 0 ? { actions } : {}),
|
|
80
104
|
});
|
|
81
105
|
resolved = handle;
|
|
82
106
|
if (isSpamDropHandle(handle))
|
|
83
107
|
return handle;
|
|
108
|
+
if (options.inAppOnly)
|
|
109
|
+
return handle;
|
|
84
110
|
const scrubbedTitle = scrubSecrets(opts.title);
|
|
85
111
|
const scrubbedBody = description ? scrubSecrets(description) : undefined;
|
|
86
112
|
const fanoutPayload = {
|
|
@@ -27,4 +27,4 @@ export { registerFenceAliases } from '../_internal/app/markdown/inlineMarkdown';
|
|
|
27
27
|
export { NotificationItem, } from './NotificationItem';
|
|
28
28
|
export { NotificationPanel } from './NotificationPanel';
|
|
29
29
|
export { NotificationsCenter } from './NotificationsCenter';
|
|
30
|
-
export { StatusBarNotificationBell } from './StatusBarNotificationBell';
|
|
30
|
+
export { StatusBarNotificationBell, } from './StatusBarNotificationBell';
|