@mintplayer/web-components 1.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintplayer/web-components",
3
- "version": "1.4.0",
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": {
@@ -3110,6 +3110,10 @@ textarea.form-control-lg {
3110
3110
  color: var(--bs-danger, #dc3545);
3111
3111
  }
3112
3112
 
3113
+ .qb-sort-add {
3114
+ --bs-btn-color: #646b72;
3115
+ }
3116
+
3113
3117
  .qb-too-deep {
3114
3118
  padding: 0.5rem;
3115
3119
  color: var(--bs-warning-text-emphasis, #997404);
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 I = r[y];
984
- if (I.getAttribute("data-resolved-size") === "popup" || !u(I)) continue;
985
- const z = h(I);
986
- (z < A || z === A && y > C) && (p = I, A = z, C = y);
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 I = r[y];
993
- if (I.getAttribute("data-resolved-size") !== "popup") continue;
994
- const z = h(I);
995
- (z > A || z === A && y < C) && (p = I, A = z, C = y);
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 $ extends w {
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
- ], $.prototype, "tabId");
1559
+ ], I.prototype, "tabId");
1560
1560
  E([
1561
1561
  l({ type: String, reflect: !0 })
1562
- ], $.prototype, "label");
1562
+ ], I.prototype, "label");
1563
1563
  E([
1564
1564
  l({ type: Boolean, reflect: !0 })
1565
- ], $.prototype, "active");
1565
+ ], I.prototype, "active");
1566
1566
  E([
1567
1567
  l({ attribute: !1 })
1568
- ], $.prototype, "idealSizes");
1568
+ ], I.prototype, "idealSizes");
1569
1569
  E([
1570
1570
  l({ attribute: !1 })
1571
- ], $.prototype, "reduceOrder");
1571
+ ], I.prototype, "reduceOrder");
1572
1572
  E([
1573
1573
  _()
1574
- ], $.prototype, "overflowEntries");
1574
+ ], I.prototype, "overflowEntries");
1575
1575
  E([
1576
1576
  S(".overflow-trigger")
1577
- ], $.prototype, "overflowTriggerEl");
1577
+ ], I.prototype, "overflowTriggerEl");
1578
1578
  E([
1579
1579
  S(".overflow-panel")
1580
- ], $.prototype, "overflowPanelEl");
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 $e = Object.defineProperty, Ie = (s, e, o, r) => {
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 && $e(e, o, t), 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
- Ie([
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
- $ as MpRibbonTab,
3148
+ I as MpRibbonTab,
3149
3149
  ne as MpRibbonTemplateItem,
3150
3150
  J as MpRibbonToggleButton
3151
3151
  };
@@ -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">&#9776;</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
+ };
@@ -0,0 +1,2 @@
1
+ export { MpShell } from './mp-shell';
2
+ export type { ShellStateChangeEventDetail } from './mp-shell';
@@ -0,0 +1,59 @@
1
+ import { LitElement } from 'lit';
2
+ export interface ShellStateChangeEventDetail {
3
+ /** Whether the sidebar is now (visually) open after the toggle. */
4
+ open: boolean;
5
+ }
6
+ /**
7
+ * `<mp-shell>` — responsive sidebar layout shell.
8
+ *
9
+ * The shadow DOM is *static chrome* (a hidden checkbox toggle, the hamburger
10
+ * label, the sidebar-root with named slots); the consumer's sidebar and main
11
+ * content are slotted light DOM. All visibility is pure CSS (see
12
+ * `shell.styles.scss`), so it works with JavaScript disabled when the shadow
13
+ * root is present (e.g. server-rendered as Declarative Shadow DOM).
14
+ *
15
+ * Authoring (vanilla):
16
+ *
17
+ * <mp-shell breakpoint="md">
18
+ * <div slot="topbar">…brand / nav…</div>
19
+ * <nav slot="sidebar">…</nav>
20
+ * <main>…</main>
21
+ * </mp-shell>
22
+ *
23
+ * Layout: a full-width top bar (the built-in hamburger toggle on its left, plus
24
+ * the `topbar` slot) sits above a row of `sidebar` + default (content) slots.
25
+ * The sidebar slides in/out below the top bar, which stays put.
26
+ *
27
+ * Attributes:
28
+ * - `state` — `auto` (default) | `show` | `hide`.
29
+ * - `breakpoint` — Bootstrap breakpoint name (`xs`…`xxl`, default `md`); below
30
+ * it the sidebar starts collapsed, at/above it expanded.
31
+ * - `size` — expanded sidebar width (any CSS length); also settable via the
32
+ * `--mp-shell-size` custom property.
33
+ * - `external-toggle` — hides the built-in hamburger; the consumer supplies a
34
+ * `<label for>` + a `slot="toggle"` checkbox and a global bridge rule.
35
+ * - `dismiss-on-navigate` — opt-in: when a navigation link (`<a href>`) inside
36
+ * the `sidebar` slot is clicked while in narrow/overlay mode, auto-close the
37
+ * drawer (the mobile-drawer convention). No effect in wide mode; a pure
38
+ * progressive enhancement (with JS off the link just navigates). Mark a link
39
+ * (or any wrapper around it) with `data-no-dismiss` to exclude it — e.g. a
40
+ * parent nav item that only expands a sub-list or highlights the active path
41
+ * and cancels its own navigation.
42
+ *
43
+ * Events: `statechange` (`detail: { open }`) when the toggle flips.
44
+ */
45
+ export declare class MpShell extends LitElement {
46
+ #private;
47
+ static styles: import('lit').CSSResult[];
48
+ static get observedAttributes(): string[];
49
+ protected createRenderRoot(): HTMLElement | DocumentFragment;
50
+ connectedCallback(): void;
51
+ disconnectedCallback(): void;
52
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
53
+ private get toggleInput();
54
+ /** Whether the sidebar is currently (visually) open. */
55
+ get open(): boolean;
56
+ /** Programmatically open/close the sidebar. Pass a boolean to force a state. */
57
+ toggle(force?: boolean): void;
58
+ render(): import('lit-html').TemplateResult<1>;
59
+ }
@@ -0,0 +1,4 @@
1
+ export { MpShell } from './components';
2
+ export type { ShellStateChangeEventDetail } from './components';
3
+ export type { ShellState } from './types';
4
+ export { shellStyles } from './styles';
@@ -0,0 +1 @@
1
+ export { shellStyles } from './shell.styles';
@@ -0,0 +1,2 @@
1
+ export declare const shellStyles: import('lit').CSSResult;
2
+ export default shellStyles;
@@ -0,0 +1 @@
1
+ export type { ShellState } from './shell-state';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Declarative sidebar state set by the consumer.
3
+ * - `auto` — responsive: collapsed below `breakpoint`, expanded at/above it;
4
+ * the toggle then flips it (inverse of the responsive default).
5
+ * - `show` — force expanded regardless of viewport / toggle.
6
+ * - `hide` — force collapsed regardless of viewport / toggle.
7
+ */
8
+ export type ShellState = 'auto' | 'show' | 'hide';