@f-ewald/components 1.32.1 → 1.34.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/dist/app-shell.js CHANGED
@@ -4,36 +4,57 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { LitElement, css, html, nothing } from "lit";
7
+ import { LitElement, css, html } from "lit";
8
8
  import { customElement, property, state } from "lit/decorators.js";
9
9
  import { iconBars3 } from "./icons.js";
10
10
  import "./kbd-hint.js";
11
11
  import { tokens } from "./tokens.js";
12
12
  /**
13
13
  * The dashboard page shell: a slot-based CSS-grid backbone that arranges a
14
- * full-height sidebar, a top bar, the main content, an optional right-hand
15
- * detail column, and an optional footer. It owns the responsive behavior so
16
- * consumers don't re-implement it — above the shared 48rem breakpoint the
17
- * sidebar collapses to an icon rail and the detail region is an inline column;
18
- * at or below it the sidebar becomes an off-canvas drawer and the detail region
19
- * an overlay, both dismissed by a scrim or Escape.
14
+ * top bar, the main content, an optional right-hand detail column, an
15
+ * optional footer, and a sidebar. The top bar always spans the shell's full
16
+ * width, in every sidebar state.
17
+ *
18
+ * The sidebar's visibility, width, and layout mode are three independent
19
+ * properties:
20
+ * - `sidebar-open` (default closed) — whether it's shown at all.
21
+ * - `sidebar-width`: `"full"` (16rem, icons + labels, the default) or
22
+ * `"icon"` (3.5rem rail, icons only — drives the slotted `app-sidebar`'s
23
+ * own `collapsed` attribute).
24
+ * - `sidebar-mode`: `"overlay"` (the default) floats the sidebar above the
25
+ * shell's own content with a higher z-index, covering part of the top
26
+ * bar's corner and whatever content sits beneath it, without ever
27
+ * resizing or reflowing `main`/`footer`. `"push"` instead reserves a real
28
+ * grid column beside `main`/`footer` (which resize to make room) — the
29
+ * top bar still spans full width above it either way.
30
+ *
31
+ * Below the shared 48rem breakpoint the sidebar always behaves as a
32
+ * full-width, modal, scrim/Escape-dismissible drawer regardless of
33
+ * `sidebar-mode`/`sidebar-width` — those two properties only affect the
34
+ * desktop presentation. Above 48rem, an `overlay`-mode sidebar is a
35
+ * non-modal panel (no dimming scrim, no Escape-dismiss, since it reads as
36
+ * an ordinary always-interactive panel rather than a blocking dialog); a
37
+ * `push`-mode sidebar is even more clearly non-modal, since it never
38
+ * covers anything.
39
+ *
40
+ * The right-hand detail column is unaffected by any of the above: it still
41
+ * reserves an inline grid column on desktop and becomes a dismissible
42
+ * overlay (scrim/Escape) on mobile.
20
43
  *
21
44
  * Widths are tunable per instance via `--component-sidebar-width` (16rem),
22
45
  * `--component-sidebar-rail-width` (3.5rem), and `--component-topbar-height`
23
46
  * (3rem); the detail column reuses the 20rem/25rem panel widths. The main
24
47
  * content area is white by default — override it with
25
- * `--component-main-background`. Give the shell a height (e.g. `height: 100vh`)
26
- * so the sidebar and main can size and scroll.
48
+ * `--component-main-background`. Give the shell a height (e.g. `height:
49
+ * 100vh`) so the sidebar and main can size and scroll.
27
50
  *
28
- * The built-in top-bar button toggles the sidebar, and so does pressing `[`
29
- * anywhere on the page (ignored while typing in a text field or with a
30
- * modifier held). Hovering or keyboard-focusing the toggle reveals a tooltip
31
- * naming the action and its `[` shortcut — the shortcut is not shown as
32
- * permanent chrome.
51
+ * Hovering or keyboard-focusing the toggle reveals a tooltip naming the
52
+ * action and its `[` shortcut — the shortcut is not shown as permanent
53
+ * chrome.
33
54
  *
34
55
  * @element app-shell
35
56
  * @slot - Main content area.
36
- * @slot sidebar - Full-height navigation (typically `app-sidebar`).
57
+ * @slot sidebar - Sidebar navigation (typically `app-sidebar`).
37
58
  * @slot topbar - Top bar content, right of the built-in toggle.
38
59
  * @slot detail - Optional right-hand detail; shown when `detail-open` is set.
39
60
  * @slot footer - Optional footer beneath the main content.
@@ -43,25 +64,25 @@ import { tokens } from "./tokens.js";
43
64
  let AppShell = class AppShell extends LitElement {
44
65
  constructor() {
45
66
  super(...arguments);
46
- /** Collapses the sidebar to an icon rail on desktop. */
47
- this.sidebarCollapsed = false;
67
+ /** Whether the sidebar is open. Closed by default at every breakpoint. */
68
+ this.sidebarOpen = false;
69
+ /** `"overlay"` (default) floats the sidebar above content; `"push"` reserves a grid column instead. */
70
+ this.sidebarMode = "overlay";
71
+ /** Sidebar width when open: `"full"` (16rem, icons + labels) or `"icon"` (3.5rem rail, icons only). */
72
+ this.sidebarWidth = "full";
48
73
  /** Shows the right-hand detail region (inline column, or overlay on mobile). */
49
74
  this.detailOpen = false;
50
75
  /** Detail width: `compact` (20rem) or `comfortable` (25rem). */
51
76
  this.detailWidth = "compact";
52
77
  /** Whether the viewport is at/below the 48rem breakpoint. */
53
78
  this._mobile = false;
54
- /** Whether the mobile off-canvas nav drawer is open. */
55
- this._mobileNavOpen = false;
56
79
  /** Whether the footer slot has assigned content. */
57
80
  this._hasFooter = false;
58
81
  this._mediaQuery = null;
59
82
  this._previousFocus = null;
60
- /** Tracks the breakpoint and closes the mobile drawer when returning to desktop. */
83
+ /** Tracks the breakpoint the sidebar's width and modality depend on. */
61
84
  this._onMediaChange = (event) => {
62
85
  this._mobile = event.matches;
63
- if (!event.matches)
64
- this._mobileNavOpen = false;
65
86
  };
66
87
  /** Handles the `[` sidebar shortcut and Escape dismissal of mobile overlays. */
