@cngx/ui 0.1.0-rc.3 → 0.1.0-rc.4

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 (37) hide show
  1. package/accordion/README.md +86 -0
  2. package/collection/README.md +167 -0
  3. package/data-grid-accordion/README.md +137 -0
  4. package/fesm2022/cngx-ui-accordion.mjs +853 -0
  5. package/fesm2022/cngx-ui-accordion.mjs.map +1 -0
  6. package/fesm2022/cngx-ui-action-button.mjs +2 -2
  7. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  8. package/fesm2022/cngx-ui-breadcrumb.mjs +1044 -0
  9. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -0
  10. package/fesm2022/cngx-ui-collection.mjs +645 -0
  11. package/fesm2022/cngx-ui-collection.mjs.map +1 -0
  12. package/fesm2022/cngx-ui-data-grid-accordion.mjs +1135 -0
  13. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -0
  14. package/fesm2022/cngx-ui-empty-state.mjs +2 -2
  15. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  16. package/fesm2022/cngx-ui-feedback.mjs +10 -10
  17. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  18. package/fesm2022/cngx-ui-mat-accordion.mjs +229 -0
  19. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -0
  20. package/fesm2022/cngx-ui-paginator.mjs +324 -255
  21. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  22. package/fesm2022/cngx-ui-sidenav.mjs +547 -65
  23. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  24. package/fesm2022/cngx-ui-tabs.mjs +6 -6
  25. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  26. package/fesm2022/cngx-ui.mjs +1 -1
  27. package/mat-accordion/README.md +48 -0
  28. package/package.json +21 -1
  29. package/paginator/README.md +9 -6
  30. package/sidenav/README.md +89 -3
  31. package/types/cngx-ui-accordion.d.ts +801 -0
  32. package/types/cngx-ui-breadcrumb.d.ts +890 -0
  33. package/types/cngx-ui-collection.d.ts +396 -0
  34. package/types/cngx-ui-data-grid-accordion.d.ts +912 -0
  35. package/types/cngx-ui-mat-accordion.d.ts +63 -0
  36. package/types/cngx-ui-paginator.d.ts +258 -146
  37. package/types/cngx-ui-sidenav.d.ts +429 -21
@@ -1,16 +1,119 @@
1
1
  import { DOCUMENT } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { input, model, signal, inject, ElementRef, computed, effect, ViewEncapsulation, ChangeDetectionStrategy, Component, contentChildren, afterNextRender, DestroyRef, Directive } from '@angular/core';
3
+ import { InjectionToken, inject, input, model, signal, computed, linkedSignal, ElementRef, effect, DestroyRef, ViewEncapsulation, ChangeDetectionStrategy, Component, contentChildren, afterNextRender, output, Directive, makeEnvironmentProviders } from '@angular/core';
4
4
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
5
  import { fromEvent } from 'rxjs';
6
+ import { FocusTrapFactory } from '@angular/cdk/a11y';
6
7
  import { parseKeyCombo, matchesKeyCombo } from '@cngx/core/utils';
8
+ import * as i1 from '@cngx/common/interactive';
9
+ import { CngxHoverIntent, CNGX_HOVER_INTENT_DEFAULTS } from '@cngx/common/interactive';
10
+ import { injectQueryParamSync } from '@cngx/common/layout';
7
11
 
