@vokril/ui-solid 0.27.1 → 0.29.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 +37 -0
- package/README.md +36 -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-BRnCKU72.js → StatusBarNotificationBell-7Izs_msz.js} +4936 -4585
- package/dist/StatusBarNotificationBell-BJiORN4s.cjs +50 -0
- 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 +64 -4
- package/dist/_internal/contract/notification.d.ts +64 -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 +250 -246
- 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 +29 -5
- package/dist/notifications/StatusBarNotificationBell.d.ts +29 -5
- package/dist/notifications/createNotificationPreviewRuntime.d.cts +2 -2
- package/dist/notifications/createNotificationPreviewRuntime.d.ts +2 -2
- package/dist/notifications/dismissableToastIds.d.cts +5 -1
- package/dist/notifications/dismissableToastIds.d.ts +5 -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 +49 -45
- package/dist/notifications/nativeEngine.d.cts +125 -5
- package/dist/notifications/nativeEngine.d.ts +125 -5
- package/dist/notifications/notificationCardServices.d.cts +5 -1
- package/dist/notifications/notificationCardServices.d.ts +5 -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 +36 -1
- package/dist/notifications/notificationService.d.ts +36 -1
- 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-D8Jt3PXI.js} +4869 -4515
- package/dist/server/StatusBarNotificationBell-LJHLMT9F.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 +183 -179
- 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 +49 -45
- 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 -14
- 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 +42 -18
- 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 +174 -31
- 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 +48 -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
|
@@ -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';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Emitter } from '../_internal/base/event';
|
|
2
|
+
const NO_SUBSCRIPTION = { dispose: () => undefined };
|
|
1
3
|
export function isSpamDropHandle(handle) {
|
|
2
4
|
return handle.id === '';
|
|
3
5
|
}
|
|
@@ -33,8 +35,34 @@ export function isNotificationSticky(item, settings) {
|
|
|
33
35
|
return true;
|
|
34
36
|
return false;
|
|
35
37
|
}
|
|
38
|
+
export function isProgressRunning(item) {
|
|
39
|
+
return (item.progress !== undefined &&
|
|
40
|
+
item.progress.done !== true &&
|
|
41
|
+
item.isolated !== true);
|
|
42
|
+
}
|
|
43
|
+
export function isOnToastStack(item) {
|
|
44
|
+
return item.priority !== 'acknowledgment-required' && item.hidden !== true;
|
|
45
|
+
}
|
|
46
|
+
export function hiddenRunningProgress(items) {
|
|
47
|
+
return items
|
|
48
|
+
.flatMap((item) => item.outOfSightSince !== undefined && isProgressRunning(item)
|
|
49
|
+
? [{ item, since: item.outOfSightSince }]
|
|
50
|
+
: [])
|
|
51
|
+
.reverse()
|
|
52
|
+
.sort((a, b) => b.since - a.since)
|
|
53
|
+
.map(({ item }) => item);
|
|
54
|
+
}
|
|
55
|
+
function withSight(item, since) {
|
|
56
|
+
if (since !== undefined)
|
|
57
|
+
return { ...item, outOfSightSince: since };
|
|
58
|
+
const { outOfSightSince: _inSight, ...card } = item;
|
|
59
|
+
return card;
|
|
60
|
+
}
|
|
36
61
|
export function createNativeNotificationEngine(dependencies) {
|
|
37
62
|
const { getSettings, warn } = dependencies;
|
|
63
|
+
const isSilenced = dependencies.isSilenced ?? (() => false);
|
|
64
|
+
const isTurnedDown = dependencies.isTurnedDown ?? (() => false);
|
|
65
|
+
const centerReachable = dependencies.centerReachable ?? (() => true);
|
|
38
66
|
const now = dependencies.now ?? (() => Date.now());
|
|
39
67
|
const setTimer = dependencies.setTimeout ??
|
|
40
68
|
((callback, timeoutMs) => window.setTimeout(callback, timeoutMs));
|
|
@@ -44,25 +72,43 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
44
72
|
const items = new Map();
|
|
45
73
|
const listeners = new Set();
|
|
46
74
|
const timers = new Map();
|
|
75
|
+
const runs = new Map();
|
|
76
|
+
const outOfSight = new Map();
|
|
47
77
|
function snapshot() {
|
|
48
78
|
return [...items.values()].sort((a, b) => a.createdAt - b.createdAt);
|
|
49
79
|
}
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
80
|
+
function clippedIds() {
|
|
81
|
+
const stack = snapshot().filter(isOnToastStack);
|
|
82
|
+
const cap = Math.max(1, getSettings().maxVisibleNotifications);
|
|
83
|
+
return new Set(stack.slice(0, Math.max(0, stack.length - cap)).map(({ id }) => id));
|
|
84
|
+
}
|
|
85
|
+
function isClipped(id) {
|
|
86
|
+
return getSettings().pauseTimerWhileHidden && clippedIds().has(id);
|
|
87
|
+
}
|
|
88
|
+
function recordSight() {
|
|
89
|
+
const clipped = clippedIds();
|
|
90
|
+
for (const id of outOfSight.keys()) {
|
|
91
|
+
if (!items.has(id))
|
|
92
|
+
outOfSight.delete(id);
|
|
93
|
+
}
|
|
94
|
+
let changed = false;
|
|
95
|
+
for (const [id, item] of items) {
|
|
96
|
+
if (item.hidden !== true && !clipped.has(id))
|
|
97
|
+
outOfSight.delete(id);
|
|
98
|
+
else if (!outOfSight.has(id))
|
|
99
|
+
outOfSight.set(id, now());
|
|
100
|
+
const since = outOfSight.get(id);
|
|
101
|
+
if (item.outOfSightSince === since)
|
|
102
|
+
continue;
|
|
103
|
+
items.set(id, withSight(item, since));
|
|
104
|
+
changed = true;
|
|
105
|
+
}
|
|
106
|
+
return changed;
|
|
61
107
|
}
|
|
62
108
|
function reevaluateSchedules() {
|
|
63
109
|
for (const id of items.keys()) {
|
|
64
110
|
if (timers.has(id)) {
|
|
65
|
-
if (
|
|
111
|
+
if (isClipped(id))
|
|
66
112
|
cancelHide(id);
|
|
67
113
|
continue;
|
|
68
114
|
}
|
|
@@ -70,6 +116,7 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
70
116
|
}
|
|
71
117
|
}
|
|
72
118
|
function emit() {
|
|
119
|
+
recordSight();
|
|
73
120
|
const snap = snapshot();
|
|
74
121
|
for (const l of Array.from(listeners)) {
|
|
75
122
|
try {
|
|
@@ -98,6 +145,55 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
98
145
|
timers.delete(id);
|
|
99
146
|
}
|
|
100
147
|
}
|
|
148
|
+
function runOf(id) {
|
|
149
|
+
const current = runs.get(id);
|
|
150
|
+
if (current)
|
|
151
|
+
return current;
|
|
152
|
+
const run = { state: 'open', changed: new Emitter() };
|
|
153
|
+
runs.set(id, run);
|
|
154
|
+
return run;
|
|
155
|
+
}
|
|
156
|
+
function endRun(id, state) {
|
|
157
|
+
const run = runs.get(id);
|
|
158
|
+
runs.delete(id);
|
|
159
|
+
if (run)
|
|
160
|
+
run.state = state;
|
|
161
|
+
return run;
|
|
162
|
+
}
|
|
163
|
+
function announceEnd(run) {
|
|
164
|
+
if (!run)
|
|
165
|
+
return;
|
|
166
|
+
run.changed.fire(run.state);
|
|
167
|
+
run.changed.dispose();
|
|
168
|
+
}
|
|
169
|
+
function closeCard(id, state) {
|
|
170
|
+
cancelHide(id);
|
|
171
|
+
if (!items.delete(id))
|
|
172
|
+
return;
|
|
173
|
+
const run = endRun(id, state);
|
|
174
|
+
emit();
|
|
175
|
+
announceEnd(run);
|
|
176
|
+
}
|
|
177
|
+
function sendToCenter(item) {
|
|
178
|
+
return { ...item, hidden: true, hovered: false, focused: false };
|
|
179
|
+
}
|
|
180
|
+
function backOnStack(item) {
|
|
181
|
+
return { ...item, hidden: false, createdAt: now() };
|
|
182
|
+
}
|
|
183
|
+
function write(id, patch) {
|
|
184
|
+
const cur = items.get(id);
|
|
185
|
+
if (!cur)
|
|
186
|
+
return;
|
|
187
|
+
const next = { ...cur, ...patch };
|
|
188
|
+
const settles = isProgressRunning(cur) && !isProgressRunning(next);
|
|
189
|
+
if (settles && isSilenced(next)) {
|
|
190
|
+
closeCard(id, 'suppressed');
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
items.set(id, settles && next.hidden ? backOnStack(next) : next);
|
|
194
|
+
emit();
|
|
195
|
+
scheduleHide(id);
|
|
196
|
+
}
|
|
101
197
|
function scheduleHide(id) {
|
|
102
198
|
cancelHide(id);
|
|
103
199
|
const item = items.get(id);
|
|
@@ -105,7 +201,7 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
105
201
|
return;
|
|
106
202
|
if (isSticky(item))
|
|
107
203
|
return;
|
|
108
|
-
if (
|
|
204
|
+
if (isClipped(id))
|
|
109
205
|
return;
|
|
110
206
|
const ms = durationFor(item);
|
|
111
207
|
if (!Number.isFinite(ms) || ms <= 0)
|
|
@@ -119,7 +215,9 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
119
215
|
return;
|
|
120
216
|
recordFade(live.source ?? 'general');
|
|
121
217
|
items.delete(id);
|
|
218
|
+
const run = endRun(id, 'closed');
|
|
122
219
|
emit();
|
|
220
|
+
announceEnd(run);
|
|
123
221
|
}, ms);
|
|
124
222
|
timers.set(id, handle);
|
|
125
223
|
}
|
|
@@ -175,11 +273,13 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
175
273
|
update: () => undefined,
|
|
176
274
|
setProgress: () => undefined,
|
|
177
275
|
close: () => undefined,
|
|
276
|
+
state: () => 'suppressed',
|
|
277
|
+
onDidChangeState: () => NO_SUBSCRIPTION,
|
|
178
278
|
};
|
|
179
279
|
}
|
|
180
280
|
const id = dedupId ?? nextId();
|
|
181
281
|
const previous = items.get(id);
|
|
182
|
-
const
|
|
282
|
+
const issued = {
|
|
183
283
|
...input,
|
|
184
284
|
id,
|
|
185
285
|
createdAt: previous?.createdAt ?? now(),
|
|
@@ -187,7 +287,14 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
187
287
|
hovered: previous?.hovered ?? false,
|
|
188
288
|
focused: previous?.focused ?? false,
|
|
189
289
|
};
|
|
290
|
+
const silenced = isProgressRunning(issued) && isSilenced(issued);
|
|
291
|
+
const next = silenced
|
|
292
|
+
? sendToCenter(issued)
|
|
293
|
+
: previous?.hidden
|
|
294
|
+
? backOnStack(issued)
|
|
295
|
+
: issued;
|
|
190
296
|
items.set(id, next);
|
|
297
|
+
const run = runOf(id);
|
|
191
298
|
if (isNewOnScreen)
|
|
192
299
|
recordFire();
|
|
193
300
|
emit();
|
|
@@ -195,26 +302,16 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
195
302
|
return {
|
|
196
303
|
id,
|
|
197
304
|
update(patch) {
|
|
198
|
-
|
|
199
|
-
if (!cur)
|
|
200
|
-
return;
|
|
201
|
-
items.set(id, { ...cur, ...patch });
|
|
202
|
-
emit();
|
|
203
|
-
scheduleHide(id);
|
|
305
|
+
write(id, patch);
|
|
204
306
|
},
|
|
205
307
|
setProgress(progress) {
|
|
206
|
-
|
|
207
|
-
if (!cur)
|
|
208
|
-
return;
|
|
209
|
-
items.set(id, { ...cur, progress });
|
|
210
|
-
emit();
|
|
211
|
-
scheduleHide(id);
|
|
308
|
+
write(id, { progress });
|
|
212
309
|
},
|
|
213
310
|
close() {
|
|
214
|
-
|
|
215
|
-
if (items.delete(id))
|
|
216
|
-
emit();
|
|
311
|
+
closeCard(id, 'closed');
|
|
217
312
|
},
|
|
313
|
+
state: () => run.state,
|
|
314
|
+
onDidChangeState: (listener, thisArgs) => run.state === 'open' ? run.changed.event(listener, thisArgs) : NO_SUBSCRIPTION,
|
|
218
315
|
};
|
|
219
316
|
}
|
|
220
317
|
function subscribeNotifications(listener) {
|
|
@@ -255,15 +352,57 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
255
352
|
scheduleHide(id);
|
|
256
353
|
}
|
|
257
354
|
function closeNotification(id) {
|
|
258
|
-
|
|
259
|
-
|
|
355
|
+
closeCard(id, 'closed');
|
|
356
|
+
}
|
|
357
|
+
function dismissNotification(id) {
|
|
358
|
+
const cur = items.get(id);
|
|
359
|
+
if (!cur)
|
|
360
|
+
return;
|
|
361
|
+
if (!isProgressRunning(cur) || isTurnedDown(cur)) {
|
|
362
|
+
closeCard(id, 'dismissed');
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if (cur.hidden || !centerReachable())
|
|
366
|
+
return;
|
|
367
|
+
items.set(id, sendToCenter(cur));
|
|
368
|
+
emit();
|
|
369
|
+
}
|
|
370
|
+
function suppressNotifications(silenced) {
|
|
371
|
+
const picked = [...items.values()].filter((item) => item.hidden !== true && silenced(item));
|
|
372
|
+
if (picked.length === 0)
|
|
373
|
+
return;
|
|
374
|
+
for (const item of picked.filter(isProgressRunning)) {
|
|
375
|
+
items.set(item.id, sendToCenter(item));
|
|
376
|
+
}
|
|
377
|
+
const ended = picked
|
|
378
|
+
.filter((item) => !isProgressRunning(item))
|
|
379
|
+
.map(({ id }) => {
|
|
380
|
+
cancelHide(id);
|
|
381
|
+
items.delete(id);
|
|
382
|
+
return endRun(id, 'suppressed');
|
|
383
|
+
});
|
|
384
|
+
emit();
|
|
385
|
+
for (const run of ended)
|
|
386
|
+
announceEnd(run);
|
|
387
|
+
}
|
|
388
|
+
function rejectNotification(id) {
|
|
389
|
+
if (items.get(id)?.priority === 'acknowledgment-required')
|
|
390
|
+
return;
|
|
391
|
+
closeCard(id, 'suppressed');
|
|
392
|
+
}
|
|
393
|
+
function refresh() {
|
|
394
|
+
if (recordSight())
|
|
260
395
|
emit();
|
|
261
396
|
}
|
|
262
397
|
function dispose() {
|
|
263
398
|
for (const id of timers.keys())
|
|
264
399
|
cancelHide(id);
|
|
400
|
+
const ended = [...runs.keys()].map((id) => endRun(id, 'closed'));
|
|
265
401
|
items.clear();
|
|
402
|
+
outOfSight.clear();
|
|
266
403
|
listeners.clear();
|
|
404
|
+
for (const run of ended)
|
|
405
|
+
announceEnd(run);
|
|
267
406
|
}
|
|
268
407
|
return {
|
|
269
408
|
notify,
|
|
@@ -272,6 +411,10 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
272
411
|
setFocus: setNotificationFocus,
|
|
273
412
|
toggleExpanded: toggleNotificationExpanded,
|
|
274
413
|
close: closeNotification,
|
|
414
|
+
dismiss: dismissNotification,
|
|
415
|
+
suppress: suppressNotifications,
|
|
416
|
+
reject: rejectNotification,
|
|
417
|
+
refresh,
|
|
275
418
|
dispose,
|
|
276
419
|
};
|
|
277
420
|
}
|
|
@@ -7,7 +7,7 @@ import { notificationSettingsUpdateFailed } from './notifications.notifications'
|
|
|
7
7
|
export function realmCardController(host, settings) {
|
|
8
8
|
const stack = host.notifications.stack;
|
|
9
9
|
return {
|
|
10
|
-
close: (id) => stack.
|
|
10
|
+
close: (id) => stack.dismiss(id),
|
|
11
11
|
setFocus: (id, focused) => stack.setFocus(id, focused),
|
|
12
12
|
setHover: (id, hovered) => stack.setHover(id, hovered),
|
|
13
13
|
toggleExpanded: (id) => stack.toggleExpanded(id),
|
|
@@ -62,6 +62,7 @@ export function overlayItemOf(item, context) {
|
|
|
62
62
|
...(item.neverShowAgainKey
|
|
63
63
|
? { neverShowAgainKey: item.neverShowAgainKey }
|
|
64
64
|
: {}),
|
|
65
|
+
...(item.remindKey ? { remindKey: item.remindKey } : {}),
|
|
65
66
|
...(item.defaultRoute ? { defaultRoute: item.defaultRoute } : {}),
|
|
66
67
|
...(item.actions ? { actions: overlayActionsOf(item.actions) } : {}),
|
|
67
68
|
...(item.secondaryActions
|
|
@@ -85,6 +86,7 @@ export function overlayStateOf(input) {
|
|
|
85
86
|
generation: input.generation,
|
|
86
87
|
reduceMotion: input.reduceMotion,
|
|
87
88
|
animationDuration: input.animationDuration,
|
|
89
|
+
remindLaterEnabled: input.remindLaterEnabled,
|
|
88
90
|
sequence: input.sequence,
|
|
89
91
|
...(input.bounds ? { bounds: input.bounds } : {}),
|
|
90
92
|
...(input.clipBounds ? { clipBounds: input.clipBounds } : {}),
|
|
@@ -228,6 +228,7 @@ function overlaySnapshot(deps, geometry, revisions, stamp) {
|
|
|
228
228
|
sequence: stamp.sequence,
|
|
229
229
|
reduceMotion: deps.reduceMotion(),
|
|
230
230
|
animationDuration: deps.animationDuration(),
|
|
231
|
+
remindLaterEnabled: deps.settings().remindLaterEnabled,
|
|
231
232
|
bounds: roundBounds(positiveBounds(stack)),
|
|
232
233
|
clipBounds: positiveBounds(el?.getBoundingClientRect()),
|
|
233
234
|
items: deps.visible().map((item) => overlayItemOf(item, {
|
|
@@ -13,6 +13,14 @@ import { clearCompiledRuleRegexCache } from './notificationRules';
|
|
|
13
13
|
import { createToast } from './toast';
|
|
14
14
|
import { createCatalogDelivery, showCatalogPreviewToast } from './catalogAdapter';
|
|
15
15
|
import { errorActionFailed } from './notifications.notifications';
|
|
16
|
+
import { silencedBySettings, turnedDownCard } from './fireNotification';
|
|
17
|
+
import { nextQuietHoursStart } from './quietHours';
|
|
18
|
+
const QUIET_HOURS_RECHECK_MS = 60 * 60_000;
|
|
19
|
+
function silencedCard(item) {
|
|
20
|
+
return (!item.isolated &&
|
|
21
|
+
item.priority !== 'acknowledgment-required' &&
|
|
22
|
+
silencedBySettings(item.source ?? 'general', item.priority ?? 'default'));
|
|
23
|
+
}
|
|
16
24
|
export class NotificationService {
|
|
17
25
|
deps;
|
|
18
26
|
renderHost;
|
|
@@ -29,6 +37,9 @@ export class NotificationService {
|
|
|
29
37
|
navigation = new Emitter();
|
|
30
38
|
log;
|
|
31
39
|
onSettingsChanged;
|
|
40
|
+
stopWatchingCards;
|
|
41
|
+
watchingQuietHours = false;
|
|
42
|
+
quietHoursTimer;
|
|
32
43
|
constructor(deps) {
|
|
33
44
|
this.deps = deps;
|
|
34
45
|
const log = deps.log.withTag('Notifications');
|
|
@@ -38,6 +49,9 @@ export class NotificationService {
|
|
|
38
49
|
getSettings: () => notificationSettings.get(),
|
|
39
50
|
recordAutoFade: (source) => this.analytics.recordAutoFade(source),
|
|
40
51
|
warn: (message, error) => log.warn(message, error),
|
|
52
|
+
isSilenced: silencedCard,
|
|
53
|
+
isTurnedDown: turnedDownCard,
|
|
54
|
+
centerReachable: deps.centerReachable,
|
|
41
55
|
});
|
|
42
56
|
this.stack = this.engine;
|
|
43
57
|
this.timeline = new NotificationTimeline({
|
|
@@ -81,8 +95,18 @@ export class NotificationService {
|
|
|
81
95
|
clearCompiledRuleRegexCache();
|
|
82
96
|
this.sounds.invalidate();
|
|
83
97
|
this.timeline.refreshBadge();
|
|
98
|
+
this.takeBackSilencedCards();
|
|
99
|
+
this.engine.refresh();
|
|
100
|
+
if (this.watchingQuietHours)
|
|
101
|
+
this.watchQuietHoursStart();
|
|
84
102
|
};
|
|
85
103
|
window.addEventListener(notificationSettings.changeEvent, this.onSettingsChanged);
|
|
104
|
+
this.stopWatchingCards = this.engine.subscribe((items) => {
|
|
105
|
+
if (items.length === 0)
|
|
106
|
+
this.stopWatchingQuietHours();
|
|
107
|
+
else if (!this.watchingQuietHours)
|
|
108
|
+
this.watchQuietHoursStart();
|
|
109
|
+
});
|
|
86
110
|
}
|
|
87
111
|
notify(definition, params) {
|
|
88
112
|
return this.delivery.notify(definition, definition.build(params, this.renderHost));
|
|
@@ -124,11 +148,35 @@ export class NotificationService {
|
|
|
124
148
|
}
|
|
125
149
|
dispose() {
|
|
126
150
|
window.removeEventListener(notificationSettings.changeEvent, this.onSettingsChanged);
|
|
151
|
+
this.stopWatchingCards();
|
|
152
|
+
this.stopWatchingQuietHours();
|
|
127
153
|
this.digest.dispose();
|
|
128
154
|
this.audio.dispose();
|
|
129
155
|
this.engine.dispose();
|
|
130
156
|
this.navigation.dispose();
|
|
131
157
|
}
|
|
158
|
+
takeBackSilencedCards() {
|
|
159
|
+
this.engine.suppress(silencedCard);
|
|
160
|
+
}
|
|
161
|
+
watchQuietHoursStart() {
|
|
162
|
+
this.stopWatchingQuietHours();
|
|
163
|
+
this.watchingQuietHours = true;
|
|
164
|
+
const next = nextQuietHoursStart(notificationSettings.get(), new Date());
|
|
165
|
+
if (next === null)
|
|
166
|
+
return;
|
|
167
|
+
const wait = Math.max(0, next.getTime() - Date.now());
|
|
168
|
+
this.quietHoursTimer = setTimeout(() => {
|
|
169
|
+
this.quietHoursTimer = undefined;
|
|
170
|
+
this.takeBackSilencedCards();
|
|
171
|
+
if (this.watchingQuietHours)
|
|
172
|
+
this.watchQuietHoursStart();
|
|
173
|
+
}, Math.min(wait, QUIET_HOURS_RECHECK_MS));
|
|
174
|
+
}
|
|
175
|
+
stopWatchingQuietHours() {
|
|
176
|
+
clearTimeout(this.quietHoursTimer);
|
|
177
|
+
this.quietHoursTimer = undefined;
|
|
178
|
+
this.watchingQuietHours = false;
|
|
179
|
+
}
|
|
132
180
|
unawaited(reason, result) {
|
|
133
181
|
void Promise.resolve(result).catch((error) => this.log.debug(reason, error));
|
|
134
182
|
}
|
|
@@ -24,3 +24,21 @@ export function isInQuietHours(settings, now) {
|
|
|
24
24
|
return minutes >= start && minutes < end;
|
|
25
25
|
return minutes >= start || minutes < end;
|
|
26
26
|
}
|
|
27
|
+
export function nextQuietHoursStart(settings, now) {
|
|
28
|
+
if (!settings.quietHoursEnabled)
|
|
29
|
+
return null;
|
|
30
|
+
const start = parseTime(settings.quietHoursStart);
|
|
31
|
+
if (start === null)
|
|
32
|
+
return null;
|
|
33
|
+
for (let day = 0; day <= 7; day++) {
|
|
34
|
+
for (const minute of start === 0 ? [0] : [0, start]) {
|
|
35
|
+
const candidate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + day, 0, minute);
|
|
36
|
+
if (candidate.getTime() <= now.getTime())
|
|
37
|
+
continue;
|
|
38
|
+
const before = new Date(candidate.getTime() - 60_000);
|
|
39
|
+
if (isInQuietHours(settings, candidate) && !isInQuietHours(settings, before))
|
|
40
|
+
return candidate;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
@@ -3,8 +3,9 @@ import { toTimelineActions, } from './notificationTimeline';
|
|
|
3
3
|
import { applyNotificationRules, } from './notificationRules';
|
|
4
4
|
import { resolveVendorError, } from '../_internal/platform/vendorErrors';
|
|
5
5
|
import { isInQuietHours } from './quietHours';
|
|
6
|
+
import { deriveImplicitRemindKey } from './toastFilterPolicy';
|
|
6
7
|
import { escapeRegExpCharacters } from '../_internal/base/regExp';
|
|
7
|
-
import { decideFilter, fire } from './fireNotification';
|
|
8
|
+
import { cardPresentation, decideFilter, fire, nativeActionsOf, turnedDownOnCard, } from './fireNotification';
|
|
8
9
|
function toMessage(value) {
|
|
9
10
|
if (typeof value === 'string')
|
|
10
11
|
return value;
|
|
@@ -43,6 +44,15 @@ export function enrichErrorToast(message, options, vendorMatch, onOpenDocs) {
|
|
|
43
44
|
}
|
|
44
45
|
return { text, displayText, bodyText, primaryAction };
|
|
45
46
|
}
|
|
47
|
+
export const suppressedProgressHandle = {
|
|
48
|
+
update: () => undefined,
|
|
49
|
+
success: () => undefined,
|
|
50
|
+
fail: () => undefined,
|
|
51
|
+
dismiss: () => undefined,
|
|
52
|
+
updateActions: () => undefined,
|
|
53
|
+
state: () => 'suppressed',
|
|
54
|
+
onDidChangeState: () => ({ dispose: () => undefined }),
|
|
55
|
+
};
|
|
46
56
|
function applyNotificationRulesFromSettings(input) {
|
|
47
57
|
return applyNotificationRules(input, notificationSettings.get().notificationRules);
|
|
48
58
|
}
|
|
@@ -139,28 +149,31 @@ export function createToast(deps) {
|
|
|
139
149
|
const onCancel = options.onCancel;
|
|
140
150
|
const source = options.source ?? 'general';
|
|
141
151
|
const priority = options.priority ?? 'default';
|
|
152
|
+
const explicitId = options.id !== undefined ? String(options.id) : undefined;
|
|
142
153
|
const decision = decideFilter(source, text, priority, options.dontShowAgainKey, options.recordTimeline);
|
|
143
154
|
if (decision.recordTimeline)
|
|
144
155
|
timeline.add(text, 'info', source, priority);
|
|
145
|
-
if (!decision.showToast
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
};
|
|
156
|
+
if (!decision.showToast &&
|
|
157
|
+
(turnedDownOnCard(source, text, options.dontShowAgainKey) ||
|
|
158
|
+
priority === 'acknowledgment-required')) {
|
|
159
|
+
if (explicitId !== undefined)
|
|
160
|
+
sinks.engine.reject(explicitId);
|
|
161
|
+
return suppressedProgressHandle;
|
|
152
162
|
}
|
|
153
|
-
const id =
|
|
154
|
-
|
|
155
|
-
|
|
163
|
+
const id = explicitId ?? `progress-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
164
|
+
const buttons = (next) => nativeActionsOf(sinks, next.action, next.actions, () => id, source);
|
|
165
|
+
const actions = buttons(options);
|
|
156
166
|
const handle = sinks.engine.notify({
|
|
157
167
|
id,
|
|
158
168
|
severity: 'info',
|
|
159
169
|
title: text,
|
|
170
|
+
...cardPresentation({ ...options, source }),
|
|
160
171
|
source,
|
|
161
172
|
priority,
|
|
162
173
|
sticky: true,
|
|
163
174
|
progress: onCancel ? { onCancel } : {},
|
|
175
|
+
remindKey: deriveImplicitRemindKey(source, text),
|
|
176
|
+
...(actions.length > 0 ? { actions } : {}),
|
|
164
177
|
});
|
|
165
178
|
return {
|
|
166
179
|
update: (next, value) => {
|
|
@@ -191,6 +204,12 @@ export function createToast(deps) {
|
|
|
191
204
|
});
|
|
192
205
|
},
|
|
193
206
|
dismiss: () => handle.close(),
|
|
207
|
+
updateActions: (next) => {
|
|
208
|
+
const replaced = buttons(next);
|
|
209
|
+
handle.update({ actions: replaced.length > 0 ? replaced : undefined });
|
|
210
|
+
},
|
|
211
|
+
state: () => handle.state(),
|
|
212
|
+
onDidChangeState: handle.onDidChangeState,
|
|
194
213
|
};
|
|
195
214
|
},
|
|
196
215
|
};
|