@cngx/ui 0.1.0-rc.8 → 0.3.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.
Files changed (108) hide show
  1. package/README.md +118 -59
  2. package/action-button/README.md +170 -53
  3. package/breadcrumb/README.md +5 -6
  4. package/collection/README.md +1 -1
  5. package/command-palette/README.md +9 -5
  6. package/data-grid-accordion/README.md +1 -1
  7. package/empty-state/README.md +2 -3
  8. package/feedback/README.md +1 -1
  9. package/fesm2022/cngx-ui-a11y.mjs +13 -23
  10. package/fesm2022/cngx-ui-a11y.mjs.map +1 -1
  11. package/fesm2022/cngx-ui-accordion.mjs +55 -60
  12. package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
  13. package/fesm2022/cngx-ui-action-button.mjs +220 -339
  14. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  15. package/fesm2022/cngx-ui-breadcrumb.mjs +100 -80
  16. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
  17. package/fesm2022/cngx-ui-chart-panel.mjs +18 -31
  18. package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -1
  19. package/fesm2022/cngx-ui-collection.mjs +28 -34
  20. package/fesm2022/cngx-ui-collection.mjs.map +1 -1
  21. package/fesm2022/cngx-ui-command-palette.mjs +29 -51
  22. package/fesm2022/cngx-ui-command-palette.mjs.map +1 -1
  23. package/fesm2022/cngx-ui-context-menu.mjs +138 -89
  24. package/fesm2022/cngx-ui-context-menu.mjs.map +1 -1
  25. package/fesm2022/cngx-ui-data-grid-accordion.mjs +135 -77
  26. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
  27. package/fesm2022/cngx-ui-empty-state.mjs +17 -44
  28. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  29. package/fesm2022/cngx-ui-feedback.mjs +648 -495
  30. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  31. package/fesm2022/cngx-ui-layout.mjs +17 -13
  32. package/fesm2022/cngx-ui-layout.mjs.map +1 -1
  33. package/fesm2022/cngx-ui-mat-accordion.mjs +6 -7
  34. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
  35. package/fesm2022/cngx-ui-mat-paginator.mjs +5 -9
  36. package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
  37. package/fesm2022/cngx-ui-mat-stepper.mjs +6 -9
  38. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
  39. package/fesm2022/cngx-ui-mat-tabs.mjs +315 -134
  40. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  41. package/fesm2022/cngx-ui-nav-rail.mjs +440 -0
  42. package/fesm2022/cngx-ui-nav-rail.mjs.map +1 -0
  43. package/fesm2022/cngx-ui-overlay.mjs +9 -10
  44. package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
  45. package/fesm2022/cngx-ui-paginator.mjs +212 -188
  46. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  47. package/fesm2022/cngx-ui-sidenav.mjs +872 -721
  48. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  49. package/fesm2022/cngx-ui-skeleton.mjs +17 -19
  50. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  51. package/fesm2022/cngx-ui-speak.mjs +21 -74
  52. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  53. package/fesm2022/cngx-ui-stat-card.mjs +39 -62
  54. package/fesm2022/cngx-ui-stat-card.mjs.map +1 -1
  55. package/fesm2022/cngx-ui-stepper.mjs +259 -130
  56. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  57. package/fesm2022/cngx-ui-tabs.mjs +148 -50
  58. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  59. package/fesm2022/cngx-ui-timeline.mjs +48 -32
  60. package/fesm2022/cngx-ui-timeline.mjs.map +1 -1
  61. package/fesm2022/cngx-ui-toc.mjs +59 -48
  62. package/fesm2022/cngx-ui-toc.mjs.map +1 -1
  63. package/fesm2022/cngx-ui.mjs +5 -5
  64. package/fesm2022/cngx-ui.mjs.map +1 -1
  65. package/mat-tabs/README.md +57 -19
  66. package/mat-tabs/styles/mat-tabs.css +285 -163
  67. package/nav-rail/README.md +325 -0
  68. package/package.json +37 -8
  69. package/paginator/README.md +10 -0
  70. package/schematics/collection.json +9 -0
  71. package/schematics/ng-add/index.js +9 -0
  72. package/schematics/ng-add/schema.json +96 -0
  73. package/schematics/package.json +3 -0
  74. package/sidenav/README.md +150 -55
  75. package/skeleton/README.md +1 -1
  76. package/speak/README.md +1 -2
  77. package/stepper/README.md +20 -5
  78. package/tabs/README.md +13 -0
  79. package/timeline/README.md +1 -1
  80. package/toc/README.md +1 -1
  81. package/types/cngx-ui-a11y.d.ts +20 -38
  82. package/types/cngx-ui-accordion.d.ts +46 -71
  83. package/types/cngx-ui-action-button.d.ts +113 -151
  84. package/types/cngx-ui-breadcrumb.d.ts +60 -85
  85. package/types/cngx-ui-chart-panel.d.ts +22 -40
  86. package/types/cngx-ui-collection.d.ts +30 -43
  87. package/types/cngx-ui-command-palette.d.ts +40 -64
  88. package/types/cngx-ui-context-menu.d.ts +109 -48
  89. package/types/cngx-ui-data-grid-accordion.d.ts +50 -75
  90. package/types/cngx-ui-empty-state.d.ts +18 -8
  91. package/types/cngx-ui-feedback.d.ts +275 -292
  92. package/types/cngx-ui-layout.d.ts +4 -12
  93. package/types/cngx-ui-mat-accordion.d.ts +5 -5
  94. package/types/cngx-ui-mat-paginator.d.ts +4 -10
  95. package/types/cngx-ui-mat-stepper.d.ts +5 -10
  96. package/types/cngx-ui-mat-tabs.d.ts +86 -89
  97. package/types/cngx-ui-nav-rail.d.ts +416 -0
  98. package/types/cngx-ui-overlay.d.ts +4 -13
  99. package/types/cngx-ui-paginator.d.ts +186 -161
  100. package/types/cngx-ui-sidenav.d.ts +557 -437
  101. package/types/cngx-ui-skeleton.d.ts +7 -13
  102. package/types/cngx-ui-speak.d.ts +40 -24
  103. package/types/cngx-ui-stat-card.d.ts +45 -36
  104. package/types/cngx-ui-stepper.d.ts +205 -84
  105. package/types/cngx-ui-tabs.d.ts +104 -28
  106. package/types/cngx-ui-timeline.d.ts +31 -51
  107. package/types/cngx-ui-toc.d.ts +43 -54
  108. package/types/cngx-ui.d.ts +1 -1
@@ -1,35 +1,182 @@
1
1
  import { DOCUMENT } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { InjectionToken, inject, input, model, computed, signal, linkedSignal, ElementRef, afterNextRender, effect, DestroyRef, ViewEncapsulation, ChangeDetectionStrategy, Component, contentChildren, output, Directive, makeEnvironmentProviders } from '@angular/core';
4
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
- import * as i1$1 from '@cngx/common/layout';
6
- import { CNGX_CONTAINER_SIZE, CngxContainer, injectQueryParamSync } from '@cngx/common/layout';
7
- import { fromEvent } from 'rxjs';
8
- import { FocusTrapFactory } from '@angular/cdk/a11y';
9
- import { createFilledOverrideMerge, injectLocale, createTransitionTracker, parseKeyCombo, matchesKeyCombo, numberFormatterFor } from '@cngx/core/utils';
10
- import * as i1 from '@cngx/common/interactive';
11
- import { CngxHoverIntent, CNGX_HOVER_INTENT_DEFAULTS } from '@cngx/common/interactive';
12
- import { clamp } from '@cngx/utils';
3
+ import { InjectionToken, inject, signal, contentChildren, computed, afterRenderEffect, ViewEncapsulation, ChangeDetectionStrategy, Component, ElementRef, untracked, input, model, viewChild, afterNextRender, Injector, effect, HostAttributeToken, output, Directive, makeEnvironmentProviders } from '@angular/core';
4
+ import * as i1 from '@cngx/common/layout';
5
+ import { CNGX_CONTAINER_SIZE, CngxContainer, CngxSidebar, CngxResizable, CNGX_SIDEBAR_DRIVER, CNGX_DRAWER_SURFACE_DRIVER, CNGX_PANEL_TARGET, CngxDrawerSurface, injectQueryParamSync } from '@cngx/common/layout';
6
+ import { createFilledOverrideMerge, injectLocale, createTransitionTracker, numberFormatterFor, createOverrideMerge } from '@cngx/core/utils';
7
+ import { CngxNavGroup, CngxNavGroupContent, CNGX_NAV_RAIL_TOOLTIP_FACTORY, CNGX_NAV_RAIL_FLYOUT_FACTORY, injectHotkeys, CNGX_HOVER_INTENT_DEFAULTS } from '@cngx/common/interactive';
8
+ import { injectNavRailConfig } from '@cngx/ui/nav-rail';
9
+ import { cngxDevWarn, clamp, CngxRuntimeError } from '@cngx/utils';
13
10
  import { formatMessage, createLanguageSection, createSectionBundle } from '@cngx/core/i18n';
