@mintplayer/web-components 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunks/{mp-treeview-Bfq4_IVW.mjs → mp-treeview-C48F63xb.mjs} +8 -8
- package/file-manager/index.mjs +1 -1
- package/package.json +1 -1
- package/query-builder/index.mjs +4 -0
- package/ribbon/index.mjs +23 -23
- package/shell/index.mjs +485 -0
- package/shell/src/components/index.d.ts +2 -0
- package/shell/src/components/mp-shell.d.ts +59 -0
- package/shell/src/index.d.ts +4 -0
- package/shell/src/styles/index.d.ts +1 -0
- package/shell/src/styles/shell.styles.d.ts +2 -0
- package/shell/src/types/index.d.ts +1 -0
- package/shell/src/types/shell-state.d.ts +8 -0
- package/tree-select/index.mjs +717 -0
- package/tree-select/src/components/index.d.ts +2 -0
- package/tree-select/src/components/mp-tree-select.d.ts +122 -0
- package/tree-select/src/index.d.ts +6 -0
- package/tree-select/src/providers/in-memory-provider.d.ts +29 -0
- package/tree-select/src/styles/index.d.ts +1 -0
- package/tree-select/src/styles/tree-select.styles.d.ts +2 -0
- package/tree-select/src/types/index.d.ts +1 -0
- package/tree-select/src/types/tree-select.d.ts +51 -0
- package/treeview/index.mjs +1 -1
|
@@ -271,12 +271,12 @@ class R extends y {
|
|
|
271
271
|
`;
|
|
272
272
|
}
|
|
273
273
|
renderNode(e, t, s, i) {
|
|
274
|
-
const r = !!(e.children && e.children.length > 0), c = !!e.lazy && !r,
|
|
274
|
+
const r = !!(e.children && e.children.length > 0), c = !!e.lazy && !r, p = r || c, l = this._loadingIds.has(e.id), v = this._errorIds.get(e.id), a = this._expandedIds.has(e.id), u = this._selectedIds.has(e.id), f = this._focusedId === e.id, m = f ? 0 : -1, w = e.iconKey && this._iconResolver ? this._iconResolver(e.iconKey, e) : void 0, _ = (t - 1) * 20, x = `${this.instanceId}-row-${e.id}`, g = this._nodeRenderer ? this._nodeRenderer(e, {
|
|
275
275
|
level: t,
|
|
276
276
|
expanded: a,
|
|
277
|
-
selected:
|
|
277
|
+
selected: u,
|
|
278
278
|
focused: f,
|
|
279
|
-
hasChildren:
|
|
279
|
+
hasChildren: p
|
|
280
280
|
}) : void 0;
|
|
281
281
|
return d`
|
|
282
282
|
<li role="none">
|
|
@@ -285,15 +285,15 @@ class R extends y {
|
|
|
285
285
|
class="treeview-row"
|
|
286
286
|
role="treeitem"
|
|
287
287
|
data-node-id=${e.id}
|
|
288
|
-
data-selected=${
|
|
288
|
+
data-selected=${u ? "true" : "false"}
|
|
289
289
|
data-loading=${l ? "true" : "false"}
|
|
290
290
|
data-error=${v ? "true" : "false"}
|
|
291
291
|
aria-level=${t}
|
|
292
292
|
aria-setsize=${i}
|
|
293
293
|
aria-posinset=${s + 1}
|
|
294
|
-
aria-expanded=${
|
|
294
|
+
aria-expanded=${p ? a ? "true" : "false" : n}
|
|
295
295
|
aria-busy=${l ? "true" : n}
|
|
296
|
-
aria-selected=${this._selectionMode !== "none" ?
|
|
296
|
+
aria-selected=${this._selectionMode !== "none" ? u ? "true" : "false" : n}
|
|
297
297
|
tabindex=${m}
|
|
298
298
|
style=${`padding-left:${_ + 12}px`}
|
|
299
299
|
@click=${(o) => this.onRowClick(e, o)}
|
|
@@ -301,7 +301,7 @@ class R extends y {
|
|
|
301
301
|
title=${v ?? n}
|
|
302
302
|
>
|
|
303
303
|
<span
|
|
304
|
-
class=${`treeview-chevron${
|
|
304
|
+
class=${`treeview-chevron${p ? "" : " invisible"}${l ? " loading" : ""}`}
|
|
305
305
|
data-expanded=${a ? "true" : "false"}
|
|
306
306
|
@click=${(o) => this.onChevronClick(e, o)}
|
|
307
307
|
aria-hidden="true"
|
|
@@ -337,7 +337,7 @@ class R extends y {
|
|
|
337
337
|
t.stopPropagation(), this.focusNode(e.id), this.toggleSelection(e, t.ctrlKey || t.metaKey), e.children && e.children.length > 0 && this.toggleExpansion(e);
|
|
338
338
|
}
|
|
339
339
|
onChevronClick(e, t) {
|
|
340
|
-
|
|
340
|
+
((e.children?.length ?? 0) > 0 || e.lazy) && (t.stopPropagation(), this.focusNode(e.id), this.toggleExpansion(e));
|
|
341
341
|
}
|
|
342
342
|
onRowKeydown(e, t) {
|
|
343
343
|
const s = !!(e.children && e.children.length > 0), i = this._expandedIds.has(e.id);
|
package/file-manager/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { unsafeHTML as u } from "lit/directives/unsafe-html.js";
|
|
|
4
4
|
import { createRef as v, ref as w } from "lit/directives/ref.js";
|
|
5
5
|
import { styleMap as y } from "lit/directives/style-map.js";
|
|
6
6
|
import "../chunks/mp-splitter-C8cGCmac.mjs";
|
|
7
|
-
import "../chunks/mp-treeview-
|
|
7
|
+
import "../chunks/mp-treeview-C48F63xb.mjs";
|
|
8
8
|
import "../chunks/mp-datatable-Con0yQue.mjs";
|
|
9
9
|
const $ = b(`:host {
|
|
10
10
|
display: flex;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/web-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Framework-agnostic Lit web components for the @mintplayer/bootstrap design system. Consumed by @mintplayer/ng-bootstrap, @mintplayer/react-bootstrap, and @mintplayer/vue-bootstrap.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
package/query-builder/index.mjs
CHANGED
package/ribbon/index.mjs
CHANGED
|
@@ -739,7 +739,7 @@ class k extends w {
|
|
|
739
739
|
return o.length === 0 ? null : o.find((r) => r.getAttribute("tabindex") === "0") ?? o[0];
|
|
740
740
|
}
|
|
741
741
|
updated(e) {
|
|
742
|
-
if (e.has("activeTabId")) {
|
|
742
|
+
if (!this.activeTabId && this.tabsList.length > 0 && (this.activeTabId = this.tabsList[0].tabId), e.has("activeTabId")) {
|
|
743
743
|
this.applyActiveAttribute();
|
|
744
744
|
const o = this.tabsList.findIndex((r) => r.tabId === this.activeTabId);
|
|
745
745
|
o >= 0 && (this.currentTabIndex = o);
|
|
@@ -980,19 +980,19 @@ class k extends w {
|
|
|
980
980
|
const h = (p) => Number(p.getAttribute("priority") ?? "0"), u = (p) => p.getAttribute("auto-scale") !== "false", f = () => {
|
|
981
981
|
let p = null, A = 1 / 0, C = -1;
|
|
982
982
|
for (let y = 0; y < r.length; y++) {
|
|
983
|
-
const
|
|
984
|
-
if (
|
|
985
|
-
const z = h(
|
|
986
|
-
(z < A || z === A && y > C) && (p =
|
|
983
|
+
const $ = r[y];
|
|
984
|
+
if ($.getAttribute("data-resolved-size") === "popup" || !u($)) continue;
|
|
985
|
+
const z = h($);
|
|
986
|
+
(z < A || z === A && y > C) && (p = $, A = z, C = y);
|
|
987
987
|
}
|
|
988
988
|
return p;
|
|
989
989
|
}, m = () => {
|
|
990
990
|
let p = null, A = -1 / 0, C = 1 / 0;
|
|
991
991
|
for (let y = 0; y < r.length; y++) {
|
|
992
|
-
const
|
|
993
|
-
if (
|
|
994
|
-
const z = h(
|
|
995
|
-
(z > A || z === A && y < C) && (p =
|
|
992
|
+
const $ = r[y];
|
|
993
|
+
if ($.getAttribute("data-resolved-size") !== "popup") continue;
|
|
994
|
+
const z = h($);
|
|
995
|
+
(z > A || z === A && y < C) && (p = $, A = z, C = y);
|
|
996
996
|
}
|
|
997
997
|
return p;
|
|
998
998
|
};
|
|
@@ -1311,7 +1311,7 @@ var le = Object.defineProperty, E = (s, e, o, r) => {
|
|
|
1311
1311
|
return t && le(e, o, t), t;
|
|
1312
1312
|
};
|
|
1313
1313
|
const de = "mp-ribbon-button, mp-ribbon-toggle-button, mp-ribbon-checkbox, mp-ribbon-combobox, mp-ribbon-color-picker, mp-ribbon-group-button, mp-ribbon-split-button, mp-ribbon-dropdown-button, mp-ribbon-gallery";
|
|
1314
|
-
class
|
|
1314
|
+
class I extends w {
|
|
1315
1315
|
constructor() {
|
|
1316
1316
|
super(...arguments), this.tabId = "", this.label = "", this.active = !1, this.idealSizes = {}, this.reduceOrder = [], this.overflowEntries = [], this.overflowOverlay = new G(this, {
|
|
1317
1317
|
anchor: () => this.overflowTriggerEl ?? null,
|
|
@@ -1556,29 +1556,29 @@ class $ extends w {
|
|
|
1556
1556
|
}
|
|
1557
1557
|
E([
|
|
1558
1558
|
l({ type: String, attribute: "tab-id", reflect: !0 })
|
|
1559
|
-
],
|
|
1559
|
+
], I.prototype, "tabId");
|
|
1560
1560
|
E([
|
|
1561
1561
|
l({ type: String, reflect: !0 })
|
|
1562
|
-
],
|
|
1562
|
+
], I.prototype, "label");
|
|
1563
1563
|
E([
|
|
1564
1564
|
l({ type: Boolean, reflect: !0 })
|
|
1565
|
-
],
|
|
1565
|
+
], I.prototype, "active");
|
|
1566
1566
|
E([
|
|
1567
1567
|
l({ attribute: !1 })
|
|
1568
|
-
],
|
|
1568
|
+
], I.prototype, "idealSizes");
|
|
1569
1569
|
E([
|
|
1570
1570
|
l({ attribute: !1 })
|
|
1571
|
-
],
|
|
1571
|
+
], I.prototype, "reduceOrder");
|
|
1572
1572
|
E([
|
|
1573
1573
|
_()
|
|
1574
|
-
],
|
|
1574
|
+
], I.prototype, "overflowEntries");
|
|
1575
1575
|
E([
|
|
1576
1576
|
S(".overflow-trigger")
|
|
1577
|
-
],
|
|
1577
|
+
], I.prototype, "overflowTriggerEl");
|
|
1578
1578
|
E([
|
|
1579
1579
|
S(".overflow-panel")
|
|
1580
|
-
],
|
|
1581
|
-
customElements.define("mp-ribbon-tab",
|
|
1580
|
+
], I.prototype, "overflowPanelEl");
|
|
1581
|
+
customElements.define("mp-ribbon-tab", I);
|
|
1582
1582
|
var ce = Object.defineProperty, W = (s, e, o, r) => {
|
|
1583
1583
|
for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
|
|
1584
1584
|
(n = s[i]) && (t = n(e, o, t) || t);
|
|
@@ -2849,10 +2849,10 @@ ie([
|
|
|
2849
2849
|
l({ type: Array })
|
|
2850
2850
|
], Y.prototype, "buttons");
|
|
2851
2851
|
customElements.define("mp-ribbon-group-button", Y);
|
|
2852
|
-
var
|
|
2852
|
+
var Ie = Object.defineProperty, $e = (s, e, o, r) => {
|
|
2853
2853
|
for (var t = void 0, i = s.length - 1, n; i >= 0; i--)
|
|
2854
2854
|
(n = s[i]) && (t = n(e, o, t) || t);
|
|
2855
|
-
return t &&
|
|
2855
|
+
return t && Ie(e, o, t), t;
|
|
2856
2856
|
};
|
|
2857
2857
|
class re extends v {
|
|
2858
2858
|
constructor() {
|
|
@@ -2884,7 +2884,7 @@ class re extends v {
|
|
|
2884
2884
|
`;
|
|
2885
2885
|
}
|
|
2886
2886
|
}
|
|
2887
|
-
|
|
2887
|
+
$e([
|
|
2888
2888
|
l({ type: Number })
|
|
2889
2889
|
], re.prototype, "columns");
|
|
2890
2890
|
customElements.define("mp-ribbon-gallery", re);
|
|
@@ -3145,7 +3145,7 @@ export {
|
|
|
3145
3145
|
R as MpRibbonMenuItem,
|
|
3146
3146
|
Oe as MpRibbonMenuSeparator,
|
|
3147
3147
|
q as MpRibbonSplitButton,
|
|
3148
|
-
|
|
3148
|
+
I as MpRibbonTab,
|
|
3149
3149
|
ne as MpRibbonTemplateItem,
|
|
3150
3150
|
J as MpRibbonToggleButton
|
|
3151
3151
|
};
|
package/shell/index.mjs
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import { unsafeCSS as l, LitElement as a, html as r } from "lit";
|
|
2
|
+
const h = l(`:host {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
position: relative;
|
|
6
|
+
--mp-shell-size: 15rem;
|
|
7
|
+
--mp-shell-open: 0;
|
|
8
|
+
--mp-shell-wide: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.topbar {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
flex: 0 0 auto;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.sidebar-root {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: stretch;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
flex: 1 1 auto;
|
|
22
|
+
min-block-size: 0;
|
|
23
|
+
position: relative;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.sidebar {
|
|
27
|
+
flex: 0 0 auto;
|
|
28
|
+
overflow-x: hidden;
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
min-block-size: 0;
|
|
31
|
+
transition: transform 0.3s ease-in-out, inline-size 0.3s ease-in-out;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.content {
|
|
35
|
+
flex: 1 1 auto;
|
|
36
|
+
min-inline-size: 0;
|
|
37
|
+
min-block-size: 0;
|
|
38
|
+
overflow-y: auto;
|
|
39
|
+
transition: margin-inline-start 0.3s ease-in-out;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.shell-toggle {
|
|
43
|
+
position: absolute;
|
|
44
|
+
inline-size: 1px;
|
|
45
|
+
block-size: 1px;
|
|
46
|
+
margin: -1px;
|
|
47
|
+
padding: 0;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
clip: rect(0 0 0 0);
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
border: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.shell-hamburger {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
flex: 0 0 auto;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
padding: 0.5rem 0.75rem;
|
|
61
|
+
font-size: 1.25rem;
|
|
62
|
+
line-height: 1;
|
|
63
|
+
user-select: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
:host([external-toggle]) .shell-hamburger {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:host([breakpoint=xs]) .sidebar {
|
|
71
|
+
position: absolute;
|
|
72
|
+
inset-block: 0;
|
|
73
|
+
inset-inline-start: 0;
|
|
74
|
+
inline-size: 100%;
|
|
75
|
+
z-index: 1030;
|
|
76
|
+
transform: translateX(calc((var(--mp-shell-open) - 1) * 100%));
|
|
77
|
+
}
|
|
78
|
+
:host([breakpoint=xs]) .content {
|
|
79
|
+
margin-inline-start: 0;
|
|
80
|
+
}
|
|
81
|
+
:host([breakpoint=xs]) .sidebar-root {
|
|
82
|
+
--mp-shell-wide: 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@media (min-width: 576px) {
|
|
86
|
+
:host([breakpoint=sm]) .sidebar {
|
|
87
|
+
position: absolute;
|
|
88
|
+
inset-block: 0;
|
|
89
|
+
inset-inline-start: 0;
|
|
90
|
+
inline-size: var(--mp-shell-size);
|
|
91
|
+
z-index: 1030;
|
|
92
|
+
transform: translateX(calc((var(--mp-shell-open) - 1) * 100%));
|
|
93
|
+
}
|
|
94
|
+
:host([breakpoint=sm]) .content {
|
|
95
|
+
margin-inline-start: calc(var(--mp-shell-open) * var(--mp-shell-size));
|
|
96
|
+
}
|
|
97
|
+
:host([breakpoint=sm]) .sidebar-root {
|
|
98
|
+
--mp-shell-wide: 1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
@media (max-width: 575.98px) {
|
|
102
|
+
:host([breakpoint=sm]) .sidebar {
|
|
103
|
+
position: absolute;
|
|
104
|
+
inset-block: 0;
|
|
105
|
+
inset-inline-start: 0;
|
|
106
|
+
inline-size: 100%;
|
|
107
|
+
z-index: 1030;
|
|
108
|
+
transform: translateX(calc((var(--mp-shell-open) - 1) * 100%));
|
|
109
|
+
}
|
|
110
|
+
:host([breakpoint=sm]) .content {
|
|
111
|
+
margin-inline-start: 0;
|
|
112
|
+
}
|
|
113
|
+
:host([breakpoint=sm]) .sidebar-root {
|
|
114
|
+
--mp-shell-wide: 0;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@media (min-width: 768px) {
|
|
119
|
+
:host([breakpoint=md]) .sidebar {
|
|
120
|
+
position: absolute;
|
|
121
|
+
inset-block: 0;
|
|
122
|
+
inset-inline-start: 0;
|
|
123
|
+
inline-size: var(--mp-shell-size);
|
|
124
|
+
z-index: 1030;
|
|
125
|
+
transform: translateX(calc((var(--mp-shell-open) - 1) * 100%));
|
|
126
|
+
}
|
|
127
|
+
:host([breakpoint=md]) .content {
|
|
128
|
+
margin-inline-start: calc(var(--mp-shell-open) * var(--mp-shell-size));
|
|
129
|
+
}
|
|
130
|
+
:host([breakpoint=md]) .sidebar-root {
|
|
131
|
+
--mp-shell-wide: 1;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
@media (max-width: 767.98px) {
|
|
135
|
+
:host([breakpoint=md]) .sidebar {
|
|
136
|
+
position: absolute;
|
|
137
|
+
inset-block: 0;
|
|
138
|
+
inset-inline-start: 0;
|
|
139
|
+
inline-size: 100%;
|
|
140
|
+
z-index: 1030;
|
|
141
|
+
transform: translateX(calc((var(--mp-shell-open) - 1) * 100%));
|
|
142
|
+
}
|
|
143
|
+
:host([breakpoint=md]) .content {
|
|
144
|
+
margin-inline-start: 0;
|
|
145
|
+
}
|
|
146
|
+
:host([breakpoint=md]) .sidebar-root {
|
|
147
|
+
--mp-shell-wide: 0;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@media (min-width: 992px) {
|
|
152
|
+
:host([breakpoint=lg]) .sidebar {
|
|
153
|
+
position: absolute;
|
|
154
|
+
inset-block: 0;
|
|
155
|
+
inset-inline-start: 0;
|
|
156
|
+
inline-size: var(--mp-shell-size);
|
|
157
|
+
z-index: 1030;
|
|
158
|
+
transform: translateX(calc((var(--mp-shell-open) - 1) * 100%));
|
|
159
|
+
}
|
|
160
|
+
:host([breakpoint=lg]) .content {
|
|
161
|
+
margin-inline-start: calc(var(--mp-shell-open) * var(--mp-shell-size));
|
|
162
|
+
}
|
|
163
|
+
:host([breakpoint=lg]) .sidebar-root {
|
|
164
|
+
--mp-shell-wide: 1;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
@media (max-width: 991.98px) {
|
|
168
|
+
:host([breakpoint=lg]) .sidebar {
|
|
169
|
+
position: absolute;
|
|
170
|
+
inset-block: 0;
|
|
171
|
+
inset-inline-start: 0;
|
|
172
|
+
inline-size: 100%;
|
|
173
|
+
z-index: 1030;
|
|
174
|
+
transform: translateX(calc((var(--mp-shell-open) - 1) * 100%));
|
|
175
|
+
}
|
|
176
|
+
:host([breakpoint=lg]) .content {
|
|
177
|
+
margin-inline-start: 0;
|
|
178
|
+
}
|
|
179
|
+
:host([breakpoint=lg]) .sidebar-root {
|
|
180
|
+
--mp-shell-wide: 0;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@media (min-width: 1200px) {
|
|
185
|
+
:host([breakpoint=xl]) .sidebar {
|
|
186
|
+
position: absolute;
|
|
187
|
+
inset-block: 0;
|
|
188
|
+
inset-inline-start: 0;
|
|
189
|
+
inline-size: var(--mp-shell-size);
|
|
190
|
+
z-index: 1030;
|
|
191
|
+
transform: translateX(calc((var(--mp-shell-open) - 1) * 100%));
|
|
192
|
+
}
|
|
193
|
+
:host([breakpoint=xl]) .content {
|
|
194
|
+
margin-inline-start: calc(var(--mp-shell-open) * var(--mp-shell-size));
|
|
195
|
+
}
|
|
196
|
+
:host([breakpoint=xl]) .sidebar-root {
|
|
197
|
+
--mp-shell-wide: 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
@media (max-width: 1199.98px) {
|
|
201
|
+
:host([breakpoint=xl]) .sidebar {
|
|
202
|
+
position: absolute;
|
|
203
|
+
inset-block: 0;
|
|
204
|
+
inset-inline-start: 0;
|
|
205
|
+
inline-size: 100%;
|
|
206
|
+
z-index: 1030;
|
|
207
|
+
transform: translateX(calc((var(--mp-shell-open) - 1) * 100%));
|
|
208
|
+
}
|
|
209
|
+
:host([breakpoint=xl]) .content {
|
|
210
|
+
margin-inline-start: 0;
|
|
211
|
+
}
|
|
212
|
+
:host([breakpoint=xl]) .sidebar-root {
|
|
213
|
+
--mp-shell-wide: 0;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@media (min-width: 1400px) {
|
|
218
|
+
:host([breakpoint=xxl]) .sidebar {
|
|
219
|
+
position: absolute;
|
|
220
|
+
inset-block: 0;
|
|
221
|
+
inset-inline-start: 0;
|
|
222
|
+
inline-size: var(--mp-shell-size);
|
|
223
|
+
z-index: 1030;
|
|
224
|
+
transform: translateX(calc((var(--mp-shell-open) - 1) * 100%));
|
|
225
|
+
}
|
|
226
|
+
:host([breakpoint=xxl]) .content {
|
|
227
|
+
margin-inline-start: calc(var(--mp-shell-open) * var(--mp-shell-size));
|
|
228
|
+
}
|
|
229
|
+
:host([breakpoint=xxl]) .sidebar-root {
|
|
230
|
+
--mp-shell-wide: 1;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
@media (max-width: 1399.98px) {
|
|
234
|
+
:host([breakpoint=xxl]) .sidebar {
|
|
235
|
+
position: absolute;
|
|
236
|
+
inset-block: 0;
|
|
237
|
+
inset-inline-start: 0;
|
|
238
|
+
inline-size: 100%;
|
|
239
|
+
z-index: 1030;
|
|
240
|
+
transform: translateX(calc((var(--mp-shell-open) - 1) * 100%));
|
|
241
|
+
}
|
|
242
|
+
:host([breakpoint=xxl]) .content {
|
|
243
|
+
margin-inline-start: 0;
|
|
244
|
+
}
|
|
245
|
+
:host([breakpoint=xxl]) .sidebar-root {
|
|
246
|
+
--mp-shell-wide: 0;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
:host([state=show]) {
|
|
251
|
+
--mp-shell-open: 1;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
:host([state=hide]) {
|
|
255
|
+
--mp-shell-open: 0;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
:host([breakpoint=xs]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
259
|
+
--mp-shell-open: 0;
|
|
260
|
+
}
|
|
261
|
+
:host([breakpoint=xs]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
262
|
+
--mp-shell-open: 1;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
@media (min-width: 576px) {
|
|
266
|
+
:host([breakpoint=sm]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
267
|
+
--mp-shell-open: 1;
|
|
268
|
+
}
|
|
269
|
+
:host([breakpoint=sm]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
270
|
+
--mp-shell-open: 0;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
@media (max-width: 575.98px) {
|
|
274
|
+
:host([breakpoint=sm]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
275
|
+
--mp-shell-open: 0;
|
|
276
|
+
}
|
|
277
|
+
:host([breakpoint=sm]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
278
|
+
--mp-shell-open: 1;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
@media (min-width: 768px) {
|
|
283
|
+
:host([breakpoint=md]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
284
|
+
--mp-shell-open: 1;
|
|
285
|
+
}
|
|
286
|
+
:host([breakpoint=md]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
287
|
+
--mp-shell-open: 0;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
@media (max-width: 767.98px) {
|
|
291
|
+
:host([breakpoint=md]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
292
|
+
--mp-shell-open: 0;
|
|
293
|
+
}
|
|
294
|
+
:host([breakpoint=md]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
295
|
+
--mp-shell-open: 1;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@media (min-width: 992px) {
|
|
300
|
+
:host([breakpoint=lg]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
301
|
+
--mp-shell-open: 1;
|
|
302
|
+
}
|
|
303
|
+
:host([breakpoint=lg]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
304
|
+
--mp-shell-open: 0;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
@media (max-width: 991.98px) {
|
|
308
|
+
:host([breakpoint=lg]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
309
|
+
--mp-shell-open: 0;
|
|
310
|
+
}
|
|
311
|
+
:host([breakpoint=lg]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
312
|
+
--mp-shell-open: 1;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
@media (min-width: 1200px) {
|
|
317
|
+
:host([breakpoint=xl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
318
|
+
--mp-shell-open: 1;
|
|
319
|
+
}
|
|
320
|
+
:host([breakpoint=xl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
321
|
+
--mp-shell-open: 0;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
@media (max-width: 1199.98px) {
|
|
325
|
+
:host([breakpoint=xl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
326
|
+
--mp-shell-open: 0;
|
|
327
|
+
}
|
|
328
|
+
:host([breakpoint=xl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
329
|
+
--mp-shell-open: 1;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
@media (min-width: 1400px) {
|
|
334
|
+
:host([breakpoint=xxl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
335
|
+
--mp-shell-open: 1;
|
|
336
|
+
}
|
|
337
|
+
:host([breakpoint=xxl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
338
|
+
--mp-shell-open: 0;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
@media (max-width: 1399.98px) {
|
|
342
|
+
:host([breakpoint=xxl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
343
|
+
--mp-shell-open: 0;
|
|
344
|
+
}
|
|
345
|
+
:host([breakpoint=xxl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
346
|
+
--mp-shell-open: 1;
|
|
347
|
+
}
|
|
348
|
+
}`);
|
|
349
|
+
class p extends a {
|
|
350
|
+
static {
|
|
351
|
+
this.styles = [h];
|
|
352
|
+
}
|
|
353
|
+
static get observedAttributes() {
|
|
354
|
+
return [
|
|
355
|
+
...super.observedAttributes ?? [],
|
|
356
|
+
"state",
|
|
357
|
+
"breakpoint",
|
|
358
|
+
"size",
|
|
359
|
+
"external-toggle"
|
|
360
|
+
];
|
|
361
|
+
}
|
|
362
|
+
createRenderRoot() {
|
|
363
|
+
return this.constructor.observedAttributes.includes("defer-hydration") || this.shadowRoot?.replaceChildren(), super.createRenderRoot();
|
|
364
|
+
}
|
|
365
|
+
connectedCallback() {
|
|
366
|
+
super.connectedCallback(), this.addEventListener("click", this.#e);
|
|
367
|
+
}
|
|
368
|
+
disconnectedCallback() {
|
|
369
|
+
super.disconnectedCallback(), this.removeEventListener("click", this.#e);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Auto-close the drawer when a navigation link inside the `sidebar` slot is
|
|
373
|
+
* clicked — only when `dismiss-on-navigate` is set AND the shell is in
|
|
374
|
+
* narrow/overlay mode. Reads the attribute on demand (no reactive property).
|
|
375
|
+
* The anchor must sit *before* the sidebar slot in the composed path, i.e.
|
|
376
|
+
* inside the slotted sidebar content — so topbar/content clicks are ignored.
|
|
377
|
+
* Opt-out: a clicked link (or any wrapper around it) carrying `data-no-dismiss`
|
|
378
|
+
* is ignored — for parent items that only expand a sub-list / highlight the
|
|
379
|
+
* active path and cancel their own navigation. Opt-out (rather than opt-in)
|
|
380
|
+
* keeps the common case — every leaf link dismisses — annotation-free.
|
|
381
|
+
*/
|
|
382
|
+
#e = (e) => {
|
|
383
|
+
if (!this.hasAttribute("dismiss-on-navigate") || this.#o()) return;
|
|
384
|
+
const t = e.composedPath(), o = this.renderRoot?.querySelector('slot[name="sidebar"]'), i = o ? t.indexOf(o) : -1;
|
|
385
|
+
if (i < 0) return;
|
|
386
|
+
const n = t.slice(0, i);
|
|
387
|
+
if (n.some((s) => s instanceof HTMLElement && s.hasAttribute("data-no-dismiss"))) return;
|
|
388
|
+
n.some(
|
|
389
|
+
(s) => s instanceof HTMLElement && s.tagName === "A" && s.hasAttribute("href")
|
|
390
|
+
) && this.open && this.toggle(!1);
|
|
391
|
+
};
|
|
392
|
+
attributeChangedCallback(e, t, o) {
|
|
393
|
+
super.attributeChangedCallback(e, t, o), e === "size" && (o ? this.style.setProperty("--mp-shell-size", o) : this.style.removeProperty("--mp-shell-size"));
|
|
394
|
+
}
|
|
395
|
+
get toggleInput() {
|
|
396
|
+
return this.renderRoot?.querySelector(".shell-toggle") ?? null;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* The *resolved, visual* open state — read straight from the value the CSS
|
|
400
|
+
* computed (`--mp-shell-open`), so it accounts for `state`, `breakpoint`, the
|
|
401
|
+
* viewport and the toggle checkbox all at once. The CSS is the single source
|
|
402
|
+
* of truth; we don't re-derive the matrix in JS.
|
|
403
|
+
*/
|
|
404
|
+
#t() {
|
|
405
|
+
if (typeof window > "u") return !1;
|
|
406
|
+
const e = this.renderRoot?.querySelector(".sidebar-root");
|
|
407
|
+
return e ? getComputedStyle(e).getPropertyValue("--mp-shell-open").trim() === "1" : !1;
|
|
408
|
+
}
|
|
409
|
+
/** An explicit `state` (`show`/`hide`) freezes the CSS checkbox. */
|
|
410
|
+
#n() {
|
|
411
|
+
const e = this.getAttribute("state");
|
|
412
|
+
return e === "show" || e === "hide";
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Wide (sidebar pushes content) vs narrow (sidebar overlays) — read from the
|
|
416
|
+
* `--mp-shell-wide` lever the media queries resolved (1 = wide, 0 = narrow),
|
|
417
|
+
* avoiding any breakpoint duplication in JS. (The sidebar is now
|
|
418
|
+
* `position: absolute` in BOTH modes, so position no longer discriminates.)
|
|
419
|
+
*/
|
|
420
|
+
#o() {
|
|
421
|
+
if (typeof window > "u") return !0;
|
|
422
|
+
const e = this.renderRoot?.querySelector(".sidebar-root");
|
|
423
|
+
return e ? getComputedStyle(e).getPropertyValue("--mp-shell-wide").trim() === "1" : !0;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Keep the checkbox encoding the resolved open for the current viewport, so
|
|
427
|
+
* that returning to `auto` (where the checkbox drives the CSS again) resolves
|
|
428
|
+
* to the same visual state instead of jumping. In `auto` the checkbox means
|
|
429
|
+
* "inverted from the responsive default": wide default = open (checked ⇒
|
|
430
|
+
* closed); narrow default = closed (checked ⇒ open).
|
|
431
|
+
*/
|
|
432
|
+
#s(e) {
|
|
433
|
+
const t = this.toggleInput;
|
|
434
|
+
t && (t.checked = this.#o() ? !e : e);
|
|
435
|
+
}
|
|
436
|
+
/** Whether the sidebar is currently (visually) open. */
|
|
437
|
+
get open() {
|
|
438
|
+
return this.#t();
|
|
439
|
+
}
|
|
440
|
+
/** Programmatically open/close the sidebar. Pass a boolean to force a state. */
|
|
441
|
+
toggle(e) {
|
|
442
|
+
const t = e ?? !this.open;
|
|
443
|
+
this.#s(t), this.#i(t);
|
|
444
|
+
}
|
|
445
|
+
#l = () => {
|
|
446
|
+
const e = this.#t(), t = this.#n() ? !e : e;
|
|
447
|
+
this.#s(t), this.#i(t);
|
|
448
|
+
};
|
|
449
|
+
#i(e) {
|
|
450
|
+
this.dispatchEvent(
|
|
451
|
+
new CustomEvent("statechange", {
|
|
452
|
+
detail: { open: e },
|
|
453
|
+
bubbles: !0,
|
|
454
|
+
composed: !0
|
|
455
|
+
})
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
render() {
|
|
459
|
+
return r`
|
|
460
|
+
<input
|
|
461
|
+
type="checkbox"
|
|
462
|
+
id="mp-shell-toggle"
|
|
463
|
+
class="shell-toggle"
|
|
464
|
+
aria-label="Toggle sidebar"
|
|
465
|
+
@change=${this.#l}
|
|
466
|
+
/>
|
|
467
|
+
<div class="topbar" part="topbar">
|
|
468
|
+
<label for="mp-shell-toggle" class="shell-hamburger" part="hamburger" title="Toggle sidebar">
|
|
469
|
+
<slot name="hamburger">☰</slot>
|
|
470
|
+
</label>
|
|
471
|
+
<slot name="topbar"></slot>
|
|
472
|
+
</div>
|
|
473
|
+
<div class="sidebar-root" part="sidebar-root">
|
|
474
|
+
<aside class="sidebar" part="sidebar" aria-label="Sidebar"><slot name="sidebar"></slot></aside>
|
|
475
|
+
<div class="content" part="content"><slot></slot></div>
|
|
476
|
+
</div>
|
|
477
|
+
<slot name="toggle"></slot>
|
|
478
|
+
`;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
customElements.get("mp-shell") || customElements.define("mp-shell", p);
|
|
482
|
+
export {
|
|
483
|
+
p as MpShell,
|
|
484
|
+
h as shellStyles
|
|
485
|
+
};
|