@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/sidebar.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { E as T } from "./ElementBase-
|
|
2
|
-
const
|
|
1
|
+
import { E as T } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
const y = {
|
|
3
3
|
sm: { expanded: 220, collapsed: 64, min: 168, max: 300 },
|
|
4
4
|
md: { expanded: 236, collapsed: 72, min: 180, max: 320 },
|
|
5
5
|
lg: { expanded: 268, collapsed: 80, min: 192, max: 360 }
|
|
6
|
-
},
|
|
6
|
+
}, w = /* @__PURE__ */ new Set([
|
|
7
7
|
"variant",
|
|
8
8
|
"size",
|
|
9
9
|
"density",
|
|
@@ -21,7 +21,7 @@ const _ = {
|
|
|
21
21
|
"position",
|
|
22
22
|
"rail",
|
|
23
23
|
"headless"
|
|
24
|
-
]),
|
|
24
|
+
]), _ = /* @__PURE__ */ new Set([
|
|
25
25
|
"width",
|
|
26
26
|
"min-width",
|
|
27
27
|
"max-width",
|
|
@@ -746,41 +746,36 @@ const _ = {
|
|
|
746
746
|
function d(o) {
|
|
747
747
|
return o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
748
748
|
}
|
|
749
|
-
function
|
|
750
|
-
if (!o)
|
|
751
|
-
return null;
|
|
749
|
+
function f(o) {
|
|
750
|
+
if (!o) return null;
|
|
752
751
|
const e = o.trim();
|
|
753
752
|
return e ? ["none", "sm", "md", "lg", "full"].includes(e) ? e : /^\d+(\.\d+)?$/.test(e) ? `${e}px` : e : null;
|
|
754
753
|
}
|
|
755
|
-
function
|
|
756
|
-
if (!o)
|
|
757
|
-
return null;
|
|
754
|
+
function m(o) {
|
|
755
|
+
if (!o) return null;
|
|
758
756
|
const e = o.trim();
|
|
759
757
|
return e ? /^\d+(\.\d+)?$/.test(e) ? `${e}px` : e : null;
|
|
760
758
|
}
|
|
761
|
-
function
|
|
759
|
+
function z(o) {
|
|
762
760
|
return o === "sm" || o === "1" ? "sm" : o === "lg" || o === "3" ? "lg" : "md";
|
|
763
761
|
}
|
|
764
762
|
function l(o, e) {
|
|
765
|
-
if (!o)
|
|
766
|
-
return e;
|
|
763
|
+
if (!o) return e;
|
|
767
764
|
const i = Number.parseFloat(String(o));
|
|
768
765
|
return Number.isFinite(i) ? i : e;
|
|
769
766
|
}
|
|
770
|
-
function
|
|
767
|
+
function v(o) {
|
|
771
768
|
return o.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "") || "item";
|
|
772
769
|
}
|
|
773
770
|
class V extends T {
|
|
774
771
|
constructor() {
|
|
775
772
|
super(...arguments), this._observer = null, this._resizeCleanup = null, this._responsiveCleanup = null, this._responsiveAutoCollapsed = !1, this._userCollapsePreference = !1, this._expanded = /* @__PURE__ */ new Set(), this._dragging = !1, this._lastExpandedWidth = 0, this._handleSearchInput = (e) => {
|
|
776
773
|
const i = e.target;
|
|
777
|
-
if (!i)
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
const r = typeof i.value == "string" ? i.value : "";
|
|
783
|
-
r ? this.setAttribute("search-query", r) : this.removeAttribute("search-query"), this.dispatchEvent(new CustomEvent("search-change", { detail: { query: r }, bubbles: !0 }));
|
|
774
|
+
if (!i) return;
|
|
775
|
+
const r = i.closest('[slot="search"]');
|
|
776
|
+
if (!r || !this.contains(r)) return;
|
|
777
|
+
const t = typeof i.value == "string" ? i.value : "";
|
|
778
|
+
t ? this.setAttribute("search-query", t) : this.removeAttribute("search-query"), this.dispatchEvent(new CustomEvent("search-change", { detail: { query: t }, bubbles: !0 }));
|
|
784
779
|
};
|
|
785
780
|
}
|
|
786
781
|
static get observedAttributes() {
|
|
@@ -822,23 +817,22 @@ class V extends T {
|
|
|
822
817
|
super.connectedCallback(), this._observeLightDom(), this._bindResponsiveCollapse(), this.addEventListener("input", this._handleSearchInput, !0), this.addEventListener("change", this._handleSearchInput, !0);
|
|
823
818
|
}
|
|
824
819
|
disconnectedCallback() {
|
|
825
|
-
|
|
826
|
-
(e = this._observer) == null || e.disconnect(), this._observer = null, (i = this._resizeCleanup) == null || i.call(this), this._resizeCleanup = null, (t = this._responsiveCleanup) == null || t.call(this), this._responsiveCleanup = null, this.removeEventListener("input", this._handleSearchInput, !0), this.removeEventListener("change", this._handleSearchInput, !0), super.disconnectedCallback();
|
|
820
|
+
this._observer?.disconnect(), this._observer = null, this._resizeCleanup?.(), this._resizeCleanup = null, this._responsiveCleanup?.(), this._responsiveCleanup = null, this.removeEventListener("input", this._handleSearchInput, !0), this.removeEventListener("change", this._handleSearchInput, !0), super.disconnectedCallback();
|
|
827
821
|
}
|
|
828
822
|
shouldRenderOnAttributeChange(e) {
|
|
829
|
-
return !(
|
|
823
|
+
return !(_.has(e) || w.has(e) || e === "collapsed" || e === "value" || e === "radius");
|
|
830
824
|
}
|
|
831
|
-
attributeChangedCallback(e, i,
|
|
832
|
-
if (i !==
|
|
825
|
+
attributeChangedCallback(e, i, r) {
|
|
826
|
+
if (i !== r) {
|
|
833
827
|
if (e === "radius" && this.isConnected) {
|
|
834
|
-
const
|
|
835
|
-
if (
|
|
836
|
-
this.setAttribute("radius",
|
|
828
|
+
const t = f(r);
|
|
829
|
+
if (t && t !== r) {
|
|
830
|
+
this.setAttribute("radius", t);
|
|
837
831
|
return;
|
|
838
832
|
}
|
|
839
833
|
}
|
|
840
834
|
if (this.isConnected) {
|
|
841
|
-
if (
|
|
835
|
+
if (_.has(e)) {
|
|
842
836
|
this._applySizing();
|
|
843
837
|
return;
|
|
844
838
|
}
|
|
@@ -850,7 +844,7 @@ class V extends T {
|
|
|
850
844
|
this._applyItemMetrics();
|
|
851
845
|
return;
|
|
852
846
|
}
|
|
853
|
-
if (!
|
|
847
|
+
if (!w.has(e)) {
|
|
854
848
|
if (e === "collapsed") {
|
|
855
849
|
this.hasAttribute("collapsed") && this._expanded.clear(), this._applySizing(), this._syncExpandedDom();
|
|
856
850
|
return;
|
|
@@ -859,7 +853,7 @@ class V extends T {
|
|
|
859
853
|
this._syncActiveDom();
|
|
860
854
|
return;
|
|
861
855
|
}
|
|
862
|
-
super.attributeChangedCallback(e, i,
|
|
856
|
+
super.attributeChangedCallback(e, i, r);
|
|
863
857
|
}
|
|
864
858
|
}
|
|
865
859
|
}
|
|
@@ -880,19 +874,19 @@ class V extends T {
|
|
|
880
874
|
(typeof e == "boolean" ? e : !this.hasAttribute("collapsed")) ? this.collapse() : this.expand();
|
|
881
875
|
}
|
|
882
876
|
render() {
|
|
883
|
-
const e = this._buildSections(), i = !this.querySelector('[slot="header"]'),
|
|
877
|
+
const e = this._buildSections(), i = !this.querySelector('[slot="header"]'), r = !this.querySelector('[slot="search"]'), t = !this.querySelector('[slot="footer"]'), s = !this.querySelector('[slot="promo"]'), n = `
|
|
884
878
|
<aside class="shell" part="shell">
|
|
885
879
|
<div class="header-wrap" part="header" ${i ? "hidden" : ""}><slot name="header"></slot></div>
|
|
886
|
-
<div class="search-wrap" part="search" ${
|
|
880
|
+
<div class="search-wrap" part="search" ${r ? "hidden" : ""}><slot name="search"></slot></div>
|
|
887
881
|
<nav class="nav" part="nav" aria-label="${d(this.getAttribute("aria-label") || "Sidebar")}">
|
|
888
882
|
${e}
|
|
889
883
|
</nav>
|
|
890
884
|
<div class="promo-wrap" part="promo" ${s ? "hidden" : ""}><slot name="promo"></slot></div>
|
|
891
|
-
<div class="footer-wrap" part="footer" ${
|
|
885
|
+
<div class="footer-wrap" part="footer" ${t ? "hidden" : ""}><slot name="footer"></slot></div>
|
|
892
886
|
<button class="resize-handle" part="resize-handle" type="button" aria-label="Resize sidebar"></button>
|
|
893
887
|
</aside>
|
|
894
888
|
`;
|
|
895
|
-
this.setContent(D(
|
|
889
|
+
this.setContent(D(n)), this._applyItemMetrics(), this._applyRadius(), this._applySizing(), this._bindInteractions(), this._syncActiveDom(), this._syncExpandedDom();
|
|
896
890
|
}
|
|
897
891
|
_observeLightDom() {
|
|
898
892
|
this._observer || (this._observer = new MutationObserver((e) => {
|
|
@@ -906,10 +900,10 @@ class V extends T {
|
|
|
906
900
|
}
|
|
907
901
|
_buildSections() {
|
|
908
902
|
const e = this._groupItems(this._filterItems(this._collectItems(), this.getAttribute("search-query") || ""));
|
|
909
|
-
return e.length ? e.map(({ label: i, items:
|
|
903
|
+
return e.length ? e.map(({ label: i, items: r }) => `
|
|
910
904
|
<section class="section" part="section">
|
|
911
905
|
${i ? `<div class="section-label" part="section-label">${d(i)}</div>` : ""}
|
|
912
|
-
<div class="section-items">${
|
|
906
|
+
<div class="section-items">${r.map((s, n) => this._renderItem(s, `${v(i || "general")}-${n}`)).join("")}</div>
|
|
913
907
|
</section>
|
|
914
908
|
`).join("") : `
|
|
915
909
|
<section class="section" part="section">
|
|
@@ -927,18 +921,18 @@ class V extends T {
|
|
|
927
921
|
`;
|
|
928
922
|
}
|
|
929
923
|
_renderItem(e, i) {
|
|
930
|
-
const
|
|
924
|
+
const r = e.id || i, t = this.value ? this.value === e.value : !!e.active, s = this._expanded.has(r), n = this.getAttribute("show-icons") !== "false", a = this.getAttribute("show-badges") !== "false", c = e.description ? `<div class="item-description">${d(e.description)}</div>` : "", u = e.contentHtml ? `<span class="copy custom-copy">${e.contentHtml}</span>` : `<span class="copy">
|
|
931
925
|
<span class="item-label">${d(e.label)}</span>
|
|
932
926
|
${c}
|
|
933
|
-
</span>`,
|
|
927
|
+
</span>`, p = n ? this._renderIcon(e) : "", g = a && e.badge ? `<span class="badge" part="badge">${d(e.badge)}</span>` : "", b = e.children.length ? '<span class="arrow-wrap" part="arrow" aria-hidden="true"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true"><path d="M6 3.75L10.25 8L6 12.25" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg></span>' : "", A = p ? `<span class="icon-wrap" part="icon"><span class="icon">${p}</span></span>` : "", C = g || b ? `<span class="end-wrap">${g ? `<span class="meta">${g}</span>` : ""}${b}</span>` : "", h = !!e.href && !e.children.length, E = t ? ' aria-current="page" data-active="true"' : "", $ = e.disabled ? ' aria-disabled="true"' : ' aria-disabled="false"', k = e.tone && e.tone !== "default" ? ` data-tone="${d(e.tone)}"` : "", I = h ? ` href="${d(e.href || "")}"` : "", S = h && e.target ? ` target="${d(e.target)}"` : "", P = h && e.rel ? ` rel="${d(e.rel)}"` : "", L = e.children.length ? `<div class="submenu" part="submenu"><div class="submenu-inner">${e.children.map((R, W) => this._renderItem(R, `${r}-${W}`)).join("")}</div></div>` : "", x = h ? "a" : "button", H = h ? "" : ' type="button"';
|
|
934
928
|
return `
|
|
935
|
-
<div class="item" data-item-id="${d(
|
|
936
|
-
<${
|
|
929
|
+
<div class="item" data-item-id="${d(r)}" data-value="${d(e.value)}" ${s ? 'data-expanded="true"' : ""}>
|
|
930
|
+
<${x}
|
|
937
931
|
class="item-button"
|
|
938
932
|
part="item"
|
|
939
933
|
${H}
|
|
940
|
-
data-action="${e.children.length ? "toggle" :
|
|
941
|
-
data-item-id="${d(
|
|
934
|
+
data-action="${e.children.length ? "toggle" : h ? "navigate" : "select"}"
|
|
935
|
+
data-item-id="${d(r)}"
|
|
942
936
|
data-value="${d(e.value)}"
|
|
943
937
|
${I}
|
|
944
938
|
${S}
|
|
@@ -947,10 +941,10 @@ class V extends T {
|
|
|
947
941
|
${$}
|
|
948
942
|
${k}
|
|
949
943
|
>
|
|
950
|
-
${
|
|
944
|
+
${A}
|
|
951
945
|
${u}
|
|
952
|
-
${
|
|
953
|
-
</${
|
|
946
|
+
${C}
|
|
947
|
+
</${x}>
|
|
954
948
|
${L}
|
|
955
949
|
</div>
|
|
956
950
|
`;
|
|
@@ -971,19 +965,18 @@ class V extends T {
|
|
|
971
965
|
return Array.from(this.querySelectorAll('[slot="item"]')).map((e) => this._parseSlottedItem(e));
|
|
972
966
|
}
|
|
973
967
|
_parseSlottedItem(e) {
|
|
974
|
-
var r, s;
|
|
975
968
|
let i = [];
|
|
976
|
-
const
|
|
977
|
-
if (
|
|
969
|
+
const r = e.dataset.children;
|
|
970
|
+
if (r)
|
|
978
971
|
try {
|
|
979
|
-
const
|
|
980
|
-
Array.isArray(
|
|
972
|
+
const t = JSON.parse(r);
|
|
973
|
+
Array.isArray(t) && (i = t);
|
|
981
974
|
} catch {
|
|
982
975
|
i = [];
|
|
983
976
|
}
|
|
984
977
|
return {
|
|
985
|
-
value: e.dataset.value ||
|
|
986
|
-
label: e.dataset.label ||
|
|
978
|
+
value: e.dataset.value || e.textContent?.trim() || "item",
|
|
979
|
+
label: e.dataset.label || e.textContent?.trim() || e.dataset.value || "Item",
|
|
987
980
|
href: e.dataset.href,
|
|
988
981
|
target: e.dataset.target,
|
|
989
982
|
rel: e.dataset.rel,
|
|
@@ -1001,67 +994,65 @@ class V extends T {
|
|
|
1001
994
|
}
|
|
1002
995
|
_renderIcon(e) {
|
|
1003
996
|
const i = String(e.iconHtml || "").trim();
|
|
1004
|
-
if (i)
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
return t ? d(t) : "";
|
|
997
|
+
if (i) return i;
|
|
998
|
+
const r = String(e.icon || "").trim();
|
|
999
|
+
return r ? d(r) : "";
|
|
1008
1000
|
}
|
|
1009
|
-
_normalizeItems(e, i = 0,
|
|
1010
|
-
return e.map((
|
|
1011
|
-
|
|
1012
|
-
const a = ((b = r.label) == null ? void 0 : b.trim()) || ((p = r.value) == null ? void 0 : p.trim()) || `Item ${s + 1}`, n = ((v = r.value) == null ? void 0 : v.trim()) || x(a), c = ((f = r.section) == null ? void 0 : f.trim()) || t || "", u = `${x(c || "nav")}-${x(n)}-${i}-${s}`, h = this._normalizeItems(r.children || [], i + 1, c);
|
|
1001
|
+
_normalizeItems(e, i = 0, r = "") {
|
|
1002
|
+
return e.map((t, s) => {
|
|
1003
|
+
const n = t.label?.trim() || t.value?.trim() || `Item ${s + 1}`, a = t.value?.trim() || v(n), c = t.section?.trim() || r || "", u = `${v(c || "nav")}-${v(a)}-${i}-${s}`, p = this._normalizeItems(t.children || [], i + 1, c);
|
|
1013
1004
|
return {
|
|
1014
|
-
...
|
|
1005
|
+
...t,
|
|
1015
1006
|
id: u,
|
|
1016
|
-
label:
|
|
1017
|
-
value:
|
|
1007
|
+
label: n,
|
|
1008
|
+
value: a,
|
|
1018
1009
|
section: c,
|
|
1019
|
-
children:
|
|
1010
|
+
children: p,
|
|
1020
1011
|
depth: i
|
|
1021
1012
|
};
|
|
1022
1013
|
});
|
|
1023
1014
|
}
|
|
1024
1015
|
_groupItems(e) {
|
|
1025
|
-
const i = [],
|
|
1026
|
-
for (const
|
|
1027
|
-
const s =
|
|
1028
|
-
if (
|
|
1029
|
-
|
|
1016
|
+
const i = [], r = /* @__PURE__ */ new Map();
|
|
1017
|
+
for (const t of e) {
|
|
1018
|
+
const s = t.section || "", n = r.get(s);
|
|
1019
|
+
if (n) {
|
|
1020
|
+
n.items.push(t);
|
|
1030
1021
|
continue;
|
|
1031
1022
|
}
|
|
1032
|
-
const
|
|
1033
|
-
|
|
1023
|
+
const a = { label: s, items: [t] };
|
|
1024
|
+
r.set(s, a), i.push(a);
|
|
1034
1025
|
}
|
|
1035
1026
|
return i;
|
|
1036
1027
|
}
|
|
1037
1028
|
_filterItems(e, i) {
|
|
1038
|
-
const
|
|
1039
|
-
return
|
|
1040
|
-
const s = [
|
|
1041
|
-
return !s && !
|
|
1042
|
-
...
|
|
1043
|
-
children:
|
|
1029
|
+
const r = i.trim().toLowerCase();
|
|
1030
|
+
return r ? e.map((t) => {
|
|
1031
|
+
const s = [t.label, t.description, t.value, t.section].filter(Boolean).some((a) => String(a).toLowerCase().includes(r)), n = s ? t.children : this._filterItems(t.children, r);
|
|
1032
|
+
return !s && !n.length ? null : {
|
|
1033
|
+
...t,
|
|
1034
|
+
children: n
|
|
1044
1035
|
};
|
|
1045
|
-
}).filter((
|
|
1036
|
+
}).filter((t) => !!t) : e;
|
|
1046
1037
|
}
|
|
1047
1038
|
_bindInteractions() {
|
|
1048
1039
|
this.root.querySelectorAll(".item-button").forEach((i) => {
|
|
1049
|
-
i.onclick = (
|
|
1050
|
-
const
|
|
1051
|
-
if (
|
|
1040
|
+
i.onclick = (r) => {
|
|
1041
|
+
const t = r.currentTarget, s = t.dataset.action, n = t.dataset.itemId || "", a = t.dataset.value || "";
|
|
1042
|
+
if (t.getAttribute("aria-disabled") !== "true") {
|
|
1052
1043
|
if (s === "toggle") {
|
|
1053
|
-
|
|
1044
|
+
r.preventDefault(), this._toggleExpanded(n);
|
|
1054
1045
|
return;
|
|
1055
1046
|
}
|
|
1056
1047
|
if (s === "navigate") {
|
|
1057
|
-
this._selectValue(
|
|
1048
|
+
this._selectValue(a);
|
|
1058
1049
|
return;
|
|
1059
1050
|
}
|
|
1060
|
-
|
|
1051
|
+
r.preventDefault(), this._selectValue(a);
|
|
1061
1052
|
}
|
|
1062
|
-
}, i.onkeydown = (
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1053
|
+
}, i.onkeydown = (r) => {
|
|
1054
|
+
const t = r.currentTarget, s = t.dataset.itemId || "", n = t.dataset.value || "";
|
|
1055
|
+
r.key === "ArrowRight" && t.dataset.action === "toggle" ? (r.preventDefault(), this._expanded.add(s), this._syncExpandedDom()) : r.key === "ArrowLeft" ? (r.preventDefault(), this._expanded.delete(s), this._syncExpandedDom()) : (r.key === "Enter" || r.key === " ") && (r.preventDefault(), t.dataset.action === "toggle" ? this._toggleExpanded(s) : this._selectValue(n));
|
|
1065
1056
|
};
|
|
1066
1057
|
});
|
|
1067
1058
|
const e = this.root.querySelector(".resize-handle");
|
|
@@ -1078,11 +1069,11 @@ class V extends T {
|
|
|
1078
1069
|
}
|
|
1079
1070
|
_selectValue(e) {
|
|
1080
1071
|
this.value = e;
|
|
1081
|
-
const i = this._flattenItems(this._collectItems()),
|
|
1082
|
-
index:
|
|
1072
|
+
const i = this._flattenItems(this._collectItems()), r = i.findIndex((n) => n.value === e), t = i[r], s = {
|
|
1073
|
+
index: r,
|
|
1083
1074
|
value: e,
|
|
1084
|
-
label:
|
|
1085
|
-
item:
|
|
1075
|
+
label: t?.label || e,
|
|
1076
|
+
item: t
|
|
1086
1077
|
};
|
|
1087
1078
|
this.dispatchEvent(new CustomEvent("select", { detail: s, bubbles: !0 })), this.dispatchEvent(new CustomEvent("change", { detail: s, bubbles: !0 }));
|
|
1088
1079
|
}
|
|
@@ -1096,8 +1087,8 @@ class V extends T {
|
|
|
1096
1087
|
return e.flatMap((i) => [i, ...this._flattenItems(i.children)]);
|
|
1097
1088
|
}
|
|
1098
1089
|
_applySizing() {
|
|
1099
|
-
const e =
|
|
1100
|
-
this.style.setProperty("--ui-sidebar-width", `${c}px`), this.style.setProperty("--ui-sidebar-min-width", `${
|
|
1090
|
+
const e = z(this.getAttribute("size")), i = y[e], r = l(this.getAttribute("width"), i.expanded), t = l(this.getAttribute("min-width"), i.min), s = l(this.getAttribute("max-width"), i.max), n = l(this.getAttribute("collapsed-width"), i.collapsed), a = this._restoreWidth(r), c = Math.min(Math.max(a, t), s), u = this.hasAttribute("collapsed") ? n : c;
|
|
1091
|
+
this.style.setProperty("--ui-sidebar-width", `${c}px`), this.style.setProperty("--ui-sidebar-min-width", `${t}px`), this.style.setProperty("--ui-sidebar-max-width", `${s}px`), this.style.setProperty("--ui-sidebar-collapsed-width", `${n}px`), this.style.setProperty("--ui-sidebar-current-width", `${u}px`), this.style.setProperty("inline-size", `${u}px`);
|
|
1101
1092
|
}
|
|
1102
1093
|
_applyRadius() {
|
|
1103
1094
|
const e = this.getAttribute("radius"), i = this.getAttribute("item-radius");
|
|
@@ -1105,12 +1096,12 @@ class V extends T {
|
|
|
1105
1096
|
this.style.removeProperty("--ui-sidebar-radius"), i || this.style.removeProperty("--ui-sidebar-item-radius"), this.style.removeProperty("--ui-sidebar-promo-radius");
|
|
1106
1097
|
return;
|
|
1107
1098
|
}
|
|
1108
|
-
const
|
|
1109
|
-
this.style.setProperty("--ui-sidebar-radius",
|
|
1099
|
+
const r = f(e) || e;
|
|
1100
|
+
this.style.setProperty("--ui-sidebar-radius", r), i || this.style.setProperty("--ui-sidebar-item-radius", r), this.style.setProperty("--ui-sidebar-promo-radius", r);
|
|
1110
1101
|
}
|
|
1111
1102
|
_applyItemMetrics() {
|
|
1112
|
-
const e =
|
|
1113
|
-
this._setOptionalCssVar("--ui-sidebar-item-radius", e), this._setOptionalCssVar("--ui-sidebar-item-gap", i), this._setOptionalCssVar("--ui-sidebar-item-padding-x",
|
|
1103
|
+
const e = f(this.getAttribute("item-radius")), i = m(this.getAttribute("item-gap")), r = m(this.getAttribute("item-padding-x")), t = m(this.getAttribute("item-padding-y")), s = m(this.getAttribute("item-height")), n = m(this.getAttribute("item-font-size")), a = m(this.getAttribute("item-line-height"));
|
|
1104
|
+
this._setOptionalCssVar("--ui-sidebar-item-radius", e), this._setOptionalCssVar("--ui-sidebar-item-gap", i), this._setOptionalCssVar("--ui-sidebar-item-padding-x", r), this._setOptionalCssVar("--ui-sidebar-item-padding-y", t), this._setOptionalCssVar("--ui-sidebar-item-height", s), this._setOptionalCssVar("--ui-sidebar-item-font-size", n), this._setOptionalCssVar("--ui-sidebar-item-line-height", a);
|
|
1114
1105
|
}
|
|
1115
1106
|
_setOptionalCssVar(e, i) {
|
|
1116
1107
|
if (!i) {
|
|
@@ -1120,24 +1111,20 @@ class V extends T {
|
|
|
1120
1111
|
this.style.setProperty(e, i);
|
|
1121
1112
|
}
|
|
1122
1113
|
_restoreWidth(e) {
|
|
1123
|
-
if (!this.hasAttribute("auto-save"))
|
|
1124
|
-
return e;
|
|
1114
|
+
if (!this.hasAttribute("auto-save")) return e;
|
|
1125
1115
|
const i = this.getAttribute("storage-key");
|
|
1126
|
-
if (!i)
|
|
1127
|
-
return e;
|
|
1116
|
+
if (!i) return e;
|
|
1128
1117
|
try {
|
|
1129
|
-
const
|
|
1130
|
-
if (!
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
return Number.isFinite(r) ? r : e;
|
|
1118
|
+
const r = window.localStorage.getItem(`ui-sidebar:${i}`);
|
|
1119
|
+
if (!r) return e;
|
|
1120
|
+
const t = Number.parseFloat(r);
|
|
1121
|
+
return Number.isFinite(t) ? t : e;
|
|
1134
1122
|
} catch {
|
|
1135
1123
|
return e;
|
|
1136
1124
|
}
|
|
1137
1125
|
}
|
|
1138
1126
|
_persistWidth(e) {
|
|
1139
|
-
if (!this.hasAttribute("auto-save"))
|
|
1140
|
-
return;
|
|
1127
|
+
if (!this.hasAttribute("auto-save")) return;
|
|
1141
1128
|
const i = this.getAttribute("storage-key");
|
|
1142
1129
|
if (i)
|
|
1143
1130
|
try {
|
|
@@ -1147,12 +1134,10 @@ class V extends T {
|
|
|
1147
1134
|
}
|
|
1148
1135
|
_currentExpandedWidth() {
|
|
1149
1136
|
const e = Number.parseFloat(this.style.getPropertyValue("--ui-sidebar-width"));
|
|
1150
|
-
return Number.isFinite(e) && e > 0 ? e : l(this.getAttribute("width"),
|
|
1137
|
+
return Number.isFinite(e) && e > 0 ? e : l(this.getAttribute("width"), y[z(this.getAttribute("size"))].expanded);
|
|
1151
1138
|
}
|
|
1152
1139
|
_bindResponsiveCollapse() {
|
|
1153
|
-
|
|
1154
|
-
if ((t = this._responsiveCleanup) == null || t.call(this), this._responsiveCleanup = null, typeof window > "u" || typeof window.matchMedia != "function")
|
|
1155
|
-
return;
|
|
1140
|
+
if (this._responsiveCleanup?.(), this._responsiveCleanup = null, typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
1156
1141
|
const e = window.matchMedia("(max-width: 767px)"), i = () => this._syncResponsiveCollapse(e.matches);
|
|
1157
1142
|
typeof e.addEventListener == "function" ? e.addEventListener("change", i) : typeof e.addListener == "function" && e.addListener(i), this._responsiveCleanup = () => {
|
|
1158
1143
|
typeof e.removeEventListener == "function" ? e.removeEventListener("change", i) : typeof e.removeListener == "function" && e.removeListener(i);
|
|
@@ -1178,38 +1163,31 @@ class V extends T {
|
|
|
1178
1163
|
this.dispatchEvent(new CustomEvent("width-change", { detail: i, bubbles: !0 }));
|
|
1179
1164
|
}
|
|
1180
1165
|
_handleResizeKey(e) {
|
|
1181
|
-
const
|
|
1182
|
-
let
|
|
1183
|
-
if (e.key === "ArrowRight")
|
|
1184
|
-
|
|
1185
|
-
else if (e.key === "
|
|
1186
|
-
|
|
1187
|
-
else
|
|
1188
|
-
|
|
1189
|
-
else if (e.key === "End")
|
|
1190
|
-
n = a;
|
|
1191
|
-
else
|
|
1192
|
-
return;
|
|
1193
|
-
e.preventDefault(), n = Math.min(Math.max(n, s), a), this.style.setProperty("--ui-sidebar-width", `${n}px`), this.hasAttribute("collapsed") || (this.style.setProperty("--ui-sidebar-current-width", `${n}px`), this.style.setProperty("inline-size", `${n}px`)), this._persistWidth(n), this._emitWidthChange("keyboard");
|
|
1166
|
+
const r = this.getAttribute("position") === "right" ? -1 : 1, t = this._currentExpandedWidth(), s = l(this.style.getPropertyValue("--ui-sidebar-min-width"), t), n = l(this.style.getPropertyValue("--ui-sidebar-max-width"), t);
|
|
1167
|
+
let a = t;
|
|
1168
|
+
if (e.key === "ArrowRight") a = t + 16 * r;
|
|
1169
|
+
else if (e.key === "ArrowLeft") a = t - 16 * r;
|
|
1170
|
+
else if (e.key === "Home") a = s;
|
|
1171
|
+
else if (e.key === "End") a = n;
|
|
1172
|
+
else return;
|
|
1173
|
+
e.preventDefault(), a = Math.min(Math.max(a, s), n), this.style.setProperty("--ui-sidebar-width", `${a}px`), this.hasAttribute("collapsed") || (this.style.setProperty("--ui-sidebar-current-width", `${a}px`), this.style.setProperty("inline-size", `${a}px`)), this._persistWidth(a), this._emitWidthChange("keyboard");
|
|
1194
1174
|
}
|
|
1195
1175
|
_startResize(e) {
|
|
1196
|
-
if (!this.hasAttribute("resizable"))
|
|
1197
|
-
return;
|
|
1176
|
+
if (!this.hasAttribute("resizable")) return;
|
|
1198
1177
|
e.preventDefault();
|
|
1199
|
-
const i = this.getAttribute("position") === "right",
|
|
1200
|
-
this._dragging = !0, this.dispatchEvent(new CustomEvent("resize-start", { detail: { width:
|
|
1201
|
-
const
|
|
1202
|
-
const
|
|
1203
|
-
this.style.setProperty("--ui-sidebar-width", `${
|
|
1178
|
+
const i = this.getAttribute("position") === "right", r = e.clientX, t = this._currentExpandedWidth(), s = l(this.style.getPropertyValue("--ui-sidebar-min-width"), t), n = l(this.style.getPropertyValue("--ui-sidebar-max-width"), t);
|
|
1179
|
+
this._dragging = !0, this.dispatchEvent(new CustomEvent("resize-start", { detail: { width: t }, bubbles: !0 }));
|
|
1180
|
+
const a = (u) => {
|
|
1181
|
+
const p = u.clientX - r, g = i ? t - p : t + p, b = Math.min(Math.max(g, s), n);
|
|
1182
|
+
this.style.setProperty("--ui-sidebar-width", `${b}px`), this.hasAttribute("collapsed") || (this.style.setProperty("--ui-sidebar-current-width", `${b}px`), this.style.setProperty("inline-size", `${b}px`)), this.dispatchEvent(new CustomEvent("resize", { detail: { width: b }, bubbles: !0 }));
|
|
1204
1183
|
}, c = () => {
|
|
1205
|
-
if (!this._dragging)
|
|
1206
|
-
|
|
1207
|
-
this._dragging = !1, window.removeEventListener("pointermove", n), window.removeEventListener("pointerup", c);
|
|
1184
|
+
if (!this._dragging) return;
|
|
1185
|
+
this._dragging = !1, window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", c);
|
|
1208
1186
|
const u = this._currentExpandedWidth();
|
|
1209
1187
|
this._persistWidth(u), this._emitWidthChange("pointer"), this.dispatchEvent(new CustomEvent("resize-end", { detail: { width: u }, bubbles: !0 }));
|
|
1210
1188
|
};
|
|
1211
|
-
window.addEventListener("pointermove",
|
|
1212
|
-
window.removeEventListener("pointermove",
|
|
1189
|
+
window.addEventListener("pointermove", a), window.addEventListener("pointerup", c), this._resizeCleanup = () => {
|
|
1190
|
+
window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", c);
|
|
1213
1191
|
};
|
|
1214
1192
|
}
|
|
1215
1193
|
}
|
package/dist/skeleton.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("./ElementBase-EV6mVBUV.js");function r(a){const e=a.trim();return!e||/[;{}<>"']/.test(e)?"":e}const x=`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
--ui-skeleton-radius: 10px;
|
|
@@ -183,23 +183,23 @@
|
|
|
183
183
|
display: none !important;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
`,
|
|
187
|
-
<style>${
|
|
186
|
+
`,g=["96%","86%","78%","92%","68%","88%"];class p extends f.ElementBase{static get observedAttributes(){return["count","height","width","radius","gap","variant","animated","animation","density","tone","duration","headless"]}_numAttr(e,t){const i=this.getAttribute(e);if(!i)return t;const n=Number(i);return Number.isFinite(n)&&n>0?n:t}_animationMode(){const e=(this.getAttribute("animation")||"").trim().toLowerCase();return e==="shimmer"||e==="pulse"||e==="wave"||e==="none"?e:this.hasAttribute("animated")?"shimmer":"none"}_lineWidth(e,t,i){return i&&i.trim()?i:t==="text"?g[e%g.length]||"92%":t==="badge"?"92px":t==="button"?"128px":t==="avatar"?"44px":"100%"}render(){const e=Math.max(1,Math.min(40,this._numAttr("count",1))),t=this.getAttribute("height"),i=this.getAttribute("width"),n=this.getAttribute("radius"),o=this.getAttribute("gap"),s=this.getAttribute("duration"),m=(this.getAttribute("variant")||"rect").trim(),k=this._animationMode(),b=Array.from({length:e},(w,v)=>`<div class="line" style="--ui-line-width:${r(this._lineWidth(v,m,i))};"></div>`).join(""),u=t?r(t):"",l=i?r(i):"",c=n?r(n):"",d=o?r(o):"",h=s?r(s):"";this.setContent(`
|
|
187
|
+
<style>${x}</style>
|
|
188
188
|
<div
|
|
189
189
|
class="stack"
|
|
190
|
-
data-animation="${
|
|
190
|
+
data-animation="${k}"
|
|
191
191
|
style="
|
|
192
|
-
${
|
|
193
|
-
${
|
|
194
|
-
${
|
|
195
|
-
${
|
|
196
|
-
${
|
|
192
|
+
${u?`--ui-skeleton-height:${u};`:""}
|
|
193
|
+
${l?`--ui-skeleton-width:${l};`:""}
|
|
194
|
+
${c?`--ui-skeleton-radius:${c};`:""}
|
|
195
|
+
${d?`--ui-skeleton-gap:${d};`:""}
|
|
196
|
+
${h?`--ui-skeleton-duration:${h};`:""}
|
|
197
197
|
"
|
|
198
198
|
role="status"
|
|
199
199
|
aria-live="polite"
|
|
200
200
|
aria-busy="true"
|
|
201
201
|
aria-label="Loading"
|
|
202
202
|
>
|
|
203
|
-
${
|
|
203
|
+
${b}
|
|
204
204
|
</div>
|
|
205
|
-
`)}shouldRenderOnAttributeChange(e,t,i){return!0}}typeof customElements<"u"&&!customElements.get("ui-skeleton")&&customElements.define("ui-skeleton",
|
|
205
|
+
`)}shouldRenderOnAttributeChange(e,t,i){return!0}}typeof customElements<"u"&&!customElements.get("ui-skeleton")&&customElements.define("ui-skeleton",p);exports.UISkeleton=p;
|
package/dist/skeleton.esm.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
|
|
1
|
+
import { E as v } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
function r(a) {
|
|
3
|
+
const e = a.trim();
|
|
4
|
+
return !e || /[;{}<>"']/.test(e) ? "" : e;
|
|
5
|
+
}
|
|
6
|
+
const f = `
|
|
3
7
|
:host {
|
|
4
8
|
display: block;
|
|
5
9
|
--ui-skeleton-radius: 10px;
|
|
@@ -184,8 +188,8 @@ const h = `
|
|
|
184
188
|
display: none !important;
|
|
185
189
|
}
|
|
186
190
|
}
|
|
187
|
-
`,
|
|
188
|
-
class
|
|
191
|
+
`, g = ["96%", "86%", "78%", "92%", "68%", "88%"];
|
|
192
|
+
class x extends v {
|
|
189
193
|
static get observedAttributes() {
|
|
190
194
|
return [
|
|
191
195
|
"count",
|
|
@@ -202,48 +206,47 @@ class g extends c {
|
|
|
202
206
|
"headless"
|
|
203
207
|
];
|
|
204
208
|
}
|
|
205
|
-
_numAttr(e,
|
|
206
|
-
const
|
|
207
|
-
if (!t
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return Number.isFinite(n) && n > 0 ? n : i;
|
|
209
|
+
_numAttr(e, t) {
|
|
210
|
+
const i = this.getAttribute(e);
|
|
211
|
+
if (!i) return t;
|
|
212
|
+
const n = Number(i);
|
|
213
|
+
return Number.isFinite(n) && n > 0 ? n : t;
|
|
211
214
|
}
|
|
212
215
|
_animationMode() {
|
|
213
216
|
const e = (this.getAttribute("animation") || "").trim().toLowerCase();
|
|
214
217
|
return e === "shimmer" || e === "pulse" || e === "wave" || e === "none" ? e : this.hasAttribute("animated") ? "shimmer" : "none";
|
|
215
218
|
}
|
|
216
|
-
_lineWidth(e,
|
|
217
|
-
return
|
|
219
|
+
_lineWidth(e, t, i) {
|
|
220
|
+
return i && i.trim() ? i : t === "text" ? g[e % g.length] || "92%" : t === "badge" ? "92px" : t === "button" ? "128px" : t === "avatar" ? "44px" : "100%";
|
|
218
221
|
}
|
|
219
222
|
render() {
|
|
220
|
-
const e = Math.max(1, Math.min(40, this._numAttr("count", 1))),
|
|
223
|
+
const e = Math.max(1, Math.min(40, this._numAttr("count", 1))), t = this.getAttribute("height"), i = this.getAttribute("width"), n = this.getAttribute("radius"), o = this.getAttribute("gap"), s = this.getAttribute("duration"), p = (this.getAttribute("variant") || "rect").trim(), m = this._animationMode(), k = Array.from({ length: e }, (w, b) => `<div class="line" style="--ui-line-width:${r(this._lineWidth(b, p, i))};"></div>`).join(""), u = t ? r(t) : "", l = i ? r(i) : "", c = n ? r(n) : "", d = o ? r(o) : "", h = s ? r(s) : "";
|
|
221
224
|
this.setContent(`
|
|
222
|
-
<style>${
|
|
225
|
+
<style>${f}</style>
|
|
223
226
|
<div
|
|
224
227
|
class="stack"
|
|
225
|
-
data-animation="${
|
|
228
|
+
data-animation="${m}"
|
|
226
229
|
style="
|
|
227
|
-
${
|
|
228
|
-
${
|
|
229
|
-
${
|
|
230
|
-
${
|
|
231
|
-
${
|
|
230
|
+
${u ? `--ui-skeleton-height:${u};` : ""}
|
|
231
|
+
${l ? `--ui-skeleton-width:${l};` : ""}
|
|
232
|
+
${c ? `--ui-skeleton-radius:${c};` : ""}
|
|
233
|
+
${d ? `--ui-skeleton-gap:${d};` : ""}
|
|
234
|
+
${h ? `--ui-skeleton-duration:${h};` : ""}
|
|
232
235
|
"
|
|
233
236
|
role="status"
|
|
234
237
|
aria-live="polite"
|
|
235
238
|
aria-busy="true"
|
|
236
239
|
aria-label="Loading"
|
|
237
240
|
>
|
|
238
|
-
${
|
|
241
|
+
${k}
|
|
239
242
|
</div>
|
|
240
243
|
`);
|
|
241
244
|
}
|
|
242
|
-
shouldRenderOnAttributeChange(e,
|
|
245
|
+
shouldRenderOnAttributeChange(e, t, i) {
|
|
243
246
|
return !0;
|
|
244
247
|
}
|
|
245
248
|
}
|
|
246
|
-
typeof customElements < "u" && !customElements.get("ui-skeleton") && customElements.define("ui-skeleton",
|
|
249
|
+
typeof customElements < "u" && !customElements.get("ui-skeleton") && customElements.define("ui-skeleton", x);
|
|
247
250
|
export {
|
|
248
|
-
|
|
251
|
+
x as UISkeleton
|
|
249
252
|
};
|