11
+ import { CngxLiveAnnouncer } from '@cngx/common/a11y';
12
+
13
+ /**
14
+ * Contract token for a sidenav rail. `CngxSidenav` provides it via
15
+ * `{ provide: CNGX_SIDENAV, useExisting: CngxSidenav }`, so a collaborator
16
+ * injects the narrow {@link CngxSidenavContract} instead of the concrete class.
17
+ *
18
+ * @since 0.3.0
19
+ * @relatedTo CngxSidenav, CngxSidenavRouterSync
20
+ */
21
+ const CNGX_SIDENAV = new InjectionToken('CNGX_SIDENAV');
22
+ /** @internal Provided by `CngxSidenavLayout`; see {@link CngxSidenavLayoutCoordinator}. */
23
+ const CNGX_SIDENAV_LAYOUT = new InjectionToken('CNGX_SIDENAV_LAYOUT');
24
+
25
+ /**
26
+ * Container for one or two `CngxSidenav` panels and a `CngxSidenavContent`.
27
+ *
28
+ * Renders the shared backdrop behind a modal overlay. Focus trap, scroll lock,
29
+ * `inert` and dismissal on Escape or an outside press belong to each rail's
30
+ * composed `CngxDrawerSurface`. Supports up to two sidenavs: one
31
+ * `position="start"` and one `position="end"`.
32
+ *
33
+ * It is also the query container the rails resolve their `'auto'` mode
34
+ * against: the stylesheet declares and names the container
35
+ * (`cngx-sidenav-layout`) and carries the single docking threshold, the
36
+ * composed `CngxContainer` observes it and publishes the resolved value. A
37
+ * rail mounted without this layout has no container and falls back to
38
+ * `over`.
39
+ *
40
+ * ### Dual sidebar
41
+ * ```html
42
+ * <cngx-sidenav-layout>
43
+ * <cngx-sidenav position="start" [(opened)]="navOpen">
44
+ * Left nav
45
+ * </cngx-sidenav>
46
+ * <cngx-sidenav-content>
47
+ * Main content
48
+ * </cngx-sidenav-content>
49
+ * <cngx-sidenav position="end" [(opened)]="detailOpen">
50
+ * Right detail panel
51
+ * </cngx-sidenav>
52
+ * </cngx-sidenav-layout>
53
+ * ```
54
+ *
55
+ * @wcag AA
56
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/sidenav-layout.ts
57
+ * @since 0.3.0
58
+ * @relatedTo CngxSidenav, CngxSidenavContent, CngxNavHeader, CngxNavFooter
59
+ */
60
+ class CngxSidenavLayout {
61
+ container = inject(CNGX_CONTAINER_SIZE, { self: true });
62
+ // No ResizeObserver (SSR, jsdom): no observation ever arrives, so the layout
63
+ // starts ready instead of staying hidden.
64
+ readyState = signal(!this.container.observes, ...(ngDevMode ? [{ debugName: "readyState" }] : /* istanbul ignore next */ []));
65
+ /**
66
+ * @internal The settled layout has been painted once - gates transitions and
67
+ * the reveal.
68
+ */
69
+ ready = this.readyState.asReadonly();
70
+ sidenavs = contentChildren(CNGX_SIDENAV, ...(ngDevMode ? [{ debugName: "sidenavs" }] : /* istanbul ignore next */ []));
71
+ /** @internal The start-positioned sidenav, if any. */
72
+ startSidenav = computed(() => this.sidenavs().find((s) => s.position() === 'start') ?? null, ...(ngDevMode ? [{ debugName: "startSidenav" }] : /* istanbul ignore next */ []));
73
+ /** @internal The end-positioned sidenav, if any. */
74
+ endSidenav = computed(() => this.sidenavs().find((s) => s.position() === 'end') ?? null, ...(ngDevMode ? [{ debugName: "endSidenav" }] : /* istanbul ignore next */ []));
75
+ /** @internal Whether any sidenav is open in overlay mode. */
76
+ hasOverlay = computed(() => this.sidenavs().some((s) => s.overlayActive()), ...(ngDevMode ? [{ debugName: "hasOverlay" }] : /* istanbul ignore next */ []));
77
+ /** Whether an open overlay takes over the page or the layout (backdrop shown). */
78
+ hasModalOverlay = computed(() => this.sidenavs().some((s) => s.overlayActive() && s.modality() !== 'none'), ...(ngDevMode ? [{ debugName: "hasModalOverlay" }] : /* istanbul ignore next */ []));
79
+ constructor() {
80
+ if (!this.container.observes) {
81
+ return;
82
+ }
83
+ // The rails resolve their width class from the container's observed size;
84
+ // a hidden layout reports 0 and still reads as compact. Once sized, the
85
+ // settled state must be painted once, hidden, before --ready reveals the
86
+ // layout and turns transitions on: in the same frame the reveal would show
87
+ // the move, and in the same style pass the transitions would animate it.
88
+ // Two frames, because the first callback may still run before that paint.
89
+ const win = inject(DOCUMENT).defaultView;
90
+ const gate = afterRenderEffect({
91
+ read: (onCleanup) => {
92
+ if (!win || this.container.inlineSize() === 0) {
93
+ return;
94
+ }
95
+ let id = win.requestAnimationFrame(() => {
96
+ id = win.requestAnimationFrame(() => {
97
+ this.readyState.set(true);
98
+ gate.destroy();
99
+ });
100
+ });
101
+ onCleanup(() => win.cancelAnimationFrame(id));
102
+ },
103
+ });
104
+ }
105
+ /** @internal Closes all sidenavs that are currently in overlay mode. */
106
+ closeAllOverlays() {
107
+ for (const nav of this.sidenavs()) {
108
+ if (nav.overlayActive()) {
109
+ nav.close();
110
+ }
111
+ }
112
+ }
113
+ /** @internal Whether `rail` is one of this layout's direct rails. */
114
+ owns(rail) {
115
+ return this.sidenavs().includes(rail);
116
+ }
117
+ /** @internal One open overlay per layout: called from a rail's open path. */
118
+ overlayOpening(rail) {
119
+ for (const nav of this.sidenavs()) {
120
+ if (nav !== rail && nav.overlayActive()) {
121
+ nav.close();
122
+ }
123
+ }
124
+ }
125
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
126
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.4", type: CngxSidenavLayout, isStandalone: true, selector: "cngx-sidenav-layout", host: { properties: { "class.cngx-sidenav-layout": "true", "class.cngx-sidenav-layout--ready": "ready()", "class.cngx-sidenav-layout--has-overlay": "hasModalOverlay()" } }, providers: [{ provide: CNGX_SIDENAV_LAYOUT, useExisting: CngxSidenavLayout }], queries: [{ propertyName: "sidenavs", predicate: CNGX_SIDENAV, isSignal: true }], exportAs: ["cngxSidenavLayout"], hostDirectives: [{ directive: i1.CngxContainer }], ngImport: i0, template: `
127
+ <ng-content select="cngx-sidenav[position=start], cngx-sidenav:not([position])" />
128
+ <ng-content select="cngx-sidenav-content" />
129
+ <ng-content select="cngx-sidenav[position=end]" />
130
+ <!-- Visual only, always rendered so it fades with the panel: the open
131
+ rail's surface makes it inert and dismisses on a press outside the
132
+ rail, so it needs no handler. --has-overlay shows it. -->
133
+ <div class="cngx-sidenav-backdrop" aria-hidden="true"></div>
134
+ `, isInline: true, styles: ["@layer cngx.tokens{.cngx-sidenav-backdrop{--cngx-sidenav-transition-duration: var(--cngx-duration-base)}}@layer cngx.components{cngx-sidenav-layout{display:flex;position:relative;width:100%;min-height:inherit;overflow:clip;container-type:inline-size;container-name:cngx-sidenav-layout}cngx-sidenav-layout>cngx-sidenav{--cngx-sidenav-width-class: compact}@container cngx-sidenav-layout (min-inline-size: 48rem){cngx-sidenav-layout>cngx-sidenav{--cngx-sidenav-width-class: medium}}@container cngx-sidenav-layout (min-inline-size: 64rem){cngx-sidenav-layout>cngx-sidenav{--cngx-sidenav-width-class: expanded}}cngx-sidenav-layout:not(.cngx-sidenav-layout--ready){opacity:0}cngx-sidenav-layout:not(.cngx-sidenav-layout--ready) cngx-sidenav,cngx-sidenav-layout:not(.cngx-sidenav-layout--ready) cngx-sidenav-content{transition:none!important}cngx-sidenav.cngx-sidenav--resizing~cngx-sidenav-content{transition:none!important;-webkit-user-select:none;user-select:none}cngx-sidenav-content{display:block;flex:1;min-width:0;overflow:auto;order:1;transition:margin-inline-start var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),margin-inline-end var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease)}.cngx-sidenav-backdrop{position:absolute;inset:0;z-index:1;background:var(--cngx-sidenav-backdrop-bg, oklch(0 0 0));opacity:0;visibility:hidden;cursor:pointer}cngx-sidenav-layout.cngx-sidenav-layout--ready>.cngx-sidenav-backdrop{transition:opacity var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s var(--cngx-sidenav-transition-duration, .25s)}cngx-sidenav-layout.cngx-sidenav-layout--has-overlay>.cngx-sidenav-backdrop{opacity:var(--cngx-sidenav-backdrop-opacity, .5);visibility:visible}cngx-sidenav-layout.cngx-sidenav-layout--ready.cngx-sidenav-layout--has-overlay>.cngx-sidenav-backdrop{transition:opacity var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s 0s}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
135
+ }
136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavLayout, decorators: [{
137
+ type: Component,
138
+ args: [{ selector: 'cngx-sidenav-layout', exportAs: 'cngxSidenavLayout', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, hostDirectives: [CngxContainer], providers: [{ provide: CNGX_SIDENAV_LAYOUT, useExisting: CngxSidenavLayout }], host: {
139
+ '[class.cngx-sidenav-layout]': 'true',
140
+ '[class.cngx-sidenav-layout--ready]': 'ready()',
141
+ '[class.cngx-sidenav-layout--has-overlay]': 'hasModalOverlay()',
142
+ }, template: `
143
+ <ng-content select="cngx-sidenav[position=start], cngx-sidenav:not([position])" />
144
+ <ng-content select="cngx-sidenav-content" />
145
+ <ng-content select="cngx-sidenav[position=end]" />
146
+ <!-- Visual only, always rendered so it fades with the panel: the open
147
+ rail's surface makes it inert and dismisses on a press outside the
148
+ rail, so it needs no handler. --has-overlay shows it. -->
149
+ <div class="cngx-sidenav-backdrop" aria-hidden="true"></div>
150
+ `, styles: ["@layer cngx.tokens{.cngx-sidenav-backdrop{--cngx-sidenav-transition-duration: var(--cngx-duration-base)}}@layer cngx.components{cngx-sidenav-layout{display:flex;position:relative;width:100%;min-height:inherit;overflow:clip;container-type:inline-size;container-name:cngx-sidenav-layout}cngx-sidenav-layout>cngx-sidenav{--cngx-sidenav-width-class: compact}@container cngx-sidenav-layout (min-inline-size: 48rem){cngx-sidenav-layout>cngx-sidenav{--cngx-sidenav-width-class: medium}}@container cngx-sidenav-layout (min-inline-size: 64rem){cngx-sidenav-layout>cngx-sidenav{--cngx-sidenav-width-class: expanded}}cngx-sidenav-layout:not(.cngx-sidenav-layout--ready){opacity:0}cngx-sidenav-layout:not(.cngx-sidenav-layout--ready) cngx-sidenav,cngx-sidenav-layout:not(.cngx-sidenav-layout--ready) cngx-sidenav-content{transition:none!important}cngx-sidenav.cngx-sidenav--resizing~cngx-sidenav-content{transition:none!important;-webkit-user-select:none;user-select:none}cngx-sidenav-content{display:block;flex:1;min-width:0;overflow:auto;order:1;transition:margin-inline-start var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),margin-inline-end var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease)}.cngx-sidenav-backdrop{position:absolute;inset:0;z-index:1;background:var(--cngx-sidenav-backdrop-bg, oklch(0 0 0));opacity:0;visibility:hidden;cursor:pointer}cngx-sidenav-layout.cngx-sidenav-layout--ready>.cngx-sidenav-backdrop{transition:opacity var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s var(--cngx-sidenav-transition-duration, .25s)}cngx-sidenav-layout.cngx-sidenav-layout--has-overlay>.cngx-sidenav-backdrop{opacity:var(--cngx-sidenav-backdrop-opacity, .5);visibility:visible}cngx-sidenav-layout.cngx-sidenav-layout--ready.cngx-sidenav-layout--has-overlay>.cngx-sidenav-backdrop{transition:opacity var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s 0s}}\n"] }]
151
+ }], ctorParameters: () => [], propDecorators: { sidenavs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CNGX_SIDENAV), { isSignal: true }] }] } });
14
152
 
15
153
  /**
16
154
  * The English sidenav section: the single source of the sidenav's English
17
155
  * copy. The `CNGX_SIDENAV_CONFIG` labels default to it.
18
156
  *
19
- * @category ui/sidenav/i18n
20
- * @since 0.1.0
157
+ * @since 0.3.0
21
158
  * @relatedTo CNGX_SIDENAV_CONFIG
22
159
  */
23
160
  const CNGX_SIDENAV_LANGUAGE_EN = {
161
+ startRegion: 'Navigation',
162
+ endRegion: 'Side panel',
24
163
  resizeHandle: 'Resize navigation',
25
164
  resizeValueText: '{value}',
165
+ collapsedAnnouncement: 'Navigation collapsed',
166
+ expandedAnnouncement: 'Navigation expanded',
167
+ toggleShortcut: 'Toggle navigation',
26
168
  };
27
169
 
28
170
  /** @internal Turns a sidenav section into the config labels for a locale. Pure. */
29
171
  function sidenavLabelsFrom(section, locale) {
30
172
  return {
173
+ startRegion: section.startRegion,
174
+ endRegion: section.endRegion,
31
175
  resizeHandle: section.resizeHandle,
32
176
  resizeValueText: (percent, value) => formatMessage(section.resizeValueText, { percent, value }, locale),
177
+ collapsedAnnouncement: section.collapsedAnnouncement,
178
+ expandedAnnouncement: section.expandedAnnouncement,
179
+ toggleShortcut: section.toggleShortcut,
33
180
  };
34
181
  }
35
182
  /** @internal The sidenav section of the active pack over the English section. */
@@ -56,17 +203,19 @@ function injectSidenavSiteLabels() {
56
203
  /**
57
204
  * Library defaults for the sidenav configuration cascade. The values are
58
205
  * byte-identical to the per-instance input defaults `CngxSidenav` shipped
59
- * before the cascade (`width '280px'`, `miniWidth '56px'`, `minWidth '120px'`,
206
+ * before the cascade (`width '280px'`, `minWidth '120px'`,
60
207
  * `maxWidth '600px'`, `enterDelay 120`, `leaveDelay 0`; `shortcut` omitted =
61
- * `undefined`), so an un-configured consumer sees no change.
208
+ * `undefined`), so an un-configured consumer sees no change. `miniWidth` is
209
+ * left out: unset, the rail width derives from the nav row tokens in
210
+ * `sidenav.css`.
62
211
  *
63
212
  * The `leaveDelay 0` default is kept deliberately (instant collapse, asymmetric
64
- * with the 120ms enter): the dwell becomes tunable via `[leaveDelay]` /
213
+ * with the 120ms enter): the dwell becomes tunable via `[collapseDelay]` /
65
214
  * `withSidenavHoverDwell(...)`, not silently changed - the breadcrumb
66
215
  * "un-configured consumer sees no change" principle.
67
216
  *
68
- * Exported for intra-lib consumers (`provideSidenavConfig` deep-merges with
69
- * this base) but **NOT** re-exported from `public-api.ts` - downstream
217
+ * Exported for intra-lib consumers (`provideSidenavConfig` merges its features
218
+ * over this base) but **NOT** re-exported from `public-api.ts` - downstream
70
219
  * consumers reach the defaults via `inject(CNGX_SIDENAV_CONFIG)` so
71
220
  * `provideSidenavConfig` / `provideSidenavConfigAt` overrides take precedence.
72
221
  *
@@ -75,7 +224,6 @@ function injectSidenavSiteLabels() {
75
224
  const CNGX_SIDENAV_DEFAULTS = {
76
225
  dimensions: {
77
226
  width: '280px',
78
- miniWidth: '56px',
79
227
  minWidth: '120px',
80
228
  maxWidth: '600px',
81
229
  },
@@ -83,8 +231,8 @@ const CNGX_SIDENAV_DEFAULTS = {
83
231
  enterDelay: 120,
84
232
  leaveDelay: 0,
85
233
  },
86
- // Empty so an un-configured consumer keeps the `'nav'` literal the directive
87
- // resolves at its use-site - byte-identical to no config.
234
+ // Empty so an un-configured consumer keeps the `'nav'` / `'nav-end'` literals
235
+ // the directive resolves per position - byte-identical to no config.
88
236
  routerSync: {},
89
237
  };
90
238
  /**
@@ -102,14 +250,41 @@ const CNGX_SIDENAV_DEFAULTS = {
102
250
  * `bootstrapApplication` providers (root cascade) or `provideSidenavConfigAt(...)`
103
251
  * in a component's `viewProviders` (sub-tree cascade).
104
252
  *
105
- * @category ui/sidenav
106
253
  * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/config/sidenav.config.defaults.ts
107
- * @since 0.1.0
254
+ * @since 0.3.0
108
255
  */
109
256
  const CNGX_SIDENAV_CONFIG = new InjectionToken('CNGX_SIDENAV_CONFIG', {
110
257
  providedIn: 'root',
111
258
  factory: () => CNGX_SIDENAV_DEFAULTS,
112
259
  });
260
+ /**
261
+ * Storage backend of `withSidenavPersistence()`. Defaults to the browser
262
+ * `localStorage`, `null` on the server or where the browser blocks storage
263
+ * (nothing is persisted). Override it to
264
+ * persist elsewhere (`sessionStorage`, a server-backed `Storage` shim):
265
+ *
266
+ * ```ts
267
+ * providers: [{ provide: CNGX_SIDENAV_STORAGE, useFactory: () => sessionStorage }];
268
+ * ```
269
+ *
270
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/config/sidenav.config.defaults.ts
271
+ * @since 0.3.0
272
+ * @relatedTo withSidenavPersistence
273
+ */
274
+ const CNGX_SIDENAV_STORAGE = new InjectionToken('CNGX_SIDENAV_STORAGE', {
275
+ providedIn: 'root',
276
+ factory: () => {
277
+ // A blocked localStorage (privacy mode, a sandboxed iframe) throws a
278
+ // SecurityError on access; persistence then turns off instead of
279
+ // failing the rail's construction.
280
+ try {
281
+ return inject(DOCUMENT).defaultView?.localStorage ?? null;
282
+ }
283
+ catch {
284
+ return null;
285
+ }
286
+ },
287
+ });
113
288
 
114
289
  /**
115
290
  * Convenience accessor for the sidenav configuration cascade. Runs in injection
@@ -126,8 +301,7 @@ const CNGX_SIDENAV_CONFIG = new InjectionToken('CNGX_SIDENAV_CONFIG', {
126
301
  * }
127
302
  * ```
128
303
  *
129
- * @category ui/sidenav
130
- * @since 0.1.0
304
+ * @since 0.3.0
131
305
  */
132
306
  function injectSidenavConfig() {
133
307
  return inject(CNGX_SIDENAV_CONFIG);
@@ -140,8 +314,7 @@ function injectSidenavConfig() {
140
314
  * `undefined` reads the section. Runs in injection context; read it inside a
141
315
  * `computed()`, a template or a handler.
142
316
  *
143
- * @category ui/sidenav
144
- * @since 0.1.0
317
+ * @since 0.3.0
145
318
  * @relatedTo withSidenavLabels
146
319
  */
147
320
  function injectSidenavLabels() {
@@ -149,47 +322,86 @@ function injectSidenavLabels() {
149
322
  }
150
323
 
151
324
  /**
152
- * Contract token for a sidenav rail. `CngxSidenav` provides it via
153
- * `{ provide: CNGX_SIDENAV, useExisting: CngxSidenav }`, so a collaborator
154
- * injects the narrow {@link CngxSidenavContract} instead of the concrete class.
325
+ * Default sidenav announcer: the `collapsedAnnouncement` /
326
+ * `expandedAnnouncement` copy (`withSidenavLabels`, then the language pack)
327
+ * through the root `CngxLiveAnnouncer`, scoped to the rail so an open modal
328
+ * overlay still reads it. The copy is read untracked at announce time, so a
329
+ * language switch never re-speaks a message. Injection context required.
155
330
  *
156
- * @category ui/sidenav
157
- * @since 0.1.0
158
- * @relatedTo CngxSidenav, CngxSidenavRouterSync
331
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/sidenav-announcer.ts
332
+ * @since 0.3.0
333
+ * @relatedTo CNGX_SIDENAV_ANNOUNCER_FACTORY, CngxLiveAnnouncer
159
334
  */
160
- const CNGX_SIDENAV = new InjectionToken('CNGX_SIDENAV');
335
+ function createSidenavAnnouncer() {
336
+ const live = inject(CngxLiveAnnouncer);
337
+ const labels = injectSidenavLabels();
338
+ const host = inject(ElementRef).nativeElement;
339
+ return {
340
+ announce: (expanded) => {
341
+ const message = untracked(() => expanded ? labels().expandedAnnouncement : labels().collapsedAnnouncement);
342
+ live.announce(message, 'polite', host);
343
+ },
344
+ };
345
+ }
346
+ /**
347
+ * Swap token for the hotkey announcement. The default resolves to
348
+ * {@link createSidenavAnnouncer}; the rail builds its announcer via
349
+ * `inject(CNGX_SIDENAV_ANNOUNCER_FACTORY)()` in its own injection context, so
350
+ * an override can still inject `CngxLiveAnnouncer` or the sidenav labels (a
351
+ * telemetry tap, assertive politeness, a silent variant).
352
+ *
353
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/sidenav-announcer.ts
354
+ * @since 0.3.0
355
+ * @relatedTo createSidenavAnnouncer, CngxSidenav
356
+ */
357
+ const CNGX_SIDENAV_ANNOUNCER_FACTORY = new InjectionToken('CngxSidenavAnnouncerFactory', { providedIn: 'root', factory: () => createSidenavAnnouncer });
161
358
 
162
359
  const PERCENT_FORMAT = { style: 'percent' };
360
+ const WIDTH_CLASSES = new Set([
361
+ 'compact',
362
+ 'medium',
363
+ 'expanded',
364
+ ]);
163
365
  /**
164
- * Declarative sidebar component for the four drawer modes (`over`,
165
- * `push`, `side`, `mini`) plus an `auto` default, two-way
166
- * `[(opened)]` binding, and content projection via header/footer
167
- * slots.
366
+ * Declarative sidebar component for the drawer modes (`over`, `side`) plus an `auto` default, two-way `[(opened)]` and `[(collapsed)]`
367
+ * bindings, and content projection via header/footer slots.
368
+ *
369
+ * The rail is a composed `CngxSidebar`: docked, `[(collapsed)]` rests it as a
370
+ * rail (`collapsedAs="rail"`, `miniWidth` wide) or hides it
371
+ * (`collapsedAs="hidden"`), and a collapsed rail peeks at full width over the
372
+ * content on a hover dwell (`expandOnHover`, `expandDelay`, `collapseDelay`).
373
+ * `toggle()` follows the width class: `expanded` flips `collapsed`, `medium`
374
+ * keeps the rail and opens the full nav as an overlay over it, `compact` opens
375
+ * the drawer. `close()` collapses a docked rail.
168
376
  *
169
- * Responsive out of the box: `mode` defaults to `'auto'`, which docks the
170
- * rail beside the content once the surrounding `CngxSidenavLayout` is
171
- * `64rem` or wider and overlays it below that. Nothing needs to be bound.
172
- * The threshold lives in `sidenav-layout.css` and nowhere else - a
173
- * `@container` rule writes `--cngx-sidenav-layout-wide` on the rail and
174
- * this component reads the resolved value, so ejecting the skin moves the
175
- * breakpoint with it. Any explicit `mode` pins that mode at every width.
377
+ * Responsive out of the box: `mode` defaults to `'auto'`, which follows the
378
+ * width class of the surrounding `CngxSidenavLayout` (`widthClass`): it
379
+ * overlays the content below `48rem` (`compact`) and docks beside it from
380
+ * `48rem` (`medium`, `expanded`). Nothing needs to be bound. The thresholds
381
+ * live in `sidenav-layout.css` and nowhere else - a `@container` rule block
382
+ * writes `--cngx-sidenav-width-class` on the rail and this component reads
383
+ * the resolved value, so ejecting the skin moves the thresholds with it. Any
384
+ * explicit `mode` pins that mode at every width.
176
385
  *
177
- * In overlay (`over`) mode it drives a CDK focus trap directly via
178
- * `FocusTrapFactory` (the same primitive `CngxFocusTrap` wraps): focus
179
- * moves into the rail on open and is restored to the opener on close.
180
- * The shared backdrop and document scroll lock are coordinated by
181
- * `CngxSidenavLayout`. It does not compose `CngxDrawer` and has no
182
- * swipe-to-dismiss.
386
+ * An open overlay runs on a composed `CngxDrawerSurface` (`@cngx/common/layout`)
387
+ * with the `modality` input (`'page'` by default): focus moves into the rail
388
+ * and is trapped, the page outside is `inert` and scroll-locked, Escape, the
389
+ * back gesture and a press outside close it, and focus returns to the opener.
390
+ * `CngxSidenavLayout` only draws the backdrop. It does not compose
391
+ * `CngxDrawer` and has no swipe-to-dismiss.
183
392
  *
184
- * Use inside `CngxSidenavLayout` for dual-sidebar support and
185
- * shared backdrop coordination.
393
+ * Use inside `CngxSidenavLayout` for dual-sidebar support and the width
394
+ * class.
186
395
  *
187
396
  * ```html
188
397
  * <cngx-sidenav-layout>
189
398
  * <cngx-sidenav position="start" [(opened)]="navOpen">
190
- * <cngx-sidenav-header>Logo</cngx-sidenav-header>
399
+ * <cngx-nav-header>
400
+ * <span cngxNavMark>A</span>
401
+ * <span cngxNavName>Acme</span>
402
+ * </cngx-nav-header>
191
403
  * <a cngxNavLink [active]="true">Dashboard</a>
192
- * <cngx-sidenav-footer>v1.0</cngx-sidenav-footer>
404
+ * <cngx-nav-footer>v1.0</cngx-nav-footer>
193
405
  * </cngx-sidenav>
194
406
  * <cngx-sidenav-content>
195
407
  * <router-outlet />
@@ -197,16 +409,14 @@ const PERCENT_FORMAT = { style: 'percent' };
197
409
  * </cngx-sidenav-layout>
198
410
  * ```
199
411
  *
200
- * @category ui/sidenav
201
- * @docsKind primary
202
412
  * @wcag AA
203
413
  * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/sidenav.ts
204
- * @since 0.1.0
205
- * @relatedTo CngxSidenavLayout, CngxSidenavContent, CngxSidenavHeader, CngxSidenavFooter
206
- * <example-url>http://localhost:4200/#/ui/sidenav/auto-mode</example-url>
207
- * <example-url>http://localhost:4200/#/ui/sidenav/dual-sidebar-master-detail</example-url>
208
- * <example-url>http://localhost:4200/#/ui/sidenav/full-navigation-sidebar</example-url>
209
- * <example-url>http://localhost:4200/#/ui/sidenav/material-theming-light-vs-dark</example-url>
414
+ * @since 0.3.0
415
+ * @relatedTo CngxSidenavLayout, CngxSidenavContent, CngxNavHeader, CngxNavFooter
416
+ * <example-url>/#/ui/sidenav/auto-mode</example-url>
417
+ * <example-url>/#/ui/sidenav/dual-sidebar-master-detail</example-url>
418
+ * <example-url>/#/ui/sidenav/full-navigation-sidebar</example-url>
419
+ * @axis level organism
210
420
  */
211
421
  class CngxSidenav {
212
422
  /**
@@ -217,22 +427,57 @@ class CngxSidenav {
217
427
  * Declared first so the input field initialisers can read it.
218
428
  */
219
429
  cfg = injectSidenavConfig();
220
- /** Logical position: `'start'` (default left in LTR) or `'end'` (right in LTR). */
430
+ /**
431
+ * Logical position: `'start'` (default left in LTR) or `'end'` (right in LTR).
432
+ * Layout projection and the persistence key read the static `position`
433
+ * attribute; a bound `[position]` moves the rail standalone only.
434
+ */
221
435
  position = input('start', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
222
- /** Accessible label for the complementary landmark. */
223
- ariaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
224
436
  /**
225
- * Drawer mode. `'auto'` (the default) resolves to `'side'` once the
226
- * surrounding layout is `64rem` or wider and to `'over'` below that; any
227
- * other value pins that mode at every width.
437
+ * Accessible name of the rail: of the `navigation` landmark, or of the
438
+ * modal `dialog` while it is an open overlay. Unbound, the `startRegion` /
439
+ * `endRegion` label (`withSidenavLabels`, then the language pack) applies by
440
+ * `position`, so two rails never share one name. An empty or blank value
441
+ * counts as unbound, so the rail is never left without a name.
442
+ */
443
+ ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), transform: (value) => (value?.trim() ? value : undefined) });
444
+ /** @internal The composed sidebar brain. */
445
+ sidebar = inject(CngxSidebar, { self: true });
446
+ /**
447
+ * Element id of the rail: a static `id="..."` attribute on the host, else a
448
+ * generated one (the composed sidebar owns it).
449
+ *
450
+ * An external toggle names this id in its `aria-controls`
451
+ * (`[attr.aria-controls]="nav.id()"`). A press inside such a control is not
452
+ * outside the open overlay, so the toggle's own click can close the rail
453
+ * instead of reopening it.
454
+ */
455
+ id = this.sidebar.id;
456
+ /**
457
+ * Drawer mode. `'auto'` (the default) resolves from `widthClass`: `'over'`
458
+ * in `compact`, `'side'` in `medium` and `expanded`. Any other value pins
459
+ * that mode at every width.
228
460
  */
229
461
  mode = input('auto', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
230
- /** Width of the sidenav panel. Supports two-way `[(width)]` for resize. */
462
+ /**
463
+ * Width of the sidenav panel. Supports two-way `[(width)]` for resize. A px
464
+ * value renders clamped to `minWidth` / `maxWidth`; any other unit passes
465
+ * through unclamped.
466
+ */
231
467
  width = model(this.cfg.dimensions?.width ?? '280px', ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
232
- /** Width of the collapsed rail in `mini` mode. Any CSS value. */
233
- miniWidth = input(this.cfg.dimensions?.miniWidth ?? '56px', ...(ngDevMode ? [{ debugName: "miniWidth" }] : /* istanbul ignore next */ []));
234
- /** Whether hovering the mini rail expands the sidenav to full width. */
235
- expandOnHover = input(true, ...(ngDevMode ? [{ debugName: "expandOnHover" }] : /* istanbul ignore next */ []));
468
+ /**
469
+ * Width of the collapsed rail (`collapsed` with `collapsedAs="rail"`). Any CSS
470
+ * value. Unbound and unconfigured, the rail width derives from the nav row
471
+ * tokens (`2 * (row inset + row inline padding) + icon size + border width`),
472
+ * so the icon box sits centred, as on `cngx-nav-rail`.
473
+ */
474
+ miniWidth = input(this.cfg.dimensions?.miniWidth, ...(ngDevMode ? [{ debugName: "miniWidth" }] : /* istanbul ignore next */ []));
475
+ /**
476
+ * Whether a row on the collapsed rail shows its label in a tooltip. Unbound,
477
+ * `withNavRailTooltip` of the nav rail config in scope applies, else `true`.
478
+ * Switching it off removes the tooltip element and its listeners.
479
+ */
480
+ tooltip = input(undefined, ...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
236
481
  /** Whether the sidebar is user-resizable via a drag handle. */
237
482
  resizable = input(false, ...(ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []));
238
483
  /**
@@ -244,126 +489,242 @@ class CngxSidenav {
244
489
  labels = injectSidenavLabels();
245
490
  locale = injectLocale();
246
491
  /** @internal */
492
+ resolvedAriaLabel = computed(() => {
493
+ const labels = this.labels();
494
+ const fallback = this.position() === 'end' ? labels.endRegion : labels.startRegion;
495
+ return this.ariaLabel() ?? fallback;
496
+ }, ...(ngDevMode ? [{ debugName: "resolvedAriaLabel" }] : /* istanbul ignore next */ []));
497
+ /** @internal */
247
498
  resolvedResizeLabel = computed(() => this.resizeLabel() ?? this.labels().resizeHandle, ...(ngDevMode ? [{ debugName: "resolvedResizeLabel" }] : /* istanbul ignore next */ []));
248
499
  /**
249
500
  * Minimum width constraint during resize. Use a px value: drag and keyboard
250
501
  * clamping (and `aria-valuemin`) resolve px only; a rem/ch constraint falls
251
- * back to the 120px default for clamping and omits the ARIA value.
502
+ * back to the 120px default.
252
503
  */
253
504
  minWidth = input(this.cfg.dimensions?.minWidth ?? '120px', ...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
254
505
  /**
255
506
  * Maximum width constraint during resize. Use a px value: drag and keyboard
256
507
  * clamping (and `aria-valuemax`) resolve px only; a rem/ch constraint falls
257
- * back to the 600px default for clamping and omits the ARIA value.
508
+ * back to the 600px default.
258
509
  */
259
510
  maxWidth = input(this.cfg.dimensions?.maxWidth ?? '600px', ...(ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []));
260
511
  /**
261
512
  * Keyboard shortcut to toggle the sidenav, e.g. `'ctrl+b'` or `'meta+b'`.
262
513
  * Uses `ctrl` on Windows/Linux and `meta` (Cmd) on macOS automatically
263
- * when `'mod+<key>'` syntax is used.
514
+ * when `'mod+<key>'` syntax is used. Unbound, a `start` rail takes the
515
+ * app-wide `withSidenavShortcut` default; an `end` rail registers only a
516
+ * combo bound here, so a dual layout never binds one press to both rails.
517
+ * Pass an empty string to turn the toggle shortcut off for this rail.
264
518
  */
265
- shortcut = input(this.cfg.shortcut, ...(ngDevMode ? [{ debugName: "shortcut" }] : /* istanbul ignore next */ []));
519
+ shortcut = input(undefined, ...(ngDevMode ? [{ debugName: "shortcut" }] : /* istanbul ignore next */ []));
520
+ /** The toggle combo: the bound `[shortcut]`, else the app default on a `start` rail. */
521
+ toggleCombo = computed(() => this.shortcut() ?? (this.position() === 'start' ? this.cfg.shortcut : undefined), ...(ngDevMode ? [{ debugName: "toggleCombo" }] : /* istanbul ignore next */ []));
522
+ /** The resize handle, present while `resizable` and at full width. */
523
+ resizeHandle = viewChild(CngxResizable, ...(ngDevMode ? [{ debugName: "resizeHandle" }] : /* istanbul ignore next */ []));
266
524
  /** Whether a resize drag is in progress. */
267
- resizingState = signal(false, ...(ngDevMode ? [{ debugName: "resizingState" }] : /* istanbul ignore next */ []));
268
- resizing = this.resizingState.asReadonly();
525
+ resizing = computed(() => this.resizeHandle()?.resizing() ?? false, ...(ngDevMode ? [{ debugName: "resizing" }] : /* istanbul ignore next */ []));
269
526
  /** Two-way opened state. Supports `[(opened)]="signal"`. */
270
527
  opened = model(false, ...(ngDevMode ? [{ debugName: "opened" }] : /* istanbul ignore next */ []));
271
- /** Debounced mini expand-on-hover, composed as a hostDirective (its own pointer listeners drive it). */
272
- hoverIntent = inject(CngxHoverIntent, { host: true });
273
528
  /**
274
- * Composed source for `expandedState`: the effective mode, the debounced
275
- * hover-intent signal, and the on/off switch. Carries an explicit `equal` so
276
- * the object literal never churns identity and re-runs the computation when
277
- * none of the three fields actually changed.
529
+ * How far an open overlay takes over the page: `'page'` (default, a modal
530
+ * dialog: focus trap, `aria-modal`, everything outside `inert`, scroll lock,
531
+ * backdrop), `'contained'` (inert and lock inside the layout only) or
532
+ * `'none'` (the page stays operable, no backdrop). Docked, the rail is a
533
+ * landmark (`navigation` unless `[role]` is bound) in every modality.
278
534
  */
279
- hoverSource = computed(() => ({
280
- mode: this.effectiveMode(),
281
- hover: this.hoverIntent.active(),
282
- enabled: this.expandOnHover(),
283
- }), { ...(ngDevMode ? { debugName: "hoverSource" } : /* istanbul ignore next */ {}), equal: (a, b) => a.mode === b.mode && a.hover === b.hover && a.enabled === b.enabled });
284
- /**
285
- * Whether the mini-mode rail is currently expanded. A pure derivation of
286
- * `(effectiveMode, hoverIntent.active, expandOnHover)`, not two imperative
287
- * event-handler writes:
288
- *
289
- * - outside `mini` it is always `false`;
290
- * - with `expandOnHover=true` the debounced hover is the source of truth, so a
291
- * pointer edge overrides a prior `expand()`/`collapse()` (see `expand()`);
292
- * - with `expandOnHover=false` hover is ignored and the prior value is kept, so
293
- * `expand()`/`collapse()` retain full programmatic authority.
294
- *
295
- * It stays a writable `linkedSignal` so `expand()`/`collapse()` can `set()` it;
296
- * the next source change re-derives from the debounced hover.
297
- */
298
- expandedState = linkedSignal({ ...(ngDevMode ? { debugName: "expandedState" } : /* istanbul ignore next */ {}), source: this.hoverSource,
299
- computation: ({ mode, hover, enabled }, prev) => {
300
- if (mode !== 'mini') {
301
- return false;
302
- }
303
- return enabled ? hover : (prev?.value ?? false);
304
- } });
305
- expanded = this.expandedState.asReadonly();
535
+ modality = input('page', ...(ngDevMode ? [{ debugName: "modality" }] : /* istanbul ignore next */ []));
306
536
  /** @internal Reference to host element for layout positioning. */
307
537
  elementRef = inject((ElementRef));
308
538
  /** The layout's query container, absent when the rail is mounted standalone. */
309
539
  container = inject(CNGX_CONTAINER_SIZE, { optional: true });
310
540
  /**
311
- * `'1'` while the layout is at or above the docking threshold, set by the
312
- * `@container` rule in `sidenav-layout.css` on this rail. The rule styles
313
- * the rail rather than the layout because a container query resolves
314
- * against an *ancestor* container - a rule whose subject is the container
315
- * itself would never match.
541
+ * The raw `--cngx-sidenav-width-class` the `@container` rule block in
542
+ * `sidenav-layout.css` writes on this rail. The rule styles the rail rather
543
+ * than the layout because a container query resolves against an *ancestor*
544
+ * container - a rule whose subject is the container itself would never match.
316
545
  *
317
546
  * Empty until the layout's first `ResizeObserver` entry arrives, so `auto`
318
- * resolves to `over` for that first frame. The observer's initial callback
319
- * runs after layout and before paint, so nothing flashes; do NOT seed this
320
- * with a constructor-time `getComputedStyle`, which would read before the
321
- * first layout and report `'0'` regardless of the real width.
547
+ * resolves to `compact` for the first frames. `CngxSidenavLayout` stays
548
+ * hidden and transition-free until the settled class has been painted. Do
549
+ * NOT seed this with a constructor-time `getComputedStyle`, which would read
550
+ * before the first layout.
551
+ */
552
+ rawWidthClass = this.container?.property('--cngx-sidenav-width-class', this.elementRef.nativeElement) ?? signal('').asReadonly();
553
+ /**
554
+ * The width class of the surrounding layout: `compact` below 48rem, `medium`
555
+ * from 48rem, `expanded` from 64rem. Outside a layout, and for a value the
556
+ * rule block does not define, it is `compact`.
322
557
  */
323
- layoutWide = this.container?.property('--cngx-sidenav-layout-wide', this.elementRef.nativeElement) ?? signal('').asReadonly();
324
- /** Resolved mode - `'auto'` derives from the layout width, anything else pins. */
558
+ widthClass = computed(() => {
559
+ const raw = this.rawWidthClass().trim();
560
+ return WIDTH_CLASSES.has(raw) ? raw : 'compact';
561
+ }, ...(ngDevMode ? [{ debugName: "widthClass" }] : /* istanbul ignore next */ []));
562
+ /** Resolved mode - `'auto'` derives from the width class, anything else pins. */
325
563
  effectiveMode = computed(() => {
326
564
  const mode = this.mode();
327
565
  if (mode !== 'auto') {
328
566
  return mode;
329
567
  }
330
- return this.layoutWide() === '1' ? 'side' : 'over';
568
+ return this.widthClass() === 'compact' ? 'over' : 'side';
331
569
  }, ...(ngDevMode ? [{ debugName: "effectiveMode" }] : /* istanbul ignore next */ []));
332
- /** Whether this sidenav is in overlay mode (over). */
333
- isOverlay = computed(() => this.effectiveMode() === 'over', ...(ngDevMode ? [{ debugName: "isOverlay" }] : /* istanbul ignore next */ []));
334
- /** Whether the sidenav is currently a modal overlay: overlay mode and open. */
570
+ /**
571
+ * `auto` in the `medium` width class: the rail is the resting state and
572
+ * `toggle()` opens the full nav as an overlay over it (no reflow).
573
+ */
574
+ railBase = computed(() => this.mode() === 'auto' && this.widthClass() === 'medium', ...(ngDevMode ? [{ debugName: "railBase" }] : /* istanbul ignore next */ []));
575
+ /**
576
+ * Whether `opened` shows the rail as an overlay: the `over` drawer, or the
577
+ * full nav over the `medium` rail.
578
+ */
579
+ isOverlay = computed(() => this.effectiveMode() === 'over' || this.railBase(), ...(ngDevMode ? [{ debugName: "isOverlay" }] : /* istanbul ignore next */ []));
580
+ /** Whether the sidenav is currently a modal overlay: overlay presentation and open. */
335
581
  overlayActive = computed(() => this.isOverlay() && this.opened(), ...(ngDevMode ? [{ debugName: "overlayActive" }] : /* istanbul ignore next */ []));
336
- /** Resolved width - mini mode uses miniWidth unless expanded. */
337
- effectiveWidth = computed(() => {
338
- if (this.effectiveMode() === 'mini' && !this.expandedState()) {
339
- return this.miniWidth();
582
+ /**
583
+ * Whether the full nav is shown: the overlay while `opened`, a
584
+ * docked rail while not `collapsed` or while it peeks. A trigger's
585
+ * `aria-expanded` mirrors it outside a peek (`panelTarget.peeked`).
586
+ */
587
+ expanded = computed(() => {
588
+ if (this.isOverlay()) {
589
+ return this.opened();
340
590
  }
341
- return this.width();
342
- }, ...(ngDevMode ? [{ debugName: "effectiveWidth" }] : /* istanbul ignore next */ []));
591
+ return this.sidebar.expanded();
592
+ }, ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
593
+ /** @internal Drives the composed `CngxSidebar`: the collapsed state per presentation. */
594
+ sidebarCollapsed = computed(() => {
595
+ if (this.railBase()) {
596
+ return true;
597
+ }
598
+ return this.effectiveMode() === 'over' ? false : this.sidebar.collapsed();
599
+ }, ...(ngDevMode ? [{ debugName: "sidebarCollapsed" }] : /* istanbul ignore next */ []));
600
+ /** @internal Drives the composed `CngxSidebar`: `medium` always rests as a rail. */
601
+ sidebarCollapsedAs = computed(() => {
602
+ if (this.railBase()) {
603
+ return 'rail';
604
+ }
605
+ return this.sidebar.collapsedAs();
606
+ }, ...(ngDevMode ? [{ debugName: "sidebarCollapsedAs" }] : /* istanbul ignore next */ []));
607
+ /** @internal Drives the composed `CngxSidebar`: the `medium` overlay shows over the rail. */
608
+ sidebarPeek = computed(() => this.railBase() && this.opened(), ...(ngDevMode ? [{ debugName: "sidebarPeek" }] : /* istanbul ignore next */ []));
609
+ /** @internal Drives the composed `CngxSidebar`: a closed drawer leaves the a11y tree. */
610
+ sidebarConcealed = computed(() => this.effectiveMode() === 'over' && !this.opened(), ...(ngDevMode ? [{ debugName: "sidebarConcealed" }] : /* istanbul ignore next */ []));
611
+ /** @internal Drives the composed `CngxSidebar`: the rail's accessible name. */
612
+ sidebarLabel = computed(() => this.resolvedAriaLabel(), ...(ngDevMode ? [{ debugName: "sidebarLabel" }] : /* istanbul ignore next */ []));
613
+ /**
614
+ * @internal Drives the composed `CngxSidebar`: the body is nav rows, so an
615
+ * unbound `[role]` renders a `navigation` landmark on either edge.
616
+ */
617
+ sidebarRole = signal('navigation').asReadonly();
618
+ /**
619
+ * @internal Drives the composed `CngxDrawerSurface`: engaged while an open
620
+ * overlay. An `auto` rail inside a layout holds off until the container rule
621
+ * has resolved its width class: the layout stays hidden until then, and a
622
+ * surface engaged earlier would run its autofocus against a rail that is
623
+ * not shown yet, so an initially open overlay would go modal with focus left
624
+ * on the page. Engaging on the resolved frame gives the trap a real edge. A
625
+ * pinned mode or a standalone rail has nothing to wait for and engages at once.
626
+ */
627
+ surfaceActive = computed(() => this.overlayActive() && !this.widthClassPending(), ...(ngDevMode ? [{ debugName: "surfaceActive" }] : /* istanbul ignore next */ []));
628
+ /**
629
+ * @internal Drives the composed `CngxDrawerSurface`: the sidebar's resolved
630
+ * role, so both host writers render one landmark; `dialog` wins while engaged.
631
+ */
632
+ surfaceLandmarkRole = computed(() => this.sidebar.role(), ...(ngDevMode ? [{ debugName: "surfaceLandmarkRole" }] : /* istanbul ignore next */ []));
633
+ /** @internal Drives the composed `CngxDrawerSurface`. */
634
+ surfaceModality = this.modality;
635
+ /** @internal Drives the composed `CngxDrawerSurface`: one name in every state. */
636
+ surfaceLabel = this.sidebarLabel;
637
+ /** @internal Escape, the back gesture or an outside press closes the overlay. */
638
+ surfaceDismiss() {
639
+ this.close();
640
+ }
641
+ /**
642
+ * The rail as a {@link CngxPanelTarget}, for `[cngxPanelTrigger]="nav.panelTarget"`
643
+ * (and `CNGX_PANEL_TARGET` inside the rail). One trigger works in every
644
+ * width class: `toggle()` flips `collapsed` on the docked rail and opens or
645
+ * closes the overlay over the `medium` rail and the `compact` drawer;
646
+ * `expanded` is "the full nav is shown", and a hover peek of the docked rail
647
+ * is reported through `peeked`, so the trigger's `aria-expanded` keeps the
648
+ * resting state. `mode` reads `over` while `opened` shows the rail as an
649
+ * overlay, else `inline`.
650
+ */
651
+ panelTarget = {
652
+ id: this.id,
653
+ expanded: this.expanded,
654
+ peeked: computed(() => !this.isOverlay() && this.sidebar.peeked()),
655
+ toggle: () => this.toggle(),
656
+ peek: () => this.peek(),
657
+ mode: computed(() => (this.isOverlay() ? 'over' : 'inline')),
658
+ modal: computed(() => this.isOverlay() && this.modality() !== 'none'),
659
+ side: this.position,
660
+ label: this.sidebarLabel,
661
+ };
662
+ /** Peeks a collapsed docked rail without changing `collapsed`; elsewhere it toggles. */
663
+ peek() {
664
+ if (this.dockedRail()) {
665
+ this.sidebar.peek();
666
+ return;
667
+ }
668
+ this.toggle();
669
+ }
343
670
  doc = inject(DOCUMENT);
344
- win = this.doc.defaultView;
671
+ layoutAncestor = inject(CNGX_SIDENAV_LAYOUT, { optional: true });
345
672
  /**
346
- * Current/previous effective-mode pair for transition detection. The shared
347
- * `createTransitionTracker` is generic since it stopped being `AsyncStatus`-
348
- * typed, so the hand-rolled `linkedSignal` twin this class used to carry is
349
- * gone. `previous` seeds to `current` on the first run, which the consumer
350
- * effect's equality guard already treats as "no transition".
673
+ * The layout this rail is a direct rail of. Any ancestor layout is not
674
+ * enough: its width-class rule and its one-overlay rule cover its own rails
675
+ * only, so a rail nested in its content stands alone.
351
676
  */
352
- modeTransition = createTransitionTracker(() => this.effectiveMode());
353
- /** CDK focus trap over the host; enabled only while a modal overlay is open. */
354
- focusTrap;
355
- /** Element that held focus when the overlay opened, restored to it on close. */
356
- restoreTarget = null;
677
+ layoutCoordinator = computed(() => {
678
+ const layout = this.layoutAncestor;
679
+ return layout?.owns(this) ? layout : null;
680
+ }, ...(ngDevMode ? [{ debugName: "layoutCoordinator" }] : /* istanbul ignore next */ []));
681
+ /** An `auto` rail inside a layout whose container rule has not written the width class yet. */
682
+ widthClassPending = computed(() => this.mode() === 'auto' &&
683
+ this.layoutCoordinator() !== null &&
684
+ this.rawWidthClass().trim() === '', ...(ngDevMode ? [{ debugName: "widthClassPending" }] : /* istanbul ignore next */ []));
685
+ announcer = inject(CNGX_SIDENAV_ANNOUNCER_FACTORY)();
357
686
  /**
358
- * Set when the mode-transition effect auto-opens an overlay (a viewport-driven
359
- * `side`/`mini` -> `over` switch). The focus effect reads it to enable the trap
360
- * without pulling focus into the rail, since that open was not user-initiated.
687
+ * Current/previous presentation pair for the open-flag reset: the resolved
688
+ * mode plus whether `medium` rests as a rail. A pinned mode ignores the width
689
+ * class, so only its own flip is an edge; `auto` -> pinned `over` at compact
690
+ * keeps the presentation. `null` while an `auto` rail waits for the layout's
691
+ * first `ResizeObserver` entry, so settling from that frame is not a change.
361
692
  */
362
- autoOpenInFlight = false;
363
- /** Aborts the in-flight resize drag's document listeners (pointerup or teardown). */
364
- resizeAbort = null;
693
+ presentationTransition = createTransitionTracker(() => this.widthClassPending() ? null : `${this.effectiveMode()}:${this.railBase()}`);
694
+ /**
695
+ * Whether the sidenav rests as a collapsed rail. Peek, expanded and hidden
696
+ * are not railed, so tooltip and flyout attach only to the narrow rest.
697
+ */
698
+ railed = computed(() => this.sidebar.state() === 'rail', ...(ngDevMode ? [{ debugName: "railed" }] : /* istanbul ignore next */ []));
699
+ navRailConfig = injectNavRailConfig();
700
+ /** Whether the rail tooltip is on: `[tooltip]`, then the nav rail config. */
701
+ resolvedTooltip = computed(() => this.tooltip() ?? this.navRailConfig.tooltip, ...(ngDevMode ? [{ debugName: "resolvedTooltip" }] : /* istanbul ignore next */ []));
702
+ // Each directive query has a `read: ElementRef` twin over the same selector,
703
+ // so the flyout pairs a directive with its host by index.
704
+ navGroups = contentChildren(CngxNavGroup, { ...(ngDevMode ? { debugName: "navGroups" } : /* istanbul ignore next */ {}), descendants: true });
705
+ navGroupElements = contentChildren(CngxNavGroup, { ...(ngDevMode ? { debugName: "navGroupElements" } : /* istanbul ignore next */ {}), descendants: true,
706
+ read: ElementRef });
707
+ navGroupContents = contentChildren(CngxNavGroupContent, { ...(ngDevMode ? { debugName: "navGroupContents" } : /* istanbul ignore next */ {}), descendants: true });
708
+ navGroupContentElements = contentChildren(CngxNavGroupContent, { ...(ngDevMode ? { debugName: "navGroupContentElements" } : /* istanbul ignore next */ {}), descendants: true,
709
+ read: ElementRef });
365
710
  constructor() {
366
- this.focusTrap = inject(FocusTrapFactory).create(this.elementRef.nativeElement);
711
+ // The rail pieces of cngx-nav-rail: a tooltip with the clipped row label
712
+ // and the nav groups as flyouts, both only while railed. The tooltip
713
+ // delay comes from CNGX_NAV_RAIL_CONFIG, so one setting covers both
714
+ // organisms.
715
+ inject(CNGX_NAV_RAIL_TOOLTIP_FACTORY)({
716
+ railed: computed(() => this.resolvedTooltip() && this.railed()),
717
+ side: this.position,
718
+ hoverDelay: signal(this.navRailConfig.tooltipDelay).asReadonly(),
719
+ });
720
+ inject(CNGX_NAV_RAIL_FLYOUT_FACTORY)({
721
+ railed: this.railed,
722
+ side: this.position,
723
+ groups: this.navGroups,
724
+ groupElements: this.navGroupElements,
725
+ contents: this.navGroupContents,
726
+ contentElements: this.navGroupContentElements,
727
+ });
367
728
  // Seed the separator's aria-valuenow for non-px rails: the attribute must
368
729
  // exist before the first focus, and only layout can resolve a rem width.
369
730
  afterNextRender(() => {
@@ -373,146 +734,179 @@ class CngxSidenav {
373
734
  if (typeof ngDevMode !== 'undefined' &&
374
735
  ngDevMode &&
375
736
  this.mode() === 'auto' &&
376
- !this.container) {
377
- console.warn('[cngx-sidenav] auto mode needs a <cngx-sidenav-layout> (or [cngxContainer]) ancestor; rendering as over.');
737
+ (!this.container || (this.layoutAncestor !== null && this.layoutCoordinator() === null))) {
738
+ cngxDevWarn('CNGX3010', '[cngx-sidenav] auto mode needs a <cngx-sidenav-layout> ancestor; rendering as over.');
378
739
  }
379
740
  });
380
- // Modal-overlay focus contract: on the open edge move focus into the rail
381
- // and trap it; on the close edge restore focus to whatever opened it, after
382
- // the DOM settles. overlayActive is the single tracked trigger; restoreTarget
383
- // is a plain field, not a signal, so this stays a pure side-effect and never
384
- // feeds a write back into the reactive graph.
385
- let wasOverlayActive = false;
386
- effect(() => {
387
- const active = this.overlayActive();
388
- this.focusTrap.enabled = active;
389
- if (active && !wasOverlayActive) {
390
- // Only pull focus into the rail when the open was user-initiated. An
391
- // auto-open driven by an auto-mode switch (container resize) engages
392
- // the trap - the rail is now modal - but must not steal focus.
393
- const viaAutoOpen = this.autoOpenInFlight;
394
- this.autoOpenInFlight = false;
395
- if (!viaAutoOpen) {
396
- const activeEl = this.doc.activeElement;
397
- this.restoreTarget = activeEl instanceof HTMLElement ? activeEl : null;
398
- void this.focusTrap.focusFirstTabbableElementWhenReady();
399
- }
741
+ // The toggle hotkey (`shortcut`, `withSidenavShortcut`) in the app's hotkey
742
+ // registry, under the remap id `sidenav.toggle`. It sits in the rail's own
743
+ // scope, so while another modal overlay holds focus it stays quiet. It runs
744
+ // toggle() (never a raw opened flip) and announces the new state, since no
745
+ // focused trigger conveys aria-expanded. An unset shortcut lists no
746
+ // binding at all: an empty combo would warn CNGX1080 as unparseable.
747
+ // An open is announced after the render that applies the modal state:
748
+ // spoken earlier, the message lands in a body region the overlay is about
749
+ // to make inert. The hotkey runs outside an injection context, hence the
750
+ // captured injector.
751
+ const injector = inject(Injector);
752
+ const runToggle = () => {
753
+ this.toggle();
754
+ if (!this.expanded()) {
755
+ this.announcer.announce(false);
756
+ return;
400
757
  }
401
- else if (!active && wasOverlayActive) {
402
- const target = this.restoreTarget;
403
- this.restoreTarget = null;
404
- // Move focus out of the rail synchronously, before aria-hidden flips
405
- // true in this same flush (host binding: !opened()). The queued restore
406
- // alone would leave the trapped focus under aria-hidden for a microtask,
407
- // which the browser blocks and warns about; the deferred restore still
408
- // returns focus to the opener afterwards.
409
- const activeEl = this.doc.activeElement;
410
- const host = this.elementRef.nativeElement;
411
- if (activeEl instanceof HTMLElement && host.contains(activeEl)) {
412
- activeEl.blur();
758
+ afterNextRender(() => this.announcer.announce(true), { injector });
759
+ };
760
+ const toggleDescription = computed(() => this.labels().toggleShortcut, ...(ngDevMode ? [{ debugName: "toggleDescription" }] : /* istanbul ignore next */ []));
761
+ injectHotkeys(computed(() => {
762
+ const combo = this.toggleCombo();
763
+ return combo
764
+ ? [{ id: 'sidenav.toggle', combo, description: toggleDescription, run: runToggle }]
765
+ : [];
766
+ }));
767
+ this.persistCollapsed();
768
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
769
+ effect(() => {
770
+ const raw = this.rawWidthClass().trim();
771
+ if (raw !== '' && !WIDTH_CLASSES.has(raw)) {
772
+ untracked(() => warnUnknownWidthClass(raw));
413
773
  }
414
- queueMicrotask(() => target?.focus());
415
- }
416
- wasOverlayActive = active;
417
- });
418
- inject(DestroyRef).onDestroy(() => {
419
- this.focusTrap.destroy();
420
- this.resizeAbort?.abort();
421
- });
422
- // Global hotkey: document listener inside effect(onCleanup) so the combo
423
- // signal can re-register at runtime. Host listeners cannot rebind.
424
- const isMac = this.win?.navigator?.userAgent?.includes('Mac') ?? false;
425
- effect((onCleanup) => {
426
- const shortcut = this.shortcut();
427
- if (!shortcut) {
774
+ });
775
+ }
776
+ // Open-flag reset on a presentation change, the one write in an effect here
777
+ // (sidenav-accepted-debt §1): opened is a consumer model(), which cannot be
778
+ // a linkedSignal keyed on the presentation. Every change starts the new
779
+ // presentation closed, so a drawer opened at one width never reopens stale
780
+ // at another and a pinned over -> side flip leaves no open overlay behind.
781
+ // A change to an overlay presentation keeps the rail open while focus is
782
+ // inside it, so the focused element is not orphaned behind inert. A change
783
+ // to a docked presentation always closes: the rail stays visible there,
784
+ // and an open trap always holds focus inside, so the exception would leave
785
+ // opened (and a synced ?nav=open) true on a docked rail.
786
+ // A docked rail never keeps opened, edge or not: neither the first settled
787
+ // presentation nor a pinned side produces one, and an initial [opened],
788
+ // a ?nav=open hydration or a later write would otherwise stay.
789
+ effect(() => {
790
+ const current = this.presentationTransition.current();
791
+ const previous = this.presentationTransition.previous();
792
+ const dockedOpen = !this.isOverlay() && this.opened();
793
+ if (!dockedOpen && (previous === null || current === previous)) {
428
794
  return;
429
795
  }
430
- const combo = parseKeyCombo(shortcut);
431
- const handler = (e) => {
432
- if (matchesKeyCombo(e, combo, isMac)) {
433
- e.preventDefault();
434
- // Through toggle(), not a raw opened flip: close() no-ops in the
435
- // always-visible modes, so the hotkey cannot desync the model (and
436
- // a router sync would not write ?nav=closed on a rail that stays
437
- // visually open).
438
- this.toggle();
439
- }
440
- };
441
- this.doc.addEventListener('keydown', handler);
442
- onCleanup(() => this.doc.removeEventListener('keydown', handler));
796
+ untracked(() => {
797
+ const host = this.elementRef.nativeElement;
798
+ this.opened.set(this.isOverlay() && host.contains(this.doc.activeElement));
799
+ });
443
800
  });
444
- // Residual transition side-effect, not a derivation: opened is a consumer
445
- // model() the user can still toggle, so leaving an always-visible mode for an
446
- // overlay mode auto-opens the rail once. Guarded by the current/previous
447
- // compare so it fires only on the transition edge.
801
+ // A closing drawer moves focus out before it turns aria-hidden (blocked
802
+ // and warned about on a focused element). Declared after the reset above,
803
+ // so a class change that keeps the drawer open is seen first.
448
804
  effect(() => {
449
- const current = this.modeTransition.current();
450
- const previous = this.modeTransition.previous();
451
- if (current === previous) {
805
+ if (!this.sidebarConcealed()) {
452
806
  return;
453
807
  }
454
- const alwaysVisible = (m) => m === 'side' || m === 'mini';
455
- if (alwaysVisible(previous) && !alwaysVisible(current)) {
456
- // Flag only overlay auto-opens so the focus effect skips the focus-move.
457
- // `over` is the only overlay mode; a `push` auto-open never raises
458
- // overlayActive, so it must not leave the flag stuck for a later open.
459
- this.autoOpenInFlight = current === 'over';
460
- this.opened.set(true);
461
- }
808
+ untracked(() => {
809
+ const host = this.elementRef.nativeElement;
810
+ const active = this.doc.activeElement;
811
+ if (active instanceof HTMLElement && host.contains(active)) {
812
+ active.blur();
813
+ }
814
+ });
462
815
  });
463
816
  }
464
- /** Opens the sidenav. */
817
+ /**
818
+ * Shows the full nav: opens the overlay, expands a docked
819
+ * rail (`collapsed = false`).
820
+ */
465
821
  open() {
466
- this.opened.set(true);
822
+ if (this.dockedRail()) {
823
+ this.sidebar.pin();
824
+ return;
825
+ }
826
+ this.openOverlay();
467
827
  }
468
- /** Closes the sidenav (only in over/push mode). No-op in side/mini mode. */
828
+ /**
829
+ * Hides the full nav: closes the overlay, collapses a docked
830
+ * rail (`collapsed = true`). On a collapsed docked rail it ends a peek.
831
+ */
469
832
  close() {
470
- const mode = this.effectiveMode();
471
- if (mode !== 'side' && mode !== 'mini') {
833
+ if (!this.dockedRail()) {
472
834
  this.opened.set(false);
835
+ return;
473
836
  }
837
+ if (!this.sidebar.collapsed()) {
838
+ this.sidebar.collapsed.set(true);
839
+ return;
840
+ }
841
+ this.sidebar.unpeek();
474
842
  }
475
- /** Toggles the sidenav. */
843
+ /**
844
+ * Toggles the full nav per width class: flips `collapsed` on a docked rail
845
+ * (the content reflows), opens or closes the overlay over the `medium` rail
846
+ * or the `compact` drawer.
847
+ */
476
848
  toggle() {
477
- if (this.opened()) {
478
- this.close();
849
+ if (this.dockedRail()) {
850
+ this.sidebar.toggle();
851
+ return;
479
852
  }
480
- else {
481
- this.open();
853
+ if (this.opened()) {
854
+ this.opened.set(false);
855
+ return;
482
856
  }
857
+ this.openOverlay();
483
858
  }
484
- /** @internal Close only if in overlay mode (for Escape key, click-outside). */
485
- closeIfOverlay() {
486
- if (this.isOverlay()) {
487
- this.close();
859
+ // One open overlay per layout: the layout closes the other rail's overlay
860
+ // in the same gesture, before this one engages its surface.
861
+ openOverlay() {
862
+ if (!this.opened() && this.isOverlay()) {
863
+ this.layoutCoordinator()?.overlayOpening(this);
488
864
  }
865
+ this.opened.set(true);
489
866
  }
490
- /**
491
- * Expand the mini rail to full width.
492
- *
493
- * When `expandOnHover=true` (the default) the debounced hover is the source of
494
- * truth for `expanded`, so a programmatic `expand()` is transient: the next
495
- * pointer edge overrides it. For authoritative programmatic control set
496
- * `expandOnHover=false`, which hands `expand()`/`collapse()` full authority.
497
- */
498
- expand() {
499
- this.expandedState.set(true);
867
+ // withSidenavPersistence(): the stored value seeds an unbound collapsed now
868
+ // (a bound [(collapsed)] overwrites it on the first check and stays the
869
+ // consumer's); the storage write is the only effect, and skips its first
870
+ // run so an untouched default is never written.
871
+ persistCollapsed() {
872
+ const storageKey = this.cfg.persistence?.storageKey;
873
+ const storage = storageKey ? inject(CNGX_SIDENAV_STORAGE) : null;
874
+ if (!storageKey || !storage) {
875
+ return;
876
+ }
877
+ const position = inject(new HostAttributeToken('position'), { optional: true }) ?? 'start';
878
+ const key = `${storageKey}:${position}`;
879
+ const stored = readStoredFlag(storage, key);
880
+ if (stored !== null) {
881
+ this.sidebar.collapsed.set(stored);
882
+ }
883
+ let first = true;
884
+ effect(() => {
885
+ const collapsed = this.sidebar.collapsed();
886
+ if (first) {
887
+ first = false;
888
+ return;
889
+ }
890
+ untracked(() => writeStoredFlag(storage, key, collapsed));
891
+ });
500
892
  }
501
- /**
502
- * Collapse the expanded mini rail back to miniWidth.
503
- *
504
- * Same reconciliation as `expand()`: transient while `expandOnHover=true`,
505
- * authoritative while `expandOnHover=false`.
506
- */
507
- collapse() {
508
- this.expandedState.set(false);
893
+ /** Whether `collapsed` (not `opened`) is the state `toggle()` and `close()` change. */
894
+ dockedRail() {
895
+ return this.effectiveMode() === 'side' && !this.railBase();
509
896
  }
510
- // px-strict: a rem/ch width must not leak a lying aria-valuenow (parseInt
511
- // on '17.5rem' is 17, below the min). Null omits the attribute instead.
512
- /** @internal Numeric px of the current width, or null for non-px units. */
513
- widthPx = computed(() => parsePx(this.width()), ...(ngDevMode ? [{ debugName: "widthPx" }] : /* istanbul ignore next */ []));
514
- minWidthPx = computed(() => parsePx(this.minWidth()), ...(ngDevMode ? [{ debugName: "minWidthPx" }] : /* istanbul ignore next */ []));
515
- maxWidthPx = computed(() => parsePx(this.maxWidth()), ...(ngDevMode ? [{ debugName: "maxWidthPx" }] : /* istanbul ignore next */ []));
897
+ /** @internal Numeric px of the current width clamped to min / max, or null for non-px units. */
898
+ widthPx = computed(() => {
899
+ const px = parsePx(this.width());
900
+ return px === null ? null : clamp(px, this.minPx(), this.maxPx());
901
+ }, ...(ngDevMode ? [{ debugName: "widthPx" }] : /* istanbul ignore next */ []));
902
+ /** @internal The rendered width: the clamped px width, else the bound value as is. */
903
+ effectiveWidth = computed(() => {
904
+ const px = this.widthPx();
905
+ return px === null ? this.width() : `${px}px`;
906
+ }, ...(ngDevMode ? [{ debugName: "effectiveWidth" }] : /* istanbul ignore next */ []));
907
+ /** @internal Resize bounds in px; a non-px bound falls back to 120 / 600. */
908
+ minPx = computed(() => parsePx(this.minWidth()) ?? 120, ...(ngDevMode ? [{ debugName: "minPx" }] : /* istanbul ignore next */ []));
909
+ maxPx = computed(() => parsePx(this.maxWidth()) ?? 600, ...(ngDevMode ? [{ debugName: "maxPx" }] : /* istanbul ignore next */ []));
516
910
  /**
517
911
  * Rect-measured width for non-px rails: seeded after first render (a
518
912
  * focusable separator must expose `aria-valuenow` before it is ever
@@ -520,346 +914,177 @@ class CngxSidenav {
520
914
  * AT reads at interaction time is current.
521
915
  */
522
916
  measuredWidthPx = signal(null, ...(ngDevMode ? [{ debugName: "measuredWidthPx" }] : /* istanbul ignore next */ []));
917
+ /** @internal The handle's `size`: the px width, else the measured one. */
918
+ sizePx = computed(() => this.widthPx() ?? this.measuredWidthPx() ?? this.minPx(), ...(ngDevMode ? [{ debugName: "sizePx" }] : /* istanbul ignore next */ []));
523
919
  /**
524
- * @internal `aria-valuenow` of the separator: the px width when parseable,
525
- * else the rect measurement - the window-splitter pattern wants a valuenow
526
- * on a focusable separator even for rem-sized rails.
920
+ * @internal `aria-valuetext` of the handle: its position as a percent of the
921
+ * min-max range, formatted in the locale, so AT speaks where the handle sits
922
+ * instead of a bare pixel count.
527
923
  */
528
- widthValueNow = computed(() => this.widthPx() ?? this.measuredWidthPx(), ...(ngDevMode ? [{ debugName: "widthValueNow" }] : /* istanbul ignore next */ []));
529
- /**
530
- * @internal `aria-valuetext` of the separator: its position as a percent of
531
- * the min-max range, formatted in the locale, so AT speaks where the handle
532
- * sits instead of a bare pixel count. `null` (AT reads `aria-valuenow`) while
533
- * the width or a bound is not in px.
534
- */
535
- widthValueText = computed(() => {
536
- const width = this.widthValueNow();
537
- const min = this.minWidthPx();
538
- const max = this.maxWidthPx();
539
- if (width === null || min === null || max === null || max <= min) {
540
- return null;
541
- }
542
- const percent = Math.round(clamp((width - min) / (max - min), 0, 1) * 100);
543
- const formatted = numberFormatterFor(this.locale(), PERCENT_FORMAT).format(percent / 100);
544
- return this.labels().resizeValueText(percent, formatted);
545
- }, ...(ngDevMode ? [{ debugName: "widthValueText" }] : /* istanbul ignore next */ []));
924
+ formatValueText = computed(() => {
925
+ const min = this.minPx();
926
+ const max = this.maxPx();
927
+ const labels = this.labels();
928
+ const formatter = numberFormatterFor(this.locale(), PERCENT_FORMAT);
929
+ return (size) => {
930
+ const percent = max > min ? Math.round(clamp((size - min) / (max - min), 0, 1) * 100) : 0;
931
+ return labels.resizeValueText(percent, formatter.format(percent / 100));
932
+ };
933
+ }, ...(ngDevMode ? [{ debugName: "formatValueText" }] : /* istanbul ignore next */ []));
934
+ /** @internal Refresh the measurement the moment AT is about to read it. */
546
935
  measureWidth() {
547
936
  const el = this.elementRef.nativeElement;
548
937
  this.measuredWidthPx.set(Math.round(el.getBoundingClientRect().width) || null);
549
938
  }
550
- /** @internal Refresh the measurement the moment AT is about to read it. */
551
- handleResizeFocus() {
552
- this.measureWidth();
553
- }
554
- /**
555
- * @internal Arrow-key resize on the separator, so the handle is operable
556
- * without a pointer (WCAG 2.1.1): arrows step by 16px (direction-aware for
557
- * `position="end"`), Home/End jump to the min/max constraint. Any modified
558
- * key (shift included) passes through untouched - browser and AT shortcuts
559
- * stay theirs.
560
- */
561
- handleResizeKeydown(event) {
562
- if (!this.resizable() || event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) {
563
- return;
564
- }
565
- const el = this.elementRef.nativeElement;
566
- const current = el.getBoundingClientRect().width;
567
- const min = this.minWidthPx() ?? 120;
568
- const max = this.maxWidthPx() ?? 600;
569
- const isEnd = this.position() === 'end';
570
- let target;
571
- switch (event.key) {
572
- case 'ArrowRight':
573
- target = current + (isEnd ? -RESIZE_KEY_STEP : RESIZE_KEY_STEP);
574
- break;
575
- case 'ArrowLeft':
576
- target = current + (isEnd ? RESIZE_KEY_STEP : -RESIZE_KEY_STEP);
577
- break;
578
- case 'Home':
579
- target = min;
580
- break;
581
- case 'End':
582
- target = max;
583
- break;
584
- default:
585
- return;
586
- }
587
- event.preventDefault();
588
- this.width.set(`${Math.round(Math.max(min, Math.min(max, target)))}px`);
589
- }
590
- /** @internal */
591
- handleResizeStart(e) {
592
- if (!this.resizable() || this.effectiveMode() === 'mini') {
593
- return;
594
- }
595
- e.preventDefault();
596
- e.target.setPointerCapture(e.pointerId);
597
- this.resizingState.set(true);
598
- const startX = e.clientX;
599
- const el = this.elementRef.nativeElement;
600
- const startWidth = el.getBoundingClientRect().width;
601
- const isEnd = this.position() === 'end';
602
- const min = this.minWidthPx() ?? 120;
603
- const max = this.maxWidthPx() ?? 600;
604
- let currentWidth = startWidth;
605
- let rafId = 0;
606
- // One controller per drag removes both document listeners in a single abort:
607
- // on pointerup below, and - critically - if the component is torn down
608
- // mid-drag (the onDestroy hook aborts this.resizeAbort).
609
- const controller = new AbortController();
610
- this.resizeAbort = controller;
611
- const onMove = (ev) => {
612
- const delta = isEnd ? startX - ev.clientX : ev.clientX - startX;
613
- currentWidth = Math.round(Math.max(min, Math.min(max, startWidth + delta)));
614
- // CSS var on the DOM node directly, no CD per frame during drag.
615
- if (!rafId) {
616
- rafId = requestAnimationFrame(() => {
617
- el.style.setProperty('--cngx-sidenav-width', `${currentWidth}px`);
618
- rafId = 0;
619
- });
620
- }
621
- };
622
- const onUp = () => {
623
- cancelAnimationFrame(rafId);
624
- this.resizingState.set(false);
625
- // Single CD on pointerup - model catches up with the DOM.
626
- this.width.set(`${currentWidth}px`);
627
- controller.abort();
628
- this.resizeAbort = null;
629
- };
630
- this.doc.addEventListener('pointermove', onMove, { signal: controller.signal });
631
- this.doc.addEventListener('pointerup', onUp, { signal: controller.signal });
939
+ /** @internal The handle resized: the model takes the px width. */
940
+ handleSizeChange(size) {
941
+ this.width.set(`${size}px`);
632
942
  }
633
943
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenav, deps: [], target: i0.ɵɵFactoryTarget.Component });
634
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSidenav, isStandalone: true, selector: "cngx-sidenav", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, miniWidth: { classPropertyName: "miniWidth", publicName: "miniWidth", isSignal: true, isRequired: false, transformFunction: null }, expandOnHover: { classPropertyName: "expandOnHover", publicName: "expandOnHover", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, resizeLabel: { classPropertyName: "resizeLabel", publicName: "resizeLabel", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, shortcut: { classPropertyName: "shortcut", publicName: "shortcut", isSignal: true, isRequired: false, transformFunction: null }, opened: { classPropertyName: "opened", publicName: "opened", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { width: "widthChange", opened: "openedChange" }, host: { attributes: { "role": "complementary" }, listeners: { "keydown.escape": "closeIfOverlay()" }, properties: { "class.cngx-sidenav": "true", "class.cngx-sidenav--start": "position() === 'start'", "class.cngx-sidenav--end": "position() === 'end'", "class.cngx-sidenav--open": "opened()", "class.cngx-sidenav--over": "effectiveMode() === 'over'", "class.cngx-sidenav--push": "effectiveMode() === 'push'", "class.cngx-sidenav--side": "effectiveMode() === 'side'", "class.cngx-sidenav--mini": "effectiveMode() === 'mini'", "class.cngx-sidenav--expanded": "expanded()", "class.cngx-sidenav--resizable": "resizable()", "class.cngx-sidenav--resizing": "resizing()", "attr.aria-hidden": "effectiveMode() === 'side' || effectiveMode() === 'mini' ? null : !opened()", "attr.aria-modal": "overlayActive() ? 'true' : null", "style.--cngx-sidenav-width": "effectiveWidth()", "style.--cngx-sidenav-mini-width": "miniWidth()", "attr.aria-label": "ariaLabel() || null" } }, providers: [
944
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSidenav, isStandalone: true, selector: "cngx-sidenav", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, miniWidth: { classPropertyName: "miniWidth", publicName: "miniWidth", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, resizeLabel: { classPropertyName: "resizeLabel", publicName: "resizeLabel", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, shortcut: { classPropertyName: "shortcut", publicName: "shortcut", isSignal: true, isRequired: false, transformFunction: null }, opened: { classPropertyName: "opened", publicName: "opened", isSignal: true, isRequired: false, transformFunction: null }, modality: { classPropertyName: "modality", publicName: "modality", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { width: "widthChange", opened: "openedChange" }, host: { properties: { "class.cngx-sidenav": "true", "class.cngx-sidenav--start": "position() === 'start'", "class.cngx-sidenav--end": "position() === 'end'", "class.cngx-sidenav--open": "opened()", "class.cngx-sidenav--over": "effectiveMode() === 'over'", "class.cngx-sidenav--side": "effectiveMode() === 'side'", "class.cngx-sidenav--resizable": "resizable()", "class.cngx-sidenav--resizing": "resizing()", "style.--cngx-sidenav-width": "effectiveWidth()", "style.--cngx-sidenav-mini-width": "miniWidth() ?? null", "style.--cngx-sidebar-size": "effectiveWidth()", "style.--cngx-sidebar-rail-size": "miniWidth() ?? null", "attr.data-nav-railed": "railed() ? 'true' : 'false'" } }, providers: [
635
945
  { provide: CNGX_HOVER_INTENT_DEFAULTS, useFactory: () => injectSidenavConfig().hover ?? {} },
636
946
  { provide: CNGX_SIDENAV, useExisting: CngxSidenav },
637
- ], exportAs: ["cngxSidenav"], hostDirectives: [{ directive: i1.CngxHoverIntent, inputs: ["enterDelay", "expandDelay", "leaveDelay", "collapseDelay"] }], ngImport: i0, template: `
638
- <ng-content select="cngx-sidenav-header, [cngxSidenavHeader]" />
947
+ { provide: CNGX_SIDEBAR_DRIVER, useExisting: CngxSidenav },
948
+ { provide: CNGX_DRAWER_SURFACE_DRIVER, useExisting: CngxSidenav },
949
+ // Over the composed sidebar's: an in-rail trigger (a pin or close button)
950
+ // follows the sidenav's per-width-class toggle, not the bare sidebar's.
951
+ { provide: CNGX_PANEL_TARGET, useFactory: () => inject(CngxSidenav).panelTarget },
952
+ ], queries: [{ propertyName: "navGroups", predicate: CngxNavGroup, descendants: true, isSignal: true }, { propertyName: "navGroupElements", predicate: CngxNavGroup, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "navGroupContents", predicate: CngxNavGroupContent, descendants: true, isSignal: true }, { propertyName: "navGroupContentElements", predicate: CngxNavGroupContent, descendants: true, read: ElementRef, isSignal: true }], viewQueries: [{ propertyName: "resizeHandle", first: true, predicate: CngxResizable, descendants: true, isSignal: true }], exportAs: ["cngxSidenav"], hostDirectives: [{ directive: i1.CngxSidebar, inputs: ["collapsed", "collapsed", "collapsedAs", "collapsedAs", "expandOnHover", "expandOnHover", "expandDelay", "expandDelay", "collapseDelay", "collapseDelay", "side", "position", "role", "role"], outputs: ["collapsedChange", "collapsedChange"] }, { directive: i1.CngxDrawerSurface }], ngImport: i0, template: `
953
+ <ng-content select="cngx-nav-header, [cngxNavHeader]" />
639
954
  <div class="cngx-sidenav__body">
640
955
  <ng-content />
641
956
  </div>
642
- <ng-content select="cngx-sidenav-footer, [cngxSidenavFooter]" />
643
- <!-- No handle in mini mode: the collapsed rail has a fixed width, and a
644
- drag there would leave a stale inline width var on the rail. -->
645
- @if (resizable() && effectiveMode() !== 'mini') {
957
+ <ng-content select="cngx-nav-footer, [cngxNavFooter]" />
958
+ <!-- Only at full width: a collapsed rail or peek has a fixed width, and a
959
+ drag there would leave a stale width on the rail. -->
960
+ @if (resizable() && sidebar.state() === 'expanded') {
646
961
  <div
647
962
  class="cngx-sidenav__resize-handle"
648
- (pointerdown)="handleResizeStart($event)"
649
- (keydown)="handleResizeKeydown($event)"
650
- (focus)="handleResizeFocus()"
651
- role="separator"
652
- tabindex="0"
653
- [attr.aria-label]="resolvedResizeLabel()"
654
- [attr.aria-orientation]="'vertical'"
655
- [attr.aria-valuenow]="widthValueNow()"
656
- [attr.aria-valuetext]="widthValueText()"
657
- [attr.aria-valuemin]="minWidthPx()"
658
- [attr.aria-valuemax]="maxWidthPx()"
963
+ cngxResizable
964
+ [size]="sizePx()"
965
+ (sizeChange)="handleSizeChange($event)"
966
+ [min]="minPx()"
967
+ [max]="maxPx()"
968
+ [edge]="position() === 'end' ? 'inline-start' : 'inline-end'"
969
+ [label]="resolvedResizeLabel()"
970
+ [valueText]="formatValueText()"
971
+ [attr.aria-controls]="id()"
972
+ (focus)="measureWidth()"
659
973
  ></div>
660
974
  }
661
- `, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-sidenav-width{syntax: \"<length>\"; inherits: true; initial-value: 280px;}@property --cngx-sidenav-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .005 250);}@property --cngx-sidenav-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-sidenav-transition-duration{syntax: \"<time>\"; inherits: false; initial-value: .25s;}:where(cngx-sidenav,cngx-sidenav *){--cngx-sidenav-transition-duration: var(--cngx-duration-base)}@property --cngx-sidenav-transition-easing{syntax: \"*\"; inherits: false; initial-value: ease;}@property --cngx-sidenav-mini-width{syntax: \"<length>\"; inherits: true; initial-value: 56px;}@property --cngx-sidenav-expanded-shadow{syntax: \"*\"; inherits: true; initial-value: 4px 0 12px oklch(0 0 0 / .1);}@property --cngx-sidenav-border-width{syntax: \"<length>\"; inherits: false; initial-value: 1px;}@property --cngx-sidenav-border-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.89 0 0);}@property --cngx-sidenav-padding{syntax: \"<length>\"; inherits: true; initial-value: 16px;}@property --cngx-sidenav-header-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-sidenav-header-font-size{syntax: \"*\"; inherits: false; initial-value: .875rem;}@property --cngx-sidenav-footer-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-sidenav-footer-border-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.89 0 0);}@property --cngx-sidenav-footer-font-size{syntax: \"*\"; inherits: false; initial-value: .75rem;}@property --cngx-sidenav-resize-handle-width{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-sidenav-resize-handle-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-sidenav-resize-handle-focus-outline-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-sidenav-resize-handle-focus-outline-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-sidenav-resize-handle-focus-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-sidenav-backdrop-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(0 0 0);}@property --cngx-sidenav-backdrop-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-nav-link-padding{syntax: \"*\"; inherits: true; initial-value: 10px 16px;}@property --cngx-nav-link-font-size{syntax: \"*\"; inherits: false; initial-value: .875rem;}@property --cngx-nav-link-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-nav-link-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-nav-link-hover-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-nav-link-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .04);}@property --cngx-nav-link-active-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-nav-link-active-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .08);}@property --cngx-nav-link-active-font-weight{syntax: \"<number>\"; inherits: false; initial-value: 600;}@property --cngx-nav-link-focus-outline-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-nav-link-focus-outline-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-nav-link-focus-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: -2px;}@property --cngx-nav-link-initial-size{syntax: \"*\"; inherits: false; initial-value: .875rem;}:root{--cngx-sidenav-bg: var(--cngx-color-surface, oklch(.97 .005 250));--cngx-sidenav-border-color: var(--cngx-color-border, oklch(.89 0 0));--cngx-sidenav-footer-border-color: var(--cngx-color-border, oklch(.89 0 0));--cngx-sidenav-expanded-shadow: 4px 0 12px oklch(0 0 0 / .1);--cngx-nav-link-hover-bg: oklch(0 0 0 / .04);--cngx-nav-link-active-bg: oklch(0 0 0 / .08);--cngx-nav-link-focus-outline-color: var(--cngx-color-primary, oklch(.66 .19 50))}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-sidenav-expanded-shadow: 4px 0 12px oklch(0 0 0 / .45);--cngx-nav-link-hover-bg: oklch(1 0 0 / .06);--cngx-nav-link-active-bg: oklch(1 0 0 / .1)}}:root[data-color-scheme=dark],:root.dark{--cngx-sidenav-expanded-shadow: 4px 0 12px oklch(0 0 0 / .45);--cngx-nav-link-hover-bg: oklch(1 0 0 / .06);--cngx-nav-link-active-bg: oklch(1 0 0 / .1)}:root[data-color-scheme=light],:root.light{--cngx-sidenav-expanded-shadow: 4px 0 12px oklch(0 0 0 / .1);--cngx-nav-link-hover-bg: oklch(0 0 0 / .04);--cngx-nav-link-active-bg: oklch(0 0 0 / .08)}}@layer cngx.components{cngx-sidenav{--cngx-sidenav-padding: var(--cngx-space-md);--cngx-nav-link-padding: var(--cngx-space-sm) var(--cngx-space-md);display:flex;flex-direction:column;flex-shrink:0;overflow:hidden;z-index:2;width:var(--cngx-sidenav-width, 280px);background:var(--cngx-sidenav-bg, oklch(.97 .005 250));color:var(--cngx-sidenav-color, inherit);transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s var(--cngx-sidenav-transition-duration, .25s)}cngx-sidenav:not(.cngx-sidenav--open):not(.cngx-sidenav--side):not(.cngx-sidenav--mini):not(.cngx-sidenav--over){width:0;visibility:hidden}cngx-sidenav.cngx-sidenav--open{visibility:visible;transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s 0s}cngx-sidenav.cngx-sidenav--side.cngx-sidenav--open{visibility:visible}cngx-sidenav.cngx-sidenav--over{position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-width, 280px);visibility:hidden;transition:transform var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s var(--cngx-sidenav-transition-duration, .25s)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--start{inset-inline-start:0;transform:translate(-100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end{inset-inline-end:0;transform:translate(100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--start:not(.cngx-sidenav--open):dir(rtl){transform:translate(100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end:not(.cngx-sidenav--open):dir(rtl){transform:translate(-100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--open{transform:translate(0);visibility:visible;transition:transform var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s 0s}cngx-sidenav.cngx-sidenav--push,cngx-sidenav.cngx-sidenav--side,cngx-sidenav.cngx-sidenav--mini{position:relative}cngx-sidenav.cngx-sidenav--mini{width:var(--cngx-sidenav-mini-width, 56px);visibility:visible;transition:none}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--expanded{width:var(--cngx-sidenav-width, 280px);z-index:3;box-shadow:var(--cngx-sidenav-expanded-shadow, 4px 0 12px oklch(0 0 0 / .1));transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),margin var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease)}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--expanded.cngx-sidenav--start{margin-inline-end:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--expanded.cngx-sidenav--end{margin-inline-start:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--start{border-inline-end:var(--cngx-sidenav-border-width, 1px) solid var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)))}cngx-sidenav.cngx-sidenav--end{border-inline-start:var(--cngx-sidenav-border-width, 1px) solid var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)));order:2}.cngx-sidenav__body{flex:1;overflow-y:auto;overflow-x:hidden;min-width:var(--cngx-sidenav-width, 280px);scrollbar-gutter:stable}.cngx-sidenav--mini:not(.cngx-sidenav--expanded) .cngx-sidenav__body{min-width:var(--cngx-sidenav-mini-width, 56px)}cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) .cngx-sidenav-header,cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) .cngx-sidenav-footer{overflow:hidden;white-space:nowrap;text-overflow:clip;text-align:center;padding:8px 4px}cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) [cngxNavLabel],cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) [cngxNavGroup]{display:none!important}.cngx-sidenav-header{flex-shrink:0;padding:var(--cngx-sidenav-padding, 16px);background:var(--cngx-sidenav-header-bg, transparent);border-bottom:1px solid var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)));font-weight:600;font-size:var(--cngx-sidenav-header-font-size, .875rem)}.cngx-sidenav-footer{flex-shrink:0;margin-top:auto;padding:var(--cngx-sidenav-padding, 16px);background:var(--cngx-sidenav-footer-bg, transparent);border-top:1px solid var( --cngx-sidenav-footer-border-color, var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0))) );font-size:var(--cngx-sidenav-footer-font-size, .75rem);color:var(--cngx-color-text-muted, oklch(.5 .01 250))}cngx-sidenav .cngx-nav-link{display:block;padding:var(--cngx-nav-link-padding, 10px 16px);text-decoration:none;font-size:var(--cngx-nav-link-font-size, .875rem);color:var(--cngx-nav-link-color, currentColor);border-radius:var(--cngx-nav-link-radius, 4px);transition:background var(--cngx-duration-fast, .15s),color var(--cngx-duration-fast, .15s)}cngx-sidenav .cngx-nav-link:hover{color:var(--cngx-nav-link-hover-color, currentColor);background:var(--cngx-nav-link-hover-bg, oklch(0 0 0 / .04))}cngx-sidenav .cngx-nav-link--active{color:var(--cngx-nav-link-active-color, currentColor);background:var(--cngx-nav-link-active-bg, oklch(0 0 0 / .08));font-weight:var(--cngx-nav-link-active-font-weight, 600)}cngx-sidenav .cngx-nav-link:focus-visible{outline:var(--cngx-nav-link-focus-outline-width, 2px) solid var(--cngx-nav-link-focus-outline-color, oklch(.66 .19 50));outline-offset:var(--cngx-nav-link-focus-outline-offset, -2px)}cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) .cngx-nav-link{overflow:hidden;text-align:center;font-size:0!important;line-height:1;padding:var(--cngx-nav-link-padding, 10px 8px)}cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) .cngx-nav-link[data-initial]:before{content:attr(data-initial) / \"\";font-size:var(--cngx-nav-link-initial-size, .875rem);font-weight:600;display:inline-block;width:var(--cngx-nav-link-initial-size, .875rem);text-align:center;line-height:1.6}cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) [cngxNavBadge]{display:none}.cngx-nav-group-content{display:grid;grid-template-rows:0fr;transition:grid-template-rows var(--cngx-sidenav-transition-duration, .2s) ease}.cngx-nav-group-content>*{overflow:hidden;min-height:0}.cngx-nav-group-content--open{grid-template-rows:1fr}.cngx-sidenav__resize-handle{--cngx-sidenav-resize-handle-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-sidenav-resize-handle-focus-outline-color: var( --cngx-color-primary, oklch(.66 .19 50) );position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-resize-handle-width, 4px);cursor:col-resize;z-index:4;background:transparent;transition:background var(--cngx-duration-fast, .15s);touch-action:none}.cngx-sidenav__resize-handle:before{content:\"\";position:absolute;top:0;bottom:0;left:50%;transform:translate(-50%);width:max(var(--cngx-sidenav-resize-handle-width, 4px),var(--cngx-target-min, 0px))}.cngx-sidenav--start .cngx-sidenav__resize-handle{inset-inline-end:0;transform:translate(50%)}.cngx-sidenav--end .cngx-sidenav__resize-handle{inset-inline-start:0;transform:translate(-50%)}.cngx-sidenav--start:dir(rtl) .cngx-sidenav__resize-handle{transform:translate(-50%)}.cngx-sidenav--end:dir(rtl) .cngx-sidenav__resize-handle{transform:translate(50%)}.cngx-sidenav__resize-handle:hover,.cngx-sidenav--resizing .cngx-sidenav__resize-handle{background:var( --cngx-sidenav-resize-handle-color, var(--cngx-color-primary, oklch(.66 .19 50)) )}.cngx-sidenav__resize-handle:focus-visible{background:var( --cngx-sidenav-resize-handle-color, var(--cngx-color-primary, oklch(.66 .19 50)) );outline:var(--cngx-sidenav-resize-handle-focus-outline-width, 2px) solid var( --cngx-sidenav-resize-handle-focus-outline-color, var(--cngx-color-primary, oklch(.66 .19 50)) );outline-offset:var(--cngx-sidenav-resize-handle-focus-outline-offset, 2px)}cngx-sidenav.cngx-sidenav--resizing{transition:none!important;-webkit-user-select:none;user-select:none}}@media(forced-colors:active){cngx-sidenav .cngx-nav-link--active{forced-color-adjust:none;background:Highlight;color:HighlightText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
975
+ `, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-sidenav-width{syntax: \"<length>\"; inherits: true; initial-value: 280px;}@property --cngx-sidenav-bg{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-color{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-transition-duration{syntax: \"<time>\"; inherits: false; initial-value: .25s;}:where(cngx-sidenav,cngx-sidenav *){--cngx-sidenav-transition-duration: var(--cngx-duration-base)}@property --cngx-sidenav-transition-easing{syntax: \"*\"; inherits: false; initial-value: ease;}@property --cngx-sidenav-mini-width{syntax: \"<length>\"; inherits: true; initial-value: 56px;}@property --cngx-sidenav-expanded-shadow{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-border-width{syntax: \"<length>\"; inherits: false; initial-value: 1px;}@property --cngx-sidenav-border-color{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-padding{syntax: \"<length>\"; inherits: true; initial-value: 16px;}@property --cngx-sidenav-row-gap{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-resize-handle-width{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-sidenav-resize-handle-target-min{syntax: \"<length>\"; inherits: true; initial-value: 24px;}@property --_cngx-sidenav-handle-reach{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --cngx-sidenav-resize-handle-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-sidenav-resize-handle-focus-outline-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-sidenav-resize-handle-focus-outline-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-sidenav-resize-handle-focus-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-sidenav-backdrop-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(0 0 0);}@property --cngx-sidenav-overlay-shadow{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-backdrop-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}:root{--_cngx-sidenav-shadow-tint: oklch(0 0 0 / .1)}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--_cngx-sidenav-shadow-tint: oklch(0 0 0 / .45)}}[data-color-scheme=dark],.dark{--_cngx-sidenav-shadow-tint: oklch(0 0 0 / .45)}[data-color-scheme=light],.light{--_cngx-sidenav-shadow-tint: oklch(0 0 0 / .1)}}@layer cngx.components{cngx-sidenav{--_cngx-sidenav-reveal-delay: var(--cngx-duration-fast, .15s);--cngx-sidenav-padding: var(--cngx-space-md);--cngx-nav-header-padding-block: var(--cngx-sidenav-padding, 16px);--cngx-nav-footer-padding-block: var(--cngx-sidenav-padding, 16px);--cngx-nav-header-border-color: var( --cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)) );--cngx-nav-footer-border-color: var( --cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)) );--cngx-nav-link-padding: var(--cngx-space-sm) var(--cngx-nav-link-padding-inline, var(--cngx-space-md));--cngx-nav-link-inset: var(--cngx-space-xs);--cngx-sidenav-mini-width: calc( var(--cngx-nav-railed-size, 60px) + var(--cngx-sidenav-border-width, 1px) );--cngx-sidebar-rail-size: var(--cngx-sidenav-mini-width);--cngx-nav-flyout-offset: calc( var(--cngx-nav-link-inset, var(--cngx-space-xs, 4px)) + var(--cngx-sidenav-border-width, 1px) + var(--cngx-space-xs, 4px) );--cngx-nav-transition: var(--cngx-sidenav-transition-duration, .25s);--cngx-nav-link-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 6%, transparent );--cngx-nav-link-pressed-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 12%, transparent );--cngx-nav-link-active-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 16%, transparent );--cngx-nav-link-active-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 22%, transparent );--cngx-nav-link-focus-outline-color: var( --cngx-sidenav-color, var(--cngx-color-text, oklch(.2 .01 250)) );--cngx-nav-link-focus-inner-color: var( --cngx-sidenav-bg, var(--cngx-color-surface, oklch(.97 .005 250)) );--cngx-nav-link-active-indicator-color: var( --cngx-color-primary-text, oklch(from var(--cngx-color-primary, oklch(.66 .19 50)) .54 c h) );--cngx-nav-link-active-indicator-size: calc(var(--cngx-space-xs) * .75);--cngx-nav-link-active-indicator-inset: var(--cngx-space-sm);--cngx-nav-label-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-nav-badge-bg: var( --cngx-color-primary-strong, oklch(from var(--cngx-color-primary, oklch(.66 .19 50)) .58 c h) );--cngx-nav-badge-color: var(--cngx-color-on-primary-strong, oklch(1 0 0));display:flex;flex-direction:column;box-sizing:border-box;flex-shrink:0;overflow:hidden;z-index:var(--cngx-sidenav-z-index, 2);width:var(--cngx-sidenav-width, 280px);background:var(--cngx-sidenav-bg, var(--cngx-color-surface, oklch(.97 .005 250)));color:var(--cngx-sidenav-color, var(--cngx-color-text, inherit));transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s var(--cngx-sidenav-transition-duration, .25s)}cngx-sidenav[data-sidebar-state=hidden]{visibility:hidden}cngx-sidenav.cngx-sidenav--open{visibility:visible;transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s 0s}cngx-sidenav.cngx-sidenav--side.cngx-sidenav--open{visibility:visible}cngx-sidenav.cngx-sidenav--over{position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-width, 280px);visibility:hidden;transition:transform var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s var(--cngx-sidenav-transition-duration, .25s)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--start{inset-inline-start:0;transform:translate(-100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end{inset-inline-end:0;transform:translate(100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--start:not(.cngx-sidenav--open):dir(rtl){transform:translate(100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end:not(.cngx-sidenav--open):dir(rtl){transform:translate(-100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--open{transform:translate(0);visibility:visible;box-shadow:var( --cngx-sidenav-overlay-shadow, var( --cngx-sidenav-expanded-shadow, var(--_cngx-sidenav-shadow-x, 4px) 0 12px var(--_cngx-sidenav-shadow-tint, oklch(0 0 0 / .1)) ) );transition:transform var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s 0s}cngx-sidenav.cngx-sidenav--end,cngx-sidenav:dir(rtl){--_cngx-sidenav-shadow-x: -4px}cngx-sidenav.cngx-sidenav--end:dir(rtl){--_cngx-sidenav-shadow-x: 4px}cngx-sidenav.cngx-sidenav--side{position:relative}cngx-sidenav[data-sidebar-state=rail]{visibility:visible}cngx-sidenav[data-sidebar-state=rail],cngx-sidenav[data-sidebar-state=peek]{transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),margin var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease)}cngx-sidenav[data-sidebar-state=peek]{box-shadow:var( --cngx-sidenav-expanded-shadow, var(--_cngx-sidenav-shadow-x, 4px) 0 12px var(--_cngx-sidenav-shadow-tint, oklch(0 0 0 / .1)) )}cngx-sidenav.cngx-sidenav--start{border-inline-end:var(--cngx-sidenav-border-width, 1px) solid var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)))}cngx-sidenav.cngx-sidenav--end{border-inline-start:var(--cngx-sidenav-border-width, 1px) solid var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)));order:2}cngx-sidenav[data-sidebar-state=hidden]{border-inline-width:0}.cngx-sidenav__body{display:flex;flex:1;flex-direction:column;gap:var(--cngx-sidenav-row-gap, calc(var(--cngx-space-xs, 4px) / 2));overflow-y:auto;overflow-x:hidden;min-width:var(--cngx-sidenav-width, 280px);padding-block:var(--cngx-space-xs, 4px);scrollbar-gutter:stable}cngx-sidenav[data-sidebar-state=rail] .cngx-sidenav__body{min-width:0;scrollbar-gutter:auto;scrollbar-width:none}cngx-sidenav :is(.cngx-nav-header,.cngx-nav-footer) .cngx-nav-name{transition:opacity var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease) var(--_cngx-sidenav-reveal-delay, .15s)}cngx-sidenav[data-sidebar-state=rail] :is(.cngx-nav-header,.cngx-nav-footer) .cngx-nav-name{transition:opacity 0s}cngx-sidenav[data-sidebar-state=rail] .cngx-sidenav__body>:has(+.cngx-nav-group-content[popover]){margin-block-end:var(--cngx-sidenav-row-gap, calc(var(--cngx-space-xs, 4px) / 2))}cngx-sidenav :is(.cngx-nav-link,.cngx-nav-group,.cngx-nav-label):not(.cngx-nav-group-content *){transition:background-color var(--cngx-duration-fast, .15s),color var(--cngx-duration-fast, .15s),-webkit-text-fill-color var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease) var(--_cngx-sidenav-reveal-delay, .15s)}cngx-sidenav .cngx-nav-badge:not(.cngx-nav-group-content *),cngx-sidenav .cngx-nav-group:not(.cngx-nav-group-content *):after{transition:rotate var(--cngx-duration-fast, .15s),opacity var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease) var(--_cngx-sidenav-reveal-delay, .15s)}cngx-sidenav :is(.cngx-nav-link,.cngx-nav-group):before,cngx-sidenav .cngx-nav-icon{-webkit-text-fill-color:currentColor}cngx-sidenav[data-sidebar-state=rail] :is(.cngx-nav-link,.cngx-nav-group,.cngx-nav-label):not(.cngx-nav-group-content *){-webkit-text-fill-color:transparent;transition:background-color var(--cngx-duration-fast, .15s),color var(--cngx-duration-fast, .15s),-webkit-text-fill-color 0s}cngx-sidenav[data-sidebar-state=rail] .cngx-nav-badge:not(.cngx-nav-group-content *),cngx-sidenav[data-sidebar-state=rail] .cngx-nav-group:not(.cngx-nav-group-content *):after{opacity:0;transition:rotate var(--cngx-duration-fast, .15s),opacity 0s}[data-motion=reduced] cngx-sidenav,cngx-sidenav[data-motion=reduced]{--_cngx-sidenav-reveal-delay: 0s}@media(prefers-reduced-motion:reduce){:root:not([data-motion=full]) cngx-sidenav{--_cngx-sidenav-reveal-delay: 0s}}.cngx-sidenav__resize-handle{--cngx-sidenav-resize-handle-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-sidenav-resize-handle-focus-outline-color: var( --cngx-color-primary, oklch(.66 .19 50) );position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-resize-handle-width, 4px);cursor:col-resize;z-index:4;background:transparent;transition:background var(--cngx-duration-fast, .15s);touch-action:none}cngx-sidenav.cngx-sidenav--resizable{--_cngx-sidenav-handle-reach: calc(max( var(--cngx-sidenav-resize-handle-width, 4px), var(--cngx-sidenav-resize-handle-target-min, 24px), var(--cngx-target-min, 0px) )/2) ;overflow:clip;overflow-clip-margin:var(--_cngx-sidenav-handle-reach)}.cngx-sidenav__resize-handle:before{content:\"\";position:absolute;top:0;bottom:0;left:50%;transform:translate(-50%);width:max(var(--cngx-sidenav-resize-handle-width, 4px),var(--cngx-sidenav-resize-handle-target-min, 24px),var(--cngx-target-min, 0px))}.cngx-sidenav--start .cngx-sidenav__resize-handle{inset-inline-end:0;transform:translate(50%)}.cngx-sidenav--end .cngx-sidenav__resize-handle{inset-inline-start:0;transform:translate(-50%)}.cngx-sidenav--start:dir(rtl) .cngx-sidenav__resize-handle{transform:translate(-50%)}.cngx-sidenav--end:dir(rtl) .cngx-sidenav__resize-handle{transform:translate(50%)}.cngx-sidenav__resize-handle:hover,.cngx-sidenav--resizing .cngx-sidenav__resize-handle{background:var(--cngx-sidenav-resize-handle-color)}.cngx-sidenav__resize-handle:focus-visible{background:var(--cngx-sidenav-resize-handle-color);outline:var(--cngx-sidenav-resize-handle-focus-outline-width, 2px) solid var(--cngx-sidenav-resize-handle-focus-outline-color);outline-offset:var(--cngx-sidenav-resize-handle-focus-outline-offset, 2px)}cngx-sidenav.cngx-sidenav--resizing{transition:none!important;-webkit-user-select:none;user-select:none}}\n"], dependencies: [{ kind: "directive", type: CngxResizable, selector: "[cngxResizable]", inputs: ["size", "min", "max", "edge", "step", "label", "valueText"], outputs: ["sizeChange"], exportAs: ["cngxResizable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
662
976
  }
663
977
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenav, decorators: [{
664
978
  type: Component,
665
979
  args: [{ selector: 'cngx-sidenav', exportAs: 'cngxSidenav', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, hostDirectives: [
666
980
  {
667
- directive: CngxHoverIntent,
668
- inputs: ['enterDelay: expandDelay', 'leaveDelay: collapseDelay'],
981
+ directive: CngxSidebar,
982
+ inputs: [
983
+ 'collapsed',
984
+ 'collapsedAs',
985
+ 'expandOnHover',
986
+ 'expandDelay',
987
+ 'collapseDelay',
988
+ 'side: position',
989
+ 'role',
990
+ ],
991
+ outputs: ['collapsedChange'],
669
992
  },
993
+ // The overlay engine: while the rail is an open overlay the surface traps
994
+ // focus (modality page), restores it on close, makes the page outside
995
+ // inert, locks scrolling and asks for dismissal on Escape, the back
996
+ // gesture and an outside press. Driven through CNGX_DRAWER_SURFACE_DRIVER.
997
+ { directive: CngxDrawerSurface, inputs: [], outputs: [] },
670
998
  ], providers: [
671
999
  { provide: CNGX_HOVER_INTENT_DEFAULTS, useFactory: () => injectSidenavConfig().hover ?? {} },
672
1000
  { provide: CNGX_SIDENAV, useExisting: CngxSidenav },
1001
+ { provide: CNGX_SIDEBAR_DRIVER, useExisting: CngxSidenav },
1002
+ { provide: CNGX_DRAWER_SURFACE_DRIVER, useExisting: CngxSidenav },
1003
+ // Over the composed sidebar's: an in-rail trigger (a pin or close button)
1004
+ // follows the sidenav's per-width-class toggle, not the bare sidebar's.
1005
+ { provide: CNGX_PANEL_TARGET, useFactory: () => inject(CngxSidenav).panelTarget },
673
1006
  ], host: {
674
1007
  '[class.cngx-sidenav]': 'true',
675
1008
  '[class.cngx-sidenav--start]': "position() === 'start'",
676
1009
  '[class.cngx-sidenav--end]': "position() === 'end'",
677
1010
  '[class.cngx-sidenav--open]': 'opened()',
678
1011
  '[class.cngx-sidenav--over]': "effectiveMode() === 'over'",
679
- '[class.cngx-sidenav--push]': "effectiveMode() === 'push'",
680
1012
  '[class.cngx-sidenav--side]': "effectiveMode() === 'side'",
681
- '[class.cngx-sidenav--mini]': "effectiveMode() === 'mini'",
682
- '[class.cngx-sidenav--expanded]': 'expanded()',
683
1013
  '[class.cngx-sidenav--resizable]': 'resizable()',
684
1014
  '[class.cngx-sidenav--resizing]': 'resizing()',
685
- '[attr.aria-hidden]': "effectiveMode() === 'side' || effectiveMode() === 'mini' ? null : !opened()",
686
- '[attr.aria-modal]': "overlayActive() ? 'true' : null",
687
1015
  '[style.--cngx-sidenav-width]': 'effectiveWidth()',
688
- '[style.--cngx-sidenav-mini-width]': 'miniWidth()',
689
- role: 'complementary',
690
- '[attr.aria-label]': 'ariaLabel() || null',
691
- '(keydown.escape)': 'closeIfOverlay()',
692
- }, template: `
693
- <ng-content select="cngx-sidenav-header, [cngxSidenavHeader]" />
1016
+ '[style.--cngx-sidenav-mini-width]': 'miniWidth() ?? null',
1017
+ '[style.--cngx-sidebar-size]': 'effectiveWidth()',
1018
+ '[style.--cngx-sidebar-rail-size]': 'miniWidth() ?? null',
1019
+ '[attr.data-nav-railed]': "railed() ? 'true' : 'false'",
1020
+ }, imports: [CngxResizable], template: `
1021
+ <ng-content select="cngx-nav-header, [cngxNavHeader]" />
694
1022
  <div class="cngx-sidenav__body">
695
1023
  <ng-content />
696
1024
  </div>
697
- <ng-content select="cngx-sidenav-footer, [cngxSidenavFooter]" />
698
- <!-- No handle in mini mode: the collapsed rail has a fixed width, and a
699
- drag there would leave a stale inline width var on the rail. -->
700
- @if (resizable() && effectiveMode() !== 'mini') {
1025
+ <ng-content select="cngx-nav-footer, [cngxNavFooter]" />
1026
+ <!-- Only at full width: a collapsed rail or peek has a fixed width, and a
1027
+ drag there would leave a stale width on the rail. -->
1028
+ @if (resizable() && sidebar.state() === 'expanded') {
701
1029
  <div
702
1030
  class="cngx-sidenav__resize-handle"
703
- (pointerdown)="handleResizeStart($event)"
704
- (keydown)="handleResizeKeydown($event)"
705
- (focus)="handleResizeFocus()"
706
- role="separator"
707
- tabindex="0"
708
- [attr.aria-label]="resolvedResizeLabel()"
709
- [attr.aria-orientation]="'vertical'"
710
- [attr.aria-valuenow]="widthValueNow()"
711
- [attr.aria-valuetext]="widthValueText()"
712
- [attr.aria-valuemin]="minWidthPx()"
713
- [attr.aria-valuemax]="maxWidthPx()"
1031
+ cngxResizable
1032
+ [size]="sizePx()"
1033
+ (sizeChange)="handleSizeChange($event)"
1034
+ [min]="minPx()"
1035
+ [max]="maxPx()"
1036
+ [edge]="position() === 'end' ? 'inline-start' : 'inline-end'"
1037
+ [label]="resolvedResizeLabel()"
1038
+ [valueText]="formatValueText()"
1039
+ [attr.aria-controls]="id()"
1040
+ (focus)="measureWidth()"
714
1041
  ></div>
715
1042
  }
716
- `, styles: ["@layer cngx.tokens{@property --cngx-sidenav-width{syntax: \"<length>\"; inherits: true; initial-value: 280px;}@property --cngx-sidenav-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .005 250);}@property --cngx-sidenav-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-sidenav-transition-duration{syntax: \"<time>\"; inherits: false; initial-value: .25s;}:where(cngx-sidenav,cngx-sidenav *){--cngx-sidenav-transition-duration: var(--cngx-duration-base)}@property --cngx-sidenav-transition-easing{syntax: \"*\"; inherits: false; initial-value: ease;}@property --cngx-sidenav-mini-width{syntax: \"<length>\"; inherits: true; initial-value: 56px;}@property --cngx-sidenav-expanded-shadow{syntax: \"*\"; inherits: true; initial-value: 4px 0 12px oklch(0 0 0 / .1);}@property --cngx-sidenav-border-width{syntax: \"<length>\"; inherits: false; initial-value: 1px;}@property --cngx-sidenav-border-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.89 0 0);}@property --cngx-sidenav-padding{syntax: \"<length>\"; inherits: true; initial-value: 16px;}@property --cngx-sidenav-header-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-sidenav-header-font-size{syntax: \"*\"; inherits: false; initial-value: .875rem;}@property --cngx-sidenav-footer-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-sidenav-footer-border-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.89 0 0);}@property --cngx-sidenav-footer-font-size{syntax: \"*\"; inherits: false; initial-value: .75rem;}@property --cngx-sidenav-resize-handle-width{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-sidenav-resize-handle-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-sidenav-resize-handle-focus-outline-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-sidenav-resize-handle-focus-outline-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-sidenav-resize-handle-focus-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-sidenav-backdrop-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(0 0 0);}@property --cngx-sidenav-backdrop-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-nav-link-padding{syntax: \"*\"; inherits: true; initial-value: 10px 16px;}@property --cngx-nav-link-font-size{syntax: \"*\"; inherits: false; initial-value: .875rem;}@property --cngx-nav-link-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-nav-link-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-nav-link-hover-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-nav-link-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .04);}@property --cngx-nav-link-active-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-nav-link-active-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .08);}@property --cngx-nav-link-active-font-weight{syntax: \"<number>\"; inherits: false; initial-value: 600;}@property --cngx-nav-link-focus-outline-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-nav-link-focus-outline-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-nav-link-focus-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: -2px;}@property --cngx-nav-link-initial-size{syntax: \"*\"; inherits: false; initial-value: .875rem;}:root{--cngx-sidenav-bg: var(--cngx-color-surface, oklch(.97 .005 250));--cngx-sidenav-border-color: var(--cngx-color-border, oklch(.89 0 0));--cngx-sidenav-footer-border-color: var(--cngx-color-border, oklch(.89 0 0));--cngx-sidenav-expanded-shadow: 4px 0 12px oklch(0 0 0 / .1);--cngx-nav-link-hover-bg: oklch(0 0 0 / .04);--cngx-nav-link-active-bg: oklch(0 0 0 / .08);--cngx-nav-link-focus-outline-color: var(--cngx-color-primary, oklch(.66 .19 50))}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-sidenav-expanded-shadow: 4px 0 12px oklch(0 0 0 / .45);--cngx-nav-link-hover-bg: oklch(1 0 0 / .06);--cngx-nav-link-active-bg: oklch(1 0 0 / .1)}}:root[data-color-scheme=dark],:root.dark{--cngx-sidenav-expanded-shadow: 4px 0 12px oklch(0 0 0 / .45);--cngx-nav-link-hover-bg: oklch(1 0 0 / .06);--cngx-nav-link-active-bg: oklch(1 0 0 / .1)}:root[data-color-scheme=light],:root.light{--cngx-sidenav-expanded-shadow: 4px 0 12px oklch(0 0 0 / .1);--cngx-nav-link-hover-bg: oklch(0 0 0 / .04);--cngx-nav-link-active-bg: oklch(0 0 0 / .08)}}@layer cngx.components{cngx-sidenav{--cngx-sidenav-padding: var(--cngx-space-md);--cngx-nav-link-padding: var(--cngx-space-sm) var(--cngx-space-md);display:flex;flex-direction:column;flex-shrink:0;overflow:hidden;z-index:2;width:var(--cngx-sidenav-width, 280px);background:var(--cngx-sidenav-bg, oklch(.97 .005 250));color:var(--cngx-sidenav-color, inherit);transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s var(--cngx-sidenav-transition-duration, .25s)}cngx-sidenav:not(.cngx-sidenav--open):not(.cngx-sidenav--side):not(.cngx-sidenav--mini):not(.cngx-sidenav--over){width:0;visibility:hidden}cngx-sidenav.cngx-sidenav--open{visibility:visible;transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s 0s}cngx-sidenav.cngx-sidenav--side.cngx-sidenav--open{visibility:visible}cngx-sidenav.cngx-sidenav--over{position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-width, 280px);visibility:hidden;transition:transform var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s var(--cngx-sidenav-transition-duration, .25s)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--start{inset-inline-start:0;transform:translate(-100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end{inset-inline-end:0;transform:translate(100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--start:not(.cngx-sidenav--open):dir(rtl){transform:translate(100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end:not(.cngx-sidenav--open):dir(rtl){transform:translate(-100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--open{transform:translate(0);visibility:visible;transition:transform var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s 0s}cngx-sidenav.cngx-sidenav--push,cngx-sidenav.cngx-sidenav--side,cngx-sidenav.cngx-sidenav--mini{position:relative}cngx-sidenav.cngx-sidenav--mini{width:var(--cngx-sidenav-mini-width, 56px);visibility:visible;transition:none}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--expanded{width:var(--cngx-sidenav-width, 280px);z-index:3;box-shadow:var(--cngx-sidenav-expanded-shadow, 4px 0 12px oklch(0 0 0 / .1));transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),margin var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease)}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--expanded.cngx-sidenav--start{margin-inline-end:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--expanded.cngx-sidenav--end{margin-inline-start:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--start{border-inline-end:var(--cngx-sidenav-border-width, 1px) solid var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)))}cngx-sidenav.cngx-sidenav--end{border-inline-start:var(--cngx-sidenav-border-width, 1px) solid var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)));order:2}.cngx-sidenav__body{flex:1;overflow-y:auto;overflow-x:hidden;min-width:var(--cngx-sidenav-width, 280px);scrollbar-gutter:stable}.cngx-sidenav--mini:not(.cngx-sidenav--expanded) .cngx-sidenav__body{min-width:var(--cngx-sidenav-mini-width, 56px)}cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) .cngx-sidenav-header,cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) .cngx-sidenav-footer{overflow:hidden;white-space:nowrap;text-overflow:clip;text-align:center;padding:8px 4px}cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) [cngxNavLabel],cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) [cngxNavGroup]{display:none!important}.cngx-sidenav-header{flex-shrink:0;padding:var(--cngx-sidenav-padding, 16px);background:var(--cngx-sidenav-header-bg, transparent);border-bottom:1px solid var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)));font-weight:600;font-size:var(--cngx-sidenav-header-font-size, .875rem)}.cngx-sidenav-footer{flex-shrink:0;margin-top:auto;padding:var(--cngx-sidenav-padding, 16px);background:var(--cngx-sidenav-footer-bg, transparent);border-top:1px solid var( --cngx-sidenav-footer-border-color, var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0))) );font-size:var(--cngx-sidenav-footer-font-size, .75rem);color:var(--cngx-color-text-muted, oklch(.5 .01 250))}cngx-sidenav .cngx-nav-link{display:block;padding:var(--cngx-nav-link-padding, 10px 16px);text-decoration:none;font-size:var(--cngx-nav-link-font-size, .875rem);color:var(--cngx-nav-link-color, currentColor);border-radius:var(--cngx-nav-link-radius, 4px);transition:background var(--cngx-duration-fast, .15s),color var(--cngx-duration-fast, .15s)}cngx-sidenav .cngx-nav-link:hover{color:var(--cngx-nav-link-hover-color, currentColor);background:var(--cngx-nav-link-hover-bg, oklch(0 0 0 / .04))}cngx-sidenav .cngx-nav-link--active{color:var(--cngx-nav-link-active-color, currentColor);background:var(--cngx-nav-link-active-bg, oklch(0 0 0 / .08));font-weight:var(--cngx-nav-link-active-font-weight, 600)}cngx-sidenav .cngx-nav-link:focus-visible{outline:var(--cngx-nav-link-focus-outline-width, 2px) solid var(--cngx-nav-link-focus-outline-color, oklch(.66 .19 50));outline-offset:var(--cngx-nav-link-focus-outline-offset, -2px)}cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) .cngx-nav-link{overflow:hidden;text-align:center;font-size:0!important;line-height:1;padding:var(--cngx-nav-link-padding, 10px 8px)}cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) .cngx-nav-link[data-initial]:before{content:attr(data-initial) / \"\";font-size:var(--cngx-nav-link-initial-size, .875rem);font-weight:600;display:inline-block;width:var(--cngx-nav-link-initial-size, .875rem);text-align:center;line-height:1.6}cngx-sidenav.cngx-sidenav--mini:not(.cngx-sidenav--expanded) [cngxNavBadge]{display:none}.cngx-nav-group-content{display:grid;grid-template-rows:0fr;transition:grid-template-rows var(--cngx-sidenav-transition-duration, .2s) ease}.cngx-nav-group-content>*{overflow:hidden;min-height:0}.cngx-nav-group-content--open{grid-template-rows:1fr}.cngx-sidenav__resize-handle{--cngx-sidenav-resize-handle-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-sidenav-resize-handle-focus-outline-color: var( --cngx-color-primary, oklch(.66 .19 50) );position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-resize-handle-width, 4px);cursor:col-resize;z-index:4;background:transparent;transition:background var(--cngx-duration-fast, .15s);touch-action:none}.cngx-sidenav__resize-handle:before{content:\"\";position:absolute;top:0;bottom:0;left:50%;transform:translate(-50%);width:max(var(--cngx-sidenav-resize-handle-width, 4px),var(--cngx-target-min, 0px))}.cngx-sidenav--start .cngx-sidenav__resize-handle{inset-inline-end:0;transform:translate(50%)}.cngx-sidenav--end .cngx-sidenav__resize-handle{inset-inline-start:0;transform:translate(-50%)}.cngx-sidenav--start:dir(rtl) .cngx-sidenav__resize-handle{transform:translate(-50%)}.cngx-sidenav--end:dir(rtl) .cngx-sidenav__resize-handle{transform:translate(50%)}.cngx-sidenav__resize-handle:hover,.cngx-sidenav--resizing .cngx-sidenav__resize-handle{background:var( --cngx-sidenav-resize-handle-color, var(--cngx-color-primary, oklch(.66 .19 50)) )}.cngx-sidenav__resize-handle:focus-visible{background:var( --cngx-sidenav-resize-handle-color, var(--cngx-color-primary, oklch(.66 .19 50)) );outline:var(--cngx-sidenav-resize-handle-focus-outline-width, 2px) solid var( --cngx-sidenav-resize-handle-focus-outline-color, var(--cngx-color-primary, oklch(.66 .19 50)) );outline-offset:var(--cngx-sidenav-resize-handle-focus-outline-offset, 2px)}cngx-sidenav.cngx-sidenav--resizing{transition:none!important;-webkit-user-select:none;user-select:none}}@media(forced-colors:active){cngx-sidenav .cngx-nav-link--active{forced-color-adjust:none;background:Highlight;color:HighlightText}}\n"] }]
717
- }], ctorParameters: () => [], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }, { type: i0.Output, args: ["widthChange"] }], miniWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "miniWidth", required: false }] }], expandOnHover: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandOnHover", required: false }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], resizeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizeLabel", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], shortcut: [{ type: i0.Input, args: [{ isSignal: true, alias: "shortcut", required: false }] }], opened: [{ type: i0.Input, args: [{ isSignal: true, alias: "opened", required: false }] }, { type: i0.Output, args: ["openedChange"] }] } });
718
- /** Per-keypress width change of the arrow-key resize, in px. */
719
- const RESIZE_KEY_STEP = 16;
720
- /**
721
- * Numeric value of a px-unit (or unitless) CSS length, `null` for any other
722
- * unit. rem/ch widths cannot be resolved without layout, and a guessed number
723
- * would surface as a lying `aria-valuenow`.
724
- */
725
- function parsePx(value) {
726
- const match = /^\s*(\d+(?:\.\d+)?)(?:px)?\s*$/.exec(value);
727
- return match ? Number.parseFloat(match[1]) : null;
728
- }
729
-
1043
+ `, styles: ["@layer cngx.tokens{@property --cngx-sidenav-width{syntax: \"<length>\"; inherits: true; initial-value: 280px;}@property --cngx-sidenav-bg{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-color{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-transition-duration{syntax: \"<time>\"; inherits: false; initial-value: .25s;}:where(cngx-sidenav,cngx-sidenav *){--cngx-sidenav-transition-duration: var(--cngx-duration-base)}@property --cngx-sidenav-transition-easing{syntax: \"*\"; inherits: false; initial-value: ease;}@property --cngx-sidenav-mini-width{syntax: \"<length>\"; inherits: true; initial-value: 56px;}@property --cngx-sidenav-expanded-shadow{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-border-width{syntax: \"<length>\"; inherits: false; initial-value: 1px;}@property --cngx-sidenav-border-color{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-padding{syntax: \"<length>\"; inherits: true; initial-value: 16px;}@property --cngx-sidenav-row-gap{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-resize-handle-width{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-sidenav-resize-handle-target-min{syntax: \"<length>\"; inherits: true; initial-value: 24px;}@property --_cngx-sidenav-handle-reach{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --cngx-sidenav-resize-handle-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-sidenav-resize-handle-focus-outline-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-sidenav-resize-handle-focus-outline-color{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-sidenav-resize-handle-focus-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-sidenav-backdrop-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(0 0 0);}@property --cngx-sidenav-overlay-shadow{syntax: \"*\"; inherits: true;}@property --cngx-sidenav-backdrop-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}:root{--_cngx-sidenav-shadow-tint: oklch(0 0 0 / .1)}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--_cngx-sidenav-shadow-tint: oklch(0 0 0 / .45)}}[data-color-scheme=dark],.dark{--_cngx-sidenav-shadow-tint: oklch(0 0 0 / .45)}[data-color-scheme=light],.light{--_cngx-sidenav-shadow-tint: oklch(0 0 0 / .1)}}@layer cngx.components{cngx-sidenav{--_cngx-sidenav-reveal-delay: var(--cngx-duration-fast, .15s);--cngx-sidenav-padding: var(--cngx-space-md);--cngx-nav-header-padding-block: var(--cngx-sidenav-padding, 16px);--cngx-nav-footer-padding-block: var(--cngx-sidenav-padding, 16px);--cngx-nav-header-border-color: var( --cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)) );--cngx-nav-footer-border-color: var( --cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)) );--cngx-nav-link-padding: var(--cngx-space-sm) var(--cngx-nav-link-padding-inline, var(--cngx-space-md));--cngx-nav-link-inset: var(--cngx-space-xs);--cngx-sidenav-mini-width: calc( var(--cngx-nav-railed-size, 60px) + var(--cngx-sidenav-border-width, 1px) );--cngx-sidebar-rail-size: var(--cngx-sidenav-mini-width);--cngx-nav-flyout-offset: calc( var(--cngx-nav-link-inset, var(--cngx-space-xs, 4px)) + var(--cngx-sidenav-border-width, 1px) + var(--cngx-space-xs, 4px) );--cngx-nav-transition: var(--cngx-sidenav-transition-duration, .25s);--cngx-nav-link-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 6%, transparent );--cngx-nav-link-pressed-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 12%, transparent );--cngx-nav-link-active-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 16%, transparent );--cngx-nav-link-active-hover-bg: color-mix( in oklch, var(--cngx-color-primary, oklch(.66 .19 50)) 22%, transparent );--cngx-nav-link-focus-outline-color: var( --cngx-sidenav-color, var(--cngx-color-text, oklch(.2 .01 250)) );--cngx-nav-link-focus-inner-color: var( --cngx-sidenav-bg, var(--cngx-color-surface, oklch(.97 .005 250)) );--cngx-nav-link-active-indicator-color: var( --cngx-color-primary-text, oklch(from var(--cngx-color-primary, oklch(.66 .19 50)) .54 c h) );--cngx-nav-link-active-indicator-size: calc(var(--cngx-space-xs) * .75);--cngx-nav-link-active-indicator-inset: var(--cngx-space-sm);--cngx-nav-label-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-nav-badge-bg: var( --cngx-color-primary-strong, oklch(from var(--cngx-color-primary, oklch(.66 .19 50)) .58 c h) );--cngx-nav-badge-color: var(--cngx-color-on-primary-strong, oklch(1 0 0));display:flex;flex-direction:column;box-sizing:border-box;flex-shrink:0;overflow:hidden;z-index:var(--cngx-sidenav-z-index, 2);width:var(--cngx-sidenav-width, 280px);background:var(--cngx-sidenav-bg, var(--cngx-color-surface, oklch(.97 .005 250)));color:var(--cngx-sidenav-color, var(--cngx-color-text, inherit));transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s var(--cngx-sidenav-transition-duration, .25s)}cngx-sidenav[data-sidebar-state=hidden]{visibility:hidden}cngx-sidenav.cngx-sidenav--open{visibility:visible;transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s 0s}cngx-sidenav.cngx-sidenav--side.cngx-sidenav--open{visibility:visible}cngx-sidenav.cngx-sidenav--over{position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-width, 280px);visibility:hidden;transition:transform var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s var(--cngx-sidenav-transition-duration, .25s)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--start{inset-inline-start:0;transform:translate(-100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end{inset-inline-end:0;transform:translate(100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--start:not(.cngx-sidenav--open):dir(rtl){transform:translate(100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end:not(.cngx-sidenav--open):dir(rtl){transform:translate(-100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--open{transform:translate(0);visibility:visible;box-shadow:var( --cngx-sidenav-overlay-shadow, var( --cngx-sidenav-expanded-shadow, var(--_cngx-sidenav-shadow-x, 4px) 0 12px var(--_cngx-sidenav-shadow-tint, oklch(0 0 0 / .1)) ) );transition:transform var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),visibility 0s 0s}cngx-sidenav.cngx-sidenav--end,cngx-sidenav:dir(rtl){--_cngx-sidenav-shadow-x: -4px}cngx-sidenav.cngx-sidenav--end:dir(rtl){--_cngx-sidenav-shadow-x: 4px}cngx-sidenav.cngx-sidenav--side{position:relative}cngx-sidenav[data-sidebar-state=rail]{visibility:visible}cngx-sidenav[data-sidebar-state=rail],cngx-sidenav[data-sidebar-state=peek]{transition:width var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),margin var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease)}cngx-sidenav[data-sidebar-state=peek]{box-shadow:var( --cngx-sidenav-expanded-shadow, var(--_cngx-sidenav-shadow-x, 4px) 0 12px var(--_cngx-sidenav-shadow-tint, oklch(0 0 0 / .1)) )}cngx-sidenav.cngx-sidenav--start{border-inline-end:var(--cngx-sidenav-border-width, 1px) solid var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)))}cngx-sidenav.cngx-sidenav--end{border-inline-start:var(--cngx-sidenav-border-width, 1px) solid var(--cngx-sidenav-border-color, var(--cngx-color-border, oklch(.89 0 0)));order:2}cngx-sidenav[data-sidebar-state=hidden]{border-inline-width:0}.cngx-sidenav__body{display:flex;flex:1;flex-direction:column;gap:var(--cngx-sidenav-row-gap, calc(var(--cngx-space-xs, 4px) / 2));overflow-y:auto;overflow-x:hidden;min-width:var(--cngx-sidenav-width, 280px);padding-block:var(--cngx-space-xs, 4px);scrollbar-gutter:stable}cngx-sidenav[data-sidebar-state=rail] .cngx-sidenav__body{min-width:0;scrollbar-gutter:auto;scrollbar-width:none}cngx-sidenav :is(.cngx-nav-header,.cngx-nav-footer) .cngx-nav-name{transition:opacity var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease) var(--_cngx-sidenav-reveal-delay, .15s)}cngx-sidenav[data-sidebar-state=rail] :is(.cngx-nav-header,.cngx-nav-footer) .cngx-nav-name{transition:opacity 0s}cngx-sidenav[data-sidebar-state=rail] .cngx-sidenav__body>:has(+.cngx-nav-group-content[popover]){margin-block-end:var(--cngx-sidenav-row-gap, calc(var(--cngx-space-xs, 4px) / 2))}cngx-sidenav :is(.cngx-nav-link,.cngx-nav-group,.cngx-nav-label):not(.cngx-nav-group-content *){transition:background-color var(--cngx-duration-fast, .15s),color var(--cngx-duration-fast, .15s),-webkit-text-fill-color var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease) var(--_cngx-sidenav-reveal-delay, .15s)}cngx-sidenav .cngx-nav-badge:not(.cngx-nav-group-content *),cngx-sidenav .cngx-nav-group:not(.cngx-nav-group-content *):after{transition:rotate var(--cngx-duration-fast, .15s),opacity var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease) var(--_cngx-sidenav-reveal-delay, .15s)}cngx-sidenav :is(.cngx-nav-link,.cngx-nav-group):before,cngx-sidenav .cngx-nav-icon{-webkit-text-fill-color:currentColor}cngx-sidenav[data-sidebar-state=rail] :is(.cngx-nav-link,.cngx-nav-group,.cngx-nav-label):not(.cngx-nav-group-content *){-webkit-text-fill-color:transparent;transition:background-color var(--cngx-duration-fast, .15s),color var(--cngx-duration-fast, .15s),-webkit-text-fill-color 0s}cngx-sidenav[data-sidebar-state=rail] .cngx-nav-badge:not(.cngx-nav-group-content *),cngx-sidenav[data-sidebar-state=rail] .cngx-nav-group:not(.cngx-nav-group-content *):after{opacity:0;transition:rotate var(--cngx-duration-fast, .15s),opacity 0s}[data-motion=reduced] cngx-sidenav,cngx-sidenav[data-motion=reduced]{--_cngx-sidenav-reveal-delay: 0s}@media(prefers-reduced-motion:reduce){:root:not([data-motion=full]) cngx-sidenav{--_cngx-sidenav-reveal-delay: 0s}}.cngx-sidenav__resize-handle{--cngx-sidenav-resize-handle-color: var(--cngx-color-primary, oklch(.66 .19 50));--cngx-sidenav-resize-handle-focus-outline-color: var( --cngx-color-primary, oklch(.66 .19 50) );position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-resize-handle-width, 4px);cursor:col-resize;z-index:4;background:transparent;transition:background var(--cngx-duration-fast, .15s);touch-action:none}cngx-sidenav.cngx-sidenav--resizable{--_cngx-sidenav-handle-reach: calc(max( var(--cngx-sidenav-resize-handle-width, 4px), var(--cngx-sidenav-resize-handle-target-min, 24px), var(--cngx-target-min, 0px) )/2) ;overflow:clip;overflow-clip-margin:var(--_cngx-sidenav-handle-reach)}.cngx-sidenav__resize-handle:before{content:\"\";position:absolute;top:0;bottom:0;left:50%;transform:translate(-50%);width:max(var(--cngx-sidenav-resize-handle-width, 4px),var(--cngx-sidenav-resize-handle-target-min, 24px),var(--cngx-target-min, 0px))}.cngx-sidenav--start .cngx-sidenav__resize-handle{inset-inline-end:0;transform:translate(50%)}.cngx-sidenav--end .cngx-sidenav__resize-handle{inset-inline-start:0;transform:translate(-50%)}.cngx-sidenav--start:dir(rtl) .cngx-sidenav__resize-handle{transform:translate(-50%)}.cngx-sidenav--end:dir(rtl) .cngx-sidenav__resize-handle{transform:translate(50%)}.cngx-sidenav__resize-handle:hover,.cngx-sidenav--resizing .cngx-sidenav__resize-handle{background:var(--cngx-sidenav-resize-handle-color)}.cngx-sidenav__resize-handle:focus-visible{background:var(--cngx-sidenav-resize-handle-color);outline:var(--cngx-sidenav-resize-handle-focus-outline-width, 2px) solid var(--cngx-sidenav-resize-handle-focus-outline-color);outline-offset:var(--cngx-sidenav-resize-handle-focus-outline-offset, 2px)}cngx-sidenav.cngx-sidenav--resizing{transition:none!important;-webkit-user-select:none;user-select:none}}\n"] }]
1044
+ }], ctorParameters: () => [], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }, { type: i0.Output, args: ["widthChange"] }], miniWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "miniWidth", required: false }] }], tooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltip", required: false }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], resizeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizeLabel", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], shortcut: [{ type: i0.Input, args: [{ isSignal: true, alias: "shortcut", required: false }] }], resizeHandle: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CngxResizable), { isSignal: true }] }], opened: [{ type: i0.Input, args: [{ isSignal: true, alias: "opened", required: false }] }, { type: i0.Output, args: ["openedChange"] }], modality: [{ type: i0.Input, args: [{ isSignal: true, alias: "modality", required: false }] }], navGroups: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxNavGroup), { ...{ descendants: true }, isSignal: true }] }], navGroupElements: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxNavGroup), { ...{
1045
+ descendants: true,
1046
+ read: ElementRef,
1047
+ }, isSignal: true }] }], navGroupContents: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxNavGroupContent), { ...{ descendants: true }, isSignal: true }] }], navGroupContentElements: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxNavGroupContent), { ...{
1048
+ descendants: true,
1049
+ read: ElementRef,
1050
+ }, isSignal: true }] }] } });
730
1051
  /**
731
- * Container for one or two `CngxSidenav` panels and a `CngxSidenavContent`.
732
- *
733
- * Manages shared backdrop, scroll lock, and click-outside coordination.
734
- * Supports up to two sidenavs: one `position="start"` and one `position="end"`.
735
- *
736
- * It is also the query container the rails resolve their `'auto'` mode
737
- * against: the stylesheet declares and names the container
738
- * (`cngx-sidenav-layout`) and carries the single docking threshold, the
739
- * composed `CngxContainer` observes it and publishes the resolved value. A
740
- * rail mounted without this layout has no container and falls back to
741
- * `over`.
742
- *
743
- * ### Dual sidebar
744
- * ```html
745
- * <cngx-sidenav-layout>
746
- * <cngx-sidenav position="start" [(opened)]="navOpen">
747
- * Left nav
748
- * </cngx-sidenav>
749
- * <cngx-sidenav-content>
750
- * Main content
751
- * </cngx-sidenav-content>
752
- * <cngx-sidenav position="end" [(opened)]="detailOpen">
753
- * Right detail panel
754
- * </cngx-sidenav>
755
- * </cngx-sidenav-layout>
756
- * ```
757
- *
758
- * @category ui/sidenav
759
- * @docsKind primary
760
- * @wcag AA
761
- * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/sidenav-layout.ts
762
- * @since 0.1.0
763
- * @relatedTo CngxSidenav, CngxSidenavContent, CngxSidenavHeader, CngxSidenavFooter
1052
+ * Dev-only: the layout wrote a width class the sidenav does not know (a typo
1053
+ * in an overridden rule block). The rail renders as `compact`.
764
1054
  */
765
- class CngxSidenavLayout {
766
- readyState = signal(false, ...(ngDevMode ? [{ debugName: "readyState" }] : /* istanbul ignore next */ []));
767
- /** @internal First render done - gates transitions against an open-on-load flash. */
768
- ready = this.readyState.asReadonly();
769
- sidenavs = contentChildren(CngxSidenav, ...(ngDevMode ? [{ debugName: "sidenavs" }] : /* istanbul ignore next */ []));
770
- /** The start-positioned sidenav, if any. */
771
- startSidenav = computed(() => this.sidenavs().find((s) => s.position() === 'start') ?? null, ...(ngDevMode ? [{ debugName: "startSidenav" }] : /* istanbul ignore next */ []));
772
- /** The end-positioned sidenav, if any. */
773
- endSidenav = computed(() => this.sidenavs().find((s) => s.position() === 'end') ?? null, ...(ngDevMode ? [{ debugName: "endSidenav" }] : /* istanbul ignore next */ []));
774
- /** Whether any sidenav is open in overlay mode. */
775
- hasOverlay = computed(() => this.sidenavs().some((s) => s.isOverlay() && s.opened()), ...(ngDevMode ? [{ debugName: "hasOverlay" }] : /* istanbul ignore next */ []));
776
- constructor() {
777
- const doc = inject(DOCUMENT);
778
- // Gate transitions until after first render - prevents open-on-load flash.
779
- afterNextRender(() => this.readyState.set(true));
780
- // Dataset ref-counting matches CngxScrollLock so concurrent lock sources
781
- // do not clobber each other's restore values. `locked` is a plain
782
- // variable, not a signal: the effect only needs to TRACK hasOverlay(),
783
- // and a signal read+written in the same effect is the loop-risk shape.
784
- const html = doc.documentElement;
785
- let locked = false;
786
- effect(() => {
787
- if (this.hasOverlay() && !locked) {
788
- if (!html.dataset['cngxPrevOverflow']) {
789
- html.dataset['cngxPrevOverflow'] = html.style.overflow;
790
- html.dataset['cngxPrevScrollbarGutter'] = html.style.scrollbarGutter;
791
- }
792
- html.style.overflow = 'hidden';
793
- html.style.scrollbarGutter = 'stable';
794
- locked = true;
795
- }
796
- else if (!this.hasOverlay() && locked) {
797
- html.style.overflow = html.dataset['cngxPrevOverflow'] ?? '';
798
- html.style.scrollbarGutter = html.dataset['cngxPrevScrollbarGutter'] ?? '';
799
- delete html.dataset['cngxPrevOverflow'];
800
- delete html.dataset['cngxPrevScrollbarGutter'];
801
- locked = false;
802
- }
803
- });
804
- inject(DestroyRef).onDestroy(() => {
805
- if (locked) {
806
- html.style.overflow = html.dataset['cngxPrevOverflow'] ?? '';
807
- html.style.scrollbarGutter = html.dataset['cngxPrevScrollbarGutter'] ?? '';
808
- delete html.dataset['cngxPrevOverflow'];
809
- delete html.dataset['cngxPrevScrollbarGutter'];
810
- }
811
- });
812
- // Dismiss on pointerdown, not click: an external open-trigger's pointerdown
813
- // fires before the click that flips opened(), so hasOverlay() is still false
814
- // here at that point and the same-gesture open cannot self-close.
815
- fromEvent(doc, 'pointerdown')
816
- .pipe(takeUntilDestroyed())
817
- .subscribe((e) => {
818
- if (!this.hasOverlay()) {
819
- return;
820
- }
821
- for (const nav of this.sidenavs()) {
822
- if (nav.isOverlay() &&
823
- nav.opened() &&
824
- !nav.elementRef.nativeElement.contains(e.target)) {
825
- nav.close();
826
- }
827
- }
828
- });
1055
+ function warnUnknownWidthClass(value) {
1056
+ if (!(typeof ngDevMode !== 'undefined' && ngDevMode)) {
1057
+ return;
829
1058
  }
830
- /** Closes all sidenavs that are currently in overlay mode. */
831
- closeAllOverlays() {
832
- for (const nav of this.sidenavs()) {
833
- if (nav.isOverlay() && nav.opened()) {
834
- nav.close();
835
- }
836
- }
1059
+ cngxDevWarn('CNGX3026', `[cngx-sidenav] unknown --cngx-sidenav-width-class "${value}"; expected compact, medium or expanded. Rendering as compact.`, { value });
1060
+ }
1061
+ /** A stored `true` / `false`, `null` when absent, unreadable or anything else. */
1062
+ function readStoredFlag(storage, key) {
1063
+ try {
1064
+ const value = storage.getItem(key);
1065
+ return value === 'true' ? true : value === 'false' ? false : null;
837
1066
  }
838
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
839
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSidenavLayout, isStandalone: true, selector: "cngx-sidenav-layout", host: { properties: { "class.cngx-sidenav-layout": "true", "class.cngx-sidenav-layout--ready": "ready()", "class.cngx-sidenav-layout--has-overlay": "hasOverlay()" } }, queries: [{ propertyName: "sidenavs", predicate: CngxSidenav, isSignal: true }], exportAs: ["cngxSidenavLayout"], hostDirectives: [{ directive: i1$1.CngxContainer }], ngImport: i0, template: `
840
- <ng-content select="cngx-sidenav[position=start], cngx-sidenav:not([position])" />
841
- <ng-content select="cngx-sidenav-content" />
842
- <ng-content select="cngx-sidenav[position=end]" />
843
- @if (hasOverlay()) {
844
- <div class="cngx-sidenav-backdrop" (click)="closeAllOverlays()"></div>
1067
+ catch {
1068
+ return null;
845
1069
  }
846
- `, isInline: true, styles: ["@layer cngx.components{cngx-sidenav-layout{display:flex;position:relative;width:100%;min-height:inherit;overflow:hidden;container-type:inline-size;container-name:cngx-sidenav-layout}cngx-sidenav-layout>cngx-sidenav{--cngx-sidenav-layout-wide: 0}@container cngx-sidenav-layout (min-inline-size: 64rem){cngx-sidenav-layout>cngx-sidenav{--cngx-sidenav-layout-wide: 1}}cngx-sidenav-layout:not(.cngx-sidenav-layout--ready) cngx-sidenav,cngx-sidenav-layout:not(.cngx-sidenav-layout--ready) cngx-sidenav-content{transition:none!important}cngx-sidenav.cngx-sidenav--resizing~cngx-sidenav-content{transition:none!important;-webkit-user-select:none;user-select:none}cngx-sidenav-content{display:block;flex:1;min-width:0;overflow:auto;order:1;transition:margin-inline-start var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),margin-inline-end var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease)}.cngx-sidenav-backdrop{position:absolute;inset:0;z-index:1;background:var(--cngx-sidenav-backdrop-bg, oklch(0 0 0));opacity:var(--cngx-sidenav-backdrop-opacity, .5);cursor:pointer}@media(prefers-reduced-motion:reduce){cngx-sidenav,cngx-sidenav-content,.cngx-sidenav-backdrop{transition:none!important}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
847
1070
  }
848
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavLayout, decorators: [{
849
- type: Component,
850
- args: [{ selector: 'cngx-sidenav-layout', exportAs: 'cngxSidenavLayout', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, hostDirectives: [CngxContainer], host: {
851
- '[class.cngx-sidenav-layout]': 'true',
852
- '[class.cngx-sidenav-layout--ready]': 'ready()',
853
- '[class.cngx-sidenav-layout--has-overlay]': 'hasOverlay()',
854
- }, template: `
855
- <ng-content select="cngx-sidenav[position=start], cngx-sidenav:not([position])" />
856
- <ng-content select="cngx-sidenav-content" />
857
- <ng-content select="cngx-sidenav[position=end]" />
858
- @if (hasOverlay()) {
859
- <div class="cngx-sidenav-backdrop" (click)="closeAllOverlays()"></div>
1071
+ // A full or blocked storage (private mode, quota) must not break the toggle.
1072
+ function writeStoredFlag(storage, key, value) {
1073
+ try {
1074
+ storage.setItem(key, String(value));
1075
+ }
1076
+ catch {
1077
+ // Persistence is best effort.
860
1078
  }
861
- `, styles: ["@layer cngx.components{cngx-sidenav-layout{display:flex;position:relative;width:100%;min-height:inherit;overflow:hidden;container-type:inline-size;container-name:cngx-sidenav-layout}cngx-sidenav-layout>cngx-sidenav{--cngx-sidenav-layout-wide: 0}@container cngx-sidenav-layout (min-inline-size: 64rem){cngx-sidenav-layout>cngx-sidenav{--cngx-sidenav-layout-wide: 1}}cngx-sidenav-layout:not(.cngx-sidenav-layout--ready) cngx-sidenav,cngx-sidenav-layout:not(.cngx-sidenav-layout--ready) cngx-sidenav-content{transition:none!important}cngx-sidenav.cngx-sidenav--resizing~cngx-sidenav-content{transition:none!important;-webkit-user-select:none;user-select:none}cngx-sidenav-content{display:block;flex:1;min-width:0;overflow:auto;order:1;transition:margin-inline-start var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease),margin-inline-end var(--cngx-sidenav-transition-duration, .25s) var(--cngx-sidenav-transition-easing, ease)}.cngx-sidenav-backdrop{position:absolute;inset:0;z-index:1;background:var(--cngx-sidenav-backdrop-bg, oklch(0 0 0));opacity:var(--cngx-sidenav-backdrop-opacity, .5);cursor:pointer}@media(prefers-reduced-motion:reduce){cngx-sidenav,cngx-sidenav-content,.cngx-sidenav-backdrop{transition:none!important}}}\n"] }]
862
- }], ctorParameters: () => [], propDecorators: { sidenavs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxSidenav), { isSignal: true }] }] } });
1079
+ }
1080
+ /**
1081
+ * Numeric value of a px-unit (or unitless) CSS length, `null` for any other
1082
+ * unit. rem/ch widths cannot be resolved without layout.
1083
+ */
1084
+ function parsePx(value) {
1085
+ const match = /^\s*(\d+(?:\.\d+)?)(?:px)?\s*$/.exec(value);
1086
+ return match ? Number.parseFloat(match[1]) : null;
1087
+ }
863
1088
 