67
88
  this._onKeydown = (event) => {
@@ -72,9 +93,9 @@ let AppShell = class AppShell extends LitElement {
72
93
  event.preventDefault();
73
94
  this._closeDetail();
74
95
  }
75
- else if (this._mobileNavOpen) {
96
+ else if (this.sidebarOpen) {
76
97
  event.preventDefault();
77
- this._mobileNavOpen = false;
98
+ this.sidebarOpen = false;
78
99
  }
79
100
  return;
80
101
  }
@@ -96,34 +117,75 @@ let AppShell = class AppShell extends LitElement {
96
117
  block-size: 100%;
97
118
  }
98
119
  .shell {
99
- --_sidebar-w: var(--component-sidebar-width, 16rem);
120
+ --_sidebar-w: 0px;
100
121
  --_detail-w: 0px;
101
122
  display: grid;
102
123
  grid-template-columns: var(--_sidebar-w) minmax(0, 1fr) var(--_detail-w);
103
124
  grid-template-rows: auto minmax(0, 1fr) auto;
104
125
  grid-template-areas:
105
- "sidebar topbar topbar"
126
+ "topbar topbar topbar"
106
127
  "sidebar main detail"
107
128
  "sidebar footer footer";
129
+ position: relative;
108
130
  block-size: 100%;
109
131
  min-height: 0;
110
132
  background: var(--ui-surface, #ffffff);
111
133
  }
112
- :host([sidebar-collapsed]) .shell {
113
- --_sidebar-w: var(--component-sidebar-rail-width, 3.5rem);
114
- }
115
134
  :host([detail-open]) .shell {
116
135
  --_detail-w: 20rem;
117
136
  }
118
137
  :host([detail-open][detail-width="comfortable"]) .shell {
119
138
  --_detail-w: 25rem;
120
139
  }
140
+ /* Push mode reserves a real grid column, sized only while open — the
141
+ column width doesn't animate (custom properties feeding a grid
142
+ track don't transition smoothly without @property registration),
143
+ so push mode's open/close is an instant snap, unlike overlay
144
+ mode's sliding transform. */
145
+ :host([sidebar-mode="push"][sidebar-open]) .shell {
146
+ --_sidebar-w: var(--component-sidebar-width, 16rem);
147
+ }
148
+ :host([sidebar-mode="push"][sidebar-open][sidebar-width="icon"]) .shell {
149
+ --_sidebar-w: var(--component-sidebar-rail-width, 3.5rem);
150
+ }
121
151
  .sidebar {
122
- grid-area: sidebar;
123
- min-height: 0;
152
+ /* No grid-area here: an absolutely-positioned grid item's inset
153
+ properties resolve against its OWN grid area's box, not the
154
+ whole grid container, once grid-area is set — even with
155
+ explicit (non-auto) insets. Overlay mode must stay anchored to
156
+ the whole .shell (to overlap the topbar row), so grid-area is
157
+ assigned only in push mode below, where the sidebar is a real,
158
+ in-flow grid item instead of an absolutely-positioned one. */
159
+ position: absolute;
160
+ top: 0;
161
+ bottom: 0;
162
+ left: 0;
163
+ width: var(--component-sidebar-width, 16rem);
164
+ z-index: 40;
124
165
  overflow: hidden;
125
166
  border-right: 1px solid var(--ui-border, #e2e8f0);
126
167
  background: var(--ui-surface, #ffffff);
168
+ transform: translateX(-100%);
169
+ transition: transform 250ms ease;
170
+ }
171
+ :host([sidebar-open]) .sidebar {
172
+ transform: translateX(0);
173
+ }
174
+ :host([sidebar-open]:not([sidebar-mode="push"])) .sidebar {
175
+ box-shadow: var(
176
+ --ui-shadow-lg,
177
+ 0 20px 25px -5px rgb(0 0 0 / 0.1),
178
+ 0 8px 10px -6px rgb(0 0 0 / 0.1)
179
+ );
180
+ }
181
+ :host([sidebar-width="icon"]) .sidebar {
182
+ width: var(--component-sidebar-rail-width, 3.5rem);
183
+ }
184
+ :host([sidebar-mode="push"]) .sidebar {
185
+ grid-area: sidebar;
186
+ position: static;
187
+ width: 100%;
188
+ transform: none;
127
189
  }
128
190
  .topbar {
129
191
  grid-area: topbar;
@@ -134,6 +196,10 @@ let AppShell = class AppShell extends LitElement {
134
196
  padding: 0.5rem 0.75rem;
135
197
  border-bottom: 1px solid var(--ui-border, #e2e8f0);
136
198
  background: var(--ui-surface, #ffffff);
199
+ /* Deliberately no z-index here: an explicit z-index on a CSS grid
200
+ item creates a stacking context, which would trap .nav-toggle
201
+ below .sidebar once an overlay-mode sidebar opens and covers this
202
+ corner. See CLAUDE.md before adding one. */
137
203
  }
138
204
  .nav-toggle {
139
205
  display: inline-flex;
@@ -151,6 +217,7 @@ let AppShell = class AppShell extends LitElement {
151
217
  }
152
218
  .nav-group {
153
219
  position: relative;
220
+ z-index: 41;
154
221
  display: inline-flex;
155
222
  align-items: center;
156
223
  gap: 0.25rem;
@@ -161,7 +228,7 @@ let AppShell = class AppShell extends LitElement {
161
228
  top: 100%;
162
229
  left: 0;
163
230
  margin-top: 0.25rem;
164
- z-index: var(--component-layer-z, 100);
231
+ z-index: 10;
165
232
  display: inline-flex;
166
233
  align-items: center;
167
234
  gap: 0.25rem;
@@ -227,39 +294,28 @@ let AppShell = class AppShell extends LitElement {
227
294
  }
228
295
  @media (max-width: 48rem) {
229
296
  .shell {
230
- grid-template-columns: minmax(0, 1fr);
231
- grid-template-rows: auto minmax(0, 1fr) auto;
297
+ grid-template-columns: minmax(0, 1fr) var(--_detail-w);
232
298
  grid-template-areas:
233
- "topbar"
234
- "main"
235
- "footer";
236
- }
237
- .sidebar {
238
- position: fixed;
239
- top: 0;
240
- bottom: 0;
241
- left: 0;
242
- width: var(--component-sidebar-width, 16rem);
243
- z-index: var(--component-layer-z, 100);
244
- transform: translateX(-100%);
245
- transition: transform 250ms ease;
299
+ "topbar topbar"
300
+ "main detail"
301
+ "footer footer";
246
302
  }
247
- .shell.nav-open .sidebar {
248
- transform: translateX(0);
249
- box-shadow: var(
250
- --ui-shadow-lg,
251
- 0 20px 25px -5px rgb(0 0 0 / 0.1),
252
- 0 8px 10px -6px rgb(0 0 0 / 0.1)
253
- );
303
+ /* Mobile is always a full-screen, position:absolute overlay drawer,
304
+ regardless of sidebar-mode/sidebar-width — those two properties
305
+ only affect the desktop presentation. */
306
+ .sidebar,
307
+ :host([sidebar-mode="push"]) .sidebar {
308
+ position: absolute;
309
+ width: 100%;
254
310
  }
255
311
  .detail {
256
- position: fixed;
312
+ position: absolute;
257
313
  top: 0;
258
314
  right: 0;
259
315
  bottom: 0;
260
316
  width: var(--_detail-w, 20rem);
261
317
  max-width: calc(100vw - 3rem);
262
- z-index: var(--component-layer-z, 100);
318
+ z-index: 40;
263
319
  transform: translateX(110%);
264
320
  transition: transform 250ms ease;
265
321
  }
@@ -273,9 +329,9 @@ let AppShell = class AppShell extends LitElement {
273
329
  }
274
330
  .scrim.show {
275
331
  display: block;
276
- position: fixed;
332
+ position: absolute;
277
333
  inset: 0;
278
- z-index: calc(var(--component-layer-z, 100) - 1);
334
+ z-index: 39;
279
335
  background: var(--ui-overlay, rgb(15 23 42 / 0.45));
280
336
  border: none;
281
337
  }
@@ -322,18 +378,14 @@ let AppShell = class AppShell extends LitElement {
322
378
  const tag = target.tagName;
323
379
  return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT";
324
380
  }
325
- /** Toggles the rail (desktop) or the off-canvas drawer (mobile) and announces it. */
381
+ /** Toggles the sidebar and announces it. */
326
382
  _toggleSidebar() {
327
- if (this._mobile) {
328
- this._mobileNavOpen = !this._mobileNavOpen;
329
- if (this._mobileNavOpen)
330
- this._previousFocus = document.activeElement;
331
- }
332
- else {
333
- this.sidebarCollapsed = !this.sidebarCollapsed;
383
+ this.sidebarOpen = !this.sidebarOpen;
384
+ if (this._mobile && this.sidebarOpen) {
385
+ this._previousFocus = document.activeElement;
334
386
  }
335
387
  this.dispatchEvent(new CustomEvent("sidebar-toggle", {
336
- detail: { collapsed: this.sidebarCollapsed, mobileOpen: this._mobileNavOpen },
388
+ detail: { open: this.sidebarOpen },
337
389
  bubbles: true,
338
390
  composed: true,
339
391
  }));
@@ -347,15 +399,23 @@ let AppShell = class AppShell extends LitElement {
347
399
  _onScrim() {
348
400
  if (this.detailOpen)
349
401
  this._closeDetail();
350
- if (this._mobileNavOpen)
351
- this._mobileNavOpen = false;
402
+ if (this.sidebarOpen)
403
+ this.sidebarOpen = false;
404
+ }
405
+ /** Mirrors `sidebar-width` onto the slotted sidebar's `collapsed` (icon rail) attribute. */
406
+ _syncSidebarWidth() {
407
+ const icon = this.sidebarWidth === "icon";
408
+ const slot = this.shadowRoot?.querySelector('slot[name="sidebar"]');
409
+ for (const element of slot?.assignedElements() ?? []) {
410
+ element.toggleAttribute("collapsed", icon);
411
+ }
352
412
  }
353
413
  updated(changed) {
354
- if (changed.has("sidebarCollapsed") || changed.has("_mobile"))
355
- this._syncSidebar();
356
- if (!changed.has("_mobileNavOpen"))
414
+ if (changed.has("sidebarWidth"))
415
+ this._syncSidebarWidth();
416
+ if (!changed.has("sidebarOpen") || !this._mobile)
357
417
  return;
358
- if (this._mobileNavOpen) {
418
+ if (this.sidebarOpen) {
359
419
  this.shadowRoot?.querySelector(".sidebar")?.focus();
360
420
  return;
361
421
  }
@@ -363,23 +423,18 @@ let AppShell = class AppShell extends LitElement {
363
423
  this._previousFocus.focus();
364
424
  this._previousFocus = null;
365
425
  }
366
- /**
367
- * Mirrors the shell's rail state onto the slotted sidebar so it hides labels
368
- * when collapsed on desktop, and always shows them in the mobile drawer.
369
- */
370
- _syncSidebar() {
371
- const rail = this.sidebarCollapsed && !this._mobile;
372
- const slot = this.shadowRoot?.querySelector('slot[name="sidebar"]');
373
- for (const element of slot?.assignedElements() ?? []) {
374
- element.toggleAttribute("collapsed", rail);
375
- }
376
- }
377
426
  render() {
378
- const scrimActive = this._mobile && (this._mobileNavOpen || this.detailOpen);
427
+ const scrimActive = this._mobile && (this.sidebarOpen || this.detailOpen);
379
428
  return html `
380
- <div class="shell ${this._mobileNavOpen ? "nav-open" : ""}">
381
- <aside class="sidebar" tabindex="-1" aria-label="Primary">
382
- <slot name="sidebar" @slotchange=${this._syncSidebar}></slot>
429
+ <div class="shell">
430
+ <aside
431
+ class="sidebar"
432
+ tabindex="-1"
433
+ aria-label="Primary"
434
+ ?inert=${!this.sidebarOpen}
435
+ aria-hidden=${String(!this.sidebarOpen)}
436
+ >
437
+ <slot name="sidebar" @slotchange=${this._syncSidebarWidth}></slot>
383
438
  </aside>
384
439
  <header class="topbar">
385
440
  <div class="nav-group">
@@ -389,20 +444,14 @@ let AppShell = class AppShell extends LitElement {
389
444
  aria-label="Toggle navigation"
390
445
  aria-keyshortcuts="["
391
446
  aria-describedby="nav-tip"
392
- aria-expanded=${this._mobile ? String(this._mobileNavOpen) : String(!this.sidebarCollapsed)}
447
+ aria-expanded=${String(this.sidebarOpen)}
393
448
  @click=${this._toggleSidebar}
394
449
  >
395
450
  ${iconBars3(18)}
396
451
  </button>
397
452
  <span class="nav-tip" id="nav-tip" role="tooltip">
398
- <span
399
- >${this._mobile
400
- ? "Navigation"
401
- : this.sidebarCollapsed
402
- ? "Expand sidebar"
403
- : "Collapse sidebar"}</span
404
- >
405
- ${this._mobile ? nothing : html `<kbd-hint keys="["></kbd-hint>`}
453
+ <span>${this.sidebarOpen ? "Hide navigation" : "Show navigation"}</span>
454
+ <kbd-hint keys="["></kbd-hint>
406
455
  </span>
407
456
  </div>
408
457
  <div class="topbar-content"><slot name="topbar"></slot></div>
@@ -436,8 +485,14 @@ let AppShell = class AppShell extends LitElement {
436
485
  }
437
486
  };
438
487
  __decorate([
439
- property({ type: Boolean, reflect: true, attribute: "sidebar-collapsed" })
440
- ], AppShell.prototype, "sidebarCollapsed", void 0);
488
+ property({ type: Boolean, reflect: true, attribute: "sidebar-open" })
489
+ ], AppShell.prototype, "sidebarOpen", void 0);
490
+ __decorate([
491
+ property({ reflect: true, attribute: "sidebar-mode" })
492
+ ], AppShell.prototype, "sidebarMode", void 0);
493
+ __decorate([
494
+ property({ reflect: true, attribute: "sidebar-width" })
495
+ ], AppShell.prototype, "sidebarWidth", void 0);
441
496
  __decorate([
442
497
  property({ type: Boolean, reflect: true, attribute: "detail-open" })
443
498
  ], AppShell.prototype, "detailOpen", void 0);
@@ -447,9 +502,6 @@ __decorate([
447
502
  __decorate([
448
503
  state()
449
504
  ], AppShell.prototype, "_mobile", void 0);
450
- __decorate([
451
- state()
452
- ], AppShell.prototype, "_mobileNavOpen", void 0);
453
505
  __decorate([
454
506
  state()
455
507
  ], AppShell.prototype, "_hasFooter", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"app-shell.js","sourceRoot":"","sources":["../src/app-shell.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACL,wDAAwD;Q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a,CAAC,WAAW,CAAC;GACd,QAAQ,CA+YpB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconBars3 } from \"./icons.js\";\nimport \"./kbd-hint.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** Fired when the built-in toggle changes the sidebar state. */\nexport interface SidebarToggleDetail {\n /** Desktop rail state. */\n collapsed: boolean;\n /** Mobile drawer open state. */\n mobileOpen: boolean;\n}\n\n/**\n * The dashboard page shell: a slot-based CSS-grid backbone that arranges a\n * full-height sidebar, a top bar, the main content, an optional right-hand\n * detail column, and an optional footer. It owns the responsive behavior so\n * consumers don't re-implement it — above the shared 48rem breakpoint the\n * sidebar collapses to an icon rail and the detail region is an inline column;\n * at or below it the sidebar becomes an off-canvas drawer and the detail region\n * an overlay, both dismissed by a scrim or Escape.\n *\n * Widths are tunable per instance via `--component-sidebar-width` (16rem),\n * `--component-sidebar-rail-width` (3.5rem), and `--component-topbar-height`\n * (3rem); the detail column reuses the 20rem/25rem panel widths. The main\n * content area is white by default — override it with\n * `--component-main-background`. Give the shell a height (e.g. `height: 100vh`)\n * so the sidebar and main can size and scroll.\n *\n * The built-in top-bar button toggles the sidebar, and so does pressing `[`\n * anywhere on the page (ignored while typing in a text field or with a\n * modifier held). Hovering or keyboard-focusing the toggle reveals a tooltip\n * naming the action and its `[` shortcut — the shortcut is not shown as\n * permanent chrome.\n *\n * @element app-shell\n * @slot - Main content area.\n * @slot sidebar - Full-height navigation (typically `app-sidebar`).\n * @slot topbar - Top bar content, right of the built-in toggle.\n * @slot detail - Optional right-hand detail; shown when `detail-open` is set.\n * @slot footer - Optional footer beneath the main content.\n * @fires sidebar-toggle - The built-in toggle changed the sidebar state.\n * @fires detail-close - The scrim or Escape dismissed the mobile detail overlay.\n */\n@customElement(\"app-shell\")\nexport class AppShell extends LitElement {\n /** Collapses the sidebar to an icon rail on desktop. */\n @property({ type: Boolean, reflect: true, attribute: \"sidebar-collapsed\" })\n sidebarCollapsed = false;\n /** Shows the right-hand detail region (inline column, or overlay on mobile). */\n @property({ type: Boolean, reflect: true, attribute: \"detail-open\" }) detailOpen = false;\n /** Detail width: `compact` (20rem) or `comfortable` (25rem). */\n @property({ attribute: \"detail-width\" }) detailWidth: \"compact\" | \"comfortable\" = \"compact\";\n\n /** Whether the viewport is at/below the 48rem breakpoint. */\n @state() private _mobile = false;\n /** Whether the mobile off-canvas nav drawer is open. */\n @state() private _mobileNavOpen = false;\n /** Whether the footer slot has assigned content. */\n @state() private _hasFooter = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n block-size: 100%;\n }\n .shell {\n --_sidebar-w: var(--component-sidebar-width, 16rem);\n --_detail-w: 0px;\n display: grid;\n grid-template-columns: var(--_sidebar-w) minmax(0, 1fr) var(--_detail-w);\n grid-template-rows: auto minmax(0, 1fr) auto;\n grid-template-areas:\n \"sidebar topbar topbar\"\n \"sidebar main detail\"\n \"sidebar footer footer\";\n block-size: 100%;\n min-height: 0;\n background: var(--ui-surface, #ffffff);\n }\n :host([sidebar-collapsed]) .shell {\n --_sidebar-w: var(--component-sidebar-rail-width, 3.5rem);\n }\n :host([detail-open]) .shell {\n --_detail-w: 20rem;\n }\n :host([detail-open][detail-width=\"comfortable\"]) .shell {\n --_detail-w: 25rem;\n }\n .sidebar {\n grid-area: sidebar;\n min-height: 0;\n overflow: hidden;\n border-right: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n .topbar {\n grid-area: topbar;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: var(--component-topbar-height, 3rem);\n padding: 0.5rem 0.75rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n .nav-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n .nav-group {\n position: relative;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n flex: 0 0 auto;\n }\n .nav-tip {\n position: absolute;\n top: 100%;\n left: 0;\n margin-top: 0.25rem;\n z-index: var(--component-layer-z, 100);\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n white-space: nowrap;\n padding: 0.25rem 0.5rem;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: var(--ui-tooltip, #0f172a);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n opacity: 0;\n visibility: hidden;\n pointer-events: none;\n transition: opacity 120ms ease;\n }\n .nav-toggle:hover + .nav-tip,\n .nav-toggle:focus-visible + .nav-tip {\n opacity: 1;\n visibility: visible;\n }\n .nav-toggle:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .nav-toggle:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .topbar-content {\n flex: 1 1 auto;\n min-width: 0;\n }\n .main {\n grid-area: main;\n min-height: 0;\n min-width: 0;\n overflow: auto;\n padding: 1rem;\n background: var(--component-main-background, var(--ui-surface, #ffffff));\n }\n .detail {\n grid-area: detail;\n display: none;\n min-height: 0;\n overflow: auto;\n border-left: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n :host([detail-open]) .detail {\n display: block;\n }\n .footer {\n grid-area: footer;\n padding: 0.5rem 0.75rem;\n border-top: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n .footer.empty {\n display: none;\n }\n .scrim {\n display: none;\n }\n @media (max-width: 48rem) {\n .shell {\n grid-template-columns: minmax(0, 1fr);\n grid-template-rows: auto minmax(0, 1fr) auto;\n grid-template-areas:\n \"topbar\"\n \"main\"\n \"footer\";\n }\n .sidebar {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n width: var(--component-sidebar-width, 16rem);\n z-index: var(--component-layer-z, 100);\n transform: translateX(-100%);\n transition: transform 250ms ease;\n }\n .shell.nav-open .sidebar {\n transform: translateX(0);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n .detail {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n width: var(--_detail-w, 20rem);\n max-width: calc(100vw - 3rem);\n z-index: var(--component-layer-z, 100);\n transform: translateX(110%);\n transition: transform 250ms ease;\n }\n :host([detail-open]) .detail {\n transform: translateX(0);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n .scrim.show {\n display: block;\n position: fixed;\n inset: 0;\n z-index: calc(var(--component-layer-z, 100) - 1);\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n border: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .sidebar,\n .detail,\n .nav-tip {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n .nav-toggle:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .nav-tip {\n border: 1px solid CanvasText;\n }\n }\n `,\n ];\n\n private _mediaQuery: MediaQueryList | null = null;\n private _previousFocus: HTMLElement | null = null;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._mediaQuery = window.matchMedia(\"(max-width: 48rem)\");\n this._mobile = this._mediaQuery.matches;\n this._mediaQuery.addEventListener(\"change\", this._onMediaChange);\n window.addEventListener(\"keydown\", this._onKeydown);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._mediaQuery?.removeEventListener(\"change\", this._onMediaChange);\n this._mediaQuery = null;\n window.removeEventListener(\"keydown\", this._onKeydown);\n }\n\n /** Tracks the breakpoint and closes the mobile drawer when returning to desktop. */\n private _onMediaChange = (event: MediaQueryListEvent): void => {\n this._mobile = event.matches;\n if (!event.matches) this._mobileNavOpen = false;\n };\n\n /** Handles the `[` sidebar shortcut and Escape dismissal of mobile overlays. */\n private _onKeydown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented) return;\n if (event.key === \"Escape\" && this._mobile) {\n if (this.detailOpen) {\n event.preventDefault();\n this._closeDetail();\n } else if (this._mobileNavOpen) {\n event.preventDefault();\n this._mobileNavOpen = false;\n }\n return;\n }\n if (\n event.key === \"[\" &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey &&\n !this._isEditableTarget(event)\n ) {\n event.preventDefault();\n this._toggleSidebar();\n }\n };\n\n /** Whether the keydown originated in a text field, so the shortcut defers to typing. */\n private _isEditableTarget(event: KeyboardEvent): boolean {\n const target = event.composedPath()[0] as HTMLElement | undefined;\n if (!target) return false;\n if (target.isContentEditable) return true;\n const tag = target.tagName;\n return tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\";\n }\n\n /** Toggles the rail (desktop) or the off-canvas drawer (mobile) and announces it. */\n private _toggleSidebar(): void {\n if (this._mobile) {\n this._mobileNavOpen = !this._mobileNavOpen;\n if (this._mobileNavOpen) this._previousFocus = document.activeElement as HTMLElement | null;\n } else {\n this.sidebarCollapsed = !this.sidebarCollapsed;\n }\n this.dispatchEvent(\n new CustomEvent<SidebarToggleDetail>(\"sidebar-toggle\", {\n detail: { collapsed: this.sidebarCollapsed, mobileOpen: this._mobileNavOpen },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n /** Closes the detail overlay and notifies the consumer that owns `detail-open`. */\n private _closeDetail(): void {\n this.detailOpen = false;\n this.dispatchEvent(new CustomEvent(\"detail-close\", { bubbles: true, composed: true }));\n }\n\n /** Scrim click dismisses whichever overlay is open. */\n private _onScrim(): void {\n if (this.detailOpen) this._closeDetail();\n if (this._mobileNavOpen) this._mobileNavOpen = false;\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"sidebarCollapsed\") || changed.has(\"_mobile\")) this._syncSidebar();\n if (!changed.has(\"_mobileNavOpen\")) return;\n if (this._mobileNavOpen) {\n this.shadowRoot?.querySelector<HTMLElement>(\".sidebar\")?.focus();\n return;\n }\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n /**\n * Mirrors the shell's rail state onto the slotted sidebar so it hides labels\n * when collapsed on desktop, and always shows them in the mobile drawer.\n */\n private _syncSidebar(): void {\n const rail = this.sidebarCollapsed && !this._mobile;\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"sidebar\"]');\n for (const element of slot?.assignedElements() ?? []) {\n element.toggleAttribute(\"collapsed\", rail);\n }\n }\n\n override render() {\n const scrimActive = this._mobile && (this._mobileNavOpen || this.detailOpen);\n return html`\n <div class=\"shell ${this._mobileNavOpen ? \"nav-open\" : \"\"}\">\n <aside class=\"sidebar\" tabindex=\"-1\" aria-label=\"Primary\">\n <slot name=\"sidebar\" @slotchange=${this._syncSidebar}></slot>\n </aside>\n <header class=\"topbar\">\n <div class=\"nav-group\">\n <button\n class=\"nav-toggle\"\n type=\"button\"\n aria-label=\"Toggle navigation\"\n aria-keyshortcuts=\"[\"\n aria-describedby=\"nav-tip\"\n aria-expanded=${this._mobile ? String(this._mobileNavOpen) : String(!this.sidebarCollapsed)}\n @click=${this._toggleSidebar}\n >\n ${iconBars3(18)}\n </button>\n <span class=\"nav-tip\" id=\"nav-tip\" role=\"tooltip\">\n <span\n >${this._mobile\n ? \"Navigation\"\n : this.sidebarCollapsed\n ? \"Expand sidebar\"\n : \"Collapse sidebar\"}</span\n >\n ${this._mobile ? nothing : html`<kbd-hint keys=\"[\"></kbd-hint>`}\n </span>\n </div>\n <div class=\"topbar-content\"><slot name=\"topbar\"></slot></div>\n </header>\n <main class=\"main\"><slot></slot></main>\n <aside\n class=\"detail\"\n aria-label=\"Detail\"\n ?inert=${!this.detailOpen}\n aria-hidden=${String(!this.detailOpen)}\n >\n <slot name=\"detail\"></slot>\n </aside>\n <footer class=\"footer ${this._hasFooter ? \"\" : \"empty\"}\">\n <slot name=\"footer\" @slotchange=${this._onFooterSlotChange}></slot>\n </footer>\n <button\n class=\"scrim ${scrimActive ? \"show\" : \"\"}\"\n type=\"button\"\n tabindex=\"-1\"\n aria-label=\"Close\"\n @click=${this._onScrim}\n ?hidden=${!scrimActive}\n ></button>\n </div>\n `;\n }\n\n /** Collapses the footer row when nothing is slotted into it. */\n private _onFooterSlotChange(event: Event): void {\n this._hasFooter = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"app-shell\": AppShell;\n }\n}\n"]}
1
+ {"version":3,"file":"app-shell.js","sourceRoot":"","sources":["../src/app-shell.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACL,0EAA0E;QACH,gBAAW,GAAG,KAAK,CAAC;QAC3F,uGAAuG;QAC/C,gBAAW,GAAuB,SAAS,CAAC;QACpG,uGAAuG;QAC9C,iBAAY,GAAoB,MAAM,CAAC;QAChG,gFAAgF;QACV,eAAU,GAAG,KAAK,CAAC;QACzF,gEAAgE;QACvB,gBAAW,GAA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,CAAC;IAED,gEAAgE;IACxD,mBAAmB,CAAC,KAAY;QACtC,IAAI,CAAC,UAAU,GAAI,KAAK,CAAC,MAA0B,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAClG,CAAC;CACF,CAAA;AA3awE;IAAtE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;6CAAqB;AAEnC;IAAvD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;6CAA6C;AAE3C;IAAxD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;8CAAwC;AAE1B;IAArE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;4CAAoB;AAEhD;IAAxC,QAAQ,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;6CAAoD;AAG3E;IAAhB,KAAK,EAAE;yCAAyB;AAEhB;IAAhB,KAAK,EAAE;4CAA4B;AAfzB,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA6apB","sourcesContent":["import { LitElement, css, html, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconBars3 } from \"./icons.js\";\nimport \"./kbd-hint.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** Fired when the built-in toggle changes the sidebar state. */\nexport interface SidebarToggleDetail {\n /** Whether the sidebar is now open. */\n open: boolean;\n}\n\n/**\n * The dashboard page shell: a slot-based CSS-grid backbone that arranges a\n * top bar, the main content, an optional right-hand detail column, an\n * optional footer, and a sidebar. The top bar always spans the shell's full\n * width, in every sidebar state.\n *\n * The sidebar's visibility, width, and layout mode are three independent\n * properties:\n * - `sidebar-open` (default closed) — whether it's shown at all.\n * - `sidebar-width`: `\"full\"` (16rem, icons + labels, the default) or\n * `\"icon\"` (3.5rem rail, icons only — drives the slotted `app-sidebar`'s\n * own `collapsed` attribute).\n * - `sidebar-mode`: `\"overlay\"` (the default) floats the sidebar above the\n * shell's own content with a higher z-index, covering part of the top\n * bar's corner and whatever content sits beneath it, without ever\n * resizing or reflowing `main`/`footer`. `\"push\"` instead reserves a real\n * grid column beside `main`/`footer` (which resize to make room) — the\n * top bar still spans full width above it either way.\n *\n * Below the shared 48rem breakpoint the sidebar always behaves as a\n * full-width, modal, scrim/Escape-dismissible drawer regardless of\n * `sidebar-mode`/`sidebar-width` — those two properties only affect the\n * desktop presentation. Above 48rem, an `overlay`-mode sidebar is a\n * non-modal panel (no dimming scrim, no Escape-dismiss, since it reads as\n * an ordinary always-interactive panel rather than a blocking dialog); a\n * `push`-mode sidebar is even more clearly non-modal, since it never\n * covers anything.\n *\n * The right-hand detail column is unaffected by any of the above: it still\n * reserves an inline grid column on desktop and becomes a dismissible\n * overlay (scrim/Escape) on mobile.\n *\n * Widths are tunable per instance via `--component-sidebar-width` (16rem),\n * `--component-sidebar-rail-width` (3.5rem), and `--component-topbar-height`\n * (3rem); the detail column reuses the 20rem/25rem panel widths. The main\n * content area is white by default — override it with\n * `--component-main-background`. Give the shell a height (e.g. `height:\n * 100vh`) so the sidebar and main can size and scroll.\n *\n * Hovering or keyboard-focusing the toggle reveals a tooltip naming the\n * action and its `[` shortcut — the shortcut is not shown as permanent\n * chrome.\n *\n * @element app-shell\n * @slot - Main content area.\n * @slot sidebar - Sidebar navigation (typically `app-sidebar`).\n * @slot topbar - Top bar content, right of the built-in toggle.\n * @slot detail - Optional right-hand detail; shown when `detail-open` is set.\n * @slot footer - Optional footer beneath the main content.\n * @fires sidebar-toggle - The built-in toggle changed the sidebar state.\n * @fires detail-close - The scrim or Escape dismissed the mobile detail overlay.\n */\n@customElement(\"app-shell\")\nexport class AppShell extends LitElement {\n /** Whether the sidebar is open. Closed by default at every breakpoint. */\n @property({ type: Boolean, reflect: true, attribute: \"sidebar-open\" }) sidebarOpen = false;\n /** `\"overlay\"` (default) floats the sidebar above content; `\"push\"` reserves a grid column instead. */\n @property({ reflect: true, attribute: \"sidebar-mode\" }) sidebarMode: \"overlay\" | \"push\" = \"overlay\";\n /** Sidebar width when open: `\"full\"` (16rem, icons + labels) or `\"icon\"` (3.5rem rail, icons only). */\n @property({ reflect: true, attribute: \"sidebar-width\" }) sidebarWidth: \"full\" | \"icon\" = \"full\";\n /** Shows the right-hand detail region (inline column, or overlay on mobile). */\n @property({ type: Boolean, reflect: true, attribute: \"detail-open\" }) detailOpen = false;\n /** Detail width: `compact` (20rem) or `comfortable` (25rem). */\n @property({ attribute: \"detail-width\" }) detailWidth: \"compact\" | \"comfortable\" = \"compact\";\n\n /** Whether the viewport is at/below the 48rem breakpoint. */\n @state() private _mobile = false;\n /** Whether the footer slot has assigned content. */\n @state() private _hasFooter = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n block-size: 100%;\n }\n .shell {\n --_sidebar-w: 0px;\n --_detail-w: 0px;\n display: grid;\n grid-template-columns: var(--_sidebar-w) minmax(0, 1fr) var(--_detail-w);\n grid-template-rows: auto minmax(0, 1fr) auto;\n grid-template-areas:\n \"topbar topbar topbar\"\n \"sidebar main detail\"\n \"sidebar footer footer\";\n position: relative;\n block-size: 100%;\n min-height: 0;\n background: var(--ui-surface, #ffffff);\n }\n :host([detail-open]) .shell {\n --_detail-w: 20rem;\n }\n :host([detail-open][detail-width=\"comfortable\"]) .shell {\n --_detail-w: 25rem;\n }\n /* Push mode reserves a real grid column, sized only while open — the\n column width doesn't animate (custom properties feeding a grid\n track don't transition smoothly without @property registration),\n so push mode's open/close is an instant snap, unlike overlay\n mode's sliding transform. */\n :host([sidebar-mode=\"push\"][sidebar-open]) .shell {\n --_sidebar-w: var(--component-sidebar-width, 16rem);\n }\n :host([sidebar-mode=\"push\"][sidebar-open][sidebar-width=\"icon\"]) .shell {\n --_sidebar-w: var(--component-sidebar-rail-width, 3.5rem);\n }\n .sidebar {\n /* No grid-area here: an absolutely-positioned grid item's inset\n properties resolve against its OWN grid area's box, not the\n whole grid container, once grid-area is set — even with\n explicit (non-auto) insets. Overlay mode must stay anchored to\n the whole .shell (to overlap the topbar row), so grid-area is\n assigned only in push mode below, where the sidebar is a real,\n in-flow grid item instead of an absolutely-positioned one. */\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: var(--component-sidebar-width, 16rem);\n z-index: 40;\n overflow: hidden;\n border-right: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n transform: translateX(-100%);\n transition: transform 250ms ease;\n }\n :host([sidebar-open]) .sidebar {\n transform: translateX(0);\n }\n :host([sidebar-open]:not([sidebar-mode=\"push\"])) .sidebar {\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n :host([sidebar-width=\"icon\"]) .sidebar {\n width: var(--component-sidebar-rail-width, 3.5rem);\n }\n :host([sidebar-mode=\"push\"]) .sidebar {\n grid-area: sidebar;\n position: static;\n width: 100%;\n transform: none;\n }\n .topbar {\n grid-area: topbar;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: var(--component-topbar-height, 3rem);\n padding: 0.5rem 0.75rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n /* Deliberately no z-index here: an explicit z-index on a CSS grid\n item creates a stacking context, which would trap .nav-toggle\n below .sidebar once an overlay-mode sidebar opens and covers this\n corner. See CLAUDE.md before adding one. */\n }\n .nav-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n .nav-group {\n position: relative;\n z-index: 41;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n flex: 0 0 auto;\n }\n .nav-tip {\n position: absolute;\n top: 100%;\n left: 0;\n margin-top: 0.25rem;\n z-index: 10;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n white-space: nowrap;\n padding: 0.25rem 0.5rem;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: var(--ui-tooltip, #0f172a);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n opacity: 0;\n visibility: hidden;\n pointer-events: none;\n transition: opacity 120ms ease;\n }\n .nav-toggle:hover + .nav-tip,\n .nav-toggle:focus-visible + .nav-tip {\n opacity: 1;\n visibility: visible;\n }\n .nav-toggle:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .nav-toggle:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .topbar-content {\n flex: 1 1 auto;\n min-width: 0;\n }\n .main {\n grid-area: main;\n min-height: 0;\n min-width: 0;\n overflow: auto;\n padding: 1rem;\n background: var(--component-main-background, var(--ui-surface, #ffffff));\n }\n .detail {\n grid-area: detail;\n display: none;\n min-height: 0;\n overflow: auto;\n border-left: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n :host([detail-open]) .detail {\n display: block;\n }\n .footer {\n grid-area: footer;\n padding: 0.5rem 0.75rem;\n border-top: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n .footer.empty {\n display: none;\n }\n .scrim {\n display: none;\n }\n @media (max-width: 48rem) {\n .shell {\n grid-template-columns: minmax(0, 1fr) var(--_detail-w);\n grid-template-areas:\n \"topbar topbar\"\n \"main detail\"\n \"footer footer\";\n }\n /* Mobile is always a full-screen, position:absolute overlay drawer,\n regardless of sidebar-mode/sidebar-width — those two properties\n only affect the desktop presentation. */\n .sidebar,\n :host([sidebar-mode=\"push\"]) .sidebar {\n position: absolute;\n width: 100%;\n }\n .detail {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: var(--_detail-w, 20rem);\n max-width: calc(100vw - 3rem);\n z-index: 40;\n transform: translateX(110%);\n transition: transform 250ms ease;\n }\n :host([detail-open]) .detail {\n transform: translateX(0);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n .scrim.show {\n display: block;\n position: absolute;\n inset: 0;\n z-index: 39;\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n border: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .sidebar,\n .detail,\n .nav-tip {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n .nav-toggle:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .nav-tip {\n border: 1px solid CanvasText;\n }\n }\n `,\n ];\n\n private _mediaQuery: MediaQueryList | null = null;\n private _previousFocus: HTMLElement | null = null;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._mediaQuery = window.matchMedia(\"(max-width: 48rem)\");\n this._mobile = this._mediaQuery.matches;\n this._mediaQuery.addEventListener(\"change\", this._onMediaChange);\n window.addEventListener(\"keydown\", this._onKeydown);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._mediaQuery?.removeEventListener(\"change\", this._onMediaChange);\n this._mediaQuery = null;\n window.removeEventListener(\"keydown\", this._onKeydown);\n }\n\n /** Tracks the breakpoint the sidebar's width and modality depend on. */\n private _onMediaChange = (event: MediaQueryListEvent): void => {\n this._mobile = event.matches;\n };\n\n /** Handles the `[` sidebar shortcut and Escape dismissal of mobile overlays. */\n private _onKeydown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented) return;\n if (event.key === \"Escape\" && this._mobile) {\n if (this.detailOpen) {\n event.preventDefault();\n this._closeDetail();\n } else if (this.sidebarOpen) {\n event.preventDefault();\n this.sidebarOpen = false;\n }\n return;\n }\n if (\n event.key === \"[\" &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey &&\n !this._isEditableTarget(event)\n ) {\n event.preventDefault();\n this._toggleSidebar();\n }\n };\n\n /** Whether the keydown originated in a text field, so the shortcut defers to typing. */\n private _isEditableTarget(event: KeyboardEvent): boolean {\n const target = event.composedPath()[0] as HTMLElement | undefined;\n if (!target) return false;\n if (target.isContentEditable) return true;\n const tag = target.tagName;\n return tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\";\n }\n\n /** Toggles the sidebar and announces it. */\n private _toggleSidebar(): void {\n this.sidebarOpen = !this.sidebarOpen;\n if (this._mobile && this.sidebarOpen) {\n this._previousFocus = document.activeElement as HTMLElement | null;\n }\n this.dispatchEvent(\n new CustomEvent<SidebarToggleDetail>(\"sidebar-toggle\", {\n detail: { open: this.sidebarOpen },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n /** Closes the detail overlay and notifies the consumer that owns `detail-open`. */\n private _closeDetail(): void {\n this.detailOpen = false;\n this.dispatchEvent(new CustomEvent(\"detail-close\", { bubbles: true, composed: true }));\n }\n\n /** Scrim click dismisses whichever overlay is open. */\n private _onScrim(): void {\n if (this.detailOpen) this._closeDetail();\n if (this.sidebarOpen) this.sidebarOpen = false;\n }\n\n /** Mirrors `sidebar-width` onto the slotted sidebar's `collapsed` (icon rail) attribute. */\n private _syncSidebarWidth(): void {\n const icon = this.sidebarWidth === \"icon\";\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"sidebar\"]');\n for (const element of slot?.assignedElements() ?? []) {\n element.toggleAttribute(\"collapsed\", icon);\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"sidebarWidth\")) this._syncSidebarWidth();\n if (!changed.has(\"sidebarOpen\") || !this._mobile) return;\n if (this.sidebarOpen) {\n this.shadowRoot?.querySelector<HTMLElement>(\".sidebar\")?.focus();\n return;\n }\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n override render() {\n const scrimActive = this._mobile && (this.sidebarOpen || this.detailOpen);\n return html`\n <div class=\"shell\">\n <aside\n class=\"sidebar\"\n tabindex=\"-1\"\n aria-label=\"Primary\"\n ?inert=${!this.sidebarOpen}\n aria-hidden=${String(!this.sidebarOpen)}\n >\n <slot name=\"sidebar\" @slotchange=${this._syncSidebarWidth}></slot>\n </aside>\n <header class=\"topbar\">\n <div class=\"nav-group\">\n <button\n class=\"nav-toggle\"\n type=\"button\"\n aria-label=\"Toggle navigation\"\n aria-keyshortcuts=\"[\"\n aria-describedby=\"nav-tip\"\n aria-expanded=${String(this.sidebarOpen)}\n @click=${this._toggleSidebar}\n >\n ${iconBars3(18)}\n </button>\n <span class=\"nav-tip\" id=\"nav-tip\" role=\"tooltip\">\n <span>${this.sidebarOpen ? \"Hide navigation\" : \"Show navigation\"}</span>\n <kbd-hint keys=\"[\"></kbd-hint>\n </span>\n </div>\n <div class=\"topbar-content\"><slot name=\"topbar\"></slot></div>\n </header>\n <main class=\"main\"><slot></slot></main>\n <aside\n class=\"detail\"\n aria-label=\"Detail\"\n ?inert=${!this.detailOpen}\n aria-hidden=${String(!this.detailOpen)}\n >\n <slot name=\"detail\"></slot>\n </aside>\n <footer class=\"footer ${this._hasFooter ? \"\" : \"empty\"}\">\n <slot name=\"footer\" @slotchange=${this._onFooterSlotChange}></slot>\n </footer>\n <button\n class=\"scrim ${scrimActive ? \"show\" : \"\"}\"\n type=\"button\"\n tabindex=\"-1\"\n aria-label=\"Close\"\n @click=${this._onScrim}\n ?hidden=${!scrimActive}\n ></button>\n </div>\n `;\n }\n\n /** Collapses the footer row when nothing is slotted into it. */\n private _onFooterSlotChange(event: Event): void {\n this._hasFooter = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"app-shell\": AppShell;\n }\n}\n"]}
@@ -7,9 +7,10 @@ import { LitElement } from "lit";
7
7
  * `aria-current="page"`. The sidebar styles them, tracks hover/active/focus,
8
8
  * and — in collapsed "rail" mode — centers the icons and hides the labels.
9
9
  *
10
- * Rail mode is driven by the `collapsed` attribute (the parent `app-shell`
11
- * toggles it). Labels are hidden by the inherited `--app-sidebar-label` custom
12
- * property, so each label element should read it, e.g.
10
+ * Rail mode is driven by the `collapsed` attribute, which callers set
11
+ * directly — `app-shell` no longer auto-manages it (its own sidebar is a
12
+ * pure overlay, not a rail). Labels are hidden by the inherited
13
+ * `--app-sidebar-label` custom property, so each label element should read it, e.g.
13
14
  * `<span style="display: var(--app-sidebar-label, inline)">Reports</span>`;
14
15
  * keep an `aria-label` on the item so its accessible name survives collapse.
15
16
  * The sidebar fills the width and height of its container — `app-shell` owns
@@ -1 +1 @@
1
- {"version":3,"file":"app-sidebar.d.ts","sourceRoot":"","sources":["../src/app-sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBACa,UAAW,SAAQ,UAAU;IACxC,2EAA2E;IAC/B,SAAS,UAAS;IAE9D,oDAAoD;IAC3C,OAAO,CAAC,UAAU,CAAS;IACpC,oDAAoD;IAC3C,OAAO,CAAC,UAAU,CAAS;IAEpC,OAAgB,MAAM,4BAkIpB;IAEF,gEAAgE;IAChE,OAAO,CAAC,mBAAmB;IAI3B,gEAAgE;IAChE,OAAO,CAAC,mBAAmB;IAIlB,MAAM,yCAcd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
1
+ {"version":3,"file":"app-sidebar.d.ts","sourceRoot":"","sources":["../src/app-sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBACa,UAAW,SAAQ,UAAU;IACxC,2EAA2E;IAC/B,SAAS,UAAS;IAE9D,oDAAoD;IAC3C,OAAO,CAAC,UAAU,CAAS;IACpC,oDAAoD;IAC3C,OAAO,CAAC,UAAU,CAAS;IAEpC,OAAgB,MAAM,4BAkIpB;IAEF,gEAAgE;IAChE,OAAO,CAAC,mBAAmB;IAI3B,gEAAgE;IAChE,OAAO,CAAC,mBAAmB;IAIlB,MAAM,yCAcd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -15,9 +15,10 @@ import { tokens } from "./tokens.js";
15
15
  * `aria-current="page"`. The sidebar styles them, tracks hover/active/focus,
16
16
  * and — in collapsed "rail" mode — centers the icons and hides the labels.
17
17
  *
18
- * Rail mode is driven by the `collapsed` attribute (the parent `app-shell`
19
- * toggles it). Labels are hidden by the inherited `--app-sidebar-label` custom
20
- * property, so each label element should read it, e.g.
18
+ * Rail mode is driven by the `collapsed` attribute, which callers set
19
+ * directly — `app-shell` no longer auto-manages it (its own sidebar is a
20
+ * pure overlay, not a rail). Labels are hidden by the inherited
21
+ * `--app-sidebar-label` custom property, so each label element should read it, e.g.
21
22
  * `<span style="display: var(--app-sidebar-label, inline)">Reports</span>`;
22
23
  * keep an `aria-label` on the item so its accessible name survives collapse.
23
24
  * The sidebar fills the width and height of its container — `app-shell` owns
@@ -1 +1 @@
1
- {"version":3,"file":"app-sidebar.js","sourceRoot":"","sources":["../src/app-sidebar.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,m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AAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAmB;AAG7C;IAAhB,KAAK,EAAE;8CAA4B;AAEnB;IAAhB,KAAK,EAAE;8CAA4B;AAPzB,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAsKtB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * Collapsible navigation sidebar for the `app-shell` sidebar slot. It is\n * deliberately presentational and router-agnostic: the consumer supplies the\n * nav items as plain `<a>`/`<button>` elements (each an icon followed by a\n * label), optional `<p>` group headings, and marks the active item with\n * `aria-current=\"page\"`. The sidebar styles them, tracks hover/active/focus,\n * and — in collapsed \"rail\" mode — centers the icons and hides the labels.\n *\n * Rail mode is driven by the `collapsed` attribute (the parent `app-shell`\n * toggles it). Labels are hidden by the inherited `--app-sidebar-label` custom\n * property, so each label element should read it, e.g.\n * `<span style=\"display: var(--app-sidebar-label, inline)\">Reports</span>`;\n * keep an `aria-label` on the item so its accessible name survives collapse.\n * The sidebar fills the width and height of its container — `app-shell` owns\n * the actual rail/expanded width.\n *\n * @element app-sidebar\n * @slot - Navigation items: `<a>`/`<button>` links and optional `<p>` headings.\n * @slot header - Optional brand pinned to the top: a small logo plus a name.\n * Wrap the name in a `--app-sidebar-label` element so rail mode shows only the\n * logo, centered in line with the nav icons.\n * @slot footer - Optional account/settings area pinned to the bottom.\n */\n@customElement(\"app-sidebar\")\nexport class AppSidebar extends LitElement {\n /** Collapses the sidebar to an icon rail (centers icons, hides labels). */\n @property({ type: Boolean, reflect: true }) collapsed = false;\n\n /** Whether the header slot has assigned content. */\n @state() private _hasHeader = false;\n /** Whether the footer slot has assigned content. */\n @state() private _hasFooter = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n height: 100%;\n --app-sidebar-label: inline;\n }\n :host([collapsed]) {\n --app-sidebar-label: none;\n }\n .sidebar {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n background: var(--ui-surface, #ffffff);\n color: var(--ui-text, #0f172a);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .brand {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n padding: 0.75rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n }\n .foot {\n flex: 0 0 auto;\n padding: 0.75rem;\n border-top: 1px solid var(--ui-border, #e2e8f0);\n }\n .brand.empty,\n .foot.empty {\n display: none;\n }\n .nav {\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n padding: 0.5rem;\n }\n ::slotted(a),\n ::slotted(button) {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n width: 100%;\n box-sizing: border-box;\n padding: 0.5rem;\n border: none;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: none;\n color: var(--ui-text, #0f172a);\n text-align: left;\n text-decoration: none;\n white-space: nowrap;\n cursor: pointer;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n ::slotted(a:hover),\n ::slotted(button:hover) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n ::slotted(a[aria-current]),\n ::slotted(button[aria-current]) {\n background: var(--ui-surface-muted, #f8fafc);\n color: var(--ui-primary, #4f46e5);\n font-weight: var(--ui-font-weight-semibold, 600);\n }\n ::slotted(a:focus-visible),\n ::slotted(button:focus-visible) {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n ::slotted(p) {\n margin: 0;\n padding: 0.5rem 0.5rem 0.25rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n text-transform: uppercase;\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n color: var(--ui-text-muted, #64748b);\n }\n :host([collapsed]) ::slotted(a),\n :host([collapsed]) ::slotted(button) {\n justify-content: center;\n }\n :host([collapsed]) ::slotted(p) {\n display: none;\n }\n :host([collapsed]) .brand {\n justify-content: center;\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n }\n @media (forced-colors: active) {\n ::slotted(a:focus-visible),\n ::slotted(button:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Collapses the header row when nothing is slotted into it. */\n private _onHeaderSlotChange(event: Event): void {\n this._hasHeader = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n\n /** Collapses the footer row when nothing is slotted into it. */\n private _onFooterSlotChange(event: Event): void {\n this._hasFooter = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n\n override render() {\n return html`\n <div class=\"sidebar\">\n <div class=\"brand ${this._hasHeader ? \"\" : \"empty\"}\">\n <slot name=\"header\" @slotchange=${this._onHeaderSlotChange}></slot>\n </div>\n <nav class=\"nav\" aria-label=\"Sidebar\">\n <slot></slot>\n </nav>\n <div class=\"foot ${this._hasFooter ? \"\" : \"empty\"}\">\n <slot name=\"footer\" @slotchange=${this._onFooterSlotChange}></slot>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"app-sidebar\": AppSidebar;\n }\n}\n"]}
1
+ {"version":3,"file":"app-sidebar.js","sourceRoot":"","sources":["../src/app-sidebar.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,C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CAAC;IACJ,CAAC;CACF,CAAA;AApK6C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAmB;AAG7C;IAAhB,KAAK,EAAE;8CAA4B;AAEnB;IAAhB,KAAK,EAAE;8CAA4B;AAPzB,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAsKtB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * Collapsible navigation sidebar for the `app-shell` sidebar slot. It is\n * deliberately presentational and router-agnostic: the consumer supplies the\n * nav items as plain `<a>`/`<button>` elements (each an icon followed by a\n * label), optional `<p>` group headings, and marks the active item with\n * `aria-current=\"page\"`. The sidebar styles them, tracks hover/active/focus,\n * and — in collapsed \"rail\" mode — centers the icons and hides the labels.\n *\n * Rail mode is driven by the `collapsed` attribute, which callers set\n * directly — `app-shell` no longer auto-manages it (its own sidebar is a\n * pure overlay, not a rail). Labels are hidden by the inherited\n * `--app-sidebar-label` custom property, so each label element should read it, e.g.\n * `<span style=\"display: var(--app-sidebar-label, inline)\">Reports</span>`;\n * keep an `aria-label` on the item so its accessible name survives collapse.\n * The sidebar fills the width and height of its container — `app-shell` owns\n * the actual rail/expanded width.\n *\n * @element app-sidebar\n * @slot - Navigation items: `<a>`/`<button>` links and optional `<p>` headings.\n * @slot header - Optional brand pinned to the top: a small logo plus a name.\n * Wrap the name in a `--app-sidebar-label` element so rail mode shows only the\n * logo, centered in line with the nav icons.\n * @slot footer - Optional account/settings area pinned to the bottom.\n */\n@customElement(\"app-sidebar\")\nexport class AppSidebar extends LitElement {\n /** Collapses the sidebar to an icon rail (centers icons, hides labels). */\n @property({ type: Boolean, reflect: true }) collapsed = false;\n\n /** Whether the header slot has assigned content. */\n @state() private _hasHeader = false;\n /** Whether the footer slot has assigned content. */\n @state() private _hasFooter = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n height: 100%;\n --app-sidebar-label: inline;\n }\n :host([collapsed]) {\n --app-sidebar-label: none;\n }\n .sidebar {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n background: var(--ui-surface, #ffffff);\n color: var(--ui-text, #0f172a);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .brand {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n padding: 0.75rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n }\n .foot {\n flex: 0 0 auto;\n padding: 0.75rem;\n border-top: 1px solid var(--ui-border, #e2e8f0);\n }\n .brand.empty,\n .foot.empty {\n display: none;\n }\n .nav {\n flex: 1 1 auto;\n min-height: 0;\n overflow-y: auto;\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n padding: 0.5rem;\n }\n ::slotted(a),\n ::slotted(button) {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n width: 100%;\n box-sizing: border-box;\n padding: 0.5rem;\n border: none;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: none;\n color: var(--ui-text, #0f172a);\n text-align: left;\n text-decoration: none;\n white-space: nowrap;\n cursor: pointer;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n ::slotted(a:hover),\n ::slotted(button:hover) {\n background: var(--ui-surface-muted, #f8fafc);\n }\n ::slotted(a[aria-current]),\n ::slotted(button[aria-current]) {\n background: var(--ui-surface-muted, #f8fafc);\n color: var(--ui-primary, #4f46e5);\n font-weight: var(--ui-font-weight-semibold, 600);\n }\n ::slotted(a:focus-visible),\n ::slotted(button:focus-visible) {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n ::slotted(p) {\n margin: 0;\n padding: 0.5rem 0.5rem 0.25rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n text-transform: uppercase;\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n color: var(--ui-text-muted, #64748b);\n }\n :host([collapsed]) ::slotted(a),\n :host([collapsed]) ::slotted(button) {\n justify-content: center;\n }\n :host([collapsed]) ::slotted(p) {\n display: none;\n }\n :host([collapsed]) .brand {\n justify-content: center;\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n }\n @media (forced-colors: active) {\n ::slotted(a:focus-visible),\n ::slotted(button:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Collapses the header row when nothing is slotted into it. */\n private _onHeaderSlotChange(event: Event): void {\n this._hasHeader = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n\n /** Collapses the footer row when nothing is slotted into it. */\n private _onFooterSlotChange(event: Event): void {\n this._hasFooter = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n\n override render() {\n return html`\n <div class=\"sidebar\">\n <div class=\"brand ${this._hasHeader ? \"\" : \"empty\"}\">\n <slot name=\"header\" @slotchange=${this._onHeaderSlotChange}></slot>\n </div>\n <nav class=\"nav\" aria-label=\"Sidebar\">\n <slot></slot>\n </nav>\n <div class=\"foot ${this._hasFooter ? \"\" : \"empty\"}\">\n <slot name=\"footer\" @slotchange=${this._onFooterSlotChange}></slot>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"app-sidebar\": AppSidebar;\n }\n}\n"]}