@editora/ui-core 0.1.19 → 0.1.21
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/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
- package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
- package/dist/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +39 -62
- package/dist/alert-dialog.cjs.js +19 -19
- package/dist/alert-dialog.esm.js +69 -87
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.js +4 -7
- package/dist/anchor.cjs.js +2 -2
- package/dist/anchor.esm.js +3 -3
- package/dist/animated-beam.cjs.js +83 -83
- package/dist/animated-beam.esm.js +250 -277
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +47 -61
- package/dist/animated-text.cjs.js +2 -2
- package/dist/animated-text.esm.js +13 -24
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +11 -13
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +4 -7
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +7 -13
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +4 -7
- package/dist/block-controls.cjs.js +2 -2
- package/dist/block-controls.esm.js +19 -35
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +8 -15
- package/dist/breadcrumb.cjs.js +2 -2
- package/dist/breadcrumb.esm.js +20 -37
- package/dist/button.cjs.js +1 -521
- package/dist/button.esm.js +2 -671
- package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
- package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +8 -9
- package/dist/card.cjs.js +4 -4
- package/dist/card.esm.js +13 -19
- package/dist/chart.cjs.js +64 -64
- package/dist/chart.esm.js +223 -254
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +2 -3
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +5 -9
- package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +30 -29
- package/dist/color-picker.cjs.js +10 -10
- package/dist/color-picker.esm.js +190 -253
- package/dist/combobox.cjs.js +13 -13
- package/dist/combobox.esm.js +93 -126
- package/dist/command-palette.cjs.js +3 -3
- package/dist/command-palette.esm.js +19 -30
- package/dist/command.cjs.js +4 -4
- package/dist/command.esm.js +41 -53
- package/dist/components/ui-collection.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-portal.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts +8 -0
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +1 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/container.cjs.js +2 -2
- package/dist/container.esm.js +2 -3
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +157 -219
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +2 -3
- package/dist/data-table.cjs.js +4 -4
- package/dist/data-table.esm.js +299 -381
- package/dist/date-field.cjs.js +3 -3
- package/dist/date-field.esm.js +68 -80
- package/dist/date-picker.cjs.js +9 -9
- package/dist/date-picker.esm.js +69 -97
- package/dist/date-range-picker.cjs.js +3 -3
- package/dist/date-range-picker.esm.js +32 -56
- package/dist/date-range-time-picker.cjs.js +9 -9
- package/dist/date-range-time-picker.esm.js +111 -140
- package/dist/date-time-picker.cjs.js +7 -7
- package/dist/date-time-picker.esm.js +115 -147
- package/dist/date-time-utils-Dmost5Ee.js +1 -0
- package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +3 -5
- package/dist/dialog.cjs.js +12 -12
- package/dist/dialog.esm.js +44 -63
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +2 -3
- package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
- package/dist/dismissable-layer-DNfrKA20.js +1 -0
- package/dist/dismissable-layer.cjs.js +2 -2
- package/dist/dismissable-layer.esm.js +4 -6
- package/dist/dock.cjs.js +5 -5
- package/dist/dock.esm.js +134 -155
- package/dist/drawer.cjs.js +2 -2
- package/dist/drawer.esm.js +18 -35
- package/dist/dropdown.cjs.js +2 -2
- package/dist/dropdown.esm.js +119 -149
- package/dist/dropzone.cjs.js +1 -1
- package/dist/dropzone.esm.js +0 -1
- package/dist/empty-state.cjs.js +1 -1
- package/dist/empty-state.esm.js +1 -1
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +3 -5
- package/dist/field.cjs.js +5 -5
- package/dist/field.esm.js +27 -34
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +19 -24
- package/dist/file-upload.cjs.js +4 -4
- package/dist/file-upload.esm.js +69 -93
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +5 -9
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +60 -85
- package/dist/focus-scope-Bwug2gDv.js +1 -0
- package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
- package/dist/focus-scope.cjs.js +2 -2
- package/dist/focus-scope.esm.js +15 -20
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +26 -53
- package/dist/gantt.cjs.js +43 -43
- package/dist/gantt.esm.js +295 -322
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +5 -9
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +22 -28
- package/dist/icon-cloud.cjs.js +7 -7
- package/dist/icon-cloud.esm.js +48 -62
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +2 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +378 -390
- package/dist/inline-edit.cjs.js +11 -11
- package/dist/inline-edit.esm.js +32 -36
- package/dist/input.cjs.js +17 -17
- package/dist/input.esm.js +50 -63
- package/dist/label.cjs.js +2 -2
- package/dist/label.esm.js +8 -17
- package/dist/layout.cjs.js +2 -2
- package/dist/layout.esm.js +20 -26
- package/dist/listbox-B6QgECax.js +46 -0
- package/dist/listbox-DJamVeFj.mjs +200 -0
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +2 -4
- package/dist/marquee.cjs.js +5 -5
- package/dist/marquee.esm.js +33 -50
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +5 -9
- package/dist/menu.cjs.js +3 -3
- package/dist/menu.esm.js +106 -126
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +118 -164
- package/dist/meter.cjs.js +2 -2
- package/dist/meter.esm.js +4 -4
- package/dist/multi-select.cjs.js +5 -5
- package/dist/multi-select.esm.js +125 -137
- package/dist/navigation-menu.cjs.js +4 -4
- package/dist/navigation-menu.esm.js +44 -55
- package/dist/number-field.cjs.js +2 -2
- package/dist/number-field.esm.js +73 -98
- package/dist/number-ticker.cjs.js +3 -3
- package/dist/number-ticker.esm.js +22 -43
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +5 -9
- package/dist/orbiter.cjs.js +13 -13
- package/dist/orbiter.esm.js +79 -90
- package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
- package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
- package/dist/pagination.cjs.js +2 -2
- package/dist/pagination.esm.js +14 -18
- package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
- package/dist/panel-group-CaD0_KQf.js +36 -0
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +2 -5
- package/dist/panel.cjs.js +4 -4
- package/dist/panel.esm.js +8 -10
- package/dist/password-field.cjs.js +9 -9
- package/dist/password-field.esm.js +62 -82
- package/dist/pin-input.cjs.js +3 -3
- package/dist/pin-input.esm.js +33 -39
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +108 -131
- package/dist/plugin-panel.cjs.js +7 -7
- package/dist/plugin-panel.esm.js +13 -15
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +21 -31
- package/dist/portal-DgpQ3Jo1.js +1 -0
- package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
- package/dist/portal.cjs.js +3 -3
- package/dist/portal.esm.js +20 -28
- package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
- package/dist/positioner-D_fqyx_j.js +1 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +22 -28
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/primitives/auto-scroll.d.ts +9 -0
- package/dist/primitives/auto-scroll.d.ts.map +1 -0
- package/dist/primitives/selector.d.ts +4 -0
- package/dist/primitives/selector.d.ts.map +1 -0
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +5 -9
- package/dist/quick-actions.cjs.js +6 -6
- package/dist/quick-actions.esm.js +52 -62
- package/dist/radio-group.cjs.js +13 -13
- package/dist/radio-group.esm.js +39 -51
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +5 -9
- package/dist/rating.cjs.js +1 -1
- package/dist/rating.esm.js +12 -23
- package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
- package/dist/roving-focus-group.cjs.js +1 -1
- package/dist/roving-focus-group.esm.js +3 -5
- package/dist/runtime-CTaOSmBj.js +1 -0
- package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +6 -6
- package/dist/scroll-area.cjs.js +3 -3
- package/dist/scroll-area.esm.js +38 -46
- package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +7 -7
- package/dist/select.esm.js +67 -97
- package/dist/selection-popup.cjs.js +1 -1
- package/dist/selection-popup.esm.js +8 -15
- package/dist/selector-BvAh35ve.js +1 -0
- package/dist/selector-WI8pD7YO.mjs +18 -0
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +18 -18
- package/dist/sidebar.esm.js +117 -139
- package/dist/skeleton.cjs.js +11 -11
- package/dist/skeleton.esm.js +27 -24
- package/dist/slider.cjs.js +1 -1
- package/dist/slider.esm.js +6 -11
- package/dist/slot.cjs.js +4 -4
- package/dist/slot.esm.js +16 -19
- package/dist/sortable.cjs.js +79 -65
- package/dist/sortable.esm.js +714 -734
- package/dist/spinning-text.cjs.js +12 -12
- package/dist/spinning-text.esm.js +80 -92
- package/dist/split-button.cjs.js +4 -4
- package/dist/split-button.esm.js +77 -62
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/stepper.cjs.js +8 -8
- package/dist/stepper.esm.js +32 -52
- package/dist/switch.cjs.js +7 -7
- package/dist/switch.esm.js +23 -31
- package/dist/table.cjs.js +2 -2
- package/dist/table.esm.js +46 -56
- package/dist/tabs.cjs.js +8 -8
- package/dist/tabs.esm.js +89 -109
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +10 -10
- package/dist/textarea.esm.js +49 -52
- package/dist/time-field.cjs.js +4 -4
- package/dist/time-field.esm.js +70 -84
- package/dist/time-picker.cjs.js +22 -22
- package/dist/time-picker.esm.js +88 -110
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.esm.js +3 -5
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +33 -47
- package/dist/toggle-group.cjs.js +6 -6
- package/dist/toggle-group.esm.js +85 -105
- package/dist/toggle.cjs.js +1 -1
- package/dist/toggle.esm.js +3 -5
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +13 -24
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +31 -42
- package/dist/transfer-list.cjs.js +31 -31
- package/dist/transfer-list.esm.js +114 -127
- package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
- package/dist/tree-Dx_kv_ih.js +39 -0
- package/dist/tree-item.cjs.js +2 -2
- package/dist/tree-item.esm.js +2 -3
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +2 -5
- package/dist/ui-button-Q0GNNWKC.mjs +665 -0
- package/dist/ui-button-rXQOS9QJ.js +521 -0
- package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
- package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +14 -14
- package/dist/wizard.esm.js +85 -105
- package/package.json +2 -2
- package/dist/date-time-utils-66480de4.js +0 -1
- package/dist/date-time-utils-a2c7af25.mjs +0 -307
- package/dist/dismissable-layer-193e3bed.js +0 -1
- package/dist/focus-scope-2b12b4e7.js +0 -1
- package/dist/listbox-308789a0.mjs +0 -210
- package/dist/listbox-ef2f708e.js +0 -46
- package/dist/panel-group-40254cdd.js +0 -36
- package/dist/portal-c69756c0.js +0 -1
- package/dist/positioner-33529bb8.js +0 -1
- package/dist/runtime-3f13807b.js +0 -1
- package/dist/tree-0a7a8d05.js +0 -39
- /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
- /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
- /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
- /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
- /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
package/dist/context-menu.esm.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { E } from "./ElementBase-
|
|
2
|
-
import {
|
|
3
|
-
import { c as S } from "./dismissable-layer-
|
|
4
|
-
import {
|
|
5
|
-
import { c as w } from "./menu-item-styles-
|
|
6
|
-
import "./listbox-
|
|
7
|
-
|
|
8
|
-
import "./collection.esm.js";
|
|
9
|
-
const c = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [data-menu-item]', b = [
|
|
1
|
+
import { E } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import { b as A } from "./portal-bR42gHvG.mjs";
|
|
3
|
+
import { c as S } from "./dismissable-layer-BmPIoK80.mjs";
|
|
4
|
+
import { e as P } from "./positioner-D0VGxtYU.mjs";
|
|
5
|
+
import { c as w } from "./menu-item-styles-CZiPwPwl.mjs";
|
|
6
|
+
import "./listbox-DJamVeFj.mjs";
|
|
7
|
+
const l = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [data-menu-item]', b = [
|
|
10
8
|
":scope > .menuitem",
|
|
11
9
|
':scope > [role="menuitem"]',
|
|
12
10
|
':scope > [role="menuitemcheckbox"]',
|
|
13
11
|
':scope > [role="menuitemradio"]',
|
|
14
12
|
":scope > [data-menu-item]"
|
|
15
|
-
].join(", "), O = ":scope > .submenu",
|
|
13
|
+
].join(", "), O = ":scope > .submenu", a = 8, L = 6, R = 420, C = 110, I = [
|
|
16
14
|
"--ui-color-primary",
|
|
17
15
|
"--ui-color-primary-hover",
|
|
18
16
|
"--ui-color-foreground-on-primary",
|
|
@@ -416,79 +414,71 @@ const c = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menui
|
|
|
416
414
|
}
|
|
417
415
|
`;
|
|
418
416
|
function z() {
|
|
419
|
-
if (typeof document > "u")
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
if (document.getElementById(o))
|
|
423
|
-
return;
|
|
417
|
+
if (typeof document > "u") return;
|
|
418
|
+
const s = "ui-context-menu-light-dom-style";
|
|
419
|
+
if (document.getElementById(s)) return;
|
|
424
420
|
const t = document.createElement("style");
|
|
425
|
-
t.id =
|
|
421
|
+
t.id = s, t.textContent = v, document.head.appendChild(t);
|
|
426
422
|
}
|
|
427
|
-
function B(
|
|
428
|
-
return
|
|
429
|
-
const
|
|
423
|
+
function B(s, t) {
|
|
424
|
+
return s.replace(/(^|})\s*([^@}{][^{}]*)\{/g, (e, i, o) => {
|
|
425
|
+
const n = o.split(",").map((r) => r.trim()).filter(Boolean).map((r) => r.startsWith(t) ? r : `${t} ${r}`).join(", ");
|
|
430
426
|
return `${i}
|
|
431
|
-
${
|
|
427
|
+
${n} {`;
|
|
432
428
|
});
|
|
433
429
|
}
|
|
434
|
-
function F(
|
|
435
|
-
const t =
|
|
430
|
+
function F(s) {
|
|
431
|
+
const t = s.replace(/:host\(\[([a-z-]+)(?:="([^"]+)")?\]\)/g, (e, i, o) => o != null ? `.ui-context-menu-portal[data-${i}="${o}"]` : `.ui-context-menu-portal[data-${i}="true"]`).replace(/:host/g, ".ui-context-menu-portal");
|
|
436
432
|
return B(t, ".ui-context-menu-portal");
|
|
437
433
|
}
|
|
438
|
-
function H(
|
|
439
|
-
return
|
|
434
|
+
function H(s) {
|
|
435
|
+
return s.replace(/(^|,)\s*ui-context-menu\b/gm, (t, e) => `${e} .ui-context-menu-portal`);
|
|
440
436
|
}
|
|
441
437
|
const D = `${F(g)}
|
|
442
438
|
${H(v)}`;
|
|
443
|
-
function M(
|
|
444
|
-
return
|
|
439
|
+
function M(s) {
|
|
440
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
445
441
|
}
|
|
446
|
-
function q(
|
|
447
|
-
return typeof
|
|
442
|
+
function q(s, t) {
|
|
443
|
+
return typeof s == "number" ? { x: s, y: typeof t == "number" ? t : 0 } : s;
|
|
448
444
|
}
|
|
449
|
-
function $(
|
|
450
|
-
return
|
|
445
|
+
function $(s) {
|
|
446
|
+
return s === "top" || s === "left" || s === "right" ? s : "bottom";
|
|
451
447
|
}
|
|
452
|
-
function V(
|
|
453
|
-
return `${
|
|
448
|
+
function V(s) {
|
|
449
|
+
return `${s}-start`;
|
|
454
450
|
}
|
|
455
|
-
function _(
|
|
456
|
-
if (!
|
|
457
|
-
|
|
458
|
-
const t = o.trim().toLowerCase();
|
|
451
|
+
function _(s) {
|
|
452
|
+
if (!s) return "";
|
|
453
|
+
const t = s.trim().toLowerCase();
|
|
459
454
|
return t === "1" ? "sm" : t === "2" ? "md" : t === "3" ? "lg" : t === "sm" || t === "md" || t === "lg" ? t : t === "compact" ? "sm" : t === "comfortable" ? "lg" : "";
|
|
460
455
|
}
|
|
461
|
-
function y(
|
|
462
|
-
if (!
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
return t ? t === "none" ? "0px" : t === "sm" ? "8px" : t === "md" ? "12px" : t === "lg" ? "16px" : t === "full" ? "999px" : t === "square" ? "6px" : t === "soft" ? "16px" : /^\d+(\.\d+)?$/.test(t) ? `${t}px` : o : "";
|
|
456
|
+
function y(s) {
|
|
457
|
+
if (!s) return "";
|
|
458
|
+
const t = s.trim().toLowerCase();
|
|
459
|
+
return t ? t === "none" ? "0px" : t === "sm" ? "8px" : t === "md" ? "12px" : t === "lg" ? "16px" : t === "full" ? "999px" : t === "square" ? "6px" : t === "soft" ? "16px" : /^\d+(\.\d+)?$/.test(t) ? `${t}px` : s : "";
|
|
466
460
|
}
|
|
467
|
-
function N(
|
|
468
|
-
if (!
|
|
469
|
-
|
|
470
|
-
const t = window.getComputedStyle(o);
|
|
461
|
+
function N(s) {
|
|
462
|
+
if (!s.isConnected || s.hidden) return !1;
|
|
463
|
+
const t = window.getComputedStyle(s);
|
|
471
464
|
return !(t.display === "none" || t.visibility === "hidden");
|
|
472
465
|
}
|
|
473
|
-
function W(
|
|
474
|
-
if (!
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
return !0;
|
|
482
|
-
const i = Number.parseFloat(t.width || "0"), n = Number.parseFloat(t.height || "0");
|
|
483
|
-
return i > 0 || n > 0;
|
|
466
|
+
function W(s) {
|
|
467
|
+
if (!s.isConnected) return !1;
|
|
468
|
+
const t = window.getComputedStyle(s);
|
|
469
|
+
if (t.display === "none" || t.visibility === "hidden") return !1;
|
|
470
|
+
const e = s.getBoundingClientRect();
|
|
471
|
+
if (e.width > 0 || e.height > 0) return !0;
|
|
472
|
+
const i = Number.parseFloat(t.width || "0"), o = Number.parseFloat(t.height || "0");
|
|
473
|
+
return i > 0 || o > 0;
|
|
484
474
|
}
|
|
485
|
-
function x(
|
|
486
|
-
const t =
|
|
487
|
-
return
|
|
475
|
+
function x(s) {
|
|
476
|
+
const t = s.getAttribute("aria-disabled");
|
|
477
|
+
return s.hasAttribute("disabled") || t === "true" || s.disabled === !0;
|
|
488
478
|
}
|
|
489
|
-
function G(
|
|
490
|
-
for (const t of
|
|
491
|
-
if (t instanceof HTMLElement && t.matches(
|
|
479
|
+
function G(s) {
|
|
480
|
+
for (const t of s)
|
|
481
|
+
if (t instanceof HTMLElement && t.matches(l))
|
|
492
482
|
return t;
|
|
493
483
|
return null;
|
|
494
484
|
}
|
|
@@ -600,8 +590,7 @@ class U extends E {
|
|
|
600
590
|
}
|
|
601
591
|
}
|
|
602
592
|
openForAnchor(t) {
|
|
603
|
-
if (this.headless || this.isDisabled)
|
|
604
|
-
return;
|
|
593
|
+
if (this.headless || this.isDisabled) return;
|
|
605
594
|
this._anchorEl = t;
|
|
606
595
|
const e = t.getBoundingClientRect();
|
|
607
596
|
if (this._point = { x: e.left, y: e.bottom }, this._isOpen) {
|
|
@@ -647,14 +636,13 @@ class U extends E {
|
|
|
647
636
|
return t || (this.state === "loading" ? "Loading actions" : this.state === "error" ? "Action unavailable" : this.state === "success" ? "Action ready" : "");
|
|
648
637
|
}
|
|
649
638
|
_emitOpenState(t, e, i) {
|
|
650
|
-
const
|
|
651
|
-
this.dispatchEvent(new CustomEvent(t ? "open" : "close", { detail:
|
|
639
|
+
const o = { open: t, previousOpen: e, source: i };
|
|
640
|
+
this.dispatchEvent(new CustomEvent(t ? "open" : "close", { detail: o, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent(t ? "ui-open" : "ui-close", { detail: o, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("change", { detail: { ...o }, bubbles: !0, composed: !0 }));
|
|
652
641
|
}
|
|
653
642
|
_setOpen(t, e) {
|
|
654
643
|
t !== this.open && (t && (this.headless || this.isDisabled) || (this._nextOpenSource = e, t ? this.setAttribute("open", "") : this.removeAttribute("open")));
|
|
655
644
|
}
|
|
656
645
|
_syncOpenState() {
|
|
657
|
-
var i;
|
|
658
646
|
const t = this.hasAttribute("open"), e = this._nextOpenSource;
|
|
659
647
|
if (this._nextOpenSource = "attribute", t === this._isOpen) {
|
|
660
648
|
this._syncGlobalListeners(t), t ? ((!this._portalEl || !this._portalEl.isConnected) && this._mountPortal(), this._syncPortalVisualState(), this._syncSurfaceState(), this._syncDismissableLayer(), this._schedulePosition(), this._scheduleSubmenuLayout()) : this._syncSurfaceState();
|
|
@@ -666,7 +654,7 @@ class U extends E {
|
|
|
666
654
|
});
|
|
667
655
|
return;
|
|
668
656
|
}
|
|
669
|
-
if (this._clearSubmenuState(), this._cancelScheduledWork(), this._teardownPortal(), this._syncSurfaceState(), this._anchorEl = null, this._emitOpenState(!1, !0, e),
|
|
657
|
+
if (this._clearSubmenuState(), this._cancelScheduledWork(), this._teardownPortal(), this._syncSurfaceState(), this._anchorEl = null, this._emitOpenState(!1, !0, e), this._restoreFocusEl?.isConnected)
|
|
670
658
|
try {
|
|
671
659
|
this._restoreFocusEl.focus();
|
|
672
660
|
} catch {
|
|
@@ -675,8 +663,7 @@ class U extends E {
|
|
|
675
663
|
}
|
|
676
664
|
_syncSurfaceState() {
|
|
677
665
|
const t = this._surface();
|
|
678
|
-
if (!t)
|
|
679
|
-
return;
|
|
666
|
+
if (!t) return;
|
|
680
667
|
const e = this._isOpen && !this.headless, i = e && !this.isDisabled && this.state !== "loading";
|
|
681
668
|
t.setAttribute("aria-hidden", this._isOpen ? "false" : "true"), t.setAttribute("aria-busy", this.state === "loading" ? "true" : "false"), this._isOpen ? t.removeAttribute("hidden") : t.setAttribute("hidden", ""), t.style.display = this.headless ? "none" : "block", t.style.visibility = e ? "visible" : "hidden", t.style.opacity = e ? "1" : "0", t.style.transform = e ? "translateY(0) scale(1)" : "translateY(4px) scale(0.985)", t.style.pointerEvents = i ? "auto" : "none";
|
|
682
669
|
}
|
|
@@ -703,59 +690,50 @@ class U extends E {
|
|
|
703
690
|
this._portalEl && (e ? this._portalEl.setAttribute(`data-${t}`, "true") : this._portalEl.removeAttribute(`data-${t}`));
|
|
704
691
|
}
|
|
705
692
|
_syncPortalThemeVariables() {
|
|
706
|
-
if (!this._portalEl)
|
|
707
|
-
return;
|
|
693
|
+
if (!this._portalEl) return;
|
|
708
694
|
const t = getComputedStyle(this), e = (i) => {
|
|
709
|
-
const
|
|
710
|
-
|
|
695
|
+
const o = t.getPropertyValue(i).trim();
|
|
696
|
+
o ? this._portalEl.style.setProperty(i, o) : this._portalEl.style.removeProperty(i);
|
|
711
697
|
};
|
|
712
|
-
I.forEach(e), T.forEach(e), k.forEach(({ prefix: i, from:
|
|
713
|
-
for (let r =
|
|
714
|
-
e(`${i}${r}`);
|
|
698
|
+
I.forEach(e), T.forEach(e), k.forEach(({ prefix: i, from: o, to: n }) => {
|
|
699
|
+
for (let r = o; r <= n; r += 1) e(`${i}${r}`);
|
|
715
700
|
});
|
|
716
701
|
}
|
|
717
702
|
_syncPortalVisualState() {
|
|
718
|
-
if (!this._portalEl)
|
|
719
|
-
return;
|
|
703
|
+
if (!this._portalEl) return;
|
|
720
704
|
const t = _(this.getAttribute("size") || this.getAttribute("density")), e = y(this.getAttribute("radius") || this.getAttribute("shape"));
|
|
721
705
|
this._syncPortalThemeVariables(), this._setPortalFlag("open", this._isOpen), this._setPortalFlag("headless", this.headless), this._setPortalFlag("disabled", this.isDisabled);
|
|
722
|
-
const i = this.getAttribute("variant"),
|
|
723
|
-
i ? this._portalEl.setAttribute("data-variant", i) : this._portalEl.removeAttribute("data-variant"),
|
|
706
|
+
const i = this.getAttribute("variant"), o = _(this.getAttribute("size") || this.getAttribute("density")), n = this.getAttribute("density"), r = this.getAttribute("radius"), u = this.getAttribute("shape"), c = this.getAttribute("elevation"), h = this.getAttribute("tone"), m = this.getAttribute("placement");
|
|
707
|
+
i ? this._portalEl.setAttribute("data-variant", i) : this._portalEl.removeAttribute("data-variant"), o && o !== "md" ? this._portalEl.setAttribute("data-size", o) : this._portalEl.removeAttribute("data-size"), n ? this._portalEl.setAttribute("data-density", n) : this._portalEl.removeAttribute("data-density"), r ? this._portalEl.setAttribute("data-radius", r) : this._portalEl.removeAttribute("data-radius"), u ? this._portalEl.setAttribute("data-shape", u) : this._portalEl.removeAttribute("data-shape"), c ? this._portalEl.setAttribute("data-elevation", c) : this._portalEl.removeAttribute("data-elevation"), h ? this._portalEl.setAttribute("data-tone", h) : this._portalEl.removeAttribute("data-tone"), m ? this._portalEl.setAttribute("data-placement-request", m) : this._portalEl.removeAttribute("data-placement-request"), t === "sm" ? (this._portalEl.style.setProperty("--ui-context-menu-padding", "4px"), this._portalEl.style.setProperty("--ui-context-menu-item-gap", "8px"), this._portalEl.style.setProperty("--ui-context-menu-item-min-height", "32px"), this._portalEl.style.setProperty("--ui-context-menu-item-pad-y", "6px"), this._portalEl.style.setProperty("--ui-context-menu-item-pad-x", "8px"), this._portalEl.style.setProperty("--ui-context-menu-item-font-size", "13px"), this._portalEl.style.setProperty("--ui-context-menu-item-line-height", "18px"), this._portalEl.style.setProperty("--ui-context-menu-separator-margin", "4px 8px")) : t === "lg" ? (this._portalEl.style.setProperty("--ui-context-menu-padding", "8px"), this._portalEl.style.setProperty("--ui-context-menu-item-gap", "12px"), this._portalEl.style.setProperty("--ui-context-menu-item-min-height", "40px"), this._portalEl.style.setProperty("--ui-context-menu-item-pad-y", "9px"), this._portalEl.style.setProperty("--ui-context-menu-item-pad-x", "12px"), this._portalEl.style.setProperty("--ui-context-menu-item-font-size", "15px"), this._portalEl.style.setProperty("--ui-context-menu-item-line-height", "22px"), this._portalEl.style.setProperty("--ui-context-menu-separator-margin", "8px 12px")) : (this._portalEl.style.removeProperty("--ui-context-menu-padding"), this._portalEl.style.removeProperty("--ui-context-menu-item-gap"), this._portalEl.style.removeProperty("--ui-context-menu-item-min-height"), this._portalEl.style.removeProperty("--ui-context-menu-item-pad-y"), this._portalEl.style.removeProperty("--ui-context-menu-item-pad-x"), this._portalEl.style.removeProperty("--ui-context-menu-item-font-size"), this._portalEl.style.removeProperty("--ui-context-menu-item-line-height"), this._portalEl.style.removeProperty("--ui-context-menu-separator-margin")), e ? (this._portalEl.style.setProperty("--ui-context-menu-radius", e), this._portalEl.style.setProperty("--ui-context-menu-item-radius", e), this._portalEl.style.setProperty("--ui-context-menu-submenu-radius", e)) : (this._portalEl.style.removeProperty("--ui-context-menu-radius"), this._portalEl.style.removeProperty("--ui-context-menu-item-radius"), this._portalEl.style.removeProperty("--ui-context-menu-submenu-radius")), this.state !== "idle" ? this._portalEl.setAttribute("data-state", this.state) : this._portalEl.removeAttribute("data-state");
|
|
724
708
|
const p = this._portalEl.querySelector(".state-row");
|
|
725
709
|
p && (p.textContent = this._stateText());
|
|
726
710
|
}
|
|
727
711
|
_moveContentIntoPortal() {
|
|
728
|
-
if (this._contentSourceEl)
|
|
729
|
-
return;
|
|
712
|
+
if (this._contentSourceEl) return;
|
|
730
713
|
const t = this.querySelector('[slot="menu"]') || this.querySelector('[slot="content"]'), e = this._portalContentHostEl;
|
|
731
714
|
!t || !e || (this._contentOriginalParent = t.parentNode, this._contentAnchor = document.createComment("ui-context-menu-anchor"), this._contentOriginalParent && this._contentOriginalParent.insertBefore(this._contentAnchor, t), this._contentSourceEl = t, e.appendChild(t));
|
|
732
715
|
}
|
|
733
716
|
_restoreContentFromPortal() {
|
|
734
717
|
const t = this._contentSourceEl;
|
|
735
|
-
if (!t)
|
|
736
|
-
return;
|
|
718
|
+
if (!t) return;
|
|
737
719
|
const e = this._contentAnchor, i = this._contentOriginalParent;
|
|
738
|
-
e
|
|
720
|
+
e?.parentNode ? (e.parentNode.insertBefore(t, e), e.parentNode.removeChild(e)) : i && i.appendChild(t), this._contentSourceEl = null, this._contentAnchor = null, this._contentOriginalParent = null;
|
|
739
721
|
}
|
|
740
722
|
_mountPortal() {
|
|
741
|
-
|
|
742
|
-
if ((i = this._portalEl) != null && i.isConnected)
|
|
743
|
-
return;
|
|
723
|
+
if (this._portalEl?.isConnected) return;
|
|
744
724
|
const t = A();
|
|
745
|
-
if (!t)
|
|
746
|
-
return;
|
|
725
|
+
if (!t) return;
|
|
747
726
|
const e = document.createElement("div");
|
|
748
727
|
e.className = "ui-context-menu-portal", e.style.position = "absolute", e.style.pointerEvents = "auto", e.innerHTML = `
|
|
749
728
|
<style>${D}</style>
|
|
750
729
|
<div class="surface" part="menu" role="menu" aria-hidden="true" aria-busy="false" tabindex="-1">
|
|
751
730
|
<div class="state-row" part="state"></div>
|
|
752
|
-
<ui-listbox class="content-host" slot="menu" role="menu" item-selector="${
|
|
731
|
+
<ui-listbox class="content-host" slot="menu" role="menu" item-selector="${l.replace(/"/g, """)}" direct-item-selector="${b.replace(/"/g, """)}" item-role="menuitem" active-attribute="data-active"></ui-listbox>
|
|
753
732
|
</div>
|
|
754
|
-
`, t.appendChild(e), this._portalEl = e, this._portalSurfaceEl = e.querySelector(".surface"), this._portalContentHostEl = e.querySelector("ui-listbox.content-host"), this._moveContentIntoPortal(),
|
|
733
|
+
`, t.appendChild(e), this._portalEl = e, this._portalSurfaceEl = e.querySelector(".surface"), this._portalContentHostEl = e.querySelector("ui-listbox.content-host"), this._moveContentIntoPortal(), this._portalContentHostEl?.refresh(), this._syncPortalVisualState(), this._syncSurfaceState(), this._bindPortalInteractionListeners(), this._syncDismissableLayer();
|
|
755
734
|
}
|
|
756
735
|
_teardownPortal() {
|
|
757
|
-
|
|
758
|
-
if ((t = this._dismissableLayer) == null || t.destroy(), this._dismissableLayer = null, (e = this._positioner) == null || e.destroy(), this._positioner = null, this._positionerPlacement = null, this._positionerOffset = 0, this._positionerAnchorEl = null, this._unbindPortalInteractionListeners(), this._restoreContentFromPortal(), this._portalContentHostEl = null, this._portalSurfaceEl = null, (i = this._portalEl) != null && i.parentElement)
|
|
736
|
+
if (this._dismissableLayer?.destroy(), this._dismissableLayer = null, this._positioner?.destroy(), this._positioner = null, this._positionerPlacement = null, this._positionerOffset = 0, this._positionerAnchorEl = null, this._unbindPortalInteractionListeners(), this._restoreContentFromPortal(), this._portalContentHostEl = null, this._portalSurfaceEl = null, this._portalEl?.parentElement)
|
|
759
737
|
try {
|
|
760
738
|
this._portalEl.parentElement.removeChild(this._portalEl);
|
|
761
739
|
} catch {
|
|
@@ -763,21 +741,20 @@ class U extends E {
|
|
|
763
741
|
this._portalEl = null;
|
|
764
742
|
}
|
|
765
743
|
_syncDismissableLayer() {
|
|
766
|
-
var e, i;
|
|
767
744
|
const t = this._portalSurfaceEl;
|
|
768
745
|
if (!t || !this._isOpen) {
|
|
769
|
-
|
|
746
|
+
this._dismissableLayer?.destroy(), this._dismissableLayer = null;
|
|
770
747
|
return;
|
|
771
748
|
}
|
|
772
|
-
|
|
749
|
+
this._dismissableLayer?.destroy(), this._dismissableLayer = S({
|
|
773
750
|
node: t,
|
|
774
751
|
trigger: this._anchorEl || this,
|
|
775
752
|
closeOnEscape: this.closeOnEscape,
|
|
776
753
|
closeOnPointerOutside: !0,
|
|
777
754
|
closeOnFocusOutside: !0,
|
|
778
|
-
onDismiss: (
|
|
779
|
-
const
|
|
780
|
-
this._setOpen(!1,
|
|
755
|
+
onDismiss: (e) => {
|
|
756
|
+
const i = e === "escape-key" ? "escape" : "outside";
|
|
757
|
+
this._setOpen(!1, i);
|
|
781
758
|
}
|
|
782
759
|
});
|
|
783
760
|
}
|
|
@@ -785,8 +762,7 @@ class U extends E {
|
|
|
785
762
|
this._positionRaf != null && (cancelAnimationFrame(this._positionRaf), this._positionRaf = null), this._submenuRaf != null && (cancelAnimationFrame(this._submenuRaf), this._submenuRaf = null), this._stopAnchorTracking(), this._cancelSubmenuIntent(), this._resetTypeahead();
|
|
786
763
|
}
|
|
787
764
|
_captureAnchorRect() {
|
|
788
|
-
if (!this._anchorEl)
|
|
789
|
-
return null;
|
|
765
|
+
if (!this._anchorEl) return null;
|
|
790
766
|
const t = this._anchorEl.getBoundingClientRect();
|
|
791
767
|
return {
|
|
792
768
|
top: t.top,
|
|
@@ -816,8 +792,7 @@ class U extends E {
|
|
|
816
792
|
};
|
|
817
793
|
}
|
|
818
794
|
_rebuildPositioner(t, e, i) {
|
|
819
|
-
|
|
820
|
-
(n = this._positioner) == null || n.destroy(), this._positioner = P({
|
|
795
|
+
this._positioner?.destroy(), this._positioner = P({
|
|
821
796
|
anchor: this._anchorEl || this._pointVirtualAnchor(),
|
|
822
797
|
floating: t,
|
|
823
798
|
placement: e,
|
|
@@ -825,7 +800,7 @@ class U extends E {
|
|
|
825
800
|
offset: i,
|
|
826
801
|
flip: !0,
|
|
827
802
|
shift: !0,
|
|
828
|
-
boundaryPadding:
|
|
803
|
+
boundaryPadding: a,
|
|
829
804
|
observeWindowResize: !1,
|
|
830
805
|
observeScroll: !1,
|
|
831
806
|
observeAncestorScroll: !1,
|
|
@@ -833,9 +808,9 @@ class U extends E {
|
|
|
833
808
|
observeLayoutShift: !1,
|
|
834
809
|
observeAnchorResize: !1,
|
|
835
810
|
observeFloatingResize: !1,
|
|
836
|
-
onUpdate: (
|
|
837
|
-
const
|
|
838
|
-
t.style.maxWidth = `${Math.max(160,
|
|
811
|
+
onUpdate: (o) => {
|
|
812
|
+
const n = window.innerWidth || document.documentElement.clientWidth || 0, r = window.innerHeight || document.documentElement.clientHeight || 0;
|
|
813
|
+
t.style.maxWidth = `${Math.max(160, n - a * 2)}px`, t.style.maxHeight = `${Math.max(120, r - a * 2)}px`, t.setAttribute("data-placement", o.placement.split("-")[0]);
|
|
839
814
|
}
|
|
840
815
|
}), this._positionerPlacement = e, this._positionerOffset = i, this._positionerAnchorEl = this._anchorEl;
|
|
841
816
|
}
|
|
@@ -846,27 +821,24 @@ class U extends E {
|
|
|
846
821
|
this._anchorTrackRaf != null && (cancelAnimationFrame(this._anchorTrackRaf), this._anchorTrackRaf = null), this._lastAnchorRect = null;
|
|
847
822
|
}
|
|
848
823
|
_trackAnchorLayout() {
|
|
849
|
-
if (this._anchorTrackRaf = null, !this._isOpen || !this._anchorEl)
|
|
850
|
-
return;
|
|
824
|
+
if (this._anchorTrackRaf = null, !this._isOpen || !this._anchorEl) return;
|
|
851
825
|
const t = this._captureAnchorRect(), e = this._lastAnchorRect;
|
|
852
826
|
if (this._lastAnchorRect = t, !t) {
|
|
853
827
|
this.close();
|
|
854
828
|
return;
|
|
855
829
|
}
|
|
856
|
-
|
|
830
|
+
e && (t.top !== e.top || t.left !== e.left || t.right !== e.right || t.bottom !== e.bottom || t.width !== e.width || t.height !== e.height) && (this._positionMenu(), this._layoutSubmenus()), this._anchorTrackRaf = requestAnimationFrame(this._trackAnchorLayout);
|
|
857
831
|
}
|
|
858
832
|
_resetTypeahead() {
|
|
859
833
|
this._typeaheadBuffer = "", this._typeaheadTimer != null && (window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null);
|
|
860
834
|
}
|
|
861
835
|
_normalizeMenuSemantics() {
|
|
862
|
-
var e;
|
|
863
836
|
const t = this._menuHost();
|
|
864
|
-
t &&
|
|
837
|
+
t && this._listbox()?.syncItemSemantics({ container: t });
|
|
865
838
|
}
|
|
866
839
|
_queryMenuItems(t) {
|
|
867
|
-
var i;
|
|
868
840
|
const e = t || this._menuHost();
|
|
869
|
-
return e ? (
|
|
841
|
+
return e ? (this._listbox()?.queryItems({ container: e }) || []).filter((i) => N(i)) : [];
|
|
870
842
|
}
|
|
871
843
|
_submenuFor(t) {
|
|
872
844
|
return t.querySelector(O);
|
|
@@ -875,12 +847,10 @@ class U extends E {
|
|
|
875
847
|
this._hoveredItem = null;
|
|
876
848
|
}
|
|
877
849
|
_focusItem(t) {
|
|
878
|
-
|
|
879
|
-
if (!t)
|
|
880
|
-
return;
|
|
850
|
+
if (!t) return;
|
|
881
851
|
this._clearHighlights();
|
|
882
852
|
const e = t.closest(".submenu") || this._menuHost();
|
|
883
|
-
|
|
853
|
+
this._listbox()?.setActiveItem(t, {
|
|
884
854
|
container: e,
|
|
885
855
|
focus: !0,
|
|
886
856
|
owner: this._surface(),
|
|
@@ -888,8 +858,7 @@ class U extends E {
|
|
|
888
858
|
}), this._setOpenBranch(t, !1);
|
|
889
859
|
}
|
|
890
860
|
_focusFirstItem() {
|
|
891
|
-
|
|
892
|
-
const t = (i = this._listbox()) == null ? void 0 : i.focusBoundary("first", {
|
|
861
|
+
const t = this._listbox()?.focusBoundary("first", {
|
|
893
862
|
container: this._menuHost(),
|
|
894
863
|
focus: !0,
|
|
895
864
|
owner: this._surface(),
|
|
@@ -908,8 +877,7 @@ class U extends E {
|
|
|
908
877
|
}
|
|
909
878
|
}
|
|
910
879
|
_focusLastItem() {
|
|
911
|
-
|
|
912
|
-
const t = (e = this._listbox()) == null ? void 0 : e.focusBoundary("last", {
|
|
880
|
+
const t = this._listbox()?.focusBoundary("last", {
|
|
913
881
|
container: this._menuHost(),
|
|
914
882
|
focus: !0,
|
|
915
883
|
owner: this._surface(),
|
|
@@ -918,145 +886,126 @@ class U extends E {
|
|
|
918
886
|
t && this._setOpenBranch(t, !1);
|
|
919
887
|
}
|
|
920
888
|
_findCurrentItem(t) {
|
|
921
|
-
var i;
|
|
922
889
|
if (t && typeof t.composedPath == "function") {
|
|
923
|
-
const
|
|
924
|
-
if (
|
|
925
|
-
return n;
|
|
890
|
+
const i = G(t.composedPath());
|
|
891
|
+
if (i) return i;
|
|
926
892
|
}
|
|
927
893
|
const e = document.activeElement;
|
|
928
894
|
if (e instanceof HTMLElement) {
|
|
929
|
-
const
|
|
930
|
-
if (
|
|
931
|
-
return n;
|
|
895
|
+
const i = e.closest(l);
|
|
896
|
+
if (i instanceof HTMLElement) return i;
|
|
932
897
|
}
|
|
933
|
-
return
|
|
898
|
+
return this._hoveredItem?.isConnected ? this._hoveredItem : null;
|
|
934
899
|
}
|
|
935
900
|
_moveFocus(t, e) {
|
|
936
|
-
var s, r, u;
|
|
937
901
|
const i = t.closest(".submenu") || this._menuHost();
|
|
938
|
-
if (!i)
|
|
939
|
-
return;
|
|
902
|
+
if (!i) return;
|
|
940
903
|
if (e === "first") {
|
|
941
|
-
const
|
|
904
|
+
const n = this._listbox()?.focusBoundary("first", {
|
|
942
905
|
container: i,
|
|
943
906
|
focus: !0,
|
|
944
907
|
owner: this._surface(),
|
|
945
908
|
scroll: !0
|
|
946
909
|
});
|
|
947
|
-
|
|
910
|
+
n && this._setOpenBranch(n, !1);
|
|
948
911
|
return;
|
|
949
912
|
}
|
|
950
913
|
if (e === "last") {
|
|
951
|
-
const
|
|
914
|
+
const n = this._listbox()?.focusBoundary("last", {
|
|
952
915
|
container: i,
|
|
953
916
|
focus: !0,
|
|
954
917
|
owner: this._surface(),
|
|
955
918
|
scroll: !0
|
|
956
919
|
});
|
|
957
|
-
|
|
920
|
+
n && this._setOpenBranch(n, !1);
|
|
958
921
|
return;
|
|
959
922
|
}
|
|
960
|
-
const
|
|
923
|
+
const o = this._listbox()?.move(e === "next" ? 1 : -1, {
|
|
961
924
|
container: i,
|
|
962
925
|
current: t,
|
|
963
926
|
focus: !0,
|
|
964
927
|
owner: this._surface(),
|
|
965
928
|
scroll: !0
|
|
966
929
|
});
|
|
967
|
-
|
|
930
|
+
o && this._setOpenBranch(o, !1);
|
|
968
931
|
}
|
|
969
932
|
_setOpenBranch(t, e) {
|
|
970
933
|
const i = this._menuHost();
|
|
971
|
-
if (!i || (i.querySelectorAll('[data-submenu-open="true"]').forEach((r) => r.removeAttribute("data-submenu-open")), !t))
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
if (!r)
|
|
978
|
-
break;
|
|
934
|
+
if (!i || (i.querySelectorAll('[data-submenu-open="true"]').forEach((r) => r.removeAttribute("data-submenu-open")), !t)) return;
|
|
935
|
+
const o = [];
|
|
936
|
+
let n = t;
|
|
937
|
+
for (; n; ) {
|
|
938
|
+
const r = n.closest(".submenu");
|
|
939
|
+
if (!r) break;
|
|
979
940
|
const u = r.parentElement;
|
|
980
|
-
if (!(u instanceof HTMLElement) || !u.matches(
|
|
981
|
-
|
|
982
|
-
n.unshift(u), s = u;
|
|
941
|
+
if (!(u instanceof HTMLElement) || !u.matches(l)) break;
|
|
942
|
+
o.unshift(u), n = u;
|
|
983
943
|
}
|
|
984
|
-
|
|
944
|
+
o.forEach((r) => r.setAttribute("data-submenu-open", "true")), e && this._submenuFor(t) && t.setAttribute("data-submenu-open", "true");
|
|
985
945
|
}
|
|
986
946
|
_openSubmenu(t, e) {
|
|
987
|
-
var s;
|
|
988
947
|
this._cancelSubmenuIntent();
|
|
989
948
|
const i = this._submenuFor(t);
|
|
990
|
-
if (!i || x(t))
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
return !0;
|
|
994
|
-
const n = (s = this._listbox()) == null ? void 0 : s.focusBoundary("first", {
|
|
949
|
+
if (!i || x(t)) return !1;
|
|
950
|
+
if (this._setOpenBranch(t, !0), this._scheduleSubmenuLayout(), !e) return !0;
|
|
951
|
+
const o = this._listbox()?.focusBoundary("first", {
|
|
995
952
|
container: i,
|
|
996
953
|
focus: !0,
|
|
997
954
|
owner: this._surface(),
|
|
998
955
|
scroll: !0
|
|
999
956
|
});
|
|
1000
|
-
return
|
|
957
|
+
return o && this._setOpenBranch(o, !1), !0;
|
|
1001
958
|
}
|
|
1002
959
|
_closeParentSubmenu(t) {
|
|
1003
960
|
const e = t.closest(".submenu");
|
|
1004
|
-
if (!e)
|
|
1005
|
-
return !1;
|
|
961
|
+
if (!e) return !1;
|
|
1006
962
|
const i = e.parentElement;
|
|
1007
|
-
return !(i instanceof HTMLElement) || !i.matches(
|
|
963
|
+
return !(i instanceof HTMLElement) || !i.matches(l) ? !1 : (this._focusItem(i), this._setOpenBranch(i, !1), i.removeAttribute("data-submenu-open"), !0);
|
|
1008
964
|
}
|
|
1009
965
|
_clearSubmenuState() {
|
|
1010
|
-
var e;
|
|
1011
966
|
this._cancelSubmenuIntent(), this._hoveredItem = null;
|
|
1012
967
|
const t = this._menuHost();
|
|
1013
|
-
t && (t.querySelectorAll('[data-submenu-open="true"]').forEach((
|
|
968
|
+
t && (t.querySelectorAll('[data-submenu-open="true"]').forEach((e) => e.removeAttribute("data-submenu-open")), this._listbox()?.clearActive({ container: t }));
|
|
1014
969
|
}
|
|
1015
970
|
_handleTypeahead(t, e) {
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
const i = (e == null ? void 0 : e.closest(".submenu")) || this._menuHost();
|
|
1020
|
-
if (!i)
|
|
1021
|
-
return !1;
|
|
971
|
+
if (!this.typeahead || t.ctrlKey || t.altKey || t.metaKey || t.key.length !== 1 || !/\S/.test(t.key)) return !1;
|
|
972
|
+
const i = e?.closest(".submenu") || this._menuHost();
|
|
973
|
+
if (!i) return !1;
|
|
1022
974
|
this._typeaheadBuffer = `${this._typeaheadBuffer}${t.key}`.slice(-24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(), R);
|
|
1023
|
-
const
|
|
975
|
+
const o = this._listbox()?.typeahead(this._typeaheadBuffer, {
|
|
1024
976
|
container: i,
|
|
1025
977
|
current: e,
|
|
1026
978
|
focus: !0,
|
|
1027
979
|
owner: this._surface(),
|
|
1028
980
|
scroll: !0
|
|
1029
981
|
});
|
|
1030
|
-
return
|
|
982
|
+
return o ? (t.preventDefault(), this._setOpenBranch(o, !1), !0) : !1;
|
|
1031
983
|
}
|
|
1032
984
|
_applySelectionBehavior(t) {
|
|
1033
985
|
const e = t.getAttribute("role");
|
|
1034
986
|
if (e === "menuitemcheckbox") {
|
|
1035
|
-
const
|
|
1036
|
-
t.setAttribute("aria-checked",
|
|
987
|
+
const n = t.getAttribute("aria-checked") !== "true";
|
|
988
|
+
t.setAttribute("aria-checked", n ? "true" : "false"), t.setAttribute("data-state", n ? "checked" : "unchecked");
|
|
1037
989
|
return;
|
|
1038
990
|
}
|
|
1039
|
-
if (e !== "menuitemradio")
|
|
1040
|
-
return;
|
|
991
|
+
if (e !== "menuitemradio") return;
|
|
1041
992
|
const i = t.closest(".submenu") || this._menuHost();
|
|
1042
|
-
if (!i)
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
n && r !== n || (s.setAttribute("aria-checked", "false"), s.setAttribute("data-state", "unchecked"));
|
|
993
|
+
if (!i) return;
|
|
994
|
+
const o = t.getAttribute("data-group") || t.getAttribute("name") || "";
|
|
995
|
+
i.querySelectorAll('[role="menuitemradio"]').forEach((n) => {
|
|
996
|
+
const r = n.getAttribute("data-group") || n.getAttribute("name") || "";
|
|
997
|
+
o && r !== o || (n.setAttribute("aria-checked", "false"), n.setAttribute("data-state", "unchecked"));
|
|
1048
998
|
}), t.setAttribute("aria-checked", "true"), t.setAttribute("data-state", "checked");
|
|
1049
999
|
}
|
|
1050
1000
|
_emitSelect(t) {
|
|
1051
|
-
|
|
1052
|
-
const e = this._menuHost(), n = (e ? Array.from(e.querySelectorAll(c)) : []).indexOf(t);
|
|
1001
|
+
const e = this._menuHost(), o = (e ? Array.from(e.querySelectorAll(l)) : []).indexOf(t);
|
|
1053
1002
|
this.dispatchEvent(new CustomEvent("select", {
|
|
1054
1003
|
bubbles: !0,
|
|
1055
1004
|
composed: !0,
|
|
1056
1005
|
detail: {
|
|
1057
|
-
index:
|
|
1006
|
+
index: o,
|
|
1058
1007
|
value: t.getAttribute("data-value") || t.getAttribute("value") || void 0,
|
|
1059
|
-
label: t.getAttribute("aria-label") ||
|
|
1008
|
+
label: t.getAttribute("aria-label") || t.textContent?.trim() || void 0,
|
|
1060
1009
|
checked: t.getAttribute("aria-checked") === "true",
|
|
1061
1010
|
item: t
|
|
1062
1011
|
}
|
|
@@ -1068,20 +1017,18 @@ class U extends E {
|
|
|
1068
1017
|
}));
|
|
1069
1018
|
}
|
|
1070
1019
|
_positionMenu() {
|
|
1071
|
-
var r;
|
|
1072
1020
|
const t = this._surface();
|
|
1073
|
-
if (!t)
|
|
1074
|
-
return;
|
|
1021
|
+
if (!t) return;
|
|
1075
1022
|
if (this._anchorEl && !W(this._anchorEl)) {
|
|
1076
1023
|
this.close();
|
|
1077
1024
|
return;
|
|
1078
1025
|
}
|
|
1079
|
-
const e = $(this.getAttribute("placement")), i = V(e),
|
|
1080
|
-
if (!this._positioner || this._positionerPlacement !== i || this._positionerOffset !==
|
|
1081
|
-
this._rebuildPositioner(t, i,
|
|
1026
|
+
const e = $(this.getAttribute("placement")), i = V(e), o = this._anchorEl ? L : 0;
|
|
1027
|
+
if (!this._positioner || this._positionerPlacement !== i || this._positionerOffset !== o || this._positionerAnchorEl !== this._anchorEl) {
|
|
1028
|
+
this._rebuildPositioner(t, i, o);
|
|
1082
1029
|
return;
|
|
1083
1030
|
}
|
|
1084
|
-
|
|
1031
|
+
this._positioner?.update();
|
|
1085
1032
|
}
|
|
1086
1033
|
_scheduleSubmenuLayout() {
|
|
1087
1034
|
this._isOpen && (this._submenuRaf != null && cancelAnimationFrame(this._submenuRaf), this._submenuRaf = requestAnimationFrame(() => {
|
|
@@ -1090,23 +1037,20 @@ class U extends E {
|
|
|
1090
1037
|
}
|
|
1091
1038
|
_layoutSubmenus() {
|
|
1092
1039
|
const t = this._menuHost();
|
|
1093
|
-
if (!t)
|
|
1094
|
-
return;
|
|
1040
|
+
if (!t) return;
|
|
1095
1041
|
const e = window.innerWidth || document.documentElement.clientWidth || 0, i = window.innerHeight || document.documentElement.clientHeight || 0;
|
|
1096
|
-
Array.from(t.querySelectorAll('.menuitem > .submenu, [role="menuitem"] > .submenu')).forEach((
|
|
1097
|
-
const r =
|
|
1098
|
-
if (!(r instanceof HTMLElement))
|
|
1099
|
-
return;
|
|
1042
|
+
Array.from(t.querySelectorAll('.menuitem > .submenu, [role="menuitem"] > .submenu')).forEach((n) => {
|
|
1043
|
+
const r = n.parentElement;
|
|
1044
|
+
if (!(r instanceof HTMLElement)) return;
|
|
1100
1045
|
r.removeAttribute("data-submenu-side"), r.removeAttribute("data-submenu-align");
|
|
1101
|
-
const u =
|
|
1102
|
-
|
|
1103
|
-
const d = r.getBoundingClientRect(), f =
|
|
1104
|
-
d.right +
|
|
1046
|
+
const u = n.style.display, c = n.style.visibility, h = n.style.pointerEvents, m = n.style.opacity, p = n.style.transform;
|
|
1047
|
+
n.style.display = "grid", n.style.visibility = "hidden", n.style.pointerEvents = "none", n.style.opacity = "0", n.style.transform = "none";
|
|
1048
|
+
const d = r.getBoundingClientRect(), f = n.getBoundingClientRect();
|
|
1049
|
+
d.right + a + f.width > e && d.left - a - f.width >= a && r.setAttribute("data-submenu-side", "left"), d.top + f.height > i - a && d.bottom - f.height >= a && r.setAttribute("data-submenu-align", "up"), n.style.display = u, n.style.visibility = c, n.style.pointerEvents = h, n.style.opacity = m, n.style.transform = p;
|
|
1105
1050
|
});
|
|
1106
1051
|
}
|
|
1107
1052
|
_onRootClick(t) {
|
|
1108
|
-
if (!this._isOpen || this.isDisabled || this.state === "loading")
|
|
1109
|
-
return;
|
|
1053
|
+
if (!this._isOpen || this.isDisabled || this.state === "loading") return;
|
|
1110
1054
|
const e = this._findCurrentItem(t);
|
|
1111
1055
|
if (!(!e || x(e))) {
|
|
1112
1056
|
if (this._submenuFor(e)) {
|
|
@@ -1117,8 +1061,7 @@ class U extends E {
|
|
|
1117
1061
|
}
|
|
1118
1062
|
}
|
|
1119
1063
|
_onRootPointerOver(t) {
|
|
1120
|
-
if (!this._isOpen)
|
|
1121
|
-
return;
|
|
1064
|
+
if (!this._isOpen) return;
|
|
1122
1065
|
const e = this._findCurrentItem(t);
|
|
1123
1066
|
if (!(!e || x(e))) {
|
|
1124
1067
|
if (this._hoveredItem = e, this._submenuFor(e)) {
|
|
@@ -1132,15 +1075,12 @@ class U extends E {
|
|
|
1132
1075
|
this._cancelSubmenuIntent(), this._clearHighlights();
|
|
1133
1076
|
}
|
|
1134
1077
|
_onRootFocusIn(t) {
|
|
1135
|
-
|
|
1136
|
-
if (!this._isOpen)
|
|
1137
|
-
return;
|
|
1078
|
+
if (!this._isOpen) return;
|
|
1138
1079
|
this._cancelSubmenuIntent();
|
|
1139
1080
|
const e = this._findCurrentItem(t);
|
|
1140
|
-
if (!e || x(e))
|
|
1141
|
-
return;
|
|
1081
|
+
if (!e || x(e)) return;
|
|
1142
1082
|
const i = e.closest(".submenu") || this._menuHost();
|
|
1143
|
-
|
|
1083
|
+
this._listbox()?.setActiveItem(e, {
|
|
1144
1084
|
container: i,
|
|
1145
1085
|
focus: !1,
|
|
1146
1086
|
owner: this._surface(),
|
|
@@ -1158,13 +1098,11 @@ class U extends E {
|
|
|
1158
1098
|
}, C));
|
|
1159
1099
|
}
|
|
1160
1100
|
_onRootKeyDown(t) {
|
|
1161
|
-
if (!this._isOpen)
|
|
1162
|
-
return;
|
|
1101
|
+
if (!this._isOpen) return;
|
|
1163
1102
|
const e = this._findCurrentItem(t);
|
|
1164
1103
|
if (!this._handleTypeahead(t, e)) {
|
|
1165
1104
|
if (t.key === "Escape") {
|
|
1166
|
-
if (!this.closeOnEscape)
|
|
1167
|
-
return;
|
|
1105
|
+
if (!this.closeOnEscape) return;
|
|
1168
1106
|
t.preventDefault(), this._setOpen(!1, "escape");
|
|
1169
1107
|
return;
|
|
1170
1108
|
}
|
|
@@ -1213,7 +1151,7 @@ class U extends E {
|
|
|
1213
1151
|
<style>${g}</style>
|
|
1214
1152
|
<div class="surface" part="menu" role="menu" aria-hidden="true" aria-busy="false" tabindex="-1">
|
|
1215
1153
|
<div class="state-row" part="state" data-state="${this.state}">${t}</div>
|
|
1216
|
-
<ui-listbox class="content-host" part="content" slot="menu" role="menu" item-selector="${
|
|
1154
|
+
<ui-listbox class="content-host" part="content" slot="menu" role="menu" item-selector="${l.replace(/"/g, """)}" direct-item-selector="${b.replace(/"/g, """)}" item-role="menuitem" active-attribute="data-active">
|
|
1217
1155
|
<slot name="menu"></slot>
|
|
1218
1156
|
<slot name="content"></slot>
|
|
1219
1157
|
</ui-listbox>
|