@cngx/common 0.1.0-rc.6 → 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/chart/README.md +85 -0
- package/command/README.md +157 -0
- package/data/README.md +33 -1
- package/dialog/README.md +23 -1
- package/fesm2022/cngx-common-a11y.mjs +356 -180
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +84 -42
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +311 -53
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +4360 -1625
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +171 -0
- package/fesm2022/cngx-common-command.mjs.map +1 -0
- package/fesm2022/cngx-common-data.mjs +1556 -616
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +518 -112
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +468 -87
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +2725 -1303
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +943 -164
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +769 -103
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +816 -348
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +2330 -1554
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +1170 -0
- package/fesm2022/cngx-common-timeline.mjs.map +1 -0
- package/fesm2022/cngx-common.mjs +2 -2
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +15 -4
- package/layout/README.md +21 -1
- package/package.json +11 -1
- package/popover/README.md +18 -2
- package/stepper/README.md +7 -5
- package/theming/components/cngx-accordion.css +4 -1
- package/theming/components/cngx-backdrop.css +12 -0
- package/theming/components/cngx-badge.css +22 -0
- package/theming/components/cngx-bottom-sheet.css +14 -2
- package/theming/components/cngx-breadcrumb.css +8 -0
- package/theming/components/cngx-button-toggle.css +73 -5
- package/theming/components/cngx-data-grid.css +234 -1
- package/theming/components/cngx-dialog.css +25 -0
- package/theming/components/cngx-divider.css +12 -0
- package/theming/components/cngx-listbox.css +48 -12
- package/theming/components/cngx-menu.css +91 -15
- package/theming/components/cngx-popover.css +24 -0
- package/theming/components/cngx-recycler-placeholder.css +196 -0
- package/theming/components/cngx-ripple.css +2 -2
- package/theming/components/cngx-slider.css +32 -1
- package/theming/components/cngx-tooltip.css +23 -0
- package/timeline/README.md +155 -0
- package/types/cngx-common-a11y.d.ts +101 -31
- package/types/cngx-common-audio.d.ts +32 -32
- package/types/cngx-common-card.d.ts +211 -20
- package/types/cngx-common-chart.d.ts +1605 -169
- package/types/cngx-common-command.d.ts +190 -0
- package/types/cngx-common-data.d.ts +842 -163
- package/types/cngx-common-dialog.d.ts +372 -28
- package/types/cngx-common-display.d.ts +432 -148
- package/types/cngx-common-interactive.d.ts +1553 -370
- package/types/cngx-common-layout.d.ts +613 -27
- package/types/cngx-common-popover.d.ts +376 -36
- package/types/cngx-common-stepper.d.ts +414 -114
- package/types/cngx-common-tabs.d.ts +597 -72
- package/types/cngx-common-timeline.d.ts +1125 -0
- package/types/cngx-common.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { ElementRef, Signal, WritableSignal, TemplateRef } from '@angular/core';
|
|
2
|
+
import { ElementRef, Signal, WritableSignal, DestroyRef, InjectionToken, TemplateRef, Provider } from '@angular/core';
|
|
3
3
|
import * as i1 from '@cngx/common/a11y';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -8,7 +8,12 @@ import * as i1 from '@cngx/common/a11y';
|
|
|
8
8
|
*
|
|
9
9
|
* When visible, all sibling elements of the host receive the `inert`
|
|
10
10
|
* attribute, preventing focus and interaction behind the backdrop.
|
|
11
|
-
* This is critical for a11y in modal/drawer overlays.
|
|
11
|
+
* This is critical for a11y in modal/drawer overlays. A sibling drawer
|
|
12
|
+
* panel (`.cngx-drawer-panel`) is excluded - it is the surface the
|
|
13
|
+
* backdrop guards, not content behind it. Siblings that already carry
|
|
14
|
+
* `inert` are left alone, so a consumer-set `inert` survives the
|
|
15
|
+
* show/hide cycle. The sibling set is re-queried on every show, so
|
|
16
|
+
* siblings rendered after init are covered too.
|
|
12
17
|
*
|
|
13
18
|
* The directive is purely behavioral - it toggles the
|
|
14
19
|
* `.cngx-backdrop--visible` class and `aria-hidden` attribute. Visual
|
|
@@ -70,7 +75,7 @@ declare class CngxBackdrop {
|
|
|
70
75
|
/** Emitted when the backdrop is clicked (and `closeOnClick` is true). */
|
|
71
76
|
readonly backdropClick: _angular_core.OutputEmitterRef<void>;
|
|
72
77
|
private readonly el;
|
|
73
|
-
private readonly
|
|
78
|
+
private readonly domReady;
|
|
74
79
|
constructor();
|
|
75
80
|
/** @internal */
|
|
76
81
|
protected handleHostClick(): void;
|
|
@@ -136,7 +141,7 @@ declare class CngxDrawer {
|
|
|
136
141
|
readonly openedChange: _angular_core.OutputEmitterRef<boolean>;
|
|
137
142
|
/** Emitted when the drawer closes. Convenience shorthand for close-only listeners. */
|
|
138
143
|
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
139
|
-
/** Opens the drawer. */
|
|
144
|
+
/** Opens the drawer. No-op when already open. */
|
|
140
145
|
open(): void;
|
|
141
146
|
/** Closes the drawer. */
|
|
142
147
|
close(): void;
|
|
@@ -160,10 +165,19 @@ type DrawerMode = 'over' | 'push' | 'side';
|
|
|
160
165
|
* the `[enabled]` and `[autoFocus]` inputs from the template.
|
|
161
166
|
*
|
|
162
167
|
* Optionally closes the drawer when the user clicks outside the panel
|
|
163
|
-
* (`closeOnClickOutside`, default `true`).
|
|
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:
|
|
164
178
|
*
|
|
165
179
|
* ```html
|
|
166
|
-
* <nav [cngxDrawerPanel]="drawer" position="left" mode="over"
|
|
180
|
+
* <nav [cngxDrawerPanel]="drawer" position="left" mode="over" [role]="null"
|
|
167
181
|
* [enabled]="drawer.opened()" [autoFocus]="true">
|
|
168
182
|
* <a href="/home">Home</a>
|
|
169
183
|
* </nav>
|
|
@@ -195,11 +209,19 @@ declare class CngxDrawerPanel {
|
|
|
195
209
|
readonly mode: _angular_core.InputSignal<DrawerMode>;
|
|
196
210
|
/** Whether clicking outside the panel closes the drawer. */
|
|
197
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>;
|
|
198
218
|
/** Whether the drawer is currently open (derived from the drawer ref). In `side` mode, always `true`. */
|
|
199
219
|
readonly isOpen: _angular_core.Signal<boolean>;
|
|
220
|
+
private suppressOutsideClick;
|
|
221
|
+
private restoreTarget;
|
|
200
222
|
constructor();
|
|
201
223
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDrawerPanel, never>;
|
|
202
|
-
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; }; }, {}, never, never, true, [{ directive: typeof i1.CngxFocusTrap; inputs: { "enabled": "enabled"; "autoFocus": "autoFocus"; }; outputs: {}; }]>;
|
|
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: {}; }]>;
|
|
203
225
|
}
|
|
204
226
|
|
|
205
227
|
/**
|
|
@@ -479,6 +501,240 @@ declare class CngxResizeObserver {
|
|
|
479
501
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxResizeObserver, "[cngxResizeObserver]", ["cngxResizeObserver"], { "box": { "alias": "box"; "required": false; "isSignal": true; }; }, { "resize": "resize"; }, never, never, true, never>;
|
|
480
502
|
}
|
|
481
503
|
|
|
504
|
+
/**
|
|
505
|
+
* Structural window surface the resize helpers read: `window`, `globalThis`,
|
|
506
|
+
* or a test double. `ResizeObserver` is optional so SSR and jsdom hosts pass
|
|
507
|
+
* the type and hit the runtime guard instead.
|
|
508
|
+
*
|
|
509
|
+
* @category common/layout/observers
|
|
510
|
+
* @since 0.3.0
|
|
511
|
+
*/
|
|
512
|
+
interface ResizeObserverHost {
|
|
513
|
+
ResizeObserver?: typeof ResizeObserver;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Subscribes `apply` to size changes of `element` on `host`.
|
|
517
|
+
*
|
|
518
|
+
* Re-applies on every observation and returns the teardown that disconnects
|
|
519
|
+
* the observer. On a host without `ResizeObserver` (SSR, jsdom) nothing is
|
|
520
|
+
* wired, `apply` never fires, and the returned teardown is a no-op. Unlike the
|
|
521
|
+
* media-query twin there is no synchronous seed: the first size is whatever the
|
|
522
|
+
* observer reports after the next layout.
|
|
523
|
+
*
|
|
524
|
+
* Reach for this low-level form when the observed element or the box model is
|
|
525
|
+
* reactive and the subscription must follow it (re-wire per `effect` run via
|
|
526
|
+
* `onCleanup`); for a static target, {@link createResizeSignal} owns the
|
|
527
|
+
* teardown via `DestroyRef`.
|
|
528
|
+
*
|
|
529
|
+
* @param host The window-like object to read `ResizeObserver` from.
|
|
530
|
+
* @param element The element to observe.
|
|
531
|
+
* @param box Which box model to report.
|
|
532
|
+
* @param apply Receives the first entry of every observation batch.
|
|
533
|
+
* @returns Teardown that disconnects the observer.
|
|
534
|
+
* @category common/layout/observers
|
|
535
|
+
* @relatedTo createResizeSignal, observeMediaQuery
|
|
536
|
+
* @since 0.1.0
|
|
537
|
+
*/
|
|
538
|
+
declare function observeResize(host: ResizeObserverHost | null | undefined, element: Element, box: ResizeObserverBoxOptions, apply: (entry: ResizeObserverEntry) => void): () => void;
|
|
539
|
+
/**
|
|
540
|
+
* Creates a `Signal<ResizeObserverEntry | null>` that carries the most recent
|
|
541
|
+
* observation of `element`, `null` until the first one arrives.
|
|
542
|
+
*
|
|
543
|
+
* Disconnects when `destroyRef` is destroyed. On a host without
|
|
544
|
+
* `ResizeObserver` (SSR, jsdom) the signal stays `null` and no observer is
|
|
545
|
+
* created, so it never throws off the browser.
|
|
546
|
+
*
|
|
547
|
+
* This is the shared kernel behind `CngxResizeObserver` and
|
|
548
|
+
* `createContainerSize`; consumers that hand-roll a `ResizeObserver` should
|
|
549
|
+
* route through it instead.
|
|
550
|
+
*
|
|
551
|
+
* ```typescript
|
|
552
|
+
* const entry = createResizeSignal(
|
|
553
|
+
* host,
|
|
554
|
+
* 'border-box',
|
|
555
|
+
* inject(DestroyRef),
|
|
556
|
+
* inject(DOCUMENT).defaultView,
|
|
557
|
+
* );
|
|
558
|
+
* const width = computed(() => entry()?.borderBoxSize[0]?.inlineSize ?? 0);
|
|
559
|
+
* ```
|
|
560
|
+
*
|
|
561
|
+
* @param element The element to observe.
|
|
562
|
+
* @param box Which box model to report.
|
|
563
|
+
* @param destroyRef Scope whose destruction disconnects the observer.
|
|
564
|
+
* @param host The window-like object to read `ResizeObserver` from.
|
|
565
|
+
* @returns A readonly signal carrying the latest entry.
|
|
566
|
+
* @category common/layout/observers
|
|
567
|
+
* @relatedTo observeResize, createMediaQuerySignal
|
|
568
|
+
* @since 0.1.0
|
|
569
|
+
*/
|
|
570
|
+
declare function createResizeSignal(element: Element, box: ResizeObserverBoxOptions, destroyRef: DestroyRef, host: ResizeObserverHost | null | undefined): Signal<ResizeObserverEntry | null>;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Reactive read of a query container: its size, and the custom properties its
|
|
574
|
+
* `@container` rules resolved to.
|
|
575
|
+
*
|
|
576
|
+
* @category common/layout/observers
|
|
577
|
+
* @since 0.1.0
|
|
578
|
+
*/
|
|
579
|
+
interface CngxContainerSize {
|
|
580
|
+
/** Border-box inline size in pixels. `0` before the first observation. */
|
|
581
|
+
readonly inlineSize: Signal<number>;
|
|
582
|
+
/** Border-box block size in pixels. `0` before the first observation. */
|
|
583
|
+
readonly blockSize: Signal<number>;
|
|
584
|
+
/** `true` once the first observation has arrived. */
|
|
585
|
+
readonly isReady: Signal<boolean>;
|
|
586
|
+
/**
|
|
587
|
+
* The resolved value of a custom property, re-read on every resize of the
|
|
588
|
+
* container.
|
|
589
|
+
*
|
|
590
|
+
* **The `@container` rule must style a descendant, never the container
|
|
591
|
+
* itself.** A container query resolves against an *ancestor* query container
|
|
592
|
+
* of the element it styles, so a rule whose subject is the container element
|
|
593
|
+
* matches nothing and the property never changes. Pass that descendant as
|
|
594
|
+
* `on`; it defaults to the container host, which is only correct for
|
|
595
|
+
* properties no container query writes.
|
|
596
|
+
*
|
|
597
|
+
* A component that is container and reader at once has no descendant to
|
|
598
|
+
* carry the value. Pass `pseudo` instead: the query container for a
|
|
599
|
+
* pseudo-element is selected from its originating element's *inclusive*
|
|
600
|
+
* ancestors, so `.host::after` resolves against `.host` while a rule on
|
|
601
|
+
* `.host` itself still matches nothing. No sentinel node enters the
|
|
602
|
+
* template.
|
|
603
|
+
*
|
|
604
|
+
* ```css
|
|
605
|
+
* .cngx-thing::after { --cngx-thing-narrow: 0; }
|
|
606
|
+
* @container cngx-thing (max-inline-size: 30rem) {
|
|
607
|
+
* .cngx-thing::after { --cngx-thing-narrow: 1; }
|
|
608
|
+
* }
|
|
609
|
+
* ```
|
|
610
|
+
*
|
|
611
|
+
* Returns the empty string before the first observation and in environments
|
|
612
|
+
* without layout (SSR, jsdom).
|
|
613
|
+
*/
|
|
614
|
+
property(name: string, on?: Element, pseudo?: '::before' | '::after'): Signal<string>;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* The nearest query container declared by {@link CngxContainer}.
|
|
618
|
+
*
|
|
619
|
+
* Deliberately has no root factory: absence is meaningful. A component that
|
|
620
|
+
* needs a container and finds none must say so (a dev-mode warning), not
|
|
621
|
+
* silently observe itself.
|
|
622
|
+
*
|
|
623
|
+
* @category common/layout/observers
|
|
624
|
+
* @since 0.1.0
|
|
625
|
+
*/
|
|
626
|
+
declare const CNGX_CONTAINER_SIZE: InjectionToken<CngxContainerSize>;
|
|
627
|
+
/**
|
|
628
|
+
* Creates a {@link CngxContainerSize} over `element`.
|
|
629
|
+
*
|
|
630
|
+
* Observes the border box, so the reported size matches what an
|
|
631
|
+
* `inline-size` container query measures. The `property()` reads are plain
|
|
632
|
+
* `computed()`s over the same resize signal - the browser has already
|
|
633
|
+
* re-evaluated every container query by the time a `ResizeObserver` callback
|
|
634
|
+
* runs, so the read returns the current value without a second scheduling hop.
|
|
635
|
+
*
|
|
636
|
+
* @param element The container host.
|
|
637
|
+
* @param destroyRef Scope whose destruction disconnects the observer.
|
|
638
|
+
* @param win The window-like object providing `ResizeObserver` and `getComputedStyle`.
|
|
639
|
+
* @category common/layout/observers
|
|
640
|
+
* @relatedTo injectContainerSize, CngxContainer
|
|
641
|
+
* @since 0.1.0
|
|
642
|
+
*/
|
|
643
|
+
declare function createContainerSize(element: Element, destroyRef: DestroyRef, win: (ResizeObserverHost & Pick<Window, 'getComputedStyle'>) | null | undefined): CngxContainerSize;
|
|
644
|
+
/**
|
|
645
|
+
* Reads the nearest query container declared by a `[cngxContainer]` ancestor,
|
|
646
|
+
* or observes `target` (default: the host element) when there is none.
|
|
647
|
+
*
|
|
648
|
+
* Use it where a component must branch structurally on the width it was given
|
|
649
|
+
* - a different template, a focus move, an `aria-modal` flip. Purely visual
|
|
650
|
+
* adaptation needs no TypeScript at all: write a `@container` rule.
|
|
651
|
+
*
|
|
652
|
+
* ```typescript
|
|
653
|
+
* private readonly container = inject(CNGX_CONTAINER_SIZE, { optional: true });
|
|
654
|
+
* private readonly wide = this.container?.property('--cngx-thing-wide', this.host) ?? signal('').asReadonly();
|
|
655
|
+
* readonly mode = computed(() => (this.wide() === '1' ? 'side' : 'over'));
|
|
656
|
+
* ```
|
|
657
|
+
*
|
|
658
|
+
* A component that declares the container in its own stylesheet and reads it
|
|
659
|
+
* itself passes its host explicitly and reads the property off `::after` -
|
|
660
|
+
* there is no descendant to carry the value:
|
|
661
|
+
*
|
|
662
|
+
* ```typescript
|
|
663
|
+
* private readonly host = inject(ElementRef).nativeElement as Element;
|
|
664
|
+
* private readonly container = injectContainerSize(this.host);
|
|
665
|
+
* private readonly narrow = this.container.property('--cngx-thing-narrow', this.host, '::after');
|
|
666
|
+
* ```
|
|
667
|
+
*
|
|
668
|
+
* @param target Element to observe when no ancestor container exists.
|
|
669
|
+
* @category common/layout/observers
|
|
670
|
+
* @relatedTo CngxContainer, injectMediaQuery
|
|
671
|
+
* @since 0.1.0
|
|
672
|
+
*/
|
|
673
|
+
declare function injectContainerSize(target?: ElementRef<Element> | Element): CngxContainerSize;
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Observes a query container and publishes its size to descendants through
|
|
677
|
+
* {@link CNGX_CONTAINER_SIZE}.
|
|
678
|
+
*
|
|
679
|
+
* The directive declares nothing visual. **Both `container-type` and
|
|
680
|
+
* `container-name` belong in the stylesheet**, next to the `@container` rules
|
|
681
|
+
* that use them: the name is API (an unnamed query matches the nearest
|
|
682
|
+
* container of any name, so a consumer wrapping the component in their own
|
|
683
|
+
* container would silently re-target it), and containment is a layout
|
|
684
|
+
* decision a skin must be able to opt out of with a plain CSS rule rather
|
|
685
|
+
* than `!important` against a host style.
|
|
686
|
+
*
|
|
687
|
+
* ```css
|
|
688
|
+
* cngx-thing-layout {
|
|
689
|
+
* container-type: inline-size;
|
|
690
|
+
* container-name: cngx-thing-layout;
|
|
691
|
+
* }
|
|
692
|
+
*
|
|
693
|
+
* cngx-thing-layout > cngx-thing { --cngx-thing-wide: 0; }
|
|
694
|
+
*
|
|
695
|
+
* @container cngx-thing-layout (min-inline-size: 64rem) {
|
|
696
|
+
* cngx-thing-layout > cngx-thing { --cngx-thing-wide: 1; }
|
|
697
|
+
* }
|
|
698
|
+
* ```
|
|
699
|
+
*
|
|
700
|
+
* ```html
|
|
701
|
+
* <div cngxContainer>
|
|
702
|
+
* <app-panel />
|
|
703
|
+
* </div>
|
|
704
|
+
* ```
|
|
705
|
+
*
|
|
706
|
+
* A descendant reads the resolved value with `injectContainerSize()`, so the
|
|
707
|
+
* breakpoint exists exactly once - in CSS. Note that `container-type:
|
|
708
|
+
* inline-size` applies size containment: an element that must shrink-wrap its
|
|
709
|
+
* content (an inline chip, a `width: max-content` bar) must not be a
|
|
710
|
+
* container.
|
|
711
|
+
*
|
|
712
|
+
* @category common/layout
|
|
713
|
+
* @docsKind primary
|
|
714
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/observers/container.directive.ts
|
|
715
|
+
* @since 0.1.0
|
|
716
|
+
* @relatedTo injectContainerSize, CngxResizeObserver, CngxMediaQuery
|
|
717
|
+
* <example-url>http://localhost:4200/#/common/layout/container/css-decides-js-reads</example-url>
|
|
718
|
+
*/
|
|
719
|
+
declare class CngxContainer implements CngxContainerSize {
|
|
720
|
+
private readonly size;
|
|
721
|
+
/** Border-box inline size in pixels. `0` before the first observation. */
|
|
722
|
+
readonly inlineSize: Signal<number>;
|
|
723
|
+
/** Border-box block size in pixels. `0` before the first observation. */
|
|
724
|
+
readonly blockSize: Signal<number>;
|
|
725
|
+
/** `true` once the first observation has arrived. */
|
|
726
|
+
readonly isReady: Signal<boolean>;
|
|
727
|
+
/**
|
|
728
|
+
* The resolved value of a custom property on `on` (default: this host),
|
|
729
|
+
* re-read on every resize. The `@container` rule must style a descendant,
|
|
730
|
+
* or a pseudo-element of the container itself - see
|
|
731
|
+
* {@link CngxContainerSize.property}.
|
|
732
|
+
*/
|
|
733
|
+
property(name: string, on?: Element, pseudo?: '::before' | '::after'): Signal<string>;
|
|
734
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxContainer, never>;
|
|
735
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxContainer, "[cngxContainer]", ["cngxContainer"], {}, {}, never, never, true, never>;
|
|
736
|
+
}
|
|
737
|
+
|
|
482
738
|
/**
|
|
483
739
|
* Prevents scrolling on the document body when enabled.
|
|
484
740
|
*
|
|
@@ -516,6 +772,185 @@ declare class CngxScrollLock {
|
|
|
516
772
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxScrollLock, "[cngxScrollLock]", ["cngxScrollLock"], { "enabled": { "alias": "cngxScrollLock"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
517
773
|
}
|
|
518
774
|
|
|
775
|
+
/**
|
|
776
|
+
* Acquire a ref-counted scroll lock on a document root and get back the
|
|
777
|
+
* matching release function.
|
|
778
|
+
*
|
|
779
|
+
* The first active lock saves the current `overflow` / `scrollbar-gutter`
|
|
780
|
+
* inline styles and sets `overflow: hidden` + `scrollbar-gutter: stable`
|
|
781
|
+
* (no layout shift when the scrollbar disappears). Releasing the last active
|
|
782
|
+
* lock restores the saved values. The returned release function is
|
|
783
|
+
* idempotent - calling it twice cannot over-decrement the count.
|
|
784
|
+
*
|
|
785
|
+
* Shared engine behind `CngxScrollLock` and `CngxDialog`'s modal scroll lock;
|
|
786
|
+
* consumers composing their own overlay primitives can use it directly.
|
|
787
|
+
*
|
|
788
|
+
* ```typescript
|
|
789
|
+
* const release = createScrollLock(document.documentElement);
|
|
790
|
+
* // ... overlay open ...
|
|
791
|
+
* release();
|
|
792
|
+
* ```
|
|
793
|
+
*
|
|
794
|
+
* @param html - The document root (`document.documentElement`) to lock.
|
|
795
|
+
* @returns Release function for this acquisition. Idempotent.
|
|
796
|
+
*
|
|
797
|
+
* @category common/layout
|
|
798
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/scroll-lock-core.ts
|
|
799
|
+
* @since 0.1.0
|
|
800
|
+
* @relatedTo CngxScrollLock, CngxDialog
|
|
801
|
+
*/
|
|
802
|
+
declare function createScrollLock(html: HTMLElement): () => void;
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Reports which edges of a scrollport still hide content and reflects them as
|
|
806
|
+
* host attributes, so an edge shadow or fade appears only while there really
|
|
807
|
+
* is something to scroll to in that direction.
|
|
808
|
+
*
|
|
809
|
+
* Put it on the element that scrolls (`overflow: auto` / `scroll`). The four
|
|
810
|
+
* signals and the four logical host attributes are derived from one read of
|
|
811
|
+
* the scroll metrics per animation frame; the attributes are present (empty
|
|
812
|
+
* value) while true and absent otherwise:
|
|
813
|
+
*
|
|
814
|
+
* - `data-scroll-block-start` / `canScrollBlockStart()` - content hidden above
|
|
815
|
+
* - `data-scroll-block-end` / `canScrollBlockEnd()` - content hidden below
|
|
816
|
+
* - `data-scroll-inline-start` / `canScrollInlineStart()` - hidden toward inline start
|
|
817
|
+
* - `data-scroll-inline-end` / `canScrollInlineEnd()` - hidden toward inline end
|
|
818
|
+
*
|
|
819
|
+
* Inline start / end follow the writing direction: in `dir="rtl"` the start
|
|
820
|
+
* edge is on the right. The direction is derived from the scroll offset
|
|
821
|
+
* itself, so a `dir="rtl"` subtree inside an LTR page reports correctly.
|
|
822
|
+
*
|
|
823
|
+
* The directive paints nothing. The four attributes (present only while true)
|
|
824
|
+
* are its public, stable contract; every visual belongs to the consumer CSS,
|
|
825
|
+
* keyed on them. Three common cues:
|
|
826
|
+
*
|
|
827
|
+
* Shadow (Material 2 elevate-on-scroll):
|
|
828
|
+
*
|
|
829
|
+
* ```css
|
|
830
|
+
* .sheet[data-scroll-block-start] .bar { box-shadow: 0 2px 4px -2px rgb(0 0 0 / 0.3); }
|
|
831
|
+
* ```
|
|
832
|
+
*
|
|
833
|
+
* Hairline that appears (iOS scroll-edge appearance; transparent border at rest):
|
|
834
|
+
*
|
|
835
|
+
* ```css
|
|
836
|
+
* .sheet[data-scroll-block-start] .bar { border-block-end-color: var(--cngx-color-border); }
|
|
837
|
+
* ```
|
|
838
|
+
*
|
|
839
|
+
* Tonal surface change (Material 3 top app bar):
|
|
840
|
+
*
|
|
841
|
+
* ```css
|
|
842
|
+
* .sheet[data-scroll-block-start] .bar { background: var(--app-bar-scrolled-surface); }
|
|
843
|
+
* ```
|
|
844
|
+
*
|
|
845
|
+
* Forced colors strips `box-shadow`, so a shadow-only cue disappears there;
|
|
846
|
+
* prefer a border or pair the shadow with one under `forced-colors: active`.
|
|
847
|
+
*
|
|
848
|
+
* ```html
|
|
849
|
+
* <div class="sheet" cngxScrollEdges #edges="cngxScrollEdges">...</div>
|
|
850
|
+
* ```
|
|
851
|
+
*
|
|
852
|
+
* The edge state is purely visual and is not announced: the hidden content
|
|
853
|
+
* stays in the DOM and in the reading order, and the scrollport remains
|
|
854
|
+
* reachable by keyboard scrolling. Make the scrollport focusable (and named)
|
|
855
|
+
* when it holds no focusable content of its own.
|
|
856
|
+
*
|
|
857
|
+
* Upgrade path: the attributes map 1:1 onto CSS
|
|
858
|
+
* `@container scroll-state(scrollable: block-start)` and its siblings, so the
|
|
859
|
+
* CSS can swap to native scroll-state queries once they are Baseline.
|
|
860
|
+
*
|
|
861
|
+
* @category common/layout
|
|
862
|
+
* @docsKind primary
|
|
863
|
+
* @wcag AA
|
|
864
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/scroll-edges.directive.ts
|
|
865
|
+
* @since 0.1.0
|
|
866
|
+
* @relatedTo CngxStickyHeader, CngxScrollSpy, createScrollEdges
|
|
867
|
+
* <example-url>http://localhost:4200/#/common/layout/scroll-edges/edge-shadows</example-url>
|
|
868
|
+
*/
|
|
869
|
+
declare class CngxScrollEdges {
|
|
870
|
+
private readonly edges;
|
|
871
|
+
/** Content is hidden toward the block-start edge (above). */
|
|
872
|
+
readonly canScrollBlockStart: _angular_core.Signal<boolean>;
|
|
873
|
+
/** Content is hidden toward the block-end edge (below). */
|
|
874
|
+
readonly canScrollBlockEnd: _angular_core.Signal<boolean>;
|
|
875
|
+
/** Content is hidden toward the inline-start edge (left in LTR, right in RTL). */
|
|
876
|
+
readonly canScrollInlineStart: _angular_core.Signal<boolean>;
|
|
877
|
+
/** Content is hidden toward the inline-end edge (right in LTR, left in RTL). */
|
|
878
|
+
readonly canScrollInlineEnd: _angular_core.Signal<boolean>;
|
|
879
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxScrollEdges, never>;
|
|
880
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxScrollEdges, "[cngxScrollEdges]", ["cngxScrollEdges"], {}, {}, never, never, true, never>;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* Structural window surface `createScrollEdges` reads: `window`, `globalThis`,
|
|
885
|
+
* or a test double. Every member is optional so SSR and jsdom hosts pass the
|
|
886
|
+
* type and fall back at runtime: no `ResizeObserver` means no resize
|
|
887
|
+
* tracking, no `MutationObserver` means the child set is captured once, no
|
|
888
|
+
* `requestAnimationFrame` means every trigger reads synchronously.
|
|
889
|
+
*
|
|
890
|
+
* @category common/layout
|
|
891
|
+
* @since 0.1.0
|
|
892
|
+
*/
|
|
893
|
+
interface ScrollEdgesHost extends ResizeObserverHost {
|
|
894
|
+
MutationObserver?: typeof MutationObserver;
|
|
895
|
+
requestAnimationFrame?: (callback: FrameRequestCallback) => number;
|
|
896
|
+
cancelAnimationFrame?: (handle: number) => void;
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Per-edge scroll state of one scrollport. Each signal is `true` while content
|
|
900
|
+
* is hidden toward that edge, i.e. while the user can still scroll toward it.
|
|
901
|
+
*
|
|
902
|
+
* @category common/layout
|
|
903
|
+
* @since 0.1.0
|
|
904
|
+
*/
|
|
905
|
+
interface CngxScrollEdgesState {
|
|
906
|
+
/** Content is hidden above (toward the block-start edge). */
|
|
907
|
+
readonly canScrollBlockStart: Signal<boolean>;
|
|
908
|
+
/** Content is hidden below (toward the block-end edge). */
|
|
909
|
+
readonly canScrollBlockEnd: Signal<boolean>;
|
|
910
|
+
/** Content is hidden toward the inline-start edge (left in LTR, right in RTL). */
|
|
911
|
+
readonly canScrollInlineStart: Signal<boolean>;
|
|
912
|
+
/** Content is hidden toward the inline-end edge (right in LTR, left in RTL). */
|
|
913
|
+
readonly canScrollInlineEnd: Signal<boolean>;
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Tracks which edges of a scrollport still hide content, as four boolean
|
|
917
|
+
* signals.
|
|
918
|
+
*
|
|
919
|
+
* Triggers are a passive `scroll` listener, one `observeResize` per observed
|
|
920
|
+
* element (the scrollport itself plus every direct element child) and a
|
|
921
|
+
* `childList`-only `MutationObserver` that keeps that child set current. All
|
|
922
|
+
* of them only schedule work: the metrics are read once per animation frame
|
|
923
|
+
* however many triggers fired, and the result lands in one snapshot signal
|
|
924
|
+
* with a structural `equal`, so the four projections only notify when an edge
|
|
925
|
+
* actually flips. A distance of 1px or less counts as "at the edge".
|
|
926
|
+
*
|
|
927
|
+
* Only direct children are resize-observed. A long item list should sit inside
|
|
928
|
+
* one content element rather than be N direct children (one observer each);
|
|
929
|
+
* growth deep inside a fixed-size child is picked up on the next scroll.
|
|
930
|
+
*
|
|
931
|
+
* A `null` host (SSR) wires nothing and all four signals stay `false`.
|
|
932
|
+
*
|
|
933
|
+
* ```typescript
|
|
934
|
+
* const edges = createScrollEdges(
|
|
935
|
+
* inject(ElementRef).nativeElement,
|
|
936
|
+
* inject(DestroyRef),
|
|
937
|
+
* inject(DOCUMENT).defaultView,
|
|
938
|
+
* );
|
|
939
|
+
* const showTopShadow = edges.canScrollBlockStart;
|
|
940
|
+
* ```
|
|
941
|
+
*
|
|
942
|
+
* @param element The scrollport to read.
|
|
943
|
+
* @param destroyRef Scope whose destruction removes the listener, disconnects
|
|
944
|
+
* every observer and cancels a pending frame.
|
|
945
|
+
* @param host The window-like object to read the observer and frame APIs from.
|
|
946
|
+
* @returns The four per-edge signals.
|
|
947
|
+
* @category common/layout
|
|
948
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/scroll/scroll-edges-core.ts
|
|
949
|
+
* @since 0.1.0
|
|
950
|
+
* @relatedTo CngxScrollEdges, observeResize
|
|
951
|
+
*/
|
|
952
|
+
declare function createScrollEdges(element: HTMLElement, destroyRef: DestroyRef, host: ScrollEdgesHost | null | undefined): CngxScrollEdgesState;
|
|
953
|
+
|
|
519
954
|
/**
|
|
520
955
|
* Headless skeleton loading placeholder.
|
|
521
956
|
*
|
|
@@ -593,7 +1028,9 @@ declare class CngxSkeleton {
|
|
|
593
1028
|
*
|
|
594
1029
|
* The observer is automatically recreated when `root`, `rootMargin`, or
|
|
595
1030
|
* `threshold` inputs change, and disconnected on destroy or when `enabled`
|
|
596
|
-
* is set to `false`.
|
|
1031
|
+
* is set to `false`. When `loading` settles back to `false` the sentinel is
|
|
1032
|
+
* re-observed, so a fetched page that did not push the sentinel out of view
|
|
1033
|
+
* still re-fires `loadMore` instead of stalling the list.
|
|
597
1034
|
*
|
|
598
1035
|
* ### Basic infinite list
|
|
599
1036
|
* ```html
|
|
@@ -655,6 +1092,7 @@ declare class CngxInfiniteScroll {
|
|
|
655
1092
|
private readonly el;
|
|
656
1093
|
private readonly doc;
|
|
657
1094
|
private lastEmitTime;
|
|
1095
|
+
private observer;
|
|
658
1096
|
constructor();
|
|
659
1097
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxInfiniteScroll, never>;
|
|
660
1098
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxInfiniteScroll, "[cngxInfiniteScroll]", ["cngxInfiniteScroll"], { "threshold": { "alias": "threshold"; "required": false; "isSignal": true; }; "rootMargin": { "alias": "rootMargin"; "required": false; "isSignal": true; }; "root": { "alias": "root"; "required": false; "isSignal": true; }; "enabled": { "alias": "enabled"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "debounceMs": { "alias": "debounceMs"; "required": false; "isSignal": true; }; }, { "loadMore": "loadMore"; }, never, never, true, never>;
|
|
@@ -669,6 +1107,15 @@ declare class CngxInfiniteScroll {
|
|
|
669
1107
|
* meaning the header is now stuck. Toggles a CSS class for shadow,
|
|
670
1108
|
* elevation, or background changes.
|
|
671
1109
|
*
|
|
1110
|
+
* The sentinel is observed against the **nearest scroll-container ancestor**
|
|
1111
|
+
* (the first ancestor whose computed `overflow-y` is not `visible`), not the
|
|
1112
|
+
* page - that is the scrollport `position: sticky` resolves against, so
|
|
1113
|
+
* `isSticky()` reports the state the host actually has. A scrollport whose
|
|
1114
|
+
* height is content-driven never scrolls in the block axis, so a header inside
|
|
1115
|
+
* it never pins; in dev mode the directive warns once when it resolves against
|
|
1116
|
+
* such a scrollport. The observer is recreated when `threshold` changes,
|
|
1117
|
+
* matching the sibling observer directives.
|
|
1118
|
+
*
|
|
672
1119
|
* ### Sticky header with shadow
|
|
673
1120
|
* ```html
|
|
674
1121
|
* <header cngxStickyHeader #sh="cngxStickyHeader"
|
|
@@ -699,7 +1146,18 @@ declare class CngxStickyHeader {
|
|
|
699
1146
|
readonly isSticky: _angular_core.Signal<boolean>;
|
|
700
1147
|
private readonly el;
|
|
701
1148
|
private readonly doc;
|
|
1149
|
+
/** Sentinel + scrollport resolved once after render; the observer effect keys on it. */
|
|
1150
|
+
private readonly observeSetup;
|
|
702
1151
|
constructor();
|
|
1152
|
+
/**
|
|
1153
|
+
* The nearest ancestor that is a scroll container in the block axis - the scrollport
|
|
1154
|
+
* `position: sticky` resolves against. Walks up from the host's parent to the first
|
|
1155
|
+
* ancestor whose computed `overflow-y` is not `visible`; `null` means no such
|
|
1156
|
+
* ancestor, i.e. the header sticks to the viewport. A used `overflow-x` other than
|
|
1157
|
+
* `visible` coerces the computed `overflow-y` to `auto`, so this also catches a
|
|
1158
|
+
* horizontal scroll container (e.g. a data grid that scrolls sideways).
|
|
1159
|
+
*/
|
|
1160
|
+
private resolveScrollParent;
|
|
703
1161
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStickyHeader, never>;
|
|
704
1162
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxStickyHeader, "[cngxStickyHeader]", ["cngxStickyHeader"], { "threshold": { "alias": "threshold"; "required": false; "isSignal": true; }; }, { "stickyChange": "stickyChange"; }, never, never, true, never>;
|
|
705
1163
|
}
|
|
@@ -711,6 +1169,10 @@ declare class CngxStickyHeader {
|
|
|
711
1169
|
* and reports the one with the highest intersection ratio as the active section.
|
|
712
1170
|
* Ideal for scroll-based navigation highlighting and reading progress.
|
|
713
1171
|
*
|
|
1172
|
+
* Section IDs are resolved when the inputs change - sections rendered later
|
|
1173
|
+
* (`@if`/`@defer`) are not picked up automatically; re-bind `[cngxScrollSpy]`
|
|
1174
|
+
* once they exist. In dev mode the directive warns about IDs it cannot find.
|
|
1175
|
+
*
|
|
714
1176
|
* ### Navigation highlighting
|
|
715
1177
|
* ```html
|
|
716
1178
|
* <nav [cngxScrollSpy]="['intro', 'features', 'pricing']"
|
|
@@ -798,16 +1260,16 @@ declare class CngxTruncate {
|
|
|
798
1260
|
/** Whether the text content actually exceeds the line limit and is being clamped. */
|
|
799
1261
|
readonly isClamped: _angular_core.Signal<boolean>;
|
|
800
1262
|
private readonly el;
|
|
801
|
-
private
|
|
1263
|
+
private stopResize;
|
|
802
1264
|
private rafHandle;
|
|
803
1265
|
/** @internal */
|
|
804
|
-
protected clampValue:
|
|
1266
|
+
protected readonly clampValue: _angular_core.Signal<string | null>;
|
|
805
1267
|
/** @internal */
|
|
806
|
-
protected displayValue:
|
|
1268
|
+
protected readonly displayValue: _angular_core.Signal<"-webkit-box" | null>;
|
|
807
1269
|
/** @internal */
|
|
808
|
-
protected orientValue:
|
|
1270
|
+
protected readonly orientValue: _angular_core.Signal<"vertical" | null>;
|
|
809
1271
|
/** @internal */
|
|
810
|
-
protected overflowValue:
|
|
1272
|
+
protected readonly overflowValue: _angular_core.Signal<"hidden" | null>;
|
|
811
1273
|
constructor();
|
|
812
1274
|
private cancelRaf;
|
|
813
1275
|
/**
|
|
@@ -829,7 +1291,9 @@ declare class CngxTruncate {
|
|
|
829
1291
|
* construction. The `<mark>` element has correct native SR semantics (announced
|
|
830
1292
|
* as "highlighted" in most screen readers).
|
|
831
1293
|
*
|
|
832
|
-
*
|
|
1294
|
+
* The original text nodes are kept by reference and re-inserted when the
|
|
1295
|
+
* term changes or the directive is destroyed - Angular bindings targeting
|
|
1296
|
+
* them (interpolations, structural directives) stay live.
|
|
833
1297
|
*
|
|
834
1298
|
* ### Search result highlighting
|
|
835
1299
|
* ```html
|
|
@@ -864,8 +1328,13 @@ declare class CngxHighlight {
|
|
|
864
1328
|
readonly matchCount: _angular_core.Signal<number>;
|
|
865
1329
|
private readonly el;
|
|
866
1330
|
private readonly doc;
|
|
867
|
-
/**
|
|
868
|
-
|
|
1331
|
+
/**
|
|
1332
|
+
* The text nodes replaced by the current highlight pass, by reference,
|
|
1333
|
+
* with the nodes standing in for them. Undone before every re-highlight
|
|
1334
|
+
* and on destroy - re-inserting the original references keeps LView
|
|
1335
|
+
* bindings (interpolations) attached to live DOM.
|
|
1336
|
+
*/
|
|
1337
|
+
private replacements;
|
|
869
1338
|
private readonly initialized;
|
|
870
1339
|
constructor();
|
|
871
1340
|
/**
|
|
@@ -873,8 +1342,7 @@ declare class CngxHighlight {
|
|
|
873
1342
|
* in `<mark>` elements. Updates `matchCountState` with the result count.
|
|
874
1343
|
*/
|
|
875
1344
|
private applyHighlight;
|
|
876
|
-
/**
|
|
877
|
-
private restore;
|
|
1345
|
+
/** Puts the original text nodes back and removes the highlight nodes. */
|
|
878
1346
|
private restoreNodes;
|
|
879
1347
|
/** Escapes special regex characters in the search term. */
|
|
880
1348
|
private escapeRegex;
|
|
@@ -916,7 +1384,6 @@ interface CngxExpandableToggleContext {
|
|
|
916
1384
|
*/
|
|
917
1385
|
declare class CngxExpandableToggle {
|
|
918
1386
|
readonly templateRef: TemplateRef<CngxExpandableToggleContext>;
|
|
919
|
-
constructor(templateRef: TemplateRef<CngxExpandableToggleContext>);
|
|
920
1387
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxExpandableToggle, never>;
|
|
921
1388
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxExpandableToggle, "ng-template[cngxExpandableToggle]", never, {}, {}, never, never, true, never>;
|
|
922
1389
|
}
|
|
@@ -960,26 +1427,145 @@ declare class CngxExpandableToggle {
|
|
|
960
1427
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/text/expandable-text.ts
|
|
961
1428
|
* @since 0.1.0
|
|
962
1429
|
* @relatedTo CngxTruncate, CngxExpandableToggle, CngxHighlight
|
|
1430
|
+
* @slot cngxExpandableToggle Replaces the show-more control; gets the current expanded state.
|
|
963
1431
|
* <example-url>http://localhost:4200/#/common/layout/expandable-text/auto-toggle</example-url>
|
|
964
1432
|
* <example-url>http://localhost:4200/#/common/layout/expandable-text/custom-labels</example-url>
|
|
965
1433
|
* <example-url>http://localhost:4200/#/common/layout/expandable-text/custom-toggle-template</example-url>
|
|
966
1434
|
*/
|
|
967
1435
|
declare class CngxExpandableText {
|
|
1436
|
+
private readonly i18n;
|
|
968
1437
|
/** Maximum visible lines when collapsed. */
|
|
969
1438
|
readonly lines: _angular_core.InputSignal<number>;
|
|
970
1439
|
/** Whether the text is expanded. Supports two-way `[(expanded)]` binding. */
|
|
971
1440
|
readonly expanded: _angular_core.ModelSignal<boolean>;
|
|
972
|
-
/**
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1441
|
+
/**
|
|
1442
|
+
* Label for the "show more" button. Unbound, it follows
|
|
1443
|
+
* `CNGX_LAYOUT_I18N.expandableTextMore`.
|
|
1444
|
+
*/
|
|
1445
|
+
readonly moreLabel: _angular_core.InputSignal<string | undefined>;
|
|
1446
|
+
/**
|
|
1447
|
+
* Label for the "show less" button. Unbound, it follows
|
|
1448
|
+
* `CNGX_LAYOUT_I18N.expandableTextLess`.
|
|
1449
|
+
*/
|
|
1450
|
+
readonly lessLabel: _angular_core.InputSignal<string | undefined>;
|
|
1451
|
+
protected readonly resolvedMoreLabel: _angular_core.Signal<string>;
|
|
1452
|
+
protected readonly resolvedLessLabel: _angular_core.Signal<string>;
|
|
976
1453
|
/** Optional custom toggle template projected by the consumer. */
|
|
977
1454
|
protected readonly customToggle: _angular_core.Signal<CngxExpandableToggle | undefined>;
|
|
978
|
-
/**
|
|
979
|
-
|
|
1455
|
+
/** Stable toggle closure - a fresh closure per context would defeat the equal fn below. */
|
|
1456
|
+
private readonly toggleFn;
|
|
1457
|
+
/**
|
|
1458
|
+
* Template context for the custom toggle. Structural `equal` fn so
|
|
1459
|
+
* `ngTemplateOutletContext` does not rebind the embedded view on every
|
|
1460
|
+
* CD cycle (same rule as the CngxTag slot contexts).
|
|
1461
|
+
*/
|
|
1462
|
+
protected readonly toggleContext: _angular_core.Signal<CngxExpandableToggleContext>;
|
|
980
1463
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxExpandableText, never>;
|
|
981
1464
|
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>;
|
|
982
1465
|
}
|
|
983
1466
|
|
|
984
|
-
|
|
985
|
-
|
|
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
|
+
/**
|
|
1497
|
+
* Layout i18n surface. Library defaults are English; consumers override via
|
|
1498
|
+
* {@link provideLayoutI18n}. Reactive from birth: the token carries a
|
|
1499
|
+
* `Signal`, and {@link withLayoutI18nLabels} accepts a `Signal` of a partial
|
|
1500
|
+
* bundle.
|
|
1501
|
+
*
|
|
1502
|
+
* Both keys are the fallback of the `CngxExpandableText` `moreLabel` /
|
|
1503
|
+
* `lessLabel` inputs, resolved in a `computed()`: a bound input wins, and an
|
|
1504
|
+
* unbound one follows a language switch. The same shape as the layout
|
|
1505
|
+
* section of a language pack, declared once as
|
|
1506
|
+
* {@link CngxLayoutLanguageSection}.
|
|
1507
|
+
*
|
|
1508
|
+
* @category common/layout/i18n
|
|
1509
|
+
* @since 0.1.0
|
|
1510
|
+
*/
|
|
1511
|
+
type CngxLayoutI18n = CngxLayoutLanguageSection;
|
|
1512
|
+
/**
|
|
1513
|
+
* DI token for the layout i18n bundle. `providedIn: 'root'`: the layout
|
|
1514
|
+
* section of the active language pack over the English defaults; the value
|
|
1515
|
+
* is a `Signal`, shared by every reader under one injector.
|
|
1516
|
+
*
|
|
1517
|
+
* @category common/layout/i18n
|
|
1518
|
+
* @wcag AA
|
|
1519
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/layout/i18n/layout-i18n.ts
|
|
1520
|
+
* @since 0.1.0
|
|
1521
|
+
* @relatedTo CngxExpandableText
|
|
1522
|
+
*/
|
|
1523
|
+
declare const CNGX_LAYOUT_I18N: InjectionToken<Signal<CngxLayoutLanguageSection>>;
|
|
1524
|
+
/**
|
|
1525
|
+
* Branded feature-fn for {@link provideLayoutI18n}.
|
|
1526
|
+
*
|
|
1527
|
+
* @category common/layout/i18n
|
|
1528
|
+
* @since 0.1.0
|
|
1529
|
+
*/
|
|
1530
|
+
type CngxLayoutI18nFeature = ((bundle: Signal<CngxLayoutI18n>) => Signal<CngxLayoutI18n>) & {
|
|
1531
|
+
readonly _target: 'i18n';
|
|
1532
|
+
};
|
|
1533
|
+
/**
|
|
1534
|
+
* Override layout labels via a partial bundle - unset keys keep the
|
|
1535
|
+
* language pack's copy, or the English default. Pass a `Signal` of a partial
|
|
1536
|
+
* bundle to switch languages at runtime.
|
|
1537
|
+
*
|
|
1538
|
+
* @category common/layout/i18n
|
|
1539
|
+
* @since 0.1.0
|
|
1540
|
+
*/
|
|
1541
|
+
declare function withLayoutI18nLabels(overrides: Partial<CngxLayoutI18n> | Signal<Partial<CngxLayoutI18n>>): CngxLayoutI18nFeature;
|
|
1542
|
+
/**
|
|
1543
|
+
* Provider for the layout i18n bundle. Returns a plain `Provider`, so it
|
|
1544
|
+
* also scopes a subtree through `viewProviders`. The features apply on top
|
|
1545
|
+
* of the active language pack.
|
|
1546
|
+
*
|
|
1547
|
+
* ```ts
|
|
1548
|
+
* bootstrapApplication(AppComponent, {
|
|
1549
|
+
* providers: [
|
|
1550
|
+
* provideLayoutI18n(
|
|
1551
|
+
* withLayoutI18nLabels({ expandableTextMore: 'Mehr anzeigen', expandableTextLess: 'Weniger anzeigen' }),
|
|
1552
|
+
* ),
|
|
1553
|
+
* ],
|
|
1554
|
+
* });
|
|
1555
|
+
* ```
|
|
1556
|
+
*
|
|
1557
|
+
* @category common/layout/i18n
|
|
1558
|
+
* @since 0.1.0
|
|
1559
|
+
*/
|
|
1560
|
+
declare function provideLayoutI18n(...features: readonly CngxLayoutI18nFeature[]): Provider;
|
|
1561
|
+
/**
|
|
1562
|
+
* Inject the resolved layout i18n bundle signal. Read it inside a
|
|
1563
|
+
* `computed()` or template so a runtime override flip re-derives.
|
|
1564
|
+
*
|
|
1565
|
+
* @category common/layout/i18n
|
|
1566
|
+
* @since 0.1.0
|
|
1567
|
+
*/
|
|
1568
|
+
declare function injectLayoutI18n(): Signal<CngxLayoutI18n>;
|
|
1569
|
+
|
|
1570
|
+
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 };
|
|
1571
|
+
export type { CngxContainerSize, CngxExpandableToggleContext, CngxLayoutI18n, CngxLayoutI18nFeature, CngxLayoutLanguageSection, CngxScrollEdgesState, DrawerMode, DrawerPosition, QueryParamSyncOptions, ResizeObserverHost, ScrollEdgesHost };
|