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