@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,10 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Signal, InjectionToken, ModelSignal, TemplateRef, OnInit, EnvironmentProviders, Provider, Injector } from '@angular/core';
|
|
2
|
+
import { Signal, InjectionToken, ModelSignal, TemplateRef, OnInit, AfterContentInit, EnvironmentProviders, Provider, Injector } from '@angular/core';
|
|
3
3
|
import { CngxAsyncState, StatusTransition } from '@cngx/core/utils';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
import { CngxErrorAggregatorContract } from '@cngx/common/interactive';
|
|
6
|
-
import { Router } from '@angular/router';
|
|
6
|
+
import { Router, ActivatedRoute } from '@angular/router';
|
|
7
|
+
import { CngxMessage } from '@cngx/core/i18n';
|
|
7
8
|
import { CngxCommitController } from '@cngx/common/data';
|
|
9
|
+
import { CngxDirection } from '@cngx/core';
|
|
8
10
|
import { CngxActiveDescendant, ActiveDescendantItem } from '@cngx/common/a11y';
|
|
9
11
|
import { CngxPopover } from '@cngx/common/popover';
|
|
10
12
|
|
|
@@ -113,7 +115,13 @@ interface CngxTabGroupHost {
|
|
|
113
115
|
*/
|
|
114
116
|
readonly originIndexDuringCommit: Signal<number | undefined>;
|
|
115
117
|
register(handle: CngxTabHandle): void;
|
|
116
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Remove a registration. Pass the registering `handle` so a destroyed
|
|
120
|
+
* instance can only evict itself: under an id collision the presenter's
|
|
121
|
+
* idempotent re-register replaces the stored handle, and the OLD
|
|
122
|
+
* instance's late destroy must not tear down the NEW instance's entry.
|
|
123
|
+
*/
|
|
124
|
+
unregister(id: string, handle?: CngxTabHandle): void;
|
|
117
125
|
select(index: number): void;
|
|
118
126
|
selectNext(): void;
|
|
119
127
|
selectPrevious(): void;
|
|
@@ -184,9 +192,20 @@ type CngxTabsCommitAction = (fromIndex: number, toIndex: number) => boolean | Pr
|
|
|
184
192
|
* <example-url>http://localhost:4200/#/ui/tabs/tab-commit-action/optimistic-pessimistic-commits-with-bridge-directives</example-url>
|
|
185
193
|
*/
|
|
186
194
|
declare class CngxTabGroupPresenter implements CngxTabGroupHost {
|
|
195
|
+
private readonly config;
|
|
187
196
|
readonly activeIndex: i0.ModelSignal<number>;
|
|
188
|
-
|
|
189
|
-
|
|
197
|
+
/**
|
|
198
|
+
* @internal Two-field alias - bind the public `[orientation]`; read
|
|
199
|
+
* the resolved {@link orientation} computed (input ?? config ?? default).
|
|
200
|
+
*/
|
|
201
|
+
readonly orientationInput: i0.InputSignal<"horizontal" | "vertical" | undefined>;
|
|
202
|
+
readonly orientation: Signal<"horizontal" | "vertical">;
|
|
203
|
+
/**
|
|
204
|
+
* @internal Two-field alias - bind the public `[loop]`; read the
|
|
205
|
+
* resolved {@link loop} computed (input ?? config ?? default).
|
|
206
|
+
*/
|
|
207
|
+
readonly loopInput: i0.InputSignal<boolean | undefined>;
|
|
208
|
+
readonly loop: Signal<boolean>;
|
|
190
209
|
/**
|
|
191
210
|
* Async-commit action gating the transition.
|
|
192
211
|
* When non-null, `select(...)` routes through {@link CngxTabsCommitHandler}; the
|
|
@@ -206,9 +225,9 @@ declare class CngxTabGroupPresenter implements CngxTabGroupHost {
|
|
|
206
225
|
*
|
|
207
226
|
* @internal Two-field alias - bind the public `[commitMode]`; read
|
|
208
227
|
* the resolved {@link commitMode} computed (DI fallback mode wins
|
|
209
|
-
* when a routed action is active).
|
|
228
|
+
* when a routed action is active, else input ?? config ?? default).
|
|
210
229
|
*/
|
|
211
|
-
readonly commitModeInput: i0.InputSignal<"optimistic" | "pessimistic">;
|
|
230
|
+
readonly commitModeInput: i0.InputSignal<"optimistic" | "pessimistic" | undefined>;
|
|
212
231
|
private readonly injector;
|
|
213
232
|
private injectedActionSource;
|
|
214
233
|
private resolveInjectedAction;
|
|
@@ -228,7 +247,7 @@ declare class CngxTabGroupPresenter implements CngxTabGroupHost {
|
|
|
228
247
|
readonly commitMode: Signal<"optimistic" | "pessimistic">;
|
|
229
248
|
/**
|
|
230
249
|
* Emitted when a tab's close affordance is activated (the close
|
|
231
|
-
* button or Delete
|
|
250
|
+
* button or Delete on the focused tab). The presenter has
|
|
232
251
|
* already moved the active index onto the surviving neighbour; the
|
|
233
252
|
* consumer removes the tab from its own data in the handler.
|
|
234
253
|
*/
|
|
@@ -268,7 +287,7 @@ declare class CngxTabGroupPresenter implements CngxTabGroupHost {
|
|
|
268
287
|
private readonly clampedIndex;
|
|
269
288
|
readonly activeId: Signal<string | null>;
|
|
270
289
|
register(handle: CngxTabHandle): void;
|
|
271
|
-
unregister(id: string): void;
|
|
290
|
+
unregister(id: string, handle?: CngxTabHandle): void;
|
|
272
291
|
/** {@inheritDoc CngxTabGroupHost.clearLastFailed} */
|
|
273
292
|
clearLastFailed(): void;
|
|
274
293
|
select(index: number): void;
|
|
@@ -278,7 +297,7 @@ declare class CngxTabGroupPresenter implements CngxTabGroupHost {
|
|
|
278
297
|
requestClose(id: string): void;
|
|
279
298
|
requestAdd(): void;
|
|
280
299
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabGroupPresenter, never>;
|
|
281
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabGroupPresenter, "[cngxTabGroup]", ["cngxTabGroup"], { "activeIndex": { "alias": "activeIndex"; "required": false; "isSignal": true; }; "
|
|
300
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabGroupPresenter, "[cngxTabGroup]", ["cngxTabGroup"], { "activeIndex": { "alias": "activeIndex"; "required": false; "isSignal": true; }; "orientationInput": { "alias": "orientation"; "required": false; "isSignal": true; }; "loopInput": { "alias": "loop"; "required": false; "isSignal": true; }; "commitActionInput": { "alias": "commitAction"; "required": false; "isSignal": true; }; "commitModeInput": { "alias": "commitMode"; "required": false; "isSignal": true; }; }, { "activeIndex": "activeIndexChange"; "tabClose": "tabClose"; "tabAdd": "tabAdd"; }, never, never, true, never>;
|
|
282
301
|
}
|
|
283
302
|
|
|
284
303
|
/**
|
|
@@ -316,6 +335,122 @@ interface CngxTabPanelHost {
|
|
|
316
335
|
*/
|
|
317
336
|
declare const CNGX_TAB_PANEL_HOST: InjectionToken<CngxTabPanelHost>;
|
|
318
337
|
|
|
338
|
+
/**
|
|
339
|
+
* Marks a tab presenter as the **navigation** flavour rather than the
|
|
340
|
+
* tablist flavour. \
|
|
341
|
+
* Provided by `<cngx-tab-nav>` (`@cngx/ui/tabs`) and `[cngxMatTabNav]`
|
|
342
|
+
* (`@cngx/ui/mat-tabs`); deliberately not provided by `<cngx-tab-group>`.
|
|
343
|
+
*
|
|
344
|
+
* Presence-only by design. There is no contract interface: providers
|
|
345
|
+
* register `{ provide: CNGX_TAB_NAV_HOST, useValue: true }` and readers
|
|
346
|
+
* only ever test `navHost != null`. Nothing here can be widened into a
|
|
347
|
+
* second host contract - {@link CNGX_TAB_GROUP_HOST} already owns the
|
|
348
|
+
* presenter surface, and this token sits beside it so the tablist path
|
|
349
|
+
* gains no dead field.
|
|
350
|
+
*
|
|
351
|
+
* **Why a token and not the host class.** A sub-directive talks to its
|
|
352
|
+
* host through DI, never through a concrete class: importing `CngxTabNav`
|
|
353
|
+
* from `@cngx/common` would be a `common -> ui` edge that Sheriff rejects,
|
|
354
|
+
* and element-tag sniffing breaks the moment a decomposed skin renames the
|
|
355
|
+
* element.
|
|
356
|
+
*
|
|
357
|
+
* **What reads it.** {@link CngxTabsRouteSync} injects it
|
|
358
|
+
* `{ optional: true, host: true }` to pick its URL-matching semantics: a
|
|
359
|
+
* nav link owns a whole subtree and stays current for every URL beneath it
|
|
360
|
+
* (prefix), while a tablist tab is a leaf and matches only its own route
|
|
361
|
+
* (suffix). The `[match]` input overrides the token-derived default when a
|
|
362
|
+
* consumer needs the other mode.
|
|
363
|
+
*
|
|
364
|
+
* ```ts
|
|
365
|
+
* @Component({
|
|
366
|
+
* selector: 'my-section-nav',
|
|
367
|
+
* providers: [{ provide: CNGX_TAB_NAV_HOST, useValue: true }],
|
|
368
|
+
* hostDirectives: [CngxTabGroupPresenter],
|
|
369
|
+
* })
|
|
370
|
+
* export class MySectionNav {}
|
|
371
|
+
* ```
|
|
372
|
+
*
|
|
373
|
+
* @category common/tabs
|
|
374
|
+
* @wcag AA
|
|
375
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab-nav-host.token.ts
|
|
376
|
+
* @since 0.1.0
|
|
377
|
+
* @relatedTo CngxTabsRouteSync, CNGX_TAB_GROUP_HOST, CngxTabNav, CngxMatTabNav
|
|
378
|
+
*/
|
|
379
|
+
declare const CNGX_TAB_NAV_HOST: InjectionToken<true>;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* How a tab's route is compared against the current URL.
|
|
383
|
+
*
|
|
384
|
+
* - `'suffix'` - the tab owns the trailing segment(s), the leaf semantics
|
|
385
|
+
* a `role="tablist"` implies.
|
|
386
|
+
* - `'prefix'` - the tab owns a subtree, the section semantics a
|
|
387
|
+
* `role="navigation"` of links implies.
|
|
388
|
+
*
|
|
389
|
+
* @category common/tabs
|
|
390
|
+
*/
|
|
391
|
+
type CngxTabMatchMode = 'suffix' | 'prefix';
|
|
392
|
+
/**
|
|
393
|
+
* Everything {@link CngxTabUrlMatch} needs to resolve the active tab.
|
|
394
|
+
* Passed in rather than injected, so the strategy stays a pure function
|
|
395
|
+
* of its inputs and needs no injection context.
|
|
396
|
+
*
|
|
397
|
+
* @category common/tabs
|
|
398
|
+
*/
|
|
399
|
+
interface CngxTabUrlMatchContext {
|
|
400
|
+
readonly router: Router;
|
|
401
|
+
/** The sync directive's mount point. `null` outside a routed tree. */
|
|
402
|
+
readonly activatedRoute: ActivatedRoute | null;
|
|
403
|
+
/** Registered tabs, in registration order. */
|
|
404
|
+
readonly tabs: readonly CngxTabHandle[];
|
|
405
|
+
/** The directive's `routeFor`, already resolved. */
|
|
406
|
+
readonly routeFor: (handle: CngxTabHandle) => unknown[];
|
|
407
|
+
/** Effective mode after the input / config / host-flavour cascade. */
|
|
408
|
+
readonly mode: CngxTabMatchMode;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Resolves which registered tab the current URL belongs to.
|
|
412
|
+
*
|
|
413
|
+
* @category common/tabs
|
|
414
|
+
*/
|
|
415
|
+
interface CngxTabUrlMatch {
|
|
416
|
+
/** Active tab id, or `null` when the URL is outside this tab set. */
|
|
417
|
+
resolve(ctx: CngxTabUrlMatchContext): string | null;
|
|
418
|
+
}
|
|
419
|
+
/** Factory shape overrides must match. @category common/tabs */
|
|
420
|
+
type CngxTabUrlMatchFactory = () => CngxTabUrlMatch;
|
|
421
|
+
/**
|
|
422
|
+
* The two URL-matching policies `[cngxTabsRouteSync]` ships, dispatched
|
|
423
|
+
* on {@link CngxTabUrlMatchContext.mode}. Same exact-versus-prefix
|
|
424
|
+
* distinction `routerLinkActive` draws.
|
|
425
|
+
*
|
|
426
|
+
* Pure: no injection context, no signal reads. The directive resolves the
|
|
427
|
+
* mode cascade and the tab registry, then hands both in.
|
|
428
|
+
*
|
|
429
|
+
* @category common/tabs
|
|
430
|
+
*/
|
|
431
|
+
declare function createTabUrlMatch(): CngxTabUrlMatch;
|
|
432
|
+
/**
|
|
433
|
+
* Swap point for how a routed tab set decides which tab the URL belongs
|
|
434
|
+
* to. Default {@link createTabUrlMatch}.
|
|
435
|
+
*
|
|
436
|
+
* Override when neither shipped policy fits: locale-segment-insensitive
|
|
437
|
+
* comparison (`/de/rounds` and `/en/rounds` are the same tab), matching
|
|
438
|
+
* on a route `data` key instead of the path, or a permission-aware read
|
|
439
|
+
* that skips tabs the user cannot open. `routeFor` only changes what a
|
|
440
|
+
* tab's route *is*; this changes how it is *compared*.
|
|
441
|
+
*
|
|
442
|
+
* Mirrors {@link CNGX_TABS_COMMIT_ACTION} on the write side: the
|
|
443
|
+
* navigation a tab switch performs is already swappable, so the read that
|
|
444
|
+
* mirrors navigation back onto `activeIndex` should be too.
|
|
445
|
+
*
|
|
446
|
+
* @category common/tabs
|
|
447
|
+
* @wcag AA
|
|
448
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/url-match.ts
|
|
449
|
+
* @since 0.1.0
|
|
450
|
+
* @relatedTo CngxTabsRouteSync, createTabUrlMatch, createTabRouterCommit
|
|
451
|
+
*/
|
|
452
|
+
declare const CNGX_TAB_URL_MATCH_STRATEGY: InjectionToken<CngxTabUrlMatch>;
|
|
453
|
+
|
|
319
454
|
/**
|
|
320
455
|
* Structural slot directive marking the per-tab panel-body template. \
|
|
321
456
|
* Discovered by `<cngx-tab-group>` via `contentChild` on each
|
|
@@ -421,6 +556,9 @@ declare class CngxTabSubLabel {
|
|
|
421
556
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab.directive.ts
|
|
422
557
|
* @since 0.1.0
|
|
423
558
|
* @relatedTo CngxTabGroupPresenter, CngxTabLabel, CngxTabContent, CngxTabErrorBadge
|
|
559
|
+
* @slot cngxTabLabel The tab's own header label.
|
|
560
|
+
* @slot cngxTabSubLabel Secondary line under the label, e.g. a count or status.
|
|
561
|
+
* @slot cngxTabContent The panel body, rendered lazily when the tab activates.
|
|
424
562
|
*/
|
|
425
563
|
declare class CngxTab implements OnInit {
|
|
426
564
|
readonly id: i0.InputSignal<string>;
|
|
@@ -517,6 +655,7 @@ declare class CngxTab implements OnInit {
|
|
|
517
655
|
*/
|
|
518
656
|
declare class CngxTabLink implements OnInit {
|
|
519
657
|
private readonly host;
|
|
658
|
+
private readonly config;
|
|
520
659
|
private readonly destroyRef;
|
|
521
660
|
private readonly renderer;
|
|
522
661
|
private readonly hostEl;
|
|
@@ -549,12 +688,35 @@ declare class CngxTabLink implements OnInit {
|
|
|
549
688
|
* silent until revealed). Mirrors `CngxTab.hasError`.
|
|
550
689
|
*/
|
|
551
690
|
protected readonly hasError: Signal<boolean>;
|
|
691
|
+
/**
|
|
692
|
+
* Which `aria-current` token the link publishes while it is active.
|
|
693
|
+
* Cascade: this input -> `CngxTabsConfig.linkAriaCurrent`
|
|
694
|
+
* ({@link withTabsLinkAriaCurrent}) -> `'page'`.
|
|
695
|
+
*
|
|
696
|
+
* Use `'true'` when the link owns a *subtree* and stays active for URLs
|
|
697
|
+
* beneath it - a section nav driven by `[cngxTabsRouteSync]` in its
|
|
698
|
+
* prefix mode. WAI-ARIA reserves `page` for the current page itself, so
|
|
699
|
+
* `page` on an ancestor section over-claims: AT reads "current page" for
|
|
700
|
+
* something that is not the page being viewed. A whole nav switches at
|
|
701
|
+
* once via `provideTabsConfigAt(withTabsLinkAriaCurrent('true'))`; this
|
|
702
|
+
* input is the per-link escape hatch.
|
|
703
|
+
*
|
|
704
|
+
* Not derived from the sync directive's match mode on purpose. `selected`
|
|
705
|
+
* has exactly one source, the presenter's `activeId` (Pillar 1); reading
|
|
706
|
+
* a sibling directive's mode here would fork that derivation and couple
|
|
707
|
+
* the atom to a directive it does not otherwise know about.
|
|
708
|
+
*/
|
|
709
|
+
readonly ariaCurrent: i0.InputSignal<"page" | "true" | "location" | "step" | undefined>;
|
|
710
|
+
/** Resolved token: input -> config -> `'page'`. */
|
|
711
|
+
protected readonly resolvedAriaCurrent: Signal<'page' | 'true' | 'location' | 'step'>;
|
|
552
712
|
/** `true` when the presenter's `activeId` equals this link's id. */
|
|
553
713
|
protected readonly selected: Signal<boolean>;
|
|
554
714
|
/**
|
|
555
|
-
* Id of the injected SR error-message descriptor.
|
|
556
|
-
*
|
|
557
|
-
*
|
|
715
|
+
* Id of the injected SR error-message descriptor. The `aria-describedby`
|
|
716
|
+
* host binding emits it only while `hasError()` - `aria-hidden` on a
|
|
717
|
+
* directly-referenced node does not suppress it (accname 1.2 traverses
|
|
718
|
+
* the reference), so the id reference itself is gated, not just the
|
|
719
|
+
* span's visibility.
|
|
558
720
|
*/
|
|
559
721
|
protected readonly descriptorId: Signal<string>;
|
|
560
722
|
/** The injected descriptor `<span>`, created in {@link ngOnInit}. */
|
|
@@ -569,7 +731,7 @@ declare class CngxTabLink implements OnInit {
|
|
|
569
731
|
*/
|
|
570
732
|
private syncDescriptor;
|
|
571
733
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabLink, never>;
|
|
572
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabLink, "[cngxTabLink]", ["cngxTabLink"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "errorAggregator": { "alias": "errorAggregator"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
734
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabLink, "[cngxTabLink]", ["cngxTabLink"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "errorAggregator": { "alias": "errorAggregator"; "required": false; "isSignal": true; }; "ariaCurrent": { "alias": "ariaCurrent"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
573
735
|
}
|
|
574
736
|
|
|
575
737
|
/**
|
|
@@ -580,6 +742,11 @@ declare class CngxTabLink implements OnInit {
|
|
|
580
742
|
* - `mode = 'fragment'` (default) → `#tab=settings`
|
|
581
743
|
* - `mode = 'queryParam'` with `paramName = 'tab'` → `?tab=settings`
|
|
582
744
|
*
|
|
745
|
+
* Reflecting the active tab replaces the current history entry by
|
|
746
|
+
* default, so browser-back leaves the page instead of stepping through
|
|
747
|
+
* the tabs opened on the way. Set `[replaceUrl]="false"` when the tabs
|
|
748
|
+
* read as distinct destinations.
|
|
749
|
+
*
|
|
583
750
|
* `Router` is optional - without it the directive logs a dev warning
|
|
584
751
|
* via `afterNextRender` and becomes a no-op. \
|
|
585
752
|
* Every `router.navigate` and `host.selectById` inside the effects sits in `untracked()`.
|
|
@@ -605,16 +772,67 @@ declare class CngxTabLink implements OnInit {
|
|
|
605
772
|
* @since 0.1.0
|
|
606
773
|
* @relatedTo CngxTabGroupPresenter, CngxTab
|
|
607
774
|
*/
|
|
608
|
-
declare class CngxTabsFragmentSync {
|
|
609
|
-
readonly
|
|
610
|
-
readonly
|
|
775
|
+
declare class CngxTabsFragmentSync implements AfterContentInit {
|
|
776
|
+
readonly modeInput: i0.InputSignal<"fragment" | "queryParam" | undefined>;
|
|
777
|
+
readonly paramNameInput: i0.InputSignal<string | undefined>;
|
|
778
|
+
private readonly config;
|
|
779
|
+
readonly mode: i0.Signal<"fragment" | "queryParam">;
|
|
780
|
+
readonly paramName: i0.Signal<string>;
|
|
781
|
+
/**
|
|
782
|
+
* Whether reflecting the active tab into the URL replaces the current
|
|
783
|
+
* history entry instead of pushing a new one. Default `true`, which is
|
|
784
|
+
* right for a view toggle: browser-back leaves the page rather than
|
|
785
|
+
* stepping through the tabs the user opened on the way.
|
|
786
|
+
*
|
|
787
|
+
* Set `false` when the tabs read as distinct destinations and back
|
|
788
|
+
* should step between them. Note that every tab switch then costs a
|
|
789
|
+
* history entry.
|
|
790
|
+
*/
|
|
791
|
+
readonly replaceUrl: i0.InputSignal<boolean>;
|
|
611
792
|
private readonly host;
|
|
612
793
|
private readonly router;
|
|
794
|
+
/**
|
|
795
|
+
* Latched once the URL seed has reached a registered tab, so the
|
|
796
|
+
* `afterNextRender` fallback cannot run it twice.
|
|
797
|
+
*
|
|
798
|
+
* Not symmetric with {@link CngxTabsRouteSync}, and it has to be: that
|
|
799
|
+
* sibling writes `activeIndex` directly, so its second seed bails on
|
|
800
|
+
* the already-matching id. This one goes through `select()`, and under
|
|
801
|
+
* a pessimistic commit `activeIndex` still holds the *previous* value
|
|
802
|
+
* while the action is in flight - so the presenter's `target ===
|
|
803
|
+
* previous` bail does not catch the repeat, and a consumer's async
|
|
804
|
+
* commit action would fire a second time and supersede the first.
|
|
805
|
+
*/
|
|
806
|
+
private seeded;
|
|
613
807
|
constructor();
|
|
808
|
+
/**
|
|
809
|
+
* Seed from the URL before the group renders its panels. `CngxTab`
|
|
810
|
+
* registers in `ngOnInit`, so the registry is populated by the time
|
|
811
|
+
* this runs, and the group's own view has not rendered yet - which is
|
|
812
|
+
* what keeps `panelMode="lazy"` from counting the default tab's first
|
|
813
|
+
* render as its first activation on a deep link.
|
|
814
|
+
*
|
|
815
|
+
* Unlike {@link CngxTabsRouteSync}, this seed goes through
|
|
816
|
+
* `selectById`, so it runs `select()` and any consumer-bound
|
|
817
|
+
* commit-action. Moving it earlier therefore also moves when that
|
|
818
|
+
* action first fires; it still fires exactly once for the seed.
|
|
819
|
+
*
|
|
820
|
+
* Its own router guard: the constructor's early return does not stop
|
|
821
|
+
* lifecycle hooks from running.
|
|
822
|
+
*/
|
|
823
|
+
ngAfterContentInit(): void;
|
|
824
|
+
private seedFromUrl;
|
|
825
|
+
/**
|
|
826
|
+
* Reflect `id` into the URL. Fragment mode re-serializes the existing
|
|
827
|
+
* fragment params so foreign state (`#foo=1&tab=x`) survives the
|
|
828
|
+
* write; values are URI-encoded symmetric to {@link parseFragment}.
|
|
829
|
+
*/
|
|
830
|
+
private writeUrl;
|
|
831
|
+
private serializeFragment;
|
|
614
832
|
private readUrlValue;
|
|
615
833
|
private parseFragment;
|
|
616
834
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabsFragmentSync, never>;
|
|
617
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabsFragmentSync, "[cngxTabsFragmentSync]", ["cngxTabsFragmentSync"], { "
|
|
835
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabsFragmentSync, "[cngxTabsFragmentSync]", ["cngxTabsFragmentSync"], { "modeInput": { "alias": "mode"; "required": false; "isSignal": true; }; "paramNameInput": { "alias": "paramName"; "required": false; "isSignal": true; }; "replaceUrl": { "alias": "replaceUrl"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
618
836
|
}
|
|
619
837
|
|
|
620
838
|
/**
|
|
@@ -672,11 +890,24 @@ declare const CNGX_TABS_COMMIT_ACTION: InjectionToken<CngxTabsCommitActionSource
|
|
|
672
890
|
* keeps the old tab. The routing gate reuses the presenter's commit
|
|
673
891
|
* lifecycle verbatim; the router navigation is the async op.
|
|
674
892
|
*
|
|
675
|
-
* Seeds the active tab from the current URL
|
|
893
|
+
* Seeds the active tab from the current URL at content-init - before
|
|
894
|
+
* the group renders its panels, so a deep link under
|
|
895
|
+
* `panelMode="lazy"` mounts only the target panel - and reflects
|
|
676
896
|
* external navigations (back/forward, direct URL) into `activeIndex`
|
|
677
897
|
* *without* re-navigating - those writes bypass the commit-action,
|
|
678
898
|
* since the router is already at the resolved route.
|
|
679
899
|
*
|
|
900
|
+
* **Two URL-matching modes, defaulted from the host flavour.** On a
|
|
901
|
+
* `<cngx-tab-group>` tablist each tab is a *leaf* route, so the default
|
|
902
|
+
* is `'suffix'`: a tab owns the trailing segment(s) of the URL and
|
|
903
|
+
* nothing else. On a `<cngx-tab-nav>` (or `[cngxMatTabNav]`) each link is
|
|
904
|
+
* an application *section* that owns a whole subtree, so the default
|
|
905
|
+
* flips to `'prefix'` and the section stays current for every URL beneath
|
|
906
|
+
* it - the non-exact flavour of `routerLinkActive`. The flavour is read
|
|
907
|
+
* from the {@link CNGX_TAB_NAV_HOST} marker the nav organisms provide, so
|
|
908
|
+
* neither default needs a consumer flag; `[match]` overrides both for the
|
|
909
|
+
* mixed case.
|
|
910
|
+
*
|
|
680
911
|
* `Router` is optional - without it the directive logs a single dev
|
|
681
912
|
* warning via `afterNextRender`, exposes a null action, and becomes a
|
|
682
913
|
* no-op. Mirrors {@link CngxTabsFragmentSync}; every `activeIndex`
|
|
@@ -746,15 +977,41 @@ declare const CNGX_TABS_COMMIT_ACTION: InjectionToken<CngxTabsCommitActionSource
|
|
|
746
977
|
* @since 0.1.0
|
|
747
978
|
* @relatedTo CngxTabGroupPresenter, CngxTabsFragmentSync, createTabRouterCommit, CngxTabNav, CngxTabLink
|
|
748
979
|
*/
|
|
749
|
-
declare class CngxTabsRouteSync implements CngxTabsCommitActionSource {
|
|
980
|
+
declare class CngxTabsRouteSync implements CngxTabsCommitActionSource, AfterContentInit {
|
|
750
981
|
/**
|
|
751
982
|
* Maps a tab handle to its router command array. Default
|
|
752
983
|
* `(handle) => [handle.id]` - the tab id is the child segment.
|
|
753
984
|
* Override for real route paths.
|
|
754
985
|
*/
|
|
755
986
|
readonly routeFor: i0.InputSignal<(handle: CngxTabHandle) => unknown[]>;
|
|
987
|
+
/**
|
|
988
|
+
* How a tab's route is matched against the current URL.
|
|
989
|
+
*
|
|
990
|
+
* - `'suffix'` - the tab owns the trailing segment(s). A leaf tab in a
|
|
991
|
+
* tablist: `/settings/billing` activates the `billing` tab, and
|
|
992
|
+
* `/billing/invoices/42` activates nothing.
|
|
993
|
+
* - `'prefix'` - the tab owns a subtree. A section link in a nav:
|
|
994
|
+
* `/rounds/explorer` activates the `rounds` link. Matching is a
|
|
995
|
+
* `UrlTree` subset test anchored at the host's own `ActivatedRoute`,
|
|
996
|
+
* so a nav mounted under a base path still resolves. When several
|
|
997
|
+
* tabs match, the one with the most path segments wins.
|
|
998
|
+
*
|
|
999
|
+
* Cascade: this input -> `CngxTabsConfig.routeMatch`
|
|
1000
|
+
* ({@link withTabsRouteMatch}) -> the host flavour, which is `'prefix'`
|
|
1001
|
+
* when {@link CNGX_TAB_NAV_HOST} is present and `'suffix'` otherwise.
|
|
1002
|
+
*
|
|
1003
|
+
* This picks *which* policy runs. {@link CNGX_TAB_URL_MATCH_STRATEGY}
|
|
1004
|
+
* replaces the policies themselves.
|
|
1005
|
+
*/
|
|
1006
|
+
readonly match: i0.InputSignal<CngxTabMatchMode | undefined>;
|
|
756
1007
|
private readonly host;
|
|
757
1008
|
private readonly router;
|
|
1009
|
+
private readonly navHost;
|
|
1010
|
+
private readonly config;
|
|
1011
|
+
private readonly urlMatch;
|
|
1012
|
+
/** Resolved match mode: input -> config -> host flavour. */
|
|
1013
|
+
private readonly effectiveMatch;
|
|
1014
|
+
private readonly activatedRoute;
|
|
758
1015
|
/**
|
|
759
1016
|
* Pessimistic-only - not exposed as an input. The route-sync owns the
|
|
760
1017
|
* mode so optimistic (show-then-revert) can never flash the target
|
|
@@ -769,6 +1026,17 @@ declare class CngxTabsRouteSync implements CngxTabsCommitActionSource {
|
|
|
769
1026
|
*/
|
|
770
1027
|
readonly action: Signal<CngxTabsCommitAction | null>;
|
|
771
1028
|
constructor();
|
|
1029
|
+
/**
|
|
1030
|
+
* Seed from the URL before the group renders its panels. `CngxTab`
|
|
1031
|
+
* registers in `ngOnInit`, so the registry is populated by the time
|
|
1032
|
+
* this runs, and the group's own view has not rendered yet - which is
|
|
1033
|
+
* what keeps `panelMode="lazy"` from counting the default tab's first
|
|
1034
|
+
* render as its first activation on a deep link.
|
|
1035
|
+
*
|
|
1036
|
+
* Its own router guard: the constructor's early return does not stop
|
|
1037
|
+
* lifecycle hooks from running.
|
|
1038
|
+
*/
|
|
1039
|
+
ngAfterContentInit(): void;
|
|
772
1040
|
/**
|
|
773
1041
|
* Mirror the URL's active tab onto `activeIndex` without navigating.
|
|
774
1042
|
* Writing the index directly (not via `select()`) is the re-entry
|
|
@@ -778,17 +1046,13 @@ declare class CngxTabsRouteSync implements CngxTabsCommitActionSource {
|
|
|
778
1046
|
*/
|
|
779
1047
|
private reflectFromUrl;
|
|
780
1048
|
/**
|
|
781
|
-
*
|
|
782
|
-
*
|
|
783
|
-
*
|
|
784
|
-
* unrelated parent segment cannot win. The path is taken before any
|
|
785
|
-
* query/fragment. If two tabs produce the same trailing segment(s)
|
|
786
|
-
* (only possible with a custom `routeFor` that collides), the first
|
|
787
|
-
* registered tab wins - the default id-based mapping never collides.
|
|
1049
|
+
* Resolve the active tab id through the swappable match strategy.
|
|
1050
|
+
* The directive owns the mode cascade (input -> config -> host
|
|
1051
|
+
* flavour); the strategy owns the comparison.
|
|
788
1052
|
*/
|
|
789
1053
|
private readActiveId;
|
|
790
1054
|
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabsRouteSync, never>;
|
|
791
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabsRouteSync, "[cngxTabsRouteSync]", ["cngxTabsRouteSync"], { "routeFor": { "alias": "routeFor"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1055
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabsRouteSync, "[cngxTabsRouteSync]", ["cngxTabsRouteSync"], { "routeFor": { "alias": "routeFor"; "required": false; "isSignal": true; }; "match": { "alias": "match"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
792
1056
|
}
|
|
793
1057
|
|
|
794
1058
|
/**
|
|
@@ -814,19 +1078,22 @@ interface CngxTabRouterCommitOptions {
|
|
|
814
1078
|
/**
|
|
815
1079
|
* Builds a {@link CngxTabsCommitAction} that gates a tab switch through
|
|
816
1080
|
* `@angular/router`. The action navigates to the target tab's route and
|
|
817
|
-
* resolves on
|
|
1081
|
+
* resolves on this navigation's own `navigate()` promise:
|
|
818
1082
|
*
|
|
819
|
-
* - `NavigationEnd` → `true` (commit the switch)
|
|
820
|
-
* - `NavigationCancel`
|
|
821
|
-
*
|
|
1083
|
+
* - resolved `true` (`NavigationEnd`) → `true` (commit the switch)
|
|
1084
|
+
* - resolved `false` (`NavigationCancel` - a `CanDeactivate` guard
|
|
1085
|
+
* blocked, or a newer navigation superseded this one) → `false`
|
|
1086
|
+
* - rejected (`NavigationError` - guard/resolver threw) → `false`
|
|
822
1087
|
*
|
|
823
1088
|
* Routed tabs reuse the presenter's commit lifecycle verbatim - the
|
|
824
1089
|
* router navigation is simply the async op. \
|
|
825
1090
|
* In pessimistic mode the active tab follows the *resolved* route, so a cancelled guard keeps
|
|
826
|
-
* the old tab with zero extra gate machinery.
|
|
827
|
-
*
|
|
828
|
-
* navigation
|
|
829
|
-
* controller's `cancel()`
|
|
1091
|
+
* the old tab with zero extra gate machinery. Correlating on the
|
|
1092
|
+
* promise (not `router.events`) means a concurrent unrelated
|
|
1093
|
+
* navigation's outcome can never resolve this commit; the commit
|
|
1094
|
+
* controller's `cancel()` closes the subscriber on supersede, and a
|
|
1095
|
+
* late promise resolution lands on the closed subscriber and is
|
|
1096
|
+
* dropped by RxJS itself.
|
|
830
1097
|
*
|
|
831
1098
|
* @category common/tabs
|
|
832
1099
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/router-commit.ts
|
|
@@ -836,7 +1103,7 @@ declare function createTabRouterCommit(opts: CngxTabRouterCommitOptions): CngxTa
|
|
|
836
1103
|
|
|
837
1104
|
/**
|
|
838
1105
|
* Context for the `*cngxTabOverflowItem` template. Replaces the
|
|
839
|
-
* default
|
|
1106
|
+
* default text (the tab label, or `unlabeledTab(position)`) inside the More popover; the
|
|
840
1107
|
* surrounding `<li role="menuitem">` shell (`aria-disabled`, click
|
|
841
1108
|
* handler, `data-tab-id`) stays library-owned.
|
|
842
1109
|
*
|
|
@@ -1006,9 +1273,10 @@ declare class CngxTabCloseIcon {
|
|
|
1006
1273
|
}
|
|
1007
1274
|
|
|
1008
1275
|
/**
|
|
1009
|
-
* Context for the `*cngxTabErrorBadge` template. Renders only
|
|
1010
|
-
* the tab's `
|
|
1011
|
-
*
|
|
1276
|
+
* Context for the `*cngxTabErrorBadge` template. Renders only while
|
|
1277
|
+
* the tab's folded `hasError()` is `true` - the direct `[error]` flag
|
|
1278
|
+
* OR the aggregator's `shouldShow()`; the visibility gate stays
|
|
1279
|
+
* library-owned. Sibling shape to `CngxStepBadgeContext`.
|
|
1012
1280
|
*
|
|
1013
1281
|
* @category common/tabs/slots
|
|
1014
1282
|
*/
|
|
@@ -1254,6 +1522,13 @@ type CngxTabIconLayout = 'start' | 'end' | 'top' | 'only';
|
|
|
1254
1522
|
* is activated and keeps it (keep-alive). `'lazy-destroy'` renders only
|
|
1255
1523
|
* the active panel's content and destroys it on leave.
|
|
1256
1524
|
*
|
|
1525
|
+
* A `[cngxTabsRouteSync]` / `[cngxTabsFragmentSync]` deep link resolves
|
|
1526
|
+
* its tab at content-init, before the first panel render, so under
|
|
1527
|
+
* `'lazy'` only the target panel's content ever mounts - the default tab
|
|
1528
|
+
* is never activated on the way. Without that ordering the first render
|
|
1529
|
+
* would count as tab 0's first activation and keep-alive would hold its
|
|
1530
|
+
* content for the rest of the session.
|
|
1531
|
+
*
|
|
1257
1532
|
* @category common/tabs
|
|
1258
1533
|
*/
|
|
1259
1534
|
type CngxTabsPanelMode = 'eager' | 'lazy' | 'lazy-destroy';
|
|
@@ -1313,6 +1588,25 @@ interface CngxTabsConfig {
|
|
|
1313
1588
|
* Override via {@link withTabsFragmentSync}.
|
|
1314
1589
|
*/
|
|
1315
1590
|
readonly fragmentSyncParam?: string;
|
|
1591
|
+
/**
|
|
1592
|
+
* App-wide default URL-matching mode for
|
|
1593
|
+
* {@link CngxTabsRouteSync}: `'suffix'` treats a tab as a leaf route,
|
|
1594
|
+
* `'prefix'` treats it as a section that owns a subtree. Per-instance
|
|
1595
|
+
* `[match]` still wins. Unset (the default) lets each host pick from
|
|
1596
|
+
* its own flavour - `'prefix'` on a nav, `'suffix'` on a tablist -
|
|
1597
|
+
* which is almost always what you want; set this only to force one
|
|
1598
|
+
* mode app-wide. Override via {@link withTabsRouteMatch}.
|
|
1599
|
+
*/
|
|
1600
|
+
readonly routeMatch?: 'suffix' | 'prefix';
|
|
1601
|
+
/**
|
|
1602
|
+
* App-wide `aria-current` token {@link CngxTabLink} publishes while
|
|
1603
|
+
* active. Default `'page'`. Set `'true'` when the links are sections
|
|
1604
|
+
* that stay active for URLs beneath them, which is the shape
|
|
1605
|
+
* `routeMatch: 'prefix'` implies - `page` would then claim the link is
|
|
1606
|
+
* the page being viewed. Per-link `[ariaCurrent]` still wins. Override
|
|
1607
|
+
* via {@link withTabsLinkAriaCurrent}.
|
|
1608
|
+
*/
|
|
1609
|
+
readonly linkAriaCurrent?: 'page' | 'true' | 'location' | 'step';
|
|
1316
1610
|
/**
|
|
1317
1611
|
* App-wide default visual skin. \
|
|
1318
1612
|
* Default `'line'`. Per-instance
|
|
@@ -1361,8 +1655,10 @@ interface CngxTabsConfig {
|
|
|
1361
1655
|
* {@link withTabsAddable}.
|
|
1362
1656
|
*/
|
|
1363
1657
|
readonly addable?: boolean;
|
|
1364
|
-
|
|
1365
|
-
readonly
|
|
1658
|
+
/** Landmark labels; a `Signal` switches the language at runtime. */
|
|
1659
|
+
readonly ariaLabels?: CngxTabsAriaLabels | Signal<CngxTabsAriaLabels>;
|
|
1660
|
+
/** Role descriptions; a `Signal` switches the language at runtime. */
|
|
1661
|
+
readonly fallbackLabels?: CngxTabsFallbackLabels | Signal<CngxTabsFallbackLabels>;
|
|
1366
1662
|
/**
|
|
1367
1663
|
* Quiescence window (ms) for the overflow IO debounce. Burst
|
|
1368
1664
|
* emissions during strip animations collapse to one write; the
|
|
@@ -1450,6 +1746,36 @@ declare function withTabsCommitMode(mode: 'optimistic' | 'pessimistic'): CngxTab
|
|
|
1450
1746
|
* @category common/tabs
|
|
1451
1747
|
*/
|
|
1452
1748
|
declare function withTabsFragmentSync(mode: 'fragment' | 'queryParam', param?: string): CngxTabsConfigFeature;
|
|
1749
|
+
/**
|
|
1750
|
+
* Force one URL-matching mode app-wide for `[cngxTabsRouteSync]`. \
|
|
1751
|
+
* `'suffix'` treats every tab as a leaf route, `'prefix'` as a section
|
|
1752
|
+
* that stays active for URLs beneath it.
|
|
1753
|
+
*
|
|
1754
|
+
* Reach for this only when the host-flavour default is wrong for your
|
|
1755
|
+
* app. Unset, a `<cngx-tab-nav>` matches by prefix and a
|
|
1756
|
+
* `<cngx-tab-group>` by suffix, which is what each markup implies; this
|
|
1757
|
+
* feature overrides *both*. Per-instance `[match]` still wins.
|
|
1758
|
+
*
|
|
1759
|
+
* Changes which policy runs, not the policies themselves - swap those via
|
|
1760
|
+
* {@link CNGX_TAB_URL_MATCH_STRATEGY}.
|
|
1761
|
+
*
|
|
1762
|
+
* @category common/tabs
|
|
1763
|
+
*/
|
|
1764
|
+
declare function withTabsRouteMatch(mode: 'suffix' | 'prefix'): CngxTabsConfigFeature;
|
|
1765
|
+
/**
|
|
1766
|
+
* Set the `aria-current` token `[cngxTabLink]` publishes while active. \
|
|
1767
|
+
* Default `'page'`.
|
|
1768
|
+
*
|
|
1769
|
+
* Use `'true'` for a section nav whose links stay active across a whole
|
|
1770
|
+
* subtree: the active link is then the current *section*, and `page`
|
|
1771
|
+
* would tell AT it is the page being viewed. Scope it to one nav with
|
|
1772
|
+
* `provideTabsConfigAt` in that component's `viewProviders` rather than
|
|
1773
|
+
* setting it app-wide, unless every nav in the app is section-shaped.
|
|
1774
|
+
* Per-link `[ariaCurrent]` still wins.
|
|
1775
|
+
*
|
|
1776
|
+
* @category common/tabs
|
|
1777
|
+
*/
|
|
1778
|
+
declare function withTabsLinkAriaCurrent(token: 'page' | 'true' | 'location' | 'step'): CngxTabsConfigFeature;
|
|
1453
1779
|
/**
|
|
1454
1780
|
* @deprecated Use {@link withTabsFragmentSync}. "Router sync" collided
|
|
1455
1781
|
* with the new `[cngxTabsRouteSync]` router-outlet directive; this
|
|
@@ -1486,6 +1812,9 @@ declare function withTabsIconLayout(layout: CngxTabIconLayout): CngxTabsConfigFe
|
|
|
1486
1812
|
* `[panelMode]` Input still wins. The panel `<div>` always stays in the
|
|
1487
1813
|
* DOM regardless of mode (the `aria-controls` target).
|
|
1488
1814
|
*
|
|
1815
|
+
* Under `'lazy'`, a deep link mounts only the panel it names: both sync
|
|
1816
|
+
* directives seed the active tab before the first panel render.
|
|
1817
|
+
*
|
|
1489
1818
|
* @category common/tabs
|
|
1490
1819
|
*/
|
|
1491
1820
|
declare function withTabsPanelMode(mode: CngxTabsPanelMode): CngxTabsConfigFeature;
|
|
@@ -1525,17 +1854,19 @@ declare function withTabsAddable(addable: boolean): CngxTabsConfigFeature;
|
|
|
1525
1854
|
/**
|
|
1526
1855
|
* Merge ARIA labels into the cascade. Keys not provided keep their
|
|
1527
1856
|
* library defaults; per-instance overrides on the tab group still win.
|
|
1857
|
+
* Pass a `Signal` to switch the language at runtime.
|
|
1528
1858
|
*
|
|
1529
1859
|
* @category common/tabs
|
|
1530
1860
|
*/
|
|
1531
|
-
declare function withTabsAriaLabels(labels: CngxTabsAriaLabels): CngxTabsConfigFeature;
|
|
1861
|
+
declare function withTabsAriaLabels(labels: CngxTabsAriaLabels | Signal<CngxTabsAriaLabels>): CngxTabsConfigFeature;
|
|
1532
1862
|
/**
|
|
1533
|
-
* Merge
|
|
1534
|
-
*
|
|
1863
|
+
* Merge the tablist / tab-panel `aria-roledescription` fallbacks into the
|
|
1864
|
+
* cascade. Keys not provided keep their library defaults. Pass a `Signal`
|
|
1865
|
+
* to switch the language at runtime.
|
|
1535
1866
|
*
|
|
1536
1867
|
* @category common/tabs
|
|
1537
1868
|
*/
|
|
1538
|
-
declare function withTabsFallbackLabels(labels: CngxTabsFallbackLabels): CngxTabsConfigFeature;
|
|
1869
|
+
declare function withTabsFallbackLabels(labels: CngxTabsFallbackLabels | Signal<CngxTabsFallbackLabels>): CngxTabsConfigFeature;
|
|
1539
1870
|
/**
|
|
1540
1871
|
* Override the IO-debounce window (ms). See
|
|
1541
1872
|
* {@link CngxTabsConfig.overflowStabilizeMs}.
|
|
@@ -1695,6 +2026,68 @@ interface CngxTabsHostAttrs {
|
|
|
1695
2026
|
*/
|
|
1696
2027
|
declare function createTabsHostAttrs(inputs: CngxTabsHostAttrsInputs): CngxTabsHostAttrs;
|
|
1697
2028
|
|
|
2029
|
+
/**
|
|
2030
|
+
* The tabs section of a {@link CngxLanguagePack}: the copy of
|
|
2031
|
+
* `@cngx/common/tabs` and of the tab organisms in `@cngx/ui/tabs` and
|
|
2032
|
+
* `@cngx/ui/mat-tabs`. It feeds `CNGX_TABS_I18N` and the copy keys of
|
|
2033
|
+
* `CNGX_TABS_CONFIG` (`ariaLabels`, `fallbackLabels`). Messages use `{name}`
|
|
2034
|
+
* placeholders; a plural message picks its form from `{count}`.
|
|
2035
|
+
*
|
|
2036
|
+
* @category common/tabs/i18n
|
|
2037
|
+
* @since 0.1.0
|
|
2038
|
+
* @relatedTo CNGX_TABS_I18N, CNGX_TABS_CONFIG
|
|
2039
|
+
*/
|
|
2040
|
+
interface CngxTabsLanguageSection {
|
|
2041
|
+
/** Accessible name of the tab-group landmark. */
|
|
2042
|
+
readonly tabsRegion: string;
|
|
2043
|
+
/** Last-tier tab-group label, used when `tabsRegion` is unset. */
|
|
2044
|
+
readonly tabsLabel: string;
|
|
2045
|
+
/** `aria-roledescription` of the tablist. */
|
|
2046
|
+
readonly tabRoleDescription: string;
|
|
2047
|
+
/** `aria-roledescription` of each tab panel. */
|
|
2048
|
+
readonly tabPanelRoleDescription: string;
|
|
2049
|
+
/** `{label}`, `{position}`, `{count}`: the accessible name of a tab. */
|
|
2050
|
+
readonly selectedTab: CngxMessage;
|
|
2051
|
+
/** `{label}`, `{detail}`: a tab label with its secondary label. */
|
|
2052
|
+
readonly tabLabelWithDetail: CngxMessage;
|
|
2053
|
+
/** Plural on `{count}`: the number of errors on a tab. */
|
|
2054
|
+
readonly tabHasErrors: CngxMessage;
|
|
2055
|
+
/** Plural on `{count}`: the overflow trigger label. */
|
|
2056
|
+
readonly moreTabsLabel: CngxMessage;
|
|
2057
|
+
/** `{position}`: the name of a tab without a label, e.g. in the overflow list. */
|
|
2058
|
+
readonly unlabeledTab: CngxMessage;
|
|
2059
|
+
/** `{tab}`: announced after a move to an earlier tab, `{tab}` being its name. */
|
|
2060
|
+
readonly previousTab: CngxMessage;
|
|
2061
|
+
/** `{tab}`: announced after a move to a later tab. */
|
|
2062
|
+
readonly nextTab: CngxMessage;
|
|
2063
|
+
/** `{label}`: accessible name of a tab's close button. */
|
|
2064
|
+
readonly closeTab: CngxMessage;
|
|
2065
|
+
readonly addTab: string;
|
|
2066
|
+
/** `{label}`: announced once a closed tab is removed. */
|
|
2067
|
+
readonly closedTab: CngxMessage;
|
|
2068
|
+
/** Announced once a tab without a label is removed. */
|
|
2069
|
+
readonly closedUnlabeledTab: string;
|
|
2070
|
+
readonly commitFailedRetry: string;
|
|
2071
|
+
/** Announced while a tab commit is in flight. */
|
|
2072
|
+
readonly commitInFlight: string;
|
|
2073
|
+
/** `{origin}`: announced when a failed commit reverts to the origin tab. */
|
|
2074
|
+
readonly commitRolledBackTo: CngxMessage;
|
|
2075
|
+
}
|
|
2076
|
+
/**
|
|
2077
|
+
* The English tabs section: the single source of the tabs' English copy.
|
|
2078
|
+
* `CNGX_TABS_I18N` and the `CNGX_TABS_CONFIG` labels default to it.
|
|
2079
|
+
*
|
|
2080
|
+
* @category common/tabs/i18n
|
|
2081
|
+
* @since 0.1.0
|
|
2082
|
+
* @relatedTo CNGX_TABS_I18N, CNGX_TABS_CONFIG
|
|
2083
|
+
*/
|
|
2084
|
+
declare const CNGX_TABS_LANGUAGE_EN: CngxTabsLanguageSection;
|
|
2085
|
+
declare module '@cngx/core/i18n' {
|
|
2086
|
+
interface CngxLanguagePack {
|
|
2087
|
+
readonly tabs: CngxTabsLanguageSection;
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
|
|
1698
2091
|
/**
|
|
1699
2092
|
* Tabs i18n surface. Library defaults are English; consumers
|
|
1700
2093
|
* override via {@link provideTabsI18n}. Sibling to
|
|
@@ -1703,6 +2096,11 @@ declare function createTabsHostAttrs(inputs: CngxTabsHostAttrsInputs): CngxTabsH
|
|
|
1703
2096
|
* @category common/tabs/i18n
|
|
1704
2097
|
*/
|
|
1705
2098
|
interface CngxTabsI18n {
|
|
2099
|
+
/**
|
|
2100
|
+
* Last tier of the tab-group `aria-label`. It only applies when
|
|
2101
|
+
* `CNGX_TABS_CONFIG.ariaLabels.tabsRegion` is unset; that key defaults
|
|
2102
|
+
* to `'Tabs'`, so localise the landmark through `withTabsAriaLabels(...)`.
|
|
2103
|
+
*/
|
|
1706
2104
|
readonly tabsLabel: string;
|
|
1707
2105
|
readonly selectedTab: (label: string, position: number, count: number) => string;
|
|
1708
2106
|
/**
|
|
@@ -1715,8 +2113,22 @@ interface CngxTabsI18n {
|
|
|
1715
2113
|
readonly tabLabelWithDetail: (label: string, detail: string) => string;
|
|
1716
2114
|
readonly tabHasErrors: (count: number) => string;
|
|
1717
2115
|
readonly moreTabsLabel: (count: number) => string;
|
|
1718
|
-
|
|
1719
|
-
|
|
2116
|
+
/**
|
|
2117
|
+
* Name of a tab without a label, e.g. a row of the overflow list.
|
|
2118
|
+
* Receives the 1-based position; English `Tab 3`.
|
|
2119
|
+
*/
|
|
2120
|
+
readonly unlabeledTab: (position: number) => string;
|
|
2121
|
+
/**
|
|
2122
|
+
* Commit-success announcement after a move to an earlier tab. Receives
|
|
2123
|
+
* the position phrase from {@link selectedTab} and owns the whole
|
|
2124
|
+
* sentence, so a locale can reorder it or drop the separator, e.g.
|
|
2125
|
+
* `Previous tab: Tab 1 of 3: Profile`. Unlike the stepper's
|
|
2126
|
+
* `previousStep` / `nextStep`, which are button labels, this key returns
|
|
2127
|
+
* the full live-region sentence.
|
|
2128
|
+
*/
|
|
2129
|
+
readonly previousTab: (positionPhrase: string) => string;
|
|
2130
|
+
/** Sibling of {@link previousTab} after a move to a later tab. */
|
|
2131
|
+
readonly nextTab: (positionPhrase: string) => string;
|
|
1720
2132
|
/**
|
|
1721
2133
|
* Accessible name for a tab's close button. Receives the tab label
|
|
1722
2134
|
* (or a generic fallback when unlabeled) and yields the button's
|
|
@@ -1725,6 +2137,12 @@ interface CngxTabsI18n {
|
|
|
1725
2137
|
readonly closeTab: (label: string) => string;
|
|
1726
2138
|
/** Accessible name for the add-tab button. */
|
|
1727
2139
|
readonly addTab: string;
|
|
2140
|
+
/**
|
|
2141
|
+
* Live-region confirmation once a closed tab's removal has actually
|
|
2142
|
+
* landed in the registry. Receives the closed tab's label (or an
|
|
2143
|
+
* empty string when unlabeled).
|
|
2144
|
+
*/
|
|
2145
|
+
readonly closedTab: (label: string) => string;
|
|
1728
2146
|
/**
|
|
1729
2147
|
* @deprecated Superseded by {@link commitRolledBackTo}. Retained as
|
|
1730
2148
|
* the defensive fallback in `liveAnnouncement` when the origin
|
|
@@ -1743,15 +2161,18 @@ interface CngxTabsI18n {
|
|
|
1743
2161
|
readonly commitRolledBackTo: (originLabel: string) => string;
|
|
1744
2162
|
}
|
|
1745
2163
|
/**
|
|
1746
|
-
* DI token for the tabs i18n bundle
|
|
1747
|
-
*
|
|
2164
|
+
* DI token for the tabs i18n bundle, as a `Signal` so a runtime language
|
|
2165
|
+
* switch re-renders every label it feeds. `providedIn: 'root'`: the tabs
|
|
2166
|
+
* section of the active language pack over the English defaults, formatted
|
|
2167
|
+
* for the app locale. Provide it through {@link provideTabsI18n}; a
|
|
2168
|
+
* `{ provide, useValue }` entry must supply a `Signal<CngxTabsI18n>`.
|
|
1748
2169
|
*
|
|
1749
2170
|
* @category common/tabs/i18n
|
|
1750
2171
|
* @wcag AA
|
|
1751
2172
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/i18n/tabs-i18n.ts
|
|
1752
2173
|
* @since 0.1.0
|
|
1753
2174
|
*/
|
|
1754
|
-
declare const CNGX_TABS_I18N: InjectionToken<CngxTabsI18n
|
|
2175
|
+
declare const CNGX_TABS_I18N: InjectionToken<Signal<CngxTabsI18n>>;
|
|
1755
2176
|
/**
|
|
1756
2177
|
* Branded feature-fn for {@link provideTabsI18n} and
|
|
1757
2178
|
* {@link provideCngxTabs}. The hidden `_target` discriminator routes
|
|
@@ -1760,28 +2181,28 @@ declare const CNGX_TABS_I18N: InjectionToken<CngxTabsI18n>;
|
|
|
1760
2181
|
*
|
|
1761
2182
|
* @category common/tabs/i18n
|
|
1762
2183
|
*/
|
|
1763
|
-
type CngxTabsI18nFeature = ((bundle: CngxTabsI18n) => CngxTabsI18n) & {
|
|
2184
|
+
type CngxTabsI18nFeature = ((bundle: Signal<CngxTabsI18n>) => Signal<CngxTabsI18n>) & {
|
|
1764
2185
|
readonly _target: 'i18n';
|
|
1765
2186
|
};
|
|
1766
2187
|
/**
|
|
1767
2188
|
* Override i18n labels via a partial bundle - unset keys keep the
|
|
1768
|
-
* English default. Same shape as `withTabsAriaLabels` /
|
|
2189
|
+
* language pack's copy, or the English default. Same shape as `withTabsAriaLabels` /
|
|
1769
2190
|
* `withTabsFallbackLabels` so `provideCngxTabs` composes both
|
|
1770
|
-
* surfaces uniformly.
|
|
2191
|
+
* surfaces uniformly. Pass a `Signal` to switch the language at runtime.
|
|
1771
2192
|
*
|
|
1772
2193
|
* @category common/tabs/i18n
|
|
1773
2194
|
*/
|
|
1774
|
-
declare function withTabsI18nLabels(overrides: Partial<CngxTabsI18n>): CngxTabsI18nFeature;
|
|
2195
|
+
declare function withTabsI18nLabels(overrides: Partial<CngxTabsI18n> | Signal<Partial<CngxTabsI18n>>): CngxTabsI18nFeature;
|
|
1775
2196
|
/**
|
|
1776
2197
|
* Provider for the tabs i18n bundle. Compose `withTabsI18nLabels(...)`
|
|
1777
2198
|
* (and future i18n `with*` features); unset keys fall back to the
|
|
1778
|
-
* English
|
|
2199
|
+
* language pack, then English. The features apply on top of the active pack.
|
|
1779
2200
|
*
|
|
1780
2201
|
* ```ts
|
|
1781
2202
|
* bootstrapApplication(AppComponent, {
|
|
1782
2203
|
* providers: [
|
|
1783
2204
|
* provideTabsI18n(
|
|
1784
|
-
* withTabsI18nLabels({ tabsLabel: 'Reiter',
|
|
2205
|
+
* withTabsI18nLabels({ tabsLabel: 'Reiter', addTab: 'Neuer Reiter' }),
|
|
1785
2206
|
* ),
|
|
1786
2207
|
* ],
|
|
1787
2208
|
* });
|
|
@@ -1791,11 +2212,12 @@ declare function withTabsI18nLabels(overrides: Partial<CngxTabsI18n>): CngxTabsI
|
|
|
1791
2212
|
*/
|
|
1792
2213
|
declare function provideTabsI18n(...features: readonly CngxTabsI18nFeature[]): Provider;
|
|
1793
2214
|
/**
|
|
1794
|
-
* Inject the resolved tabs i18n bundle.
|
|
2215
|
+
* Inject the resolved tabs i18n bundle. Read it inside a `computed()`,
|
|
2216
|
+
* template or handler so a language switch reaches the label.
|
|
1795
2217
|
*
|
|
1796
2218
|
* @category common/tabs/i18n
|
|
1797
2219
|
*/
|
|
1798
|
-
declare function injectTabsI18n(): CngxTabsI18n
|
|
2220
|
+
declare function injectTabsI18n(): Signal<CngxTabsI18n>;
|
|
1799
2221
|
|
|
1800
2222
|
/**
|
|
1801
2223
|
* Union of feature kinds the tabs aggregator accepts. \
|
|
@@ -1813,7 +2235,7 @@ type CngxTabsFeature = CngxTabsConfigFeature | CngxTabsI18nFeature;
|
|
|
1813
2235
|
* - `provideCngxSelect`;
|
|
1814
2236
|
* apply once in the app providers array. \
|
|
1815
2237
|
* Returns {@link EnvironmentProviders}; for
|
|
1816
|
-
* - `viewProviders` use {@link provideCngxTabsAt}
|
|
2238
|
+
* - `viewProviders` use {@link provideCngxTabsAt} - opaque
|
|
1817
2239
|
* - `EnvironmentProviders` cannot live there.
|
|
1818
2240
|
*
|
|
1819
2241
|
* ```ts
|
|
@@ -2111,7 +2533,8 @@ declare class CngxTabAddIcon {
|
|
|
2111
2533
|
interface CngxTabDismissalsOptions {
|
|
2112
2534
|
readonly host: CngxTabGroupHost;
|
|
2113
2535
|
readonly config: CngxTabsConfig;
|
|
2114
|
-
|
|
2536
|
+
/** Tabs i18n bundle Signal (`injectTabsI18n()`). */
|
|
2537
|
+
readonly i18n: Signal<CngxTabsI18n>;
|
|
2115
2538
|
readonly closable: Signal<boolean | undefined>;
|
|
2116
2539
|
readonly addable: Signal<boolean | undefined>;
|
|
2117
2540
|
readonly hostElement: HTMLElement;
|
|
@@ -2134,6 +2557,15 @@ interface CngxTabDismissals {
|
|
|
2134
2557
|
closeButtonLabel(tab: CngxTabHandle): string;
|
|
2135
2558
|
/** Stable `*cngxTabCloseIcon` context (`{ tab }`) per tab. */
|
|
2136
2559
|
closeIconContextFor(tab: CngxTabHandle): CngxTabCloseIconContext;
|
|
2560
|
+
/**
|
|
2561
|
+
* Live-region phrase confirming a landed close (`i18n.closedTab`).
|
|
2562
|
+
* Derived from the registry transition - it updates when a requested
|
|
2563
|
+
* close's id actually leaves the registry, so an async consumer
|
|
2564
|
+
* removal announces on completion, not on request. Feed it into
|
|
2565
|
+
* `createTabGroupAnnouncements` (options.closedAnnouncement) so the
|
|
2566
|
+
* live region resolves one priority chain.
|
|
2567
|
+
*/
|
|
2568
|
+
readonly closedAnnouncement: Signal<string>;
|
|
2137
2569
|
/** Close a tab and restore focus to the new active tab / add button. */
|
|
2138
2570
|
handleClose(tab: CngxTabHandle, event?: Event): void;
|
|
2139
2571
|
/** Delete on a focused closable tab requests its close (APG). */
|
|
@@ -2193,6 +2625,19 @@ declare function createTabDismissals(opts: CngxTabDismissalsOptions): CngxTabDis
|
|
|
2193
2625
|
interface CngxTabKeyboardNavOptions {
|
|
2194
2626
|
readonly host: CngxTabGroupHost;
|
|
2195
2627
|
readonly hostElement: HTMLElement;
|
|
2628
|
+
/**
|
|
2629
|
+
* Document writing direction. Flips the horizontal-arrow step under
|
|
2630
|
+
* `rtl` (APG); the vertical axis and Home/End stay direction-invariant.
|
|
2631
|
+
*/
|
|
2632
|
+
readonly direction: Signal<CngxDirection>;
|
|
2633
|
+
/**
|
|
2634
|
+
* Enables the rejection focus-release effect. Under a pessimistic
|
|
2635
|
+
* commit, focus follows the intended target while the action is in
|
|
2636
|
+
* flight; a rejection keeps the roving stop on the origin, so
|
|
2637
|
+
* without the release the user is stranded on a `tabindex="-1"`
|
|
2638
|
+
* button. Omitted, the effect is skipped (headless usage).
|
|
2639
|
+
*/
|
|
2640
|
+
readonly injector?: Injector;
|
|
2196
2641
|
}
|
|
2197
2642
|
/**
|
|
2198
2643
|
* Resolved keyboard surface for `<cngx-tab-group>`'s tablist. The
|
|
@@ -2246,7 +2691,7 @@ declare function createTabKeyboardNav(opts: CngxTabKeyboardNavOptions): CngxTabK
|
|
|
2246
2691
|
|
|
2247
2692
|
/**
|
|
2248
2693
|
* Inputs to {@link createTabGroupTemplateBindings}. \
|
|
2249
|
-
* The organism owns the `contentChild()` queries (NG8110
|
|
2694
|
+
* The organism owns the `contentChild()` queries (NG8110 - must run in component
|
|
2250
2695
|
* injection context) and the resolved {@link CngxTabsConfig}; the
|
|
2251
2696
|
* factory runs the 3-stage cascade per slot key.
|
|
2252
2697
|
*
|
|
@@ -2293,10 +2738,10 @@ interface CngxTabGroupTemplateBindings {
|
|
|
2293
2738
|
* span for the state decorations, the `CNGX_TABS_GLYPHS` glyph for
|
|
2294
2739
|
* `closeIcon` / `addIcon`, and nothing for `icon`.
|
|
2295
2740
|
*
|
|
2296
|
-
* Pure
|
|
2741
|
+
* Pure - no DI, no side effects. Safe in field-init. Sibling to
|
|
2297
2742
|
* `createStepperTemplateBindings` and `createTabOverflowTemplateBindings`.
|
|
2298
2743
|
*
|
|
2299
|
-
* Single-consumer today: `[cngxMatTabs]` does not consume this
|
|
2744
|
+
* Single-consumer today: `[cngxMatTabs]` does not consume this -
|
|
2300
2745
|
* Material owns the rendered tab-button chrome via its own MDC
|
|
2301
2746
|
* template, leaving no DOM seam. See `tabs-accepted-debt §9`.
|
|
2302
2747
|
*
|
|
@@ -2321,19 +2766,27 @@ declare function createTabGroupTemplateBindings(opts: CngxTabGroupTemplateBindin
|
|
|
2321
2766
|
/**
|
|
2322
2767
|
* Inputs the announcements bundle reads from the host organism.
|
|
2323
2768
|
* Passing presenter / i18n / config in (instead of re-injecting)
|
|
2324
|
-
* keeps the factory pure
|
|
2769
|
+
* keeps the factory pure - one call returns the bundle, no
|
|
2325
2770
|
* injection context required.
|
|
2326
2771
|
*
|
|
2327
2772
|
* @category common/tabs/announcements
|
|
2328
2773
|
*/
|
|
2329
2774
|
interface CngxTabGroupAnnouncementsOptions {
|
|
2330
2775
|
readonly presenter: CngxTabGroupHost;
|
|
2331
|
-
|
|
2776
|
+
/** Tabs i18n bundle Signal (`injectTabsI18n()`). */
|
|
2777
|
+
readonly i18n: Signal<CngxTabsI18n>;
|
|
2332
2778
|
readonly config: CngxTabsConfig;
|
|
2333
2779
|
/** Per-instance `aria-label` Input on the organism. */
|
|
2334
2780
|
readonly ariaLabel: Signal<string | undefined>;
|
|
2335
2781
|
/** Per-instance `aria-labelledby` Input on the organism. */
|
|
2336
2782
|
readonly ariaLabelledBy: Signal<string | undefined>;
|
|
2783
|
+
/**
|
|
2784
|
+
* Landed-close phrase from `createTabDismissals`. When supplied,
|
|
2785
|
+
* `liveAnnouncement` surfaces it while no commit phrase applies and
|
|
2786
|
+
* expires it on the next commit activity, so a stale close can never
|
|
2787
|
+
* re-enter (and re-announce through) the live region.
|
|
2788
|
+
*/
|
|
2789
|
+
readonly closedAnnouncement?: Signal<string>;
|
|
2337
2790
|
}
|
|
2338
2791
|
/**
|
|
2339
2792
|
* Resolved bundle returned by {@link createTabGroupAnnouncements}.
|
|
@@ -2363,14 +2816,14 @@ interface CngxTabGroupAnnouncements {
|
|
|
2363
2816
|
*/
|
|
2364
2817
|
readonly resolvedAriaLabel: Signal<string | null>;
|
|
2365
2818
|
/**
|
|
2366
|
-
* Polite live-region content
|
|
2819
|
+
* Polite live-region content - declarative, never an imperative
|
|
2367
2820
|
* `announce()`. Empty between transitions so the region stays
|
|
2368
2821
|
* quiet on no-op ticks.
|
|
2369
2822
|
*
|
|
2370
2823
|
* Error arm: `commitRolledBackTo(originLabel)` when origin
|
|
2371
2824
|
* resolves; otherwise `commitFailedRetry`.
|
|
2372
2825
|
*
|
|
2373
|
-
* Success arm:
|
|
2826
|
+
* Success arm: `previousTab|nextTab(selectedTab(...))` when
|
|
2374
2827
|
* the index moved; bare `selectedTab(...)` when it didn't (initial
|
|
2375
2828
|
* mount, or commit-success that lands on the same tab).
|
|
2376
2829
|
*/
|
|
@@ -2386,7 +2839,7 @@ interface CngxTabGroupAnnouncements {
|
|
|
2386
2839
|
*/
|
|
2387
2840
|
statusPhrase(tab: CngxTabHandle): string;
|
|
2388
2841
|
/**
|
|
2389
|
-
* Verbose tab-button `aria-label`
|
|
2842
|
+
* Verbose tab-button `aria-label` - `selectedTab(label, position,
|
|
2390
2843
|
* count)` so AT hears "Tab 2 of 5: Settings" instead of inferring
|
|
2391
2844
|
* position from tablist enumeration. The visual span keeps the
|
|
2392
2845
|
* bare label.
|
|
@@ -2396,7 +2849,7 @@ interface CngxTabGroupAnnouncements {
|
|
|
2396
2849
|
/**
|
|
2397
2850
|
* Pure factory bundling the `<cngx-tab-group>` AT-announcement +
|
|
2398
2851
|
* descriptor surfaces. Owns one internal `linkedSignal`
|
|
2399
|
-
* (prior-active-index, drives the success-arm direction prefix)
|
|
2852
|
+
* (prior-active-index, drives the success-arm direction prefix) -
|
|
2400
2853
|
* lazy by `linkedSignal` semantics, so the organism reads
|
|
2401
2854
|
* `liveAnnouncement` once at construction to seed it.
|
|
2402
2855
|
*
|
|
@@ -2426,6 +2879,69 @@ interface CngxTabGroupAnnouncements {
|
|
|
2426
2879
|
*/
|
|
2427
2880
|
declare function createTabGroupAnnouncements(options: CngxTabGroupAnnouncementsOptions): CngxTabGroupAnnouncements;
|
|
2428
2881
|
|
|
2882
|
+
/**
|
|
2883
|
+
* Inputs the nav announcement bundle reads from its host organism.
|
|
2884
|
+
* Passing the presenter in (instead of re-injecting) keeps the factory a
|
|
2885
|
+
* plain function of its arguments.
|
|
2886
|
+
*
|
|
2887
|
+
* @category common/tabs/announcements
|
|
2888
|
+
*/
|
|
2889
|
+
interface CngxTabNavAnnouncementOptions {
|
|
2890
|
+
readonly presenter: CngxTabGroupHost;
|
|
2891
|
+
/**
|
|
2892
|
+
* Injection context for the one-shot `afterNextRender` that opens the
|
|
2893
|
+
* mount window. Callers pass their own `inject(Injector)`.
|
|
2894
|
+
*/
|
|
2895
|
+
readonly injector: Injector;
|
|
2896
|
+
}
|
|
2897
|
+
/**
|
|
2898
|
+
* Resolved bundle returned by {@link createTabNavAnnouncement}.
|
|
2899
|
+
*
|
|
2900
|
+
* @category common/tabs/announcements
|
|
2901
|
+
*/
|
|
2902
|
+
interface CngxTabNavAnnouncement {
|
|
2903
|
+
/**
|
|
2904
|
+
* Polite live-region content - declarative, never an imperative
|
|
2905
|
+
* `announce()`. Empty at rest and through the mount window, so the
|
|
2906
|
+
* region speaks only on a real change.
|
|
2907
|
+
*/
|
|
2908
|
+
readonly liveAnnouncement: Signal<string>;
|
|
2909
|
+
}
|
|
2910
|
+
/**
|
|
2911
|
+
* Live-region content for the link-driven nav flavour: the active link's
|
|
2912
|
+
* accessible label, announced only when the active id actually changes.
|
|
2913
|
+
*
|
|
2914
|
+
* **Why this is not {@link createTabGroupAnnouncements}.** That bundle's
|
|
2915
|
+
* phrasing is built around the commit lifecycle (`pending -> success`,
|
|
2916
|
+
* rollback, direction prefix) and it gates on the commit transition, so
|
|
2917
|
+
* it stays silent at rest for free. The nav path is commit-free by
|
|
2918
|
+
* design: links navigate through their own `routerLink` and nothing calls
|
|
2919
|
+
* `presenter.select()`. Its only meaningful announcement is the landing
|
|
2920
|
+
* label, and it needs a different silence gate.
|
|
2921
|
+
*
|
|
2922
|
+
* **The mount window.** `announcing` stays `false` through the first
|
|
2923
|
+
* render and the microtask after it. On a deep link the active link is
|
|
2924
|
+
* the page's *initial state*, not a change, and the browser already
|
|
2925
|
+
* announces the document; pushing the landing section into a polite
|
|
2926
|
+
* region there is noise. `queueMicrotask` rather than the
|
|
2927
|
+
* `afterNextRender` body: every `afterNextRender` callback for one render
|
|
2928
|
+
* runs in a single synchronous batch, so deferring past it makes the gate
|
|
2929
|
+
* independent of whether a `[cngxTabsRouteSync]` seed registered before
|
|
2930
|
+
* or after this one.
|
|
2931
|
+
*
|
|
2932
|
+
* The prior-id tracker is seeded when that window closes, not at
|
|
2933
|
+
* construction, so whatever the seed resolved counts as the starting
|
|
2934
|
+
* point instead of as the first announcement. Returning to a section
|
|
2935
|
+
* that was active at mount still announces.
|
|
2936
|
+
*
|
|
2937
|
+
* @category common/tabs/announcements
|
|
2938
|
+
* @wcag AA
|
|
2939
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/announcements/tab-nav-announcement.ts
|
|
2940
|
+
* @since 0.1.0
|
|
2941
|
+
* @relatedTo CngxTabNav, CngxLiveRegion, createTabGroupAnnouncements
|
|
2942
|
+
*/
|
|
2943
|
+
declare function createTabNavAnnouncement(options: CngxTabNavAnnouncementOptions): CngxTabNavAnnouncement;
|
|
2944
|
+
|
|
2429
2945
|
/**
|
|
2430
2946
|
* Default glyph fallbacks for `<cngx-tab-group>` skin slots. Read by
|
|
2431
2947
|
* the organism when neither a per-instance slot directive nor
|
|
@@ -2479,6 +2995,10 @@ interface CngxTabOverflowTemplateBindingsOptions {
|
|
|
2479
2995
|
readonly hiddenTabs: Signal<readonly CngxTabHandle[]>;
|
|
2480
2996
|
/** Commit-aware select callback - invoked from `itemContext.pick`. */
|
|
2481
2997
|
readonly pickTab: (tab: CngxTabHandle) => void;
|
|
2998
|
+
/** Every tab of the strip; an unlabelled tab is named by its position in it. */
|
|
2999
|
+
readonly tabs: Signal<readonly CngxTabHandle[]>;
|
|
3000
|
+
/** Resolved tabs copy (`unlabeledTab`). */
|
|
3001
|
+
readonly i18n: Signal<CngxTabsI18n>;
|
|
2482
3002
|
}
|
|
2483
3003
|
/**
|
|
2484
3004
|
* Output of {@link createTabOverflowTemplateBindings}. Carries the two
|
|
@@ -2492,6 +3012,11 @@ interface CngxTabOverflowTemplateBindings {
|
|
|
2492
3012
|
readonly itemTemplate: Signal<TemplateRef<CngxTabOverflowItemContext> | null>;
|
|
2493
3013
|
readonly triggerContext: Signal<CngxTabOverflowTriggerContext>;
|
|
2494
3014
|
readonly buildItemContext: (tab: CngxTabHandle, index: number) => CngxTabOverflowItemContext;
|
|
3015
|
+
/**
|
|
3016
|
+
* Default text of an overflow row and its typeahead label: the tab label,
|
|
3017
|
+
* or `unlabeledTab(position)` for an unlabelled tab - never the tab id.
|
|
3018
|
+
*/
|
|
3019
|
+
readonly itemLabel: (tab: CngxTabHandle) => string;
|
|
2495
3020
|
/**
|
|
2496
3021
|
* `ActiveDescendantItem[]` projection of `hiddenTabs()` for
|
|
2497
3022
|
* `CngxActiveDescendant.items`. \
|
|
@@ -2711,5 +3236,5 @@ type CngxDirectiveByIdMapFactory = <T extends {
|
|
|
2711
3236
|
*/
|
|
2712
3237
|
declare const CNGX_DIRECTIVE_BY_ID_MAP_FACTORY: InjectionToken<CngxDirectiveByIdMapFactory>;
|
|
2713
3238
|
|
|
2714
|
-
export { CNGX_DIRECTIVE_BY_ID_MAP_FACTORY, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_ORGANISM_SCROLL_SYNC_FACTORY, CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY, CNGX_TABS_COMMIT_ACTION, CNGX_TABS_COMMIT_HANDLER_FACTORY, CNGX_TABS_CONFIG, CNGX_TABS_GLYPHS, CNGX_TABS_I18N, CNGX_TAB_GROUP_HOST, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CngxTab, CngxTabAddIcon, CngxTabBusySpinner, CngxTabCloseIcon, CngxTabContent, CngxTabErrorBadge, CngxTabGroupPresenter, CngxTabIcon, CngxTabLabel, CngxTabLink, CngxTabOverflowItem, CngxTabOverflowTrigger, CngxTabRejectionIcon, CngxTabSubLabel, CngxTabsFragmentSync, CngxTabsRouteSync, createCngxTabOverflowDefaultDomAdapter, createDirectiveByIdMap, createDomAnchorRetry, createOrganismScrollSync, createOverflowPopoverHighlightSync, createTabDismissals, createTabGroupAnnouncements, createTabGroupTemplateBindings, createTabKeyboardNav, createTabOverflowTemplateBindings, createTabRouterCommit, createTabsCommitHandler, createTabsHostAttrs, injectTabsConfig, injectTabsI18n, provideCngxTabs, provideCngxTabsAt, provideTabsConfig, provideTabsConfigAt, provideTabsI18n, tabOverflowOptionId, withDefaultOrientation, withTabAddIconTemplate, withTabBusySpinnerTemplate, withTabCloseIconTemplate, withTabErrorBadgeTemplate, withTabIconTemplate, withTabOverflowItemTemplate, withTabOverflowMaxDeferMs, withTabOverflowStabilizeMs, withTabOverflowTriggerTemplate, withTabRejectionIconTemplate, withTabsAddable, withTabsAlign, withTabsAriaLabels, withTabsClosable, withTabsCommitMode, withTabsDefaultOrientation, withTabsFallbackLabels, withTabsFitted, withTabsFragmentSync, withTabsI18nLabels, withTabsIconLayout, withTabsPanelMode, withTabsRouterSync, withTabsRovingLoop, withTabsSkin };
|
|
2715
|
-
export type { CngxDirectiveByIdMapFactory, CngxDirectiveByIdMapOptions, CngxDomAnchorRetryFactory, CngxDomAnchorRetryHandle, CngxDomAnchorRetryOptions, CngxDomAnchorRetryResult, CngxOrganismScrollSyncFactory, CngxOrganismScrollSyncOptions, CngxOverflowPopoverHighlightSyncFactory, CngxTabAlign, CngxTabBusySpinnerContext, CngxTabCloseEvent, CngxTabCloseIconContext, CngxTabDismissals, CngxTabDismissalsOptions, CngxTabErrorBadgeContext, CngxTabGroupAnnouncements, CngxTabGroupAnnouncementsOptions, CngxTabGroupHost, CngxTabGroupTemplateBindings, CngxTabGroupTemplateBindingsOptions, CngxTabHandle, CngxTabIconContext, CngxTabIconLayout, CngxTabKeyboardNav, CngxTabKeyboardNavOptions, CngxTabOverflowDomAdapter, CngxTabOverflowDomAdapterFactory, CngxTabOverflowItemContext, CngxTabOverflowTemplateBindings, CngxTabOverflowTemplateBindingsOptions, CngxTabOverflowTriggerContext, CngxTabPanelHost, CngxTabRejectionIconContext, CngxTabRouterCommitOptions, CngxTabsAriaLabels, CngxTabsCommitAction, CngxTabsCommitActionSource, CngxTabsCommitHandler, CngxTabsCommitHandlerFactory, CngxTabsCommitHandlerOptions, CngxTabsConfig, CngxTabsConfigFeature, CngxTabsFallbackLabels, CngxTabsFeature, CngxTabsHostAttrs, CngxTabsHostAttrsInputs, CngxTabsI18n, CngxTabsI18nFeature, CngxTabsPanelMode, CngxTabsSkin, CngxTabsTemplates };
|
|
3239
|
+
export { CNGX_DIRECTIVE_BY_ID_MAP_FACTORY, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_ORGANISM_SCROLL_SYNC_FACTORY, CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY, CNGX_TABS_COMMIT_ACTION, CNGX_TABS_COMMIT_HANDLER_FACTORY, CNGX_TABS_CONFIG, CNGX_TABS_GLYPHS, CNGX_TABS_I18N, CNGX_TABS_LANGUAGE_EN, CNGX_TAB_GROUP_HOST, CNGX_TAB_NAV_HOST, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CNGX_TAB_URL_MATCH_STRATEGY, CngxTab, CngxTabAddIcon, CngxTabBusySpinner, CngxTabCloseIcon, CngxTabContent, CngxTabErrorBadge, CngxTabGroupPresenter, CngxTabIcon, CngxTabLabel, CngxTabLink, CngxTabOverflowItem, CngxTabOverflowTrigger, CngxTabRejectionIcon, CngxTabSubLabel, CngxTabsFragmentSync, CngxTabsRouteSync, createCngxTabOverflowDefaultDomAdapter, createDirectiveByIdMap, createDomAnchorRetry, createOrganismScrollSync, createOverflowPopoverHighlightSync, createTabDismissals, createTabGroupAnnouncements, createTabGroupTemplateBindings, createTabKeyboardNav, createTabNavAnnouncement, createTabOverflowTemplateBindings, createTabRouterCommit, createTabUrlMatch, createTabsCommitHandler, createTabsHostAttrs, injectTabsConfig, injectTabsI18n, provideCngxTabs, provideCngxTabsAt, provideTabsConfig, provideTabsConfigAt, provideTabsI18n, tabOverflowOptionId, withDefaultOrientation, withTabAddIconTemplate, withTabBusySpinnerTemplate, withTabCloseIconTemplate, withTabErrorBadgeTemplate, withTabIconTemplate, withTabOverflowItemTemplate, withTabOverflowMaxDeferMs, withTabOverflowStabilizeMs, withTabOverflowTriggerTemplate, withTabRejectionIconTemplate, withTabsAddable, withTabsAlign, withTabsAriaLabels, withTabsClosable, withTabsCommitMode, withTabsDefaultOrientation, withTabsFallbackLabels, withTabsFitted, withTabsFragmentSync, withTabsI18nLabels, withTabsIconLayout, withTabsLinkAriaCurrent, withTabsPanelMode, withTabsRouteMatch, withTabsRouterSync, withTabsRovingLoop, withTabsSkin };
|
|
3240
|
+
export type { CngxDirectiveByIdMapFactory, CngxDirectiveByIdMapOptions, CngxDomAnchorRetryFactory, CngxDomAnchorRetryHandle, CngxDomAnchorRetryOptions, CngxDomAnchorRetryResult, CngxOrganismScrollSyncFactory, CngxOrganismScrollSyncOptions, CngxOverflowPopoverHighlightSyncFactory, CngxTabAlign, CngxTabBusySpinnerContext, CngxTabCloseEvent, CngxTabCloseIconContext, CngxTabDismissals, CngxTabDismissalsOptions, CngxTabErrorBadgeContext, CngxTabGroupAnnouncements, CngxTabGroupAnnouncementsOptions, CngxTabGroupHost, CngxTabGroupTemplateBindings, CngxTabGroupTemplateBindingsOptions, CngxTabHandle, CngxTabIconContext, CngxTabIconLayout, CngxTabKeyboardNav, CngxTabKeyboardNavOptions, CngxTabMatchMode, CngxTabNavAnnouncement, CngxTabNavAnnouncementOptions, CngxTabOverflowDomAdapter, CngxTabOverflowDomAdapterFactory, CngxTabOverflowItemContext, CngxTabOverflowTemplateBindings, CngxTabOverflowTemplateBindingsOptions, CngxTabOverflowTriggerContext, CngxTabPanelHost, CngxTabRejectionIconContext, CngxTabRouterCommitOptions, CngxTabUrlMatch, CngxTabUrlMatchContext, CngxTabUrlMatchFactory, CngxTabsAriaLabels, CngxTabsCommitAction, CngxTabsCommitActionSource, CngxTabsCommitHandler, CngxTabsCommitHandlerFactory, CngxTabsCommitHandlerOptions, CngxTabsConfig, CngxTabsConfigFeature, CngxTabsFallbackLabels, CngxTabsFeature, CngxTabsHostAttrs, CngxTabsHostAttrsInputs, CngxTabsI18n, CngxTabsI18nFeature, CngxTabsLanguageSection, CngxTabsPanelMode, CngxTabsSkin, CngxTabsTemplates };
|