@vokril/ui-solid 0.29.0 → 0.31.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 +71 -0
- package/README.md +27 -0
- package/dist/{AttributeGrid-eND8YDby.cjs → AttributeGrid-Ch1k9v5j.cjs} +1 -1
- package/dist/{AttributeGrid-CASILa4u.js → AttributeGrid-DqFd4gBm.js} +3 -3
- package/dist/Button-4meERfnv.js +300 -0
- package/dist/Button-OyZHrl-t.cjs +1 -0
- package/dist/CommandPalette-CxYZUJtN.cjs +2 -0
- package/dist/{CommandPalette-Cj618AOz.js → CommandPalette-DwOp8y1-.js} +1467 -1466
- package/dist/{CopyButton-B5gS2ft3.cjs → CopyButton-16QNPgz6.cjs} +1 -1
- package/dist/{CopyButton-g-WSiBDZ.js → CopyButton-BVS49lMS.js} +1 -1
- package/dist/{DateRangePicker-CJD9ADgB.js → DateRangePicker-8QvydugY.js} +4 -4
- package/dist/{DateRangePicker-Frc0HVxp.cjs → DateRangePicker-DI-06xWY.cjs} +1 -1
- package/dist/{GuidedTour-B6q7lYhn.cjs → GuidedTour-DUQwdW8n.cjs} +1 -1
- package/dist/{GuidedTour-CFCvRJN4.js → GuidedTour-DXMmHn0o.js} +2 -2
- package/dist/{HostPortal-CXGUUhP8.js → HostPortal-Ba3MD9CG.js} +1 -1
- package/dist/HostPortal-CpWsArs6.cjs +1 -0
- package/dist/{IconPicker-DYqNi5ud.js → IconPicker-D1G8HK92.js} +3 -3
- package/dist/{IconPicker-CIbJb1ei.cjs → IconPicker-Q-ZDtNkd.cjs} +1 -1
- package/dist/Input-Brp5EDhg.cjs +1 -0
- package/dist/Input-CZi8KEfm.js +374 -0
- package/dist/Modal-CBi7Wd2V.cjs +1 -0
- package/dist/Modal-iyY1HUtr.js +588 -0
- package/dist/{PageSkeleton-BPbb28-H.cjs → PageSkeleton-B_-4fz1q.cjs} +1 -1
- package/dist/{PageSkeleton-CLnJO6uD.js → PageSkeleton-zNyjLPlk.js} +3 -3
- package/dist/{Popover-Cttb6NYT.js → Popover-DVi179wu.js} +4 -3
- package/dist/Popover-DXrczbt9.cjs +1 -0
- package/dist/{SearchableSelect-BvCm4enQ.js → SearchableSelect-DtHbWJhR.js} +34 -33
- package/dist/SearchableSelect-yLVqCGFo.cjs +1 -0
- package/dist/StatusBarNotificationBell-DQs5g1K6.cjs +50 -0
- package/dist/{StatusBarNotificationBell-7Izs_msz.js → StatusBarNotificationBell-ZTEhZFmJ.js} +4279 -4002
- package/dist/{Stepper-D9i1Xclm.js → Stepper-CyRgzWlR.js} +1 -1
- package/dist/{Stepper-Ci5JpLbS.cjs → Stepper-u2ZsE5oP.cjs} +1 -1
- package/dist/{Textarea-CeAGf08O.cjs → Textarea-DASNQNoi.cjs} +1 -1
- package/dist/{Textarea-B5QqqKnI.js → Textarea-szHXQahi.js} +1 -1
- package/dist/{TimeSeriesChart-DOwi2lJs.js → TimeSeriesChart-D7lIqolp.js} +1 -1
- package/dist/{TimeSeriesChart-huvheefm.cjs → TimeSeriesChart-DGzM9B--.cjs} +1 -1
- package/dist/{ToggleButton-CFM8P3JY.js → ToggleButton-B22PsCqo.js} +61 -60
- package/dist/ToggleButton-DWslrIBN.cjs +1 -0
- package/dist/_internal/contract/notification.d.cts +9 -0
- package/dist/_internal/contract/notification.d.ts +9 -0
- package/dist/_internal/contract/notificationCatalog.d.cts +2 -0
- package/dist/_internal/contract/notificationCatalog.d.ts +2 -0
- package/dist/_internal/platform/settings/settingsTypes.d.cts +0 -8
- package/dist/_internal/platform/settings/settingsTypes.d.ts +0 -8
- package/dist/anchoredLayout-CBjQ1etD.cjs +1 -0
- package/dist/anchoredLayout-E0mqCWxk.js +233 -0
- package/dist/appThemeDerivation-BylmT80v.cjs +1 -0
- package/dist/{appThemeDerivation-CKoSe4KP.js → appThemeDerivation-DBAOkGl7.js} +260 -231
- package/dist/base.css +2 -2
- package/dist/charts/index.cjs +1 -1
- package/dist/charts/index.js +1 -1
- package/dist/context/DesktopContextMenuContext.d.cts +8 -1
- package/dist/context/DesktopContextMenuContext.d.ts +8 -1
- package/dist/createDialogShellFocus-CQ0VNC2g.cjs +1 -0
- package/dist/{createDialogShellFocus-B4piXDU4.js → createDialogShellFocus-DbiQmLgb.js} +9 -9
- package/dist/createResizableSidebar-COlpGQ7H.cjs +1 -0
- package/dist/createResizableSidebar-cmCKTIg_.js +504 -0
- package/dist/desktop/index.cjs +1 -1
- package/dist/desktop/index.js +3 -3
- package/dist/dialogFocusRestore-BhxVTSiP.js +10 -0
- package/dist/dialogFocusRestore-DP5b1bDo.cjs +1 -0
- package/dist/feedback/index.cjs +1 -1
- package/dist/feedback/index.js +3 -3
- package/dist/forms/Input.d.cts +20 -0
- package/dist/forms/Input.d.ts +20 -0
- package/dist/forms/InputMessage.d.cts +19 -0
- package/dist/forms/InputMessage.d.ts +19 -0
- package/dist/forms/index.cjs +1 -1
- package/dist/forms/index.js +9 -9
- package/dist/grid/index.cjs +1 -1
- package/dist/grid/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +547 -541
- package/dist/layout/index.cjs +1 -1
- package/dist/layout/index.js +2 -2
- package/dist/layout/resizeCarry.d.cts +17 -0
- package/dist/layout/resizeCarry.d.ts +17 -0
- package/dist/mainRealmDom-B215swW-.js +166 -0
- package/dist/mainRealmDom-BYGSE-fo.cjs +1 -0
- package/dist/nativeTitleHold-A9jUISgQ.js +170 -0
- package/dist/nativeTitleHold-B7Ou-W9b.cjs +1 -0
- package/dist/navigation/index.cjs +1 -1
- package/dist/navigation/index.js +1 -1
- package/dist/notifications/NotificationItem.d.cts +9 -0
- package/dist/notifications/NotificationItem.d.ts +9 -0
- package/dist/notifications/NotificationsCenter.d.cts +18 -0
- package/dist/notifications/NotificationsCenter.d.ts +18 -0
- package/dist/notifications/RunningProgressCards.d.cts +3 -0
- package/dist/notifications/RunningProgressCards.d.ts +3 -0
- package/dist/notifications/fireNotification.d.cts +35 -16
- package/dist/notifications/fireNotification.d.ts +35 -16
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.d.cts +1 -0
- package/dist/notifications/index.d.ts +1 -0
- package/dist/notifications/index.js +55 -52
- package/dist/notifications/nativeEngine.d.cts +4 -3
- package/dist/notifications/nativeEngine.d.ts +4 -3
- package/dist/notifications/notificationEntryList.d.cts +91 -0
- package/dist/notifications/notificationEntryList.d.ts +91 -0
- package/dist/notifications/notificationService.d.cts +23 -2
- package/dist/notifications/notificationService.d.ts +23 -2
- package/dist/notifications/toast.d.cts +3 -0
- package/dist/notifications/toast.d.ts +3 -0
- package/dist/notifications/toastCorner.d.cts +8 -0
- package/dist/notifications/toastCorner.d.ts +8 -0
- package/dist/notifications/toastFilterPolicy.d.cts +33 -1
- package/dist/notifications/toastFilterPolicy.d.ts +33 -1
- package/dist/overlay/Modal.d.cts +6 -0
- package/dist/overlay/Modal.d.ts +6 -0
- package/dist/overlay/backgroundInert.d.cts +6 -2
- package/dist/overlay/backgroundInert.d.ts +6 -2
- package/dist/overlay/command-palette/CommandPalette.d.cts +12 -0
- package/dist/overlay/command-palette/CommandPalette.d.ts +12 -0
- package/dist/overlay/index.cjs +1 -1
- package/dist/overlay/index.js +70 -68
- package/dist/overlay/nativeTitleHold.d.cts +24 -0
- package/dist/overlay/nativeTitleHold.d.ts +24 -0
- package/dist/ownerAnimationFrame-DzFcMSmn.js +19 -0
- package/dist/ownerAnimationFrame-T6jf6qYC.cjs +1 -0
- package/dist/server/{AttributeGrid-CMi-UtWb.js → AttributeGrid-Bpjlauuz.js} +2 -2
- package/dist/server/{AttributeGrid-B7sb3btp.cjs → AttributeGrid-DNYdKb8J.cjs} +1 -1
- package/dist/server/CommandPalette-BuVxnqBG.cjs +1 -0
- package/dist/server/{CommandPalette-CozogFlk.js → CommandPalette-Dn3NKXPM.js} +1095 -1069
- package/dist/server/{DateRangePicker-KLZzyuPJ.cjs → DateRangePicker-BFzNjaME.cjs} +1 -1
- package/dist/server/{DateRangePicker-C35q8BTw.js → DateRangePicker-CnYkTgXX.js} +3 -3
- package/dist/server/{GuidedTour-DmLbBttx.js → GuidedTour-BZardPYW.js} +1 -1
- package/dist/server/{GuidedTour-DfV0yzqh.cjs → GuidedTour-yhdZk2SU.cjs} +1 -1
- package/dist/server/{HostPortal-CXGUUhP8.js → HostPortal-C4IrAeWN.js} +1 -1
- package/dist/server/HostPortal-D5ECrJvn.cjs +1 -0
- package/dist/server/{IconPicker-B1soopAp.cjs → IconPicker-C5lAN9pX.cjs} +1 -1
- package/dist/server/{IconPicker-B4aXspLw.js → IconPicker-DDWgB7sm.js} +3 -3
- package/dist/server/Input-AdF-i0O8.js +245 -0
- package/dist/server/Input-XF9Jr0G9.cjs +1 -0
- package/dist/server/{Modal-BheFQLs1.js → Modal-C5dzgcRW.js} +102 -97
- package/dist/server/{Modal-BswxV8Pn.cjs → Modal-nAhBS1L9.cjs} +1 -1
- package/dist/server/Popover-C5avmGWz.cjs +1 -0
- package/dist/server/{Popover-Cg28aPUZ.js → Popover-H3AAYZI0.js} +57 -57
- package/dist/server/{SearchableSelect-09ECcDlB.cjs → SearchableSelect-CZrXDKfC.cjs} +1 -1
- package/dist/server/{SearchableSelect-vjhS4c-H.js → SearchableSelect-DMqed5Er.js} +1 -1
- package/dist/server/StatusBarNotificationBell-CGcMdT4h.cjs +49 -0
- package/dist/server/{StatusBarNotificationBell-D8Jt3PXI.js → StatusBarNotificationBell-DW2l5O9B.js} +4216 -3949
- package/dist/server/{Stepper-DxNrskdq.cjs → Stepper-CpapA_WH.cjs} +1 -1
- package/dist/server/{Stepper-n5f9r-ye.js → Stepper-gGA7JwjV.js} +1 -1
- package/dist/server/{Textarea-BQf2lL59.cjs → Textarea-Bh5LVrBn.cjs} +1 -1
- package/dist/server/{Textarea-BTH48NET.js → Textarea-DVkfGkP0.js} +1 -1
- package/dist/server/{ToggleButton-TE3Xf2yD.cjs → ToggleButton-CA9T-OsI.cjs} +1 -1
- package/dist/server/{ToggleButton-FywO2CCI.js → ToggleButton-CBNKajZa.js} +4 -4
- package/dist/server/{VpTrash-Dlq8o6Uv.js → VpTrash-CZMWCIpF.js} +84 -70
- package/dist/server/VpTrash-DiczWhwm.cjs +1 -0
- package/dist/server/appThemeDerivation-BylmT80v.cjs +1 -0
- package/dist/server/{appThemeDerivation-CKoSe4KP.js → appThemeDerivation-DBAOkGl7.js} +260 -231
- package/dist/server/{createDialogShellFocus-BiBAZOCI.cjs → createDialogShellFocus-CDaLuPg8.cjs} +1 -1
- package/dist/server/{createDialogShellFocus-BFo8awdj.js → createDialogShellFocus-LGDBOVnr.js} +6 -6
- package/dist/server/{createResizableSidebar-BImbKlLe.js → createResizableSidebar-Dvu7iEk1.js} +1 -1
- package/dist/server/{createResizableSidebar-GFgZIj-5.cjs → createResizableSidebar-v40ZOb-Q.cjs} +1 -1
- package/dist/server/desktop/index.cjs +1 -1
- package/dist/server/desktop/index.js +3 -3
- package/dist/server/dialogFocusRestore-BhxVTSiP.js +10 -0
- package/dist/server/dialogFocusRestore-DP5b1bDo.cjs +1 -0
- package/dist/server/forms/index.cjs +1 -1
- package/dist/server/forms/index.js +7 -7
- package/dist/server/grid/index.cjs +1 -1
- package/dist/server/grid/index.js +1 -1
- package/dist/server/{index-UIjsx3oJ.js → index-BEARfm54.js} +3604 -3617
- package/dist/server/index-C6rYfWCJ.cjs +1 -0
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +502 -497
- 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 +55 -52
- package/dist/server/overlay/index.cjs +1 -1
- package/dist/server/overlay/index.js +54 -53
- package/dist/server/tokens/index.cjs +1 -1
- package/dist/server/tokens/index.js +30 -28
- package/dist/solid/feedback/Badge.jsx +3 -14
- package/dist/solid/forms/Button.jsx +3 -14
- package/dist/solid/forms/Input.jsx +31 -5
- package/dist/solid/forms/Input.module.css.js +1 -0
- package/dist/solid/forms/InputMessage.jsx +86 -0
- package/dist/solid/forms/PressableSurface.jsx +3 -14
- package/dist/solid/layout/ResizeHandle.jsx +11 -1
- package/dist/solid/layout/resizeCarry.js +31 -0
- package/dist/solid/notifications/NotificationHost.jsx +5 -18
- package/dist/solid/notifications/NotificationItem.jsx +5 -5
- package/dist/solid/notifications/NotificationPanel.jsx +14 -4
- package/dist/solid/notifications/NotificationsCenter.jsx +70 -12
- package/dist/solid/notifications/RunningProgressCards.jsx +1 -1
- package/dist/solid/notifications/StatusBarNotificationBell.jsx +8 -3
- package/dist/solid/notifications/catalogAdapter.js +1 -0
- package/dist/solid/notifications/fireNotification.js +21 -16
- package/dist/solid/notifications/index.js +1 -0
- package/dist/solid/notifications/notificationEntryList.js +168 -0
- package/dist/solid/notifications/notificationService.js +20 -4
- package/dist/solid/notifications/toast.js +54 -7
- package/dist/solid/notifications/toastCorner.js +3 -0
- package/dist/solid/notifications/toastFilterPolicy.js +12 -0
- package/dist/solid/overlay/Drawer.jsx +2 -1
- package/dist/solid/overlay/Modal.jsx +42 -4
- package/dist/solid/overlay/command-palette/CommandPalette.jsx +4 -4
- package/dist/solid/overlay/context-menu/DesktopContextMenu.jsx +8 -7
- package/dist/solid/overlay/nativeTitleHold.js +33 -0
- package/dist/solid/overlay/tooltipDirective.js +3 -11
- package/dist/solid/tokens/index.js +1 -0
- package/dist/solid/tokens/palette/paletteContract.js +27 -0
- package/dist/style.css +2 -2
- package/dist/theme.css +1 -1
- package/dist/tokens/index.cjs +1 -1
- package/dist/tokens/index.d.cts +1 -0
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +30 -28
- package/dist/tokens/palette/paletteContract.d.cts +17 -0
- package/dist/tokens/palette/paletteContract.d.ts +17 -0
- package/dist/tokens/tokens.css +1 -1
- package/dist/ui.css +1 -1
- package/package.json +1 -1
- package/dist/Button-Bb68ymNP.cjs +0 -1
- package/dist/Button-D-T0tyGF.js +0 -305
- package/dist/CommandPalette-5FQRgPG9.cjs +0 -2
- package/dist/HostPortal-CgJwxt-f.cjs +0 -1
- package/dist/Input-CZruORyy.cjs +0 -1
- package/dist/Input-DkPhsdfk.js +0 -227
- package/dist/Modal-CY6ePolt.cjs +0 -1
- package/dist/Modal-NzZzHSwb.js +0 -559
- package/dist/Popover-CWrR51eG.cjs +0 -1
- package/dist/SearchableSelect-CVqdVMOC.cjs +0 -1
- package/dist/StatusBarNotificationBell-BJiORN4s.cjs +0 -50
- package/dist/ToggleButton-BFWh1_o5.cjs +0 -1
- package/dist/anchoredLayout-Dstwa5OH.cjs +0 -1
- package/dist/anchoredLayout-FC-qv8xm.js +0 -250
- package/dist/appThemeDerivation-Be_oKljl.cjs +0 -1
- package/dist/createDialogShellFocus-CJaw9-B9.cjs +0 -1
- package/dist/createResizableSidebar-BDUlX9-G.js +0 -472
- package/dist/createResizableSidebar-BVJBU2kP.cjs +0 -1
- package/dist/dialogFocusRestore--dH59ER2.js +0 -35
- package/dist/dialogFocusRestore-CL-ExfAA.cjs +0 -1
- package/dist/mainRealmDom-C12lr9lm.js +0 -171
- package/dist/mainRealmDom-S6teqEr4.cjs +0 -1
- package/dist/server/CommandPalette-DQK6N98N.cjs +0 -1
- package/dist/server/HostPortal-CgJwxt-f.cjs +0 -1
- package/dist/server/Input-CjvD8w18.cjs +0 -1
- package/dist/server/Input-DaEN2JJd.js +0 -127
- package/dist/server/Popover-BsxIKBbl.cjs +0 -1
- package/dist/server/StatusBarNotificationBell-LJHLMT9F.cjs +0 -49
- package/dist/server/VpTrash-D49oUUJh.cjs +0 -1
- package/dist/server/appThemeDerivation-Be_oKljl.cjs +0 -1
- package/dist/server/dialogFocusRestore--dH59ER2.js +0 -35
- package/dist/server/dialogFocusRestore-CL-ExfAA.cjs +0 -1
- package/dist/server/index-2mQPVEDR.cjs +0 -1
- package/dist/tooltipCoordinator-BzxEyKhA.js +0 -144
- package/dist/tooltipCoordinator-DslqMlsI.cjs +0 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { createEffect, on, onCleanup, onMount } from 'solid-js';
|
|
2
|
+
import { namedKeyOf } from '../_internal/base/keys';
|
|
3
|
+
import { t } from '../i18n/i18n';
|
|
4
|
+
import { NOTIFICATION_SEVERITY_LABELS } from './notificationSeverityLabels';
|
|
5
|
+
import { resolveNotificationSource } from './notificationSources';
|
|
6
|
+
const ENTRY_ATTRIBUTE = 'data-notification-entry';
|
|
7
|
+
export const notificationEntryMark = { [ENTRY_ATTRIBUTE]: '' };
|
|
8
|
+
const ENTRY_SELECTOR = `[${ENTRY_ATTRIBUTE}]`;
|
|
9
|
+
function entriesUnder(root) {
|
|
10
|
+
return Array.from(root.querySelectorAll(ENTRY_SELECTOR));
|
|
11
|
+
}
|
|
12
|
+
export function focusFirstNotificationEntry(root, options) {
|
|
13
|
+
const first = entriesUnder(root)[0];
|
|
14
|
+
if (first === undefined)
|
|
15
|
+
return false;
|
|
16
|
+
first.focus(options);
|
|
17
|
+
return first.ownerDocument.activeElement === first;
|
|
18
|
+
}
|
|
19
|
+
export function notificationListFocusStep(event, current, count, paging) {
|
|
20
|
+
if (count === 0)
|
|
21
|
+
return null;
|
|
22
|
+
switch (namedKeyOf(event)) {
|
|
23
|
+
case 'ArrowDown':
|
|
24
|
+
return current === null ? 0 : Math.min(count - 1, current + 1);
|
|
25
|
+
case 'ArrowUp':
|
|
26
|
+
return current === null ? count - 1 : Math.max(0, current - 1);
|
|
27
|
+
case 'Home':
|
|
28
|
+
return 0;
|
|
29
|
+
case 'End':
|
|
30
|
+
return count - 1;
|
|
31
|
+
case 'PageUp':
|
|
32
|
+
return paging === 'ends' ? 0 : paging(current, -1);
|
|
33
|
+
case 'PageDown':
|
|
34
|
+
return paging === 'ends' ? count - 1 : paging(current, 1);
|
|
35
|
+
default:
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function lastEndingBy(page, edge) {
|
|
40
|
+
let found = 0;
|
|
41
|
+
page.extents.forEach((extent, index) => {
|
|
42
|
+
if (extent.bottom <= edge)
|
|
43
|
+
found = index;
|
|
44
|
+
});
|
|
45
|
+
return found;
|
|
46
|
+
}
|
|
47
|
+
function firstStartingFrom(page, edge) {
|
|
48
|
+
if (edge <= 0)
|
|
49
|
+
return 0;
|
|
50
|
+
const found = page.extents.findIndex((extent) => extent.top >= edge);
|
|
51
|
+
return found < 0 ? page.extents.length - 1 : found;
|
|
52
|
+
}
|
|
53
|
+
export function notificationListPageStep(page, current, direction) {
|
|
54
|
+
const final = page.extents.length - 1;
|
|
55
|
+
if (direction === 1) {
|
|
56
|
+
const last = lastEndingBy(page, page.scrollTop + page.height);
|
|
57
|
+
if (current === null || last > current)
|
|
58
|
+
return last;
|
|
59
|
+
const scrolled = Math.min(page.maxScrollTop, page.scrollTop + page.height);
|
|
60
|
+
if (scrolled <= page.scrollTop || current >= final)
|
|
61
|
+
return current;
|
|
62
|
+
return Math.min(final, Math.max(current + 1, lastEndingBy(page, scrolled + page.height)));
|
|
63
|
+
}
|
|
64
|
+
const first = firstStartingFrom(page, page.scrollTop);
|
|
65
|
+
if (current === null || first < current)
|
|
66
|
+
return first;
|
|
67
|
+
const scrolled = Math.max(0, page.scrollTop - page.height);
|
|
68
|
+
if (scrolled >= page.scrollTop || current <= 0)
|
|
69
|
+
return current;
|
|
70
|
+
return Math.max(0, Math.min(current - 1, firstStartingFrom(page, scrolled)));
|
|
71
|
+
}
|
|
72
|
+
function measureNotificationListPage(viewport, entries) {
|
|
73
|
+
const origin = viewport.getBoundingClientRect().top + viewport.clientTop - viewport.scrollTop;
|
|
74
|
+
return {
|
|
75
|
+
extents: entries.map((entry) => {
|
|
76
|
+
const rect = entry.getBoundingClientRect();
|
|
77
|
+
return { top: rect.top - origin, bottom: rect.bottom - origin };
|
|
78
|
+
}),
|
|
79
|
+
scrollTop: viewport.scrollTop,
|
|
80
|
+
height: viewport.clientHeight,
|
|
81
|
+
maxScrollTop: Math.max(0, viewport.scrollHeight - viewport.clientHeight),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function isEditable(element) {
|
|
85
|
+
const tag = element.tagName;
|
|
86
|
+
return tag === 'INPUT' || tag === 'TEXTAREA' || element.isContentEditable;
|
|
87
|
+
}
|
|
88
|
+
export function moveNotificationEntryFocus(event, viewport) {
|
|
89
|
+
if (event.defaultPrevented)
|
|
90
|
+
return;
|
|
91
|
+
const target = event.target;
|
|
92
|
+
if (target === null || typeof target.closest !== 'function')
|
|
93
|
+
return;
|
|
94
|
+
if (isEditable(target))
|
|
95
|
+
return;
|
|
96
|
+
const entry = target.closest(ENTRY_SELECTOR);
|
|
97
|
+
if (entry === null)
|
|
98
|
+
return;
|
|
99
|
+
const entries = entriesUnder(viewport);
|
|
100
|
+
const current = entries.indexOf(entry);
|
|
101
|
+
if (current < 0)
|
|
102
|
+
return;
|
|
103
|
+
const next = notificationListFocusStep(event, current, entries.length, (from, direction) => notificationListPageStep(measureNotificationListPage(viewport, entries), from, direction));
|
|
104
|
+
if (next === null)
|
|
105
|
+
return;
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
event.stopPropagation();
|
|
108
|
+
const destination = entries[next];
|
|
109
|
+
if (destination === undefined)
|
|
110
|
+
return;
|
|
111
|
+
destination.focus({ preventScroll: true });
|
|
112
|
+
destination.scrollIntoView({ block: 'nearest' });
|
|
113
|
+
}
|
|
114
|
+
export function followNotificationListFocus(options) {
|
|
115
|
+
let inside = false;
|
|
116
|
+
let lastEntry = null;
|
|
117
|
+
let lastIndex = -1;
|
|
118
|
+
const remember = (container, element) => {
|
|
119
|
+
lastEntry = element.closest(ENTRY_SELECTOR);
|
|
120
|
+
lastIndex = lastEntry === null ? -1 : entriesUnder(container).indexOf(lastEntry);
|
|
121
|
+
};
|
|
122
|
+
onMount(() => {
|
|
123
|
+
const container = options.container();
|
|
124
|
+
if (container === undefined)
|
|
125
|
+
return;
|
|
126
|
+
const doc = container.ownerDocument;
|
|
127
|
+
const onFocusIn = (event) => {
|
|
128
|
+
const target = event.target;
|
|
129
|
+
inside = target !== null && typeof target.closest === 'function' && container.contains(target);
|
|
130
|
+
if (inside && target !== null)
|
|
131
|
+
remember(container, target);
|
|
132
|
+
};
|
|
133
|
+
doc.addEventListener('focusin', onFocusIn, true);
|
|
134
|
+
onCleanup(() => doc.removeEventListener('focusin', onFocusIn, true));
|
|
135
|
+
});
|
|
136
|
+
createEffect(on(options.drawn, () => {
|
|
137
|
+
const container = options.container();
|
|
138
|
+
if (container === undefined || !inside)
|
|
139
|
+
return;
|
|
140
|
+
const doc = container.ownerDocument;
|
|
141
|
+
const active = doc.activeElement;
|
|
142
|
+
if (active !== null && container.contains(active)) {
|
|
143
|
+
remember(container, active);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (active !== null && active !== doc.body)
|
|
147
|
+
return;
|
|
148
|
+
const entries = entriesUnder(container);
|
|
149
|
+
const target = lastEntry !== null && entries.includes(lastEntry)
|
|
150
|
+
? lastEntry
|
|
151
|
+
: (entries[lastIndex - 1] ?? entries[0]);
|
|
152
|
+
if (target !== undefined)
|
|
153
|
+
target.focus();
|
|
154
|
+
else
|
|
155
|
+
options.fallback(container);
|
|
156
|
+
}, { defer: true }));
|
|
157
|
+
return { holdsFocus: () => inside };
|
|
158
|
+
}
|
|
159
|
+
export function timelineEntryAriaLabel(entry) {
|
|
160
|
+
const message = t('{severity}: {title}', {
|
|
161
|
+
severity: t(NOTIFICATION_SEVERITY_LABELS[entry.tone]),
|
|
162
|
+
title: entry.message,
|
|
163
|
+
});
|
|
164
|
+
const source = t('Source: {source}', {
|
|
165
|
+
source: resolveNotificationSource(entry.source).label,
|
|
166
|
+
});
|
|
167
|
+
return `${message}, ${source}`;
|
|
168
|
+
}
|
|
@@ -16,10 +16,10 @@ import { errorActionFailed } from './notifications.notifications';
|
|
|
16
16
|
import { silencedBySettings, turnedDownCard } from './fireNotification';
|
|
17
17
|
import { nextQuietHoursStart } from './quietHours';
|
|
18
18
|
const QUIET_HOURS_RECHECK_MS = 60 * 60_000;
|
|
19
|
-
function silencedCard(item) {
|
|
19
|
+
function silencedCard(item, filter) {
|
|
20
20
|
return (!item.isolated &&
|
|
21
21
|
item.priority !== 'acknowledgment-required' &&
|
|
22
|
-
silencedBySettings(item.source ?? 'general', item.priority ?? 'default'));
|
|
22
|
+
silencedBySettings(item.source ?? 'general', item.severity, item.priority ?? 'default', filter));
|
|
23
23
|
}
|
|
24
24
|
export class NotificationService {
|
|
25
25
|
deps;
|
|
@@ -28,6 +28,9 @@ export class NotificationService {
|
|
|
28
28
|
stack;
|
|
29
29
|
timeline;
|
|
30
30
|
onDidRequestNavigation;
|
|
31
|
+
onDidChangeFilter;
|
|
32
|
+
filter = 'off';
|
|
33
|
+
filterChange = new Emitter();
|
|
31
34
|
engine;
|
|
32
35
|
analytics = new NotificationAnalytics();
|
|
33
36
|
sounds;
|
|
@@ -49,7 +52,7 @@ export class NotificationService {
|
|
|
49
52
|
getSettings: () => notificationSettings.get(),
|
|
50
53
|
recordAutoFade: (source) => this.analytics.recordAutoFade(source),
|
|
51
54
|
warn: (message, error) => log.warn(message, error),
|
|
52
|
-
isSilenced: silencedCard,
|
|
55
|
+
isSilenced: (item) => silencedCard(item, this.filter),
|
|
53
56
|
isTurnedDown: turnedDownCard,
|
|
54
57
|
centerReachable: deps.centerReachable,
|
|
55
58
|
});
|
|
@@ -83,6 +86,7 @@ export class NotificationService {
|
|
|
83
86
|
timeline: this.timeline,
|
|
84
87
|
vendorErrors: deps.vendorErrors,
|
|
85
88
|
openExternal: (url) => openExternalUrl(deps.desktop, log, url),
|
|
89
|
+
filter: () => this.filter,
|
|
86
90
|
});
|
|
87
91
|
this.delivery = createCatalogDelivery({
|
|
88
92
|
toast: this.toast,
|
|
@@ -91,6 +95,7 @@ export class NotificationService {
|
|
|
91
95
|
onActionFailed: (cause) => this.notify(errorActionFailed, { cause }),
|
|
92
96
|
});
|
|
93
97
|
this.onDidRequestNavigation = this.navigation.event;
|
|
98
|
+
this.onDidChangeFilter = this.filterChange.event;
|
|
94
99
|
this.onSettingsChanged = () => {
|
|
95
100
|
clearCompiledRuleRegexCache();
|
|
96
101
|
this.sounds.invalidate();
|
|
@@ -146,6 +151,16 @@ export class NotificationService {
|
|
|
146
151
|
requestNavigation(route) {
|
|
147
152
|
this.navigation.fire(route);
|
|
148
153
|
}
|
|
154
|
+
getFilter() {
|
|
155
|
+
return this.filter;
|
|
156
|
+
}
|
|
157
|
+
setFilter(filter) {
|
|
158
|
+
if (filter === this.filter)
|
|
159
|
+
return;
|
|
160
|
+
this.filter = filter;
|
|
161
|
+
this.takeBackSilencedCards();
|
|
162
|
+
this.filterChange.fire(filter);
|
|
163
|
+
}
|
|
149
164
|
dispose() {
|
|
150
165
|
window.removeEventListener(notificationSettings.changeEvent, this.onSettingsChanged);
|
|
151
166
|
this.stopWatchingCards();
|
|
@@ -154,9 +169,10 @@ export class NotificationService {
|
|
|
154
169
|
this.audio.dispose();
|
|
155
170
|
this.engine.dispose();
|
|
156
171
|
this.navigation.dispose();
|
|
172
|
+
this.filterChange.dispose();
|
|
157
173
|
}
|
|
158
174
|
takeBackSilencedCards() {
|
|
159
|
-
this.engine.suppress(silencedCard);
|
|
175
|
+
this.engine.suppress((item) => silencedCard(item, this.filter));
|
|
160
176
|
}
|
|
161
177
|
watchQuietHoursStart() {
|
|
162
178
|
this.stopWatchingQuietHours();
|
|
@@ -53,6 +53,12 @@ export const suppressedProgressHandle = {
|
|
|
53
53
|
state: () => 'suppressed',
|
|
54
54
|
onDidChangeState: () => ({ dispose: () => undefined }),
|
|
55
55
|
};
|
|
56
|
+
function issueKeysOf(options) {
|
|
57
|
+
return {
|
|
58
|
+
dontShowAgainKey: options.dontShowAgainKey,
|
|
59
|
+
remindKey: options.remindKey,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
56
62
|
function applyNotificationRulesFromSettings(input) {
|
|
57
63
|
return applyNotificationRules(input, notificationSettings.get().notificationRules);
|
|
58
64
|
}
|
|
@@ -70,7 +76,15 @@ export function createToast(deps) {
|
|
|
70
76
|
});
|
|
71
77
|
if (!ruled)
|
|
72
78
|
return '';
|
|
73
|
-
const decision = decideFilter(
|
|
79
|
+
const decision = decideFilter({
|
|
80
|
+
source: ruled.source,
|
|
81
|
+
title: ruled.title,
|
|
82
|
+
severity: ruled.severity,
|
|
83
|
+
priority: ruled.priority,
|
|
84
|
+
recordTimeline: options.recordTimeline,
|
|
85
|
+
filter: deps.filter(),
|
|
86
|
+
...issueKeysOf(options),
|
|
87
|
+
});
|
|
74
88
|
if (decision.recordTimeline)
|
|
75
89
|
timeline.add(ruled.title, ruled.severity, ruled.source, ruled.priority, toTimelineActions(options.action));
|
|
76
90
|
if (!settings.showSuccessToasts && ruled.priority !== 'urgent')
|
|
@@ -101,7 +115,15 @@ export function createToast(deps) {
|
|
|
101
115
|
if (!ruled)
|
|
102
116
|
return '';
|
|
103
117
|
const { source, priority } = ruled;
|
|
104
|
-
const decision = decideFilter(
|
|
118
|
+
const decision = decideFilter({
|
|
119
|
+
source,
|
|
120
|
+
title: ruled.title,
|
|
121
|
+
severity: ruled.severity,
|
|
122
|
+
priority,
|
|
123
|
+
recordTimeline: options.recordTimeline,
|
|
124
|
+
filter: deps.filter(),
|
|
125
|
+
...issueKeysOf(options),
|
|
126
|
+
});
|
|
105
127
|
if (decision.recordTimeline)
|
|
106
128
|
timeline.add(timelineText, ruled.severity, source, priority, toTimelineActions(options.action), options.vendorError);
|
|
107
129
|
const handle = fire(sinks, {
|
|
@@ -125,7 +147,15 @@ export function createToast(deps) {
|
|
|
125
147
|
const settings = notificationSettings.get();
|
|
126
148
|
const source = options.source ?? 'sql-execution';
|
|
127
149
|
const priority = options.priority ?? 'default';
|
|
128
|
-
const decision = decideFilter(
|
|
150
|
+
const decision = decideFilter({
|
|
151
|
+
source,
|
|
152
|
+
title: text,
|
|
153
|
+
severity: 'success',
|
|
154
|
+
priority,
|
|
155
|
+
recordTimeline: options.recordTimeline,
|
|
156
|
+
filter: deps.filter(),
|
|
157
|
+
...issueKeysOf(options),
|
|
158
|
+
});
|
|
129
159
|
if (decision.recordTimeline)
|
|
130
160
|
timeline.add(text, 'success', source, priority, toTimelineActions(options.action));
|
|
131
161
|
if (settings.notificationsEnabled &&
|
|
@@ -150,11 +180,20 @@ export function createToast(deps) {
|
|
|
150
180
|
const source = options.source ?? 'general';
|
|
151
181
|
const priority = options.priority ?? 'default';
|
|
152
182
|
const explicitId = options.id !== undefined ? String(options.id) : undefined;
|
|
153
|
-
const
|
|
183
|
+
const keys = issueKeysOf(options);
|
|
184
|
+
const decision = decideFilter({
|
|
185
|
+
source,
|
|
186
|
+
title: text,
|
|
187
|
+
severity: 'info',
|
|
188
|
+
priority,
|
|
189
|
+
recordTimeline: options.recordTimeline,
|
|
190
|
+
filter: deps.filter(),
|
|
191
|
+
...keys,
|
|
192
|
+
});
|
|
154
193
|
if (decision.recordTimeline)
|
|
155
194
|
timeline.add(text, 'info', source, priority);
|
|
156
195
|
if (!decision.showToast &&
|
|
157
|
-
(turnedDownOnCard(source, text,
|
|
196
|
+
(turnedDownOnCard(source, text, keys) ||
|
|
158
197
|
priority === 'acknowledgment-required')) {
|
|
159
198
|
if (explicitId !== undefined)
|
|
160
199
|
sinks.engine.reject(explicitId);
|
|
@@ -172,7 +211,7 @@ export function createToast(deps) {
|
|
|
172
211
|
priority,
|
|
173
212
|
sticky: true,
|
|
174
213
|
progress: onCancel ? { onCancel } : {},
|
|
175
|
-
remindKey: deriveImplicitRemindKey(source, text),
|
|
214
|
+
remindKey: keys.remindKey ?? keys.dontShowAgainKey ?? deriveImplicitRemindKey(source, text),
|
|
176
215
|
...(actions.length > 0 ? { actions } : {}),
|
|
177
216
|
});
|
|
178
217
|
return {
|
|
@@ -223,7 +262,15 @@ function plainVerb(deps, severity, message, options) {
|
|
|
223
262
|
});
|
|
224
263
|
if (!ruled)
|
|
225
264
|
return '';
|
|
226
|
-
const decision = decideFilter(
|
|
265
|
+
const decision = decideFilter({
|
|
266
|
+
source: ruled.source,
|
|
267
|
+
title: ruled.title,
|
|
268
|
+
severity: ruled.severity,
|
|
269
|
+
priority: ruled.priority,
|
|
270
|
+
recordTimeline: options.recordTimeline,
|
|
271
|
+
filter: deps.filter(),
|
|
272
|
+
...issueKeysOf(options),
|
|
273
|
+
});
|
|
227
274
|
if (decision.recordTimeline)
|
|
228
275
|
deps.timeline.add(ruled.title, ruled.severity, ruled.source, ruled.priority, toTimelineActions(options.action));
|
|
229
276
|
const handle = fire(deps.sinks, {
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
export function filteredPriority(priority, severity, filter) {
|
|
2
|
+
return filter === 'errors-only' &&
|
|
3
|
+
(priority === 'default' || priority === 'optional') &&
|
|
4
|
+
severity !== 'error'
|
|
5
|
+
? 'silent'
|
|
6
|
+
: priority;
|
|
7
|
+
}
|
|
1
8
|
export function deriveImplicitRemindKey(source, title) {
|
|
2
9
|
return `__remind:${source}:${title}`;
|
|
3
10
|
}
|
|
11
|
+
export function cardRemindKey(card) {
|
|
12
|
+
return (card.remindKey ??
|
|
13
|
+
card.neverShowAgainKey ??
|
|
14
|
+
deriveImplicitRemindKey(card.source ?? 'general', card.title));
|
|
15
|
+
}
|
|
4
16
|
export function decideFilter(input, settings, gates) {
|
|
5
17
|
const { priority } = input;
|
|
6
18
|
const allowTimeline = input.recordTimeline !== false;
|
|
@@ -10,6 +10,7 @@ import { createDialogFocusScope } from './dialogFocusScope';
|
|
|
10
10
|
import { trapTabFocusWithin } from './modalFocusContainment';
|
|
11
11
|
import { resolveDialogShellKeyIntent } from './dialogShellKeyIntent';
|
|
12
12
|
import { createOverlayCloseGuard } from './overlayCloseGuard';
|
|
13
|
+
import { modalBackgroundExemption } from './backgroundInert';
|
|
13
14
|
import styles from './Drawer.module.css.js';
|
|
14
15
|
import { isKey } from '../_internal/base/keys';
|
|
15
16
|
export function Drawer(props) {
|
|
@@ -94,7 +95,7 @@ export function Drawer(props) {
|
|
|
94
95
|
});
|
|
95
96
|
return (<Show when={openedIn()}>
|
|
96
97
|
{(doc) => (<Portal mount={props.container ?? doc().body}>
|
|
97
|
-
<div class={`${styles.backdrop} ${contained() ? (styles.contained ?? '') : ''}`} onMouseDown={handleOverlayMouseDown} onClick={handleOverlayClick} aria-hidden="true"/>
|
|
98
|
+
<div class={`${styles.backdrop} ${contained() ? (styles.contained ?? '') : ''}`} onMouseDown={handleOverlayMouseDown} onClick={handleOverlayClick} aria-hidden="true" {...modalBackgroundExemption('dialog-backdrop')}/>
|
|
98
99
|
<div ref={captureAndFocus} class={`${styles.drawer} ${placementClass()} ${sizeClass()} ${contained() ? (styles.contained ?? '') : ''} ${props.class ?? ''}`} role="dialog" aria-modal={contained() ? undefined : 'true'} aria-label={props.ariaLabel ?? props.title ?? t('Drawer')} tabIndex={-1} onKeyDown={handleKeyDown}>
|
|
99
100
|
<header class={styles.header}>
|
|
100
101
|
<Show when={props.title} fallback={<div />}>
|
|
@@ -16,6 +16,7 @@ import { t } from '../i18n/i18n';
|
|
|
16
16
|
import styles from './Modal.module.css.js';
|
|
17
17
|
import { bestEffortFailed } from '../_internal/base/bestEffort';
|
|
18
18
|
import { isKey } from '../_internal/base/keys';
|
|
19
|
+
const RESTORE_DRAG_THRESHOLD_PX = 4;
|
|
19
20
|
const INTERACTIVE_HEADER_SELECTOR = 'button, a, input, select, textarea, label, summary, [role="button"], [role="tab"], [role="menuitem"], [data-no-drag]';
|
|
20
21
|
export function Modal(props) {
|
|
21
22
|
const openedIn = createMemo((previous) => props.embedded || !props.open()
|
|
@@ -204,7 +205,13 @@ export function Modal(props) {
|
|
|
204
205
|
!isExiting() &&
|
|
205
206
|
!isMaximized() &&
|
|
206
207
|
(props.allowDrag ?? true);
|
|
208
|
+
const canRestoreDrag = () => !props.embedded &&
|
|
209
|
+
!isExiting() &&
|
|
210
|
+
isMaximized() &&
|
|
211
|
+
canMaximize() &&
|
|
212
|
+
(props.allowDrag ?? true);
|
|
207
213
|
let cleanupActiveDrag = null;
|
|
214
|
+
let pendingRestore = null;
|
|
208
215
|
let isDraggingPointer = false;
|
|
209
216
|
let dragPointerId = null;
|
|
210
217
|
let dragStartPointer = { x: 0, y: 0 };
|
|
@@ -300,7 +307,7 @@ export function Modal(props) {
|
|
|
300
307
|
const handlePointerDown = (e) => {
|
|
301
308
|
if (e.button !== undefined && e.button !== 0)
|
|
302
309
|
return;
|
|
303
|
-
if (!canDrag())
|
|
310
|
+
if (!canDrag() && !canRestoreDrag())
|
|
304
311
|
return;
|
|
305
312
|
const target = e.target;
|
|
306
313
|
if (target?.closest(INTERACTIVE_HEADER_SELECTOR)) {
|
|
@@ -325,6 +332,7 @@ export function Modal(props) {
|
|
|
325
332
|
dragStartPointer = { x: e.clientX, y: e.clientY };
|
|
326
333
|
dragStartOffset = { ...dragOffset() };
|
|
327
334
|
const rect = dialogElement.getBoundingClientRect();
|
|
335
|
+
pendingRestore = isMaximized() ? rect : null;
|
|
328
336
|
dragBasePosition = {
|
|
329
337
|
left: rect.left - dragStartOffset.x,
|
|
330
338
|
top: rect.top - dragStartOffset.y,
|
|
@@ -358,6 +366,7 @@ export function Modal(props) {
|
|
|
358
366
|
doc.addEventListener('pointercancel', onDocEnd);
|
|
359
367
|
}
|
|
360
368
|
cleanupActiveDrag = () => {
|
|
369
|
+
pendingRestore = null;
|
|
361
370
|
isDraggingPointer = false;
|
|
362
371
|
dragPointerId = null;
|
|
363
372
|
setIsDragging(false);
|
|
@@ -380,12 +389,36 @@ export function Modal(props) {
|
|
|
380
389
|
if (!isDraggingPointer || pointerId !== dragPointerId || !dialogElement) {
|
|
381
390
|
return;
|
|
382
391
|
}
|
|
383
|
-
const deltaX = e.clientX - dragStartPointer.x;
|
|
384
|
-
const deltaY = e.clientY - dragStartPointer.y;
|
|
385
392
|
const win = dialogElement.ownerDocument.defaultView;
|
|
386
393
|
if (win === null)
|
|
387
394
|
return;
|
|
388
395
|
const headerHeight = headerElement ? headerElement.offsetHeight : 44;
|
|
396
|
+
if (pendingRestore) {
|
|
397
|
+
const travelled = Math.hypot(e.clientX - dragStartPointer.x, e.clientY - dragStartPointer.y);
|
|
398
|
+
if (travelled < RESTORE_DRAG_THRESHOLD_PX)
|
|
399
|
+
return;
|
|
400
|
+
const maximizedRect = pendingRestore;
|
|
401
|
+
pendingRestore = null;
|
|
402
|
+
const fraction = Math.min(1, Math.max(0, (dragStartPointer.x - maximizedRect.left) /
|
|
403
|
+
Math.max(1, maximizedRect.width)));
|
|
404
|
+
const grabY = Math.min(Math.max(dragStartPointer.y - maximizedRect.top, 0), headerHeight / 2);
|
|
405
|
+
setDragOffset({ x: 0, y: 0 });
|
|
406
|
+
setIsMaximized(false);
|
|
407
|
+
const restored = dialogElement.getBoundingClientRect();
|
|
408
|
+
dragBasePosition = {
|
|
409
|
+
left: restored.left,
|
|
410
|
+
top: restored.top,
|
|
411
|
+
width: restored.width,
|
|
412
|
+
height: restored.height,
|
|
413
|
+
};
|
|
414
|
+
const placed = clampDragOffset(e.clientX - fraction * restored.width - restored.left, e.clientY - grabY - restored.top, dragBasePosition, win, headerHeight);
|
|
415
|
+
dragStartPointer = { x: e.clientX, y: e.clientY };
|
|
416
|
+
dragStartOffset = placed;
|
|
417
|
+
setDragOffset(placed);
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const deltaX = e.clientX - dragStartPointer.x;
|
|
421
|
+
const deltaY = e.clientY - dragStartPointer.y;
|
|
389
422
|
const rawX = dragStartOffset.x + deltaX;
|
|
390
423
|
const rawY = dragStartOffset.y + deltaY;
|
|
391
424
|
const clamped = clampDragOffset(rawX, rawY, dragBasePosition, win, headerHeight);
|
|
@@ -440,7 +473,12 @@ export function Modal(props) {
|
|
|
440
473
|
endDrag();
|
|
441
474
|
});
|
|
442
475
|
});
|
|
443
|
-
return (<div class={`${props.embedded ? styles.modalOverlayEmbedded : styles.modalOverlay} ${isMaximized() ? styles.modalOverlayMaximized : ''} ${isExiting() ? styles.modalOverlayExiting : ''}`} style={
|
|
476
|
+
return (<div class={`${props.embedded ? styles.modalOverlayEmbedded : styles.modalOverlay} ${isMaximized() ? styles.modalOverlayMaximized : ''} ${isExiting() ? styles.modalOverlayExiting : ''}`} style={{
|
|
477
|
+
...(props.transparentBackdrop ? { background: 'transparent' } : {}),
|
|
478
|
+
...(props.maximizeInset !== undefined
|
|
479
|
+
? { '--modal-maximize-inset': props.maximizeInset }
|
|
480
|
+
: {}),
|
|
481
|
+
}} tabIndex={-1} onMouseDown={handleOverlayMouseDown} onClick={handleOverlayClick} onKeyDown={(e) => {
|
|
444
482
|
if (isKey(e, 'Escape'))
|
|
445
483
|
dismissOnEscape(e);
|
|
446
484
|
}}>
|
|
@@ -165,24 +165,24 @@ export function CommandPalette(props) {
|
|
|
165
165
|
enterSubmenu(command);
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
|
+
props.onClose();
|
|
168
169
|
props.onCommandExecuted(command.id);
|
|
169
170
|
void command.run();
|
|
170
|
-
props.onClose();
|
|
171
171
|
};
|
|
172
172
|
const configureKeybinding = (command) => {
|
|
173
173
|
const configure = props.onConfigureKeybinding;
|
|
174
174
|
if (!configure)
|
|
175
175
|
return;
|
|
176
|
-
configure(command.id);
|
|
177
176
|
props.onClose();
|
|
177
|
+
configure(command.id);
|
|
178
178
|
};
|
|
179
179
|
const executeSubmenuItem = (item) => {
|
|
180
180
|
const submenu = activeSubmenu();
|
|
181
|
+
props.onClose();
|
|
181
182
|
if (submenu) {
|
|
182
183
|
props.onCommandExecuted(submenu.rootCommandId);
|
|
183
184
|
}
|
|
184
185
|
void item.run();
|
|
185
|
-
props.onClose();
|
|
186
186
|
};
|
|
187
187
|
const executeUnifiedItem = (item) => {
|
|
188
188
|
if (!item.enabled)
|
|
@@ -191,8 +191,8 @@ export function CommandPalette(props) {
|
|
|
191
191
|
executeCommand(item.rawCommand);
|
|
192
192
|
return;
|
|
193
193
|
}
|
|
194
|
-
void item.run();
|
|
195
194
|
props.onClose();
|
|
195
|
+
void item.run();
|
|
196
196
|
};
|
|
197
197
|
createEffect(() => {
|
|
198
198
|
if (!props.open) {
|
|
@@ -17,6 +17,9 @@ const VIEWPORT_PADDING = 8;
|
|
|
17
17
|
function isItem(entry) {
|
|
18
18
|
return entry.type !== 'separator';
|
|
19
19
|
}
|
|
20
|
+
function readRowState(state) {
|
|
21
|
+
return typeof state === 'function' ? state() : state === true;
|
|
22
|
+
}
|
|
20
23
|
function MenuPanel(props) {
|
|
21
24
|
let panelRef;
|
|
22
25
|
let viewportEl;
|
|
@@ -347,7 +350,7 @@ function MenuPanel(props) {
|
|
|
347
350
|
};
|
|
348
351
|
const handleItemHover = (event, item, index) => {
|
|
349
352
|
cancelSubmenuClose();
|
|
350
|
-
if (item.disabled || !item.submenu || item.submenu.length === 0) {
|
|
353
|
+
if (readRowState(item.disabled) || !item.submenu || item.submenu.length === 0) {
|
|
351
354
|
scheduleSubmenuClose();
|
|
352
355
|
return;
|
|
353
356
|
}
|
|
@@ -408,10 +411,8 @@ function MenuPanel(props) {
|
|
|
408
411
|
return <div class={styles.separator} role="separator"/>;
|
|
409
412
|
}
|
|
410
413
|
const hasSubmenu = () => Boolean(entry.submenu && entry.submenu.length > 0);
|
|
411
|
-
const checkedValue = () =>
|
|
412
|
-
|
|
413
|
-
return typeof c === 'function' ? c() : Boolean(c);
|
|
414
|
-
};
|
|
414
|
+
const checkedValue = () => readRowState(entry.checked);
|
|
415
|
+
const disabledValue = () => readRowState(entry.disabled);
|
|
415
416
|
const isSubmenuOpen = () => hasSubmenu() && submenuState()?.items === entry.submenu;
|
|
416
417
|
let textEl;
|
|
417
418
|
const label = () => typeof entry.label === 'function' ? entry.label() : entry.label;
|
|
@@ -430,7 +431,7 @@ function MenuPanel(props) {
|
|
|
430
431
|
[styles.itemExpanded ?? '']: isSubmenuOpen(),
|
|
431
432
|
}} role={entry.checkedRole
|
|
432
433
|
? `menuitem${entry.checkedRole}`
|
|
433
|
-
: 'menuitem'} tabIndex={-1} aria-disabled={
|
|
434
|
+
: 'menuitem'} tabIndex={-1} aria-disabled={disabledValue() ? true : undefined} aria-checked={entry.checkedRole ? checkedValue() : undefined} aria-haspopup={hasSubmenu() ? 'menu' : undefined} aria-expanded={hasSubmenu() ? isSubmenuOpen() : undefined} aria-describedby={entry.hint ? hintId(index()) : undefined} onFocus={() => setFocusedIndex(index())} onMouseEnter={(event) => {
|
|
434
435
|
if (panelRef &&
|
|
435
436
|
props.hostWin.document.activeElement &&
|
|
436
437
|
props.hostWin.document.activeElement !== panelRef &&
|
|
@@ -440,7 +441,7 @@ function MenuPanel(props) {
|
|
|
440
441
|
setFocusedIndex(index());
|
|
441
442
|
handleItemHover(event, entry, index());
|
|
442
443
|
}} onClick={() => {
|
|
443
|
-
if (
|
|
444
|
+
if (disabledValue())
|
|
444
445
|
return;
|
|
445
446
|
if (hasSubmenu()) {
|
|
446
447
|
const rowEl = itemRefs[index()];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const HELD_TITLE = 'data-suppressed-title';
|
|
2
|
+
const holds = new WeakMap();
|
|
3
|
+
export function holdNativeTitle(element) {
|
|
4
|
+
const view = element.ownerDocument.defaultView;
|
|
5
|
+
if (view === null || holds.has(element))
|
|
6
|
+
return;
|
|
7
|
+
const title = element.getAttribute('title');
|
|
8
|
+
if (title === null || title === '')
|
|
9
|
+
return;
|
|
10
|
+
element.setAttribute(HELD_TITLE, title);
|
|
11
|
+
element.setAttribute('title', '');
|
|
12
|
+
let wrote = false;
|
|
13
|
+
const observer = new view.MutationObserver(() => {
|
|
14
|
+
wrote = true;
|
|
15
|
+
});
|
|
16
|
+
observer.observe(element, { attributes: true, attributeFilter: ['title'] });
|
|
17
|
+
holds.set(element, {
|
|
18
|
+
ownerWrote: () => wrote || observer.takeRecords().length > 0,
|
|
19
|
+
stop: () => observer.disconnect(),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function releaseNativeTitle(element) {
|
|
23
|
+
const hold = holds.get(element);
|
|
24
|
+
if (hold === undefined)
|
|
25
|
+
return;
|
|
26
|
+
holds.delete(element);
|
|
27
|
+
const ownerWrote = hold.ownerWrote();
|
|
28
|
+
hold.stop();
|
|
29
|
+
const held = element.getAttribute(HELD_TITLE);
|
|
30
|
+
element.removeAttribute(HELD_TITLE);
|
|
31
|
+
if (!ownerWrote && held !== null)
|
|
32
|
+
element.setAttribute('title', held);
|
|
33
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createUniqueId, onCleanup } from 'solid-js';
|
|
2
2
|
import { tooltipCoordinator, } from './tooltipCoordinator';
|
|
3
|
+
import { holdNativeTitle, releaseNativeTitle } from './nativeTitleHold';
|
|
3
4
|
export function tooltip(el, accessor) {
|
|
4
5
|
const id = createUniqueId();
|
|
5
6
|
const getOptions = () => {
|
|
@@ -15,10 +16,7 @@ export function tooltip(el, accessor) {
|
|
|
15
16
|
const opts = getOptions();
|
|
16
17
|
if (!opts || !opts.content)
|
|
17
18
|
return;
|
|
18
|
-
|
|
19
|
-
el.setAttribute('data-suppressed-title', el.getAttribute('title') ?? '');
|
|
20
|
-
el.removeAttribute('title');
|
|
21
|
-
}
|
|
19
|
+
holdNativeTitle(el);
|
|
22
20
|
tooltipCoordinator.showTooltip({
|
|
23
21
|
id,
|
|
24
22
|
target: el,
|
|
@@ -30,13 +28,7 @@ export function tooltip(el, accessor) {
|
|
|
30
28
|
});
|
|
31
29
|
};
|
|
32
30
|
const hide = () => {
|
|
33
|
-
|
|
34
|
-
const original = el.getAttribute('data-suppressed-title');
|
|
35
|
-
if (original) {
|
|
36
|
-
el.setAttribute('title', original);
|
|
37
|
-
}
|
|
38
|
-
el.removeAttribute('data-suppressed-title');
|
|
39
|
-
}
|
|
31
|
+
releaseNativeTitle(el);
|
|
40
32
|
tooltipCoordinator.hideTooltip(el);
|
|
41
33
|
};
|
|
42
34
|
el.addEventListener('pointerenter', show);
|
|
@@ -2,6 +2,7 @@ export * from './theme';
|
|
|
2
2
|
export { themeOptions } from './palette/palettes';
|
|
3
3
|
export { DEFAULT_THEME_ID, DESIGN_THEMES, LEGACY_THEME_IDS, getDefaultThemeId, getThemeById, getThemeDesign, getThemeOptions, isKnownThemeId, registerThemeSource, setThemeDesign, } from './palette/themeRegistry';
|
|
4
4
|
export { derivePaletteProperties } from './palette/paletteProperties';
|
|
5
|
+
export { THEME_PALETTE_TOKENS, isThemePaletteColor } from './palette/paletteContract';
|
|
5
6
|
export { toColorVisionSafePalette, isColorVisionSafeActive, OKABE_ITO_DIFF, } from './palette/colorVisionPalette';
|
|
6
7
|
export * from './palette/accessiblePalette';
|
|
7
8
|
export * from '../_internal/app/settings/theme/appThemeDerivation';
|