@cngx/common 0.1.0-rc.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/README.md +15 -2
- package/button/README.md +258 -0
- package/command/README.md +42 -2
- package/data/README.md +15 -12
- package/fesm2022/cngx-common-a11y.mjs +1076 -319
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +99 -77
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-button.mjs +1084 -0
- package/fesm2022/cngx-common-button.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +138 -78
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +799 -327
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +101 -25
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +861 -423
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +198 -160
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +693 -329
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7303 -2774
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2174 -442
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-menu-button.mjs +557 -0
- package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +2109 -557
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +548 -419
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +442 -331
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +44 -71
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +10 -10
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +30 -19
- package/layout/README.md +17 -1
- package/menu-button/README.md +234 -0
- package/package.json +31 -8
- package/popover/README.md +81 -4
- package/popover/tooltip-indicator.scss +52 -0
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +96 -0
- package/schematics/package.json +3 -0
- package/stepper/README.md +5 -5
- package/theming/components/cngx-accordion.css +36 -7
- package/theming/components/cngx-async.css +185 -37
- package/theming/components/cngx-backdrop.css +3 -1
- package/theming/components/cngx-badge.css +20 -5
- package/theming/components/cngx-bottom-sheet.css +2 -0
- package/theming/components/cngx-breadcrumb.css +3 -1
- package/theming/components/cngx-button-group.css +325 -0
- package/theming/components/cngx-button-toggle.css +55 -23
- package/theming/components/cngx-button.css +975 -0
- package/theming/components/cngx-data-grid.css +2 -0
- package/theming/components/cngx-dialog.css +3 -1
- package/theming/components/cngx-divider.css +24 -9
- package/theming/components/cngx-drawer.css +153 -0
- package/theming/components/cngx-icon-glyph.css +76 -0
- package/theming/components/cngx-listbox.css +79 -25
- package/theming/components/cngx-menu.css +112 -52
- package/theming/components/cngx-nav.css +1220 -0
- package/theming/components/cngx-popover-sheet.css +434 -0
- package/theming/components/cngx-popover.css +37 -9
- package/theming/components/cngx-recycler-placeholder.css +2 -0
- package/theming/components/cngx-ripple.css +74 -16
- package/theming/components/cngx-sidebar.css +71 -0
- package/theming/components/cngx-slider.css +3 -1
- package/theming/components/cngx-tooltip.css +2 -0
- package/timeline/README.md +2 -2
- package/types/cngx-common-a11y.d.ts +488 -112
- package/types/cngx-common-audio.d.ts +60 -88
- package/types/cngx-common-button.d.ts +698 -0
- package/types/cngx-common-card.d.ts +104 -78
- package/types/cngx-common-chart.d.ts +677 -389
- package/types/cngx-common-command.d.ts +55 -41
- package/types/cngx-common-data.d.ts +506 -360
- package/types/cngx-common-dialog.d.ts +94 -127
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4383 -1721
- package/types/cngx-common-layout.d.ts +1399 -288
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +990 -268
- package/types/cngx-common-stepper.d.ts +374 -465
- package/types/cngx-common-tabs.d.ts +309 -403
- package/types/cngx-common-timeline.d.ts +50 -109
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { InjectionToken, Signal, OnInit, OnChanges, ElementRef, WritableSignal, DestroyRef, TemplateRef, Provider } from '@angular/core';
|
|
3
3
|
import * as i1 from '@cngx/common/a11y';
|
|
4
|
+
import { CngxFocusTrapDriver, CngxFocusRestoreDriver } from '@cngx/common/a11y';
|
|
5
|
+
import * as i2 from '@cngx/common/interactive';
|
|
6
|
+
import { CngxClickOutsideDriver, CngxHotkeyScopeNode, CngxHoverIntentDriver } from '@cngx/common/interactive';
|
|
7
|
+
import * as _cngx_common_layout from '@cngx/common/layout';
|
|
8
|
+
import * as i2$1 from '@cngx/common/button';
|
|
9
|
+
import { CngxMessage } from '@cngx/core/i18n';
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
12
|
* Manages backdrop overlay behavior: visibility, click-to-close, and
|
|
@@ -10,13 +16,18 @@ import * as i1 from '@cngx/common/a11y';
|
|
|
10
16
|
* attribute, preventing focus and interaction behind the backdrop.
|
|
11
17
|
* This is critical for a11y in modal/drawer overlays. A sibling drawer
|
|
12
18
|
* panel (`.cngx-drawer-panel`) is excluded - it is the surface the
|
|
13
|
-
* backdrop guards, not content behind it.
|
|
19
|
+
* backdrop guards, not content behind it. Focus-trap anchors (the
|
|
20
|
+
* panel's trap would stop wrapping) and live regions (announcements would
|
|
21
|
+
* go silent) stay live too; a sibling that only contains a live region has
|
|
22
|
+
* its other children inerted instead. Siblings that already carry
|
|
14
23
|
* `inert` are left alone, so a consumer-set `inert` survives the
|
|
15
24
|
* show/hide cycle. The sibling set is re-queried on every show, so
|
|
16
25
|
* siblings rendered after init are covered too.
|
|
17
26
|
*
|
|
18
27
|
* The directive is purely behavioral - it toggles the
|
|
19
|
-
* `.cngx-backdrop--visible` class and `aria-hidden` attribute
|
|
28
|
+
* `.cngx-backdrop--visible` class and `aria-hidden` attribute, and marks
|
|
29
|
+
* its host with `data-cngx-backdrop`, which keeps it live under the inert
|
|
30
|
+
* set of a page-modal drawer so its `backdropClick` still fires. Visual
|
|
20
31
|
* styling is opt-in: either consume the shipped default stylesheet or
|
|
21
32
|
* provide your own.
|
|
22
33
|
*
|
|
@@ -60,12 +71,12 @@ import * as i1 from '@cngx/common/a11y';
|
|
|
60
71
|
* }
|
|
61
72
|
* ```
|
|
62
73
|
*
|
|
63
|
-
* @category common/layout
|
|
64
74
|
* @wcag AA
|
|
65
75
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/drawer/backdrop.directive.ts
|
|
66
|
-
* @since 0.
|
|
76
|
+
* @since 0.3.0
|
|
67
77
|
* @relatedTo CngxDrawer, CngxDrawerPanel, CngxScrollLock
|
|
68
|
-
* <example-url
|
|
78
|
+
* <example-url>/#/common/layout/backdrop/overlay-with-inert</example-url>
|
|
79
|
+
* @axis level atom
|
|
69
80
|
*/
|
|
70
81
|
declare class CngxBackdrop {
|
|
71
82
|
/** Whether the backdrop is visible and siblings are inert. */
|
|
@@ -84,9 +95,509 @@ declare class CngxBackdrop {
|
|
|
84
95
|
}
|
|
85
96
|
|
|
86
97
|
/**
|
|
87
|
-
*
|
|
98
|
+
* How a panel is laid out against its content: `inline` reserves space in
|
|
99
|
+
* the layout (a sidebar), `push` slides in next to the content, `over`
|
|
100
|
+
* slides in on top of it.
|
|
101
|
+
*
|
|
102
|
+
* @since 0.3.0
|
|
103
|
+
*/
|
|
104
|
+
type CngxPanelMode = 'inline' | 'push' | 'over';
|
|
105
|
+
/**
|
|
106
|
+
* The edge a panel sits on. `start` / `end` follow the writing direction,
|
|
107
|
+
* `left` / `right` / `top` / `bottom` are physical.
|
|
108
|
+
*
|
|
109
|
+
* @since 0.3.0
|
|
110
|
+
*/
|
|
111
|
+
type CngxPanelSide = 'start' | 'end' | 'left' | 'right' | 'top' | 'bottom';
|
|
112
|
+
/**
|
|
113
|
+
* The contract a disclosure panel (drawer, sidebar, sidenav) offers its
|
|
114
|
+
* triggers. A trigger mirrors it and owns no state.
|
|
115
|
+
*
|
|
116
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/panel-trigger/panel-target.ts
|
|
117
|
+
* @since 0.3.0
|
|
118
|
+
* @relatedTo CngxPanelTrigger, CngxPanelToggle, CNGX_PANEL_TARGET
|
|
119
|
+
*/
|
|
120
|
+
interface CngxPanelTarget {
|
|
121
|
+
/** The `id` of the panel element; the trigger's `aria-controls`. */
|
|
122
|
+
readonly id: Signal<string>;
|
|
123
|
+
/**
|
|
124
|
+
* Whether the panel is shown (a peek included); the trigger's
|
|
125
|
+
* `aria-expanded` unless `peeked`.
|
|
126
|
+
*/
|
|
127
|
+
readonly expanded: Signal<boolean>;
|
|
128
|
+
/**
|
|
129
|
+
* Whether the panel shows only temporarily over its resting state.
|
|
130
|
+
* Optional; unset reads as `false`. A trigger does not report a peek as
|
|
131
|
+
* expanded.
|
|
132
|
+
*/
|
|
133
|
+
readonly peeked?: Signal<boolean>;
|
|
134
|
+
/** Opens a hidden panel, hides an open one. */
|
|
135
|
+
toggle(): void;
|
|
136
|
+
/** Shows the panel temporarily without changing its resting state. Optional. */
|
|
137
|
+
peek?(): void;
|
|
138
|
+
/** How the panel is laid out against its content. Optional; unset reads as `inline`. */
|
|
139
|
+
readonly mode?: Signal<CngxPanelMode>;
|
|
140
|
+
/**
|
|
141
|
+
* Whether the shown panel blocks the page around it (a modal over-drawer).
|
|
142
|
+
* Optional; unset reads as `false`.
|
|
143
|
+
*/
|
|
144
|
+
readonly modal?: Signal<boolean>;
|
|
145
|
+
/** The edge the panel sits on. Optional; unset reads as `start`. */
|
|
146
|
+
readonly side?: Signal<CngxPanelSide>;
|
|
147
|
+
/**
|
|
148
|
+
* The panel's accessible name. A trigger without text content takes it
|
|
149
|
+
* as its own name, so the name stays the same while the panel opens and
|
|
150
|
+
* closes. Optional; unset or `undefined` falls back to
|
|
151
|
+
* `CNGX_LAYOUT_I18N.panelTrigger`.
|
|
152
|
+
*/
|
|
153
|
+
readonly label?: Signal<string | undefined>;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The panel target of the surrounding drawer, sidebar or sidenav, for a
|
|
157
|
+
* `CngxPanelTrigger` placed inside it (a pin or close button). A trigger
|
|
158
|
+
* outside the panel takes the target as an explicit reference instead.
|
|
159
|
+
*
|
|
160
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/panel-trigger/panel-target.ts
|
|
161
|
+
* @since 0.3.0
|
|
162
|
+
* @relatedTo CngxPanelTrigger, CngxDrawer
|
|
163
|
+
*/
|
|
164
|
+
declare const CNGX_PANEL_TARGET: InjectionToken<CngxPanelTarget>;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* How far an engaged `CngxDrawerSurface` takes over the page.
|
|
168
|
+
*
|
|
169
|
+
* - `'page'`: a modal dialog. Focus trap, `role="dialog"` + `aria-modal`,
|
|
170
|
+
* everything outside the host `inert` up to `<body>`, scroll lock on the
|
|
171
|
+
* nearest scroll container above the host.
|
|
172
|
+
* - `'contained'`: modal only inside a boundary element (for a drawer, the
|
|
173
|
+
* `[cngxDrawer]` host). The host's siblings inside the boundary are
|
|
174
|
+
* `inert` and a scroll container inside the boundary is locked; everything
|
|
175
|
+
* outside the boundary (an app header above a clipped drawer) stays live.
|
|
176
|
+
* No trap and no `aria-modal`: focus moves into the host on activation
|
|
177
|
+
* and Tab can reach the live page around the boundary.
|
|
178
|
+
* - `'none'`: the page stays operable. No trap, no inert, no lock.
|
|
179
|
+
*
|
|
180
|
+
* @since 0.3.0
|
|
181
|
+
*/
|
|
182
|
+
type CngxDrawerModality = 'page' | 'contained' | 'none';
|
|
183
|
+
/**
|
|
184
|
+
* @internal Lets a directive that composes `CngxDrawerSurface` as a host
|
|
185
|
+
* directive drive it from its own state instead of `[active]` / `[modality]`.
|
|
186
|
+
* Provided by the composer on the same element (`useExisting`); the surface
|
|
187
|
+
* resolves it lazily with `self: true`, because the composer constructs after
|
|
188
|
+
* its host directives.
|
|
189
|
+
*/
|
|
190
|
+
interface CngxDrawerSurfaceDriver {
|
|
191
|
+
/** Whether the surface is engaged; wins over `[active]`. */
|
|
192
|
+
readonly surfaceActive: Signal<boolean>;
|
|
193
|
+
/** The modality of the engaged surface; wins over `[modality]`. */
|
|
194
|
+
readonly surfaceModality: Signal<CngxDrawerModality>;
|
|
195
|
+
/**
|
|
196
|
+
* The boundary of a `contained` surface. Without it, or when it does not
|
|
197
|
+
* contain the host, the host's parent element is the boundary.
|
|
198
|
+
*/
|
|
199
|
+
readonly surfaceBoundary?: Signal<HTMLElement | null>;
|
|
200
|
+
/**
|
|
201
|
+
* Landmark role while the surface is not an engaged page modal. Without it
|
|
202
|
+
* the surface renders its own `[role]`.
|
|
203
|
+
*/
|
|
204
|
+
readonly surfaceLandmarkRole?: Signal<string | null>;
|
|
205
|
+
/** Whether a press outside the host asks for dismissal. Without it, it does. */
|
|
206
|
+
readonly surfaceOutsideDismiss?: Signal<boolean>;
|
|
207
|
+
/**
|
|
208
|
+
* Accessible name of the host in every state; wins over `[label]`, the
|
|
209
|
+
* static `aria-label` and the dialog fallback. For a composer that names
|
|
210
|
+
* the host itself, so the surface never writes a different name.
|
|
211
|
+
*/
|
|
212
|
+
readonly surfaceLabel?: Signal<string>;
|
|
213
|
+
/** Called for every dismissal request (Escape, back gesture, outside press). */
|
|
214
|
+
surfaceDismiss(): void;
|
|
215
|
+
}
|
|
216
|
+
/** @internal See {@link CngxDrawerSurfaceDriver}. */
|
|
217
|
+
declare const CNGX_DRAWER_SURFACE_DRIVER: InjectionToken<CngxDrawerSurfaceDriver>;
|
|
218
|
+
/**
|
|
219
|
+
* The transient-surface behaviour of a drawer or an overlay rail, with an
|
|
220
|
+
* explicit modality.
|
|
221
|
+
*
|
|
222
|
+
* While `active`, the surface asks to be dismissed on Escape with focus
|
|
223
|
+
* inside (in every browser: the close Chromium derives from an Escape
|
|
224
|
+
* keypress is not a back gesture and is dropped), on the platform back
|
|
225
|
+
* gesture (`CloseWatcher`) and on a press outside the
|
|
226
|
+
* host. A press on the element whose `aria-controls` names the host `id` is
|
|
227
|
+
* not outside, so the trigger can toggle the surface itself. One Escape
|
|
228
|
+
* dismisses one layer: an inner surface or an open popover inside the host
|
|
229
|
+
* (a menu, a select panel) takes the keypress first. Focus returns
|
|
230
|
+
* to the element focused at activation when the surface deactivates.
|
|
231
|
+
*
|
|
232
|
+
* `modality` decides how far the engaged surface takes over the page:
|
|
233
|
+
*
|
|
234
|
+
* - `'page'` (default) additionally traps focus, renders `role="dialog"` +
|
|
235
|
+
* `aria-modal="true"`, makes everything outside the host `inert` up to
|
|
236
|
+
* `<body>` (the siblings of the host and of every ancestor, like a modal
|
|
237
|
+
* dialog) and locks scrolling on the nearest scroll container above the
|
|
238
|
+
* host (the nearest ancestor with a computed `overflow-y` of `auto` or
|
|
239
|
+
* `scroll`, else the document root).
|
|
240
|
+
* - `'contained'` does the same inside a boundary only: the host's siblings
|
|
241
|
+
* inside the boundary are `inert`, the nearest scroll container between
|
|
242
|
+
* the host and the boundary (inclusive) is locked if there is one, and
|
|
243
|
+
* nothing outside the boundary is touched. The element whose `aria-controls`
|
|
244
|
+
* names the host stays live wherever it sits. No trap and no
|
|
245
|
+
* `aria-modal` (the page around the boundary is operable, so the surface
|
|
246
|
+
* must not claim it is not); the landmark role stays and focus moves to
|
|
247
|
+
* the first tabbable element inside the host on activation. The
|
|
248
|
+
* boundary is the host's parent element unless a composer names one
|
|
249
|
+
* (`CngxDrawerPanel` names its `[cngxDrawer]` host).
|
|
250
|
+
* - `'none'` keeps the page around it operable: no trap, no lock, no
|
|
251
|
+
* inert, the landmark `role` (default `complementary`, `null` keeps the
|
|
252
|
+
* host's implicit role).
|
|
253
|
+
*
|
|
254
|
+
* In every modality focus-trap anchors, live regions, the CDK overlay
|
|
255
|
+
* container, the toast and banner outlets and a visible `CngxBackdrop` stay
|
|
256
|
+
* live, and an `inert` set by someone else is kept on release. Escape, the
|
|
257
|
+
* back gesture and an outside press ask for dismissal in all three.
|
|
258
|
+
*
|
|
259
|
+
* The surface does not own the open state: it reports `dismiss` and the
|
|
260
|
+
* owner decides. It composes `CngxFocusTrap`, `CngxFocusRestore` and
|
|
261
|
+
* `CngxClickOutside` and drives them; none of their inputs is re-exposed.
|
|
262
|
+
*
|
|
263
|
+
* ```html
|
|
264
|
+
* <aside id="filters" cngxDrawerSurface [active]="open()" modality="none"
|
|
265
|
+
* (dismiss)="open.set(false)">…</aside>
|
|
266
|
+
* <button aria-controls="filters" [attr.aria-expanded]="open()"
|
|
267
|
+
* (click)="open.set(!open())">Filters</button>
|
|
268
|
+
* ```
|
|
269
|
+
*
|
|
270
|
+
* `CngxDrawerPanel` hosts the surface for drawers; consumers rarely bind it
|
|
271
|
+
* directly.
|
|
272
|
+
*
|
|
273
|
+
* @wcag AA
|
|
274
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/drawer/drawer-surface.directive.ts
|
|
275
|
+
* @since 0.3.0
|
|
276
|
+
* @relatedTo CngxDrawerPanel, CngxFocusTrap, CngxFocusRestore, CngxClickOutside, createScrollLock
|
|
277
|
+
* <example-url>/#/common/layout/drawer/standalone-surface</example-url>
|
|
278
|
+
* @axis level molecule
|
|
279
|
+
*/
|
|
280
|
+
declare class CngxDrawerSurface implements CngxFocusTrapDriver, CngxFocusRestoreDriver, CngxClickOutsideDriver {
|
|
281
|
+
/**
|
|
282
|
+
* Whether the surface is engaged (the drawer or overlay is open). Bind it
|
|
283
|
+
* to the owner's open state.
|
|
284
|
+
*/
|
|
285
|
+
readonly active: _angular_core.InputSignal<boolean>;
|
|
286
|
+
/**
|
|
287
|
+
* How far the engaged surface takes over the page: `'page'` (modal dialog,
|
|
288
|
+
* inert up to `<body>`), `'contained'` (inert and scroll lock inside the
|
|
289
|
+
* boundary only, no trap) or `'none'`. See {@link CngxDrawerModality}.
|
|
290
|
+
*/
|
|
291
|
+
readonly modality: _angular_core.InputSignal<CngxDrawerModality>;
|
|
292
|
+
/**
|
|
293
|
+
* Landmark role while the surface is not an engaged page modal. Defaults
|
|
294
|
+
* to `complementary`; pass `navigation` for a nav surface, or `null` on a
|
|
295
|
+
* `<nav>` / `<aside>` host to keep its implicit role. A composer's driver
|
|
296
|
+
* wins over it.
|
|
297
|
+
*/
|
|
298
|
+
readonly role: _angular_core.InputSignal<string | null>;
|
|
299
|
+
/**
|
|
300
|
+
* Accessible name of the surface. An engaged page modal (a `dialog`)
|
|
301
|
+
* without one falls back to a static `aria-label` on the host, then to
|
|
302
|
+
* `CNGX_LAYOUT_I18N.drawerDialog`; a host with a static `aria-labelledby`
|
|
303
|
+
* keeps that name. Outside an engaged page modal only a bound label or a
|
|
304
|
+
* static `aria-label` names the landmark.
|
|
305
|
+
*/
|
|
306
|
+
readonly labelInput: _angular_core.InputSignal<string | undefined>;
|
|
307
|
+
/**
|
|
308
|
+
* Emitted when the user asks to dismiss the engaged surface: Escape, the
|
|
309
|
+
* back gesture, or a press outside the host. The owner closes it.
|
|
310
|
+
*/
|
|
311
|
+
readonly dismiss: _angular_core.OutputEmitterRef<void>;
|
|
312
|
+
private readonly injector;
|
|
313
|
+
private readonly host;
|
|
314
|
+
private readonly doc;
|
|
315
|
+
private readonly domReady;
|
|
316
|
+
private readonly focusTrap;
|
|
317
|
+
private readonly i18n;
|
|
318
|
+
private readonly staticLabel;
|
|
319
|
+
private readonly staticLabelledBy;
|
|
320
|
+
private readonly staticTabindex;
|
|
321
|
+
private destroyed;
|
|
322
|
+
private escapeKeyTimer;
|
|
323
|
+
private readonly escapeKeydown;
|
|
324
|
+
private releaseTrailingClick;
|
|
325
|
+
private resolvedDriver;
|
|
326
|
+
private driver;
|
|
327
|
+
/** Whether the surface is engaged, after the driver. */
|
|
328
|
+
readonly isActive: Signal<boolean>;
|
|
329
|
+
/** The modality of the surface, after the driver. */
|
|
330
|
+
readonly resolvedModality: Signal<CngxDrawerModality>;
|
|
331
|
+
/** The modality while engaged; `'none'` while the surface is not active. */
|
|
332
|
+
protected readonly engagedModality: Signal<CngxDrawerModality>;
|
|
333
|
+
protected readonly engagedPage: Signal<boolean>;
|
|
334
|
+
/**
|
|
335
|
+
* @internal Hotkey scope of the surface subtree: modal while engaged as
|
|
336
|
+
* `'page'` or `'contained'`, so app bindings outside stay quiet while focus
|
|
337
|
+
* is inside. Always active: the drawer's own bindings (toggle, close) must
|
|
338
|
+
* fire whether the surface is engaged or not.
|
|
339
|
+
*/
|
|
340
|
+
readonly hotkeyScope: CngxHotkeyScopeNode;
|
|
341
|
+
protected readonly surfaceRole: Signal<string | null>;
|
|
342
|
+
private readonly namesWithFallback;
|
|
343
|
+
/**
|
|
344
|
+
* The resolved accessible name: the bound `label`, else a static
|
|
345
|
+
* `aria-label`, else (engaged page modal without a static name)
|
|
346
|
+
* `CNGX_LAYOUT_I18N.drawerDialog`.
|
|
347
|
+
*/
|
|
348
|
+
readonly label: Signal<string | undefined>;
|
|
349
|
+
protected readonly ariaLabel: Signal<string | null>;
|
|
350
|
+
/** @internal Drives the composed `CngxFocusTrap`. */
|
|
351
|
+
readonly focusTrapEnabled: Signal<boolean>;
|
|
352
|
+
/** @internal Drives the composed `CngxFocusTrap`. */
|
|
353
|
+
readonly focusTrapAutoFocus = true;
|
|
354
|
+
/**
|
|
355
|
+
* @internal Drives the composed `CngxFocusRestore`. The restore edge can
|
|
356
|
+
* run before the scope effect below releases `inert` around the host; the
|
|
357
|
+
* restore then focuses the opener after the render, once it is live.
|
|
358
|
+
*/
|
|
359
|
+
readonly focusRestoreActive: Signal<boolean>;
|
|
360
|
+
/**
|
|
361
|
+
* @internal Drives the composed `CngxFocusRestore`: when the surface was
|
|
362
|
+
* engaged with focus already inside it (a docked rail that turned into a
|
|
363
|
+
* drawer), there is no opener to return to, so focus goes to the element
|
|
364
|
+
* whose `aria-controls` names the host, the same relation an outside press
|
|
365
|
+
* is exempted by.
|
|
366
|
+
*/
|
|
367
|
+
focusRestoreFallback(): HTMLElement | null;
|
|
368
|
+
protected readonly hostTabindex: Signal<string | null>;
|
|
369
|
+
/** @internal Drives the composed `CngxClickOutside`. */
|
|
370
|
+
readonly clickOutsideEnabled: Signal<boolean>;
|
|
371
|
+
private readonly closeWatcher;
|
|
372
|
+
constructor();
|
|
373
|
+
private holdPageScope;
|
|
374
|
+
private holdContainedScope;
|
|
375
|
+
private containedBoundary;
|
|
376
|
+
protected handleEscape(event: Event): void;
|
|
377
|
+
private clearEscapeKey;
|
|
378
|
+
private handleCloseRequest;
|
|
379
|
+
private swallowTrailingClick;
|
|
380
|
+
private requestDismiss;
|
|
381
|
+
private emitDismiss;
|
|
382
|
+
private rearmIfEngaged;
|
|
383
|
+
private scrollScope;
|
|
384
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDrawerSurface, never>;
|
|
385
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxDrawerSurface, "[cngxDrawerSurface]", ["cngxDrawerSurface"], { "active": { "alias": "active"; "required": false; "isSignal": true; }; "modality": { "alias": "modality"; "required": false; "isSignal": true; }; "role": { "alias": "role"; "required": false; "isSignal": true; }; "labelInput": { "alias": "label"; "required": false; "isSignal": true; }; }, { "dismiss": "dismiss"; }, never, never, true, [{ directive: typeof i1.CngxFocusTrap; inputs: {}; outputs: {}; }, { directive: typeof i1.CngxFocusRestore; inputs: {}; outputs: {}; }, { directive: typeof i2.CngxClickOutside; inputs: {}; outputs: {}; }]>;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* How the drawer panel interacts with the content area.
|
|
390
|
+
*/
|
|
391
|
+
type DrawerMode = 'over' | 'push';
|
|
392
|
+
/**
|
|
393
|
+
* The sliding panel of a drawer. Reads its open state from an explicit
|
|
394
|
+
* `[cngxDrawerPanel]` reference, or from the `CNGX_DRAWER_HOST` a
|
|
395
|
+
* `CngxDrawer` on the same element provides when the attribute is bare - no
|
|
396
|
+
* ancestor injection. Both go through the `CngxDrawerHost` contract, never
|
|
397
|
+
* the concrete `CngxDrawer` class.
|
|
398
|
+
*
|
|
399
|
+
* The open panel is a transient surface (`CngxDrawerSurface`): Escape, the
|
|
400
|
+
* Android back gesture and a press outside the panel close the drawer
|
|
401
|
+
* (`closeOnClickOutside`, default `true`). A press on the trigger whose
|
|
402
|
+
* `aria-controls` names the panel `id` is not outside, so the trigger
|
|
403
|
+
* toggles the drawer itself. While closed the panel
|
|
404
|
+
* is `aria-hidden` AND `inert`. On close, focus returns to the element that
|
|
405
|
+
* was focused when the drawer opened - unless the user moved focus to
|
|
406
|
+
* another element themselves.
|
|
407
|
+
*
|
|
408
|
+
* **Modality.** `modality` defaults to `'page'` for `over` and `'none'` for
|
|
409
|
+
* `push`:
|
|
410
|
+
*
|
|
411
|
+
* - `'page'`: the open panel traps focus, renders `role="dialog"` +
|
|
412
|
+
* `aria-modal="true"` (named by `label`, else a static `aria-label` /
|
|
413
|
+
* `aria-labelledby`, else `CNGX_LAYOUT_I18N.drawerDialog`), makes
|
|
414
|
+
* everything outside it `inert` up to `<body>`
|
|
415
|
+
* (focus-trap anchors, live regions and a visible backdrop stay live) and
|
|
416
|
+
* locks scrolling on the nearest scroll container above it (else the
|
|
417
|
+
* document root). The full-height drawer that covers the app header.
|
|
418
|
+
* - `'contained'`: the same inside the `[cngxDrawer]` host only. The
|
|
419
|
+
* panel's siblings inside the host are `inert` and a scroll container
|
|
420
|
+
* between the panel and the host is locked; everything outside the host
|
|
421
|
+
* stays live. No trap and no `aria-modal`: focus moves into the panel on
|
|
422
|
+
* open, returns to the opener on close, and Tab can reach the page
|
|
423
|
+
* around the host. The clipped drawer below a live app header: place the
|
|
424
|
+
* header outside `[cngxDrawer]`.
|
|
425
|
+
* - `'none'`: the page around the panel stays operable.
|
|
426
|
+
*
|
|
427
|
+
* `push` is never modal: it lays the panel out next to the content, which
|
|
428
|
+
* stays in use; `'page'` or `'contained'` with `push` resolve to `'none'`
|
|
429
|
+
* and warn [`CNGX1076`](/error-codes/cngx1076.md) in development.
|
|
430
|
+
*
|
|
431
|
+
* **Scrim.** The panel renders `cngx-drawer-panel--modal` while its
|
|
432
|
+
* resolved modality is `'page'` or `'contained'` (plus
|
|
433
|
+
* `cngx-drawer-panel--contained` for the latter). The opt-in stylesheet
|
|
434
|
+
* `cngx-drawer.css` skins the panel from its classes: add the `cngx-drawer`
|
|
435
|
+
* class to the `[cngxDrawer]` host and the panel sits on its `position`
|
|
436
|
+
* side with a surface and a border toward the content, slides in (in
|
|
437
|
+
* `push` mode the content moves aside by its size), and the host shows a scrim over itself
|
|
438
|
+
* while a modal panel inside it is open (`--cngx-drawer-scrim-bg`, default
|
|
439
|
+
* `--cngx-backdrop-bg`). A press on the scrim is a press outside the panel
|
|
440
|
+
* and closes the drawer. The panel sits above the scrim
|
|
441
|
+
* (`--cngx-drawer-panel-z-index`, `2`, over `--cngx-drawer-scrim-z-index`,
|
|
442
|
+
* `1`).
|
|
443
|
+
*
|
|
444
|
+
* The `role` input (landmark while not an open page modal) defaults to
|
|
445
|
+
* `complementary`. On a `<nav>` host pass `[role]="null"` so the implicit
|
|
446
|
+
* navigation landmark survives:
|
|
447
|
+
*
|
|
448
|
+
* ```html
|
|
449
|
+
* <button aria-controls="nav-panel" [attr.aria-expanded]="drawer.opened()"
|
|
450
|
+
* (click)="drawer.toggle()">Menu</button>
|
|
451
|
+
* <nav id="nav-panel" [cngxDrawerPanel]="drawer" position="left" mode="over" [role]="null">
|
|
452
|
+
* <a href="/home">Home</a>
|
|
453
|
+
* </nav>
|
|
454
|
+
* ```
|
|
455
|
+
*
|
|
456
|
+
* @wcag AA
|
|
457
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/drawer/drawer-panel.directive.ts
|
|
458
|
+
* @since 0.3.0
|
|
459
|
+
* @relatedTo CngxDrawer, CngxDrawerContent, CngxFocusTrap
|
|
460
|
+
* <example-url>/#/common/layout/drawer/basic-scroll-lock-backdrop</example-url>
|
|
461
|
+
* <example-url>/#/common/layout/drawer/controlled-mode</example-url>
|
|
462
|
+
* <example-url>/#/common/layout/drawer/direction-all-four-sides</example-url>
|
|
463
|
+
* <example-url>/#/common/layout/drawer/events-openedchange-closed</example-url>
|
|
464
|
+
* <example-url>/#/common/layout/drawer/app-header-clipped</example-url>
|
|
465
|
+
* <example-url>/#/common/layout/drawer/full-height-modal</example-url>
|
|
466
|
+
* <example-url>/#/common/layout/drawer/filter-panel-push</example-url>
|
|
467
|
+
* <example-url>/#/common/layout/drawer/pattern-consumer-wiring</example-url>
|
|
468
|
+
*/
|
|
469
|
+
declare class CngxDrawerPanel implements CngxDrawerSurfaceDriver, OnInit, OnChanges {
|
|
470
|
+
/**
|
|
471
|
+
* The drawer state owner (a `CngxDrawer`, or anything implementing
|
|
472
|
+
* `CngxDrawerHost`). Bind it explicitly (`[cngxDrawerPanel]="drawer"`), or
|
|
473
|
+
* leave the attribute bare on an element that also carries `cngxDrawer`.
|
|
474
|
+
*/
|
|
475
|
+
readonly drawerInput: _angular_core.InputSignalWithTransform<CngxDrawerHost | undefined, "" | CngxDrawerHost | undefined>;
|
|
476
|
+
/** Direction the panel slides from. */
|
|
477
|
+
readonly position: _angular_core.InputSignal<DrawerPosition>;
|
|
478
|
+
/**
|
|
479
|
+
* How the panel interacts with the content area:
|
|
480
|
+
* - `'over'` (default) - overlays content (absolute positioned)
|
|
481
|
+
* - `'push'` - pushes content aside (content gets margin)
|
|
482
|
+
*/
|
|
483
|
+
readonly mode: _angular_core.InputSignal<DrawerMode>;
|
|
484
|
+
/**
|
|
485
|
+
* How much of the page the open panel blocks:
|
|
486
|
+
*
|
|
487
|
+
* - `'page'`: the whole page is blocked. The panel is a modal dialog,
|
|
488
|
+
* focus is trapped in it and everything outside it is `inert` up to
|
|
489
|
+
* `<body>`.
|
|
490
|
+
* - `'contained'`: only the `[cngxDrawer]` host is blocked. The content
|
|
491
|
+
* beside the panel is `inert` and scroll-locked, everything outside the
|
|
492
|
+
* host (an app header above it) stays clickable, and focus moves into
|
|
493
|
+
* the panel without being trapped.
|
|
494
|
+
* - `'none'`: nothing is blocked. No `inert`, no lock, no trap.
|
|
495
|
+
*
|
|
496
|
+
* With the `cngx-drawer` stylesheet, `'page'` and `'contained'` show a
|
|
497
|
+
* scrim over the `[cngxDrawer]` host. Unbound, it follows the mode: `over`
|
|
498
|
+
* is `'page'`, `push` is `'none'`. `push` never blocks: `'page'` or
|
|
499
|
+
* `'contained'` with `push` resolve to `'none'` and warn [`CNGX1076`](/error-codes/cngx1076.md) in
|
|
500
|
+
* development. See {@link CngxDrawerModality}.
|
|
501
|
+
*/
|
|
502
|
+
readonly modality: _angular_core.InputSignal<CngxDrawerModality | undefined>;
|
|
503
|
+
/** Whether a press outside the panel closes the drawer. */
|
|
504
|
+
readonly closeOnClickOutside: _angular_core.InputSignal<boolean>;
|
|
505
|
+
/**
|
|
506
|
+
* Landmark role rendered on the panel while it is not an open page modal
|
|
507
|
+
* (an open `'page'` panel is a `dialog`; a `'contained'` one keeps this
|
|
508
|
+
* role). Defaults to `complementary`; pass `navigation` for nav drawers or
|
|
509
|
+
* `null` to keep the element's implicit role (e.g. on a `<nav>` host).
|
|
510
|
+
*/
|
|
511
|
+
readonly role: _angular_core.InputSignal<string | null>;
|
|
512
|
+
private readonly hostDrawer;
|
|
513
|
+
/** The resolved drawer: the explicit reference wins over a drawer host on the element. */
|
|
514
|
+
readonly drawerRef: _angular_core.Signal<CngxDrawerHost | null>;
|
|
515
|
+
private readonly staticId;
|
|
516
|
+
/** The panel's `id`: a static `id` attribute wins over the drawer's `panelId`. */
|
|
517
|
+
protected readonly panelId: _angular_core.Signal<string | null>;
|
|
518
|
+
/** Whether the drawer is currently open (derived from the drawer ref). */
|
|
519
|
+
readonly isOpen: _angular_core.Signal<boolean>;
|
|
520
|
+
/** @internal Drives the composed `CngxDrawerSurface`. */
|
|
521
|
+
readonly surfaceActive: _angular_core.Signal<boolean>;
|
|
522
|
+
/** @internal Drives the composed `CngxDrawerSurface`. */
|
|
523
|
+
readonly surfaceModality: _angular_core.Signal<CngxDrawerModality>;
|
|
524
|
+
/** @internal Drives the composed `CngxDrawerSurface`: the `[cngxDrawer]` host. */
|
|
525
|
+
readonly surfaceBoundary: _angular_core.Signal<HTMLElement | null>;
|
|
526
|
+
/** @internal Drives the composed `CngxDrawerSurface`. */
|
|
527
|
+
readonly surfaceLandmarkRole: _angular_core.InputSignal<string | null>;
|
|
528
|
+
private readonly presentation;
|
|
529
|
+
/** @internal Drives the composed `CngxDrawerSurface`. */
|
|
530
|
+
readonly surfaceOutsideDismiss: _angular_core.InputSignal<boolean>;
|
|
531
|
+
private connection;
|
|
532
|
+
constructor();
|
|
533
|
+
ngOnChanges(): void;
|
|
534
|
+
ngOnInit(): void;
|
|
535
|
+
private syncConnection;
|
|
536
|
+
private disconnect;
|
|
537
|
+
/** @internal Drives the composed `CngxDrawerSurface`. */
|
|
538
|
+
surfaceDismiss(): void;
|
|
539
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDrawerPanel, never>;
|
|
540
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxDrawerPanel, "[cngxDrawerPanel]", ["cngxDrawerPanel"], { "drawerInput": { "alias": "cngxDrawerPanel"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "modality": { "alias": "modality"; "required": false; "isSignal": true; }; "closeOnClickOutside": { "alias": "closeOnClickOutside"; "required": false; "isSignal": true; }; "role": { "alias": "role"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof CngxDrawerSurface; inputs: { "label": "label"; }; outputs: {}; }]>;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* What a `CngxDrawerPanel` reports to its drawer host, so the host can say
|
|
545
|
+
* how its panel is presented (the `CngxPanelTarget` view of `CngxDrawer`)
|
|
546
|
+
* and leave Escape inside the panel to the panel's surface.
|
|
88
547
|
*
|
|
89
|
-
* @
|
|
548
|
+
* @since 0.3.0
|
|
549
|
+
*/
|
|
550
|
+
interface CngxDrawerPanelPresentation {
|
|
551
|
+
/** The panel's `mode`. */
|
|
552
|
+
readonly mode: Signal<DrawerMode>;
|
|
553
|
+
/** Whether the panel's resolved modality blocks anything. */
|
|
554
|
+
readonly modal: Signal<boolean>;
|
|
555
|
+
/** The edge the panel slides in from. */
|
|
556
|
+
readonly position: Signal<DrawerPosition>;
|
|
557
|
+
/** The panel element. */
|
|
558
|
+
readonly element: HTMLElement;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* The contract a `CngxDrawerPanel` reads from the drawer that owns its open
|
|
562
|
+
* state. `CngxDrawer` implements it and provides `CNGX_DRAWER_HOST`; any
|
|
563
|
+
* other state owner that implements it can drive a panel the same way,
|
|
564
|
+
* bound explicitly (`[cngxDrawerPanel]="host"`) or provided on the panel's
|
|
565
|
+
* own element.
|
|
566
|
+
*
|
|
567
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/drawer/drawer-host.ts
|
|
568
|
+
* @since 0.3.0
|
|
569
|
+
* @relatedTo CngxDrawer, CngxDrawerPanel, CNGX_DRAWER_HOST
|
|
570
|
+
*/
|
|
571
|
+
interface CngxDrawerHost {
|
|
572
|
+
/** Whether the drawer is open. */
|
|
573
|
+
readonly opened: Signal<boolean>;
|
|
574
|
+
/** The `id` the panel renders unless it carries a static one. */
|
|
575
|
+
readonly panelId: Signal<string | undefined>;
|
|
576
|
+
/** The drawer element: the boundary of a `'contained'` panel. */
|
|
577
|
+
readonly elementRef: ElementRef<HTMLElement>;
|
|
578
|
+
/** Closes the drawer. The panel calls it for every dismissal request. */
|
|
579
|
+
close(): void;
|
|
580
|
+
/**
|
|
581
|
+
* Connects a panel's presentation; the latest connected panel wins.
|
|
582
|
+
* Returns the disconnect, which the panel calls when it leaves or
|
|
583
|
+
* switches hosts.
|
|
584
|
+
*/
|
|
585
|
+
connectPanel(panel: CngxDrawerPanelPresentation): () => void;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* The drawer host of a `CngxDrawerPanel` on the same element. `CngxDrawer`
|
|
589
|
+
* provides it via `useExisting`, so a bare `cngxDrawerPanel` attribute next
|
|
590
|
+
* to `cngxDrawer` resolves its drawer without injecting the concrete class.
|
|
591
|
+
* An explicit `[cngxDrawerPanel]` reference wins over it.
|
|
592
|
+
*
|
|
593
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/drawer/drawer-host.ts
|
|
594
|
+
* @since 0.3.0
|
|
595
|
+
* @relatedTo CngxDrawer, CngxDrawerPanel
|
|
596
|
+
*/
|
|
597
|
+
declare const CNGX_DRAWER_HOST: InjectionToken<CngxDrawerHost>;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Position from which the drawer panel slides in.
|
|
90
601
|
*/
|
|
91
602
|
type DrawerPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
92
603
|
/**
|
|
@@ -98,6 +609,30 @@ type DrawerPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
|
98
609
|
*
|
|
99
610
|
* Child directives (`CngxDrawerPanel`, `CngxDrawerContent`) receive a
|
|
100
611
|
* reference to this directive via an explicit input - no ancestor injection.
|
|
612
|
+
* The panel reads it through the `CngxDrawerHost` contract, which the drawer
|
|
613
|
+
* also provides as `CNGX_DRAWER_HOST` for a panel on its own element.
|
|
614
|
+
*
|
|
615
|
+
* The drawer is a `CngxPanelTarget`: a `[cngxPanelTrigger]="drawer"` button
|
|
616
|
+
* mirrors `opened` as `aria-expanded` and points `aria-controls` at
|
|
617
|
+
* `panelId`, which the panel takes as its `id`. Inside the drawer it provides
|
|
618
|
+
* `CNGX_PANEL_TARGET` for a bare `cngxPanelTrigger`. Its `mode`, `modal`
|
|
619
|
+
* and `side` follow the panel's `mode`, resolved modality and `position`,
|
|
620
|
+
* so a `CngxPanelToggle` draws the glyph of the current presentation.
|
|
621
|
+
*
|
|
622
|
+
* The drawer host is also the boundary of a `'contained'` panel and the
|
|
623
|
+
* area its scrim covers: with the opt-in `cngx-drawer` class (stylesheet
|
|
624
|
+
* `@cngx/common/theming/components/cngx-drawer.css`, part of the cngx
|
|
625
|
+
* bundle) the host places the panel on its side, lets the content fill the
|
|
626
|
+
* rest and paints a scrim over itself while a modal panel inside it is
|
|
627
|
+
* open. Keep an app header that must stay live outside the host.
|
|
628
|
+
*
|
|
629
|
+
* ### With a panel trigger
|
|
630
|
+
* ```html
|
|
631
|
+
* <button type="button" [cngxPanelTrigger]="drawer">Menu</button>
|
|
632
|
+
* <div cngxDrawer #drawer="cngxDrawer" panelId="main-nav">
|
|
633
|
+
* <nav [cngxDrawerPanel]="drawer">…</nav>
|
|
634
|
+
* </div>
|
|
635
|
+
* ```
|
|
101
636
|
*
|
|
102
637
|
* ### Uncontrolled
|
|
103
638
|
* ```html
|
|
@@ -116,27 +651,49 @@ type DrawerPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
|
116
651
|
* </div>
|
|
117
652
|
* ```
|
|
118
653
|
*
|
|
119
|
-
* @category common/layout
|
|
120
|
-
* @docsKind primary
|
|
121
654
|
* @wcag AA
|
|
122
655
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/drawer/drawer.directive.ts
|
|
123
|
-
* @since 0.
|
|
656
|
+
* @since 0.3.0
|
|
124
657
|
* @relatedTo CngxDrawerPanel, CngxDrawerContent, CngxBackdrop, CngxScrollLock
|
|
125
|
-
* <example-url
|
|
126
|
-
* <example-url
|
|
127
|
-
* <example-url
|
|
128
|
-
* <example-url
|
|
129
|
-
* <example-url
|
|
130
|
-
* <example-url
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
658
|
+
* <example-url>/#/common/layout/drawer/basic-scroll-lock-backdrop</example-url>
|
|
659
|
+
* <example-url>/#/common/layout/drawer/controlled-mode</example-url>
|
|
660
|
+
* <example-url>/#/common/layout/drawer/direction-all-four-sides</example-url>
|
|
661
|
+
* <example-url>/#/common/layout/drawer/events-openedchange-closed</example-url>
|
|
662
|
+
* <example-url>/#/common/layout/drawer/app-header-clipped</example-url>
|
|
663
|
+
* <example-url>/#/common/layout/drawer/full-height-modal</example-url>
|
|
664
|
+
* <example-url>/#/common/layout/drawer/filter-panel-push</example-url>
|
|
665
|
+
* <example-url>/#/common/layout/drawer/pattern-consumer-wiring</example-url>
|
|
666
|
+
* @axis level organism
|
|
667
|
+
*/
|
|
668
|
+
declare class CngxDrawer implements CngxPanelTarget, CngxDrawerHost {
|
|
669
|
+
/** @internal Host element ref. */
|
|
134
670
|
readonly elementRef: ElementRef<any>;
|
|
671
|
+
private readonly host;
|
|
672
|
+
/**
|
|
673
|
+
* The `id` of the drawer's panel element. `CngxDrawerPanel` renders it as
|
|
674
|
+
* its `id` unless the panel carries a static one, and a panel trigger
|
|
675
|
+
* points `aria-controls` at it.
|
|
676
|
+
*/
|
|
677
|
+
readonly panelId: _angular_core.InputSignal<string | undefined>;
|
|
135
678
|
/** Controlled opened state. When bound, takes precedence over internal state. */
|
|
136
679
|
readonly openedInput: _angular_core.InputSignal<boolean | undefined>;
|
|
137
680
|
private readonly openedState;
|
|
138
681
|
/** Resolved opened state - controlled input wins over internal state. */
|
|
139
682
|
readonly opened: _angular_core.Signal<boolean>;
|
|
683
|
+
/** {@link CngxPanelTarget} view of {@link panelId}; empty when unset. */
|
|
684
|
+
readonly id: _angular_core.Signal<string>;
|
|
685
|
+
/** {@link CngxPanelTarget} view of {@link opened}. */
|
|
686
|
+
readonly expanded: _angular_core.Signal<boolean>;
|
|
687
|
+
private readonly panelSlot;
|
|
688
|
+
/** {@link CngxPanelTarget} view of the panel's `mode`; `over` until a panel registers. */
|
|
689
|
+
readonly mode: _angular_core.Signal<CngxPanelMode>;
|
|
690
|
+
/**
|
|
691
|
+
* {@link CngxPanelTarget}: whether the panel's resolved modality blocks
|
|
692
|
+
* anything; `false` until a panel connects, like an unset `modal`.
|
|
693
|
+
*/
|
|
694
|
+
readonly modal: _angular_core.Signal<boolean>;
|
|
695
|
+
/** {@link CngxPanelTarget} view of the panel's `position`; `left` until a panel registers. */
|
|
696
|
+
readonly side: _angular_core.Signal<CngxPanelSide>;
|
|
140
697
|
/** Emitted when the opened state changes. Wire to a signal for two-way binding. */
|
|
141
698
|
readonly openedChange: _angular_core.OutputEmitterRef<boolean>;
|
|
142
699
|
/** Emitted when the drawer closes. Convenience shorthand for close-only listeners. */
|
|
@@ -145,90 +702,23 @@ declare class CngxDrawer {
|
|
|
145
702
|
open(): void;
|
|
146
703
|
/** Closes the drawer. */
|
|
147
704
|
close(): void;
|
|
705
|
+
protected handleEscape(event: Event): void;
|
|
706
|
+
/** {@link CngxDrawerHost}: connects a panel; the latest panel wins. */
|
|
707
|
+
connectPanel(panel: CngxDrawerPanelPresentation): () => void;
|
|
148
708
|
/** Toggles the drawer between open and closed. */
|
|
149
709
|
toggle(): void;
|
|
150
710
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDrawer, never>;
|
|
151
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxDrawer, "[cngxDrawer]", ["cngxDrawer"], { "openedInput": { "alias": "cngxDrawerOpened"; "required": false; "isSignal": true; }; }, { "openedChange": "openedChange"; "closed": "closed"; }, never, never, true, never>;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* How the drawer panel interacts with the content area.
|
|
156
|
-
*
|
|
157
|
-
* @category common/layout
|
|
158
|
-
*/
|
|
159
|
-
type DrawerMode = 'over' | 'push' | 'side';
|
|
160
|
-
/**
|
|
161
|
-
* The sliding panel of a drawer. Reads its open state from an explicit
|
|
162
|
-
* `[cngxDrawerPanel]` reference - no ancestor injection.
|
|
163
|
-
*
|
|
164
|
-
* Composes `CngxFocusTrap` as a `hostDirective` - the consumer controls
|
|
165
|
-
* the `[enabled]` and `[autoFocus]` inputs from the template.
|
|
166
|
-
*
|
|
167
|
-
* Optionally closes the drawer when the user clicks outside the panel
|
|
168
|
-
* (`closeOnClickOutside`, default `true`). The click that opened the
|
|
169
|
-
* drawer never counts as an outside click. While closed (except in
|
|
170
|
-
* `side` mode) the panel is `aria-hidden` AND `inert`, so its focusable
|
|
171
|
-
* children are unreachable for keyboard and AT alike. On close, focus
|
|
172
|
-
* returns to the element that was focused when the drawer opened -
|
|
173
|
-
* unless the user moved focus to another focusable element themselves
|
|
174
|
-
* (a click on a focusable outside target keeps its focus).
|
|
175
|
-
*
|
|
176
|
-
* The `role` input defaults to `complementary`. On a `<nav>` host pass
|
|
177
|
-
* `[role]="null"` so the implicit navigation landmark survives:
|
|
178
|
-
*
|
|
179
|
-
* ```html
|
|
180
|
-
* <nav [cngxDrawerPanel]="drawer" position="left" mode="over" [role]="null"
|
|
181
|
-
* [enabled]="drawer.opened()" [autoFocus]="true">
|
|
182
|
-
* <a href="/home">Home</a>
|
|
183
|
-
* </nav>
|
|
184
|
-
* ```
|
|
185
|
-
*
|
|
186
|
-
* @category common/layout
|
|
187
|
-
* @wcag AA
|
|
188
|
-
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/drawer/drawer-panel.directive.ts
|
|
189
|
-
* @since 0.1.0
|
|
190
|
-
* @relatedTo CngxDrawer, CngxDrawerContent, CngxFocusTrap
|
|
191
|
-
* <example-url>http://localhost:4200/#/common/layout/drawer/basic-scroll-lock-backdrop</example-url>
|
|
192
|
-
* <example-url>http://localhost:4200/#/common/layout/drawer/controlled-mode</example-url>
|
|
193
|
-
* <example-url>http://localhost:4200/#/common/layout/drawer/direction-all-four-sides</example-url>
|
|
194
|
-
* <example-url>http://localhost:4200/#/common/layout/drawer/events-openedchange-closed</example-url>
|
|
195
|
-
* <example-url>http://localhost:4200/#/common/layout/drawer/mode-over-push-side</example-url>
|
|
196
|
-
* <example-url>http://localhost:4200/#/common/layout/drawer/pattern-consumer-wiring</example-url>
|
|
197
|
-
*/
|
|
198
|
-
declare class CngxDrawerPanel {
|
|
199
|
-
/** Reference to the parent `CngxDrawer` state owner. */
|
|
200
|
-
readonly drawerRef: _angular_core.InputSignal<CngxDrawer>;
|
|
201
|
-
/** Direction the panel slides from. */
|
|
202
|
-
readonly position: _angular_core.InputSignal<DrawerPosition>;
|
|
203
|
-
/**
|
|
204
|
-
* How the panel interacts with the content area:
|
|
205
|
-
* - `'over'` (default) - overlays content (absolute positioned)
|
|
206
|
-
* - `'push'` - pushes content aside (content gets margin)
|
|
207
|
-
* - `'side'` - always visible, no toggle behavior
|
|
208
|
-
*/
|
|
209
|
-
readonly mode: _angular_core.InputSignal<DrawerMode>;
|
|
210
|
-
/** Whether clicking outside the panel closes the drawer. */
|
|
211
|
-
readonly closeOnClickOutside: _angular_core.InputSignal<boolean>;
|
|
212
|
-
/**
|
|
213
|
-
* Landmark role rendered on the panel. Defaults to `complementary`;
|
|
214
|
-
* pass `navigation` for nav drawers or `null` to keep the element's
|
|
215
|
-
* implicit role (e.g. on a `<nav>` host).
|
|
216
|
-
*/
|
|
217
|
-
readonly role: _angular_core.InputSignal<string | null>;
|
|
218
|
-
/** Whether the drawer is currently open (derived from the drawer ref). In `side` mode, always `true`. */
|
|
219
|
-
readonly isOpen: _angular_core.Signal<boolean>;
|
|
220
|
-
private suppressOutsideClick;
|
|
221
|
-
private restoreTarget;
|
|
222
|
-
constructor();
|
|
223
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDrawerPanel, never>;
|
|
224
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxDrawerPanel, "[cngxDrawerPanel]", ["cngxDrawerPanel"], { "drawerRef": { "alias": "cngxDrawerPanel"; "required": true; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "closeOnClickOutside": { "alias": "closeOnClickOutside"; "required": false; "isSignal": true; }; "role": { "alias": "role"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.CngxFocusTrap; inputs: { "enabled": "enabled"; "autoFocus": "autoFocus"; }; outputs: {}; }]>;
|
|
711
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxDrawer, "[cngxDrawer]", ["cngxDrawer"], { "panelId": { "alias": "panelId"; "required": false; "isSignal": true; }; "openedInput": { "alias": "cngxDrawerOpened"; "required": false; "isSignal": true; }; }, { "openedChange": "openedChange"; "closed": "closed"; }, never, never, true, never>;
|
|
225
712
|
}
|
|
226
713
|
|
|
227
714
|
/**
|
|
228
715
|
* Marks the main content area adjacent to a drawer panel.
|
|
229
716
|
*
|
|
230
717
|
* Adds a CSS class when the drawer is open so the consumer can offset
|
|
231
|
-
* the content via CSS transitions or transforms.
|
|
718
|
+
* the content via CSS transitions or transforms. While a `push` panel is
|
|
719
|
+
* open it also writes `data-drawer-push` with the panel's side (`left`,
|
|
720
|
+
* `right`, `top`, `bottom`); `cngx-drawer.css` moves the content aside by
|
|
721
|
+
* the panel size from it, so the panel itself slides at full size.
|
|
232
722
|
*
|
|
233
723
|
* ```html
|
|
234
724
|
* <main [cngxDrawerContent]="drawer">
|
|
@@ -236,22 +726,25 @@ declare class CngxDrawerPanel {
|
|
|
236
726
|
* </main>
|
|
237
727
|
* ```
|
|
238
728
|
*
|
|
239
|
-
* @category common/layout
|
|
240
729
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/drawer/drawer-content.directive.ts
|
|
241
|
-
* @since 0.
|
|
730
|
+
* @since 0.3.0
|
|
242
731
|
* @relatedTo CngxDrawer, CngxDrawerPanel
|
|
243
|
-
* <example-url
|
|
244
|
-
* <example-url
|
|
245
|
-
* <example-url
|
|
246
|
-
* <example-url
|
|
247
|
-
* <example-url
|
|
248
|
-
* <example-url
|
|
732
|
+
* <example-url>/#/common/layout/drawer/basic-scroll-lock-backdrop</example-url>
|
|
733
|
+
* <example-url>/#/common/layout/drawer/controlled-mode</example-url>
|
|
734
|
+
* <example-url>/#/common/layout/drawer/direction-all-four-sides</example-url>
|
|
735
|
+
* <example-url>/#/common/layout/drawer/events-openedchange-closed</example-url>
|
|
736
|
+
* <example-url>/#/common/layout/drawer/app-header-clipped</example-url>
|
|
737
|
+
* <example-url>/#/common/layout/drawer/full-height-modal</example-url>
|
|
738
|
+
* <example-url>/#/common/layout/drawer/filter-panel-push</example-url>
|
|
739
|
+
* <example-url>/#/common/layout/drawer/pattern-consumer-wiring</example-url>
|
|
249
740
|
*/
|
|
250
741
|
declare class CngxDrawerContent {
|
|
251
742
|
/** Reference to the parent `CngxDrawer` state owner. */
|
|
252
743
|
readonly drawerRef: _angular_core.InputSignal<CngxDrawer>;
|
|
253
744
|
/** Whether the drawer is currently open (derived from the drawer ref). */
|
|
254
745
|
readonly isOpen: _angular_core.Signal<boolean>;
|
|
746
|
+
/** Side of the open `push` panel the content gives way to; `null` otherwise. */
|
|
747
|
+
protected readonly pushSide: _angular_core.Signal<_cngx_common_layout.CngxPanelSide | null>;
|
|
255
748
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDrawerContent, never>;
|
|
256
749
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxDrawerContent, "[cngxDrawerContent]", ["cngxDrawerContent"], { "drawerRef": { "alias": "cngxDrawerContent"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
257
750
|
}
|
|
@@ -290,12 +783,11 @@ declare class CngxDrawerContent {
|
|
|
290
783
|
* </div>
|
|
291
784
|
* ```
|
|
292
785
|
*
|
|
293
|
-
* @category common/layout
|
|
294
|
-
* @docsKind primary
|
|
295
786
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/observers/intersection-observer.directive.ts
|
|
296
|
-
* @since 0.
|
|
787
|
+
* @since 0.3.0
|
|
297
788
|
* @relatedTo CngxResizeObserver, CngxMediaQuery, CngxInfiniteScroll, CngxScrollSpy
|
|
298
|
-
* <example-url
|
|
789
|
+
* <example-url>/#/common/layout/intersection-observer/scroll-sentinel</example-url>
|
|
790
|
+
* @axis level atom
|
|
299
791
|
*/
|
|
300
792
|
declare class CngxIntersectionObserver {
|
|
301
793
|
/** CSS selector for the scroll container root. `null` (default) uses the viewport. */
|
|
@@ -333,7 +825,7 @@ declare class CngxIntersectionObserver {
|
|
|
333
825
|
* ```html
|
|
334
826
|
* <div cngxMediaQuery="(min-width: 1024px)" #mq="cngxMediaQuery">
|
|
335
827
|
* <nav [cngxDrawerPanel]="drawer"
|
|
336
|
-
* [mode]="mq.matches() ? '
|
|
828
|
+
* [mode]="mq.matches() ? 'push' : 'over'">
|
|
337
829
|
* …
|
|
338
830
|
* </nav>
|
|
339
831
|
* </div>
|
|
@@ -346,12 +838,12 @@ declare class CngxIntersectionObserver {
|
|
|
346
838
|
* </div>
|
|
347
839
|
* ```
|
|
348
840
|
*
|
|
349
|
-
* @category common/layout
|
|
350
|
-
* @docsKind primary
|
|
351
841
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/observers/media-query.directive.ts
|
|
352
|
-
* @since 0.
|
|
842
|
+
* @since 0.3.0
|
|
353
843
|
* @relatedTo CngxResizeObserver, CngxIntersectionObserver
|
|
354
|
-
* <example-url
|
|
844
|
+
* <example-url>/#/common/layout/media-query/viewport-breakpoints</example-url>
|
|
845
|
+
* <example-url>/#/ui/breadcrumb/recipes/mobile-parent-only</example-url>
|
|
846
|
+
* @axis level atom
|
|
355
847
|
*/
|
|
356
848
|
declare class CngxMediaQuery {
|
|
357
849
|
/** The CSS media query string to evaluate. */
|
|
@@ -395,11 +887,10 @@ declare class CngxMediaQuery {
|
|
|
395
887
|
*
|
|
396
888
|
* @param query A CSS media query string, e.g. `(max-width: 640px)`.
|
|
397
889
|
* @returns A reactive `Signal<boolean>` tracking the query's match state.
|
|
398
|
-
* @category common/layout
|
|
399
890
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/observers/inject-media-query.ts
|
|
400
|
-
* @since 0.
|
|
891
|
+
* @since 0.3.0
|
|
401
892
|
* @relatedTo CngxMediaQuery, CngxResizeObserver
|
|
402
|
-
* <example-url
|
|
893
|
+
* <example-url>/#/common/layout/media-query/inject-breakpoint-signal</example-url>
|
|
403
894
|
*/
|
|
404
895
|
declare function injectMediaQuery(query: string): Signal<boolean>;
|
|
405
896
|
|
|
@@ -427,6 +918,15 @@ interface QueryParamSyncOptions<T = boolean> {
|
|
|
427
918
|
* signal is the source and reflects outward. Re-hydrates on browser
|
|
428
919
|
* back/forward. Dev-warns once and no-ops when `@angular/router` is absent.
|
|
429
920
|
*
|
|
921
|
+
* The key, the initial hydrate and the bookkeeping are resolved on the first
|
|
922
|
+
* effect run, not in the call: a `Signal<string>` key backed by an input is
|
|
923
|
+
* read after the input is bound, and in a directive the hydrated state is in
|
|
924
|
+
* place before the caller's view first renders. A read of `state()` in the
|
|
925
|
+
* caller's constructor or `ngOnInit` still sees the un-hydrated value. Called
|
|
926
|
+
* from an environment injector (a service, `runInInjectionContext`), the
|
|
927
|
+
* effects are root effects: `state()` is hydrated on the first application
|
|
928
|
+
* tick, not when the call returns.
|
|
929
|
+
*
|
|
430
930
|
* Loop-safety (the core of this helper): the reflect effect writes the URL in
|
|
431
931
|
* `untracked()` and skips `navigate` when the serialized `state()` equals the
|
|
432
932
|
* last value it wrote - a local closure seeded from the initial URL read, not
|
|
@@ -435,18 +935,17 @@ interface QueryParamSyncOptions<T = boolean> {
|
|
|
435
935
|
* back/forward re-hydration never triggers a reflex navigate. A `param` rename
|
|
436
936
|
* is migrated in one navigate (`{ [old]: null, [new]: serialize(state()) }`)
|
|
437
937
|
* by a dedicated effect whose only tracked source is the normalized param
|
|
438
|
-
* signal; its first run
|
|
938
|
+
* signal; its first run finds the key `init()` seeded and never navigates.
|
|
439
939
|
*
|
|
440
940
|
* The `state.set` inside the hydrate effect is a deliberate signal-write-in-
|
|
441
941
|
* effect: the URL is an external system and `state` is a caller-owned signal
|
|
442
942
|
* the consumer must stay able to toggle, so hydrate cannot be a `computed`. It
|
|
443
943
|
* is edge-guarded by serialized equality and wrapped in `untracked()`.
|
|
444
944
|
*
|
|
445
|
-
* @category common/layout
|
|
446
945
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/router/inject-query-param-sync.ts
|
|
447
|
-
* @since 0.
|
|
946
|
+
* @since 0.3.0
|
|
448
947
|
* @relatedTo CngxStepperRouterSync
|
|
449
|
-
* <example-url
|
|
948
|
+
* <example-url>/#/common/layout/router/persisted-toggle</example-url>
|
|
450
949
|
*/
|
|
451
950
|
declare function injectQueryParamSync<T = boolean>(state: WritableSignal<T>, opts: QueryParamSyncOptions<T>): void;
|
|
452
951
|
|
|
@@ -474,12 +973,12 @@ declare function injectQueryParamSync<T = boolean>(state: WritableSignal<T>, opt
|
|
|
474
973
|
* readonly columns = computed(() => (this.ro()?.width() ?? 0) > 600 ? 3 : 1);
|
|
475
974
|
* ```
|
|
476
975
|
*
|
|
477
|
-
* @category common/layout
|
|
478
|
-
* @docsKind primary
|
|
479
976
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/observers/resize-observer.directive.ts
|
|
480
|
-
* @since 0.
|
|
977
|
+
* @since 0.3.0
|
|
481
978
|
* @relatedTo CngxIntersectionObserver, CngxMediaQuery
|
|
482
|
-
* <example-url
|
|
979
|
+
* <example-url>/#/common/layout/resize-observer/live-size</example-url>
|
|
980
|
+
* <example-url>/#/ui/breadcrumb/recipes/responsive-collapse</example-url>
|
|
981
|
+
* @axis level atom
|
|
483
982
|
*/
|
|
484
983
|
declare class CngxResizeObserver {
|
|
485
984
|
/** Which box model to observe. `'content-box'` (default), `'border-box'`, or `'device-pixel-content-box'`. */
|
|
@@ -506,7 +1005,6 @@ declare class CngxResizeObserver {
|
|
|
506
1005
|
* or a test double. `ResizeObserver` is optional so SSR and jsdom hosts pass
|
|
507
1006
|
* the type and hit the runtime guard instead.
|
|
508
1007
|
*
|
|
509
|
-
* @category common/layout/observers
|
|
510
1008
|
* @since 0.3.0
|
|
511
1009
|
*/
|
|
512
1010
|
interface ResizeObserverHost {
|
|
@@ -531,9 +1029,8 @@ interface ResizeObserverHost {
|
|
|
531
1029
|
* @param box Which box model to report.
|
|
532
1030
|
* @param apply Receives the first entry of every observation batch.
|
|
533
1031
|
* @returns Teardown that disconnects the observer.
|
|
534
|
-
* @category common/layout/observers
|
|
535
1032
|
* @relatedTo createResizeSignal, observeMediaQuery
|
|
536
|
-
* @since 0.
|
|
1033
|
+
* @since 0.3.0
|
|
537
1034
|
*/
|
|
538
1035
|
declare function observeResize(host: ResizeObserverHost | null | undefined, element: Element, box: ResizeObserverBoxOptions, apply: (entry: ResizeObserverEntry) => void): () => void;
|
|
539
1036
|
/**
|
|
@@ -563,9 +1060,8 @@ declare function observeResize(host: ResizeObserverHost | null | undefined, elem
|
|
|
563
1060
|
* @param destroyRef Scope whose destruction disconnects the observer.
|
|
564
1061
|
* @param host The window-like object to read `ResizeObserver` from.
|
|
565
1062
|
* @returns A readonly signal carrying the latest entry.
|
|
566
|
-
* @category common/layout/observers
|
|
567
1063
|
* @relatedTo observeResize, createMediaQuerySignal
|
|
568
|
-
* @since 0.
|
|
1064
|
+
* @since 0.3.0
|
|
569
1065
|
*/
|
|
570
1066
|
declare function createResizeSignal(element: Element, box: ResizeObserverBoxOptions, destroyRef: DestroyRef, host: ResizeObserverHost | null | undefined): Signal<ResizeObserverEntry | null>;
|
|
571
1067
|
|
|
@@ -573,8 +1069,7 @@ declare function createResizeSignal(element: Element, box: ResizeObserverBoxOpti
|
|
|
573
1069
|
* Reactive read of a query container: its size, and the custom properties its
|
|
574
1070
|
* `@container` rules resolved to.
|
|
575
1071
|
*
|
|
576
|
-
* @
|
|
577
|
-
* @since 0.1.0
|
|
1072
|
+
* @since 0.3.0
|
|
578
1073
|
*/
|
|
579
1074
|
interface CngxContainerSize {
|
|
580
1075
|
/** Border-box inline size in pixels. `0` before the first observation. */
|
|
@@ -583,6 +1078,11 @@ interface CngxContainerSize {
|
|
|
583
1078
|
readonly blockSize: Signal<number>;
|
|
584
1079
|
/** `true` once the first observation has arrived. */
|
|
585
1080
|
readonly isReady: Signal<boolean>;
|
|
1081
|
+
/**
|
|
1082
|
+
* `false` on a host without `ResizeObserver` (SSR, jsdom): no observation
|
|
1083
|
+
* ever arrives there, so `isReady` stays `false` for good.
|
|
1084
|
+
*/
|
|
1085
|
+
readonly observes: boolean;
|
|
586
1086
|
/**
|
|
587
1087
|
* The resolved value of a custom property, re-read on every resize of the
|
|
588
1088
|
* container.
|
|
@@ -620,8 +1120,7 @@ interface CngxContainerSize {
|
|
|
620
1120
|
* needs a container and finds none must say so (a dev-mode warning), not
|
|
621
1121
|
* silently observe itself.
|
|
622
1122
|
*
|
|
623
|
-
* @
|
|
624
|
-
* @since 0.1.0
|
|
1123
|
+
* @since 0.3.0
|
|
625
1124
|
*/
|
|
626
1125
|
declare const CNGX_CONTAINER_SIZE: InjectionToken<CngxContainerSize>;
|
|
627
1126
|
/**
|
|
@@ -636,9 +1135,8 @@ declare const CNGX_CONTAINER_SIZE: InjectionToken<CngxContainerSize>;
|
|
|
636
1135
|
* @param element The container host.
|
|
637
1136
|
* @param destroyRef Scope whose destruction disconnects the observer.
|
|
638
1137
|
* @param win The window-like object providing `ResizeObserver` and `getComputedStyle`.
|
|
639
|
-
* @category common/layout/observers
|
|
640
1138
|
* @relatedTo injectContainerSize, CngxContainer
|
|
641
|
-
* @since 0.
|
|
1139
|
+
* @since 0.3.0
|
|
642
1140
|
*/
|
|
643
1141
|
declare function createContainerSize(element: Element, destroyRef: DestroyRef, win: (ResizeObserverHost & Pick<Window, 'getComputedStyle'>) | null | undefined): CngxContainerSize;
|
|
644
1142
|
/**
|
|
@@ -652,7 +1150,7 @@ declare function createContainerSize(element: Element, destroyRef: DestroyRef, w
|
|
|
652
1150
|
* ```typescript
|
|
653
1151
|
* private readonly container = inject(CNGX_CONTAINER_SIZE, { optional: true });
|
|
654
1152
|
* private readonly wide = this.container?.property('--cngx-thing-wide', this.host) ?? signal('').asReadonly();
|
|
655
|
-
* readonly mode = computed(() => (this.wide() === '1' ? '
|
|
1153
|
+
* readonly mode = computed(() => (this.wide() === '1' ? 'push' : 'over'));
|
|
656
1154
|
* ```
|
|
657
1155
|
*
|
|
658
1156
|
* A component that declares the container in its own stylesheet and reads it
|
|
@@ -666,9 +1164,8 @@ declare function createContainerSize(element: Element, destroyRef: DestroyRef, w
|
|
|
666
1164
|
* ```
|
|
667
1165
|
*
|
|
668
1166
|
* @param target Element to observe when no ancestor container exists.
|
|
669
|
-
* @category common/layout/observers
|
|
670
1167
|
* @relatedTo CngxContainer, injectMediaQuery
|
|
671
|
-
* @since 0.
|
|
1168
|
+
* @since 0.3.0
|
|
672
1169
|
*/
|
|
673
1170
|
declare function injectContainerSize(target?: ElementRef<Element> | Element): CngxContainerSize;
|
|
674
1171
|
|
|
@@ -709,12 +1206,11 @@ declare function injectContainerSize(target?: ElementRef<Element> | Element): Cn
|
|
|
709
1206
|
* content (an inline chip, a `width: max-content` bar) must not be a
|
|
710
1207
|
* container.
|
|
711
1208
|
*
|
|
712
|
-
* @category common/layout
|
|
713
|
-
* @docsKind primary
|
|
714
1209
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/observers/container.directive.ts
|
|
715
|
-
* @since 0.
|
|
1210
|
+
* @since 0.3.0
|
|
716
1211
|
* @relatedTo injectContainerSize, CngxResizeObserver, CngxMediaQuery
|
|
717
|
-
* <example-url
|
|
1212
|
+
* <example-url>/#/common/layout/container/css-decides-js-reads</example-url>
|
|
1213
|
+
* @axis level atom
|
|
718
1214
|
*/
|
|
719
1215
|
declare class CngxContainer implements CngxContainerSize {
|
|
720
1216
|
private readonly size;
|
|
@@ -724,6 +1220,8 @@ declare class CngxContainer implements CngxContainerSize {
|
|
|
724
1220
|
readonly blockSize: Signal<number>;
|
|
725
1221
|
/** `true` once the first observation has arrived. */
|
|
726
1222
|
readonly isReady: Signal<boolean>;
|
|
1223
|
+
/** `false` on a host without `ResizeObserver` (SSR, jsdom). */
|
|
1224
|
+
readonly observes: boolean;
|
|
727
1225
|
/**
|
|
728
1226
|
* The resolved value of a custom property on `on` (default: this host),
|
|
729
1227
|
* re-read on every resize. The `@container` rule must style a descendant,
|
|
@@ -736,14 +1234,372 @@ declare class CngxContainer implements CngxContainerSize {
|
|
|
736
1234
|
}
|
|
737
1235
|
|
|
738
1236
|
/**
|
|
739
|
-
*
|
|
1237
|
+
* What a `CngxPanelTrigger` does on activation.
|
|
1238
|
+
*
|
|
1239
|
+
* @since 0.3.0
|
|
1240
|
+
*/
|
|
1241
|
+
type CngxPanelTriggerAction = 'toggle' | 'peek';
|
|
1242
|
+
/**
|
|
1243
|
+
* The trigger of a drawer, sidebar or sidenav panel. It owns no state: it
|
|
1244
|
+
* mirrors the target's `expanded` as `aria-expanded`, points
|
|
1245
|
+
* `aria-controls` at the target's `id`, and calls `toggle()` (or `peek()`)
|
|
1246
|
+
* on click, Enter and Space.
|
|
1247
|
+
*
|
|
1248
|
+
* The target is an explicit reference (`[cngxPanelTrigger]="drawer"`). A
|
|
1249
|
+
* bare `cngxPanelTrigger` inside the panel resolves the surrounding
|
|
1250
|
+
* `CNGX_PANEL_TARGET` (a pin or close button). Because the trigger names
|
|
1251
|
+
* the panel in `aria-controls`, a press on it is not an outside press for
|
|
1252
|
+
* the panel's dismissal, so one press toggles once.
|
|
1253
|
+
*
|
|
1254
|
+
* On a native `<button>` the browser turns Enter and Space into the click.
|
|
1255
|
+
* Any other host gets `role="button"`, `tabindex="0"` and its own
|
|
1256
|
+
* Enter / Space handling. An icon-only trigger (no text content; text
|
|
1257
|
+
* inside `hidden` or `aria-hidden` elements does not count) is named after
|
|
1258
|
+
* the panel: a bound `label`, else a static `aria-label`, else the
|
|
1259
|
+
* target's `label`, else
|
|
1260
|
+
* `CNGX_LAYOUT_I18N.panelTrigger`. The name stays the same while the panel
|
|
1261
|
+
* opens and closes; `aria-expanded` carries the state. A trigger with
|
|
1262
|
+
* visible text keeps its text as its name. The check follows the host
|
|
1263
|
+
* content: text added to or removed from the trigger later (an
|
|
1264
|
+
* interpolation, an `@if`) switches between the two.
|
|
1265
|
+
*
|
|
1266
|
+
* The trigger draws nothing: the host's content is the consumer's. For an
|
|
1267
|
+
* icon button with a glyph that follows the panel, use
|
|
1268
|
+
* `button[cngxPanelToggle]`, which composes this directive.
|
|
740
1269
|
*
|
|
741
|
-
*
|
|
1270
|
+
* ```html
|
|
1271
|
+
* <button type="button" [cngxPanelTrigger]="drawer">Menu</button>
|
|
1272
|
+
* <div cngxDrawer #drawer="cngxDrawer" panelId="nav">
|
|
1273
|
+
* <nav [cngxDrawerPanel]="drawer">…</nav>
|
|
1274
|
+
* </div>
|
|
1275
|
+
* ```
|
|
1276
|
+
*
|
|
1277
|
+
* @wcag AA
|
|
1278
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/panel-trigger/panel-trigger.directive.ts
|
|
1279
|
+
* @since 0.3.0
|
|
1280
|
+
* @relatedTo CngxPanelToggle, CngxPanelTarget, CNGX_PANEL_TARGET, CngxDrawer, CngxSidebar
|
|
1281
|
+
* <example-url>/#/common/layout/sidebar/clipped-below-header</example-url>
|
|
1282
|
+
* <example-url>/#/common/layout/sidebar/collapsible-rail</example-url>
|
|
1283
|
+
* <example-url>/#/common/layout/sidebar/inset-app-sidebar</example-url>
|
|
1284
|
+
* <example-url>/#/common/layout/drawer/app-header-clipped</example-url>
|
|
1285
|
+
* <example-url>/#/common/layout/drawer/full-height-modal</example-url>
|
|
1286
|
+
* @axis level atom
|
|
1287
|
+
*/
|
|
1288
|
+
declare class CngxPanelTrigger {
|
|
1289
|
+
/**
|
|
1290
|
+
* The panel to control. Bind it explicitly, or leave the attribute bare
|
|
1291
|
+
* inside a panel that provides `CNGX_PANEL_TARGET`.
|
|
1292
|
+
*/
|
|
1293
|
+
readonly targetInput: _angular_core.InputSignalWithTransform<CngxPanelTarget | undefined, "" | CngxPanelTarget | undefined>;
|
|
1294
|
+
/**
|
|
1295
|
+
* `toggle` (default) flips the panel. `peek` shows it temporarily; a target
|
|
1296
|
+
* without `peek()` toggles instead.
|
|
1297
|
+
*/
|
|
1298
|
+
readonly action: _angular_core.InputSignal<CngxPanelTriggerAction>;
|
|
1299
|
+
/**
|
|
1300
|
+
* Accessible name. Unbound, a static `aria-label` on the host stays; on a
|
|
1301
|
+
* trigger without text content or a static `aria-label` it falls back to
|
|
1302
|
+
* the target's `label`, then to `CNGX_LAYOUT_I18N.panelTrigger`. It does
|
|
1303
|
+
* not follow the panel state; `aria-expanded` does.
|
|
1304
|
+
*/
|
|
1305
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
1306
|
+
private readonly host;
|
|
1307
|
+
private readonly providedTarget;
|
|
1308
|
+
private readonly i18n;
|
|
1309
|
+
private readonly staticLabel;
|
|
1310
|
+
private readonly rendered;
|
|
1311
|
+
private readonly nameVersion;
|
|
1312
|
+
private readonly hasOwnName;
|
|
1313
|
+
protected readonly nativeButton: boolean;
|
|
1314
|
+
/** The resolved target: the explicit reference wins over the provided one. */
|
|
1315
|
+
readonly target: _angular_core.Signal<CngxPanelTarget | null>;
|
|
1316
|
+
/**
|
|
1317
|
+
* Whether the controlled panel is shown in its resting state. A peek is
|
|
1318
|
+
* transient pointer presentation, so a peeked target reads as collapsed.
|
|
1319
|
+
*/
|
|
1320
|
+
readonly expanded: _angular_core.Signal<boolean>;
|
|
1321
|
+
protected readonly controls: _angular_core.Signal<string | null>;
|
|
1322
|
+
private readonly fallbackLabel;
|
|
1323
|
+
protected readonly resolvedLabel: _angular_core.Signal<string | null>;
|
|
1324
|
+
protected readonly handleActivationKey: (event: Event) => void;
|
|
1325
|
+
constructor();
|
|
1326
|
+
/** Runs the action on the target. */
|
|
1327
|
+
activate(): void;
|
|
1328
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPanelTrigger, never>;
|
|
1329
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxPanelTrigger, "[cngxPanelTrigger]", ["cngxPanelTrigger"], { "targetInput": { "alias": "cngxPanelTrigger"; "required": false; "isSignal": true; }; "action": { "alias": "action"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* Icon button that opens and closes a drawer or sidebar and draws its own
|
|
1334
|
+
* glyph. The behaviour is a composed `CngxPanelTrigger`: `aria-expanded`
|
|
1335
|
+
* mirrors the panel, `aria-controls` names it, a press toggles it (or peeks
|
|
1336
|
+
* it with `action="peek"`), and the accessible name is the panel's: a
|
|
1337
|
+
* bound `label`, else the target's `label`, else
|
|
1338
|
+
* `CNGX_LAYOUT_I18N.panelTrigger`. The name stays the same while the panel
|
|
1339
|
+
* opens and closes.
|
|
1340
|
+
*
|
|
1341
|
+
* The glyph follows how the target presents the panel right now, so it
|
|
1342
|
+
* changes with a breakpoint that switches the panel's `mode`:
|
|
1343
|
+
*
|
|
1344
|
+
* - a modal over-drawer (the mobile nav: `mode="over"` with a `page` or
|
|
1345
|
+
* `contained` modality) shows three bars while closed and a cross while
|
|
1346
|
+
* open;
|
|
1347
|
+
* - every other presentation (an inline sidebar or rail, a push drawer, a
|
|
1348
|
+
* non-modal over-drawer) shows a panel glyph that draws what a press
|
|
1349
|
+
* does: a frame with a column on the panel's side and a chevron pointing
|
|
1350
|
+
* away from the column while the panel is closed (open it), toward the
|
|
1351
|
+
* column while it is open (close it). `aria-expanded` carries the same
|
|
1352
|
+
* state for assistive technology. The glyph mirrors for a panel
|
|
1353
|
+
* on the right: `position="right"`, or the end side in LTR and the start
|
|
1354
|
+
* side in RTL (`CNGX_DIRECTION`).
|
|
1355
|
+
*
|
|
1356
|
+
* A target without `mode` / `modal` / `side` (a consumer-built
|
|
1357
|
+
* `CngxPanelTarget`) reads as an inline panel on the start side. The glyph
|
|
1358
|
+
* is `aria-hidden`; project an icon to replace it. The state the default
|
|
1359
|
+
* glyph follows is public on the exported instance (`expanded`,
|
|
1360
|
+
* `modalOverlay`, `mirrored`), so a projected glyph can follow it too:
|
|
1361
|
+
*
|
|
1362
|
+
* ```html
|
|
1363
|
+
* <button type="button" [cngxPanelToggle]="nav" #toggle="cngxPanelToggle">
|
|
1364
|
+
* <cngx-icon [style.transform]="toggle.mirrored() ? 'scaleX(-1)' : null">
|
|
1365
|
+
* <mat-icon>{{ toggle.expanded() ? 'menu_open' : 'menu' }}</mat-icon>
|
|
1366
|
+
* </cngx-icon>
|
|
1367
|
+
* </button>
|
|
1368
|
+
* ```
|
|
1369
|
+
*
|
|
1370
|
+
* Shares the button family's state surface: `disabled` renders
|
|
1371
|
+
* `aria-disabled` (the button stays focusable and swallows activation) and
|
|
1372
|
+
* `disabledReason` is read through `aria-describedby`. The emphasis stays
|
|
1373
|
+
* `ghost` unless `variant` is set; `size` and `tone` fall through to the
|
|
1374
|
+
* group, `provideButtonConfig` and the icon-button defaults.
|
|
1375
|
+
*
|
|
1376
|
+
* ```html
|
|
1377
|
+
* <button type="button" [cngxPanelToggle]="nav"></button>
|
|
1378
|
+
* <div cngxDrawer #nav="cngxDrawer" panelId="main-nav">
|
|
1379
|
+
* <nav [cngxDrawerPanel]="nav" [mode]="mobile() ? 'over' : 'push'">…</nav>
|
|
1380
|
+
* </div>
|
|
1381
|
+
* ```
|
|
1382
|
+
*
|
|
1383
|
+
* @wcag AA
|
|
1384
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/panel-toggle/panel-toggle.component.ts
|
|
1385
|
+
* @since 0.3.0
|
|
1386
|
+
* @relatedTo CngxPanelTrigger, CngxPanelTarget, CngxDrawer, CngxSidebar, CngxIconButton
|
|
1387
|
+
* <example-url>/#/common/layout/sidebar/inset-app-sidebar</example-url>
|
|
1388
|
+
* <example-url>/#/common/layout/sidebar/collapsible-rail</example-url>
|
|
1389
|
+
* <example-url>/#/common/layout/drawer/app-header-clipped</example-url>
|
|
1390
|
+
* <example-url>/#/common/layout/drawer/full-height-modal</example-url>
|
|
1391
|
+
* <example-url>/#/common/layout/drawer/filter-panel-push</example-url>
|
|
1392
|
+
* <example-url>/#/common/layout/sidebar/projected-toggle-glyph</example-url>
|
|
1393
|
+
* @axis level molecule
|
|
1394
|
+
*/
|
|
1395
|
+
declare class CngxPanelToggle {
|
|
1396
|
+
private readonly trigger;
|
|
1397
|
+
private readonly direction;
|
|
1398
|
+
/**
|
|
1399
|
+
* Whether the target shows the panel right now. Read it from a projected
|
|
1400
|
+
* glyph through `#toggle="cngxPanelToggle"`.
|
|
1401
|
+
*/
|
|
1402
|
+
readonly expanded: _angular_core.Signal<boolean>;
|
|
1403
|
+
/**
|
|
1404
|
+
* Whether the target presents the panel as a modal over-drawer right now
|
|
1405
|
+
* (`mode="over"` with a blocking modality). The default glyph draws menu
|
|
1406
|
+
* bars and a cross then; a projected glyph can follow the same switch.
|
|
1407
|
+
*/
|
|
1408
|
+
readonly modalOverlay: _angular_core.Signal<boolean>;
|
|
1409
|
+
/**
|
|
1410
|
+
* Whether a panel glyph drawn for a left panel must be flipped: the panel
|
|
1411
|
+
* sits on the right (`right`, `end` in LTR, `start` in RTL). Always
|
|
1412
|
+
* `false` while {@link modalOverlay} holds.
|
|
1413
|
+
*/
|
|
1414
|
+
readonly mirrored: _angular_core.Signal<boolean>;
|
|
1415
|
+
/** @internal - the default glyph for the current presentation and state. */
|
|
1416
|
+
protected readonly icon: _angular_core.Signal<{
|
|
1417
|
+
readonly viewBox: "0 0 24 24";
|
|
1418
|
+
readonly d: "M6 6l12 12M18 6L6 18";
|
|
1419
|
+
readonly paint: "stroke";
|
|
1420
|
+
readonly micro: {
|
|
1421
|
+
readonly viewBox: "0 0 12 12";
|
|
1422
|
+
readonly d: "M2 3L3 2L10 9L9 10ZM9 2L10 3L3 10L2 9Z";
|
|
1423
|
+
};
|
|
1424
|
+
readonly small: {
|
|
1425
|
+
readonly viewBox: "0 0 16 16";
|
|
1426
|
+
readonly d: "M3 4L4 3L13 12L12 13ZM12 3L13 4L4 13L3 12Z";
|
|
1427
|
+
};
|
|
1428
|
+
} | {
|
|
1429
|
+
readonly viewBox: "0 0 24 24";
|
|
1430
|
+
readonly d: "M4 6h16M4 12h16M4 18h16";
|
|
1431
|
+
readonly paint: "stroke";
|
|
1432
|
+
readonly micro: {
|
|
1433
|
+
readonly viewBox: "0 0 12 12";
|
|
1434
|
+
readonly d: "M2 2H10V3H2ZM2 5H10V6H2ZM2 8H10V9H2Z";
|
|
1435
|
+
};
|
|
1436
|
+
readonly small: {
|
|
1437
|
+
readonly viewBox: "0 0 16 16";
|
|
1438
|
+
readonly d: "M2 3H14V4H2ZM2 7H14V8H2ZM2 11H14V12H2Z";
|
|
1439
|
+
};
|
|
1440
|
+
} | {
|
|
1441
|
+
readonly viewBox: "0 0 24 24";
|
|
1442
|
+
readonly d: "M7 5h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM10 5v14M16 9l-3 3 3 3";
|
|
1443
|
+
readonly paint: "stroke";
|
|
1444
|
+
readonly micro: {
|
|
1445
|
+
readonly viewBox: "0 0 12 12";
|
|
1446
|
+
readonly d: "M2 1H10V2H2ZM1 2H2V10H1ZM4 2H5V10H4ZM10 2H11V10H10ZM8 3H9V4H8ZM7 4H8V5H7ZM6 5H7V7H6ZM7 7H8V8H7ZM8 8H9V9H8ZM2 10H10V11H2Z";
|
|
1447
|
+
};
|
|
1448
|
+
readonly small: {
|
|
1449
|
+
readonly viewBox: "0 0 16 16";
|
|
1450
|
+
readonly d: "M3 2H13V3H3ZM2 3H3V13H2ZM5 3H6V13H5ZM13 3H14V13H13ZM10 5H11V6H10ZM9 6H10V7H9ZM8 7H9V9H8ZM9 9H10V10H9ZM10 10H11V11H10ZM3 13H13V14H3Z";
|
|
1451
|
+
};
|
|
1452
|
+
} | {
|
|
1453
|
+
readonly viewBox: "0 0 24 24";
|
|
1454
|
+
readonly d: "M7 5h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2zM10 5v14M13 9l3 3-3 3";
|
|
1455
|
+
readonly paint: "stroke";
|
|
1456
|
+
readonly micro: {
|
|
1457
|
+
readonly viewBox: "0 0 12 12";
|
|
1458
|
+
readonly d: "M2 1H10V2H2ZM1 2H2V10H1ZM4 2H5V10H4ZM10 2H11V10H10ZM6 3H7V4H6ZM7 4H8V5H7ZM8 5H9V7H8ZM7 7H8V8H7ZM6 8H7V9H6ZM2 10H10V11H2Z";
|
|
1459
|
+
};
|
|
1460
|
+
readonly small: {
|
|
1461
|
+
readonly viewBox: "0 0 16 16";
|
|
1462
|
+
readonly d: "M3 2H13V3H3ZM2 3H3V13H2ZM5 3H6V13H5ZM13 3H14V13H13ZM8 5H9V6H8ZM9 6H10V7H9ZM10 7H11V9H10ZM9 9H10V10H9ZM8 10H9V11H8ZM3 13H13V14H3Z";
|
|
1463
|
+
};
|
|
1464
|
+
}>;
|
|
1465
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxPanelToggle, never>;
|
|
1466
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxPanelToggle, "button[cngxPanelToggle]", ["cngxPanelToggle"], {}, {}, never, ["*"], true, [{ directive: typeof CngxPanelTrigger; inputs: { "cngxPanelTrigger": "cngxPanelToggle"; "action": "action"; "label": "label"; }; outputs: {}; }, { directive: typeof i2$1.CngxButtonBrain; inputs: { "variant": "variant"; "tone": "tone"; "size": "size"; "disabled": "disabled"; "disabledReason": "disabledReason"; "cngxDescribedBy": "cngxDescribedBy"; "type": "type"; }; outputs: {}; }]>;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Which inline edge of the resized panel the handle sits on. Logical, so the
|
|
1471
|
+
* drag and arrow-key direction follow the writing direction.
|
|
1472
|
+
*
|
|
1473
|
+
* @since 0.3.0
|
|
1474
|
+
*/
|
|
1475
|
+
type CngxResizableEdge = 'inline-start' | 'inline-end';
|
|
1476
|
+
/**
|
|
1477
|
+
* Optional app-wide defaults for `CngxResizable`'s bounds and key step.
|
|
1478
|
+
* Provide it to move the `min` / `max` / `step` fallbacks an organism
|
|
1479
|
+
* composes the handle with, without touching the per-instance input surface.
|
|
1480
|
+
* Every key is optional - an unset key keeps the atom's literal
|
|
1481
|
+
* (120 / 600 / 16).
|
|
1482
|
+
*
|
|
1483
|
+
* @since 0.3.0
|
|
1484
|
+
*/
|
|
1485
|
+
interface CngxResizableDefaults {
|
|
1486
|
+
/** Fallback for `min` (px) when the input is not bound. */
|
|
1487
|
+
readonly min?: number;
|
|
1488
|
+
/** Fallback for `max` (px) when the input is not bound. */
|
|
1489
|
+
readonly max?: number;
|
|
1490
|
+
/** Fallback for `step` (px per arrow-key press) when the input is not bound. */
|
|
1491
|
+
readonly step?: number;
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Optional DI fallback for `CngxResizable`'s `min` / `max` / `step` input
|
|
1495
|
+
* defaults. Resolution is `bound input -> injected default -> literal`
|
|
1496
|
+
* (120 / 600 / 16). A hostDirective input default cannot be overridden by the
|
|
1497
|
+
* host that composes it, so this token is the layered extension point a
|
|
1498
|
+
* resizable organism uses to set app-wide bounds. `optional`, so standalone
|
|
1499
|
+
* `[cngxResizable]` stays byte-identical when the token is absent.
|
|
1500
|
+
*
|
|
1501
|
+
* @relatedTo CngxResizable
|
|
1502
|
+
* @since 0.3.0
|
|
1503
|
+
*/
|
|
1504
|
+
declare const CNGX_RESIZABLE_DEFAULTS: InjectionToken<CngxResizableDefaults>;
|
|
1505
|
+
/**
|
|
1506
|
+
* A resize handle for a side panel: the WAI-ARIA window-splitter pattern on
|
|
1507
|
+
* the handle element.
|
|
1508
|
+
*
|
|
1509
|
+
* The handle owns no layout. It reads and writes `size` (px) through a
|
|
1510
|
+
* two-way binding; the consumer applies the size to the panel (an inline
|
|
1511
|
+
* size or a custom property). Pointer drag runs with pointer capture and
|
|
1512
|
+
* writes at most once per animation frame; the handle sets
|
|
1513
|
+
* `touch-action: none`, so a touch drag resizes instead of panning the page.
|
|
1514
|
+
* The keyboard path makes the handle operable without a pointer (WCAG
|
|
1515
|
+
* 2.1.1): Arrow Left / Right move the handle by `step`, Home / End jump to
|
|
1516
|
+
* `min` / `max`. Modified keys pass through.
|
|
1517
|
+
*
|
|
1518
|
+
* `edge` names the panel edge the handle sits on: `inline-end` for a panel at
|
|
1519
|
+
* the start of the row (the handle grows the panel toward the end),
|
|
1520
|
+
* `inline-start` for a panel at the end. Under `dir="rtl"` the physical
|
|
1521
|
+
* directions flip with the writing direction.
|
|
1522
|
+
*
|
|
1523
|
+
* ARIA lives in the `computed()` graph: `role="separator"`,
|
|
1524
|
+
* `aria-orientation="vertical"`, `aria-valuenow` / `-min` / `-max`,
|
|
1525
|
+
* `aria-valuetext` and `aria-label` (copy from `CNGX_LAYOUT_I18N` unless the
|
|
1526
|
+
* `label` / `valueText` inputs are bound).
|
|
1527
|
+
* The pattern also refers the handle to the resized panel through
|
|
1528
|
+
* `aria-controls`; the handle does not know the panel, so set it on the host
|
|
1529
|
+
* (`aria-controls="filters"`) next to the panel's `id`. The handle never binds
|
|
1530
|
+
* it, so a static attribute stays.
|
|
1531
|
+
*
|
|
1532
|
+
* `min`, `max` and `step` fall back to `CNGX_RESIZABLE_DEFAULTS`, then to
|
|
1533
|
+
* 120 / 600 / 16.
|
|
1534
|
+
*
|
|
1535
|
+
* ```html
|
|
1536
|
+
* <aside id="side" [style.inline-size.px]="width()">…</aside>
|
|
1537
|
+
* <div cngxResizable [(size)]="width" [min]="200" [max]="480" aria-controls="side"></div>
|
|
1538
|
+
* ```
|
|
1539
|
+
*
|
|
1540
|
+
* @wcag AA
|
|
1541
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/resizable/resizable.directive.ts
|
|
1542
|
+
* @since 0.3.0
|
|
1543
|
+
* @relatedTo CngxSidebar, CngxDrawerPanel, CNGX_LAYOUT_I18N
|
|
1544
|
+
* <example-url>/#/common/layout/resizable/side-panel</example-url>
|
|
1545
|
+
* @axis level atom
|
|
1546
|
+
*/
|
|
1547
|
+
declare class CngxResizable {
|
|
1548
|
+
/**
|
|
1549
|
+
* Optional app-wide bounds. Declared first so the input initialisers below
|
|
1550
|
+
* can source their fallback from it. Absent by default - standalone
|
|
1551
|
+
* `[cngxResizable]` then keeps the 120 / 600 / 16 literals.
|
|
1552
|
+
*/
|
|
1553
|
+
private readonly defaults;
|
|
1554
|
+
/** Size of the resized panel in px. Two-way: `[(size)]="width"`. */
|
|
1555
|
+
readonly size: _angular_core.ModelSignal<number>;
|
|
1556
|
+
/** Smallest size in px a drag or key can reach. */
|
|
1557
|
+
readonly min: _angular_core.InputSignal<number>;
|
|
1558
|
+
/** Largest size in px a drag or key can reach. */
|
|
1559
|
+
readonly max: _angular_core.InputSignal<number>;
|
|
1560
|
+
/** The panel edge the handle sits on; sets the drag and arrow-key direction. */
|
|
1561
|
+
readonly edge: _angular_core.InputSignal<CngxResizableEdge>;
|
|
1562
|
+
/** Size change in px per arrow-key press. */
|
|
1563
|
+
readonly step: _angular_core.InputSignal<number>;
|
|
1564
|
+
/** Accessible name of the handle. Falls back to `CNGX_LAYOUT_I18N.resizeHandle`. */
|
|
1565
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
1566
|
+
/**
|
|
1567
|
+
* `aria-valuetext` for a px size. Falls back to
|
|
1568
|
+
* `CNGX_LAYOUT_I18N.resizeValueText`.
|
|
1569
|
+
*/
|
|
1570
|
+
readonly valueText: _angular_core.InputSignal<((size: number) => string) | undefined>;
|
|
1571
|
+
private readonly doc;
|
|
1572
|
+
private readonly direction;
|
|
1573
|
+
private readonly i18n;
|
|
1574
|
+
private readonly resizingState;
|
|
1575
|
+
private dragAbort;
|
|
1576
|
+
/** Whether a pointer drag is in progress. */
|
|
1577
|
+
readonly resizing: _angular_core.Signal<boolean>;
|
|
1578
|
+
protected readonly valueNow: _angular_core.Signal<number>;
|
|
1579
|
+
protected readonly resolvedLabel: _angular_core.Signal<string>;
|
|
1580
|
+
protected readonly resolvedValueText: _angular_core.Signal<string>;
|
|
1581
|
+
/** +1 when moving the handle physically right grows the panel, else -1. */
|
|
1582
|
+
private readonly growSign;
|
|
1583
|
+
constructor();
|
|
1584
|
+
protected handleKeydown(event: KeyboardEvent): void;
|
|
1585
|
+
protected handlePointerDown(event: PointerEvent): void;
|
|
1586
|
+
private keyTarget;
|
|
1587
|
+
private clamped;
|
|
1588
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxResizable, never>;
|
|
1589
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxResizable, "[cngxResizable]", ["cngxResizable"], { "size": { "alias": "size"; "required": true; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "edge": { "alias": "edge"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "valueText": { "alias": "valueText"; "required": false; "isSignal": true; }; }, { "size": "sizeChange"; }, never, never, true, never>;
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Prevents scrolling on the document, or on a given scroll container, when
|
|
1594
|
+
* enabled.
|
|
1595
|
+
*
|
|
1596
|
+
* Sets `overflow: hidden` and `scrollbar-gutter: stable` on the target
|
|
1597
|
+
* (`<html>` unless `[cngxScrollLockTarget]` names another element) to
|
|
742
1598
|
* prevent layout shift when the scrollbar disappears. Restores original
|
|
743
|
-
* values when all lock instances are released.
|
|
1599
|
+
* values when all lock instances on that target are released.
|
|
744
1600
|
*
|
|
745
|
-
* Multiple instances are ref-counted - the original styles are
|
|
746
|
-
* restored when the last lock is released.
|
|
1601
|
+
* Multiple instances are ref-counted per target - the original styles are
|
|
1602
|
+
* only restored when the last lock on that element is released.
|
|
747
1603
|
*
|
|
748
1604
|
* ### With a drawer
|
|
749
1605
|
* ```html
|
|
@@ -757,30 +1613,47 @@ declare class CngxContainer implements CngxContainerSize {
|
|
|
757
1613
|
* <div [cngxScrollLock]="isModalOpen()">…</div>
|
|
758
1614
|
* ```
|
|
759
1615
|
*
|
|
760
|
-
*
|
|
761
|
-
*
|
|
1616
|
+
* ### Inside a scroll container
|
|
1617
|
+
* ```html
|
|
1618
|
+
* <section #pane class="pane">
|
|
1619
|
+
* <aside [cngxScrollLock]="open()" [cngxScrollLockTarget]="pane">…</aside>
|
|
1620
|
+
* </section>
|
|
1621
|
+
* ```
|
|
1622
|
+
*
|
|
762
1623
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/scroll-lock.directive.ts
|
|
763
|
-
* @since 0.
|
|
1624
|
+
* @since 0.3.0
|
|
764
1625
|
* @relatedTo CngxDrawer, CngxBackdrop
|
|
765
|
-
* <example-url
|
|
1626
|
+
* <example-url>/#/common/layout/scroll-lock/toggle</example-url>
|
|
1627
|
+
* @axis level atom
|
|
766
1628
|
*/
|
|
767
1629
|
declare class CngxScrollLock {
|
|
768
1630
|
/** Whether scroll lock is active. */
|
|
769
1631
|
readonly enabled: _angular_core.InputSignal<boolean>;
|
|
1632
|
+
/**
|
|
1633
|
+
* The scrolling element to lock. Defaults to the document root
|
|
1634
|
+
* (`document.documentElement`). Changing it while locked moves the lock.
|
|
1635
|
+
*/
|
|
1636
|
+
readonly target: _angular_core.InputSignal<HTMLElement | null | undefined>;
|
|
770
1637
|
constructor();
|
|
771
1638
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxScrollLock, never>;
|
|
772
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxScrollLock, "[cngxScrollLock]", ["cngxScrollLock"], { "enabled": { "alias": "cngxScrollLock"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1639
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxScrollLock, "[cngxScrollLock]", ["cngxScrollLock"], { "enabled": { "alias": "cngxScrollLock"; "required": false; "isSignal": true; }; "target": { "alias": "cngxScrollLockTarget"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
773
1640
|
}
|
|
774
1641
|
|
|
775
1642
|
/**
|
|
776
|
-
* Acquire a ref-counted scroll lock on
|
|
777
|
-
*
|
|
1643
|
+
* Acquire a ref-counted scroll lock on an element and get back the matching
|
|
1644
|
+
* release function.
|
|
778
1645
|
*
|
|
779
|
-
* The
|
|
780
|
-
*
|
|
1646
|
+
* The target is the element that scrolls: the document root
|
|
1647
|
+
* (`document.documentElement`) for the page, or any scroll container (a
|
|
1648
|
+
* panel with `overflow-y: auto`) for a surface that overlays only that
|
|
1649
|
+
* container. Each element keeps its own count, so locks on two containers
|
|
1650
|
+
* never interfere.
|
|
1651
|
+
*
|
|
1652
|
+
* The first active lock on a target saves its inline `overflow` /
|
|
1653
|
+
* `scrollbar-gutter` and sets `overflow: hidden` + `scrollbar-gutter: stable`
|
|
781
1654
|
* (no layout shift when the scrollbar disappears). Releasing the last active
|
|
782
|
-
* lock restores the saved values. The returned release
|
|
783
|
-
* idempotent - calling it twice cannot over-decrement the count.
|
|
1655
|
+
* lock on that target restores the saved values. The returned release
|
|
1656
|
+
* function is idempotent - calling it twice cannot over-decrement the count.
|
|
784
1657
|
*
|
|
785
1658
|
* Shared engine behind `CngxScrollLock` and `CngxDialog`'s modal scroll lock;
|
|
786
1659
|
* consumers composing their own overlay primitives can use it directly.
|
|
@@ -791,15 +1664,44 @@ declare class CngxScrollLock {
|
|
|
791
1664
|
* release();
|
|
792
1665
|
* ```
|
|
793
1666
|
*
|
|
794
|
-
* @param
|
|
1667
|
+
* @param target - The scrolling element to lock.
|
|
795
1668
|
* @returns Release function for this acquisition. Idempotent.
|
|
796
1669
|
*
|
|
797
|
-
* @category common/layout
|
|
798
1670
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/scroll-lock-core.ts
|
|
799
|
-
* @since 0.
|
|
1671
|
+
* @since 0.3.0
|
|
800
1672
|
* @relatedTo CngxScrollLock, CngxDialog
|
|
801
1673
|
*/
|
|
802
|
-
declare function createScrollLock(
|
|
1674
|
+
declare function createScrollLock(target: HTMLElement): () => void;
|
|
1675
|
+
/**
|
|
1676
|
+
* Acquire a ref-counted scroll lock that pins the page body in place, for
|
|
1677
|
+
* overlays that must hold on iOS Safari.
|
|
1678
|
+
*
|
|
1679
|
+
* `overflow: hidden` on the root does not stop iOS Safari from scrolling a
|
|
1680
|
+
* page that was already scrolled, and the visual viewport drifts with it, so
|
|
1681
|
+
* a bottom-fixed overlay ends above the visible bottom. The first pin saves
|
|
1682
|
+
* the body's inline `position`, `top`, `inset-inline` and `overflow` and the
|
|
1683
|
+
* scroll position, fixes the body at `top: -scrollY`, and acquires
|
|
1684
|
+
* {@link createScrollLock} on the root. The last
|
|
1685
|
+
* release restores the body, releases the root lock and scrolls back to the
|
|
1686
|
+
* saved position. The returned release function is idempotent.
|
|
1687
|
+
*
|
|
1688
|
+
* `CngxDialog` and `CngxScrollLock` keep {@link createScrollLock}; reach for
|
|
1689
|
+
* this one when the overlay is pinned to the viewport bottom on touch devices.
|
|
1690
|
+
*
|
|
1691
|
+
* ```typescript
|
|
1692
|
+
* const release = createPinnedScrollLock(document.documentElement);
|
|
1693
|
+
* // ... sheet open ...
|
|
1694
|
+
* release();
|
|
1695
|
+
* ```
|
|
1696
|
+
*
|
|
1697
|
+
* @param html - The document root (`document.documentElement`) to lock.
|
|
1698
|
+
* @returns Release function for this acquisition. Idempotent.
|
|
1699
|
+
*
|
|
1700
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/scroll-lock-core.ts
|
|
1701
|
+
* @since 0.3.0
|
|
1702
|
+
* @relatedTo createScrollLock, CngxPopoverSheet
|
|
1703
|
+
*/
|
|
1704
|
+
declare function createPinnedScrollLock(html: HTMLElement): () => void;
|
|
803
1705
|
|
|
804
1706
|
/**
|
|
805
1707
|
* Reports which edges of a scrollport still hide content and reflects them as
|
|
@@ -811,14 +1713,17 @@ declare function createScrollLock(html: HTMLElement): () => void;
|
|
|
811
1713
|
* the scroll metrics per animation frame; the attributes are present (empty
|
|
812
1714
|
* value) while true and absent otherwise:
|
|
813
1715
|
*
|
|
814
|
-
* - `data-scroll-block-start` / `canScrollBlockStart()` -
|
|
815
|
-
* - `data-scroll-block-end` / `canScrollBlockEnd()` -
|
|
1716
|
+
* - `data-scroll-block-start` / `canScrollBlockStart()` - hidden toward block start
|
|
1717
|
+
* - `data-scroll-block-end` / `canScrollBlockEnd()` - hidden toward block end
|
|
816
1718
|
* - `data-scroll-inline-start` / `canScrollInlineStart()` - hidden toward inline start
|
|
817
1719
|
* - `data-scroll-inline-end` / `canScrollInlineEnd()` - hidden toward inline end
|
|
818
1720
|
*
|
|
819
|
-
*
|
|
820
|
-
*
|
|
821
|
-
*
|
|
1721
|
+
* In a horizontal writing mode block start / end are the top and bottom
|
|
1722
|
+
* edges; under a `vertical-*` or `sideways-*` writing mode they are the
|
|
1723
|
+
* horizontal ones. Inline start / end follow the writing direction: in
|
|
1724
|
+
* `dir="rtl"` the start edge is on the right. The direction is derived from
|
|
1725
|
+
* the scroll offset itself, so a `dir="rtl"` subtree inside an LTR page
|
|
1726
|
+
* reports correctly.
|
|
822
1727
|
*
|
|
823
1728
|
* The directive paints nothing. The four attributes (present only while true)
|
|
824
1729
|
* are its public, stable contract; every visual belongs to the consumer CSS,
|
|
@@ -858,23 +1763,22 @@ declare function createScrollLock(html: HTMLElement): () => void;
|
|
|
858
1763
|
* `@container scroll-state(scrollable: block-start)` and its siblings, so the
|
|
859
1764
|
* CSS can swap to native scroll-state queries once they are Baseline.
|
|
860
1765
|
*
|
|
861
|
-
* @category common/layout
|
|
862
|
-
* @docsKind primary
|
|
863
1766
|
* @wcag AA
|
|
864
1767
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/scroll-edges.directive.ts
|
|
865
|
-
* @since 0.
|
|
1768
|
+
* @since 0.3.0
|
|
866
1769
|
* @relatedTo CngxStickyHeader, CngxScrollSpy, createScrollEdges
|
|
867
|
-
* <example-url
|
|
1770
|
+
* <example-url>/#/common/layout/scroll-edges/edge-shadows</example-url>
|
|
1771
|
+
* @axis level atom
|
|
868
1772
|
*/
|
|
869
1773
|
declare class CngxScrollEdges {
|
|
870
1774
|
private readonly edges;
|
|
871
|
-
/** Content is hidden toward the block-start edge (
|
|
1775
|
+
/** Content is hidden toward the block-start edge (top in horizontal writing modes). */
|
|
872
1776
|
readonly canScrollBlockStart: _angular_core.Signal<boolean>;
|
|
873
|
-
/** Content is hidden toward the block-end edge (
|
|
1777
|
+
/** Content is hidden toward the block-end edge (bottom in horizontal writing modes). */
|
|
874
1778
|
readonly canScrollBlockEnd: _angular_core.Signal<boolean>;
|
|
875
|
-
/** Content is hidden toward the inline-start edge (left in LTR, right in RTL). */
|
|
1779
|
+
/** Content is hidden toward the inline-start edge (left in LTR, right in RTL, horizontally). */
|
|
876
1780
|
readonly canScrollInlineStart: _angular_core.Signal<boolean>;
|
|
877
|
-
/** Content is hidden toward the inline-end edge (right in LTR, left in RTL). */
|
|
1781
|
+
/** Content is hidden toward the inline-end edge (right in LTR, left in RTL, horizontally). */
|
|
878
1782
|
readonly canScrollInlineEnd: _angular_core.Signal<boolean>;
|
|
879
1783
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxScrollEdges, never>;
|
|
880
1784
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxScrollEdges, "[cngxScrollEdges]", ["cngxScrollEdges"], {}, {}, never, never, true, never>;
|
|
@@ -885,31 +1789,35 @@ declare class CngxScrollEdges {
|
|
|
885
1789
|
* or a test double. Every member is optional so SSR and jsdom hosts pass the
|
|
886
1790
|
* type and fall back at runtime: no `ResizeObserver` means no resize
|
|
887
1791
|
* tracking, no `MutationObserver` means the child set is captured once, no
|
|
888
|
-
* `requestAnimationFrame` means every trigger reads synchronously
|
|
1792
|
+
* `requestAnimationFrame` means every trigger reads synchronously, no
|
|
1793
|
+
* `getComputedStyle` means the scrollport is read as horizontal-tb.
|
|
889
1794
|
*
|
|
890
|
-
* @
|
|
891
|
-
* @since 0.1.0
|
|
1795
|
+
* @since 0.3.0
|
|
892
1796
|
*/
|
|
893
1797
|
interface ScrollEdgesHost extends ResizeObserverHost {
|
|
894
1798
|
MutationObserver?: typeof MutationObserver;
|
|
895
1799
|
requestAnimationFrame?: (callback: FrameRequestCallback) => number;
|
|
896
1800
|
cancelAnimationFrame?: (handle: number) => void;
|
|
1801
|
+
getComputedStyle?: (element: Element) => CSSStyleDeclaration;
|
|
897
1802
|
}
|
|
898
1803
|
/**
|
|
899
1804
|
* Per-edge scroll state of one scrollport. Each signal is `true` while content
|
|
900
1805
|
* is hidden toward that edge, i.e. while the user can still scroll toward it.
|
|
1806
|
+
* The edges are logical: under a `vertical-*` or `sideways-*` writing mode the
|
|
1807
|
+
* block edges are the horizontal ones and the inline edges the vertical ones.
|
|
1808
|
+
* The writing mode is read once per scrollport, so a runtime `writing-mode`
|
|
1809
|
+
* flip on a live scrollport is not picked up.
|
|
901
1810
|
*
|
|
902
|
-
* @
|
|
903
|
-
* @since 0.1.0
|
|
1811
|
+
* @since 0.3.0
|
|
904
1812
|
*/
|
|
905
1813
|
interface CngxScrollEdgesState {
|
|
906
|
-
/** Content is hidden
|
|
1814
|
+
/** Content is hidden toward the block-start edge (top in horizontal writing modes). */
|
|
907
1815
|
readonly canScrollBlockStart: Signal<boolean>;
|
|
908
|
-
/** Content is hidden
|
|
1816
|
+
/** Content is hidden toward the block-end edge (bottom in horizontal writing modes). */
|
|
909
1817
|
readonly canScrollBlockEnd: Signal<boolean>;
|
|
910
|
-
/** Content is hidden toward the inline-start edge (left in LTR, right in RTL). */
|
|
1818
|
+
/** Content is hidden toward the inline-start edge (left in LTR, right in RTL, horizontally). */
|
|
911
1819
|
readonly canScrollInlineStart: Signal<boolean>;
|
|
912
|
-
/** Content is hidden toward the inline-end edge (right in LTR, left in RTL). */
|
|
1820
|
+
/** Content is hidden toward the inline-end edge (right in LTR, left in RTL, horizontally). */
|
|
913
1821
|
readonly canScrollInlineEnd: Signal<boolean>;
|
|
914
1822
|
}
|
|
915
1823
|
/**
|
|
@@ -936,7 +1844,7 @@ interface CngxScrollEdgesState {
|
|
|
936
1844
|
* inject(DestroyRef),
|
|
937
1845
|
* inject(DOCUMENT).defaultView,
|
|
938
1846
|
* );
|
|
939
|
-
* const
|
|
1847
|
+
* const showStartShadow = edges.canScrollBlockStart;
|
|
940
1848
|
* ```
|
|
941
1849
|
*
|
|
942
1850
|
* @param element The scrollport to read.
|
|
@@ -944,13 +1852,202 @@ interface CngxScrollEdgesState {
|
|
|
944
1852
|
* every observer and cancels a pending frame.
|
|
945
1853
|
* @param host The window-like object to read the observer and frame APIs from.
|
|
946
1854
|
* @returns The four per-edge signals.
|
|
947
|
-
* @category common/layout
|
|
948
1855
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/scroll-edges-core.ts
|
|
949
|
-
* @since 0.
|
|
1856
|
+
* @since 0.3.0
|
|
950
1857
|
* @relatedTo CngxScrollEdges, observeResize
|
|
951
1858
|
*/
|
|
952
1859
|
declare function createScrollEdges(element: HTMLElement, destroyRef: DestroyRef, host: ScrollEdgesHost | null | undefined): CngxScrollEdgesState;
|
|
953
1860
|
|
|
1861
|
+
/**
|
|
1862
|
+
* How a collapsed `CngxSidebar` rests: as a narrow, operable `rail`, or
|
|
1863
|
+
* `hidden` (no reserved space, `inert`).
|
|
1864
|
+
*
|
|
1865
|
+
* @since 0.3.0
|
|
1866
|
+
*/
|
|
1867
|
+
type CngxSidebarCollapsedAs = 'rail' | 'hidden';
|
|
1868
|
+
/**
|
|
1869
|
+
* The edge a `CngxSidebar` sits on, in the writing direction: a `start`
|
|
1870
|
+
* sidebar peeks towards the end, an `end` sidebar towards the start.
|
|
1871
|
+
*
|
|
1872
|
+
* @since 0.3.0
|
|
1873
|
+
*/
|
|
1874
|
+
type CngxSidebarSide = 'start' | 'end';
|
|
1875
|
+
/**
|
|
1876
|
+
* The resting state a `CngxSidebar` renders as `data-sidebar-state`.
|
|
1877
|
+
*
|
|
1878
|
+
* @since 0.3.0
|
|
1879
|
+
*/
|
|
1880
|
+
type CngxSidebarState = 'expanded' | 'rail' | 'hidden' | 'peek';
|
|
1881
|
+
/**
|
|
1882
|
+
* @internal Lets a component that composes `CngxSidebar` as a host directive
|
|
1883
|
+
* decide what the sidebar renders from its own state (a sidenav maps its
|
|
1884
|
+
* width class onto the sidebar). Provided by the composer on the same
|
|
1885
|
+
* element (`useExisting`); the sidebar resolves it lazily with `self: true`,
|
|
1886
|
+
* because the composer constructs after its host directives. The consumer's
|
|
1887
|
+
* `[(collapsed)]` stays the persisted user decision; the driver only decides
|
|
1888
|
+
* what is rendered.
|
|
1889
|
+
*/
|
|
1890
|
+
interface CngxSidebarDriver {
|
|
1891
|
+
/** The collapsed state the sidebar renders; wins over `[(collapsed)]`. */
|
|
1892
|
+
readonly sidebarCollapsed: Signal<boolean>;
|
|
1893
|
+
/** The collapsed rest the sidebar renders; wins over `[collapsedAs]`. */
|
|
1894
|
+
readonly sidebarCollapsedAs?: Signal<CngxSidebarCollapsedAs>;
|
|
1895
|
+
/** Shows a collapsed sidebar at full size over the content while `true`. */
|
|
1896
|
+
readonly sidebarPeek?: Signal<boolean>;
|
|
1897
|
+
/** Conceals the sidebar (`inert` + `aria-hidden`) while `true`, in any state. */
|
|
1898
|
+
readonly sidebarConcealed?: Signal<boolean>;
|
|
1899
|
+
/** Accessible name; wins over `[label]` and the i18n fallback. */
|
|
1900
|
+
readonly sidebarLabel?: Signal<string>;
|
|
1901
|
+
/** Landmark role the sidebar renders while no `[role]` is bound. */
|
|
1902
|
+
readonly sidebarRole?: Signal<string | null>;
|
|
1903
|
+
}
|
|
1904
|
+
/** @internal See {@link CngxSidebarDriver}. */
|
|
1905
|
+
declare const CNGX_SIDEBAR_DRIVER: InjectionToken<CngxSidebarDriver>;
|
|
1906
|
+
/**
|
|
1907
|
+
* The brain of a persistent side region: a sidebar that stays in the layout
|
|
1908
|
+
* and reserves inline space, unlike a drawer, which is transient.
|
|
1909
|
+
*
|
|
1910
|
+
* `collapsed` (two-way) switches between the expanded size and the
|
|
1911
|
+
* collapsed rest, `collapsedAs` picks the rest: a `rail` stays operable at
|
|
1912
|
+
* `--cngx-sidebar-rail-size`, `hidden` reserves nothing and becomes `inert`
|
|
1913
|
+
* + `aria-hidden`. A collapsed sidebar can **peek**: it shows at full size
|
|
1914
|
+
* over the content without reflowing it (the reserved space stays at the
|
|
1915
|
+
* rest size). Peek comes from the pointer resting on the host
|
|
1916
|
+
* (`CngxHoverIntent`, gated by `expandOnHover`) or from `peek()`, and ends
|
|
1917
|
+
* on Escape (wherever focus is, so a hover peek over the page is
|
|
1918
|
+
* dismissible without moving focus, WCAG 1.4.13), on a press outside the
|
|
1919
|
+
* host (a press on the trigger whose `aria-controls` names the sidebar is
|
|
1920
|
+
* left to the trigger), when focus leaves the host, or when the pointer
|
|
1921
|
+
* leaves the host after resting on it. A `peek()` from a trigger outside the
|
|
1922
|
+
* host therefore stays until one of these happens, even if the pointer never
|
|
1923
|
+
* enters.
|
|
1924
|
+
* `pin()` turns a peek into the expanded state.
|
|
1925
|
+
*
|
|
1926
|
+
* `side` names the edge the sidebar sits on (`start`, default, or `end` for
|
|
1927
|
+
* an inspector after the content); a peek grows away from it.
|
|
1928
|
+
*
|
|
1929
|
+
* Sizes are tokens with fallbacks: `--cngx-sidebar-size` (expanded, default
|
|
1930
|
+
* `16rem`) and `--cngx-sidebar-rail-size` (default `3.5rem`), plus
|
|
1931
|
+
* `--cngx-sidebar-peek-z-index`. The host renders `data-sidebar-state`
|
|
1932
|
+
* (`expanded | rail | hidden | peek`) and `data-sidebar-side` for skins.
|
|
1933
|
+
* The base skin is opt-in with the `cngx-sidebar` class (`cngx-sidebar.css`
|
|
1934
|
+
* in `@cngx/themes/cngx.css`): surface, border and peek shadow of the box,
|
|
1935
|
+
* nothing for its content.
|
|
1936
|
+
*
|
|
1937
|
+
* The sidebar is a `CngxPanelTarget` and provides `CNGX_PANEL_TARGET`: a
|
|
1938
|
+
* `[cngxPanelTrigger]="sidebar"` mirrors `expanded` and toggles `collapsed`;
|
|
1939
|
+
* `action="peek"` peeks. It knows no nav model; `[cngxNavRailed]` crops the
|
|
1940
|
+
* nav rows inside it on the rail and adds the rail tooltip and group flyout.
|
|
1941
|
+
*
|
|
1942
|
+
* ```html
|
|
1943
|
+
* <button type="button" [cngxPanelTrigger]="sidebar"></button>
|
|
1944
|
+
* <div style="display: flex">
|
|
1945
|
+
* <nav cngxSidebar #sidebar="cngxSidebar" [(collapsed)]="collapsed" [role]="null">…</nav>
|
|
1946
|
+
* <main>…</main>
|
|
1947
|
+
* </div>
|
|
1948
|
+
* ```
|
|
1949
|
+
*
|
|
1950
|
+
* @wcag AA
|
|
1951
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/sidebar/sidebar.directive.ts
|
|
1952
|
+
* @since 0.3.0
|
|
1953
|
+
* @relatedTo CngxPanelTrigger, CngxDrawer, CngxHoverIntent, CngxResizable
|
|
1954
|
+
* <example-url>/#/common/layout/sidebar/clipped-below-header</example-url>
|
|
1955
|
+
* <example-url>/#/common/layout/sidebar/collapsible-rail</example-url>
|
|
1956
|
+
* <example-url>/#/common/layout/sidebar/inset-app-sidebar</example-url>
|
|
1957
|
+
* <example-url>/#/common/layout/sidebar/projected-toggle-glyph</example-url>
|
|
1958
|
+
* @axis level molecule
|
|
1959
|
+
*/
|
|
1960
|
+
declare class CngxSidebar implements CngxPanelTarget, CngxHoverIntentDriver {
|
|
1961
|
+
/** Whether the sidebar rests collapsed. Two-way: `[(collapsed)]`. */
|
|
1962
|
+
readonly collapsed: _angular_core.ModelSignal<boolean>;
|
|
1963
|
+
/** How a collapsed sidebar rests: an operable `rail` or `hidden`. */
|
|
1964
|
+
readonly collapsedAs: _angular_core.InputSignal<CngxSidebarCollapsedAs>;
|
|
1965
|
+
/**
|
|
1966
|
+
* {@link CngxPanelTarget}: the edge the sidebar sits on, in the writing
|
|
1967
|
+
* direction. A peek grows away from it.
|
|
1968
|
+
*/
|
|
1969
|
+
readonly side: _angular_core.InputSignal<CngxSidebarSide>;
|
|
1970
|
+
/** Whether the pointer resting on a collapsed sidebar peeks it. */
|
|
1971
|
+
readonly expandOnHover: _angular_core.InputSignal<boolean>;
|
|
1972
|
+
/**
|
|
1973
|
+
* ms the pointer rests on a collapsed sidebar before it peeks. Unbound,
|
|
1974
|
+
* `CNGX_HOVER_INTENT_DEFAULTS` applies, then 120.
|
|
1975
|
+
*/
|
|
1976
|
+
readonly expandDelay: _angular_core.InputSignal<number | undefined>;
|
|
1977
|
+
/**
|
|
1978
|
+
* ms after the pointer leaves before a hover peek ends. Unbound,
|
|
1979
|
+
* `CNGX_HOVER_INTENT_DEFAULTS` applies, then 0.
|
|
1980
|
+
*/
|
|
1981
|
+
readonly collapseDelay: _angular_core.InputSignal<number | undefined>;
|
|
1982
|
+
/** @internal Drives the composed `CngxHoverIntent`. */
|
|
1983
|
+
readonly hoverEnterDelay: _angular_core.InputSignal<number | undefined>;
|
|
1984
|
+
/** @internal Drives the composed `CngxHoverIntent`. */
|
|
1985
|
+
readonly hoverLeaveDelay: _angular_core.InputSignal<number | undefined>;
|
|
1986
|
+
/**
|
|
1987
|
+
* Landmark role. Defaults to `complementary`; pass `navigation` for a nav
|
|
1988
|
+
* sidebar, or `null` on a `<nav>` / `<aside>` host to keep its implicit role.
|
|
1989
|
+
*/
|
|
1990
|
+
readonly roleInput: _angular_core.InputSignal<string | null | undefined>;
|
|
1991
|
+
/**
|
|
1992
|
+
* Accessible name of the region. Falls back to `CNGX_LAYOUT_I18N.sidebarRegion`
|
|
1993
|
+
* while the role is `complementary`.
|
|
1994
|
+
*/
|
|
1995
|
+
readonly labelInput: _angular_core.InputSignal<string | undefined>;
|
|
1996
|
+
private readonly hover;
|
|
1997
|
+
private readonly injector;
|
|
1998
|
+
private resolvedDriver;
|
|
1999
|
+
private driver;
|
|
2000
|
+
private readonly restCollapsed;
|
|
2001
|
+
private readonly restAs;
|
|
2002
|
+
private readonly host;
|
|
2003
|
+
private readonly doc;
|
|
2004
|
+
private readonly i18n;
|
|
2005
|
+
private readonly peekState;
|
|
2006
|
+
private readonly hoverSuppressed;
|
|
2007
|
+
/**
|
|
2008
|
+
* The host `id` (a static `id` attribute, else a generated one); the
|
|
2009
|
+
* trigger's `aria-controls`.
|
|
2010
|
+
*/
|
|
2011
|
+
readonly id: Signal<string>;
|
|
2012
|
+
/** {@link CngxPanelTarget}: a sidebar reserves inline space, it is never an overlay. */
|
|
2013
|
+
readonly mode: Signal<CngxPanelMode>;
|
|
2014
|
+
/** Whether a collapsed sidebar currently shows at full size over the content. */
|
|
2015
|
+
readonly peeked: Signal<boolean>;
|
|
2016
|
+
/** Whether the sidebar shows at full size: expanded, or collapsed and peeked. */
|
|
2017
|
+
readonly expanded: Signal<boolean>;
|
|
2018
|
+
/** The rendered state: `expanded`, `peek`, or the collapsed rest. */
|
|
2019
|
+
readonly state: Signal<CngxSidebarState>;
|
|
2020
|
+
/**
|
|
2021
|
+
* The rendered landmark role: the bound `role` (`null` keeps the host's
|
|
2022
|
+
* implicit role), else the composer's, else `complementary`.
|
|
2023
|
+
*/
|
|
2024
|
+
readonly role: Signal<string | null>;
|
|
2025
|
+
protected readonly concealed: Signal<boolean>;
|
|
2026
|
+
/**
|
|
2027
|
+
* {@link CngxPanelTarget}: the region's resolved accessible name, the bound
|
|
2028
|
+
* `label`, else `CNGX_LAYOUT_I18N.sidebarRegion` while the role is
|
|
2029
|
+
* `complementary` (a `navigation` landmark announces its role already). An
|
|
2030
|
+
* icon-only trigger takes it as its name.
|
|
2031
|
+
*/
|
|
2032
|
+
readonly label: Signal<string | undefined>;
|
|
2033
|
+
protected readonly inlineSize: Signal<"0px" | "var(--cngx-sidebar-rail-size, 3.5rem)" | "var(--cngx-sidebar-size, 16rem)">;
|
|
2034
|
+
protected readonly peekOffset: Signal<string | null>;
|
|
2035
|
+
constructor();
|
|
2036
|
+
/** Collapses an expanded sidebar, expands a collapsed one. Ends a peek. */
|
|
2037
|
+
toggle(): void;
|
|
2038
|
+
/** Shows a collapsed sidebar at full size over the content until dismissed. */
|
|
2039
|
+
peek(): void;
|
|
2040
|
+
/** Ends a peek without changing `collapsed`. */
|
|
2041
|
+
unpeek(): void;
|
|
2042
|
+
/** Keeps the sidebar expanded: `collapsed = false`, any peek ends. */
|
|
2043
|
+
pin(): void;
|
|
2044
|
+
private isController;
|
|
2045
|
+
protected handleEscape(event: Event): void;
|
|
2046
|
+
protected handleFocusOut(event: FocusEvent): void;
|
|
2047
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxSidebar, never>;
|
|
2048
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxSidebar, "[cngxSidebar]", ["cngxSidebar"], { "collapsed": { "alias": "collapsed"; "required": false; "isSignal": true; }; "collapsedAs": { "alias": "collapsedAs"; "required": false; "isSignal": true; }; "side": { "alias": "side"; "required": false; "isSignal": true; }; "expandOnHover": { "alias": "expandOnHover"; "required": false; "isSignal": true; }; "expandDelay": { "alias": "expandDelay"; "required": false; "isSignal": true; }; "collapseDelay": { "alias": "collapseDelay"; "required": false; "isSignal": true; }; "roleInput": { "alias": "role"; "required": false; "isSignal": true; }; "labelInput": { "alias": "label"; "required": false; "isSignal": true; }; }, { "collapsed": "collapsedChange"; }, never, never, true, [{ directive: typeof i2.CngxHoverIntent; inputs: {}; outputs: {}; }]>;
|
|
2049
|
+
}
|
|
2050
|
+
|
|
954
2051
|
/**
|
|
955
2052
|
* Headless skeleton loading placeholder.
|
|
956
2053
|
*
|
|
@@ -958,7 +2055,8 @@ declare function createScrollEdges(element: HTMLElement, destroyRef: DestroyRef,
|
|
|
958
2055
|
* No template -- the consumer renders the skeleton UI.
|
|
959
2056
|
*
|
|
960
2057
|
* Exposes an `indices()` signal for `@for` rendering of repeated skeleton elements.
|
|
961
|
-
* Respects
|
|
2058
|
+
* Respects reduced motion, the in-app `CNGX_MOTION` pick or the OS query
|
|
2059
|
+
* (disables shimmer animation class).
|
|
962
2060
|
*
|
|
963
2061
|
* ### Basic loading placeholder
|
|
964
2062
|
* ```html
|
|
@@ -991,14 +2089,12 @@ declare function createScrollEdges(element: HTMLElement, destroyRef: DestroyRef,
|
|
|
991
2089
|
* </div>
|
|
992
2090
|
* ```
|
|
993
2091
|
*
|
|
994
|
-
* @category common/layout
|
|
995
|
-
* @docsKind primary
|
|
996
2092
|
* @wcag AA
|
|
997
2093
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/text/skeleton.directive.ts
|
|
998
|
-
* @since 0.
|
|
2094
|
+
* @since 0.3.0
|
|
999
2095
|
* @relatedTo CngxTruncate, CngxExpandableText, CngxHighlight
|
|
1000
|
-
* <example-url
|
|
1001
|
-
*
|
|
2096
|
+
* <example-url>/#/common/layout/skeleton/basic-skeleton</example-url>
|
|
2097
|
+
* @axis level atom
|
|
1002
2098
|
*/
|
|
1003
2099
|
declare class CngxSkeleton {
|
|
1004
2100
|
/** Controls the loading state. */
|
|
@@ -1007,14 +2103,13 @@ declare class CngxSkeleton {
|
|
|
1007
2103
|
readonly shimmer: _angular_core.InputSignal<boolean>;
|
|
1008
2104
|
/** Repeat count - exposed via the `indices()` signal for `@for` rendering. */
|
|
1009
2105
|
readonly count: _angular_core.InputSignal<number>;
|
|
1010
|
-
private readonly
|
|
1011
|
-
constructor();
|
|
2106
|
+
private readonly motion;
|
|
1012
2107
|
/** Whether the skeleton is in loading state. Mirrors the `cngxSkeleton` input. */
|
|
1013
|
-
readonly loading: Signal<boolean>;
|
|
2108
|
+
readonly loading: _angular_core.Signal<boolean>;
|
|
1014
2109
|
/** Array of indices for `@for` rendering of repeated skeleton elements. */
|
|
1015
|
-
readonly indices: Signal<number[]>;
|
|
2110
|
+
readonly indices: _angular_core.Signal<number[]>;
|
|
1016
2111
|
/** @internal - shimmer class condition. */
|
|
1017
|
-
protected readonly showShimmer: Signal<boolean>;
|
|
2112
|
+
protected readonly showShimmer: _angular_core.Signal<boolean>;
|
|
1018
2113
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxSkeleton, never>;
|
|
1019
2114
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxSkeleton, "[cngxSkeleton]", ["cngxSkeleton"], { "skeleton": { "alias": "cngxSkeleton"; "required": false; "isSignal": true; }; "shimmer": { "alias": "shimmer"; "required": false; "isSignal": true; }; "count": { "alias": "count"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1020
2115
|
}
|
|
@@ -1064,13 +2159,12 @@ declare class CngxSkeleton {
|
|
|
1064
2159
|
* </div>
|
|
1065
2160
|
* ```
|
|
1066
2161
|
*
|
|
1067
|
-
* @category common/layout
|
|
1068
|
-
* @docsKind primary
|
|
1069
2162
|
* @wcag AA
|
|
1070
2163
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/infinite-scroll.directive.ts
|
|
1071
|
-
* @since 0.
|
|
2164
|
+
* @since 0.3.0
|
|
1072
2165
|
* @relatedTo CngxIntersectionObserver, CngxScrollSpy, CngxStickyHeader
|
|
1073
|
-
* <example-url
|
|
2166
|
+
* <example-url>/#/common/layout/infinite-scroll/scrollable-list</example-url>
|
|
2167
|
+
* @axis level atom
|
|
1074
2168
|
*/
|
|
1075
2169
|
declare class CngxInfiniteScroll {
|
|
1076
2170
|
/** IntersectionObserver threshold (0–1). */
|
|
@@ -1128,13 +2222,12 @@ declare class CngxInfiniteScroll {
|
|
|
1128
2222
|
* .cngx-sticky--active { box-shadow: 0 2px 4px rgba(0,0,0,.1); }
|
|
1129
2223
|
* ```
|
|
1130
2224
|
*
|
|
1131
|
-
* @category common/layout
|
|
1132
|
-
* @docsKind primary
|
|
1133
2225
|
* @wcag AA
|
|
1134
2226
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/sticky-header.directive.ts
|
|
1135
|
-
* @since 0.
|
|
2227
|
+
* @since 0.3.0
|
|
1136
2228
|
* @relatedTo CngxScrollSpy, CngxIntersectionObserver
|
|
1137
|
-
* <example-url
|
|
2229
|
+
* <example-url>/#/common/layout/sticky-header/sticky-header-with-shadow</example-url>
|
|
2230
|
+
* @axis level atom
|
|
1138
2231
|
*/
|
|
1139
2232
|
declare class CngxStickyHeader {
|
|
1140
2233
|
/** Intersection threshold - `0` triggers as soon as the sentinel leaves. */
|
|
@@ -1152,10 +2245,11 @@ declare class CngxStickyHeader {
|
|
|
1152
2245
|
/**
|
|
1153
2246
|
* The nearest ancestor that is a scroll container in the block axis - the scrollport
|
|
1154
2247
|
* `position: sticky` resolves against. Walks up from the host's parent to the first
|
|
1155
|
-
* ancestor whose computed `overflow-y` is
|
|
1156
|
-
* ancestor, i.e. the header sticks to the viewport.
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
2248
|
+
* ancestor whose computed `overflow-y` is `auto`, `scroll` or `hidden`; `null` means
|
|
2249
|
+
* no such ancestor, i.e. the header sticks to the viewport. `clip` clips without
|
|
2250
|
+
* creating a scroll container, so it is skipped. A used `overflow-x` of `auto`,
|
|
2251
|
+
* `scroll` or `hidden` coerces the computed `overflow-y` to `auto`, so this also
|
|
2252
|
+
* catches a horizontal scroll container (e.g. a data grid that scrolls sideways).
|
|
1159
2253
|
*/
|
|
1160
2254
|
private resolveScrollParent;
|
|
1161
2255
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStickyHeader, never>;
|
|
@@ -1187,13 +2281,12 @@ declare class CngxStickyHeader {
|
|
|
1187
2281
|
* <section id="pricing">…</section>
|
|
1188
2282
|
* ```
|
|
1189
2283
|
*
|
|
1190
|
-
* @category common/layout
|
|
1191
|
-
* @docsKind primary
|
|
1192
2284
|
* @wcag AA
|
|
1193
2285
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/scroll-spy.directive.ts
|
|
1194
|
-
* @since 0.
|
|
2286
|
+
* @since 0.3.0
|
|
1195
2287
|
* @relatedTo CngxIntersectionObserver, CngxStickyHeader, CngxInfiniteScroll
|
|
1196
|
-
* <example-url
|
|
2288
|
+
* <example-url>/#/common/layout/scroll-spy/scroll-based-navigation</example-url>
|
|
2289
|
+
* @axis level atom
|
|
1197
2290
|
*/
|
|
1198
2291
|
declare class CngxScrollSpy {
|
|
1199
2292
|
/** IDs of the sections to observe. */
|
|
@@ -1242,14 +2335,13 @@ declare class CngxScrollSpy {
|
|
|
1242
2335
|
* </button> * }
|
|
1243
2336
|
* ```
|
|
1244
2337
|
*
|
|
1245
|
-
* @category common/layout
|
|
1246
|
-
* @docsKind primary
|
|
1247
2338
|
* @wcag AA
|
|
1248
2339
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/text/truncate.directive.ts
|
|
1249
|
-
* @since 0.
|
|
2340
|
+
* @since 0.3.0
|
|
1250
2341
|
* @relatedTo CngxExpandableText, CngxExpandableToggle, CngxHighlight
|
|
1251
|
-
* <example-url
|
|
1252
|
-
* <example-url
|
|
2342
|
+
* <example-url>/#/common/layout/truncate/short-text-no-toggle</example-url>
|
|
2343
|
+
* <example-url>/#/common/layout/truncate/truncated-text-with-toggle</example-url>
|
|
2344
|
+
* @axis level atom
|
|
1253
2345
|
*/
|
|
1254
2346
|
declare class CngxTruncate {
|
|
1255
2347
|
/** Maximum number of visible lines when collapsed. */
|
|
@@ -1309,14 +2401,13 @@ declare class CngxTruncate {
|
|
|
1309
2401
|
* </p>
|
|
1310
2402
|
* ```
|
|
1311
2403
|
*
|
|
1312
|
-
* @category common/layout
|
|
1313
|
-
* @docsKind primary
|
|
1314
2404
|
* @wcag AA
|
|
1315
2405
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/text/highlight.directive.ts
|
|
1316
|
-
* @since 0.
|
|
2406
|
+
* @since 0.3.0
|
|
1317
2407
|
* @relatedTo CngxTruncate, CngxExpandableText
|
|
1318
|
-
* <example-url
|
|
1319
|
-
* <example-url
|
|
2408
|
+
* <example-url>/#/common/layout/highlight/live-search-highlighting</example-url>
|
|
2409
|
+
* <example-url>/#/common/layout/highlight/multiple-paragraphs</example-url>
|
|
2410
|
+
* @axis level atom
|
|
1320
2411
|
*/
|
|
1321
2412
|
declare class CngxHighlight {
|
|
1322
2413
|
/** The search term to highlight. Empty string clears all highlights. */
|
|
@@ -1352,8 +2443,6 @@ declare class CngxHighlight {
|
|
|
1352
2443
|
|
|
1353
2444
|
/**
|
|
1354
2445
|
* Template context for the custom toggle template.
|
|
1355
|
-
*
|
|
1356
|
-
* @category common/layout
|
|
1357
2446
|
*/
|
|
1358
2447
|
interface CngxExpandableToggleContext {
|
|
1359
2448
|
/** Whether the text is currently expanded. */
|
|
@@ -1377,9 +2466,8 @@ interface CngxExpandableToggleContext {
|
|
|
1377
2466
|
* </cngx-expandable-text>
|
|
1378
2467
|
* ```
|
|
1379
2468
|
*
|
|
1380
|
-
* @category common/layout
|
|
1381
2469
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/text/expandable-text.ts
|
|
1382
|
-
* @since 0.
|
|
2470
|
+
* @since 0.3.0
|
|
1383
2471
|
* @relatedTo CngxExpandableText, CngxTruncate
|
|
1384
2472
|
*/
|
|
1385
2473
|
declare class CngxExpandableToggle {
|
|
@@ -1421,16 +2509,16 @@ declare class CngxExpandableToggle {
|
|
|
1421
2509
|
* </cngx-expandable-text>
|
|
1422
2510
|
* ```
|
|
1423
2511
|
*
|
|
1424
|
-
* @category common/layout
|
|
1425
|
-
* @docsKind primary
|
|
1426
2512
|
* @wcag AA
|
|
1427
2513
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/text/expandable-text.ts
|
|
1428
|
-
* @since 0.
|
|
2514
|
+
* @since 0.3.0
|
|
1429
2515
|
* @relatedTo CngxTruncate, CngxExpandableToggle, CngxHighlight
|
|
1430
2516
|
* @slot cngxExpandableToggle Replaces the show-more control; gets the current expanded state.
|
|
1431
|
-
* <example-url
|
|
1432
|
-
* <example-url
|
|
1433
|
-
* <example-url
|
|
2517
|
+
* <example-url>/#/common/layout/expandable-text/auto-toggle</example-url>
|
|
2518
|
+
* <example-url>/#/common/layout/expandable-text/custom-labels</example-url>
|
|
2519
|
+
* <example-url>/#/common/layout/expandable-text/custom-toggle-template</example-url>
|
|
2520
|
+
* <example-url>/#/common/layout/expandable-text/card-with-expandable-text</example-url>
|
|
2521
|
+
* @axis level molecule
|
|
1434
2522
|
*/
|
|
1435
2523
|
declare class CngxExpandableText {
|
|
1436
2524
|
private readonly i18n;
|
|
@@ -1464,79 +2552,67 @@ declare class CngxExpandableText {
|
|
|
1464
2552
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxExpandableText, "cngx-expandable-text", ["cngxExpandableText"], { "lines": { "alias": "lines"; "required": false; "isSignal": true; }; "expanded": { "alias": "expanded"; "required": false; "isSignal": true; }; "moreLabel": { "alias": "moreLabel"; "required": false; "isSignal": true; }; "lessLabel": { "alias": "lessLabel"; "required": false; "isSignal": true; }; }, { "expanded": "expandedChange"; }, ["customToggle"], ["*"], true, never>;
|
|
1465
2553
|
}
|
|
1466
2554
|
|
|
1467
|
-
/**
|
|
1468
|
-
* The layout section of a {@link CngxLanguagePack}: the copy of the
|
|
1469
|
-
* `@cngx/common/layout` atoms. It feeds `CNGX_LAYOUT_I18N`.
|
|
1470
|
-
*
|
|
1471
|
-
* @category common/layout/i18n
|
|
1472
|
-
* @since 0.1.0
|
|
1473
|
-
* @relatedTo CNGX_LAYOUT_I18N
|
|
1474
|
-
*/
|
|
1475
|
-
interface CngxLayoutLanguageSection {
|
|
1476
|
-
/** Label of the `CngxExpandableText` expand control. */
|
|
1477
|
-
readonly expandableTextMore: string;
|
|
1478
|
-
/** Label of the `CngxExpandableText` collapse control. */
|
|
1479
|
-
readonly expandableTextLess: string;
|
|
1480
|
-
}
|
|
1481
|
-
/**
|
|
1482
|
-
* The English layout section: the single source of the layout atoms'
|
|
1483
|
-
* English copy. `CNGX_LAYOUT_I18N` defaults to it.
|
|
1484
|
-
*
|
|
1485
|
-
* @category common/layout/i18n
|
|
1486
|
-
* @since 0.1.0
|
|
1487
|
-
* @relatedTo CNGX_LAYOUT_I18N
|
|
1488
|
-
*/
|
|
1489
|
-
declare const CNGX_LAYOUT_LANGUAGE_EN: CngxLayoutLanguageSection;
|
|
1490
|
-
declare module '@cngx/core/i18n' {
|
|
1491
|
-
interface CngxLanguagePack {
|
|
1492
|
-
readonly layout: CngxLayoutLanguageSection;
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
2555
|
/**
|
|
1497
2556
|
* Layout i18n surface. Library defaults are English; consumers override via
|
|
1498
2557
|
* {@link provideLayoutI18n}. Reactive from birth: the token carries a
|
|
1499
2558
|
* `Signal`, and {@link withLayoutI18nLabels} accepts a `Signal` of a partial
|
|
1500
2559
|
* bundle.
|
|
1501
2560
|
*
|
|
1502
|
-
*
|
|
1503
|
-
* `
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
1506
|
-
*
|
|
2561
|
+
* Every key is the fallback of a copy input on a layout atom, resolved in a
|
|
2562
|
+
* `computed()`: a bound input wins, and an unbound one follows a language
|
|
2563
|
+
* switch. The keys mirror the layout section of a language pack
|
|
2564
|
+
* ({@link CngxLayoutLanguageSection}); composed copy is a function of its
|
|
2565
|
+
* parameters, formatted for the reading locale.
|
|
1507
2566
|
*
|
|
1508
|
-
* @
|
|
1509
|
-
* @since 0.1.0
|
|
2567
|
+
* @since 0.3.0
|
|
1510
2568
|
*/
|
|
1511
|
-
|
|
2569
|
+
interface CngxLayoutI18n {
|
|
2570
|
+
/** Fallback of `CngxExpandableText.moreLabel`. */
|
|
2571
|
+
readonly expandableTextMore: string;
|
|
2572
|
+
/** Fallback of `CngxExpandableText.lessLabel`. */
|
|
2573
|
+
readonly expandableTextLess: string;
|
|
2574
|
+
/** Fallback of `CngxResizable.label`, the handle's accessible name. */
|
|
2575
|
+
readonly resizeHandle: string;
|
|
2576
|
+
/** Fallback of `CngxResizable.valueText`: the handle's `aria-valuetext` for a px size. */
|
|
2577
|
+
readonly resizeValueText: (size: number) => string;
|
|
2578
|
+
/**
|
|
2579
|
+
* Fallback of `CngxPanelTrigger.label` on a trigger without text content
|
|
2580
|
+
* whose panel has no `label`. Stable: the panel state is `aria-expanded`.
|
|
2581
|
+
*/
|
|
2582
|
+
readonly panelTrigger: string;
|
|
2583
|
+
/** Fallback of `CngxSidebar.label`, the region's accessible name. */
|
|
2584
|
+
readonly sidebarRegion: string;
|
|
2585
|
+
/**
|
|
2586
|
+
* Fallback of `CngxDrawerPanel.label` and `CngxDrawerSurface.label`: the
|
|
2587
|
+
* name of an engaged page modal (a `dialog`) without a bound label or a
|
|
2588
|
+
* static `aria-label` / `aria-labelledby`.
|
|
2589
|
+
*/
|
|
2590
|
+
readonly drawerDialog: string;
|
|
2591
|
+
}
|
|
1512
2592
|
/**
|
|
1513
2593
|
* DI token for the layout i18n bundle. `providedIn: 'root'`: the layout
|
|
1514
2594
|
* section of the active language pack over the English defaults; the value
|
|
1515
2595
|
* is a `Signal`, shared by every reader under one injector.
|
|
1516
2596
|
*
|
|
1517
|
-
* @category common/layout/i18n
|
|
1518
2597
|
* @wcag AA
|
|
1519
2598
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/i18n/layout-i18n.ts
|
|
1520
|
-
* @since 0.
|
|
1521
|
-
* @relatedTo CngxExpandableText
|
|
2599
|
+
* @since 0.3.0
|
|
2600
|
+
* @relatedTo CngxExpandableText, CngxResizable, CngxPanelTrigger, CngxSidebar, CngxDrawerPanel
|
|
1522
2601
|
*/
|
|
1523
|
-
declare const CNGX_LAYOUT_I18N: InjectionToken<Signal<
|
|
2602
|
+
declare const CNGX_LAYOUT_I18N: InjectionToken<Signal<CngxLayoutI18n>>;
|
|
1524
2603
|
/**
|
|
1525
|
-
*
|
|
2604
|
+
* A label override feature of `provideLayoutI18n`.
|
|
1526
2605
|
*
|
|
1527
|
-
* @
|
|
1528
|
-
* @
|
|
2606
|
+
* @since 0.3.0
|
|
2607
|
+
* @relatedTo CNGX_LAYOUT_I18N, withLayoutI18nLabels
|
|
1529
2608
|
*/
|
|
1530
|
-
type CngxLayoutI18nFeature = (
|
|
1531
|
-
readonly _target: 'i18n';
|
|
1532
|
-
};
|
|
2609
|
+
type CngxLayoutI18nFeature = (bundle: Signal<CngxLayoutI18n>) => Signal<CngxLayoutI18n>;
|
|
1533
2610
|
/**
|
|
1534
2611
|
* Override layout labels via a partial bundle - unset keys keep the
|
|
1535
2612
|
* language pack's copy, or the English default. Pass a `Signal` of a partial
|
|
1536
2613
|
* bundle to switch languages at runtime.
|
|
1537
2614
|
*
|
|
1538
|
-
* @
|
|
1539
|
-
* @since 0.1.0
|
|
2615
|
+
* @since 0.3.0
|
|
1540
2616
|
*/
|
|
1541
2617
|
declare function withLayoutI18nLabels(overrides: Partial<CngxLayoutI18n> | Signal<Partial<CngxLayoutI18n>>): CngxLayoutI18nFeature;
|
|
1542
2618
|
/**
|
|
@@ -1554,18 +2630,53 @@ declare function withLayoutI18nLabels(overrides: Partial<CngxLayoutI18n> | Signa
|
|
|
1554
2630
|
* });
|
|
1555
2631
|
* ```
|
|
1556
2632
|
*
|
|
1557
|
-
* @
|
|
1558
|
-
* @since 0.1.0
|
|
2633
|
+
* @since 0.3.0
|
|
1559
2634
|
*/
|
|
1560
2635
|
declare function provideLayoutI18n(...features: readonly CngxLayoutI18nFeature[]): Provider;
|
|
1561
2636
|
/**
|
|
1562
2637
|
* Inject the resolved layout i18n bundle signal. Read it inside a
|
|
1563
2638
|
* `computed()` or template so a runtime override flip re-derives.
|
|
1564
2639
|
*
|
|
1565
|
-
* @
|
|
1566
|
-
* @since 0.1.0
|
|
2640
|
+
* @since 0.3.0
|
|
1567
2641
|
*/
|
|
1568
2642
|
declare function injectLayoutI18n(): Signal<CngxLayoutI18n>;
|
|
1569
2643
|
|
|
1570
|
-
|
|
1571
|
-
|
|
2644
|
+
/**
|
|
2645
|
+
* The layout section of a {@link CngxLanguagePack}: the copy of the
|
|
2646
|
+
* `@cngx/common/layout` atoms. It feeds `CNGX_LAYOUT_I18N`.
|
|
2647
|
+
*
|
|
2648
|
+
* @since 0.3.0
|
|
2649
|
+
* @relatedTo CNGX_LAYOUT_I18N
|
|
2650
|
+
*/
|
|
2651
|
+
interface CngxLayoutLanguageSection {
|
|
2652
|
+
/** Label of the `CngxExpandableText` expand control. */
|
|
2653
|
+
readonly expandableTextMore: string;
|
|
2654
|
+
/** Label of the `CngxExpandableText` collapse control. */
|
|
2655
|
+
readonly expandableTextLess: string;
|
|
2656
|
+
/** Accessible name of a `CngxResizable` handle. */
|
|
2657
|
+
readonly resizeHandle: string;
|
|
2658
|
+
/** `aria-valuetext` of a `CngxResizable` handle. Placeholder: `{size}` (px). */
|
|
2659
|
+
readonly resizeValueText: CngxMessage;
|
|
2660
|
+
/** Accessible name of a `CngxPanelTrigger` without text content whose panel has no label. */
|
|
2661
|
+
readonly panelTrigger: string;
|
|
2662
|
+
/** Accessible name of a `CngxSidebar` region without a bound label. */
|
|
2663
|
+
readonly sidebarRegion: string;
|
|
2664
|
+
/** Accessible name of an open page-modal drawer panel or surface without a bound label. */
|
|
2665
|
+
readonly drawerDialog: string;
|
|
2666
|
+
}
|
|
2667
|
+
/**
|
|
2668
|
+
* The English layout section: the single source of the layout atoms'
|
|
2669
|
+
* English copy. `CNGX_LAYOUT_I18N` defaults to it.
|
|
2670
|
+
*
|
|
2671
|
+
* @since 0.3.0
|
|
2672
|
+
* @relatedTo CNGX_LAYOUT_I18N
|
|
2673
|
+
*/
|
|
2674
|
+
declare const CNGX_LAYOUT_LANGUAGE_EN: CngxLayoutLanguageSection;
|
|
2675
|
+
declare module '@cngx/core/i18n' {
|
|
2676
|
+
interface CngxLanguagePack {
|
|
2677
|
+
readonly layout: CngxLayoutLanguageSection;
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
export { CNGX_CONTAINER_SIZE, CNGX_DRAWER_HOST, CNGX_DRAWER_SURFACE_DRIVER, CNGX_LAYOUT_I18N, CNGX_LAYOUT_LANGUAGE_EN, CNGX_PANEL_TARGET, CNGX_RESIZABLE_DEFAULTS, CNGX_SIDEBAR_DRIVER, CngxBackdrop, CngxContainer, CngxDrawer, CngxDrawerContent, CngxDrawerPanel, CngxDrawerSurface, CngxExpandableText, CngxExpandableToggle, CngxHighlight, CngxInfiniteScroll, CngxIntersectionObserver, CngxMediaQuery, CngxPanelToggle, CngxPanelTrigger, CngxResizable, CngxResizeObserver, CngxScrollEdges, CngxScrollLock, CngxScrollSpy, CngxSidebar, CngxSkeleton, CngxStickyHeader, CngxTruncate, createContainerSize, createPinnedScrollLock, createResizeSignal, createScrollEdges, createScrollLock, injectContainerSize, injectLayoutI18n, injectMediaQuery, injectQueryParamSync, observeResize, provideLayoutI18n, withLayoutI18nLabels };
|
|
2682
|
+
export type { CngxContainerSize, CngxDrawerHost, CngxDrawerModality, CngxDrawerPanelPresentation, CngxDrawerSurfaceDriver, CngxExpandableToggleContext, CngxLayoutI18n, CngxLayoutI18nFeature, CngxLayoutLanguageSection, CngxPanelMode, CngxPanelSide, CngxPanelTarget, CngxPanelTriggerAction, CngxResizableDefaults, CngxResizableEdge, CngxScrollEdgesState, CngxSidebarCollapsedAs, CngxSidebarDriver, CngxSidebarSide, CngxSidebarState, DrawerMode, DrawerPosition, QueryParamSyncOptions, ResizeObserverHost, ScrollEdgesHost };
|