8
12
  /**
9
- * Declarative sidebar component that composes drawer, focus trap,
10
- * scroll lock, swipe dismiss, and media query atoms internally.
13
+ * Library defaults for the sidenav configuration cascade. The values are
14
+ * byte-identical to the per-instance input defaults `CngxSidenav` shipped
15
+ * before the cascade (`width '280px'`, `miniWidth '56px'`, `minWidth '120px'`,
16
+ * `maxWidth '600px'`, `enterDelay 120`, `leaveDelay 0`; `responsive` and
17
+ * `shortcut` omitted = `undefined`), so an un-configured consumer sees no
18
+ * change.
11
19
  *
12
- * Supports responsive mode switching, two-way `[(opened)]` binding,
13
- * and content projection via header/footer slots.
20
+ * The `leaveDelay 0` default is kept deliberately (instant collapse, asymmetric
21
+ * with the 120ms enter): the dwell becomes tunable via `[leaveDelay]` /
22
+ * `withSidenavHoverDwell(...)`, not silently changed - the breadcrumb
23
+ * "un-configured consumer sees no change" principle.
24
+ *
25
+ * Exported for intra-lib consumers (`provideSidenavConfig` deep-merges with
26
+ * this base) but **NOT** re-exported from `public-api.ts` - downstream
27
+ * consumers reach the defaults via `inject(CNGX_SIDENAV_CONFIG)` so
28
+ * `provideSidenavConfig` / `provideSidenavConfigAt` overrides take precedence.
29
+ *
30
+ * @internal
31
+ */
32
+ const CNGX_SIDENAV_DEFAULTS = {
33
+ dimensions: {
34
+ width: '280px',
35
+ miniWidth: '56px',
36
+ minWidth: '120px',
37
+ maxWidth: '600px',
38
+ },
39
+ hover: {
40
+ enterDelay: 120,
41
+ leaveDelay: 0,
42
+ },
43
+ // Empty so an un-configured consumer keeps the `'nav'` literal the directive
44
+ // resolves at its use-site - byte-identical to no config.
45
+ routerSync: {},
46
+ };
47
+ /**
48
+ * App-wide configuration cascade for the sidenav family. Resolves in priority
49
+ * order:
50
+ *
51
+ * 1. Per-instance Input binding.
52
+ * 2. `provideSidenavConfigAt(...)` in a parent component's `viewProviders`.
53
+ * 3. `provideSidenavConfig(...)` at the application root.
54
+ * 4. Library defaults (this token's `factory`).
55
+ *
56
+ * `providedIn: 'root'` with a default factory means consumers never need to
57
+ * provide the token explicitly - `inject(CNGX_SIDENAV_CONFIG)` always resolves.
58
+ * Consumers who want overrides call `provideSidenavConfig(...)` in
59
+ * `bootstrapApplication` providers (root cascade) or `provideSidenavConfigAt(...)`
60
+ * in a component's `viewProviders` (sub-tree cascade).
61
+ *
62
+ * @category ui/sidenav
63
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/config/sidenav.config.defaults.ts
64
+ * @since 0.1.0
65
+ */
66
+ const CNGX_SIDENAV_CONFIG = new InjectionToken('CNGX_SIDENAV_CONFIG', {
67
+ providedIn: 'root',
68
+ factory: () => CNGX_SIDENAV_DEFAULTS,
69
+ });
70
+
71
+ /**
72
+ * Convenience accessor for the sidenav configuration cascade. Runs in injection
73
+ * context; resolves through the priority chain (per-instance Input ->
74
+ * `provideSidenavConfigAt` -> `provideSidenavConfig` -> library defaults).
75
+ * Equivalent to `inject(CNGX_SIDENAV_CONFIG)` - the helper exists so consumers
76
+ * don't import the token directly. Mirrors `injectBreadcrumbConfig` in
77
+ * `@cngx/ui/breadcrumb`.
78
+ *
79
+ * ```ts
80
+ * export class CngxSidenav {
81
+ * private readonly cfg = injectSidenavConfig();
82
+ * readonly width = model<string>(this.cfg.dimensions?.width ?? '280px');
83
+ * }
84
+ * ```
85
+ *
86
+ * @category ui/sidenav
87
+ * @since 0.1.0
88
+ */
89
+ function injectSidenavConfig() {
90
+ return inject(CNGX_SIDENAV_CONFIG);
91
+ }
92
+
93
+ /**
94
+ * Contract token for a sidenav rail. `CngxSidenav` provides it via
95
+ * `{ provide: CNGX_SIDENAV, useExisting: CngxSidenav }`, so a collaborator
96
+ * injects the narrow {@link CngxSidenavContract} instead of the concrete class.
97
+ *
98
+ * @category ui/sidenav
99
+ * @since 0.1.0
100
+ * @relatedTo CngxSidenav, CngxSidenavRouterSync
101
+ */
102
+ const CNGX_SIDENAV = new InjectionToken('CNGX_SIDENAV');
103
+
104
+ /**
105
+ * Declarative sidebar component for the four drawer modes (`over`,
106
+ * `push`, `side`, `mini`), with responsive mode switching, two-way
107
+ * `[(opened)]` binding, and content projection via header/footer
108
+ * slots.
109
+ *
110
+ * In overlay (`over`) mode it drives a CDK focus trap directly via
111
+ * `FocusTrapFactory` (the same primitive `CngxFocusTrap` wraps): focus
112
+ * moves into the rail on open and is restored to the opener on close.
113
+ * Responsive switching runs off an inline `matchMedia` listener; the
114
+ * shared backdrop and document scroll lock are coordinated by
115
+ * `CngxSidenavLayout`. It does not compose `CngxDrawer` and has no
116
+ * swipe-to-dismiss.
14
117
  *
15
118
  * Use inside `CngxSidenavLayout` for dual-sidebar support and
16
119
  * shared backdrop coordination.
@@ -40,6 +143,14 @@ import { parseKeyCombo, matchesKeyCombo } from '@cngx/core/utils';
40
143
  * <example-url>http://localhost:4200/#/ui/sidenav/material-theming-light-vs-dark</example-url>
41
144
  */