864
1089
  /**
865
1090
  * Deep-links a sidenav's open state into a query param. Opt-in via
@@ -870,26 +1095,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
870
1095
  * contract token, never the concrete class.
871
1096
  *
872
1097
  * The `param` default cascades: per-instance `[param]` wins, then
873
- * `withSidenavRouterSync({ param })` on `CNGX_SIDENAV_CONFIG`, then the `'nav'`
874
- * literal. Without `@angular/router` the kernel dev-warns once and no-ops.
1098
+ * `withSidenavRouterSync({ param })` on `CNGX_SIDENAV_CONFIG`, then `'nav'` on a
1099
+ * start rail and `'nav-end'` on an end rail, so two synced rails keep apart. Without `@angular/router` the kernel dev-warns once and no-ops.
875
1100
  *
876
- * @category ui/sidenav
877
- * @docsKind primary
878
1101
  * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/sidenav-router-sync.directive.ts
879
- * @since 0.1.0
1102
+ * @since 0.3.0
880
1103
  * @relatedTo CngxSidenav, CNGX_SIDENAV, injectQueryParamSync
881
- * <example-url>http://localhost:4200/#/ui/sidenav/router-sync/deep-linkable-overlay</example-url>
1104
+ * <example-url>/#/ui/sidenav/router-sync/deep-linkable-overlay</example-url>
1105
+ * @axis level organism
882
1106
  */
