@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
|
@@ -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,18 @@ 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
|
+
}
|
|
36
46
|
export function createNativeNotificationEngine(dependencies) {
|
|
37
47
|
const { getSettings, warn } = dependencies;
|
|
48
|
+
const isSilenced = dependencies.isSilenced ?? (() => false);
|
|
49
|
+
const isTurnedDown = dependencies.isTurnedDown ?? (() => false);
|
|
38
50
|
const now = dependencies.now ?? (() => Date.now());
|
|
39
51
|
const setTimer = dependencies.setTimeout ??
|
|
40
52
|
((callback, timeoutMs) => window.setTimeout(callback, timeoutMs));
|
|
@@ -44,25 +56,26 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
44
56
|
const items = new Map();
|
|
45
57
|
const listeners = new Set();
|
|
46
58
|
const timers = new Map();
|
|
59
|
+
const runs = new Map();
|
|
47
60
|
function snapshot() {
|
|
48
61
|
return [...items.values()].sort((a, b) => a.createdAt - b.createdAt);
|
|
49
62
|
}
|
|
50
|
-
function
|
|
63
|
+
function isClipped(id) {
|
|
51
64
|
const settings = getSettings();
|
|
52
65
|
if (!settings.pauseTimerWhileHidden)
|
|
53
66
|
return false;
|
|
54
|
-
const
|
|
67
|
+
const stack = snapshot().filter(isOnToastStack);
|
|
55
68
|
const cap = Math.max(1, settings.maxVisibleNotifications);
|
|
56
|
-
if (
|
|
69
|
+
if (stack.length <= cap)
|
|
57
70
|
return false;
|
|
58
|
-
const cutoff =
|
|
59
|
-
const idx =
|
|
71
|
+
const cutoff = stack.length - cap;
|
|
72
|
+
const idx = stack.findIndex((entry) => entry.id === id);
|
|
60
73
|
return idx >= 0 && idx < cutoff;
|
|
61
74
|
}
|
|
62
75
|
function reevaluateSchedules() {
|
|
63
76
|
for (const id of items.keys()) {
|
|
64
77
|
if (timers.has(id)) {
|
|
65
|
-
if (
|
|
78
|
+
if (isClipped(id))
|
|
66
79
|
cancelHide(id);
|
|
67
80
|
continue;
|
|
68
81
|
}
|
|
@@ -98,6 +111,55 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
98
111
|
timers.delete(id);
|
|
99
112
|
}
|
|
100
113
|
}
|
|
114
|
+
function runOf(id) {
|
|
115
|
+
const current = runs.get(id);
|
|
116
|
+
if (current)
|
|
117
|
+
return current;
|
|
118
|
+
const run = { state: 'open', changed: new Emitter() };
|
|
119
|
+
runs.set(id, run);
|
|
120
|
+
return run;
|
|
121
|
+
}
|
|
122
|
+
function endRun(id, state) {
|
|
123
|
+
const run = runs.get(id);
|
|
124
|
+
runs.delete(id);
|
|
125
|
+
if (run)
|
|
126
|
+
run.state = state;
|
|
127
|
+
return run;
|
|
128
|
+
}
|
|
129
|
+
function announceEnd(run) {
|
|
130
|
+
if (!run)
|
|
131
|
+
return;
|
|
132
|
+
run.changed.fire(run.state);
|
|
133
|
+
run.changed.dispose();
|
|
134
|
+
}
|
|
135
|
+
function closeCard(id, state) {
|
|
136
|
+
cancelHide(id);
|
|
137
|
+
if (!items.delete(id))
|
|
138
|
+
return;
|
|
139
|
+
const run = endRun(id, state);
|
|
140
|
+
emit();
|
|
141
|
+
announceEnd(run);
|
|
142
|
+
}
|
|
143
|
+
function sendToCenter(item) {
|
|
144
|
+
return { ...item, hidden: true, hovered: false, focused: false };
|
|
145
|
+
}
|
|
146
|
+
function backOnStack(item) {
|
|
147
|
+
return { ...item, hidden: false, createdAt: now() };
|
|
148
|
+
}
|
|
149
|
+
function write(id, patch) {
|
|
150
|
+
const cur = items.get(id);
|
|
151
|
+
if (!cur)
|
|
152
|
+
return;
|
|
153
|
+
const next = { ...cur, ...patch };
|
|
154
|
+
const settles = isProgressRunning(cur) && !isProgressRunning(next);
|
|
155
|
+
if (settles && isSilenced(next)) {
|
|
156
|
+
closeCard(id, 'suppressed');
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
items.set(id, settles && next.hidden ? backOnStack(next) : next);
|
|
160
|
+
emit();
|
|
161
|
+
scheduleHide(id);
|
|
162
|
+
}
|
|
101
163
|
function scheduleHide(id) {
|
|
102
164
|
cancelHide(id);
|
|
103
165
|
const item = items.get(id);
|
|
@@ -105,7 +167,7 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
105
167
|
return;
|
|
106
168
|
if (isSticky(item))
|
|
107
169
|
return;
|
|
108
|
-
if (
|
|
170
|
+
if (isClipped(id))
|
|
109
171
|
return;
|
|
110
172
|
const ms = durationFor(item);
|
|
111
173
|
if (!Number.isFinite(ms) || ms <= 0)
|
|
@@ -119,7 +181,9 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
119
181
|
return;
|
|
120
182
|
recordFade(live.source ?? 'general');
|
|
121
183
|
items.delete(id);
|
|
184
|
+
const run = endRun(id, 'closed');
|
|
122
185
|
emit();
|
|
186
|
+
announceEnd(run);
|
|
123
187
|
}, ms);
|
|
124
188
|
timers.set(id, handle);
|
|
125
189
|
}
|
|
@@ -175,11 +239,13 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
175
239
|
update: () => undefined,
|
|
176
240
|
setProgress: () => undefined,
|
|
177
241
|
close: () => undefined,
|
|
242
|
+
state: () => 'suppressed',
|
|
243
|
+
onDidChangeState: () => NO_SUBSCRIPTION,
|
|
178
244
|
};
|
|
179
245
|
}
|
|
180
246
|
const id = dedupId ?? nextId();
|
|
181
247
|
const previous = items.get(id);
|
|
182
|
-
const
|
|
248
|
+
const issued = {
|
|
183
249
|
...input,
|
|
184
250
|
id,
|
|
185
251
|
createdAt: previous?.createdAt ?? now(),
|
|
@@ -187,7 +253,14 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
187
253
|
hovered: previous?.hovered ?? false,
|
|
188
254
|
focused: previous?.focused ?? false,
|
|
189
255
|
};
|
|
256
|
+
const silenced = isProgressRunning(issued) && isSilenced(issued);
|
|
257
|
+
const next = silenced
|
|
258
|
+
? sendToCenter(issued)
|
|
259
|
+
: previous?.hidden
|
|
260
|
+
? backOnStack(issued)
|
|
261
|
+
: issued;
|
|
190
262
|
items.set(id, next);
|
|
263
|
+
const run = runOf(id);
|
|
191
264
|
if (isNewOnScreen)
|
|
192
265
|
recordFire();
|
|
193
266
|
emit();
|
|
@@ -195,26 +268,16 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
195
268
|
return {
|
|
196
269
|
id,
|
|
197
270
|
update(patch) {
|
|
198
|
-
|
|
199
|
-
if (!cur)
|
|
200
|
-
return;
|
|
201
|
-
items.set(id, { ...cur, ...patch });
|
|
202
|
-
emit();
|
|
203
|
-
scheduleHide(id);
|
|
271
|
+
write(id, patch);
|
|
204
272
|
},
|
|
205
273
|
setProgress(progress) {
|
|
206
|
-
|
|
207
|
-
if (!cur)
|
|
208
|
-
return;
|
|
209
|
-
items.set(id, { ...cur, progress });
|
|
210
|
-
emit();
|
|
211
|
-
scheduleHide(id);
|
|
274
|
+
write(id, { progress });
|
|
212
275
|
},
|
|
213
276
|
close() {
|
|
214
|
-
|
|
215
|
-
if (items.delete(id))
|
|
216
|
-
emit();
|
|
277
|
+
closeCard(id, 'closed');
|
|
217
278
|
},
|
|
279
|
+
state: () => run.state,
|
|
280
|
+
onDidChangeState: (listener, thisArgs) => run.state === 'open' ? run.changed.event(listener, thisArgs) : NO_SUBSCRIPTION,
|
|
218
281
|
};
|
|
219
282
|
}
|
|
220
283
|
function subscribeNotifications(listener) {
|
|
@@ -255,15 +318,52 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
255
318
|
scheduleHide(id);
|
|
256
319
|
}
|
|
257
320
|
function closeNotification(id) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
321
|
+
closeCard(id, 'closed');
|
|
322
|
+
}
|
|
323
|
+
function dismissNotification(id) {
|
|
324
|
+
const cur = items.get(id);
|
|
325
|
+
if (!cur)
|
|
326
|
+
return;
|
|
327
|
+
if (!isProgressRunning(cur) || isTurnedDown(cur)) {
|
|
328
|
+
closeCard(id, 'dismissed');
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (cur.hidden)
|
|
332
|
+
return;
|
|
333
|
+
items.set(id, sendToCenter(cur));
|
|
334
|
+
emit();
|
|
335
|
+
}
|
|
336
|
+
function suppressNotifications(silenced) {
|
|
337
|
+
const picked = [...items.values()].filter((item) => item.hidden !== true && silenced(item));
|
|
338
|
+
if (picked.length === 0)
|
|
339
|
+
return;
|
|
340
|
+
for (const item of picked.filter(isProgressRunning)) {
|
|
341
|
+
items.set(item.id, sendToCenter(item));
|
|
342
|
+
}
|
|
343
|
+
const ended = picked
|
|
344
|
+
.filter((item) => !isProgressRunning(item))
|
|
345
|
+
.map(({ id }) => {
|
|
346
|
+
cancelHide(id);
|
|
347
|
+
items.delete(id);
|
|
348
|
+
return endRun(id, 'suppressed');
|
|
349
|
+
});
|
|
350
|
+
emit();
|
|
351
|
+
for (const run of ended)
|
|
352
|
+
announceEnd(run);
|
|
353
|
+
}
|
|
354
|
+
function rejectNotification(id) {
|
|
355
|
+
if (items.get(id)?.priority === 'acknowledgment-required')
|
|
356
|
+
return;
|
|
357
|
+
closeCard(id, 'suppressed');
|
|
261
358
|
}
|
|
262
359
|
function dispose() {
|
|
263
360
|
for (const id of timers.keys())
|
|
264
361
|
cancelHide(id);
|
|
362
|
+
const ended = [...runs.keys()].map((id) => endRun(id, 'closed'));
|
|
265
363
|
items.clear();
|
|
266
364
|
listeners.clear();
|
|
365
|
+
for (const run of ended)
|
|
366
|
+
announceEnd(run);
|
|
267
367
|
}
|
|
268
368
|
return {
|
|
269
369
|
notify,
|
|
@@ -272,6 +372,9 @@ export function createNativeNotificationEngine(dependencies) {
|
|
|
272
372
|
setFocus: setNotificationFocus,
|
|
273
373
|
toggleExpanded: toggleNotificationExpanded,
|
|
274
374
|
close: closeNotification,
|
|
375
|
+
dismiss: dismissNotification,
|
|
376
|
+
suppress: suppressNotifications,
|
|
377
|
+
reject: rejectNotification,
|
|
275
378
|
dispose,
|
|
276
379
|
};
|
|
277
380
|
}
|
|
@@ -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,8 @@ 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,
|
|
41
54
|
});
|
|
42
55
|
this.stack = this.engine;
|
|
43
56
|
this.timeline = new NotificationTimeline({
|
|
@@ -81,8 +94,17 @@ export class NotificationService {
|
|
|
81
94
|
clearCompiledRuleRegexCache();
|
|
82
95
|
this.sounds.invalidate();
|
|
83
96
|
this.timeline.refreshBadge();
|
|
97
|
+
this.takeBackSilencedCards();
|
|
98
|
+
if (this.watchingQuietHours)
|
|
99
|
+
this.watchQuietHoursStart();
|
|
84
100
|
};
|
|
85
101
|
window.addEventListener(notificationSettings.changeEvent, this.onSettingsChanged);
|
|
102
|
+
this.stopWatchingCards = this.engine.subscribe((items) => {
|
|
103
|
+
if (items.length === 0)
|
|
104
|
+
this.stopWatchingQuietHours();
|
|
105
|
+
else if (!this.watchingQuietHours)
|
|
106
|
+
this.watchQuietHoursStart();
|
|
107
|
+
});
|
|
86
108
|
}
|
|
87
109
|
notify(definition, params) {
|
|
88
110
|
return this.delivery.notify(definition, definition.build(params, this.renderHost));
|
|
@@ -124,11 +146,35 @@ export class NotificationService {
|
|
|
124
146
|
}
|
|
125
147
|
dispose() {
|
|
126
148
|
window.removeEventListener(notificationSettings.changeEvent, this.onSettingsChanged);
|
|
149
|
+
this.stopWatchingCards();
|
|
150
|
+
this.stopWatchingQuietHours();
|
|
127
151
|
this.digest.dispose();
|
|
128
152
|
this.audio.dispose();
|
|
129
153
|
this.engine.dispose();
|
|
130
154
|
this.navigation.dispose();
|
|
131
155
|
}
|
|
156
|
+
takeBackSilencedCards() {
|
|
157
|
+
this.engine.suppress(silencedCard);
|
|
158
|
+
}
|
|
159
|
+
watchQuietHoursStart() {
|
|
160
|
+
this.stopWatchingQuietHours();
|
|
161
|
+
this.watchingQuietHours = true;
|
|
162
|
+
const next = nextQuietHoursStart(notificationSettings.get(), new Date());
|
|
163
|
+
if (next === null)
|
|
164
|
+
return;
|
|
165
|
+
const wait = Math.max(0, next.getTime() - Date.now());
|
|
166
|
+
this.quietHoursTimer = setTimeout(() => {
|
|
167
|
+
this.quietHoursTimer = undefined;
|
|
168
|
+
this.takeBackSilencedCards();
|
|
169
|
+
if (this.watchingQuietHours)
|
|
170
|
+
this.watchQuietHoursStart();
|
|
171
|
+
}, Math.min(wait, QUIET_HOURS_RECHECK_MS));
|
|
172
|
+
}
|
|
173
|
+
stopWatchingQuietHours() {
|
|
174
|
+
clearTimeout(this.quietHoursTimer);
|
|
175
|
+
this.quietHoursTimer = undefined;
|
|
176
|
+
this.watchingQuietHours = false;
|
|
177
|
+
}
|
|
132
178
|
unawaited(reason, result) {
|
|
133
179
|
void Promise.resolve(result).catch((error) => this.log.debug(reason, error));
|
|
134
180
|
}
|
|
@@ -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
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Show, createEffect, createSignal, createUniqueId, on, onCleanup, } from 'solid-js';
|
|
2
2
|
import { OverlayPortal } from './OverlayPortal';
|
|
3
3
|
import { Button } from '../forms/Button';
|
|
4
|
+
import { Checkbox } from '../forms/Checkbox';
|
|
4
5
|
import { Input } from '../forms/Input';
|
|
5
6
|
import { Textarea } from '../forms/Textarea';
|
|
6
7
|
import { createDialogFocusScope } from './dialogFocusScope';
|
|
@@ -18,6 +19,8 @@ const hostDocOf = (host) => (host?.() ?? getMainWindow().window).document;
|
|
|
18
19
|
export function ConfirmDialog(props) {
|
|
19
20
|
const titleId = createUniqueId();
|
|
20
21
|
const placeId = createUniqueId();
|
|
22
|
+
const messageId = createUniqueId();
|
|
23
|
+
const describedBy = () => props.place ? `${placeId} ${messageId}` : messageId;
|
|
21
24
|
const [remaining, setRemaining] = createSignal(0);
|
|
22
25
|
createEffect(() => {
|
|
23
26
|
if (!props.open()) {
|
|
@@ -34,6 +37,12 @@ export function ConfirmDialog(props) {
|
|
|
34
37
|
}, 1000);
|
|
35
38
|
onCleanup(() => host.clearInterval(id));
|
|
36
39
|
});
|
|
40
|
+
const [checked, setChecked] = createSignal(false);
|
|
41
|
+
createEffect(on(() => props.open(), (open) => {
|
|
42
|
+
if (open)
|
|
43
|
+
setChecked(props.checkbox?.checked ?? false);
|
|
44
|
+
}));
|
|
45
|
+
const answer = () => props.checkbox ? { checkboxChecked: checked() } : {};
|
|
37
46
|
const focusScope = createDialogFocusScope({
|
|
38
47
|
open: () => props.open(),
|
|
39
48
|
ownerDocument: () => hostDocOf(props.host),
|
|
@@ -41,12 +50,31 @@ export function ConfirmDialog(props) {
|
|
|
41
50
|
let dialogElement = null;
|
|
42
51
|
const overlayGuard = createOverlayCloseGuard();
|
|
43
52
|
const handleOverlayMouseDown = (event) => {
|
|
44
|
-
|
|
53
|
+
const onOverlay = event.target === event.currentTarget;
|
|
54
|
+
overlayGuard.noteMouseDown(onOverlay);
|
|
55
|
+
if (onOverlay && props.sticky)
|
|
56
|
+
event.preventDefault();
|
|
45
57
|
};
|
|
46
58
|
const handleOverlayClick = (event) => {
|
|
47
|
-
if (overlayGuard.shouldCloseOnClick(event.target === event.currentTarget)
|
|
48
|
-
props.
|
|
59
|
+
if (overlayGuard.shouldCloseOnClick(event.target === event.currentTarget) &&
|
|
60
|
+
!props.sticky) {
|
|
61
|
+
props.onCancel(answer());
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const handleOverlayKeyDown = (event) => {
|
|
65
|
+
if (event.target !== event.currentTarget)
|
|
66
|
+
return;
|
|
67
|
+
const intent = resolveDialogShellKeyIntent(event.key, {
|
|
68
|
+
confirmOnEnter: false,
|
|
69
|
+
});
|
|
70
|
+
if (intent === 'dismiss') {
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
if (!props.sticky)
|
|
73
|
+
props.onCancel(answer());
|
|
74
|
+
return;
|
|
49
75
|
}
|
|
76
|
+
if (intent === 'trap' && dialogElement)
|
|
77
|
+
trapTabFocusWithin(dialogElement, event);
|
|
50
78
|
};
|
|
51
79
|
const handleKeyDown = (event) => {
|
|
52
80
|
const intent = resolveDialogShellKeyIntent(event.key, {
|
|
@@ -54,7 +82,8 @@ export function ConfirmDialog(props) {
|
|
|
54
82
|
});
|
|
55
83
|
if (intent === 'dismiss') {
|
|
56
84
|
event.stopPropagation();
|
|
57
|
-
props.
|
|
85
|
+
if (!props.sticky)
|
|
86
|
+
props.onCancel(answer());
|
|
58
87
|
return;
|
|
59
88
|
}
|
|
60
89
|
if (intent === 'trap' && dialogElement)
|
|
@@ -69,18 +98,17 @@ export function ConfirmDialog(props) {
|
|
|
69
98
|
const buttons = Array.from(el.querySelectorAll('button:not([disabled])'));
|
|
70
99
|
const isDanger = (props.variant ?? 'default') === 'danger';
|
|
71
100
|
const targetBtn = isDanger
|
|
72
|
-
?
|
|
101
|
+
? props.sticky
|
|
102
|
+
? undefined
|
|
103
|
+
: (buttons.find((b) => b.textContent === (props.cancelLabel ?? t('Cancel'))) ?? buttons[0])
|
|
73
104
|
: (buttons[buttons.length - 1] ?? buttons[0]);
|
|
74
105
|
(targetBtn ?? el).focus();
|
|
75
106
|
});
|
|
76
107
|
};
|
|
77
108
|
return (<Show when={props.open()}>
|
|
78
109
|
<OverlayPortal modal mount={hostDocOf(props.host).body} idPrefix="confirm-dialog">
|
|
79
|
-
<div class={styles.overlay} tabIndex={-1} onMouseDown={handleOverlayMouseDown} onClick={handleOverlayClick} onKeyDown={
|
|
80
|
-
|
|
81
|
-
props.onCancel();
|
|
82
|
-
}}>
|
|
83
|
-
<div ref={captureAndFocus} class={styles.dialog} role="alertdialog" aria-modal="true" aria-labelledby={titleId} aria-describedby={props.place ? placeId : undefined} tabIndex={-1} onKeyDown={handleKeyDown}>
|
|
110
|
+
<div class={styles.overlay} tabIndex={-1} onMouseDown={handleOverlayMouseDown} onClick={handleOverlayClick} onKeyDown={handleOverlayKeyDown}>
|
|
111
|
+
<div ref={captureAndFocus} class={styles.dialog} role="alertdialog" aria-modal="true" aria-labelledby={titleId} aria-describedby={describedBy()} tabIndex={-1} onKeyDown={handleKeyDown}>
|
|
84
112
|
<div class={styles.header}>
|
|
85
113
|
<h3 id={titleId} class={styles.title}>
|
|
86
114
|
{props.title}
|
|
@@ -90,7 +118,9 @@ export function ConfirmDialog(props) {
|
|
|
90
118
|
<Show when={props.place}>
|
|
91
119
|
{(place) => <ActionPlaceRow id={placeId} place={place()}/>}
|
|
92
120
|
</Show>
|
|
93
|
-
<p class={styles.message}>
|
|
121
|
+
<p id={messageId} class={styles.message}>
|
|
122
|
+
{props.message}
|
|
123
|
+
</p>
|
|
94
124
|
<Show when={props.code}>
|
|
95
125
|
{(code) => (<OverlayScrollArea rootClass={styles.codeScroll} viewportClass={styles.code}>
|
|
96
126
|
<pre class={styles.codePre} aria-label={t('Statement')}>
|
|
@@ -98,14 +128,21 @@ export function ConfirmDialog(props) {
|
|
|
98
128
|
</pre>
|
|
99
129
|
</OverlayScrollArea>)}
|
|
100
130
|
</Show>
|
|
131
|
+
<Show when={props.checkbox}>
|
|
132
|
+
{(checkbox) => (<Checkbox class={styles.checkbox} checked={checked()} onChange={setChecked}>
|
|
133
|
+
{checkbox().label}
|
|
134
|
+
</Checkbox>)}
|
|
135
|
+
</Show>
|
|
101
136
|
</div>
|
|
102
137
|
<div class={styles.footer}>
|
|
103
|
-
<
|
|
104
|
-
{props.
|
|
105
|
-
|
|
138
|
+
<Show when={!props.sticky}>
|
|
139
|
+
<Button size="lg" variant="secondary" onClick={() => props.onCancel(answer())}>
|
|
140
|
+
{props.cancelLabel ?? t('Cancel')}
|
|
141
|
+
</Button>
|
|
142
|
+
</Show>
|
|
106
143
|
<Button size="lg" variant={(props.variant ?? 'default') === 'danger'
|
|
107
144
|
? 'dangerSolid'
|
|
108
|
-
: 'primary'} disabled={remaining() > 0} onClick={() => props.onConfirm()}>
|
|
145
|
+
: 'primary'} disabled={remaining() > 0} onClick={() => props.onConfirm(answer())}>
|
|
109
146
|
{remaining() > 0
|
|
110
147
|
? t('{label} ({seconds})', {
|
|
111
148
|
label: props.confirmLabel ?? t('Confirm'),
|
|
@@ -121,6 +158,7 @@ export function ConfirmDialog(props) {
|
|
|
121
158
|
}
|
|
122
159
|
export function SaveDiscardDialog(props) {
|
|
123
160
|
const titleId = createUniqueId();
|
|
161
|
+
const messageId = createUniqueId();
|
|
124
162
|
const focusScope = createDialogFocusScope({
|
|
125
163
|
open: () => props.open(),
|
|
126
164
|
ownerDocument: () => hostDocOf(props.host),
|
|
@@ -164,14 +202,16 @@ export function SaveDiscardDialog(props) {
|
|
|
164
202
|
if (isKey(e, 'Escape'))
|
|
165
203
|
props.onChoice('cancel');
|
|
166
204
|
}}>
|
|
167
|
-
<div ref={captureAndFocus} class={styles.dialog} role="alertdialog" aria-modal="true" aria-labelledby={titleId} tabIndex={-1} onKeyDown={handleKeyDown}>
|
|
205
|
+
<div ref={captureAndFocus} class={styles.dialog} role="alertdialog" aria-modal="true" aria-labelledby={titleId} aria-describedby={messageId} tabIndex={-1} onKeyDown={handleKeyDown}>
|
|
168
206
|
<div class={styles.header}>
|
|
169
207
|
<h3 id={titleId} class={styles.title}>
|
|
170
208
|
{props.title}
|
|
171
209
|
</h3>
|
|
172
210
|
</div>
|
|
173
211
|
<div class={styles.body}>
|
|
174
|
-
<p class={styles.message}>
|
|
212
|
+
<p id={messageId} class={styles.message}>
|
|
213
|
+
{props.message}
|
|
214
|
+
</p>
|
|
175
215
|
</div>
|
|
176
216
|
<div class={styles.footer}>
|
|
177
217
|
<Button size="lg" variant="secondary" onClick={() => props.onChoice('cancel')}>
|
|
@@ -8,6 +8,7 @@ export default {
|
|
|
8
8
|
"title": "vk_title_0fm8I vk_titleLg_Iswm3",
|
|
9
9
|
"body": "vk_body_U-3RF",
|
|
10
10
|
"message": "vk_message_UsUIn",
|
|
11
|
+
"checkbox": "vk_checkbox_P8FRX",
|
|
11
12
|
"promptField": "vk_promptField_jlrF3",
|
|
12
13
|
"footer": "vk_footer_orvoX",
|
|
13
14
|
"codeScroll": "vk_codeScroll_rzK59",
|