42
145
  class CngxSidenav {
146
+ /**
147
+ * Resolved sidenav configuration cascade. Seeds the dimension, `responsive`,
148
+ * and `shortcut` input defaults below so a per-instance binding still wins
149
+ * (Controlled+Uncontrolled), an app-wide `provideSidenavConfig(...)` moves the
150
+ * default, and an un-configured consumer keeps the byte-identical literals.
151
+ * Declared first so the input field initialisers can read it.
152
+ */
153
+ cfg = injectSidenavConfig();
43
154
  /** Logical position: `'start'` (default left in LTR) or `'end'` (right in LTR). */
44
155
  position = input('start', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
45
156
  /** Accessible label for the complementary landmark. */
@@ -51,32 +162,64 @@ class CngxSidenav {
51
162
  * When the query matches, mode becomes `'side'` (permanent).
52
163
  * When it doesn't match, mode becomes `'over'` (overlay).
53
164
  */
54
- responsive = input(undefined, ...(ngDevMode ? [{ debugName: "responsive" }] : /* istanbul ignore next */ []));
165
+ responsive = input(this.cfg.responsive, ...(ngDevMode ? [{ debugName: "responsive" }] : /* istanbul ignore next */ []));
55
166
  /** Width of the sidenav panel. Supports two-way `[(width)]` for resize. */
56
- width = model('280px', ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
167
+ width = model(this.cfg.dimensions?.width ?? '280px', ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
57
168
  /** Width of the collapsed rail in `mini` mode. Any CSS value. */
58
- miniWidth = input('56px', ...(ngDevMode ? [{ debugName: "miniWidth" }] : /* istanbul ignore next */ []));
169
+ miniWidth = input(this.cfg.dimensions?.miniWidth ?? '56px', ...(ngDevMode ? [{ debugName: "miniWidth" }] : /* istanbul ignore next */ []));
59
170
  /** Whether hovering the mini rail expands the sidenav to full width. */
60
171
  expandOnHover = input(true, ...(ngDevMode ? [{ debugName: "expandOnHover" }] : /* istanbul ignore next */ []));
61
172
  /** Whether the sidebar is user-resizable via a drag handle. */
62
173
  resizable = input(false, ...(ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []));
63
174
  /** Minimum width constraint during resize. */
64
- minWidth = input('120px', ...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
175
+ minWidth = input(this.cfg.dimensions?.minWidth ?? '120px', ...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
65
176
  /** Maximum width constraint during resize. */
66
- maxWidth = input('600px', ...(ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []));
177
+ maxWidth = input(this.cfg.dimensions?.maxWidth ?? '600px', ...(ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []));
67
178
  /**
68
179
  * Keyboard shortcut to toggle the sidenav, e.g. `'ctrl+b'` or `'meta+b'`.
69
180
  * Uses `ctrl` on Windows/Linux and `meta` (Cmd) on macOS automatically
70
181
  * when `'mod+<key>'` syntax is used.
71
182
  */
72
- shortcut = input(undefined, ...(ngDevMode ? [{ debugName: "shortcut" }] : /* istanbul ignore next */ []));
183
+ shortcut = input(this.cfg.shortcut, ...(ngDevMode ? [{ debugName: "shortcut" }] : /* istanbul ignore next */ []));
73
184
  /** Whether a resize drag is in progress. */
74
185
  resizingState = signal(false, ...(ngDevMode ? [{ debugName: "resizingState" }] : /* istanbul ignore next */ []));
75
186
  resizing = this.resizingState.asReadonly();
76
187
  /** Two-way opened state. Supports `[(opened)]="signal"`. */
77
188
  opened = model(false, ...(ngDevMode ? [{ debugName: "opened" }] : /* istanbul ignore next */ []));
78
- /** Whether the mini-mode rail is currently expanded (hover or programmatic). */
79
- expandedState = signal(false, ...(ngDevMode ? [{ debugName: "expandedState" }] : /* istanbul ignore next */ []));
189
+ /** Debounced mini expand-on-hover, composed as a hostDirective (its own pointer listeners drive it). */
190
+ hoverIntent = inject(CngxHoverIntent, { host: true });
191
+ /**
192
+ * Composed source for `expandedState`: the effective mode, the debounced
193
+ * hover-intent signal, and the on/off switch. Carries an explicit `equal` so
194
+ * the object literal never churns identity and re-runs the computation when
195
+ * none of the three fields actually changed.
196
+ */
197
+ hoverSource = computed(() => ({
198
+ mode: this.effectiveMode(),
199
+ hover: this.hoverIntent.active(),
200
+ enabled: this.expandOnHover(),
201
+ }), { ...(ngDevMode ? { debugName: "hoverSource" } : /* istanbul ignore next */ {}), equal: (a, b) => a.mode === b.mode && a.hover === b.hover && a.enabled === b.enabled });
202
+ /**
203
+ * Whether the mini-mode rail is currently expanded. A pure derivation of
204
+ * `(effectiveMode, hoverIntent.active, expandOnHover)`, not two imperative
205
+ * event-handler writes:
206
+ *
207
+ * - outside `mini` it is always `false`;
208
+ * - with `expandOnHover=true` the debounced hover is the source of truth, so a
209
+ * pointer edge overrides a prior `expand()`/`collapse()` (see `expand()`);
210
+ * - with `expandOnHover=false` hover is ignored and the prior value is kept, so
211
+ * `expand()`/`collapse()` retain full programmatic authority.
212
+ *
213
+ * It stays a writable `linkedSignal` so `expand()`/`collapse()` can `set()` it;
214
+ * the next source change re-derives from the debounced hover.
215
+ */
216
+ expandedState = linkedSignal({ ...(ngDevMode ? { debugName: "expandedState" } : /* istanbul ignore next */ {}), source: this.hoverSource,
217
+ computation: ({ mode, hover, enabled }, prev) => {
218
+ if (mode !== 'mini') {
219
+ return false;
220
+ }
221
+ return enabled ? hover : (prev?.value ?? false);
222
+ } });
80
223
  expanded = this.expandedState.asReadonly();
81
224
  /** @internal Reference to host element for layout positioning. */
82
225
  elementRef = inject((ElementRef));
@@ -91,6 +234,8 @@ class CngxSidenav {
91
234
  }, ...(ngDevMode ? [{ debugName: "effectiveMode" }] : /* istanbul ignore next */ []));
92
235
  /** Whether this sidenav is in overlay mode (over). */
93
236
  isOverlay = computed(() => this.effectiveMode() === 'over', ...(ngDevMode ? [{ debugName: "isOverlay" }] : /* istanbul ignore next */ []));
237
+ /** Whether the sidenav is currently a modal overlay: overlay mode and open. */
238
+ overlayActive = computed(() => this.isOverlay() && this.opened(), ...(ngDevMode ? [{ debugName: "overlayActive" }] : /* istanbul ignore next */ []));
94
239
  /** Resolved width - mini mode uses miniWidth unless expanded. */
95
240
  effectiveWidth = computed(() => {
96
241
  if (this.effectiveMode() === 'mini' && !this.expandedState()) {
@@ -100,9 +245,62 @@ class CngxSidenav {
100
245
  }, ...(ngDevMode ? [{ debugName: "effectiveWidth" }] : /* istanbul ignore next */ []));
101
246
  doc = inject(DOCUMENT);
102
247
  win = this.doc.defaultView;
103
- /** Tracks the previous effective mode to detect transitions. */
104
- prevMode = signal(undefined, ...(ngDevMode ? [{ debugName: "prevMode" }] : /* istanbul ignore next */ []));
248
+ /**
249
+ * Current/previous effective-mode pair for transition detection. Mirrors the
250
+ * `createTransitionTracker` shape from `@cngx/core/utils`, inlined because that
251
+ * helper is typed to `AsyncStatus`; `SidenavMode` needs the same `linkedSignal`
252
+ * pattern. Replaces the hand-rolled `prevMode` signal that was `.set()` inside
253
+ * the mode effect.
254
+ */
255
+ modeTransition = linkedSignal({ ...(ngDevMode ? { debugName: "modeTransition" } : /* istanbul ignore next */ {}), source: () => this.effectiveMode(),
256
+ computation: (current, prev) => ({ current, previous: prev?.value.current }),
257
+ equal: (a, b) => a.current === b.current && a.previous === b.previous });
258
+ /** CDK focus trap over the host; enabled only while a modal overlay is open. */
259
+ focusTrap;
260
+ /** Element that held focus when the overlay opened, restored to it on close. */
261
+ restoreTarget = null;
262
+ /**
263
+ * Set when the mode-transition effect auto-opens an overlay (a viewport-driven
264
+ * `side`/`mini` -> `over` switch). The focus effect reads it to enable the trap
265
+ * without pulling focus into the rail, since that open was not user-initiated.
266
+ */
267
+ autoOpenInFlight = false;
268
+ /** Aborts the in-flight resize drag's document listeners (pointerup or teardown). */
269
+ resizeAbort = null;
105
270
  constructor() {
271
+ this.focusTrap = inject(FocusTrapFactory).create(this.elementRef.nativeElement);
272
+ // Modal-overlay focus contract: on the open edge move focus into the rail
273
+ // and trap it; on the close edge restore focus to whatever opened it, after
274
+ // the DOM settles. overlayActive is the single tracked trigger; restoreTarget
275
+ // is a plain field, not a signal, so this stays a pure side-effect and never
276
+ // feeds a write back into the reactive graph.
277
+ let wasOverlayActive = false;
278
+ effect(() => {
279
+ const active = this.overlayActive();
280
+ this.focusTrap.enabled = active;
281
+ if (active && !wasOverlayActive) {
282
+ // Only pull focus into the rail when the open was user-initiated. An
283
+ // auto-open driven by a responsive mode switch (viewport resize) engages
284
+ // the trap - the rail is now modal - but must not steal focus.
285
+ const viaAutoOpen = this.autoOpenInFlight;
286
+ this.autoOpenInFlight = false;
287
+ if (!viaAutoOpen) {
288
+ const activeEl = this.doc.activeElement;
289
+ this.restoreTarget = activeEl instanceof HTMLElement ? activeEl : null;
290
+ void this.focusTrap.focusFirstTabbableElementWhenReady();
291
+ }
292
+ }
293
+ else if (!active && wasOverlayActive) {
294
+ const target = this.restoreTarget;
295
+ this.restoreTarget = null;
296
+ queueMicrotask(() => target?.focus());
297
+ }
298
+ wasOverlayActive = active;
299
+ });
300
+ inject(DestroyRef).onDestroy(() => {
301
+ this.focusTrap.destroy();
302
+ this.resizeAbort?.abort();
303
+ });
106
304
  effect((onCleanup) => {
107
305
  const query = this.responsive();
108
306
  const win = this.win;
@@ -133,21 +331,23 @@ class CngxSidenav {
133
331
  this.doc.addEventListener('keydown', handler);
134
332
  onCleanup(() => this.doc.removeEventListener('keydown', handler));
135
333
  });
136
- // Plain signal for prev mode, linkedSignal updates eagerly before the
137
- // effect reads it and the prev/current compare collapses.
334
+ // Residual transition side-effect, not a derivation: opened is a consumer
335
+ // model() the user can still toggle, so leaving an always-visible mode for an
336
+ // overlay mode auto-opens the rail once. Guarded by the current/previous
337
+ // compare so it fires only on the transition edge.
138
338
  effect(() => {
139
- const mode = this.effectiveMode();
140
- const prev = this.prevMode();
141
- if (prev !== undefined) {
142
- const alwaysVisible = (m) => m === 'side' || m === 'mini';
143
- if (alwaysVisible(prev) && !alwaysVisible(mode)) {
144
- this.opened.set(true);
145
- }
146
- if (prev === 'mini' && mode !== 'mini') {
147
- this.expandedState.set(false);
148
- }
339
+ const { current, previous } = this.modeTransition();
340
+ if (previous === undefined || current === previous) {
341
+ return;
342
+ }
343
+ const alwaysVisible = (m) => m === 'side' || m === 'mini';
344
+ if (alwaysVisible(previous) && !alwaysVisible(current)) {
345
+ // Flag only overlay auto-opens so the focus effect skips the focus-move.
346
+ // `over` is the only overlay mode; a `push` auto-open never raises
347
+ // overlayActive, so it must not leave the flag stuck for a later open.
348
+ this.autoOpenInFlight = current === 'over';
349
+ this.opened.set(true);
149
350
  }
150
- this.prevMode.set(mode);
151
351
  });
152
352
  }
153
353
  /** Opens the sidenav. */
@@ -176,26 +376,26 @@ class CngxSidenav {
176
376
  this.close();
177
377
  }
178
378
  }
179
- /** Expand the mini rail to full width. */
379
+ /**
380
+ * Expand the mini rail to full width.
381
+ *
382
+ * When `expandOnHover=true` (the default) the debounced hover is the source of
383
+ * truth for `expanded`, so a programmatic `expand()` is transient: the next
384
+ * pointer edge overrides it. For authoritative programmatic control set
385
+ * `expandOnHover=false`, which hands `expand()`/`collapse()` full authority.
386
+ */
180
387
  expand() {
181
388
  this.expandedState.set(true);
182
389
  }
183
- /** Collapse the expanded mini rail back to miniWidth. */
390
+ /**
391
+ * Collapse the expanded mini rail back to miniWidth.
392
+ *
393
+ * Same reconciliation as `expand()`: transient while `expandOnHover=true`,
394
+ * authoritative while `expandOnHover=false`.
395
+ */
184
396
  collapse() {
185
397
  this.expandedState.set(false);
186
398
  }
187
- /** @internal */
188
- handleMouseEnter() {
189
- if (this.effectiveMode() === 'mini' && this.expandOnHover()) {
190
- this.expandedState.set(true);
191
- }
192
- }
193
- /** @internal */
194
- handleMouseLeave() {
195
- if (this.effectiveMode() === 'mini') {
196
- this.expandedState.set(false);
197
- }
198
- }
199
399
  /** @internal Parse a CSS px value to a number. */
200
400
  widthPx = computed(() => Number.parseInt(this.width(), 10) || 280, ...(ngDevMode ? [{ debugName: "widthPx" }] : /* istanbul ignore next */ []));
201
401
  minWidthPx = computed(() => Number.parseInt(this.minWidth(), 10) || 120, ...(ngDevMode ? [{ debugName: "minWidthPx" }] : /* istanbul ignore next */ []));
@@ -216,6 +416,11 @@ class CngxSidenav {
216
416
  const max = this.maxWidthPx();
217
417
  let currentWidth = startWidth;
218
418
  let rafId = 0;
419
+ // One controller per drag removes both document listeners in a single abort:
420
+ // on pointerup below, and - critically - if the component is torn down
421
+ // mid-drag (the onDestroy hook aborts this.resizeAbort).
422
+ const controller = new AbortController();
423
+ this.resizeAbort = controller;
219
424
  const onMove = (ev) => {
220
425
  const delta = isEnd ? startX - ev.clientX : ev.clientX - startX;
221
426
  currentWidth = Math.round(Math.max(min, Math.min(max, startWidth + delta)));
@@ -232,14 +437,17 @@ class CngxSidenav {
232
437
  this.resizingState.set(false);
233
438
  // Single CD on pointerup - model catches up with the DOM.
234
439
  this.width.set(`${currentWidth}px`);
235
- this.doc.removeEventListener('pointermove', onMove);
236
- this.doc.removeEventListener('pointerup', onUp);
440
+ controller.abort();
441
+ this.resizeAbort = null;
237
442
  };
238
- this.doc.addEventListener('pointermove', onMove);
239
- this.doc.addEventListener('pointerup', onUp);
443
+ this.doc.addEventListener('pointermove', onMove, { signal: controller.signal });
444
+ this.doc.addEventListener('pointerup', onUp, { signal: controller.signal });
240
445
  }
241
446
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenav, deps: [], target: i0.ɵɵFactoryTarget.Component });
242
- 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 }, responsive: { classPropertyName: "responsive", publicName: "responsive", 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 }, 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()", "mouseenter": "handleMouseEnter()", "mouseleave": "handleMouseLeave()" }, 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()", "style.--cngx-sidenav-width": "effectiveWidth()", "style.--cngx-sidenav-mini-width": "miniWidth()", "attr.aria-label": "ariaLabel() || null" } }, exportAs: ["cngxSidenav"], ngImport: i0, template: `
447
+ 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 }, responsive: { classPropertyName: "responsive", publicName: "responsive", 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 }, 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: [
448
+ { provide: CNGX_HOVER_INTENT_DEFAULTS, useFactory: () => injectSidenavConfig().hover ?? {} },
449
+ { provide: CNGX_SIDENAV, useExisting: CngxSidenav },
450
+ ], exportAs: ["cngxSidenav"], hostDirectives: [{ directive: i1.CngxHoverIntent, inputs: ["enterDelay", "expandDelay", "leaveDelay", "collapseDelay"] }], ngImport: i0, template: `
243
451
  <ng-content select="cngx-sidenav-header, [cngxSidenavHeader]" />
244
452
  <div class="cngx-sidenav__body">
245
453
  <ng-content />
@@ -256,17 +464,19 @@ class CngxSidenav {
256
464
  [attr.aria-valuemax]="maxWidthPx()"
257
465
  ></div>
258
466
  }
259
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
467
+ `, 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;}@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-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{left:0;transform:translate(-100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end{right:0;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-right:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--expanded.cngx-sidenav--end{margin-left:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--start{border-right: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-left: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);opacity:.7}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 .15s,color .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{position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-resize-handle-width, 4px);cursor:col-resize;z-index:4;background:transparent;transition:background .15s;touch-action:none}.cngx-sidenav--start .cngx-sidenav__resize-handle{right:0;transform:translate(50%)}.cngx-sidenav--end .cngx-sidenav__resize-handle{left:0;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.cngx-sidenav--resizing{transition:none!important;-webkit-user-select:none;user-select:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
260
468
  }
261
469
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenav, decorators: [{
262
470
  type: Component,
263
- args: [{
264
- selector: 'cngx-sidenav',
265
- exportAs: 'cngxSidenav',
266
- standalone: true,
267
- changeDetection: ChangeDetectionStrategy.OnPush,
268
- encapsulation: ViewEncapsulation.None,
269
- host: {
471
+ args: [{ selector: 'cngx-sidenav', exportAs: 'cngxSidenav', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, hostDirectives: [
472
+ {
473
+ directive: CngxHoverIntent,
474
+ inputs: ['enterDelay: expandDelay', 'leaveDelay: collapseDelay'],
475
+ },
476
+ ], providers: [
477
+ { provide: CNGX_HOVER_INTENT_DEFAULTS, useFactory: () => injectSidenavConfig().hover ?? {} },
478
+ { provide: CNGX_SIDENAV, useExisting: CngxSidenav },
479
+ ], host: {
270
480
  '[class.cngx-sidenav]': 'true',
271
481
  '[class.cngx-sidenav--start]': "position() === 'start'",
272
482
  '[class.cngx-sidenav--end]': "position() === 'end'",
@@ -279,15 +489,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
279
489
  '[class.cngx-sidenav--resizable]': 'resizable()',
280
490
  '[class.cngx-sidenav--resizing]': 'resizing()',
281
491
  '[attr.aria-hidden]': "effectiveMode() === 'side' || effectiveMode() === 'mini' ? null : !opened()",
492
+ '[attr.aria-modal]': "overlayActive() ? 'true' : null",
282
493
  '[style.--cngx-sidenav-width]': 'effectiveWidth()',
283
494
  '[style.--cngx-sidenav-mini-width]': 'miniWidth()',
284
495
  role: 'complementary',
285
496
  '[attr.aria-label]': 'ariaLabel() || null',
286
497
  '(keydown.escape)': 'closeIfOverlay()',
287
- '(mouseenter)': 'handleMouseEnter()',
288
- '(mouseleave)': 'handleMouseLeave()',
289
- },
290
- template: `
498
+ }, template: `
291
499
  <ng-content select="cngx-sidenav-header, [cngxSidenavHeader]" />
292
500
  <div class="cngx-sidenav__body">
293
501
  <ng-content />
@@ -304,8 +512,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
304
512
  [attr.aria-valuemax]="maxWidthPx()"
305
513
  ></div>
306
514
  }
307
- `,
308
- }]
515
+ `, 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;}@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-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{left:0;transform:translate(-100%)}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end{right:0;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-right:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--expanded.cngx-sidenav--end{margin-left:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--start{border-right: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-left: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);opacity:.7}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 .15s,color .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{position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-resize-handle-width, 4px);cursor:col-resize;z-index:4;background:transparent;transition:background .15s;touch-action:none}.cngx-sidenav--start .cngx-sidenav__resize-handle{right:0;transform:translate(50%)}.cngx-sidenav--end .cngx-sidenav__resize-handle{left:0;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.cngx-sidenav--resizing{transition:none!important;-webkit-user-select:none;user-select:none}}\n"] }]
309
516
  }], 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 }] }], responsive: [{ type: i0.Input, args: [{ isSignal: true, alias: "responsive", 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 }] }], 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"] }] } });
310
517
 
311
518
  /**
@@ -381,7 +588,10 @@ class CngxSidenavLayout {
381
588
  delete html.dataset['cngxPrevScrollbarGutter'];
382
589
  }
383
590
  });
384
- fromEvent(doc, 'click')
591
+ // Dismiss on pointerdown, not click: an external open-trigger's pointerdown
592
+ // fires before the click that flips opened(), so hasOverlay() is still false
593
+ // here at that point and the same-gesture open cannot self-close.
594
+ fromEvent(doc, 'pointerdown')
385
595
  .pipe(takeUntilDestroyed())
386
596
  .subscribe((e) => {
387
597
  if (!this.hasOverlay()) {
@@ -412,7 +622,7 @@ class CngxSidenavLayout {
412
622
  @if (hasOverlay()) {
413
623
  <div class="cngx-sidenav-backdrop" (click)="closeAllOverlays()"></div>
414
624
  }
415
- `, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-sidenav-width{syntax: \"<length>\"; inherits: false; 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;}@property --cngx-sidenav-transition-easing{syntax: \"*\"; inherits: false; initial-value: ease;}@property --cngx-sidenav-mini-width{syntax: \"<length>\"; inherits: false; 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: false; 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-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: false; 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-layout{display:flex;position:relative;width:100%;min-height:inherit;overflow:hidden}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{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){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}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--start{left:0}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end{right:0}cngx-sidenav.cngx-sidenav--push,cngx-sidenav.cngx-sidenav--side,cngx-sidenav.cngx-sidenav--mini{position:relative}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--open{width:var(--cngx-sidenav-mini-width, 56px);visibility:visible;transition:none}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--open.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))}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--open.cngx-sidenav--expanded.cngx-sidenav--start{margin-right:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--open.cngx-sidenav--expanded.cngx-sidenav--end{margin-left:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--start{border-right: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-left: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);opacity:.7}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 .15s,color .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{position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-resize-handle-width, 4px);cursor:col-resize;z-index:4;background:transparent;transition:background .15s;touch-action:none}.cngx-sidenav--start .cngx-sidenav__resize-handle{right:0;transform:translate(50%)}.cngx-sidenav--end .cngx-sidenav__resize-handle{left:0;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.cngx-sidenav--resizing{transition:none!important;-webkit-user-select:none;user-select:none}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 });
625
+ `, isInline: true, styles: ["@layer cngx.components{cngx-sidenav-layout{display:flex;position:relative;width:100%;min-height:inherit;overflow:hidden}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 });
416
626
  }
417
627
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavLayout, decorators: [{
418
628
  type: Component,
@@ -427,9 +637,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
427
637
  @if (hasOverlay()) {
428
638
  <div class="cngx-sidenav-backdrop" (click)="closeAllOverlays()"></div>
429
639
  }
430
- `, styles: ["@layer cngx.tokens{@property --cngx-sidenav-width{syntax: \"<length>\"; inherits: false; 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;}@property --cngx-sidenav-transition-easing{syntax: \"*\"; inherits: false; initial-value: ease;}@property --cngx-sidenav-mini-width{syntax: \"<length>\"; inherits: false; 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: false; 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-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: false; 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-layout{display:flex;position:relative;width:100%;min-height:inherit;overflow:hidden}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{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){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}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--start{left:0}cngx-sidenav.cngx-sidenav--over.cngx-sidenav--end{right:0}cngx-sidenav.cngx-sidenav--push,cngx-sidenav.cngx-sidenav--side,cngx-sidenav.cngx-sidenav--mini{position:relative}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--open{width:var(--cngx-sidenav-mini-width, 56px);visibility:visible;transition:none}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--open.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))}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--open.cngx-sidenav--expanded.cngx-sidenav--start{margin-right:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--mini.cngx-sidenav--open.cngx-sidenav--expanded.cngx-sidenav--end{margin-left:calc(var(--cngx-sidenav-mini-width, 56px) - var(--cngx-sidenav-width, 280px))}cngx-sidenav.cngx-sidenav--start{border-right: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-left: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);opacity:.7}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 .15s,color .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{position:absolute;top:0;bottom:0;width:var(--cngx-sidenav-resize-handle-width, 4px);cursor:col-resize;z-index:4;background:transparent;transition:background .15s;touch-action:none}.cngx-sidenav--start .cngx-sidenav__resize-handle{right:0;transform:translate(50%)}.cngx-sidenav--end .cngx-sidenav__resize-handle{left:0;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.cngx-sidenav--resizing{transition:none!important;-webkit-user-select:none;user-select:none}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"] }]
640
+ `, styles: ["@layer cngx.components{cngx-sidenav-layout{display:flex;position:relative;width:100%;min-height:inherit;overflow:hidden}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"] }]
431
641
  }], ctorParameters: () => [], propDecorators: { sidenavs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxSidenav), { isSignal: true }] }] } });
432
642
 
643
+ /**
644
+ * Deep-links a sidenav's open state into a query param. Opt-in via
645
+ * `[cngxSidenavRouterSync]` on a `<cngx-sidenav>`: opening writes `?nav=open`,
646
+ * an initial `?nav=open` hydrates it open, closing removes the param, and
647
+ * browser back/forward re-hydrates it. A thin caller over
648
+ * `injectQueryParamSync` - it reaches the rail through the {@link CNGX_SIDENAV}
649
+ * contract token, never the concrete class.
650
+ *
651
+ * The `param` default cascades: per-instance `[param]` wins, then
652
+ * `withSidenavRouterSync({ param })` on `CNGX_SIDENAV_CONFIG`, then the `'nav'`
653
+ * literal. Without `@angular/router` the kernel dev-warns once and no-ops.
654
+ *
655
+ * @category ui/sidenav
656
+ * @docsKind primary
657
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/sidenav/sidenav-router-sync.directive.ts
658
+ * @since 0.1.0
659
+ * @relatedTo CngxSidenav, CNGX_SIDENAV, injectQueryParamSync
660
+ * <example-url>http://localhost:4200/#/ui/sidenav/router-sync/deep-linkable-overlay</example-url>
661
+ */
662
+ class CngxSidenavRouterSync {
663
+ sidenav = inject(CNGX_SIDENAV, { host: true });
664
+ cfg = injectSidenavConfig();
665
+ /**
666
+ * Raw `[param]` input. Read the resolved {@link param} computed instead.
667
+ * @internal
668
+ */
669
+ paramInput = input(undefined, { ...(ngDevMode ? { debugName: "paramInput" } : /* istanbul ignore next */ {}), alias: 'param' });
670
+ /** Resolved query-param key: `[param]` -> config `routerSync.param` -> `'nav'`. */
671
+ param = computed(() => this.paramInput() ?? this.cfg.routerSync?.param ?? 'nav', ...(ngDevMode ? [{ debugName: "param" }] : /* istanbul ignore next */ []));
672
+ /** Emits when a `router.navigate` rejection is observed. Parity with the stepper sibling. */
673
+ syncError = output();
674
+ constructor() {
675
+ // Pass the `param` computed itself, never `this.param()` - a constructor-time
676
+ // read would freeze the resolved value and ignore a later-bound `[param]`.
677
+ injectQueryParamSync(this.sidenav.opened, {
678
+ param: this.param,
679
+ onSyncError: (err) => this.syncError.emit(err),
680
+ });
681
+ }
682
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavRouterSync, deps: [], target: i0.ɵɵFactoryTarget.Directive });
683
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxSidenavRouterSync, isStandalone: true, selector: "[cngxSidenavRouterSync]", inputs: { paramInput: { classPropertyName: "paramInput", publicName: "param", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { syncError: "syncError" }, exportAs: ["cngxSidenavRouterSync"], ngImport: i0 });
684
+ }
685
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSidenavRouterSync, decorators: [{
686
+ type: Directive,
687
+ args: [{
688
+ selector: '[cngxSidenavRouterSync]',
689
+ exportAs: 'cngxSidenavRouterSync',
690
+ standalone: true,
691
+ }]
692
+ }], ctorParameters: () => [], propDecorators: { paramInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "param", required: false }] }], syncError: [{ type: i0.Output, args: ["syncError"] }] } });
693
+
433
694
  /**
434
695
  * Main content area within a `CngxSidenavLayout`.
435
696
  *
@@ -588,6 +849,227 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
588
849
  }]
589
850
  }] });
590
851
 
852
+ /**
853
+ * Reduces a list of feature objects into a partial config - last write wins
854
+ * per sub-tree. The nested `dimensions` / `hover` sub-trees are spread-merged
855
+ * so partial overrides compose cleanly with prior writes.
856
+ *
857
+ * @internal
858
+ */
859
+ function reduceFeatures(features) {
860
+ const out = {};
861
+ for (const f of features) {
862
+ switch (f.kind) {
863
+ case 'dimensions':
864
+ out.dimensions = { ...out.dimensions, ...f.payload };
865
+ break;
866
+ case 'hover':
867
+ out.hover = { ...out.hover, ...f.payload };
868
+ break;
869
+ case 'routerSync':
870
+ out.routerSync = { ...out.routerSync, ...f.payload };
871
+ break;
872
+ case 'responsive':
873
+ out.responsive = f.payload.responsive;
874
+ break;
875
+ case 'shortcut':
876
+ out.shortcut = f.payload.shortcut;
877
+ break;
878
+ }
879
+ }
880
+ return out;
881
+ }
882
+ /**
883
+ * Two-level deep merge: the nested sub-tree keys (`dimensions` / `hover`) are
884
+ * spread-merged so the partial fills in missing keys without nuking unrelated
885
+ * config sub-trees; the flat top-level scalars (`responsive` / `shortcut`) take
886
+ * the partial when present, else the base. Inner objects are flat (one level),
887
+ * so a single spread per key suffices. Invariant: a config key nested more than
888
+ * one level deep would shallow-merge silently here - if the config ever grows a
889
+ * deeper sub-tree, add a dedicated spread for it rather than relying on this
890
+ * pass.
891
+ *
892
+ * @internal
893
+ */
894
+ function mergeConfig(base, partial) {
895
+ return {
896
+ dimensions: { ...base.dimensions, ...partial.dimensions },
897
+ hover: { ...base.hover, ...partial.hover },
898
+ routerSync: { ...base.routerSync, ...partial.routerSync },
899
+ responsive: partial.responsive ?? base.responsive,
900
+ shortcut: partial.shortcut ?? base.shortcut,
901
+ };
902
+ }
903
+ /**
904
+ * Application-root configuration cascade for the sidenav family. Pass any
905
+ * combination of `withSidenavDimensions`, `withSidenavResponsive`,
906
+ * `withSidenavShortcut`, `withSidenavHoverDwell`, and `withSidenavRouterSync`
907
+ * features in `bootstrapApplication`'s providers array.
908
+ *
909
+ * Resolution priority (high -> low):
910
+ * 1. Per-instance Input binding.
911
+ * 2. `provideSidenavConfigAt(...)` in a parent component's `viewProviders`.
912
+ * 3. `provideSidenavConfig(...)` at the application root.
913
+ * 4. Library defaults (`CNGX_SIDENAV_DEFAULTS`).
914
+ *
915
+ * The provider deep-merges supplied features with the library defaults so
916
+ * consumers only declare keys they want to override.
917
+ *
918
+ * ```ts
919
+ * bootstrapApplication(AppComponent, {
920
+ * providers: [
921
+ * provideSidenavConfig(
922
+ * withSidenavDimensions({ width: '320px' }),
923
+ * withSidenavShortcut('mod+b'),
924
+ * ),
925
+ * ],
926
+ * });
927
+ * ```
928
+ *
929
+ * @category ui/sidenav
930
+ * @since 0.1.0
931
+ */
932
+ function provideSidenavConfig(...features) {
933
+ // Empty-features: skip the override so the root factory's
934
+ // CNGX_SIDENAV_DEFAULTS reference flows through untouched. A fresh
935
+ // mergeConfig(...) would allocate identical content under a new reference and
936
+ // bust downstream identity comparisons.
937
+ if (features.length === 0) {
938
+ return makeEnvironmentProviders([]);
939
+ }
940
+ const partial = reduceFeatures(features);
941
+ return makeEnvironmentProviders([
942
+ {
943
+ provide: CNGX_SIDENAV_CONFIG,
944
+ useValue: mergeConfig(CNGX_SIDENAV_DEFAULTS, partial),
945
+ },
946
+ ]);
947
+ }
948
+ /**
949
+ * Component-scoped configuration cascade for the sidenav family. Pass any
950
+ * combination of feature factories in a parent component's `viewProviders`
951
+ * array.
952
+ *
953
+ * Unlike `provideSidenavConfig` (root-only), `provideSidenavConfigAt` injects
954
+ * the parent injector's `CNGX_SIDENAV_CONFIG` value (resolves through the
955
+ * priority chain - root provider, library defaults, or another
956
+ * `provideSidenavConfigAt` further up) and deep-merges the supplied features on
957
+ * top. Descendant sidenav instances see the merged config; sibling sub-trees
958
+ * keep the inherited value untouched.
959
+ *
960
+ * ```ts
961
+ * @Component({
962
+ * viewProviders: [
963
+ * provideSidenavConfigAt(withSidenavDimensions({ width: '320px' })),
964
+ * ],
965
+ * template: '<cngx-sidenav>...</cngx-sidenav>',
966
+ * })
967
+ * class Section {}
968
+ * ```
969
+ *
970
+ * @category ui/sidenav
971
+ * @since 0.1.0
972
+ */
973
+ function provideSidenavConfigAt(...features) {
974
+ // Empty-features call: parent value flows through untouched. Skipping the
975
+ // factory preserves reference identity through the sub-tree.
976
+ if (features.length === 0) {
977
+ return [];
978
+ }
979
+ const partial = reduceFeatures(features);
980
+ return [
981
+ {
982
+ provide: CNGX_SIDENAV_CONFIG,
983
+ useFactory: () => {
984
+ const parent = inject(CNGX_SIDENAV_CONFIG, { skipSelf: true });
985
+ return mergeConfig(parent, partial);
986
+ },
987
+ },
988
+ ];
989
+ }
990
+
991
+ /**
992
+ * Override the sidenav family's panel dimensions - `width`, `miniWidth`,
993
+ * `minWidth`, and `maxWidth`. Per-instance `[width]` / `[miniWidth]` /
994
+ * `[minWidth]` / `[maxWidth]` bindings still win over the cascade; this only
995
+ * moves the defaults. Partial payloads deep-merge, so pass only the keys you
996
+ * want to change.
997
+ *
998
+ * ```ts
999
+ * provideSidenavConfig(withSidenavDimensions({ width: '320px', miniWidth: '64px' }));
1000
+ * ```
1001
+ *
1002
+ * @category ui/sidenav
1003
+ * @since 0.1.0
1004
+ */
1005
+ function withSidenavDimensions(payload) {
1006
+ return { kind: 'dimensions', payload };
1007
+ }
1008
+ /**
1009
+ * Set the app-wide default CSS media-query string for responsive mode
1010
+ * switching. When the query matches, the sidenav resolves to `'side'`;
1011
+ * otherwise it falls back to its `mode`. Per-instance `[responsive]` still
1012
+ * wins.
1013
+ *
1014
+ * ```ts
1015
+ * provideSidenavConfig(withSidenavResponsive('(min-width: 1024px)'));
1016
+ * ```
1017
+ *
1018
+ * @category ui/sidenav
1019
+ * @since 0.1.0
1020
+ */
1021
+ function withSidenavResponsive(query) {
1022
+ return { kind: 'responsive', payload: { responsive: query } };
1023
+ }
1024
+ /**
1025
+ * Set the app-wide default keyboard shortcut to toggle the sidenav (e.g.
1026
+ * `'mod+b'`, which resolves to `ctrl` on Windows/Linux and `meta` on macOS).
1027
+ * Per-instance `[shortcut]` still wins.
1028
+ *
1029
+ * ```ts
1030
+ * provideSidenavConfig(withSidenavShortcut('mod+b'));
1031
+ * ```
1032
+ *
1033
+ * @category ui/sidenav
1034
+ * @since 0.1.0
1035
+ */
1036
+ function withSidenavShortcut(combo) {
1037
+ return { kind: 'shortcut', payload: { shortcut: combo } };
1038
+ }
1039
+ /**
1040
+ * Set the app-wide default mini expand-on-hover dwell - `enterDelay` (ms before
1041
+ * the rail expands) and `leaveDelay` (ms before it collapses). Flows into the
1042
+ * composed `CngxHoverIntent` via `CNGX_HOVER_INTENT_DEFAULTS`. Per-instance
1043
+ * `[enterDelay]` / `[leaveDelay]` still win; the shipped literals (120 / 0)
1044
+ * apply when neither is set. Partial payloads deep-merge, so pass only the key
1045
+ * you want to change.
1046
+ *
1047
+ * ```ts
1048
+ * provideSidenavConfig(withSidenavHoverDwell({ enterDelay: 200, leaveDelay: 150 }));
1049
+ * ```
1050
+ *
1051
+ * @category ui/sidenav
1052
+ * @since 0.1.0
1053
+ */
1054
+ function withSidenavHoverDwell(payload) {
1055
+ return { kind: 'hover', payload };
1056
+ }
1057
+ /**
1058
+ * Set the app-wide default query-param key for `[cngxSidenavRouterSync]` - the
1059
+ * param the sidenav's `opened` state deep-links to. Per-instance `[param]`
1060
+ * still wins; the `'nav'` literal applies when neither is set.
1061
+ *
1062
+ * ```ts
1063
+ * provideSidenavConfig(withSidenavRouterSync({ param: 'menu' }));
1064
+ * ```
1065
+ *
1066
+ * @category ui/sidenav
1067
+ * @since 0.1.0
1068
+ */
1069
+ function withSidenavRouterSync(payload) {
1070
+ return { kind: 'routerSync', payload };
1071
+ }
1072
+
591
1073
  /**
592
1074
  * @module @cngx/ui/sidenav
593
1075
  */
@@ -596,5 +1078,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
596
1078
  * Generated bundle index. Do not edit.
597
1079
  */
598
1080
 
599
- export { CngxSidenav, CngxSidenavContent, CngxSidenavFooter, CngxSidenavHeader, CngxSidenavLayout };
1081
+ export { CNGX_SIDENAV, CNGX_SIDENAV_CONFIG, CngxSidenav, CngxSidenavContent, CngxSidenavFooter, CngxSidenavHeader, CngxSidenavLayout, CngxSidenavRouterSync, injectSidenavConfig, provideSidenavConfig, provideSidenavConfigAt, withSidenavDimensions, withSidenavHoverDwell, withSidenavResponsive, withSidenavRouterSync, withSidenavShortcut };
600
1082
  //# sourceMappingURL=cngx-ui-sidenav.mjs.map