883
1107
  class CngxSidenavRouterSync {
884
- sidenav = inject(CNGX_SIDENAV, { host: true });
1108
+ sidenav = injectRouterSyncSidenav();
885
1109
  cfg = injectSidenavConfig();
886
1110
  /**
887
- * Raw `[param]` input. Read the resolved {@link param} computed instead.
888
- * @internal
1111
+ * Query-param key that the sidenav `opened` state syncs to, set through `[param]`.
1112
+ * Falls back to the config `routerSync.param`, then to `'nav'` (`'nav-end'` on a
1113
+ * `position="end"` rail); the resolved key is
1114
+ * the `param` computed. An empty string is a set value and is used as the key.
1115
+ * A `[param]` set after construction renames the synced key: the current state is reflected under the
1116
+ * new key and the old key is removed. The initial URL is read once under the resolved key, after
1117
+ * `[param]` is bound, so a deep link to a static `param="menu"` opens the sidenav.
889
1118
  */
890
1119
  paramInput = input(undefined, { ...(ngDevMode ? { debugName: "paramInput" } : /* istanbul ignore next */ {}), alias: 'param' });
891
- /** Resolved query-param key: `[param]` -> config `routerSync.param` -> `'nav'`. */
892
- param = computed(() => this.paramInput() ?? this.cfg.routerSync?.param ?? 'nav', ...(ngDevMode ? [{ debugName: "param" }] : /* istanbul ignore next */ []));
1120
+ // Read from the static attribute, as the persistence key does.
1121
+ defaultParam = inject(new HostAttributeToken('position'), { optional: true }) === 'end' ? 'nav-end' : 'nav';
1122
+ /** Resolved query-param key: `[param]` -> config `routerSync.param` -> `'nav'` / `'nav-end'`. */
1123
+ param = computed(() => this.paramInput() ?? this.cfg.routerSync?.param ?? this.defaultParam, ...(ngDevMode ? [{ debugName: "param" }] : /* istanbul ignore next */ []));
893
1124
  /** Emits when a `router.navigate` rejection is observed. Parity with the stepper sibling. */
894
1125
  syncError = output();
895
1126
  constructor() {
@@ -911,11 +1142,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
911
1142
  standalone: true,
912
1143
  }]
