@cngx/common 0.1.0-rc.7 → 0.1.0-rc.8
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/card/README.md +2 -1
- package/data/README.md +10 -1
- package/dialog/README.md +23 -1
- package/fesm2022/cngx-common-a11y.mjs +125 -111
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +47 -5
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +300 -46
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +1176 -453
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +37 -10
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +1318 -469
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +151 -14
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +340 -73
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +1744 -952
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +841 -114
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +350 -60
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +727 -317
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1601 -1243
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +137 -53
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/interactive/README.md +15 -4
- package/layout/README.md +21 -1
- package/package.json +3 -3
- package/popover/README.md +18 -2
- package/stepper/README.md +6 -4
- package/theming/components/cngx-accordion.css +1 -1
- package/theming/components/cngx-backdrop.css +12 -0
- package/theming/components/cngx-button-toggle.css +29 -3
- package/theming/components/cngx-data-grid.css +168 -1
- package/theming/components/cngx-dialog.css +13 -0
- package/theming/components/cngx-listbox.css +21 -12
- package/theming/components/cngx-menu.css +56 -16
- package/theming/components/cngx-popover.css +24 -0
- package/theming/components/cngx-recycler-placeholder.css +196 -0
- package/theming/components/cngx-ripple.css +1 -1
- package/theming/components/cngx-slider.css +32 -1
- package/theming/components/cngx-tooltip.css +12 -0
- package/timeline/README.md +155 -0
- package/types/cngx-common-a11y.d.ts +42 -18
- package/types/cngx-common-card.d.ts +201 -17
- package/types/cngx-common-chart.d.ts +343 -47
- package/types/cngx-common-command.d.ts +31 -8
- package/types/cngx-common-data.d.ts +581 -68
- package/types/cngx-common-dialog.d.ts +158 -3
- package/types/cngx-common-display.d.ts +356 -142
- package/types/cngx-common-interactive.d.ts +859 -210
- package/types/cngx-common-layout.d.ts +567 -28
- package/types/cngx-common-popover.d.ts +262 -39
- package/types/cngx-common-stepper.d.ts +366 -116
- package/types/cngx-common-tabs.d.ts +214 -50
- package/types/cngx-common-timeline.d.ts +82 -16
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, inject, ElementRef, signal, afterNextRender, effect, Directive, computed,
|
|
3
|
-
import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
|
|
4
|
-
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
5
|
-
import { fromEvent } from 'rxjs';
|
|
2
|
+
import { input, output, inject, ElementRef, signal, afterNextRender, effect, Directive, computed, untracked, isDevMode, DestroyRef, InjectionToken, PLATFORM_ID, model, TemplateRef, contentChild, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { DOCUMENT, isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import { toObservable, outputToObservable, takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
5
|
+
import { switchMap, fromEvent } from 'rxjs';
|
|
6
|
+
import { createTransitionTracker, observeMediaQuery, createMediaQuerySignal, coerceSignal, createOverrideMerge } from '@cngx/core/utils';
|
|
6
7
|
import * as i1 from '@cngx/common/a11y';
|
|
7
8
|
import { CngxFocusTrap } from '@cngx/common/a11y';
|
|
8
|
-
import { observeMediaQuery, createMediaQuerySignal } from '@cngx/core/utils';
|
|
9
9
|
import { Router, ActivatedRoute } from '@angular/router';
|
|
10
|
+
import { createLanguageSection } from '@cngx/core/i18n';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Manages backdrop overlay behavior: visibility, click-to-close, and
|
|
@@ -14,7 +15,12 @@ import { Router, ActivatedRoute } from '@angular/router';
|
|
|
14
15
|
*
|
|
15
16
|
* When visible, all sibling elements of the host receive the `inert`
|
|
16
17
|
* attribute, preventing focus and interaction behind the backdrop.
|
|
17
|
-
* This is critical for a11y in modal/drawer overlays.
|
|
18
|
+
* This is critical for a11y in modal/drawer overlays. A sibling drawer
|
|
19
|
+
* panel (`.cngx-drawer-panel`) is excluded - it is the surface the
|
|
20
|
+
* backdrop guards, not content behind it. Siblings that already carry
|
|
21
|
+
* `inert` are left alone, so a consumer-set `inert` survives the
|
|
22
|
+
* show/hide cycle. The sibling set is re-queried on every show, so
|
|
23
|
+
* siblings rendered after init are covered too.
|
|
18
24
|
*
|
|
19
25
|
* The directive is purely behavioral - it toggles the
|
|
20
26
|
* `.cngx-backdrop--visible` class and `aria-hidden` attribute. Visual
|
|
@@ -76,18 +82,28 @@ class CngxBackdrop {
|
|
|
76
82
|
/** Emitted when the backdrop is clicked (and `closeOnClick` is true). */
|
|
77
83
|
backdropClick = output();
|
|
78
84
|
el = inject((ElementRef));
|
|
79
|
-
|
|
85
|
+
domReady = signal(false, ...(ngDevMode ? [{ debugName: "domReady" }] : /* istanbul ignore next */ []));
|
|
80
86
|
constructor() {
|
|
81
|
-
afterNextRender(() =>
|
|
87
|
+
afterNextRender(() => this.domReady.set(true));
|
|
88
|
+
effect((onCleanup) => {
|
|
89
|
+
if (!this.domReady() || !this.visible()) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// Re-queried on every show: siblings rendered after init (@if/@defer)
|
|
93
|
+
// must be inerted too. The drawer panel keeps working - it is the
|
|
94
|
+
// surface the backdrop guards, not content behind it.
|
|
82
95
|
const el = this.el.nativeElement;
|
|
83
96
|
const parent = el.parentElement;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
// skip siblings that are already inert - removing it on cleanup
|
|
98
|
+
// would clobber a consumer-set attribute that predated the show
|
|
99
|
+
const targets = parent
|
|
100
|
+
? Array.from(parent.children).filter((child) => child !== el &&
|
|
101
|
+
child instanceof HTMLElement &&
|
|
102
|
+
!child.classList.contains('cngx-drawer-panel') &&
|
|
103
|
+
!child.hasAttribute('inert'))
|
|
104
|
+
: [];
|
|
105
|
+
targets.forEach((target) => target.setAttribute('inert', ''));
|
|
106
|
+
onCleanup(() => targets.forEach((target) => target.removeAttribute('inert')));
|
|
91
107
|
});
|
|
92
108
|
}
|
|
93
109
|
/** @internal */
|
|
@@ -97,7 +113,7 @@ class CngxBackdrop {
|
|
|
97
113
|
}
|
|
98
114
|
}
|
|
99
115
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBackdrop, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
100
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxBackdrop, isStandalone: true, selector: "[cngxBackdrop]", inputs: { visible: { classPropertyName: "visible", publicName: "cngxBackdrop", isSignal: true, isRequired: false, transformFunction: null }, closeOnClick: { classPropertyName: "closeOnClick", publicName: "closeOnClick", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { backdropClick: "backdropClick" }, host: { listeners: { "click": "handleHostClick()" }, properties: { "class.cngx-backdrop--visible": "visible()"
|
|
116
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxBackdrop, isStandalone: true, selector: "[cngxBackdrop]", inputs: { visible: { classPropertyName: "visible", publicName: "cngxBackdrop", isSignal: true, isRequired: false, transformFunction: null }, closeOnClick: { classPropertyName: "closeOnClick", publicName: "closeOnClick", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { backdropClick: "backdropClick" }, host: { attributes: { "aria-hidden": "true" }, listeners: { "click": "handleHostClick()" }, properties: { "class.cngx-backdrop--visible": "visible()" } }, exportAs: ["cngxBackdrop"], ngImport: i0 });
|
|
101
117
|
}
|
|
102
118
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBackdrop, decorators: [{
|
|
103
119
|
type: Directive,
|
|
@@ -107,7 +123,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
107
123
|
standalone: true,
|
|
108
124
|
host: {
|
|
109
125
|
'[class.cngx-backdrop--visible]': 'visible()',
|
|
110
|
-
'
|
|
126
|
+
'aria-hidden': 'true',
|
|
111
127
|
'(click)': 'handleHostClick()',
|
|
112
128
|
},
|
|
113
129
|
}]
|
|
@@ -165,8 +181,11 @@ class CngxDrawer {
|
|
|
165
181
|
openedChange = output();
|
|
166
182
|
/** Emitted when the drawer closes. Convenience shorthand for close-only listeners. */
|
|
167
183
|
closed = output();
|
|
168
|
-
/** Opens the drawer. */
|
|
184
|
+
/** Opens the drawer. No-op when already open. */
|
|
169
185
|
open() {
|
|
186
|
+
if (this.opened()) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
170
189
|
this.openedState.set(true);
|
|
171
190
|
this.openedChange.emit(true);
|
|
172
191
|
}
|
|
@@ -212,10 +231,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
212
231
|
* the `[enabled]` and `[autoFocus]` inputs from the template.
|
|
213
232
|
*
|
|
214
233
|
* Optionally closes the drawer when the user clicks outside the panel
|
|
215
|
-
* (`closeOnClickOutside`, default `true`).
|
|
234
|
+
* (`closeOnClickOutside`, default `true`). The click that opened the
|
|
235
|
+
* drawer never counts as an outside click. While closed (except in
|
|
236
|
+
* `side` mode) the panel is `aria-hidden` AND `inert`, so its focusable
|
|
237
|
+
* children are unreachable for keyboard and AT alike. On close, focus
|
|
238
|
+
* returns to the element that was focused when the drawer opened -
|
|
239
|
+
* unless the user moved focus to another focusable element themselves
|
|
240
|
+
* (a click on a focusable outside target keeps its focus).
|
|
241
|
+
*
|
|
242
|
+
* The `role` input defaults to `complementary`. On a `<nav>` host pass
|
|
243
|
+
* `[role]="null"` so the implicit navigation landmark survives:
|
|
216
244
|
*
|
|
217
245
|
* ```html
|
|
218
|
-
* <nav [cngxDrawerPanel]="drawer" position="left" mode="over"
|
|
246
|
+
* <nav [cngxDrawerPanel]="drawer" position="left" mode="over" [role]="null"
|
|
219
247
|
* [enabled]="drawer.opened()" [autoFocus]="true">
|
|
220
248
|
* <a href="/home">Home</a>
|
|
221
249
|
* </nav>
|
|
@@ -247,16 +275,69 @@ class CngxDrawerPanel {
|
|
|
247
275
|
mode = input('over', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
248
276
|
/** Whether clicking outside the panel closes the drawer. */
|
|
249
277
|
closeOnClickOutside = input(true, ...(ngDevMode ? [{ debugName: "closeOnClickOutside" }] : /* istanbul ignore next */ []));
|
|
278
|
+
/**
|
|
279
|
+
* Landmark role rendered on the panel. Defaults to `complementary`;
|
|
280
|
+
* pass `navigation` for nav drawers or `null` to keep the element's
|
|
281
|
+
* implicit role (e.g. on a `<nav>` host).
|
|
282
|
+
*/
|
|
283
|
+
role = input('complementary', ...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
|
|
250
284
|
/** Whether the drawer is currently open (derived from the drawer ref). In `side` mode, always `true`. */
|
|
251
285
|
isOpen = computed(() => this.mode() === 'side' || this.drawerRef().opened(), ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
286
|
+
suppressOutsideClick = false;
|
|
287
|
+
restoreTarget = null;
|
|
252
288
|
constructor() {
|
|
253
289
|
const doc = inject(DOCUMENT);
|
|
290
|
+
const el = inject((ElementRef));
|
|
291
|
+
// Focus restoration: closing puts `inert` on the panel, which would
|
|
292
|
+
// silently drop focus to <body>. Capture the focused element at the
|
|
293
|
+
// open transition and hand focus back at the close transition when
|
|
294
|
+
// focus is still inside the panel (Escape) or already fell to <body>
|
|
295
|
+
// (outside click on a non-focusable area). A focusable outside target
|
|
296
|
+
// the user clicked keeps its focus.
|
|
297
|
+
const openTransition = createTransitionTracker(() => this.isOpen());
|
|
298
|
+
effect(() => {
|
|
299
|
+
const open = openTransition.current();
|
|
300
|
+
const wasOpen = openTransition.previous();
|
|
301
|
+
if (open === wasOpen) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
untracked(() => {
|
|
305
|
+
if (open) {
|
|
306
|
+
const active = doc.activeElement;
|
|
307
|
+
this.restoreTarget = active instanceof HTMLElement ? active : null;
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
const active = doc.activeElement;
|
|
311
|
+
const focusLost = active === null ||
|
|
312
|
+
active === doc.body ||
|
|
313
|
+
el.nativeElement.contains(active);
|
|
314
|
+
if (focusLost && this.restoreTarget?.isConnected) {
|
|
315
|
+
this.restoreTarget.focus();
|
|
316
|
+
}
|
|
317
|
+
this.restoreTarget = null;
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
// A click on a toggle OUTSIDE the container opens the drawer and then
|
|
321
|
+
// bubbles on to the document listener below within the same dispatch -
|
|
322
|
+
// without suppression it would close its own drawer instantly. The
|
|
323
|
+
// openedChange emit is synchronous inside that dispatch; the flag is
|
|
324
|
+
// lifted on the next macrotask, after the bubble phase has finished
|
|
325
|
+
// (a microtask checkpoint can run between listeners of a native event).
|
|
326
|
+
toObservable(this.drawerRef)
|
|
327
|
+
.pipe(switchMap((drawer) => outputToObservable(drawer.openedChange)), takeUntilDestroyed())
|
|
328
|
+
.subscribe((opened) => {
|
|
329
|
+
if (opened) {
|
|
330
|
+
this.suppressOutsideClick = true;
|
|
331
|
+
setTimeout(() => (this.suppressOutsideClick = false));
|
|
332
|
+
}
|
|
333
|
+
});
|
|
254
334
|
// Hit-test against the container, not the panel - toggle buttons and backdrops
|
|
255
335
|
// sit inside the container and must not count as outside clicks.
|
|
256
336
|
fromEvent(doc, 'click')
|
|
257
337
|
.pipe(takeUntilDestroyed())
|
|
258
338
|
.subscribe((e) => {
|
|
259
|
-
if (this.
|
|
339
|
+
if (!this.suppressOutsideClick &&
|
|
340
|
+
this.mode() !== 'side' &&
|
|
260
341
|
this.isOpen() &&
|
|
261
342
|
this.closeOnClickOutside() &&
|
|
262
343
|
!this.drawerRef().elementRef.nativeElement.contains(e.target)) {
|
|
@@ -265,7 +346,7 @@ class CngxDrawerPanel {
|
|
|
265
346
|
});
|
|
266
347
|
}
|
|
267
348
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDrawerPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
268
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxDrawerPanel, isStandalone: true, selector: "[cngxDrawerPanel]", inputs: { drawerRef: { classPropertyName: "drawerRef", publicName: "cngxDrawerPanel", isSignal: true, isRequired: true, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, closeOnClickOutside: { classPropertyName: "closeOnClickOutside", publicName: "closeOnClickOutside", isSignal: true, isRequired: false, transformFunction: null }
|
|
349
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxDrawerPanel, isStandalone: true, selector: "[cngxDrawerPanel]", inputs: { drawerRef: { classPropertyName: "drawerRef", publicName: "cngxDrawerPanel", isSignal: true, isRequired: true, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, closeOnClickOutside: { classPropertyName: "closeOnClickOutside", publicName: "closeOnClickOutside", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-drawer-panel": "true", "class.cngx-drawer-panel--open": "isOpen()", "class.cngx-drawer-panel--left": "position() === 'left'", "class.cngx-drawer-panel--right": "position() === 'right'", "class.cngx-drawer-panel--top": "position() === 'top'", "class.cngx-drawer-panel--bottom": "position() === 'bottom'", "class.cngx-drawer-panel--over": "mode() === 'over'", "class.cngx-drawer-panel--push": "mode() === 'push'", "class.cngx-drawer-panel--side": "mode() === 'side'", "attr.aria-hidden": "mode() !== 'side' && !isOpen() ? true : null", "attr.inert": "mode() !== 'side' && !isOpen() ? '' : null", "attr.role": "role()" } }, exportAs: ["cngxDrawerPanel"], hostDirectives: [{ directive: i1.CngxFocusTrap, inputs: ["enabled", "enabled", "autoFocus", "autoFocus"] }], ngImport: i0 });
|
|
269
350
|
}
|
|
270
351
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDrawerPanel, decorators: [{
|
|
271
352
|
type: Directive,
|
|
@@ -284,11 +365,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
284
365
|
'[class.cngx-drawer-panel--over]': "mode() === 'over'",
|
|
285
366
|
'[class.cngx-drawer-panel--push]': "mode() === 'push'",
|
|
286
367
|
'[class.cngx-drawer-panel--side]': "mode() === 'side'",
|
|
287
|
-
'[attr.aria-hidden]': "mode()
|
|
288
|
-
|
|
368
|
+
'[attr.aria-hidden]': "mode() !== 'side' && !isOpen() ? true : null",
|
|
369
|
+
'[attr.inert]': "mode() !== 'side' && !isOpen() ? '' : null",
|
|
370
|
+
'[attr.role]': 'role()',
|
|
289
371
|
},
|
|
290
372
|
}]
|
|
291
|
-
}], ctorParameters: () => [], propDecorators: { drawerRef: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxDrawerPanel", required: true }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], closeOnClickOutside: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnClickOutside", required: false }] }] } });
|
|
373
|
+
}], ctorParameters: () => [], propDecorators: { drawerRef: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxDrawerPanel", required: true }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], closeOnClickOutside: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnClickOutside", required: false }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }] } });
|
|
292
374
|
|
|
293
375
|
/**
|
|
294
376
|
* Marks the main content area adjacent to a drawer panel.
|
|
@@ -405,8 +487,13 @@ class CngxIntersectionObserver {
|
|
|
405
487
|
const rootMargin = this.rootMargin();
|
|
406
488
|
const threshold = this.threshold();
|
|
407
489
|
const resolvedRoot = root ? this.doc.querySelector(root) : null;
|
|
490
|
+
if (isDevMode() && root && !resolvedRoot) {
|
|
491
|
+
console.warn(`[cngxIntersectionObserver] root selector "${root}" matched no element - ` +
|
|
492
|
+
'falling back to the viewport. A late-rendered root needs a re-bind of [root].');
|
|
493
|
+
}
|
|
408
494
|
const observer = new IntersectionObserver((entries) => {
|
|
409
|
-
|
|
495
|
+
// batched records arrive oldest-first; only the newest reflects reality
|
|
496
|
+
const entry = entries[entries.length - 1];
|
|
410
497
|
const wasIntersecting = this.entryState()?.isIntersecting ?? false;
|
|
411
498
|
this.entryState.set(entry);
|
|
412
499
|
this.intersectionChange.emit(entry);
|
|
@@ -532,13 +619,16 @@ function injectMediaQuery(query) {
|
|
|
532
619
|
* Dev-warning the query-param sync kernel emits when `@angular/router` is
|
|
533
620
|
* not provided. Mirrors {@link warnTabsRouterAbsent} in `@cngx/common/tabs`
|
|
534
621
|
* so the message stays identical across the two sync surfaces; only the
|
|
535
|
-
* `enables` clause differs
|
|
536
|
-
* import - sharing would force the helper onto a
|
|
537
|
-
* matches no approved public-API prefix.
|
|
622
|
+
* `enables` clause differs (and this copy is dev-gated). A deliberate small
|
|
623
|
+
* copy rather than a shared import - sharing would force the helper onto a
|
|
624
|
+
* `public-api.ts`, and `warn*` matches no approved public-API prefix.
|
|
538
625
|
*
|
|
539
626
|
* @internal
|
|
540
627
|
*/
|
|
541
628
|
function warnRouterAbsent(directive, enables) {
|
|
629
|
+
if (!isDevMode()) {
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
542
632
|
console.warn(`${directive}: no Router available - directive is a no-op. ` +
|
|
543
633
|
`Provide @angular/router via provideRouter(...) to enable ${enables}.`);
|
|
544
634
|
}
|
|
@@ -577,7 +667,7 @@ function injectQueryParamSync(state, opts) {
|
|
|
577
667
|
return;
|
|
578
668
|
}
|
|
579
669
|
const route = inject(ActivatedRoute);
|
|
580
|
-
const paramSignal =
|
|
670
|
+
const paramSignal = coerceSignal(opts.param);
|
|
581
671
|
const serialize = opts.serialize ?? ((value) => (value ? 'open' : null));
|
|
582
672
|
const deserialize = opts.deserialize ?? ((raw) => (raw != null));
|
|
583
673
|
// Closure bookkeeping, seeded from the initial URL read. `lastWritten` is
|
|
@@ -662,6 +752,75 @@ function injectQueryParamSync(state, opts) {
|
|
|
662
752
|
});
|
|
663
753
|
}
|
|
664
754
|
|
|
755
|
+
/**
|
|
756
|
+
* Subscribes `apply` to size changes of `element` on `host`.
|
|
757
|
+
*
|
|
758
|
+
* Re-applies on every observation and returns the teardown that disconnects
|
|
759
|
+
* the observer. On a host without `ResizeObserver` (SSR, jsdom) nothing is
|
|
760
|
+
* wired, `apply` never fires, and the returned teardown is a no-op. Unlike the
|
|
761
|
+
* media-query twin there is no synchronous seed: the first size is whatever the
|
|
762
|
+
* observer reports after the next layout.
|
|
763
|
+
*
|
|
764
|
+
* Reach for this low-level form when the observed element or the box model is
|
|
765
|
+
* reactive and the subscription must follow it (re-wire per `effect` run via
|
|
766
|
+
* `onCleanup`); for a static target, {@link createResizeSignal} owns the
|
|
767
|
+
* teardown via `DestroyRef`.
|
|
768
|
+
*
|
|
769
|
+
* @param host The window-like object to read `ResizeObserver` from.
|
|
770
|
+
* @param element The element to observe.
|
|
771
|
+
* @param box Which box model to report.
|
|
772
|
+
* @param apply Receives the first entry of every observation batch.
|
|
773
|
+
* @returns Teardown that disconnects the observer.
|
|
774
|
+
* @category common/layout/observers
|
|
775
|
+
* @relatedTo createResizeSignal, observeMediaQuery
|
|
776
|
+
* @since 0.1.0
|
|
777
|
+
*/
|
|
778
|
+
function observeResize(host, element, box, apply) {
|
|
779
|
+
if (!host || typeof host.ResizeObserver !== 'function') {
|
|
780
|
+
return () => undefined;
|
|
781
|
+
}
|
|
782
|
+
const observer = new host.ResizeObserver((entries) => apply(entries[0]));
|
|
783
|
+
observer.observe(element, { box });
|
|
784
|
+
return () => observer.disconnect();
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Creates a `Signal<ResizeObserverEntry | null>` that carries the most recent
|
|
788
|
+
* observation of `element`, `null` until the first one arrives.
|
|
789
|
+
*
|
|
790
|
+
* Disconnects when `destroyRef` is destroyed. On a host without
|
|
791
|
+
* `ResizeObserver` (SSR, jsdom) the signal stays `null` and no observer is
|
|
792
|
+
* created, so it never throws off the browser.
|
|
793
|
+
*
|
|
794
|
+
* This is the shared kernel behind `CngxResizeObserver` and
|
|
795
|
+
* `createContainerSize`; consumers that hand-roll a `ResizeObserver` should
|
|
796
|
+
* route through it instead.
|
|
797
|
+
*
|
|
798
|
+
* ```typescript
|
|
799
|
+
* const entry = createResizeSignal(
|
|
800
|
+
* host,
|
|
801
|
+
* 'border-box',
|
|
802
|
+
* inject(DestroyRef),
|
|
803
|
+
* inject(DOCUMENT).defaultView,
|
|
804
|
+
* );
|
|
805
|
+
* const width = computed(() => entry()?.borderBoxSize[0]?.inlineSize ?? 0);
|
|
806
|
+
* ```
|
|
807
|
+
*
|
|
808
|
+
* @param element The element to observe.
|
|
809
|
+
* @param box Which box model to report.
|
|
810
|
+
* @param destroyRef Scope whose destruction disconnects the observer.
|
|
811
|
+
* @param host The window-like object to read `ResizeObserver` from.
|
|
812
|
+
* @returns A readonly signal carrying the latest entry.
|
|
813
|
+
* @category common/layout/observers
|
|
814
|
+
* @relatedTo observeResize, createMediaQuerySignal
|
|
815
|
+
* @since 0.1.0
|
|
816
|
+
*/
|
|
817
|
+
function createResizeSignal(element, box, destroyRef, host) {
|
|
818
|
+
const entry = signal(null, ...(ngDevMode ? [{ debugName: "entry" }] : /* istanbul ignore next */ []));
|
|
819
|
+
const unsubscribe = observeResize(host, element, box, (value) => entry.set(value));
|
|
820
|
+
destroyRef.onDestroy(unsubscribe);
|
|
821
|
+
return entry.asReadonly();
|
|
822
|
+
}
|
|
823
|
+
|
|
665
824
|
/**
|
|
666
825
|
* Observes size changes of the host element via the `ResizeObserver` API.
|
|
667
826
|
*
|
|
@@ -710,18 +869,16 @@ class CngxResizeObserver {
|
|
|
710
869
|
el = inject((ElementRef));
|
|
711
870
|
constructor() {
|
|
712
871
|
const win = inject(DOCUMENT).defaultView;
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
this.
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
observer.observe(this.el.nativeElement, { box: this.box() });
|
|
872
|
+
// One subscription per `box` value: `onCleanup` disconnects the previous
|
|
873
|
+
// observer before `observeResize` wires the next, which is also the
|
|
874
|
+
// teardown on destroy. The kernel no-ops when the host ships no
|
|
875
|
+
// `ResizeObserver` (SSR, jsdom), so no host guard is needed here.
|
|
876
|
+
effect((onCleanup) => {
|
|
877
|
+
onCleanup(observeResize(win, this.el.nativeElement, this.box(), (entry) => {
|
|
878
|
+
this.entryState.set(entry);
|
|
879
|
+
this.resize.emit(entry);
|
|
880
|
+
}));
|
|
723
881
|
});
|
|
724
|
-
inject(DestroyRef).onDestroy(() => observer.disconnect());
|
|
725
882
|
}
|
|
726
883
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxResizeObserver, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
727
884
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxResizeObserver, isStandalone: true, selector: "[cngxResizeObserver]", inputs: { box: { classPropertyName: "box", publicName: "box", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { resize: "resize" }, exportAs: ["cngxResizeObserver"], ngImport: i0 });
|
|
@@ -735,6 +892,187 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
735
892
|
}]
|
|
736
893
|
}], ctorParameters: () => [], propDecorators: { box: [{ type: i0.Input, args: [{ isSignal: true, alias: "box", required: false }] }], resize: [{ type: i0.Output, args: ["resize"] }] } });
|
|
737
894
|
|
|
895
|
+
/**
|
|
896
|
+
* The nearest query container declared by {@link CngxContainer}.
|
|
897
|
+
*
|
|
898
|
+
* Deliberately has no root factory: absence is meaningful. A component that
|
|
899
|
+
* needs a container and finds none must say so (a dev-mode warning), not
|
|
900
|
+
* silently observe itself.
|
|
901
|
+
*
|
|
902
|
+
* @category common/layout/observers
|
|
903
|
+
* @since 0.1.0
|
|
904
|
+
*/
|
|
905
|
+
const CNGX_CONTAINER_SIZE = new InjectionToken('CNGX_CONTAINER_SIZE');
|
|
906
|
+
/**
|
|
907
|
+
* Creates a {@link CngxContainerSize} over `element`.
|
|
908
|
+
*
|
|
909
|
+
* Observes the border box, so the reported size matches what an
|
|
910
|
+
* `inline-size` container query measures. The `property()` reads are plain
|
|
911
|
+
* `computed()`s over the same resize signal - the browser has already
|
|
912
|
+
* re-evaluated every container query by the time a `ResizeObserver` callback
|
|
913
|
+
* runs, so the read returns the current value without a second scheduling hop.
|
|
914
|
+
*
|
|
915
|
+
* @param element The container host.
|
|
916
|
+
* @param destroyRef Scope whose destruction disconnects the observer.
|
|
917
|
+
* @param win The window-like object providing `ResizeObserver` and `getComputedStyle`.
|
|
918
|
+
* @category common/layout/observers
|
|
919
|
+
* @relatedTo injectContainerSize, CngxContainer
|
|
920
|
+
* @since 0.1.0
|
|
921
|
+
*/
|
|
922
|
+
function createContainerSize(element, destroyRef, win) {
|
|
923
|
+
const entry = createResizeSignal(element, 'border-box', destroyRef, win);
|
|
924
|
+
const inlineSize = computed(() => entry()?.borderBoxSize?.[0]?.inlineSize ?? 0, ...(ngDevMode ? [{ debugName: "inlineSize" }] : /* istanbul ignore next */ []));
|
|
925
|
+
const blockSize = computed(() => entry()?.borderBoxSize?.[0]?.blockSize ?? 0, ...(ngDevMode ? [{ debugName: "blockSize" }] : /* istanbul ignore next */ []));
|
|
926
|
+
const isReady = computed(() => entry() !== null, ...(ngDevMode ? [{ debugName: "isReady" }] : /* istanbul ignore next */ []));
|
|
927
|
+
// Weak on the element: the container outlives descendants that get
|
|
928
|
+
// destroyed, so a strong Map would pin every dead node it ever read.
|
|
929
|
+
const cache = new WeakMap();
|
|
930
|
+
const property = (name, on, pseudo) => {
|
|
931
|
+
const target = on ?? element;
|
|
932
|
+
let byName = cache.get(target);
|
|
933
|
+
if (!byName) {
|
|
934
|
+
byName = new Map();
|
|
935
|
+
cache.set(target, byName);
|
|
936
|
+
}
|
|
937
|
+
const key = `${pseudo ?? ''}|${name}`;
|
|
938
|
+
const cached = byName.get(key);
|
|
939
|
+
if (cached) {
|
|
940
|
+
return cached;
|
|
941
|
+
}
|
|
942
|
+
// A DOM read inside a computed() is deliberate here, not an oversight: the
|
|
943
|
+
// only tracked dependency is the resize entry, and a ResizeObserver
|
|
944
|
+
// callback runs after layout, when every container query has already been
|
|
945
|
+
// re-evaluated. The read is therefore idempotent for a given entry and
|
|
946
|
+
// never forces a recalc of its own. An effect writing into a signal would
|
|
947
|
+
// add a scheduling hop for nothing.
|
|
948
|
+
const value = computed(() => {
|
|
949
|
+
if (entry() === null || !win?.getComputedStyle) {
|
|
950
|
+
return '';
|
|
951
|
+
}
|
|
952
|
+
return win
|
|
953
|
+
.getComputedStyle(target, pseudo ?? null)
|
|
954
|
+
.getPropertyValue(name)
|
|
955
|
+
.trim();
|
|
956
|
+
}, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
957
|
+
byName.set(key, value);
|
|
958
|
+
return value;
|
|
959
|
+
};
|
|
960
|
+
return { inlineSize, blockSize, isReady, property };
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Reads the nearest query container declared by a `[cngxContainer]` ancestor,
|
|
964
|
+
* or observes `target` (default: the host element) when there is none.
|
|
965
|
+
*
|
|
966
|
+
* Use it where a component must branch structurally on the width it was given
|
|
967
|
+
* - a different template, a focus move, an `aria-modal` flip. Purely visual
|
|
968
|
+
* adaptation needs no TypeScript at all: write a `@container` rule.
|
|
969
|
+
*
|
|
970
|
+
* ```typescript
|
|
971
|
+
* private readonly container = inject(CNGX_CONTAINER_SIZE, { optional: true });
|
|
972
|
+
* private readonly wide = this.container?.property('--cngx-thing-wide', this.host) ?? signal('').asReadonly();
|
|
973
|
+
* readonly mode = computed(() => (this.wide() === '1' ? 'side' : 'over'));
|
|
974
|
+
* ```
|
|
975
|
+
*
|
|
976
|
+
* A component that declares the container in its own stylesheet and reads it
|
|
977
|
+
* itself passes its host explicitly and reads the property off `::after` -
|
|
978
|
+
* there is no descendant to carry the value:
|
|
979
|
+
*
|
|
980
|
+
* ```typescript
|
|
981
|
+
* private readonly host = inject(ElementRef).nativeElement as Element;
|
|
982
|
+
* private readonly container = injectContainerSize(this.host);
|
|
983
|
+
* private readonly narrow = this.container.property('--cngx-thing-narrow', this.host, '::after');
|
|
984
|
+
* ```
|
|
985
|
+
*
|
|
986
|
+
* @param target Element to observe when no ancestor container exists.
|
|
987
|
+
* @category common/layout/observers
|
|
988
|
+
* @relatedTo CngxContainer, injectMediaQuery
|
|
989
|
+
* @since 0.1.0
|
|
990
|
+
*/
|
|
991
|
+
function injectContainerSize(target) {
|
|
992
|
+
const ancestor = inject(CNGX_CONTAINER_SIZE, { optional: true, skipSelf: true });
|
|
993
|
+
if (ancestor && !target) {
|
|
994
|
+
return ancestor;
|
|
995
|
+
}
|
|
996
|
+
const resolved = target instanceof ElementRef
|
|
997
|
+
? target.nativeElement
|
|
998
|
+
: (target ?? inject(ElementRef).nativeElement);
|
|
999
|
+
return createContainerSize(resolved, inject(DestroyRef), inject(DOCUMENT).defaultView);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* Observes a query container and publishes its size to descendants through
|
|
1004
|
+
* {@link CNGX_CONTAINER_SIZE}.
|
|
1005
|
+
*
|
|
1006
|
+
* The directive declares nothing visual. **Both `container-type` and
|
|
1007
|
+
* `container-name` belong in the stylesheet**, next to the `@container` rules
|
|
1008
|
+
* that use them: the name is API (an unnamed query matches the nearest
|
|
1009
|
+
* container of any name, so a consumer wrapping the component in their own
|
|
1010
|
+
* container would silently re-target it), and containment is a layout
|
|
1011
|
+
* decision a skin must be able to opt out of with a plain CSS rule rather
|
|
1012
|
+
* than `!important` against a host style.
|
|
1013
|
+
*
|
|
1014
|
+
* ```css
|
|
1015
|
+
* cngx-thing-layout {
|
|
1016
|
+
* container-type: inline-size;
|
|
1017
|
+
* container-name: cngx-thing-layout;
|
|
1018
|
+
* }
|
|
1019
|
+
*
|
|
1020
|
+
* cngx-thing-layout > cngx-thing { --cngx-thing-wide: 0; }
|
|
1021
|
+
*
|
|
1022
|
+
* @container cngx-thing-layout (min-inline-size: 64rem) {
|
|
1023
|
+
* cngx-thing-layout > cngx-thing { --cngx-thing-wide: 1; }
|
|
1024
|
+
* }
|
|
1025
|
+
* ```
|
|
1026
|
+
*
|
|
1027
|
+
* ```html
|
|
1028
|
+
* <div cngxContainer>
|
|
1029
|
+
* <app-panel />
|
|
1030
|
+
* </div>
|
|
1031
|
+
* ```
|
|
1032
|
+
*
|
|
1033
|
+
* A descendant reads the resolved value with `injectContainerSize()`, so the
|
|
1034
|
+
* breakpoint exists exactly once - in CSS. Note that `container-type:
|
|
1035
|
+
* inline-size` applies size containment: an element that must shrink-wrap its
|
|
1036
|
+
* content (an inline chip, a `width: max-content` bar) must not be a
|
|
1037
|
+
* container.
|
|
1038
|
+
*
|
|
1039
|
+
* @category common/layout
|
|
1040
|
+
* @docsKind primary
|
|
1041
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/observers/container.directive.ts
|
|
1042
|
+
* @since 0.1.0
|
|
1043
|
+
* @relatedTo injectContainerSize, CngxResizeObserver, CngxMediaQuery
|
|
1044
|
+
* <example-url>http://localhost:4200/#/common/layout/container/css-decides-js-reads</example-url>
|
|
1045
|
+
*/
|
|
1046
|
+
class CngxContainer {
|
|
1047
|
+
size = createContainerSize(inject(ElementRef).nativeElement, inject(DestroyRef), inject(DOCUMENT).defaultView);
|
|
1048
|
+
/** Border-box inline size in pixels. `0` before the first observation. */
|
|
1049
|
+
inlineSize = this.size.inlineSize;
|
|
1050
|
+
/** Border-box block size in pixels. `0` before the first observation. */
|
|
1051
|
+
blockSize = this.size.blockSize;
|
|
1052
|
+
/** `true` once the first observation has arrived. */
|
|
1053
|
+
isReady = this.size.isReady;
|
|
1054
|
+
/**
|
|
1055
|
+
* The resolved value of a custom property on `on` (default: this host),
|
|
1056
|
+
* re-read on every resize. The `@container` rule must style a descendant,
|
|
1057
|
+
* or a pseudo-element of the container itself - see
|
|
1058
|
+
* {@link CngxContainerSize.property}.
|
|
1059
|
+
*/
|
|
1060
|
+
property(name, on, pseudo) {
|
|
1061
|
+
return this.size.property(name, on, pseudo);
|
|
1062
|
+
}
|
|
1063
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxContainer, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1064
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxContainer, isStandalone: true, selector: "[cngxContainer]", providers: [{ provide: CNGX_CONTAINER_SIZE, useExisting: CngxContainer }], exportAs: ["cngxContainer"], ngImport: i0 });
|
|
1065
|
+
}
|
|
1066
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxContainer, decorators: [{
|
|
1067
|
+
type: Directive,
|
|
1068
|
+
args: [{
|
|
1069
|
+
selector: '[cngxContainer]',
|
|
1070
|
+
exportAs: 'cngxContainer',
|
|
1071
|
+
standalone: true,
|
|
1072
|
+
providers: [{ provide: CNGX_CONTAINER_SIZE, useExisting: CngxContainer }],
|
|
1073
|
+
}]
|
|
1074
|
+
}] });
|
|
1075
|
+
|
|
738
1076
|
/**
|
|
739
1077
|
* Ref-count per document root. Module-private on purpose: this file is the
|
|
740
1078
|
* single owner of the lock state. A second copy of this map (the pre-extraction
|
|
@@ -861,6 +1199,240 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
861
1199
|
}]
|
|
862
1200
|
}], ctorParameters: () => [], propDecorators: { enabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxScrollLock", required: false }] }] } });
|
|
863
1201
|
|
|
1202
|
+
/** Distances up to this many px count as "at the edge" (sub-pixel and zoom rounding). */
|
|
1203
|
+
const EDGE_TOLERANCE = 1;
|
|
1204
|
+
const NO_EDGES = {
|
|
1205
|
+
blockStart: false,
|
|
1206
|
+
blockEnd: false,
|
|
1207
|
+
inlineStart: false,
|
|
1208
|
+
inlineEnd: false,
|
|
1209
|
+
};
|
|
1210
|
+
function sameEdges(a, b) {
|
|
1211
|
+
return (a.blockStart === b.blockStart &&
|
|
1212
|
+
a.blockEnd === b.blockEnd &&
|
|
1213
|
+
a.inlineStart === b.inlineStart &&
|
|
1214
|
+
a.inlineEnd === b.inlineEnd);
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* One read of the six scroll metrics. RTL `scrollLeft` runs over `[-max, 0]`
|
|
1218
|
+
* in every evergreen engine and LTR over `[0, max]`, so its magnitude is the
|
|
1219
|
+
* distance from the inline-start edge in both directions - no direction lookup
|
|
1220
|
+
* and no `getComputedStyle` in the scroll path.
|
|
1221
|
+
*/
|
|
1222
|
+
function readEdges(element) {
|
|
1223
|
+
const inlineOffset = Math.abs(element.scrollLeft);
|
|
1224
|
+
return {
|
|
1225
|
+
blockStart: element.scrollTop > EDGE_TOLERANCE,
|
|
1226
|
+
blockEnd: element.scrollHeight - element.clientHeight - element.scrollTop > EDGE_TOLERANCE,
|
|
1227
|
+
inlineStart: inlineOffset > EDGE_TOLERANCE,
|
|
1228
|
+
inlineEnd: element.scrollWidth - element.clientWidth - inlineOffset > EDGE_TOLERANCE,
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* Tracks which edges of a scrollport still hide content, as four boolean
|
|
1233
|
+
* signals.
|
|
1234
|
+
*
|
|
1235
|
+
* Triggers are a passive `scroll` listener, one `observeResize` per observed
|
|
1236
|
+
* element (the scrollport itself plus every direct element child) and a
|
|
1237
|
+
* `childList`-only `MutationObserver` that keeps that child set current. All
|
|
1238
|
+
* of them only schedule work: the metrics are read once per animation frame
|
|
1239
|
+
* however many triggers fired, and the result lands in one snapshot signal
|
|
1240
|
+
* with a structural `equal`, so the four projections only notify when an edge
|
|
1241
|
+
* actually flips. A distance of 1px or less counts as "at the edge".
|
|
1242
|
+
*
|
|
1243
|
+
* Only direct children are resize-observed. A long item list should sit inside
|
|
1244
|
+
* one content element rather than be N direct children (one observer each);
|
|
1245
|
+
* growth deep inside a fixed-size child is picked up on the next scroll.
|
|
1246
|
+
*
|
|
1247
|
+
* A `null` host (SSR) wires nothing and all four signals stay `false`.
|
|
1248
|
+
*
|
|
1249
|
+
* ```typescript
|
|
1250
|
+
* const edges = createScrollEdges(
|
|
1251
|
+
* inject(ElementRef).nativeElement,
|
|
1252
|
+
* inject(DestroyRef),
|
|
1253
|
+
* inject(DOCUMENT).defaultView,
|
|
1254
|
+
* );
|
|
1255
|
+
* const showTopShadow = edges.canScrollBlockStart;
|
|
1256
|
+
* ```
|
|
1257
|
+
*
|
|
1258
|
+
* @param element The scrollport to read.
|
|
1259
|
+
* @param destroyRef Scope whose destruction removes the listener, disconnects
|
|
1260
|
+
* every observer and cancels a pending frame.
|
|
1261
|
+
* @param host The window-like object to read the observer and frame APIs from.
|
|
1262
|
+
* @returns The four per-edge signals.
|
|
1263
|
+
* @category common/layout
|
|
1264
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/scroll-edges-core.ts
|
|
1265
|
+
* @since 0.1.0
|
|
1266
|
+
* @relatedTo CngxScrollEdges, observeResize
|
|
1267
|
+
*/
|
|
1268
|
+
function createScrollEdges(element, destroyRef, host) {
|
|
1269
|
+
const edges = signal(NO_EDGES, { ...(ngDevMode ? { debugName: "edges" } : /* istanbul ignore next */ {}), equal: sameEdges });
|
|
1270
|
+
const state = {
|
|
1271
|
+
canScrollBlockStart: computed(() => edges().blockStart),
|
|
1272
|
+
canScrollBlockEnd: computed(() => edges().blockEnd),
|
|
1273
|
+
canScrollInlineStart: computed(() => edges().inlineStart),
|
|
1274
|
+
canScrollInlineEnd: computed(() => edges().inlineEnd),
|
|
1275
|
+
};
|
|
1276
|
+
if (!host) {
|
|
1277
|
+
return state;
|
|
1278
|
+
}
|
|
1279
|
+
let destroyed = false;
|
|
1280
|
+
let framePending = false;
|
|
1281
|
+
let frameHandle = 0;
|
|
1282
|
+
const read = () => {
|
|
1283
|
+
framePending = false;
|
|
1284
|
+
if (destroyed) {
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
edges.set(readEdges(element));
|
|
1288
|
+
};
|
|
1289
|
+
const schedule = () => {
|
|
1290
|
+
if (destroyed || framePending) {
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
if (typeof host.requestAnimationFrame !== 'function') {
|
|
1294
|
+
read();
|
|
1295
|
+
return;
|
|
1296
|
+
}
|
|
1297
|
+
framePending = true;
|
|
1298
|
+
frameHandle = host.requestAnimationFrame(read);
|
|
1299
|
+
};
|
|
1300
|
+
const resizeTeardowns = new Map();
|
|
1301
|
+
const observe = (target) => {
|
|
1302
|
+
if (resizeTeardowns.has(target)) {
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
resizeTeardowns.set(target, observeResize(host, target, 'border-box', () => schedule()));
|
|
1306
|
+
};
|
|
1307
|
+
const syncChildren = () => {
|
|
1308
|
+
const children = new Set(Array.from(element.children));
|
|
1309
|
+
for (const [target, teardown] of resizeTeardowns) {
|
|
1310
|
+
if (target !== element && !children.has(target)) {
|
|
1311
|
+
teardown();
|
|
1312
|
+
resizeTeardowns.delete(target);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
children.forEach(observe);
|
|
1316
|
+
};
|
|
1317
|
+
element.addEventListener('scroll', schedule, { passive: true });
|
|
1318
|
+
observe(element);
|
|
1319
|
+
syncChildren();
|
|
1320
|
+
let mutationObserver = null;
|
|
1321
|
+
if (typeof host.MutationObserver === 'function') {
|
|
1322
|
+
mutationObserver = new host.MutationObserver(() => {
|
|
1323
|
+
syncChildren();
|
|
1324
|
+
schedule();
|
|
1325
|
+
});
|
|
1326
|
+
mutationObserver.observe(element, { childList: true });
|
|
1327
|
+
}
|
|
1328
|
+
schedule();
|
|
1329
|
+
destroyRef.onDestroy(() => {
|
|
1330
|
+
destroyed = true;
|
|
1331
|
+
element.removeEventListener('scroll', schedule);
|
|
1332
|
+
mutationObserver?.disconnect();
|
|
1333
|
+
resizeTeardowns.forEach((teardown) => teardown());
|
|
1334
|
+
resizeTeardowns.clear();
|
|
1335
|
+
if (framePending && typeof host.cancelAnimationFrame === 'function') {
|
|
1336
|
+
host.cancelAnimationFrame(frameHandle);
|
|
1337
|
+
}
|
|
1338
|
+
framePending = false;
|
|
1339
|
+
});
|
|
1340
|
+
return state;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Reports which edges of a scrollport still hide content and reflects them as
|
|
1345
|
+
* host attributes, so an edge shadow or fade appears only while there really
|
|
1346
|
+
* is something to scroll to in that direction.
|
|
1347
|
+
*
|
|
1348
|
+
* Put it on the element that scrolls (`overflow: auto` / `scroll`). The four
|
|
1349
|
+
* signals and the four logical host attributes are derived from one read of
|
|
1350
|
+
* the scroll metrics per animation frame; the attributes are present (empty
|
|
1351
|
+
* value) while true and absent otherwise:
|
|
1352
|
+
*
|
|
1353
|
+
* - `data-scroll-block-start` / `canScrollBlockStart()` - content hidden above
|
|
1354
|
+
* - `data-scroll-block-end` / `canScrollBlockEnd()` - content hidden below
|
|
1355
|
+
* - `data-scroll-inline-start` / `canScrollInlineStart()` - hidden toward inline start
|
|
1356
|
+
* - `data-scroll-inline-end` / `canScrollInlineEnd()` - hidden toward inline end
|
|
1357
|
+
*
|
|
1358
|
+
* Inline start / end follow the writing direction: in `dir="rtl"` the start
|
|
1359
|
+
* edge is on the right. The direction is derived from the scroll offset
|
|
1360
|
+
* itself, so a `dir="rtl"` subtree inside an LTR page reports correctly.
|
|
1361
|
+
*
|
|
1362
|
+
* The directive paints nothing. The four attributes (present only while true)
|
|
1363
|
+
* are its public, stable contract; every visual belongs to the consumer CSS,
|
|
1364
|
+
* keyed on them. Three common cues:
|
|
1365
|
+
*
|
|
1366
|
+
* Shadow (Material 2 elevate-on-scroll):
|
|
1367
|
+
*
|
|
1368
|
+
* ```css
|
|
1369
|
+
* .sheet[data-scroll-block-start] .bar { box-shadow: 0 2px 4px -2px rgb(0 0 0 / 0.3); }
|
|
1370
|
+
* ```
|
|
1371
|
+
*
|
|
1372
|
+
* Hairline that appears (iOS scroll-edge appearance; transparent border at rest):
|
|
1373
|
+
*
|
|
1374
|
+
* ```css
|
|
1375
|
+
* .sheet[data-scroll-block-start] .bar { border-block-end-color: var(--cngx-color-border); }
|
|
1376
|
+
* ```
|
|
1377
|
+
*
|
|
1378
|
+
* Tonal surface change (Material 3 top app bar):
|
|
1379
|
+
*
|
|
1380
|
+
* ```css
|
|
1381
|
+
* .sheet[data-scroll-block-start] .bar { background: var(--app-bar-scrolled-surface); }
|
|
1382
|
+
* ```
|
|
1383
|
+
*
|
|
1384
|
+
* Forced colors strips `box-shadow`, so a shadow-only cue disappears there;
|
|
1385
|
+
* prefer a border or pair the shadow with one under `forced-colors: active`.
|
|
1386
|
+
*
|
|
1387
|
+
* ```html
|
|
1388
|
+
* <div class="sheet" cngxScrollEdges #edges="cngxScrollEdges">...</div>
|
|
1389
|
+
* ```
|
|
1390
|
+
*
|
|
1391
|
+
* The edge state is purely visual and is not announced: the hidden content
|
|
1392
|
+
* stays in the DOM and in the reading order, and the scrollport remains
|
|
1393
|
+
* reachable by keyboard scrolling. Make the scrollport focusable (and named)
|
|
1394
|
+
* when it holds no focusable content of its own.
|
|
1395
|
+
*
|
|
1396
|
+
* Upgrade path: the attributes map 1:1 onto CSS
|
|
1397
|
+
* `@container scroll-state(scrollable: block-start)` and its siblings, so the
|
|
1398
|
+
* CSS can swap to native scroll-state queries once they are Baseline.
|
|
1399
|
+
*
|
|
1400
|
+
* @category common/layout
|
|
1401
|
+
* @docsKind primary
|
|
1402
|
+
* @wcag AA
|
|
1403
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/scroll-edges.directive.ts
|
|
1404
|
+
* @since 0.1.0
|
|
1405
|
+
* @relatedTo CngxStickyHeader, CngxScrollSpy, createScrollEdges
|
|
1406
|
+
* <example-url>http://localhost:4200/#/common/layout/scroll-edges/edge-shadows</example-url>
|
|
1407
|
+
*/
|
|
1408
|
+
class CngxScrollEdges {
|
|
1409
|
+
edges = createScrollEdges(inject(ElementRef).nativeElement, inject(DestroyRef), isPlatformBrowser(inject(PLATFORM_ID)) ? inject(DOCUMENT).defaultView : null);
|
|
1410
|
+
/** Content is hidden toward the block-start edge (above). */
|
|
1411
|
+
canScrollBlockStart = this.edges.canScrollBlockStart;
|
|
1412
|
+
/** Content is hidden toward the block-end edge (below). */
|
|
1413
|
+
canScrollBlockEnd = this.edges.canScrollBlockEnd;
|
|
1414
|
+
/** Content is hidden toward the inline-start edge (left in LTR, right in RTL). */
|
|
1415
|
+
canScrollInlineStart = this.edges.canScrollInlineStart;
|
|
1416
|
+
/** Content is hidden toward the inline-end edge (right in LTR, left in RTL). */
|
|
1417
|
+
canScrollInlineEnd = this.edges.canScrollInlineEnd;
|
|
1418
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxScrollEdges, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1419
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxScrollEdges, isStandalone: true, selector: "[cngxScrollEdges]", host: { properties: { "attr.data-scroll-block-start": "canScrollBlockStart() ? '' : null", "attr.data-scroll-block-end": "canScrollBlockEnd() ? '' : null", "attr.data-scroll-inline-start": "canScrollInlineStart() ? '' : null", "attr.data-scroll-inline-end": "canScrollInlineEnd() ? '' : null" } }, exportAs: ["cngxScrollEdges"], ngImport: i0 });
|
|
1420
|
+
}
|
|
1421
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxScrollEdges, decorators: [{
|
|
1422
|
+
type: Directive,
|
|
1423
|
+
args: [{
|
|
1424
|
+
selector: '[cngxScrollEdges]',
|
|
1425
|
+
exportAs: 'cngxScrollEdges',
|
|
1426
|
+
standalone: true,
|
|
1427
|
+
host: {
|
|
1428
|
+
'[attr.data-scroll-block-start]': "canScrollBlockStart() ? '' : null",
|
|
1429
|
+
'[attr.data-scroll-block-end]': "canScrollBlockEnd() ? '' : null",
|
|
1430
|
+
'[attr.data-scroll-inline-start]': "canScrollInlineStart() ? '' : null",
|
|
1431
|
+
'[attr.data-scroll-inline-end]': "canScrollInlineEnd() ? '' : null",
|
|
1432
|
+
},
|
|
1433
|
+
}]
|
|
1434
|
+
}] });
|
|
1435
|
+
|
|
864
1436
|
/**
|
|
865
1437
|
* Headless skeleton loading placeholder.
|
|
866
1438
|
*
|
|
@@ -954,7 +1526,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
954
1526
|
*
|
|
955
1527
|
* The observer is automatically recreated when `root`, `rootMargin`, or
|
|
956
1528
|
* `threshold` inputs change, and disconnected on destroy or when `enabled`
|
|
957
|
-
* is set to `false`.
|
|
1529
|
+
* is set to `false`. When `loading` settles back to `false` the sentinel is
|
|
1530
|
+
* re-observed, so a fetched page that did not push the sentinel out of view
|
|
1531
|
+
* still re-fires `loadMore` instead of stalling the list.
|
|
958
1532
|
*
|
|
959
1533
|
* ### Basic infinite list
|
|
960
1534
|
* ```html
|
|
@@ -1016,6 +1590,7 @@ class CngxInfiniteScroll {
|
|
|
1016
1590
|
el = inject((ElementRef));
|
|
1017
1591
|
doc = inject(DOCUMENT);
|
|
1018
1592
|
lastEmitTime = 0;
|
|
1593
|
+
observer = null;
|
|
1019
1594
|
constructor() {
|
|
1020
1595
|
const win = this.doc.defaultView;
|
|
1021
1596
|
if (!win) {
|
|
@@ -1032,8 +1607,13 @@ class CngxInfiniteScroll {
|
|
|
1032
1607
|
}
|
|
1033
1608
|
const isLoading = () => this.loading();
|
|
1034
1609
|
const resolvedRoot = root ? this.doc.querySelector(root) : null;
|
|
1610
|
+
if (isDevMode() && root && !resolvedRoot) {
|
|
1611
|
+
console.warn(`[cngxInfiniteScroll] root selector "${root}" matched no element - ` +
|
|
1612
|
+
'falling back to the viewport. A late-rendered root needs a re-bind of [root].');
|
|
1613
|
+
}
|
|
1035
1614
|
const observer = new IntersectionObserver((entries) => {
|
|
1036
|
-
|
|
1615
|
+
// batched records arrive oldest-first; only the newest reflects reality
|
|
1616
|
+
const entry = entries[entries.length - 1];
|
|
1037
1617
|
if (!entry.isIntersecting) {
|
|
1038
1618
|
return;
|
|
1039
1619
|
}
|
|
@@ -1048,7 +1628,29 @@ class CngxInfiniteScroll {
|
|
|
1048
1628
|
this.loadMore.emit();
|
|
1049
1629
|
}, { root: resolvedRoot, rootMargin, threshold });
|
|
1050
1630
|
observer.observe(this.el.nativeElement);
|
|
1051
|
-
|
|
1631
|
+
this.observer = observer;
|
|
1632
|
+
onCleanup(() => {
|
|
1633
|
+
observer.disconnect();
|
|
1634
|
+
this.observer = null;
|
|
1635
|
+
});
|
|
1636
|
+
});
|
|
1637
|
+
const loadingTransition = createTransitionTracker(() => this.loading());
|
|
1638
|
+
effect(() => {
|
|
1639
|
+
const loading = loadingTransition.current();
|
|
1640
|
+
const wasLoading = loadingTransition.previous();
|
|
1641
|
+
if (!wasLoading || loading) {
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
// IO reports intersection CHANGES only: when a fetched page does not
|
|
1645
|
+
// push the sentinel out of view there is no new entry after loading
|
|
1646
|
+
// settles, and the list stalls. Re-observing forces a fresh entry;
|
|
1647
|
+
// the debounce window is reset so that entry may emit immediately.
|
|
1648
|
+
untracked(() => {
|
|
1649
|
+
const sentinel = this.el.nativeElement;
|
|
1650
|
+
this.lastEmitTime = 0;
|
|
1651
|
+
this.observer?.unobserve(sentinel);
|
|
1652
|
+
this.observer?.observe(sentinel);
|
|
1653
|
+
});
|
|
1052
1654
|
});
|
|
1053
1655
|
}
|
|
1054
1656
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxInfiniteScroll, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
@@ -1083,7 +1685,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1083
1685
|
* `isSticky()` reports the state the host actually has. A scrollport whose
|
|
1084
1686
|
* height is content-driven never scrolls in the block axis, so a header inside
|
|
1085
1687
|
* it never pins; in dev mode the directive warns once when it resolves against
|
|
1086
|
-
* such a scrollport.
|
|
1688
|
+
* such a scrollport. The observer is recreated when `threshold` changes,
|
|
1689
|
+
* matching the sibling observer directives.
|
|
1087
1690
|
*
|
|
1088
1691
|
* ### Sticky header with shadow
|
|
1089
1692
|
* ```html
|
|
@@ -1115,6 +1718,8 @@ class CngxStickyHeader {
|
|
|
1115
1718
|
isSticky = this.isStickyState.asReadonly();
|
|
1116
1719
|
el = inject((ElementRef));
|
|
1117
1720
|
doc = inject(DOCUMENT);
|
|
1721
|
+
/** Sentinel + scrollport resolved once after render; the observer effect keys on it. */
|
|
1722
|
+
observeSetup = signal(null, ...(ngDevMode ? [{ debugName: "observeSetup" }] : /* istanbul ignore next */ []));
|
|
1118
1723
|
constructor() {
|
|
1119
1724
|
const destroyRef = inject(DestroyRef);
|
|
1120
1725
|
// IntersectionObserver sentinel pattern - host is stuck once the 1px sentinel leaves
|
|
@@ -1126,14 +1731,15 @@ class CngxStickyHeader {
|
|
|
1126
1731
|
// header inside a never-scrolling scrollport would read `isSticky() === true` while
|
|
1127
1732
|
// it visibly scrolls away with its content.
|
|
1128
1733
|
const scrollport = this.resolveScrollParent(host);
|
|
1129
|
-
// A scrollport whose content fits
|
|
1130
|
-
//
|
|
1131
|
-
//
|
|
1132
|
-
//
|
|
1133
|
-
//
|
|
1734
|
+
// A scrollport whose content fits never scrolls in the block axis, so a header
|
|
1735
|
+
// inside it can never pin - `isSticky()` stays false while the whole scrollport
|
|
1736
|
+
// moves. Flag the misconfiguration once, in dev only; a one-shot read here is
|
|
1737
|
+
// exactly what `afterNextRender` is for (no reactive-graph node, unlike a
|
|
1738
|
+
// dep-less effect). The 1px tolerance absorbs sub-pixel layout and browser-zoom
|
|
1739
|
+
// rounding: "cannot meaningfully scroll" instead of exact equality.
|
|
1134
1740
|
if (isDevMode() &&
|
|
1135
1741
|
scrollport &&
|
|
1136
|
-
scrollport.
|
|
1742
|
+
scrollport.scrollHeight - scrollport.clientHeight <= 1) {
|
|
1137
1743
|
console.warn('[cngxStickyHeader] resolves against a scroll container that cannot scroll ' +
|
|
1138
1744
|
'in the block axis (client height equals scroll height), so this header ' +
|
|
1139
1745
|
'will never pin. Give the scrollport a bounded block-size, or drop ' +
|
|
@@ -1147,18 +1753,27 @@ class CngxStickyHeader {
|
|
|
1147
1753
|
sentinel.style.pointerEvents = 'none';
|
|
1148
1754
|
sentinel.setAttribute('aria-hidden', 'true');
|
|
1149
1755
|
host.parentElement?.insertBefore(sentinel, host);
|
|
1756
|
+
this.observeSetup.set({ sentinel, scrollport });
|
|
1757
|
+
destroyRef.onDestroy(() => sentinel.remove());
|
|
1758
|
+
});
|
|
1759
|
+
// Observer creation lives in an effect so a later threshold change
|
|
1760
|
+
// recreates it - the one-shot afterNextRender above only resolves DOM.
|
|
1761
|
+
effect((onCleanup) => {
|
|
1762
|
+
const setup = this.observeSetup();
|
|
1763
|
+
const threshold = this.threshold();
|
|
1764
|
+
if (!setup) {
|
|
1765
|
+
return;
|
|
1766
|
+
}
|
|
1150
1767
|
const observer = new IntersectionObserver((entries) => {
|
|
1151
|
-
|
|
1768
|
+
// batched records arrive oldest-first; only the newest reflects reality
|
|
1769
|
+
const isSticky = !entries[entries.length - 1].isIntersecting;
|
|
1152
1770
|
if (isSticky !== this.isStickyState()) {
|
|
1153
1771
|
this.isStickyState.set(isSticky);
|
|
1154
1772
|
this.stickyChange.emit(isSticky);
|
|
1155
1773
|
}
|
|
1156
|
-
}, { threshold
|
|
1157
|
-
observer.observe(sentinel);
|
|
1158
|
-
|
|
1159
|
-
observer.disconnect();
|
|
1160
|
-
sentinel.remove();
|
|
1161
|
-
});
|
|
1774
|
+
}, { threshold, root: setup.scrollport });
|
|
1775
|
+
observer.observe(setup.sentinel);
|
|
1776
|
+
onCleanup(() => observer.disconnect());
|
|
1162
1777
|
});
|
|
1163
1778
|
}
|
|
1164
1779
|
/**
|
|
@@ -1202,6 +1817,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1202
1817
|
* and reports the one with the highest intersection ratio as the active section.
|
|
1203
1818
|
* Ideal for scroll-based navigation highlighting and reading progress.
|
|
1204
1819
|
*
|
|
1820
|
+
* Section IDs are resolved when the inputs change - sections rendered later
|
|
1821
|
+
* (`@if`/`@defer`) are not picked up automatically; re-bind `[cngxScrollSpy]`
|
|
1822
|
+
* once they exist. In dev mode the directive warns about IDs it cannot find.
|
|
1823
|
+
*
|
|
1205
1824
|
* ### Navigation highlighting
|
|
1206
1825
|
* ```html
|
|
1207
1826
|
* <nav [cngxScrollSpy]="['intro', 'features', 'pricing']"
|
|
@@ -1274,10 +1893,19 @@ class CngxScrollSpy {
|
|
|
1274
1893
|
const elements = ids
|
|
1275
1894
|
.map((id) => this.doc.getElementById(id))
|
|
1276
1895
|
.filter((el) => el !== null);
|
|
1896
|
+
if (isDevMode() && elements.length < ids.length) {
|
|
1897
|
+
const missing = ids.filter((id) => !this.doc.getElementById(id));
|
|
1898
|
+
console.warn(`[cngxScrollSpy] section id(s) not found: ${missing.join(', ')}. ` +
|
|
1899
|
+
'Late-rendered sections are not observed - re-bind [cngxScrollSpy] once they exist.');
|
|
1900
|
+
}
|
|
1277
1901
|
if (elements.length === 0) {
|
|
1278
1902
|
return undefined;
|
|
1279
1903
|
}
|
|
1280
1904
|
const resolvedRoot = rootSelector ? this.doc.querySelector(rootSelector) : null;
|
|
1905
|
+
if (isDevMode() && rootSelector && !resolvedRoot) {
|
|
1906
|
+
console.warn(`[cngxScrollSpy] root selector "${rootSelector}" matched no element - ` +
|
|
1907
|
+
'falling back to the viewport. A late-rendered root needs a re-bind of [root].');
|
|
1908
|
+
}
|
|
1281
1909
|
const observer = new IntersectionObserver((entries) => {
|
|
1282
1910
|
entries.forEach((entry) => this.ratios.set(entry.target.id, entry.intersectionRatio));
|
|
1283
1911
|
const best = Array.from(this.ratios).reduce((acc, [id, ratio]) => ratio >= thresholdValue && ratio > acc.ratio ? { id, ratio } : acc, { id: null, ratio: 0 });
|
|
@@ -1344,23 +1972,27 @@ class CngxTruncate {
|
|
|
1344
1972
|
/** Whether the text content actually exceeds the line limit and is being clamped. */
|
|
1345
1973
|
isClamped = this.isClampedState.asReadonly();
|
|
1346
1974
|
el = inject((ElementRef));
|
|
1347
|
-
|
|
1975
|
+
stopResize = null;
|
|
1348
1976
|
rafHandle = null;
|
|
1349
1977
|
// null strips the host binding - preferred over an empty string for -webkit-line-clamp.
|
|
1350
1978
|
/** @internal */
|
|
1351
|
-
clampValue = () => (this.expanded() ? null : String(this.lines()));
|
|
1979
|
+
clampValue = computed(() => (this.expanded() ? null : String(this.lines())), ...(ngDevMode ? [{ debugName: "clampValue" }] : /* istanbul ignore next */ []));
|
|
1352
1980
|
/** @internal */
|
|
1353
|
-
displayValue = () => (this.expanded() ? null : '-webkit-box');
|
|
1981
|
+
displayValue = computed(() => (this.expanded() ? null : '-webkit-box'), ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
1354
1982
|
/** @internal */
|
|
1355
|
-
orientValue = () => (this.expanded() ? null : 'vertical');
|
|
1983
|
+
orientValue = computed(() => (this.expanded() ? null : 'vertical'), ...(ngDevMode ? [{ debugName: "orientValue" }] : /* istanbul ignore next */ []));
|
|
1356
1984
|
/** @internal */
|
|
1357
|
-
overflowValue = () => (this.expanded() ? null : 'hidden');
|
|
1985
|
+
overflowValue = computed(() => (this.expanded() ? null : 'hidden'), ...(ngDevMode ? [{ debugName: "overflowValue" }] : /* istanbul ignore next */ []));
|
|
1358
1986
|
constructor() {
|
|
1359
1987
|
const destroyRef = inject(DestroyRef);
|
|
1988
|
+
// SSR guard: no window, no measuring - the style bindings above still render.
|
|
1989
|
+
const win = inject(DOCUMENT).defaultView;
|
|
1990
|
+
if (!win) {
|
|
1991
|
+
return;
|
|
1992
|
+
}
|
|
1360
1993
|
afterNextRender(() => {
|
|
1361
1994
|
this.checkClamped();
|
|
1362
|
-
this.
|
|
1363
|
-
this.observer.observe(this.el.nativeElement);
|
|
1995
|
+
this.stopResize = observeResize(win, this.el.nativeElement, 'content-box', () => this.checkClamped());
|
|
1364
1996
|
});
|
|
1365
1997
|
// Re-check after expanded/lines change; RAF ensures styles are applied first.
|
|
1366
1998
|
effect(() => {
|
|
@@ -1370,7 +2002,7 @@ class CngxTruncate {
|
|
|
1370
2002
|
this.rafHandle = requestAnimationFrame(() => this.checkClamped());
|
|
1371
2003
|
});
|
|
1372
2004
|
destroyRef.onDestroy(() => {
|
|
1373
|
-
this.
|
|
2005
|
+
this.stopResize?.();
|
|
1374
2006
|
this.cancelRaf();
|
|
1375
2007
|
});
|
|
1376
2008
|
}
|
|
@@ -1419,7 +2051,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1419
2051
|
* construction. The `<mark>` element has correct native SR semantics (announced
|
|
1420
2052
|
* as "highlighted" in most screen readers).
|
|
1421
2053
|
*
|
|
1422
|
-
*
|
|
2054
|
+
* The original text nodes are kept by reference and re-inserted when the
|
|
2055
|
+
* term changes or the directive is destroyed - Angular bindings targeting
|
|
2056
|
+
* them (interpolations, structural directives) stay live.
|
|
1423
2057
|
*
|
|
1424
2058
|
* ### Search result highlighting
|
|
1425
2059
|
* ```html
|
|
@@ -1454,20 +2088,26 @@ class CngxHighlight {
|
|
|
1454
2088
|
matchCount = this.matchCountState.asReadonly();
|
|
1455
2089
|
el = inject((ElementRef));
|
|
1456
2090
|
doc = inject(DOCUMENT);
|
|
1457
|
-
/**
|
|
1458
|
-
|
|
2091
|
+
/**
|
|
2092
|
+
* The text nodes replaced by the current highlight pass, by reference,
|
|
2093
|
+
* with the nodes standing in for them. Undone before every re-highlight
|
|
2094
|
+
* and on destroy - re-inserting the original references keeps LView
|
|
2095
|
+
* bindings (interpolations) attached to live DOM.
|
|
2096
|
+
*/
|
|
2097
|
+
replacements = [];
|
|
1459
2098
|
initialized = signal(false, ...(ngDevMode ? [{ debugName: "initialized" }] : /* istanbul ignore next */ []));
|
|
1460
2099
|
constructor() {
|
|
1461
|
-
inject(DestroyRef).onDestroy(() => this.
|
|
2100
|
+
inject(DestroyRef).onDestroy(() => this.restoreNodes());
|
|
1462
2101
|
afterNextRender(() => {
|
|
1463
2102
|
this.initialized.set(true);
|
|
1464
2103
|
});
|
|
1465
|
-
//
|
|
2104
|
+
// The highlight pass writes matchCountState - untracked, so the write
|
|
2105
|
+
// cannot re-trigger this effect.
|
|
1466
2106
|
effect(() => {
|
|
1467
2107
|
const term = this.term();
|
|
1468
2108
|
const caseSensitive = this.caseSensitive();
|
|
1469
2109
|
if (this.initialized()) {
|
|
1470
|
-
this.applyHighlight(term, caseSensitive);
|
|
2110
|
+
untracked(() => this.applyHighlight(term, caseSensitive));
|
|
1471
2111
|
}
|
|
1472
2112
|
});
|
|
1473
2113
|
}
|
|
@@ -1477,12 +2117,7 @@ class CngxHighlight {
|
|
|
1477
2117
|
*/
|
|
1478
2118
|
applyHighlight(term, caseSensitive) {
|
|
1479
2119
|
const host = this.el.nativeElement;
|
|
1480
|
-
|
|
1481
|
-
this.originalNodes = Array.from(host.childNodes).map((n) => n.cloneNode(true));
|
|
1482
|
-
}
|
|
1483
|
-
else {
|
|
1484
|
-
this.restoreNodes(host);
|
|
1485
|
-
}
|
|
2120
|
+
this.restoreNodes();
|
|
1486
2121
|
if (!term) {
|
|
1487
2122
|
this.matchCountState.set(0);
|
|
1488
2123
|
return;
|
|
@@ -1520,26 +2155,28 @@ class CngxHighlight {
|
|
|
1520
2155
|
if (lastIndex < text.length) {
|
|
1521
2156
|
fragment.appendChild(this.doc.createTextNode(text.slice(lastIndex)));
|
|
1522
2157
|
}
|
|
2158
|
+
// Capture before replaceChild - inserting a fragment empties it.
|
|
2159
|
+
const inserted = Array.from(fragment.childNodes);
|
|
1523
2160
|
textNode.parentNode.replaceChild(fragment, textNode);
|
|
2161
|
+
this.replacements.push({ original: textNode, inserted });
|
|
1524
2162
|
}
|
|
1525
2163
|
this.matchCountState.set(count);
|
|
1526
2164
|
}
|
|
1527
|
-
/**
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
for (const node of this.originalNodes) {
|
|
1541
|
-
host.appendChild(node.cloneNode(true));
|
|
2165
|
+
/** Puts the original text nodes back and removes the highlight nodes. */
|
|
2166
|
+
restoreNodes() {
|
|
2167
|
+
for (const { original, inserted } of this.replacements) {
|
|
2168
|
+
const parent = inserted[0]?.parentNode;
|
|
2169
|
+
if (!parent) {
|
|
2170
|
+
continue;
|
|
2171
|
+
}
|
|
2172
|
+
parent.insertBefore(original, inserted[0]);
|
|
2173
|
+
for (const node of inserted) {
|
|
2174
|
+
if (node.parentNode === parent) {
|
|
2175
|
+
parent.removeChild(node);
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
1542
2178
|
}
|
|
2179
|
+
this.replacements = [];
|
|
1543
2180
|
}
|
|
1544
2181
|
/** Escapes special regex characters in the search term. */
|
|
1545
2182
|
escapeRegex(str) {
|
|
@@ -1557,6 +2194,86 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1557
2194
|
}]
|
|
1558
2195
|
}], ctorParameters: () => [], propDecorators: { term: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxHighlight", required: false }] }], caseSensitive: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightCaseSensitive", required: false }] }] } });
|
|
1559
2196
|
|
|
2197
|
+
/**
|
|
2198
|
+
* The English layout section: the single source of the layout atoms'
|
|
2199
|
+
* English copy. `CNGX_LAYOUT_I18N` defaults to it.
|
|
2200
|
+
*
|
|
2201
|
+
* @category common/layout/i18n
|
|
2202
|
+
* @since 0.1.0
|
|
2203
|
+
* @relatedTo CNGX_LAYOUT_I18N
|
|
2204
|
+
*/
|
|
2205
|
+
const CNGX_LAYOUT_LANGUAGE_EN = {
|
|
2206
|
+
expandableTextMore: 'Show more',
|
|
2207
|
+
expandableTextLess: 'Show less',
|
|
2208
|
+
};
|
|
2209
|
+
|
|
2210
|
+
/** @internal The English section with the active pack's layout section on top. */
|
|
2211
|
+
const layoutBundleFromPack = createLanguageSection('layout', CNGX_LAYOUT_LANGUAGE_EN);
|
|
2212
|
+
/**
|
|
2213
|
+
* DI token for the layout i18n bundle. `providedIn: 'root'`: the layout
|
|
2214
|
+
* section of the active language pack over the English defaults; the value
|
|
2215
|
+
* is a `Signal`, shared by every reader under one injector.
|
|
2216
|
+
*
|
|
2217
|
+
* @category common/layout/i18n
|
|
2218
|
+
* @wcag AA
|
|
2219
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/i18n/layout-i18n.ts
|
|
2220
|
+
* @since 0.1.0
|
|
2221
|
+
* @relatedTo CngxExpandableText
|
|
2222
|
+
*/
|
|
2223
|
+
const CNGX_LAYOUT_I18N = new InjectionToken('CngxLayoutI18n', {
|
|
2224
|
+
providedIn: 'root',
|
|
2225
|
+
factory: layoutBundleFromPack,
|
|
2226
|
+
});
|
|
2227
|
+
/** @internal */
|
|
2228
|
+
function defineLayoutI18nFeature(fn) {
|
|
2229
|
+
return Object.assign(fn, { _target: 'i18n' });
|
|
2230
|
+
}
|
|
2231
|
+
/**
|
|
2232
|
+
* Override layout labels via a partial bundle - unset keys keep the
|
|
2233
|
+
* language pack's copy, or the English default. Pass a `Signal` of a partial
|
|
2234
|
+
* bundle to switch languages at runtime.
|
|
2235
|
+
*
|
|
2236
|
+
* @category common/layout/i18n
|
|
2237
|
+
* @since 0.1.0
|
|
2238
|
+
*/
|
|
2239
|
+
function withLayoutI18nLabels(overrides) {
|
|
2240
|
+
return defineLayoutI18nFeature((bundle) => createOverrideMerge(bundle, overrides));
|
|
2241
|
+
}
|
|
2242
|
+
/**
|
|
2243
|
+
* Provider for the layout i18n bundle. Returns a plain `Provider`, so it
|
|
2244
|
+
* also scopes a subtree through `viewProviders`. The features apply on top
|
|
2245
|
+
* of the active language pack.
|
|
2246
|
+
*
|
|
2247
|
+
* ```ts
|
|
2248
|
+
* bootstrapApplication(AppComponent, {
|
|
2249
|
+
* providers: [
|
|
2250
|
+
* provideLayoutI18n(
|
|
2251
|
+
* withLayoutI18nLabels({ expandableTextMore: 'Mehr anzeigen', expandableTextLess: 'Weniger anzeigen' }),
|
|
2252
|
+
* ),
|
|
2253
|
+
* ],
|
|
2254
|
+
* });
|
|
2255
|
+
* ```
|
|
2256
|
+
*
|
|
2257
|
+
* @category common/layout/i18n
|
|
2258
|
+
* @since 0.1.0
|
|
2259
|
+
*/
|
|
2260
|
+
function provideLayoutI18n(...features) {
|
|
2261
|
+
return {
|
|
2262
|
+
provide: CNGX_LAYOUT_I18N,
|
|
2263
|
+
useFactory: () => features.reduce((bundle, feat) => feat(bundle), layoutBundleFromPack()),
|
|
2264
|
+
};
|
|
2265
|
+
}
|
|
2266
|
+
/**
|
|
2267
|
+
* Inject the resolved layout i18n bundle signal. Read it inside a
|
|
2268
|
+
* `computed()` or template so a runtime override flip re-derives.
|
|
2269
|
+
*
|
|
2270
|
+
* @category common/layout/i18n
|
|
2271
|
+
* @since 0.1.0
|
|
2272
|
+
*/
|
|
2273
|
+
function injectLayoutI18n() {
|
|
2274
|
+
return inject(CNGX_LAYOUT_I18N);
|
|
2275
|
+
}
|
|
2276
|
+
|
|
1560
2277
|
/**
|
|
1561
2278
|
* Marks a custom toggle template inside `cngx-expandable-text`.
|
|
1562
2279
|
*
|
|
@@ -1577,11 +2294,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1577
2294
|
* @relatedTo CngxExpandableText, CngxTruncate
|
|
1578
2295
|
*/
|
|
1579
2296
|
class CngxExpandableToggle {
|
|
1580
|
-
templateRef;
|
|
1581
|
-
|
|
1582
|
-
this.templateRef = templateRef;
|
|
1583
|
-
}
|
|
1584
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxExpandableToggle, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2297
|
+
templateRef = inject(TemplateRef);
|
|
2298
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxExpandableToggle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1585
2299
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxExpandableToggle, isStandalone: true, selector: "ng-template[cngxExpandableToggle]", ngImport: i0 });
|
|
1586
2300
|
}
|
|
1587
2301
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxExpandableToggle, decorators: [{
|
|
@@ -1590,7 +2304,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1590
2304
|
selector: 'ng-template[cngxExpandableToggle]',
|
|
1591
2305
|
standalone: true,
|
|
1592
2306
|
}]
|
|
1593
|
-
}]
|
|
2307
|
+
}] });
|
|
1594
2308
|
/**
|
|
1595
2309
|
* Molecule wrapping `CngxTruncate` with a built-in expand/collapse toggle.
|
|
1596
2310
|
*
|
|
@@ -1637,24 +2351,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1637
2351
|
* <example-url>http://localhost:4200/#/common/layout/expandable-text/custom-toggle-template</example-url>
|
|
1638
2352
|
*/
|
|
1639
2353
|
class CngxExpandableText {
|
|
2354
|
+
i18n = injectLayoutI18n();
|
|
1640
2355
|
/** Maximum visible lines when collapsed. */
|
|
1641
2356
|
lines = input(3, ...(ngDevMode ? [{ debugName: "lines" }] : /* istanbul ignore next */ []));
|
|
1642
2357
|
/** Whether the text is expanded. Supports two-way `[(expanded)]` binding. */
|
|
1643
2358
|
expanded = model(false, ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
1644
|
-
/**
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
2359
|
+
/**
|
|
2360
|
+
* Label for the "show more" button. Unbound, it follows
|
|
2361
|
+
* `CNGX_LAYOUT_I18N.expandableTextMore`.
|
|
2362
|
+
*/
|
|
2363
|
+
moreLabel = input(undefined, ...(ngDevMode ? [{ debugName: "moreLabel" }] : /* istanbul ignore next */ []));
|
|
2364
|
+
/**
|
|
2365
|
+
* Label for the "show less" button. Unbound, it follows
|
|
2366
|
+
* `CNGX_LAYOUT_I18N.expandableTextLess`.
|
|
2367
|
+
*/
|
|
2368
|
+
lessLabel = input(undefined, ...(ngDevMode ? [{ debugName: "lessLabel" }] : /* istanbul ignore next */ []));
|
|
2369
|
+
resolvedMoreLabel = computed(() => this.moreLabel() ?? this.i18n().expandableTextMore, ...(ngDevMode ? [{ debugName: "resolvedMoreLabel" }] : /* istanbul ignore next */ []));
|
|
2370
|
+
resolvedLessLabel = computed(() => this.lessLabel() ?? this.i18n().expandableTextLess, ...(ngDevMode ? [{ debugName: "resolvedLessLabel" }] : /* istanbul ignore next */ []));
|
|
1648
2371
|
/** Optional custom toggle template projected by the consumer. */
|
|
1649
2372
|
customToggle = contentChild(CngxExpandableToggle, ...(ngDevMode ? [{ debugName: "customToggle" }] : /* istanbul ignore next */ []));
|
|
1650
|
-
/**
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
2373
|
+
/** Stable toggle closure - a fresh closure per context would defeat the equal fn below. */
|
|
2374
|
+
toggleFn = () => this.expanded.set(!this.expanded());
|
|
2375
|
+
/**
|
|
2376
|
+
* Template context for the custom toggle. Structural `equal` fn so
|
|
2377
|
+
* `ngTemplateOutletContext` does not rebind the embedded view on every
|
|
2378
|
+
* CD cycle (same rule as the CngxTag slot contexts).
|
|
2379
|
+
*/
|
|
2380
|
+
toggleContext = computed(() => ({
|
|
2381
|
+
$implicit: this.expanded(),
|
|
2382
|
+
expanded: this.expanded(),
|
|
2383
|
+
toggle: this.toggleFn,
|
|
2384
|
+
}), { ...(ngDevMode ? { debugName: "toggleContext" } : /* istanbul ignore next */ {}), equal: (a, b) => a.expanded === b.expanded });
|
|
1658
2385
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxExpandableText, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1659
2386
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxExpandableText, isStandalone: true, selector: "cngx-expandable-text", inputs: { lines: { classPropertyName: "lines", publicName: "lines", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, moreLabel: { classPropertyName: "moreLabel", publicName: "moreLabel", isSignal: true, isRequired: false, transformFunction: null }, lessLabel: { classPropertyName: "lessLabel", publicName: "lessLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange" }, host: { styleAttribute: "display:block" }, queries: [{ propertyName: "customToggle", first: true, predicate: CngxExpandableToggle, descendants: true, isSignal: true }], exportAs: ["cngxExpandableText"], ngImport: i0, template: `
|
|
1660
2387
|
<div [cngxTruncate]="lines()" [(expanded)]="expanded" #trunc="cngxTruncate">
|
|
@@ -1673,7 +2400,7 @@ class CngxExpandableText {
|
|
|
1673
2400
|
[attr.aria-expanded]="expanded()"
|
|
1674
2401
|
(click)="expanded.set(!expanded())"
|
|
1675
2402
|
>
|
|
1676
|
-
{{ expanded() ?
|
|
2403
|
+
{{ expanded() ? resolvedLessLabel() : resolvedMoreLabel() }}
|
|
1677
2404
|
</button>
|
|
1678
2405
|
}
|
|
1679
2406
|
}
|
|
@@ -1708,7 +2435,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1708
2435
|
[attr.aria-expanded]="expanded()"
|
|
1709
2436
|
(click)="expanded.set(!expanded())"
|
|
1710
2437
|
>
|
|
1711
|
-
{{ expanded() ?
|
|
2438
|
+
{{ expanded() ? resolvedLessLabel() : resolvedMoreLabel() }}
|
|
1712
2439
|
</button>
|
|
1713
2440
|
}
|
|
1714
2441
|
}
|
|
@@ -1724,5 +2451,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1724
2451
|
* Generated bundle index. Do not edit.
|
|
1725
2452
|
*/
|
|
1726
2453
|
|
|
1727
|
-
export { CngxBackdrop, CngxDrawer, CngxDrawerContent, CngxDrawerPanel, CngxExpandableText, CngxExpandableToggle, CngxHighlight, CngxInfiniteScroll, CngxIntersectionObserver, CngxMediaQuery, CngxResizeObserver, CngxScrollLock, CngxScrollSpy, CngxSkeleton, CngxStickyHeader, CngxTruncate, createScrollLock, injectMediaQuery, injectQueryParamSync };
|
|
2454
|
+
export { CNGX_CONTAINER_SIZE, CNGX_LAYOUT_I18N, CNGX_LAYOUT_LANGUAGE_EN, CngxBackdrop, CngxContainer, CngxDrawer, CngxDrawerContent, CngxDrawerPanel, CngxExpandableText, CngxExpandableToggle, CngxHighlight, CngxInfiniteScroll, CngxIntersectionObserver, CngxMediaQuery, CngxResizeObserver, CngxScrollEdges, CngxScrollLock, CngxScrollSpy, CngxSkeleton, CngxStickyHeader, CngxTruncate, createContainerSize, createResizeSignal, createScrollEdges, createScrollLock, injectContainerSize, injectLayoutI18n, injectMediaQuery, injectQueryParamSync, observeResize, provideLayoutI18n, withLayoutI18nLabels };
|
|
1728
2455
|
//# sourceMappingURL=cngx-common-layout.mjs.map
|