@vokril/ui-solid 0.28.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 +81 -0
- package/README.md +48 -4
- 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-yryWdwyX.js → StatusBarNotificationBell-ZTEhZFmJ.js} +4980 -4678
- 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 +13 -3
- package/dist/_internal/contract/notification.d.ts +13 -3
- 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 +516 -509
- 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 +12 -3
- package/dist/notifications/NotificationItem.d.ts +12 -3
- 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/StatusBarNotificationBell.d.cts +18 -6
- package/dist/notifications/StatusBarNotificationBell.d.ts +18 -6
- package/dist/notifications/dismissableToastIds.d.cts +2 -1
- package/dist/notifications/dismissableToastIds.d.ts +2 -1
- 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 +56 -52
- package/dist/notifications/nativeEngine.d.cts +54 -16
- package/dist/notifications/nativeEngine.d.ts +54 -16
- package/dist/notifications/notificationCardServices.d.cts +2 -1
- package/dist/notifications/notificationCardServices.d.ts +2 -1
- package/dist/notifications/notificationCommands.d.cts +3 -3
- package/dist/notifications/notificationCommands.d.ts +3 -3
- package/dist/notifications/notificationEntryList.d.cts +91 -0
- package/dist/notifications/notificationEntryList.d.ts +91 -0
- package/dist/notifications/notificationService.d.cts +33 -3
- package/dist/notifications/notificationService.d.ts +33 -3
- 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-DdAdsduo.js → StatusBarNotificationBell-DW2l5O9B.js} +4812 -4520
- 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 +478 -472
- 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 +56 -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 +6 -29
- 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 +21 -19
- 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/nativeEngine.js +51 -11
- package/dist/solid/notifications/notificationEntryList.js +168 -0
- package/dist/solid/notifications/notificationService.js +22 -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-CJ3HuhRu.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-Z2LmIkM1.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
|
@@ -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';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const THEME_PALETTE_TOKEN_SET = {
|
|
2
|
+
surface: true,
|
|
3
|
+
surfaceAlt: true,
|
|
4
|
+
surfaceElevated: true,
|
|
5
|
+
brand: true,
|
|
6
|
+
brandHover: true,
|
|
7
|
+
content: true,
|
|
8
|
+
contentSecondary: true,
|
|
9
|
+
border: true,
|
|
10
|
+
input: true,
|
|
11
|
+
inputBorder: true,
|
|
12
|
+
success: true,
|
|
13
|
+
error: true,
|
|
14
|
+
warning: true,
|
|
15
|
+
info: true,
|
|
16
|
+
syntaxKeyword: true,
|
|
17
|
+
syntaxString: true,
|
|
18
|
+
syntaxFunction: true,
|
|
19
|
+
syntaxComment: true,
|
|
20
|
+
syntaxNumber: true,
|
|
21
|
+
syntaxType: true,
|
|
22
|
+
};
|
|
23
|
+
export const THEME_PALETTE_TOKENS = Object.freeze(Object.keys(THEME_PALETTE_TOKEN_SET));
|
|
24
|
+
const PALETTE_COLOR = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
25
|
+
export function isThemePaletteColor(value) {
|
|
26
|
+
return typeof value === 'string' && PALETTE_COLOR.test(value);
|
|
27
|
+
}
|