913
1144
  }], ctorParameters: () => [], propDecorators: { paramInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "param", required: false }] }], syncError: [{ type: i0.Output, args: ["syncError"] }] } });
1145
+ function injectRouterSyncSidenav() {
1146
+ const sidenav = inject(CNGX_SIDENAV, { host: true, optional: true });
1147
+ if (!sidenav) {
1148
+ throw new CngxRuntimeError('CNGX3021', typeof ngDevMode !== 'undefined' &&
1149
+ ngDevMode &&
1150
+ '[cngxSidenavRouterSync] must be placed on or inside <cngx-sidenav>.');
1151
+ }
1152
+ return sidenav;
1153
+ }
914
1154
 
915
1155
  /**
916
1156
  * Main content area within a `CngxSidenavLayout`.
917
1157
  *
918
- * Auto-adjusts margins when sibling sidenavs are in `push` or `side`
1158
+ * Sits in flex flow beside sibling sidenavs docked in `side`
919
1159
  * mode. Must be a direct child of `CngxSidenavLayout`.
920
1160
  *
921
1161
  * ```html
@@ -927,35 +1167,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
927
1167
  * </cngx-sidenav-layout>
928
1168
  * ```
929
1169
  *
930
- * @category ui/sidenav
931
- * @docsKind primary
932
1170
  * @wcag AA
933
1171
  * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/sidenav-content.ts
934
- * @since 0.1.0
1172
+ * @since 0.3.0
935
1173
  * @relatedTo CngxSidenavLayout, CngxSidenav
936
1174
  */
937
1175
  class CngxSidenavContent {
938
1176
  layout = inject(CngxSidenavLayout, { optional: true });
939
1177
  constructor() {
940
1178
  if (!this.layout) {
941
- throw new Error('cngx-sidenav-content must be placed inside a cngx-sidenav-layout.');
1179
+ throw new CngxRuntimeError('CNGX3014', typeof ngDevMode !== 'undefined' &&
1180
+ ngDevMode &&
1181
+ '[cngx-sidenav-content] must be placed inside <cngx-sidenav-layout>.');
942
1182
  }
943
1183
  }
944
- /**
945
- * Margin offset for the start sidenav.
946
- *
947
- * Push and side modes use `position: relative` - the sidenav sits in
948
- * the flex flow and the content shrinks naturally via `flex: 1`.
949
- * No margin needed. Over mode uses `position: absolute` - no margin needed
950
- * either since the sidenav floats above content.
951
- *
952
- * Kept as a public computed so tests and consumers can still read it.
953
- */
954
- marginStart = '0';
955
- /** Margin offset for the end sidenav - same rationale as start. */
956
- marginEnd = '0';
957
1184
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavContent, deps: [], target: i0.ɵɵFactoryTarget.Component });
958
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CngxSidenavContent, isStandalone: true, selector: "cngx-sidenav-content", host: { properties: { "class.cngx-sidenav-content": "true", "style.margin-inline-start": "marginStart", "style.margin-inline-end": "marginEnd" } }, exportAs: ["cngxSidenavContent"], ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1185
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: CngxSidenavContent, isStandalone: true, selector: "cngx-sidenav-content", host: { properties: { "class.cngx-sidenav-content": "true" } }, exportAs: ["cngxSidenavContent"], ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
959
1186
  }
960
1187
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavContent, decorators: [{
961
1188
  type: Component,
@@ -967,109 +1194,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
967
1194
  encapsulation: ViewEncapsulation.None,
968
1195
  host: {
969
1196
  '[class.cngx-sidenav-content]': 'true',
970
- '[style.margin-inline-start]': 'marginStart',
971
- '[style.margin-inline-end]': 'marginEnd',
972
1197
  },
973
1198
  template: `<ng-content />`,
974
1199
  }]
975
1200
  }], ctorParameters: () => [] });
976
1201
 
977
- /**
978
- * Top region of `<cngx-sidenav>`. Sits before the scrolling body in
979
- * the sidenav's flex column, so it stays pinned at the top while the
980
- * body scrolls. Not `position: sticky` - a non-shrinking flex sibling
981
- * with `flex-shrink: 0`.
982
- *
983
- * Two selector forms:
984
- * - `<cngx-sidenav-header>` element wrapper for arbitrary content.
985
- * - `[cngxSidenavHeader]` attribute for native landmarks like
986
- * `<header>` so the landmark a11y comes from the element itself.
987
- *
988
- * Adds the `cngx-sidenav-header` class for theming via
989
- * `--cngx-sidenav-header-bg` and `--cngx-sidenav-header-font-size`.
990
- *
991
- * In `mini` mode (collapsed rail, not expanded) the region clips to
992
- * `miniWidth` with `overflow: hidden`, centred text, and tight
993
- * padding. Design the projected content to survive the rail width:
994
- * an icon-sized logo works, a wordmark gets cropped.
995
- *
996
- * Typical content: logo, app name, close trigger.
997
- *
998
- * ```html
999
- * <cngx-sidenav>
1000
- * <cngx-sidenav-header>Acme HR</cngx-sidenav-header>
1001
- * ...
1002
- * </cngx-sidenav>
1003
- * ```
1004
- *
1005
- * @category ui/sidenav
1006
- * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/sidenav-header.ts
1007
- * @selector cngx-sidenav-header
1008
- * @since 0.1.0
1009
- * @relatedTo CngxSidenav, CngxSidenavFooter, CngxSidenavLayout
1010
- */
1011
- class CngxSidenavHeader {
1012
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1013
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxSidenavHeader, isStandalone: true, selector: "cngx-sidenav-header, [cngxSidenavHeader]", host: { properties: { "class.cngx-sidenav-header": "true" } }, ngImport: i0 });
1014
- }
1015
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavHeader, decorators: [{
1016
- type: Directive,
1017
- args: [{
1018
- selector: 'cngx-sidenav-header, [cngxSidenavHeader]',
1019
- standalone: true,
1020
- host: { '[class.cngx-sidenav-header]': 'true' },
1021
- }]
1022
- }] });
1023
-
1024
- /**
1025
- * Bottom region of `<cngx-sidenav>`. Mirror of `CngxSidenavHeader`:
1026
- * a non-shrinking flex sibling after the scrolling body, so it stays
1027
- * pinned at the bottom while the body scrolls. Not `position:
1028
- * sticky`.
1029
- *
1030
- * Two selector forms:
1031
- * - `<cngx-sidenav-footer>` element wrapper for arbitrary content.
1032
- * - `[cngxSidenavFooter]` attribute for native landmarks like
1033
- * `<footer>` so the landmark a11y comes from the element itself.
1034
- *
1035
- * Adds the `cngx-sidenav-footer` class for theming via
1036
- * `--cngx-sidenav-footer-bg`, `--cngx-sidenav-footer-border-color`,
1037
- * and `--cngx-sidenav-footer-font-size`.
1038
- *
1039
- * In `mini` mode (collapsed rail, not expanded) the region clips to
1040
- * `miniWidth` with `overflow: hidden` and centred text - same
1041
- * caveat as the header. An icon + tooltip pattern survives the
1042
- * rail; a multi-line copyright line does not.
1043
- *
1044
- * Typical content: version badge, account menu trigger, secondary
1045
- * nav, sign-out button.
1046
- *
1047
- * ```html
1048
- * <cngx-sidenav>
1049
- * ...
1050
- * <cngx-sidenav-footer>v2.4.0</cngx-sidenav-footer>
1051
- * </cngx-sidenav>
1052
- * ```
1053
- *
1054
- * @category ui/sidenav
1055
- * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/sidenav-footer.ts
1056
- * @selector cngx-sidenav-footer
1057
- * @since 0.1.0
1058
- * @relatedTo CngxSidenav, CngxSidenavHeader, CngxSidenavLayout
1059
- */
1060
- class CngxSidenavFooter {
1061
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavFooter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1062
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxSidenavFooter, isStandalone: true, selector: "cngx-sidenav-footer, [cngxSidenavFooter]", host: { properties: { "class.cngx-sidenav-footer": "true" } }, ngImport: i0 });
1063
- }
1064
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavFooter, decorators: [{
1065
- type: Directive,
1066
- args: [{
1067
- selector: 'cngx-sidenav-footer, [cngxSidenavFooter]',
1068
- standalone: true,
1069
- host: { '[class.cngx-sidenav-footer]': 'true' },
1070
- }]
1071
- }] });
1072
-
1202
+ const NO_LABELS = {};
1073
1203
  /**
1074
1204
  * Reduces a list of feature objects into a partial config - last write wins
1075
1205
  * per sub-tree. The nested `dimensions` / `hover` sub-trees are spread-merged
@@ -1094,17 +1224,20 @@ function reduceFeatures(features) {
1094
1224
  out.shortcut = f.payload.shortcut;
1095
1225
  break;
1096
1226
  case 'labels':
1097
- out.labels = f.payload.labels;
1227
+ out.labels = createOverrideMerge(out.labels ?? NO_LABELS, f.payload.labels);
1228
+ break;
1229
+ case 'persistence':
1230
+ out.persistence = f.payload;
1098
1231
  break;
1099
1232
  }
1100
1233
  }
1101
1234
  return out;
1102
1235
  }
1103
1236
  /**
1104
- * Two-level deep merge: the nested sub-tree keys (`dimensions` / `hover`) are
1105
- * spread-merged so the partial fills in missing keys without nuking unrelated
1106
- * config sub-trees; the flat top-level scalar (`shortcut`) takes the partial
1107
- * when present, else the base. Inner objects are flat (one level),
1237
+ * Two-level merge: `dimensions`, `hover` and `routerSync` are spread-merged per
1238
+ * key, `labels` merges per key through `createOverrideMerge` (it may be a
1239
+ * `Signal`); `shortcut` and `persistence` take the partial when present, else
1240
+ * the base. Inner objects are flat (one level),
1108
1241
  * so a single spread per key suffices. Invariant: a config key nested more than
1109
1242
  * one level deep would shallow-merge silently here - if the config ever grows a
1110
1243
  * deeper sub-tree, add a dedicated spread for it rather than relying on this
@@ -1118,23 +1251,23 @@ function mergeConfig(base, partial) {
1118
1251
  hover: { ...base.hover, ...partial.hover },
1119
1252
  routerSync: { ...base.routerSync, ...partial.routerSync },
1120
1253
  shortcut: partial.shortcut ?? base.shortcut,
1121
- labels: partial.labels ?? base.labels,
1254
+ labels: createOverrideMerge(base.labels ?? NO_LABELS, partial.labels),
1255
+ persistence: partial.persistence ?? base.persistence,
1122
1256
  };
1123
1257
  }
1124
1258
  /**
1125
1259
  * Application-root configuration cascade for the sidenav family. Pass any
1126
- * combination of `withSidenavDimensions`,
1127
- * `withSidenavShortcut`, `withSidenavHoverDwell`, and `withSidenavRouterSync`
1128
- * features in `bootstrapApplication`'s providers array.
1260
+ * combination of the `withSidenav*` features in `bootstrapApplication`'s
1261
+ * providers array.
1129
1262
  *
1130
1263
  * Resolution priority (high -> low):
1131
1264
  * 1. Per-instance Input binding.
1132
1265
  * 2. `provideSidenavConfigAt(...)` in a parent component's `viewProviders`.
1133
1266
  * 3. `provideSidenavConfig(...)` at the application root.
1134
- * 4. Library defaults (`CNGX_SIDENAV_DEFAULTS`).
1267
+ * 4. Library defaults.
1135
1268
  *
1136
- * The provider deep-merges supplied features with the library defaults so
1137
- * consumers only declare keys they want to override.
1269
+ * `dimensions`, `hover`, `routerSync` and `labels` merge per key with the
1270
+ * library defaults; `shortcut` and `persistence` replace them.
1138
1271
  *
1139
1272
  * ```ts
1140
1273
  * bootstrapApplication(AppComponent, {
@@ -1147,8 +1280,7 @@ function mergeConfig(base, partial) {
1147
1280
  * });
1148
1281
  * ```
1149
1282
  *
1150
- * @category ui/sidenav
1151
- * @since 0.1.0
1283
+ * @since 0.3.0
1152
1284
  */
1153
1285
  function provideSidenavConfig(...features) {
1154
1286
  // Empty-features: skip the override so the root factory's
@@ -1174,9 +1306,12 @@ function provideSidenavConfig(...features) {
1174
1306
  * Unlike `provideSidenavConfig` (root-only), `provideSidenavConfigAt` injects
1175
1307
  * the parent injector's `CNGX_SIDENAV_CONFIG` value (resolves through the
1176
1308
  * priority chain - root provider, library defaults, or another
1177
- * `provideSidenavConfigAt` further up) and deep-merges the supplied features on
1178
- * top. Descendant sidenav instances see the merged config; sibling sub-trees
1179
- * keep the inherited value untouched.
1309
+ * `provideSidenavConfigAt` further up) and applies the supplied features on
1310
+ * top: `dimensions`, `hover`, `routerSync` and `labels` merge per key,
1311
+ * `shortcut` and `persistence` replace. Descendant sidenav instances see the
1312
+ * result; sibling sub-trees keep the inherited value untouched. Pass only the
1313
+ * keys you set: an explicit `undefined` inside a merged sub-tree overrides
1314
+ * the parent.
1180
1315
  *
1181
1316
  * ```ts
1182
1317
  * @Component({
@@ -1188,8 +1323,7 @@ function provideSidenavConfig(...features) {
1188
1323
  * class Section {}
1189
1324
  * ```
1190
1325
  *
1191
- * @category ui/sidenav
1192
- * @since 0.1.0
1326
+ * @since 0.3.0
1193
1327
  */
1194
1328
  function provideSidenavConfigAt(...features) {
1195
1329
  // Empty-features call: parent value flows through untouched. Skipping the
@@ -1220,8 +1354,7 @@ function provideSidenavConfigAt(...features) {
1220
1354
  * provideSidenavConfig(withSidenavDimensions({ width: '320px', miniWidth: '64px' }));
1221
1355
  * ```
1222
1356
  *
1223
- * @category ui/sidenav
1224
- * @since 0.1.0
1357
+ * @since 0.3.0
1225
1358
  */
1226
1359
  function withSidenavDimensions(payload) {
1227
1360
  return { kind: 'dimensions', payload };
@@ -1229,23 +1362,24 @@ function withSidenavDimensions(payload) {
1229
1362
  /**
1230
1363
  * Set the app-wide default keyboard shortcut to toggle the sidenav (e.g.
1231
1364
  * `'mod+b'`, which resolves to `ctrl` on Windows/Linux and `meta` on macOS).
1232
- * Per-instance `[shortcut]` still wins.
1365
+ * The default applies to `position="start"` rails only; an `end` rail toggles
1366
+ * by key only with its own `[shortcut]`. Per-instance `[shortcut]` still wins.
1233
1367
  *
1234
1368
  * ```ts
1235
1369
  * provideSidenavConfig(withSidenavShortcut('mod+b'));
1236
1370
  * ```
1237
1371
  *
1238
- * @category ui/sidenav
1239
- * @since 0.1.0
1372
+ * @since 0.3.0
1240
1373
  */
1241
1374
  function withSidenavShortcut(combo) {
1242
1375
  return { kind: 'shortcut', payload: { shortcut: combo } };
1243
1376
  }
1244
1377
  /**
1245
- * Set the app-wide default mini expand-on-hover dwell - `enterDelay` (ms before
1246
- * the rail expands) and `leaveDelay` (ms before it collapses). Flows into the
1247
- * composed `CngxHoverIntent` via `CNGX_HOVER_INTENT_DEFAULTS`. Per-instance
1248
- * `[enterDelay]` / `[leaveDelay]` still win; the shipped literals (120 / 0)
1378
+ * Set the app-wide default hover dwell of the collapsed rail's peek -
1379
+ * `enterDelay` (ms of hover before the rail peeks) and `leaveDelay` (ms before
1380
+ * the peek ends). Flows into the `CngxHoverIntent` of the composed
1381
+ * `CngxSidebar` via `CNGX_HOVER_INTENT_DEFAULTS`. Per-instance
1382
+ * `[expandDelay]` / `[collapseDelay]` still win; the shipped literals (120 / 0)
1249
1383
  * apply when neither is set. Partial payloads deep-merge, so pass only the key
1250
1384
  * you want to change.
1251
1385
  *
@@ -1253,8 +1387,7 @@ function withSidenavShortcut(combo) {
1253
1387
  * provideSidenavConfig(withSidenavHoverDwell({ enterDelay: 200, leaveDelay: 150 }));
1254
1388
  * ```
1255
1389
  *
1256
- * @category ui/sidenav
1257
- * @since 0.1.0
1390
+ * @since 0.3.0
1258
1391
  */
1259
1392
  function withSidenavHoverDwell(payload) {
1260
1393
  return { kind: 'hover', payload };
@@ -1262,14 +1395,14 @@ function withSidenavHoverDwell(payload) {
1262
1395
  /**
1263
1396
  * Set the app-wide default query-param key for `[cngxSidenavRouterSync]` - the
1264
1397
  * param the sidenav's `opened` state deep-links to. Per-instance `[param]`
1265
- * still wins; the `'nav'` literal applies when neither is set.
1398
+ * still wins; when neither is set, a start rail uses `'nav'` and an end rail
1399
+ * `'nav-end'`.
1266
1400
  *
1267
1401
  * ```ts
1268
1402
  * provideSidenavConfig(withSidenavRouterSync({ param: 'menu' }));
1269
1403
  * ```
1270
1404
  *
1271
- * @category ui/sidenav
1272
- * @since 0.1.0
1405
+ * @since 0.3.0
1273
1406
  */
1274
1407
  function withSidenavRouterSync(payload) {
1275
1408
  return { kind: 'routerSync', payload };
@@ -1278,26 +1411,44 @@ function withSidenavRouterSync(payload) {
1278
1411
  * Override the app-wide sidenav copy. Unset keys read the `sidenav` section of
1279
1412
  * the language pack (English without one); pass a `Signal` of a partial bundle
1280
1413
  * to switch languages at runtime. A per-instance `[resizeLabel]` still wins
1281
- * over `resizeHandle`. A later call replaces the whole bundle.
1414
+ * over `resizeHandle`. A later call merges per key over the earlier one.
1282
1415
  *
1283
1416
  * ```ts
1284
1417
  * provideSidenavConfig(withSidenavLabels({ resizeHandle: 'Navigation anpassen' }));
1285
1418
  * ```
1286
1419
  *
1287
- * @category ui/sidenav
1288
- * @since 0.1.0
1420
+ * @since 0.3.0
1289
1421
  */
1290
1422
  function withSidenavLabels(labels) {
1291
1423
  return { kind: 'labels', payload: { labels } };
1292
1424
  }
1425
+ /**
1426
+ * Persist each rail's `collapsed` across reloads, in `CNGX_SIDENAV_STORAGE`
1427
+ * (the browser `localStorage` by default) under `<storageKey>:<position>`.
1428
+ * `collapsed` only means something on the docked rail of the `expanded` width
1429
+ * class, so one value per rail is stored, and it survives a pass through
1430
+ * `medium` and `compact`. The stored value seeds an unbound `collapsed` at
1431
+ * construction. A bound `[(collapsed)]` is persisted too; on load the bound
1432
+ * value wins over the stored one. The position is read from the static
1433
+ * `position` attribute (`start` when absent).
1434
+ *
1435
+ * ```ts
1436
+ * provideSidenavConfig(withSidenavPersistence());
1437
+ * ```
1438
+ *
1439
+ * @since 0.3.0
1440
+ */
1441
+ function withSidenavPersistence(storageKey = 'cngx-sidenav') {
1442
+ return { kind: 'persistence', payload: { storageKey } };
1443
+ }
1293
1444
 
1294
1445
  /**
1295
- * @module @cngx/ui/sidenav
1446
+ * @module `@cngx/ui/sidenav`
1296
1447
  */
1297
1448
 
1298
1449
  /**
1299
1450
  * Generated bundle index. Do not edit.
1300
1451
  */
1301
1452
 
1302
- export { CNGX_SIDENAV, CNGX_SIDENAV_CONFIG, CNGX_SIDENAV_DEFAULTS, CNGX_SIDENAV_LANGUAGE_EN, CngxSidenav, CngxSidenavContent, CngxSidenavFooter, CngxSidenavHeader, CngxSidenavLayout, CngxSidenavRouterSync, injectSidenavConfig, injectSidenavLabels, provideSidenavConfig, provideSidenavConfigAt, withSidenavDimensions, withSidenavHoverDwell, withSidenavLabels, withSidenavRouterSync, withSidenavShortcut };
1453
+ export { CNGX_SIDENAV, CNGX_SIDENAV_ANNOUNCER_FACTORY, CNGX_SIDENAV_CONFIG, CNGX_SIDENAV_LANGUAGE_EN, CNGX_SIDENAV_STORAGE, CngxSidenav, CngxSidenavContent, CngxSidenavLayout, CngxSidenavRouterSync, createSidenavAnnouncer, injectSidenavConfig, injectSidenavLabels, provideSidenavConfig, provideSidenavConfigAt, withSidenavDimensions, withSidenavHoverDwell, withSidenavLabels, withSidenavPersistence, withSidenavRouterSync, withSidenavShortcut };
1303
1454
  //# sourceMappingURL=cngx-ui-sidenav.mjs.map