@cngx/ui 0.1.0-rc.8 → 0.1.0-rc.9
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/command-palette/README.md +5 -2
- package/fesm2022/cngx-ui-accordion.mjs +19 -2
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +10 -7
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +55 -15
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-collection.mjs +10 -0
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +2 -2
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -1
- package/fesm2022/cngx-ui-context-menu.mjs +60 -6
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -1
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +87 -7
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +63 -32
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +3 -2
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +264 -86
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-paginator.mjs +67 -21
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +19 -5
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +65 -53
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +84 -25
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +28 -6
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -1
- package/fesm2022/cngx-ui-toc.mjs +32 -8
- package/fesm2022/cngx-ui-toc.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +1 -1
- package/mat-tabs/README.md +30 -6
- package/mat-tabs/styles/mat-tabs.css +180 -33
- package/package.json +31 -7
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +91 -0
- package/schematics/package.json +3 -0
- package/stepper/README.md +1 -1
- package/types/cngx-ui-accordion.d.ts +9 -2
- package/types/cngx-ui-breadcrumb.d.ts +14 -3
- package/types/cngx-ui-collection.d.ts +10 -0
- package/types/cngx-ui-context-menu.d.ts +42 -4
- package/types/cngx-ui-data-grid-accordion.d.ts +4 -1
- package/types/cngx-ui-feedback.d.ts +11 -3
- package/types/cngx-ui-mat-accordion.d.ts +3 -2
- package/types/cngx-ui-mat-tabs.d.ts +44 -21
- package/types/cngx-ui-paginator.d.ts +22 -7
- package/types/cngx-ui-stepper.d.ts +23 -23
- package/types/cngx-ui-tabs.d.ts +4 -2
- package/types/cngx-ui-timeline.d.ts +12 -4
- package/types/cngx-ui-toc.d.ts +13 -3
package/fesm2022/cngx-ui-toc.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DOCUMENT, isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { InjectionToken, inject, TemplateRef, Directive, PLATFORM_ID, input, booleanAttribute, output, viewChild, contentChild, signal, computed, DestroyRef, effect, ViewEncapsulation, ChangeDetectionStrategy, Component, afterNextRender, makeEnvironmentProviders } from '@angular/core';
|
|
4
|
-
import { arrayEqual } from '@cngx/utils';
|
|
4
|
+
import { arrayEqual, cngxDevWarn, CngxRuntimeError } from '@cngx/utils';
|
|
5
5
|
import { injectMediaQuery, CngxScrollSpy } from '@cngx/common/layout';
|
|
6
6
|
import { createFilledOverrideMerge, createOverrideMerge } from '@cngx/core/utils';
|
|
7
7
|
import { createLanguageSection } from '@cngx/core/i18n';
|
|
@@ -476,8 +476,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
476
476
|
*
|
|
477
477
|
* @internal
|
|
478
478
|
*/
|
|
479
|
-
function warnRouterAbsent(
|
|
480
|
-
|
|
479
|
+
function warnRouterAbsent(selector, enables) {
|
|
480
|
+
if (!(typeof ngDevMode !== 'undefined' && ngDevMode)) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
cngxDevWarn('CNGX3001', `[${selector}] no Router / ActivatedRoute available - directive is a no-op. ` +
|
|
481
484
|
`Provide @angular/router via provideRouter(...) to enable ${enables}.`);
|
|
482
485
|
}
|
|
483
486
|
/**
|
|
@@ -501,12 +504,14 @@ function warnRouterAbsent(directive, enables) {
|
|
|
501
504
|
* <example-url>http://localhost:4200/#/ui/toc/router/fragment-deep-link</example-url>
|
|
502
505
|
*/
|
|
503
506
|
class CngxTocRouterSync {
|
|
504
|
-
toc =
|
|
507
|
+
toc = injectRouterSyncToc();
|
|
505
508
|
router = inject(Router, { optional: true });
|
|
506
509
|
route = inject(ActivatedRoute, { optional: true });
|
|
507
510
|
constructor() {
|
|
508
511
|
if (!this.router || !this.route) {
|
|
509
|
-
|
|
512
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
513
|
+
afterNextRender(() => warnRouterAbsent('cngxTocRouterSync', 'fragment deep-linking'));
|
|
514
|
+
}
|
|
510
515
|
return;
|
|
511
516
|
}
|
|
512
517
|
const router = this.router;
|
|
@@ -543,6 +548,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
543
548
|
standalone: true,
|
|
544
549
|
}]
|
|
545
550
|
}], ctorParameters: () => [] });
|
|
551
|
+
function injectRouterSyncToc() {
|
|
552
|
+
const toc = inject(CNGX_TOC, { host: true, optional: true });
|
|
553
|
+
if (!toc) {
|
|
554
|
+
throw new CngxRuntimeError('CNGX3021', typeof ngDevMode !== 'undefined' &&
|
|
555
|
+
ngDevMode &&
|
|
556
|
+
'[cngxTocRouterSync] must be placed on or inside <cngx-toc>.');
|
|
557
|
+
}
|
|
558
|
+
return toc;
|
|
559
|
+
}
|
|
546
560
|
|
|
547
561
|
/**
|
|
548
562
|
* Override the toc's ARIA-string fallback - the accessible name of the `nav`
|
|
@@ -596,10 +610,20 @@ function withTocSpy(payload) {
|
|
|
596
610
|
* `*cngxTocItem` slot and before the built-in plain-label rendering, so every
|
|
597
611
|
* un-slotted toc renders the same custom item markup.
|
|
598
612
|
*
|
|
613
|
+
* A `TemplateRef` exists only once a view renders, so it cannot go into
|
|
614
|
+
* `viewProviders` or the root providers. Build the scope from the rendered
|
|
615
|
+
* template and hand it to `ngTemplateOutlet`:
|
|
616
|
+
*
|
|
599
617
|
* ```ts
|
|
600
|
-
*
|
|
601
|
-
*
|
|
602
|
-
*
|
|
618
|
+
* private readonly injector = inject(Injector);
|
|
619
|
+
* private readonly itemTpl = viewChild.required<TemplateRef<CngxTocItemContext>>('tocItem');
|
|
620
|
+
* protected readonly tocScope = computed(() =>
|
|
621
|
+
* Injector.create({
|
|
622
|
+
* parent: this.injector,
|
|
623
|
+
* providers: [provideTocConfigAt(withTocTemplates({ item: this.itemTpl() }))],
|
|
624
|
+
* }),
|
|
625
|
+
* );
|
|
626
|
+
* // <ng-container *ngTemplateOutlet="tocTpl; injector: tocScope()" />
|
|
603
627
|
* ```
|
|
604
628
|
*
|
|
605
629
|
* @category ui/toc
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cngx-ui-toc.mjs","sources":["../../../projects/ui/toc/i18n/toc-language-section.ts","../../../projects/ui/toc/i18n/toc-i18n.ts","../../../projects/ui/toc/config/toc.config.defaults.ts","../../../projects/ui/toc/config/inject-toc-config.ts","../../../projects/ui/toc/toc-item-slot.ts","../../../projects/ui/toc/toc-token.ts","../../../projects/ui/toc/toc.component.ts","../../../projects/ui/toc/toc.component.html","../../../projects/ui/toc/toc-router-sync.directive.ts","../../../projects/ui/toc/config/features.ts","../../../projects/ui/toc/config/provide-toc-config.ts","../../../projects/ui/toc/public-api.ts","../../../projects/ui/toc/cngx-ui-toc.ts"],"sourcesContent":["/**\n * The toc section of a {@link CngxLanguagePack}: the accessible names of\n * `CngxToc`. It feeds the `ariaLabels` of `CNGX_TOC_CONFIG`; a key set through\n * `withTocAriaLabels` still wins.\n *\n * @category ui/toc/i18n\n * @since 0.1.0\n * @relatedTo CNGX_TOC_CONFIG, withTocAriaLabels\n */\nexport interface CngxTocLanguageSection {\n /** Accessible name of the `nav` landmark. */\n readonly nav: string;\n}\n\n/**\n * The English toc section: the single source of the toc's English copy. The\n * `CNGX_TOC_CONFIG` labels default to it.\n *\n * @category ui/toc/i18n\n * @since 0.1.0\n * @relatedTo CNGX_TOC_CONFIG\n */\nexport const CNGX_TOC_LANGUAGE_EN: CngxTocLanguageSection = {\n nav: 'On this page',\n};\n\ndeclare module '@cngx/core/i18n' {\n interface CngxLanguagePack {\n readonly toc: CngxTocLanguageSection;\n }\n}\n","import { createLanguageSection } from '@cngx/core/i18n';\n\nimport { CNGX_TOC_LANGUAGE_EN } from './toc-language-section';\n\n/**\n * @internal The toc section of the active pack over the English section,\n * shared app-wide. Consumers override copy through `withTocAriaLabels`.\n */\nexport const injectTocSiteCopy = createLanguageSection('toc', CNGX_TOC_LANGUAGE_EN);\n","import { InjectionToken } from '@angular/core';\n\nimport type { CngxTocConfig } from './toc.config';\n\n/**\n * Library defaults for the toc configuration cascade. Carries no copy: the\n * `ariaLabels` defaults are the `toc` section of the language pack; single\n * keys ride the `withTocAriaLabels` feature. The spy defaults (`rootMargin` / `threshold`) mirror\n * `CngxScrollSpy`'s own input defaults so an un-configured toc tracks\n * scrolling identically to a hand-wired spy.\n *\n * Exported for intra-lib consumers (`provideTocConfig` deep-merges with this\n * base) but **NOT** re-exported from `public-api.ts` - downstream consumers\n * reach the defaults via `inject(CNGX_TOC_CONFIG)` so `provideTocConfig` /\n * `provideTocConfigAt` overrides take precedence.\n *\n * @internal\n */\nexport const CNGX_TOC_DEFAULTS: CngxTocConfig = {\n scrollBehavior: 'smooth',\n spy: {\n rootMargin: '0px',\n threshold: 0.3,\n },\n};\n\n/**\n * App-wide configuration cascade for the table-of-contents organism. Resolves\n * in priority order:\n *\n * 1. Per-instance Input binding.\n * 2. `provideTocConfigAt(...)` in a parent component's `viewProviders`.\n * 3. `provideTocConfig(...)` at the application root.\n * 4. Library defaults (this token's `factory`).\n *\n * `providedIn: 'root'` with a default factory means consumers never need to\n * provide the token explicitly - `inject(CNGX_TOC_CONFIG)` always resolves.\n * Consumers who want overrides call `provideTocConfig(...)` in\n * `bootstrapApplication` providers (root cascade) or `provideTocConfigAt(...)`\n * in a component's `viewProviders` (sub-tree cascade).\n *\n * @category ui/toc\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/config/toc.config.defaults.ts\n * @since 0.1.0\n */\nexport const CNGX_TOC_CONFIG = new InjectionToken<CngxTocConfig>('CNGX_TOC_CONFIG', {\n providedIn: 'root',\n factory: () => CNGX_TOC_DEFAULTS,\n});\n","import { inject, type Signal } from '@angular/core';\nimport { createFilledOverrideMerge } from '@cngx/core/utils';\n\nimport { injectTocSiteCopy } from '../i18n/toc-i18n';\nimport type { CngxTocAriaLabels, CngxTocConfig } from './toc.config';\nimport { CNGX_TOC_CONFIG } from './toc.config.defaults';\n\n/**\n * Convenience accessor for the toc configuration cascade. Runs in injection\n * context; resolves through the priority chain (per-instance Input ->\n * `provideTocConfigAt` -> `provideTocConfig` -> library defaults). Equivalent\n * to `inject(CNGX_TOC_CONFIG)` - the helper exists so consumers don't import\n * the token directly. Mirrors `injectBreadcrumbConfig`.\n *\n * ```ts\n * export class CngxToc {\n * private readonly cfg = injectTocConfig();\n * protected readonly navLabel = computed(() => this.cfg.ariaLabels?.nav ?? 'On this page');\n * }\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function injectTocConfig(): CngxTocConfig {\n return inject(CNGX_TOC_CONFIG);\n}\n\n/**\n * The resolved accessible names of the toc config in scope, every key the\n * config leaves unset (also a key an override sets to `undefined`) filled from\n * the `toc` section of the active pack, as a Signal that follows a runtime\n * language switch. Runs in injection context; read it inside a `computed()`, a template\n * or a handler.\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function injectTocAriaLabels(): Signal<Required<CngxTocAriaLabels>> {\n return createFilledOverrideMerge(injectTocSiteCopy(), injectTocConfig().ariaLabels);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxTocItemContext } from './toc.types';\n\n/**\n * Per-item template slot for `CngxToc`. Project an `<ng-template cngxTocItem>`\n * inside `<cngx-toc>` to replace the built-in plain-label rendering with\n * custom markup - the `let-` variables come out typed via\n * `ngTemplateContextGuard`:\n *\n * ```html\n * <cngx-toc [items]=\"toc\" contentRoot=\"#article\">\n * <ng-template cngxTocItem let-item let-active=\"active\" let-depth=\"depth\">\n * <span [class.is-active]=\"active\">{{ item.label }}</span>\n * @if (depth === 0) { <cngx-badge>{{ item.children?.length }}</cngx-badge> }\n * </ng-template>\n * </cngx-toc>\n * ```\n *\n * Named `CngxTocItemSlot` (not `*Directive`) per the repo's no-artifact-suffix\n * rule; the selector stays `cngxTocItem`, which is what consumers write.\n * Resolves ahead of `CNGX_TOC_CONFIG.templates.item` and the built-in label.\n *\n * @category ui/toc\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/toc-item-slot.ts\n * @since 0.1.0\n * @relatedTo CngxToc\n * <example-url>http://localhost:4200/#/ui/toc/slots/custom-item-template</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxTocItem]',\n standalone: true,\n exportAs: 'cngxTocItem',\n})\nexport class CngxTocItemSlot {\n readonly templateRef = inject<TemplateRef<CngxTocItemContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _dir: CngxTocItemSlot,\n ctx: unknown,\n ): ctx is CngxTocItemContext {\n return true;\n }\n}\n","import { InjectionToken, type OutputRef, type Signal } from '@angular/core';\n\nimport type { CngxTocItem } from './toc.types';\n\n/**\n * Minimal contract a toc rail exposes to its collaborators (the opt-in\n * `CngxTocRouterSync` fragment directive): the active-section signal it\n * derives, the activation output it emits, and the imperative `scrollTo`\n * it owns. Injected via {@link CNGX_TOC} + `useExisting`, never by injecting\n * the concrete `CngxToc` class - that would create a cyclic type dependency\n * and block the decompose brain/skin split.\n *\n * Direction mirrors `CNGX_SIDENAV`, not `CNGX_BREADCRUMB_ITEMS_SOURCE`: the\n * rail owns the state (`activeId`, `scrollTo`) and the collaborator consumes\n * it, so the toc *provides* the token and the sync directive *injects* it.\n *\n * @category ui/toc\n * @since 0.1.0\n * @relatedTo CngxToc, CngxTocRouterSync\n */\nexport interface CngxTocContract {\n /** The section currently most visible, or `null` before the spy resolves. */\n readonly activeId: Signal<string | null>;\n /** Fires when a link is activated (click / Enter), carrying its item. */\n readonly activated: OutputRef<CngxTocItem>;\n /** Scroll the section with this id into view and move focus to it. */\n scrollTo(id: string): void;\n}\n\n/**\n * Contract token for a toc rail. `CngxToc` provides it via\n * `{ provide: CNGX_TOC, useExisting: CngxToc }`, so a collaborator injects the\n * narrow {@link CngxTocContract} instead of the concrete class.\n *\n * @category ui/toc\n * @since 0.1.0\n * @relatedTo CngxToc, CngxTocRouterSync\n */\nexport const CNGX_TOC = new InjectionToken<CngxTocContract>('CNGX_TOC');\n","import { DOCUMENT, isPlatformBrowser, NgTemplateOutlet } from '@angular/common';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n DestroyRef,\n effect,\n inject,\n input,\n output,\n PLATFORM_ID,\n signal,\n ViewEncapsulation,\n viewChild,\n type Signal,\n} from '@angular/core';\nimport { arrayEqual } from '@cngx/utils';\nimport { CngxScrollSpy, injectMediaQuery } from '@cngx/common/layout';\n\nimport { injectTocAriaLabels, injectTocConfig } from './config/inject-toc-config';\nimport { CngxTocItemSlot } from './toc-item-slot';\nimport { CNGX_TOC, type CngxTocContract } from './toc-token';\nimport type { CngxTocItem } from './toc.types';\n\n/** Shared empty result so the no-active-section trail is reference-stable. */\nconst EMPTY_IDS: readonly string[] = [];\n\n/** Shared empty outline so the pre-scan / no-headings state is reference-stable. */\nconst EMPTY_ITEMS: readonly CngxTocItem[] = [];\n\n/** Mutable node used while building the discovered tree, before it is frozen to CngxTocItem. */\ninterface MutableItem {\n id: string;\n label: string;\n children: MutableItem[];\n}\n\n/**\n * Structural compare of two discovered outlines (id + label + nesting). Guards\n * the `discovered` signal so a re-scan of unchanged headings keeps the same\n * reference and never re-stamps the outline outlet.\n */\nfunction itemsEqual(a: readonly CngxTocItem[], b: readonly CngxTocItem[]): boolean {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n const x = a[i];\n const y = b[i];\n if (x.id !== y.id || x.label !== y.label) {\n return false;\n }\n if (!itemsEqual(x.children ?? EMPTY_ITEMS, y.children ?? EMPTY_ITEMS)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * \"On this page\" navigation rail. Renders a `<nav>` of anchor links from a\n * {@link CngxTocItem} outline, tracks the most-visible section through an\n * internal {@link CngxScrollSpy}, and communicates the active link via\n * `aria-current` inside the `computed()` graph. Nested items render as\n * indented sub-lists; native link semantics and tab order stay intact (a toc\n * is a navigation landmark of links, not a treeview).\n *\n * Composition over configuration: the spy is bound in this component's own\n * template rather than via `hostDirectives`, because the organism - not the\n * consumer - owns the flat id list the spy observes, and `[cngxScrollSpy]` is\n * a required input. The spy resolves its targets through `getElementById`, so\n * its host placement is irrelevant to its function.\n *\n * @category ui/toc\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/toc.component.ts\n * @since 0.1.0\n * @relatedTo CngxScrollSpy, CngxTocRouterSync, CngxSidenav\n * <example-url>http://localhost:4200/#/ui/toc/basic/on-this-page-rail</example-url>\n * <example-url>http://localhost:4200/#/ui/toc/auto/heading-auto-discovery</example-url>\n * @slot cngxTocItem Replaces the plain label inside each item's link at every depth, ahead of CNGX_TOC_CONFIG.templates.item; gets the item as $implicit, plus active and the zero-based depth.\n */\n@Component({\n selector: 'cngx-toc',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [NgTemplateOutlet, CngxScrollSpy],\n providers: [{ provide: CNGX_TOC, useExisting: CngxToc }],\n templateUrl: './toc.component.html',\n styleUrl: './toc.component.css',\n})\nexport class CngxToc implements CngxTocContract {\n private readonly doc = inject(DOCUMENT);\n private readonly cfg = injectTocConfig();\n private readonly ariaLabels = injectTocAriaLabels();\n private readonly reducedMotion = injectMediaQuery('(prefers-reduced-motion: reduce)');\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /**\n * The outline to render. Tree-shaped; nested `children` become sub-lists.\n * Ignored when `[autoDiscover]` is set - the headings under `contentRoot`\n * become the outline instead.\n */\n readonly items = input<readonly CngxTocItem[]>(EMPTY_ITEMS);\n /**\n * Derive the outline from the heading elements under `contentRoot` instead\n * of a hand-maintained `[items]` array. Headings nest by their level\n * (`h2 > h3`), and a heading with no `id` gets a slugified one written onto\n * it so the link can target it. Scans once after the first render; call\n * {@link refresh} after you inject or remove sections at runtime.\n */\n readonly autoDiscover = input(false, { transform: booleanAttribute });\n /** Which headings `[autoDiscover]` collects, in CSS-selector form. */\n readonly headingSelector = input<string>('h2, h3');\n /**\n * CSS selector for the scroll container the spy observes. `null` (default)\n * uses the viewport. Forwarded to the spy's `[root]`; also the root the\n * `[autoDiscover]` scan walks for headings.\n */\n readonly contentRoot = input<string | null>(null);\n /** Root margin forwarded to the spy. Defaults to the config cascade. */\n readonly rootMargin = input<string>(this.cfg.spy?.rootMargin ?? '0px');\n /** Minimum visibility ratio forwarded to the spy. Defaults to the config cascade. */\n readonly threshold = input<number>(this.cfg.spy?.threshold ?? 0.3);\n\n /** Fires when a link is activated (click / Enter). */\n readonly activated = output<CngxTocItem>();\n\n private readonly spy = viewChild(CngxScrollSpy);\n private readonly itemSlot = contentChild(CngxTocItemSlot);\n\n /** Headings discovered by the last `[autoDiscover]` scan. */\n private readonly discovered = signal<readonly CngxTocItem[]>(EMPTY_ITEMS, { equal: itemsEqual });\n\n /** The outline actually rendered: the discovered headings when `[autoDiscover]` is on, else `[items]`. */\n protected readonly resolvedItems = computed(() =>\n this.autoDiscover() ? this.discovered() : this.items(),\n );\n\n /** Accessible name of the `nav` landmark, from the config cascade; follows a language switch. */\n protected readonly navLabel = computed(() => this.ariaLabels().nav);\n\n /**\n * Depth-first flat id list feeding `[cngxScrollSpy]`. `equal: arrayEqual`\n * keeps the reference stable across same-shape re-sets so a re-render does\n * not re-create the observer.\n */\n protected readonly flatIds = computed(() => this.collectIds(this.resolvedItems()), {\n equal: arrayEqual,\n });\n\n constructor() {\n // Re-scan whenever the discovery inputs change. The DOM read + discovered\n // write are deferred to a microtask so no signal is written during effect\n // execution (Pillar 1) and the just-rendered content has settled - the same\n // queueMicrotask discipline the panel-lifecycle focus restore uses. The\n // destroyed guard keeps a microtask queued right before teardown from\n // scanning a detached DOM.\n let destroyed = false;\n inject(DestroyRef).onDestroy(() => {\n destroyed = true;\n });\n effect(() => {\n if (!this.autoDiscover()) {\n return;\n }\n this.contentRoot();\n this.headingSelector();\n queueMicrotask(() => {\n if (!destroyed) {\n this.refresh();\n }\n });\n });\n }\n\n /**\n * The active section, or `null`. `viewChild` is a view query, so `spy()` is\n * `undefined` during the creation pass; `?? null` makes that an explicit\n * value every downstream computed is defined at.\n */\n readonly activeId: Signal<string | null> = computed(() => this.spy()?.activeId() ?? null);\n\n /**\n * Ancestor-id chain of the active leaf - the parent links that get\n * `data-active-trail`. Same `equal` as `flatIds`: an array-valued computed\n * feeding an attribute binding must not allocate a fresh array every spy\n * tick (reference_signal_architecture Equality Rule).\n */\n protected readonly activeTrail = computed(() => this.computeTrail(), { equal: arrayEqual });\n\n /** Resolved item template: instance slot -> config default -> built-in label. */\n protected readonly resolvedItemTpl = computed(\n () => this.itemSlot()?.templateRef ?? this.cfg.templates?.item ?? null,\n );\n\n /**\n * Scroll the section with this id into view and move focus to it. Honours\n * `prefers-reduced-motion` - the configured `scrollBehavior` is swapped for\n * `'auto'` (instant) whenever reduced motion is requested. A visual-only\n * jump is a silent state change for screen-reader users, so focus follows\n * the scroll (Pillar 2).\n */\n scrollTo(id: string): void {\n const target = this.doc.getElementById(id);\n if (target === null) {\n return;\n }\n const behavior = this.reducedMotion() ? 'auto' : (this.cfg.scrollBehavior ?? 'smooth');\n target.scrollIntoView({ behavior });\n this.focusTarget(target);\n }\n\n /** Click / Enter handler: takes over the native anchor jump, scrolls, and announces the activation. */\n protected handleActivate(item: CngxTocItem, event?: Event): void {\n event?.preventDefault();\n this.scrollTo(item.id);\n this.activated.emit(item);\n }\n\n /**\n * Move focus to the scrolled-to section. `preventScroll` keeps `focus()`\n * from fighting the smooth `scrollIntoView` above with a second instant\n * jump. Section elements are consumer-owned DOM, so `tabindex=\"-1\"` is set\n * imperatively only when the element is not focusable by default and the\n * consumer set no `tabindex` - an author-set value is never overwritten.\n * That persistent attribute on borrowed DOM is the entry's tracked debt.\n */\n private focusTarget(target: HTMLElement): void {\n const needsTabindex = !target.hasAttribute('tabindex') && !this.isFocusableByDefault(target);\n if (needsTabindex) {\n target.setAttribute('tabindex', '-1');\n }\n target.focus({ preventScroll: true });\n }\n\n /** Elements that take focus without an author `tabindex`. */\n private isFocusableByDefault(el: HTMLElement): boolean {\n return /^(a|button|input|select|textarea|summary|iframe)$/i.test(el.tagName);\n }\n\n /** Depth-first collect of every id in the outline. */\n private collectIds(items: readonly CngxTocItem[], acc: string[] = []): string[] {\n for (const item of items) {\n acc.push(item.id);\n if (item.children?.length) {\n this.collectIds(item.children, acc);\n }\n }\n return acc;\n }\n\n /** Ancestor ids of the active leaf (path from root, excluding the leaf itself). */\n private computeTrail(): readonly string[] {\n const id = this.activeId();\n if (id === null) {\n return EMPTY_IDS;\n }\n const path = this.pathTo(id, this.resolvedItems());\n return path ? path.slice(0, -1) : EMPTY_IDS;\n }\n\n /** Root-to-target id path, or `null` when the id is not in the outline. */\n private pathTo(target: string, items: readonly CngxTocItem[]): readonly string[] | null {\n for (const item of items) {\n if (item.id === target) {\n return [item.id];\n }\n const childPath = item.children?.length ? this.pathTo(target, item.children) : null;\n if (childPath) {\n return [item.id, ...childPath];\n }\n }\n return null;\n }\n\n /**\n * Re-run the `[autoDiscover]` heading scan. No-op unless `[autoDiscover]` is\n * set and we are on the browser. Call it after injecting or removing sections\n * at runtime - discovery is one-shot by design, not a live observer.\n */\n refresh(): void {\n if (!this.autoDiscover() || !this.isBrowser) {\n return;\n }\n this.discovered.set(this.scanHeadings());\n }\n\n /** Walk the headings under `contentRoot` into a level-nested outline. */\n private scanHeadings(): readonly CngxTocItem[] {\n const rootSelector = this.contentRoot();\n let root: ParentNode = this.doc;\n if (rootSelector) {\n const matched = this.doc.querySelector(rootSelector);\n // A set-but-unmatched root scans nothing, not the whole document -\n // falling back to `doc` would sweep site chrome into the outline.\n if (matched === null) {\n return EMPTY_ITEMS;\n }\n root = matched;\n }\n const headings = Array.from(root.querySelectorAll<HTMLElement>(this.headingSelector()));\n if (headings.length === 0) {\n return EMPTY_ITEMS;\n }\n\n const roots: MutableItem[] = [];\n const stack: { level: number; node: MutableItem }[] = [];\n const used = new Set<string>();\n\n for (const el of headings) {\n const level = this.headingLevel(el);\n const node: MutableItem = { id: this.ensureId(el, used), label: this.headingLabel(el), children: [] };\n while (stack.length > 0 && stack[stack.length - 1].level >= level) {\n stack.pop();\n }\n const parent = stack[stack.length - 1];\n if (parent) {\n parent.node.children.push(node);\n } else {\n roots.push(node);\n }\n stack.push({ level, node });\n }\n\n return roots.map((node) => this.freeze(node));\n }\n\n /** Numeric level of a heading element (`h2` -> 2). Non-heading matches read as level 1. */\n private headingLevel(el: HTMLElement): number {\n const match = /^h([1-6])$/i.exec(el.tagName);\n return match ? Number(match[1]) : 1;\n }\n\n /** Visible text of a heading, collapsed to a single spaced line. */\n private headingLabel(el: HTMLElement): string {\n return (el.textContent ?? '').replace(/\\s+/g, ' ').trim();\n }\n\n /**\n * Return the heading's id, generating and writing a slug when it has none.\n * The write mutates consumer-owned DOM (tracked debt); an author-set id is\n * kept verbatim. Collisions against prior scan ids and existing document ids\n * get a `-2`, `-3`, ... suffix.\n */\n private ensureId(el: HTMLElement, used: Set<string>): string {\n if (el.id) {\n used.add(el.id);\n return el.id;\n }\n const base = this.slugify(this.headingLabel(el)) || 'section';\n let candidate = base;\n let n = 2;\n while (used.has(candidate) || this.doc.getElementById(candidate) !== null) {\n candidate = `${base}-${n++}`;\n }\n used.add(candidate);\n el.setAttribute('id', candidate);\n return candidate;\n }\n\n /** Lowercase, strip diacritics-free non-alphanumerics to hyphens, collapse and trim. */\n private slugify(text: string): string {\n return text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n }\n\n /** Freeze a mutable node into a CngxTocItem, dropping empty children arrays. */\n private freeze(node: MutableItem): CngxTocItem {\n if (node.children.length === 0) {\n return { id: node.id, label: node.label };\n }\n return { id: node.id, label: node.label, children: node.children.map((child) => this.freeze(child)) };\n }\n}\n","<nav\n class=\"cngx-toc__nav\"\n [attr.aria-label]=\"navLabel()\"\n [cngxScrollSpy]=\"flatIds()\"\n [root]=\"contentRoot()\"\n [rootMargin]=\"rootMargin()\"\n [threshold]=\"threshold()\"\n>\n <ng-container *ngTemplateOutlet=\"list; context: { $implicit: resolvedItems(), depth: 0 }\" />\n</nav>\n\n<ng-template #list let-nodes let-depth=\"depth\">\n <ul class=\"cngx-toc__list\" [style.--cngx-toc-depth]=\"depth\">\n @for (item of nodes; track item.id) {\n <li class=\"cngx-toc__item\" [attr.data-active-trail]=\"activeTrail().includes(item.id) ? '' : null\">\n <a\n class=\"cngx-toc__link\"\n [href]=\"'#' + item.id\"\n [attr.aria-current]=\"activeId() === item.id ? 'location' : null\"\n (click)=\"handleActivate(item, $event)\"\n >\n @if (resolvedItemTpl(); as tpl) {\n <ng-container\n *ngTemplateOutlet=\"\n tpl;\n context: { $implicit: item, active: activeId() === item.id, depth: depth }\n \"\n />\n } @else {\n {{ item.label }}\n }\n </a>\n @if (item.children?.length) {\n <ng-container\n *ngTemplateOutlet=\"list; context: { $implicit: item.children, depth: depth + 1 }\"\n />\n }\n </li>\n }\n </ul>\n</ng-template>\n","import { afterNextRender, Directive, inject } from '@angular/core';\nimport { outputToObservable, takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, Router } from '@angular/router';\n\nimport { CNGX_TOC } from './toc-token';\n\n/**\n * Dev-warning emitted when `@angular/router` is absent. A deliberate small\n * local copy of the `@cngx/common/layout` kernel's warning rather than a\n * shared import - sharing would force the helper onto a `public-api.ts`, and\n * `warn*` matches no approved public-API prefix (same call the tabs and\n * sidenav sync directives make).\n *\n * @internal\n */\nfunction warnRouterAbsent(directive: string, enables: string): void {\n console.warn(\n `${directive}: no Router available - directive is a no-op. ` +\n `Provide @angular/router via provideRouter(...) to enable ${enables}.`,\n );\n}\n\n/**\n * Deep-links a `CngxToc` into the URL fragment. Opt-in via\n * `[cngxTocRouterSync]` on the same host as `<cngx-toc>`: activating a link\n * writes `#<section-id>` (replacing the history entry, so a scroll-driven rail\n * never floods the back stack), and a deep link like `/guide#pricing` scrolls\n * to that section once on load.\n *\n * Reaches the rail through the {@link CNGX_TOC} contract token, never the\n * concrete `CngxToc` class. The activation subscription is torn down with the\n * directive via `takeUntilDestroyed` - an `OutputRef` subscription would\n * otherwise outlive route changes. Without `@angular/router` the directive\n * dev-warns once and no-ops.\n *\n * @category ui/toc\n * @docsKind primary\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/toc-router-sync.directive.ts\n * @since 0.1.0\n * @relatedTo CngxToc, CNGX_TOC\n * <example-url>http://localhost:4200/#/ui/toc/router/fragment-deep-link</example-url>\n */\n@Directive({\n selector: '[cngxTocRouterSync]',\n exportAs: 'cngxTocRouterSync',\n standalone: true,\n})\nexport class CngxTocRouterSync {\n private readonly toc = inject(CNGX_TOC, { host: true });\n private readonly router = inject(Router, { optional: true });\n private readonly route = inject(ActivatedRoute, { optional: true });\n\n constructor() {\n if (!this.router || !this.route) {\n afterNextRender(() => warnRouterAbsent('CngxTocRouterSync', 'fragment deep-linking'));\n return;\n }\n const router = this.router;\n\n // Write the fragment on every activation. replaceUrl keeps a scroll-driven\n // rail from pushing a history entry per section; 'merge' keeps the query\n // params a bare fragment navigate would otherwise wipe.\n outputToObservable(this.toc.activated)\n .pipe(takeUntilDestroyed())\n .subscribe((item) => {\n router\n .navigate([], { fragment: item.id, replaceUrl: true, queryParamsHandling: 'merge' })\n .catch(() => undefined);\n });\n\n // One-shot deep-link scroll: read the fragment present at load and bring\n // that section into view after the first render.\n const fragment = toSignal(this.route.fragment, {\n initialValue: this.route.snapshot.fragment,\n });\n afterNextRender(() => {\n const initial = fragment();\n if (initial) {\n this.toc.scrollTo(initial);\n }\n });\n }\n}\n","import type { Signal } from '@angular/core';\n\nimport type { CngxTocAriaLabels, CngxTocConfig } from './toc.config';\nimport type { CngxTocConfigFeature } from './provide-toc-config';\n\n/**\n * Override the toc's ARIA-string fallback - the accessible name of the `nav`\n * landmark that wraps the link list (default `'On this page'`). Pass a\n * `Signal` to switch the language at runtime.\n *\n * ```ts\n * provideTocConfig(withTocAriaLabels({ nav: 'Auf dieser Seite' }));\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function withTocAriaLabels(\n payload: CngxTocAriaLabels | Signal<CngxTocAriaLabels>,\n): CngxTocConfigFeature {\n return { kind: 'ariaLabels', payload };\n}\n\n/**\n * Set the app-wide default scroll behaviour used when a link is activated.\n * `'smooth'` by default; the organism still swaps to `'auto'` at runtime\n * whenever `prefers-reduced-motion: reduce` matches, so this only chooses the\n * motion-allowed behaviour.\n *\n * ```ts\n * provideTocConfig(withTocScrollBehavior('auto'));\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function withTocScrollBehavior(\n scrollBehavior: NonNullable<CngxTocConfig['scrollBehavior']>,\n): CngxTocConfigFeature {\n return { kind: 'scrollBehavior', payload: { scrollBehavior } };\n}\n\n/**\n * Move the app-wide `CngxScrollSpy` defaults - the `rootMargin` and\n * `threshold` the rail forwards to its internal spy. Per-instance\n * `[rootMargin]` / `[threshold]` bindings still win; this only sets the\n * cascade default (e.g. a fixed-header offset every toc should share).\n *\n * ```ts\n * provideTocConfig(withTocSpy({ rootMargin: '-80px 0px 0px 0px' }));\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function withTocSpy(payload: NonNullable<CngxTocConfig['spy']>): CngxTocConfigFeature {\n return { kind: 'spy', payload };\n}\n\n/**\n * Register a global default item template. Resolves after a per-instance\n * `*cngxTocItem` slot and before the built-in plain-label rendering, so every\n * un-slotted toc renders the same custom item markup.\n *\n * ```ts\n * @Component({\n * viewProviders: [provideTocConfigAt(withTocTemplates({ item: myItemTpl }))],\n * })\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function withTocTemplates(\n payload: NonNullable<CngxTocConfig['templates']>,\n): CngxTocConfigFeature {\n return { kind: 'templates', payload };\n}\n","import {\n inject,\n makeEnvironmentProviders,\n type EnvironmentProviders,\n type Provider,\n type Signal,\n} from '@angular/core';\nimport { createOverrideMerge } from '@cngx/core/utils';\n\nimport type { CngxTocAriaLabels, CngxTocConfig } from './toc.config';\nimport { CNGX_TOC_CONFIG, CNGX_TOC_DEFAULTS } from './toc.config.defaults';\n\nconst NO_ARIA_LABELS: CngxTocAriaLabels = {};\n\n/**\n * Discriminated-union shape returned by the toc config features -\n * `withTocAriaLabels`, `withTocScrollBehavior`, `withTocSpy`, and\n * `withTocTemplates`. The\n * reducer in `provideTocConfig` / `provideTocConfigAt` matches on `kind` and\n * merges `payload` into the corresponding config sub-tree. Mirrors\n * `CngxBreadcrumbConfigFeature` so the consumer's mental model is one across\n * feature areas.\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport type CngxTocConfigFeature =\n | {\n readonly kind: 'ariaLabels';\n readonly payload: CngxTocAriaLabels | Signal<CngxTocAriaLabels>;\n }\n | {\n readonly kind: 'scrollBehavior';\n readonly payload: { readonly scrollBehavior: NonNullable<CngxTocConfig['scrollBehavior']> };\n }\n | {\n readonly kind: 'spy';\n readonly payload: NonNullable<CngxTocConfig['spy']>;\n }\n | {\n readonly kind: 'templates';\n readonly payload: NonNullable<CngxTocConfig['templates']>;\n };\n\n/**\n * Reduces a list of feature objects into a partial config - last write wins\n * per sub-tree. Inner objects are spread-merged so partial overrides compose\n * cleanly with prior writes.\n *\n * @internal\n */\nfunction reduceFeatures(features: readonly CngxTocConfigFeature[]): Partial<CngxTocConfig> {\n const out: {\n ariaLabels?: CngxTocAriaLabels | Signal<CngxTocAriaLabels>;\n scrollBehavior?: NonNullable<CngxTocConfig['scrollBehavior']>;\n spy?: NonNullable<CngxTocConfig['spy']>;\n templates?: NonNullable<CngxTocConfig['templates']>;\n } = {};\n for (const f of features) {\n switch (f.kind) {\n case 'ariaLabels':\n out.ariaLabels = createOverrideMerge(out.ariaLabels ?? NO_ARIA_LABELS, f.payload);\n break;\n case 'scrollBehavior':\n out.scrollBehavior = f.payload.scrollBehavior;\n break;\n case 'spy':\n out.spy = { ...out.spy, ...f.payload };\n break;\n case 'templates':\n out.templates = { ...out.templates, ...f.payload };\n break;\n }\n }\n return out;\n}\n\n/**\n * Deep merge: the nested sub-trees (`ariaLabels` / `spy` / `templates`) are\n * spread-merged so a partial fills in missing keys without nuking unrelated\n * sub-trees; the flat scalar `scrollBehavior` takes the partial when present,\n * else the base. Inner objects are flat (one level), so a single spread per\n * key suffices.\n *\n * @internal\n */\nfunction mergeConfig(\n base: CngxTocConfig,\n partial: Partial<CngxTocConfig>,\n): CngxTocConfig {\n return {\n ariaLabels: createOverrideMerge(base.ariaLabels ?? NO_ARIA_LABELS, partial.ariaLabels),\n scrollBehavior: partial.scrollBehavior ?? base.scrollBehavior,\n spy: { ...base.spy, ...partial.spy },\n templates: { ...base.templates, ...partial.templates },\n };\n}\n\n/**\n * Application-root configuration cascade for the toc organism. Pass any\n * combination of `withTocAriaLabels`, `withTocScrollBehavior`, `withTocSpy`,\n * and `withTocTemplates` features in `bootstrapApplication`'s providers array.\n *\n * Resolution priority (high -> low):\n * 1. Per-instance Input binding.\n * 2. `provideTocConfigAt(...)` in a parent component's `viewProviders`.\n * 3. `provideTocConfig(...)` at the application root.\n * 4. Library defaults (`CNGX_TOC_DEFAULTS`).\n *\n * The provider deep-merges supplied features with the library defaults so\n * consumers only declare keys they want to override.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideTocConfig(\n * withTocAriaLabels({ nav: 'On this page' }),\n * withTocScrollBehavior('smooth'),\n * ),\n * ],\n * });\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function provideTocConfig(...features: CngxTocConfigFeature[]): EnvironmentProviders {\n // Empty-features: skip the override so the root factory's CNGX_TOC_DEFAULTS\n // reference flows through untouched. A fresh mergeConfig(...) would allocate\n // identical content under a new reference and bust identity comparisons.\n if (features.length === 0) {\n return makeEnvironmentProviders([]);\n }\n const partial = reduceFeatures(features);\n return makeEnvironmentProviders([\n {\n provide: CNGX_TOC_CONFIG,\n useValue: mergeConfig(CNGX_TOC_DEFAULTS, partial),\n },\n ]);\n}\n\n/**\n * Component-scoped configuration cascade for the toc organism. Pass any\n * combination of feature factories in a parent component's `viewProviders`\n * array.\n *\n * Unlike `provideTocConfig` (root-only), `provideTocConfigAt` injects the\n * parent injector's `CNGX_TOC_CONFIG` value (resolves through the priority\n * chain) and deep-merges the supplied features on top. Descendant toc\n * instances see the merged config; sibling sub-trees keep the inherited value.\n *\n * ```ts\n * @Component({\n * viewProviders: [provideTocConfigAt(withTocScrollBehavior('auto'))],\n * template: '<cngx-toc [items]=\"toc\" contentRoot=\"#article\" />',\n * })\n * class Guide {}\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function provideTocConfigAt(...features: CngxTocConfigFeature[]): Provider[] {\n // Empty-features call: parent value flows through untouched. Skipping the\n // factory preserves reference identity through the sub-tree.\n if (features.length === 0) {\n return [];\n }\n const partial = reduceFeatures(features);\n return [\n {\n provide: CNGX_TOC_CONFIG,\n useFactory: () => {\n const parent = inject(CNGX_TOC_CONFIG, { skipSelf: true });\n return mergeConfig(parent, partial);\n },\n },\n ];\n}\n","/**\n * @module @cngx/ui/toc\n */\n\nexport { CngxToc } from './toc.component';\nexport { CngxTocRouterSync } from './toc-router-sync.directive';\nexport { CngxTocItemSlot } from './toc-item-slot';\nexport { CNGX_TOC, type CngxTocContract } from './toc-token';\nexport type { CngxTocItem, CngxTocItemContext } from './toc.types';\nexport type { CngxTocAriaLabels, CngxTocConfig } from './config/toc.config';\nexport { CNGX_TOC_CONFIG, CNGX_TOC_DEFAULTS } from './config/toc.config.defaults';\nexport {\n withTocAriaLabels,\n withTocScrollBehavior,\n withTocSpy,\n withTocTemplates,\n} from './config/features';\nexport {\n provideTocConfig,\n provideTocConfigAt,\n type CngxTocConfigFeature,\n} from './config/provide-toc-config';\nexport { injectTocAriaLabels, injectTocConfig } from './config/inject-toc-config';\nexport { CNGX_TOC_LANGUAGE_EN, type CngxTocLanguageSection } from './i18n/toc-language-section';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAcA;;;;;;;AAOG;AACI,MAAM,oBAAoB,GAA2B;AAC1D,IAAA,GAAG,EAAE,cAAc;;;ACnBrB;;;AAGG;AACI,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,CAAC;;ACJnF;;;;;;;;;;;;;AAaG;AACI,MAAM,iBAAiB,GAAkB;AAC9C,IAAA,cAAc,EAAE,QAAQ;AACxB,IAAA,GAAG,EAAE;AACH,QAAA,UAAU,EAAE,KAAK;AACjB,QAAA,SAAS,EAAE,GAAG;AACf,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AG,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE;QACpC,SAAS,EAAE,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE;KACvD;AACH;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,SAAU,gBAAgB,CAAC,GAAG,QAAgC,EAAA;;;;AAIlE,IAAA,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACzB,QAAA,OAAO,wBAAwB,CAAC,EAAE,CAAC;IACrC;AACA,IAAA,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC;AACxC,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA;AACE,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,QAAQ,EAAE,WAAW,CAAC,iBAAiB,EAAE,OAAO,CAAC;AAClD,SAAA;AACF,KAAA,CAAC;AACJ;AAEA;;;;;;;;;;;;;;;;;;;;AAoBG;AACG,SAAU,kBAAkB,CAAC,GAAG,QAAgC,EAAA;;;AAGpE,IAAA,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACzB,QAAA,OAAO,EAAE;IACX;AACA,IAAA,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC;IACxC,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,eAAe;YACxB,UAAU,EAAE,MAAK;AACf,gBAAA,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC1D,gBAAA,OAAO,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC;YACrC,CAAC;AACF,SAAA;KACF;AACH;;ACnLA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cngx-ui-toc.mjs","sources":["../../../projects/ui/toc/i18n/toc-language-section.ts","../../../projects/ui/toc/i18n/toc-i18n.ts","../../../projects/ui/toc/config/toc.config.defaults.ts","../../../projects/ui/toc/config/inject-toc-config.ts","../../../projects/ui/toc/toc-item-slot.ts","../../../projects/ui/toc/toc-token.ts","../../../projects/ui/toc/toc.component.ts","../../../projects/ui/toc/toc.component.html","../../../projects/ui/toc/toc-router-sync.directive.ts","../../../projects/ui/toc/config/features.ts","../../../projects/ui/toc/config/provide-toc-config.ts","../../../projects/ui/toc/public-api.ts","../../../projects/ui/toc/cngx-ui-toc.ts"],"sourcesContent":["/**\n * The toc section of a {@link CngxLanguagePack}: the accessible names of\n * `CngxToc`. It feeds the `ariaLabels` of `CNGX_TOC_CONFIG`; a key set through\n * `withTocAriaLabels` still wins.\n *\n * @category ui/toc/i18n\n * @since 0.1.0\n * @relatedTo CNGX_TOC_CONFIG, withTocAriaLabels\n */\nexport interface CngxTocLanguageSection {\n /** Accessible name of the `nav` landmark. */\n readonly nav: string;\n}\n\n/**\n * The English toc section: the single source of the toc's English copy. The\n * `CNGX_TOC_CONFIG` labels default to it.\n *\n * @category ui/toc/i18n\n * @since 0.1.0\n * @relatedTo CNGX_TOC_CONFIG\n */\nexport const CNGX_TOC_LANGUAGE_EN: CngxTocLanguageSection = {\n nav: 'On this page',\n};\n\ndeclare module '@cngx/core/i18n' {\n interface CngxLanguagePack {\n readonly toc: CngxTocLanguageSection;\n }\n}\n","import { createLanguageSection } from '@cngx/core/i18n';\n\nimport { CNGX_TOC_LANGUAGE_EN } from './toc-language-section';\n\n/**\n * @internal The toc section of the active pack over the English section,\n * shared app-wide. Consumers override copy through `withTocAriaLabels`.\n */\nexport const injectTocSiteCopy = createLanguageSection('toc', CNGX_TOC_LANGUAGE_EN);\n","import { InjectionToken } from '@angular/core';\n\nimport type { CngxTocConfig } from './toc.config';\n\n/**\n * Library defaults for the toc configuration cascade. Carries no copy: the\n * `ariaLabels` defaults are the `toc` section of the language pack; single\n * keys ride the `withTocAriaLabels` feature. The spy defaults (`rootMargin` / `threshold`) mirror\n * `CngxScrollSpy`'s own input defaults so an un-configured toc tracks\n * scrolling identically to a hand-wired spy.\n *\n * Exported for intra-lib consumers (`provideTocConfig` deep-merges with this\n * base) but **NOT** re-exported from `public-api.ts` - downstream consumers\n * reach the defaults via `inject(CNGX_TOC_CONFIG)` so `provideTocConfig` /\n * `provideTocConfigAt` overrides take precedence.\n *\n * @internal\n */\nexport const CNGX_TOC_DEFAULTS: CngxTocConfig = {\n scrollBehavior: 'smooth',\n spy: {\n rootMargin: '0px',\n threshold: 0.3,\n },\n};\n\n/**\n * App-wide configuration cascade for the table-of-contents organism. Resolves\n * in priority order:\n *\n * 1. Per-instance Input binding.\n * 2. `provideTocConfigAt(...)` in a parent component's `viewProviders`.\n * 3. `provideTocConfig(...)` at the application root.\n * 4. Library defaults (this token's `factory`).\n *\n * `providedIn: 'root'` with a default factory means consumers never need to\n * provide the token explicitly - `inject(CNGX_TOC_CONFIG)` always resolves.\n * Consumers who want overrides call `provideTocConfig(...)` in\n * `bootstrapApplication` providers (root cascade) or `provideTocConfigAt(...)`\n * in a component's `viewProviders` (sub-tree cascade).\n *\n * @category ui/toc\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/config/toc.config.defaults.ts\n * @since 0.1.0\n */\nexport const CNGX_TOC_CONFIG = new InjectionToken<CngxTocConfig>('CNGX_TOC_CONFIG', {\n providedIn: 'root',\n factory: () => CNGX_TOC_DEFAULTS,\n});\n","import { inject, type Signal } from '@angular/core';\nimport { createFilledOverrideMerge } from '@cngx/core/utils';\n\nimport { injectTocSiteCopy } from '../i18n/toc-i18n';\nimport type { CngxTocAriaLabels, CngxTocConfig } from './toc.config';\nimport { CNGX_TOC_CONFIG } from './toc.config.defaults';\n\n/**\n * Convenience accessor for the toc configuration cascade. Runs in injection\n * context; resolves through the priority chain (per-instance Input ->\n * `provideTocConfigAt` -> `provideTocConfig` -> library defaults). Equivalent\n * to `inject(CNGX_TOC_CONFIG)` - the helper exists so consumers don't import\n * the token directly. Mirrors `injectBreadcrumbConfig`.\n *\n * ```ts\n * export class CngxToc {\n * private readonly cfg = injectTocConfig();\n * protected readonly navLabel = computed(() => this.cfg.ariaLabels?.nav ?? 'On this page');\n * }\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function injectTocConfig(): CngxTocConfig {\n return inject(CNGX_TOC_CONFIG);\n}\n\n/**\n * The resolved accessible names of the toc config in scope, every key the\n * config leaves unset (also a key an override sets to `undefined`) filled from\n * the `toc` section of the active pack, as a Signal that follows a runtime\n * language switch. Runs in injection context; read it inside a `computed()`, a template\n * or a handler.\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function injectTocAriaLabels(): Signal<Required<CngxTocAriaLabels>> {\n return createFilledOverrideMerge(injectTocSiteCopy(), injectTocConfig().ariaLabels);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxTocItemContext } from './toc.types';\n\n/**\n * Per-item template slot for `CngxToc`. Project an `<ng-template cngxTocItem>`\n * inside `<cngx-toc>` to replace the built-in plain-label rendering with\n * custom markup - the `let-` variables come out typed via\n * `ngTemplateContextGuard`:\n *\n * ```html\n * <cngx-toc [items]=\"toc\" contentRoot=\"#article\">\n * <ng-template cngxTocItem let-item let-active=\"active\" let-depth=\"depth\">\n * <span [class.is-active]=\"active\">{{ item.label }}</span>\n * @if (depth === 0) { <cngx-badge>{{ item.children?.length }}</cngx-badge> }\n * </ng-template>\n * </cngx-toc>\n * ```\n *\n * Named `CngxTocItemSlot` (not `*Directive`) per the repo's no-artifact-suffix\n * rule; the selector stays `cngxTocItem`, which is what consumers write.\n * Resolves ahead of `CNGX_TOC_CONFIG.templates.item` and the built-in label.\n *\n * @category ui/toc\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/toc-item-slot.ts\n * @since 0.1.0\n * @relatedTo CngxToc\n * <example-url>http://localhost:4200/#/ui/toc/slots/custom-item-template</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxTocItem]',\n standalone: true,\n exportAs: 'cngxTocItem',\n})\nexport class CngxTocItemSlot {\n readonly templateRef = inject<TemplateRef<CngxTocItemContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _dir: CngxTocItemSlot,\n ctx: unknown,\n ): ctx is CngxTocItemContext {\n return true;\n }\n}\n","import { InjectionToken, type OutputRef, type Signal } from '@angular/core';\n\nimport type { CngxTocItem } from './toc.types';\n\n/**\n * Minimal contract a toc rail exposes to its collaborators (the opt-in\n * `CngxTocRouterSync` fragment directive): the active-section signal it\n * derives, the activation output it emits, and the imperative `scrollTo`\n * it owns. Injected via {@link CNGX_TOC} + `useExisting`, never by injecting\n * the concrete `CngxToc` class - that would create a cyclic type dependency\n * and block the decompose brain/skin split.\n *\n * Direction mirrors `CNGX_SIDENAV`, not `CNGX_BREADCRUMB_ITEMS_SOURCE`: the\n * rail owns the state (`activeId`, `scrollTo`) and the collaborator consumes\n * it, so the toc *provides* the token and the sync directive *injects* it.\n *\n * @category ui/toc\n * @since 0.1.0\n * @relatedTo CngxToc, CngxTocRouterSync\n */\nexport interface CngxTocContract {\n /** The section currently most visible, or `null` before the spy resolves. */\n readonly activeId: Signal<string | null>;\n /** Fires when a link is activated (click / Enter), carrying its item. */\n readonly activated: OutputRef<CngxTocItem>;\n /** Scroll the section with this id into view and move focus to it. */\n scrollTo(id: string): void;\n}\n\n/**\n * Contract token for a toc rail. `CngxToc` provides it via\n * `{ provide: CNGX_TOC, useExisting: CngxToc }`, so a collaborator injects the\n * narrow {@link CngxTocContract} instead of the concrete class.\n *\n * @category ui/toc\n * @since 0.1.0\n * @relatedTo CngxToc, CngxTocRouterSync\n */\nexport const CNGX_TOC = new InjectionToken<CngxTocContract>('CNGX_TOC');\n","import { DOCUMENT, isPlatformBrowser, NgTemplateOutlet } from '@angular/common';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n DestroyRef,\n effect,\n inject,\n input,\n output,\n PLATFORM_ID,\n signal,\n ViewEncapsulation,\n viewChild,\n type Signal,\n} from '@angular/core';\nimport { arrayEqual } from '@cngx/utils';\nimport { CngxScrollSpy, injectMediaQuery } from '@cngx/common/layout';\n\nimport { injectTocAriaLabels, injectTocConfig } from './config/inject-toc-config';\nimport { CngxTocItemSlot } from './toc-item-slot';\nimport { CNGX_TOC, type CngxTocContract } from './toc-token';\nimport type { CngxTocItem } from './toc.types';\n\n/** Shared empty result so the no-active-section trail is reference-stable. */\nconst EMPTY_IDS: readonly string[] = [];\n\n/** Shared empty outline so the pre-scan / no-headings state is reference-stable. */\nconst EMPTY_ITEMS: readonly CngxTocItem[] = [];\n\n/** Mutable node used while building the discovered tree, before it is frozen to CngxTocItem. */\ninterface MutableItem {\n id: string;\n label: string;\n children: MutableItem[];\n}\n\n/**\n * Structural compare of two discovered outlines (id + label + nesting). Guards\n * the `discovered` signal so a re-scan of unchanged headings keeps the same\n * reference and never re-stamps the outline outlet.\n */\nfunction itemsEqual(a: readonly CngxTocItem[], b: readonly CngxTocItem[]): boolean {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n const x = a[i];\n const y = b[i];\n if (x.id !== y.id || x.label !== y.label) {\n return false;\n }\n if (!itemsEqual(x.children ?? EMPTY_ITEMS, y.children ?? EMPTY_ITEMS)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * \"On this page\" navigation rail. Renders a `<nav>` of anchor links from a\n * {@link CngxTocItem} outline, tracks the most-visible section through an\n * internal {@link CngxScrollSpy}, and communicates the active link via\n * `aria-current` inside the `computed()` graph. Nested items render as\n * indented sub-lists; native link semantics and tab order stay intact (a toc\n * is a navigation landmark of links, not a treeview).\n *\n * Composition over configuration: the spy is bound in this component's own\n * template rather than via `hostDirectives`, because the organism - not the\n * consumer - owns the flat id list the spy observes, and `[cngxScrollSpy]` is\n * a required input. The spy resolves its targets through `getElementById`, so\n * its host placement is irrelevant to its function.\n *\n * @category ui/toc\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/toc.component.ts\n * @since 0.1.0\n * @relatedTo CngxScrollSpy, CngxTocRouterSync, CngxSidenav\n * <example-url>http://localhost:4200/#/ui/toc/basic/on-this-page-rail</example-url>\n * <example-url>http://localhost:4200/#/ui/toc/auto/heading-auto-discovery</example-url>\n * @slot cngxTocItem Replaces the plain label inside each item's link at every depth, ahead of CNGX_TOC_CONFIG.templates.item; gets the item as $implicit, plus active and the zero-based depth.\n */\n@Component({\n selector: 'cngx-toc',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [NgTemplateOutlet, CngxScrollSpy],\n providers: [{ provide: CNGX_TOC, useExisting: CngxToc }],\n templateUrl: './toc.component.html',\n styleUrl: './toc.component.css',\n})\nexport class CngxToc implements CngxTocContract {\n private readonly doc = inject(DOCUMENT);\n private readonly cfg = injectTocConfig();\n private readonly ariaLabels = injectTocAriaLabels();\n private readonly reducedMotion = injectMediaQuery('(prefers-reduced-motion: reduce)');\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /**\n * The outline to render. Tree-shaped; nested `children` become sub-lists.\n * Ignored when `[autoDiscover]` is set - the headings under `contentRoot`\n * become the outline instead.\n */\n readonly items = input<readonly CngxTocItem[]>(EMPTY_ITEMS);\n /**\n * Derive the outline from the heading elements under `contentRoot` instead\n * of a hand-maintained `[items]` array. Headings nest by their level\n * (`h2 > h3`), and a heading with no `id` gets a slugified one written onto\n * it so the link can target it. Scans once after the first render; call\n * {@link refresh} after you inject or remove sections at runtime.\n */\n readonly autoDiscover = input(false, { transform: booleanAttribute });\n /** Which headings `[autoDiscover]` collects, in CSS-selector form. */\n readonly headingSelector = input<string>('h2, h3');\n /**\n * CSS selector for the scroll container the spy observes. `null` (default)\n * uses the viewport. Forwarded to the spy's `[root]`; also the root the\n * `[autoDiscover]` scan walks for headings.\n */\n readonly contentRoot = input<string | null>(null);\n /** Root margin forwarded to the spy. Defaults to the config cascade. */\n readonly rootMargin = input<string>(this.cfg.spy?.rootMargin ?? '0px');\n /** Minimum visibility ratio forwarded to the spy. Defaults to the config cascade. */\n readonly threshold = input<number>(this.cfg.spy?.threshold ?? 0.3);\n\n /** Fires when a link is activated (click / Enter). */\n readonly activated = output<CngxTocItem>();\n\n private readonly spy = viewChild(CngxScrollSpy);\n private readonly itemSlot = contentChild(CngxTocItemSlot);\n\n /** Headings discovered by the last `[autoDiscover]` scan. */\n private readonly discovered = signal<readonly CngxTocItem[]>(EMPTY_ITEMS, { equal: itemsEqual });\n\n /** The outline actually rendered: the discovered headings when `[autoDiscover]` is on, else `[items]`. */\n protected readonly resolvedItems = computed(() =>\n this.autoDiscover() ? this.discovered() : this.items(),\n );\n\n /** Accessible name of the `nav` landmark, from the config cascade; follows a language switch. */\n protected readonly navLabel = computed(() => this.ariaLabels().nav);\n\n /**\n * Depth-first flat id list feeding `[cngxScrollSpy]`. `equal: arrayEqual`\n * keeps the reference stable across same-shape re-sets so a re-render does\n * not re-create the observer.\n */\n protected readonly flatIds = computed(() => this.collectIds(this.resolvedItems()), {\n equal: arrayEqual,\n });\n\n constructor() {\n // Re-scan whenever the discovery inputs change. The DOM read + discovered\n // write are deferred to a microtask so no signal is written during effect\n // execution (Pillar 1) and the just-rendered content has settled - the same\n // queueMicrotask discipline the panel-lifecycle focus restore uses. The\n // destroyed guard keeps a microtask queued right before teardown from\n // scanning a detached DOM.\n let destroyed = false;\n inject(DestroyRef).onDestroy(() => {\n destroyed = true;\n });\n effect(() => {\n if (!this.autoDiscover()) {\n return;\n }\n this.contentRoot();\n this.headingSelector();\n queueMicrotask(() => {\n if (!destroyed) {\n this.refresh();\n }\n });\n });\n }\n\n /**\n * The active section, or `null`. `viewChild` is a view query, so `spy()` is\n * `undefined` during the creation pass; `?? null` makes that an explicit\n * value every downstream computed is defined at.\n */\n readonly activeId: Signal<string | null> = computed(() => this.spy()?.activeId() ?? null);\n\n /**\n * Ancestor-id chain of the active leaf - the parent links that get\n * `data-active-trail`. Same `equal` as `flatIds`: an array-valued computed\n * feeding an attribute binding must not allocate a fresh array every spy\n * tick (reference_signal_architecture Equality Rule).\n */\n protected readonly activeTrail = computed(() => this.computeTrail(), { equal: arrayEqual });\n\n /** Resolved item template: instance slot -> config default -> built-in label. */\n protected readonly resolvedItemTpl = computed(\n () => this.itemSlot()?.templateRef ?? this.cfg.templates?.item ?? null,\n );\n\n /**\n * Scroll the section with this id into view and move focus to it. Honours\n * `prefers-reduced-motion` - the configured `scrollBehavior` is swapped for\n * `'auto'` (instant) whenever reduced motion is requested. A visual-only\n * jump is a silent state change for screen-reader users, so focus follows\n * the scroll (Pillar 2).\n */\n scrollTo(id: string): void {\n const target = this.doc.getElementById(id);\n if (target === null) {\n return;\n }\n const behavior = this.reducedMotion() ? 'auto' : (this.cfg.scrollBehavior ?? 'smooth');\n target.scrollIntoView({ behavior });\n this.focusTarget(target);\n }\n\n /** Click / Enter handler: takes over the native anchor jump, scrolls, and announces the activation. */\n protected handleActivate(item: CngxTocItem, event?: Event): void {\n event?.preventDefault();\n this.scrollTo(item.id);\n this.activated.emit(item);\n }\n\n /**\n * Move focus to the scrolled-to section. `preventScroll` keeps `focus()`\n * from fighting the smooth `scrollIntoView` above with a second instant\n * jump. Section elements are consumer-owned DOM, so `tabindex=\"-1\"` is set\n * imperatively only when the element is not focusable by default and the\n * consumer set no `tabindex` - an author-set value is never overwritten.\n * That persistent attribute on borrowed DOM is the entry's tracked debt.\n */\n private focusTarget(target: HTMLElement): void {\n const needsTabindex = !target.hasAttribute('tabindex') && !this.isFocusableByDefault(target);\n if (needsTabindex) {\n target.setAttribute('tabindex', '-1');\n }\n target.focus({ preventScroll: true });\n }\n\n /** Elements that take focus without an author `tabindex`. */\n private isFocusableByDefault(el: HTMLElement): boolean {\n return /^(a|button|input|select|textarea|summary|iframe)$/i.test(el.tagName);\n }\n\n /** Depth-first collect of every id in the outline. */\n private collectIds(items: readonly CngxTocItem[], acc: string[] = []): string[] {\n for (const item of items) {\n acc.push(item.id);\n if (item.children?.length) {\n this.collectIds(item.children, acc);\n }\n }\n return acc;\n }\n\n /** Ancestor ids of the active leaf (path from root, excluding the leaf itself). */\n private computeTrail(): readonly string[] {\n const id = this.activeId();\n if (id === null) {\n return EMPTY_IDS;\n }\n const path = this.pathTo(id, this.resolvedItems());\n return path ? path.slice(0, -1) : EMPTY_IDS;\n }\n\n /** Root-to-target id path, or `null` when the id is not in the outline. */\n private pathTo(target: string, items: readonly CngxTocItem[]): readonly string[] | null {\n for (const item of items) {\n if (item.id === target) {\n return [item.id];\n }\n const childPath = item.children?.length ? this.pathTo(target, item.children) : null;\n if (childPath) {\n return [item.id, ...childPath];\n }\n }\n return null;\n }\n\n /**\n * Re-run the `[autoDiscover]` heading scan. No-op unless `[autoDiscover]` is\n * set and we are on the browser. Call it after injecting or removing sections\n * at runtime - discovery is one-shot by design, not a live observer.\n */\n refresh(): void {\n if (!this.autoDiscover() || !this.isBrowser) {\n return;\n }\n this.discovered.set(this.scanHeadings());\n }\n\n /** Walk the headings under `contentRoot` into a level-nested outline. */\n private scanHeadings(): readonly CngxTocItem[] {\n const rootSelector = this.contentRoot();\n let root: ParentNode = this.doc;\n if (rootSelector) {\n const matched = this.doc.querySelector(rootSelector);\n // A set-but-unmatched root scans nothing, not the whole document -\n // falling back to `doc` would sweep site chrome into the outline.\n if (matched === null) {\n return EMPTY_ITEMS;\n }\n root = matched;\n }\n const headings = Array.from(root.querySelectorAll<HTMLElement>(this.headingSelector()));\n if (headings.length === 0) {\n return EMPTY_ITEMS;\n }\n\n const roots: MutableItem[] = [];\n const stack: { level: number; node: MutableItem }[] = [];\n const used = new Set<string>();\n\n for (const el of headings) {\n const level = this.headingLevel(el);\n const node: MutableItem = { id: this.ensureId(el, used), label: this.headingLabel(el), children: [] };\n while (stack.length > 0 && stack[stack.length - 1].level >= level) {\n stack.pop();\n }\n const parent = stack[stack.length - 1];\n if (parent) {\n parent.node.children.push(node);\n } else {\n roots.push(node);\n }\n stack.push({ level, node });\n }\n\n return roots.map((node) => this.freeze(node));\n }\n\n /** Numeric level of a heading element (`h2` -> 2). Non-heading matches read as level 1. */\n private headingLevel(el: HTMLElement): number {\n const match = /^h([1-6])$/i.exec(el.tagName);\n return match ? Number(match[1]) : 1;\n }\n\n /** Visible text of a heading, collapsed to a single spaced line. */\n private headingLabel(el: HTMLElement): string {\n return (el.textContent ?? '').replace(/\\s+/g, ' ').trim();\n }\n\n /**\n * Return the heading's id, generating and writing a slug when it has none.\n * The write mutates consumer-owned DOM (tracked debt); an author-set id is\n * kept verbatim. Collisions against prior scan ids and existing document ids\n * get a `-2`, `-3`, ... suffix.\n */\n private ensureId(el: HTMLElement, used: Set<string>): string {\n if (el.id) {\n used.add(el.id);\n return el.id;\n }\n const base = this.slugify(this.headingLabel(el)) || 'section';\n let candidate = base;\n let n = 2;\n while (used.has(candidate) || this.doc.getElementById(candidate) !== null) {\n candidate = `${base}-${n++}`;\n }\n used.add(candidate);\n el.setAttribute('id', candidate);\n return candidate;\n }\n\n /** Lowercase, strip diacritics-free non-alphanumerics to hyphens, collapse and trim. */\n private slugify(text: string): string {\n return text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n }\n\n /** Freeze a mutable node into a CngxTocItem, dropping empty children arrays. */\n private freeze(node: MutableItem): CngxTocItem {\n if (node.children.length === 0) {\n return { id: node.id, label: node.label };\n }\n return { id: node.id, label: node.label, children: node.children.map((child) => this.freeze(child)) };\n }\n}\n","<nav\n class=\"cngx-toc__nav\"\n [attr.aria-label]=\"navLabel()\"\n [cngxScrollSpy]=\"flatIds()\"\n [root]=\"contentRoot()\"\n [rootMargin]=\"rootMargin()\"\n [threshold]=\"threshold()\"\n>\n <ng-container *ngTemplateOutlet=\"list; context: { $implicit: resolvedItems(), depth: 0 }\" />\n</nav>\n\n<ng-template #list let-nodes let-depth=\"depth\">\n <ul class=\"cngx-toc__list\" [style.--cngx-toc-depth]=\"depth\">\n @for (item of nodes; track item.id) {\n <li class=\"cngx-toc__item\" [attr.data-active-trail]=\"activeTrail().includes(item.id) ? '' : null\">\n <a\n class=\"cngx-toc__link\"\n [href]=\"'#' + item.id\"\n [attr.aria-current]=\"activeId() === item.id ? 'location' : null\"\n (click)=\"handleActivate(item, $event)\"\n >\n @if (resolvedItemTpl(); as tpl) {\n <ng-container\n *ngTemplateOutlet=\"\n tpl;\n context: { $implicit: item, active: activeId() === item.id, depth: depth }\n \"\n />\n } @else {\n {{ item.label }}\n }\n </a>\n @if (item.children?.length) {\n <ng-container\n *ngTemplateOutlet=\"list; context: { $implicit: item.children, depth: depth + 1 }\"\n />\n }\n </li>\n }\n </ul>\n</ng-template>\n","import { afterNextRender, Directive, inject } from '@angular/core';\nimport { outputToObservable, takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { CngxRuntimeError, cngxDevWarn } from '@cngx/utils';\n\nimport { CNGX_TOC, type CngxTocContract } from './toc-token';\n\n/**\n * Dev-warning emitted when `@angular/router` is absent. A deliberate small\n * local copy of the `@cngx/common/layout` kernel's warning rather than a\n * shared import - sharing would force the helper onto a `public-api.ts`, and\n * `warn*` matches no approved public-API prefix (same call the tabs and\n * sidenav sync directives make).\n *\n * @internal\n */\nfunction warnRouterAbsent(selector: string, enables: string): void {\n if (!(typeof ngDevMode !== 'undefined' && ngDevMode)) {\n return;\n }\n cngxDevWarn(\n 'CNGX3001',\n `[${selector}] no Router / ActivatedRoute available - directive is a no-op. ` +\n `Provide @angular/router via provideRouter(...) to enable ${enables}.`,\n );\n}\n\n/**\n * Deep-links a `CngxToc` into the URL fragment. Opt-in via\n * `[cngxTocRouterSync]` on the same host as `<cngx-toc>`: activating a link\n * writes `#<section-id>` (replacing the history entry, so a scroll-driven rail\n * never floods the back stack), and a deep link like `/guide#pricing` scrolls\n * to that section once on load.\n *\n * Reaches the rail through the {@link CNGX_TOC} contract token, never the\n * concrete `CngxToc` class. The activation subscription is torn down with the\n * directive via `takeUntilDestroyed` - an `OutputRef` subscription would\n * otherwise outlive route changes. Without `@angular/router` the directive\n * dev-warns once and no-ops.\n *\n * @category ui/toc\n * @docsKind primary\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/toc/toc-router-sync.directive.ts\n * @since 0.1.0\n * @relatedTo CngxToc, CNGX_TOC\n * <example-url>http://localhost:4200/#/ui/toc/router/fragment-deep-link</example-url>\n */\n@Directive({\n selector: '[cngxTocRouterSync]',\n exportAs: 'cngxTocRouterSync',\n standalone: true,\n})\nexport class CngxTocRouterSync {\n private readonly toc = injectRouterSyncToc();\n private readonly router = inject(Router, { optional: true });\n private readonly route = inject(ActivatedRoute, { optional: true });\n\n constructor() {\n if (!this.router || !this.route) {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n afterNextRender(() => warnRouterAbsent('cngxTocRouterSync', 'fragment deep-linking'));\n }\n return;\n }\n const router = this.router;\n\n // Write the fragment on every activation. replaceUrl keeps a scroll-driven\n // rail from pushing a history entry per section; 'merge' keeps the query\n // params a bare fragment navigate would otherwise wipe.\n outputToObservable(this.toc.activated)\n .pipe(takeUntilDestroyed())\n .subscribe((item) => {\n router\n .navigate([], { fragment: item.id, replaceUrl: true, queryParamsHandling: 'merge' })\n .catch(() => undefined);\n });\n\n // One-shot deep-link scroll: read the fragment present at load and bring\n // that section into view after the first render.\n const fragment = toSignal(this.route.fragment, {\n initialValue: this.route.snapshot.fragment,\n });\n afterNextRender(() => {\n const initial = fragment();\n if (initial) {\n this.toc.scrollTo(initial);\n }\n });\n }\n}\n\nfunction injectRouterSyncToc(): CngxTocContract {\n const toc = inject(CNGX_TOC, { host: true, optional: true });\n if (!toc) {\n throw new CngxRuntimeError(\n 'CNGX3021',\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n '[cngxTocRouterSync] must be placed on or inside <cngx-toc>.',\n );\n }\n return toc;\n}\n","import type { Signal } from '@angular/core';\n\nimport type { CngxTocAriaLabels, CngxTocConfig } from './toc.config';\nimport type { CngxTocConfigFeature } from './provide-toc-config';\n\n/**\n * Override the toc's ARIA-string fallback - the accessible name of the `nav`\n * landmark that wraps the link list (default `'On this page'`). Pass a\n * `Signal` to switch the language at runtime.\n *\n * ```ts\n * provideTocConfig(withTocAriaLabels({ nav: 'Auf dieser Seite' }));\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function withTocAriaLabels(\n payload: CngxTocAriaLabels | Signal<CngxTocAriaLabels>,\n): CngxTocConfigFeature {\n return { kind: 'ariaLabels', payload };\n}\n\n/**\n * Set the app-wide default scroll behaviour used when a link is activated.\n * `'smooth'` by default; the organism still swaps to `'auto'` at runtime\n * whenever `prefers-reduced-motion: reduce` matches, so this only chooses the\n * motion-allowed behaviour.\n *\n * ```ts\n * provideTocConfig(withTocScrollBehavior('auto'));\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function withTocScrollBehavior(\n scrollBehavior: NonNullable<CngxTocConfig['scrollBehavior']>,\n): CngxTocConfigFeature {\n return { kind: 'scrollBehavior', payload: { scrollBehavior } };\n}\n\n/**\n * Move the app-wide `CngxScrollSpy` defaults - the `rootMargin` and\n * `threshold` the rail forwards to its internal spy. Per-instance\n * `[rootMargin]` / `[threshold]` bindings still win; this only sets the\n * cascade default (e.g. a fixed-header offset every toc should share).\n *\n * ```ts\n * provideTocConfig(withTocSpy({ rootMargin: '-80px 0px 0px 0px' }));\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function withTocSpy(payload: NonNullable<CngxTocConfig['spy']>): CngxTocConfigFeature {\n return { kind: 'spy', payload };\n}\n\n/**\n * Register a global default item template. Resolves after a per-instance\n * `*cngxTocItem` slot and before the built-in plain-label rendering, so every\n * un-slotted toc renders the same custom item markup.\n *\n * A `TemplateRef` exists only once a view renders, so it cannot go into\n * `viewProviders` or the root providers. Build the scope from the rendered\n * template and hand it to `ngTemplateOutlet`:\n *\n * ```ts\n * private readonly injector = inject(Injector);\n * private readonly itemTpl = viewChild.required<TemplateRef<CngxTocItemContext>>('tocItem');\n * protected readonly tocScope = computed(() =>\n * Injector.create({\n * parent: this.injector,\n * providers: [provideTocConfigAt(withTocTemplates({ item: this.itemTpl() }))],\n * }),\n * );\n * // <ng-container *ngTemplateOutlet=\"tocTpl; injector: tocScope()\" />\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function withTocTemplates(\n payload: NonNullable<CngxTocConfig['templates']>,\n): CngxTocConfigFeature {\n return { kind: 'templates', payload };\n}\n","import {\n inject,\n makeEnvironmentProviders,\n type EnvironmentProviders,\n type Provider,\n type Signal,\n} from '@angular/core';\nimport { createOverrideMerge } from '@cngx/core/utils';\n\nimport type { CngxTocAriaLabels, CngxTocConfig } from './toc.config';\nimport { CNGX_TOC_CONFIG, CNGX_TOC_DEFAULTS } from './toc.config.defaults';\n\nconst NO_ARIA_LABELS: CngxTocAriaLabels = {};\n\n/**\n * Discriminated-union shape returned by the toc config features -\n * `withTocAriaLabels`, `withTocScrollBehavior`, `withTocSpy`, and\n * `withTocTemplates`. The\n * reducer in `provideTocConfig` / `provideTocConfigAt` matches on `kind` and\n * merges `payload` into the corresponding config sub-tree. Mirrors\n * `CngxBreadcrumbConfigFeature` so the consumer's mental model is one across\n * feature areas.\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport type CngxTocConfigFeature =\n | {\n readonly kind: 'ariaLabels';\n readonly payload: CngxTocAriaLabels | Signal<CngxTocAriaLabels>;\n }\n | {\n readonly kind: 'scrollBehavior';\n readonly payload: { readonly scrollBehavior: NonNullable<CngxTocConfig['scrollBehavior']> };\n }\n | {\n readonly kind: 'spy';\n readonly payload: NonNullable<CngxTocConfig['spy']>;\n }\n | {\n readonly kind: 'templates';\n readonly payload: NonNullable<CngxTocConfig['templates']>;\n };\n\n/**\n * Reduces a list of feature objects into a partial config - last write wins\n * per sub-tree. Inner objects are spread-merged so partial overrides compose\n * cleanly with prior writes.\n *\n * @internal\n */\nfunction reduceFeatures(features: readonly CngxTocConfigFeature[]): Partial<CngxTocConfig> {\n const out: {\n ariaLabels?: CngxTocAriaLabels | Signal<CngxTocAriaLabels>;\n scrollBehavior?: NonNullable<CngxTocConfig['scrollBehavior']>;\n spy?: NonNullable<CngxTocConfig['spy']>;\n templates?: NonNullable<CngxTocConfig['templates']>;\n } = {};\n for (const f of features) {\n switch (f.kind) {\n case 'ariaLabels':\n out.ariaLabels = createOverrideMerge(out.ariaLabels ?? NO_ARIA_LABELS, f.payload);\n break;\n case 'scrollBehavior':\n out.scrollBehavior = f.payload.scrollBehavior;\n break;\n case 'spy':\n out.spy = { ...out.spy, ...f.payload };\n break;\n case 'templates':\n out.templates = { ...out.templates, ...f.payload };\n break;\n }\n }\n return out;\n}\n\n/**\n * Deep merge: the nested sub-trees (`ariaLabels` / `spy` / `templates`) are\n * spread-merged so a partial fills in missing keys without nuking unrelated\n * sub-trees; the flat scalar `scrollBehavior` takes the partial when present,\n * else the base. Inner objects are flat (one level), so a single spread per\n * key suffices.\n *\n * @internal\n */\nfunction mergeConfig(\n base: CngxTocConfig,\n partial: Partial<CngxTocConfig>,\n): CngxTocConfig {\n return {\n ariaLabels: createOverrideMerge(base.ariaLabels ?? NO_ARIA_LABELS, partial.ariaLabels),\n scrollBehavior: partial.scrollBehavior ?? base.scrollBehavior,\n spy: { ...base.spy, ...partial.spy },\n templates: { ...base.templates, ...partial.templates },\n };\n}\n\n/**\n * Application-root configuration cascade for the toc organism. Pass any\n * combination of `withTocAriaLabels`, `withTocScrollBehavior`, `withTocSpy`,\n * and `withTocTemplates` features in `bootstrapApplication`'s providers array.\n *\n * Resolution priority (high -> low):\n * 1. Per-instance Input binding.\n * 2. `provideTocConfigAt(...)` in a parent component's `viewProviders`.\n * 3. `provideTocConfig(...)` at the application root.\n * 4. Library defaults (`CNGX_TOC_DEFAULTS`).\n *\n * The provider deep-merges supplied features with the library defaults so\n * consumers only declare keys they want to override.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideTocConfig(\n * withTocAriaLabels({ nav: 'On this page' }),\n * withTocScrollBehavior('smooth'),\n * ),\n * ],\n * });\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function provideTocConfig(...features: CngxTocConfigFeature[]): EnvironmentProviders {\n // Empty-features: skip the override so the root factory's CNGX_TOC_DEFAULTS\n // reference flows through untouched. A fresh mergeConfig(...) would allocate\n // identical content under a new reference and bust identity comparisons.\n if (features.length === 0) {\n return makeEnvironmentProviders([]);\n }\n const partial = reduceFeatures(features);\n return makeEnvironmentProviders([\n {\n provide: CNGX_TOC_CONFIG,\n useValue: mergeConfig(CNGX_TOC_DEFAULTS, partial),\n },\n ]);\n}\n\n/**\n * Component-scoped configuration cascade for the toc organism. Pass any\n * combination of feature factories in a parent component's `viewProviders`\n * array.\n *\n * Unlike `provideTocConfig` (root-only), `provideTocConfigAt` injects the\n * parent injector's `CNGX_TOC_CONFIG` value (resolves through the priority\n * chain) and deep-merges the supplied features on top. Descendant toc\n * instances see the merged config; sibling sub-trees keep the inherited value.\n *\n * ```ts\n * @Component({\n * viewProviders: [provideTocConfigAt(withTocScrollBehavior('auto'))],\n * template: '<cngx-toc [items]=\"toc\" contentRoot=\"#article\" />',\n * })\n * class Guide {}\n * ```\n *\n * @category ui/toc\n * @since 0.1.0\n */\nexport function provideTocConfigAt(...features: CngxTocConfigFeature[]): Provider[] {\n // Empty-features call: parent value flows through untouched. Skipping the\n // factory preserves reference identity through the sub-tree.\n if (features.length === 0) {\n return [];\n }\n const partial = reduceFeatures(features);\n return [\n {\n provide: CNGX_TOC_CONFIG,\n useFactory: () => {\n const parent = inject(CNGX_TOC_CONFIG, { skipSelf: true });\n return mergeConfig(parent, partial);\n },\n },\n ];\n}\n","/**\n * @module @cngx/ui/toc\n */\n\nexport { CngxToc } from './toc.component';\nexport { CngxTocRouterSync } from './toc-router-sync.directive';\nexport { CngxTocItemSlot } from './toc-item-slot';\nexport { CNGX_TOC, type CngxTocContract } from './toc-token';\nexport type { CngxTocItem, CngxTocItemContext } from './toc.types';\nexport type { CngxTocAriaLabels, CngxTocConfig } from './config/toc.config';\nexport { CNGX_TOC_CONFIG, CNGX_TOC_DEFAULTS } from './config/toc.config.defaults';\nexport {\n withTocAriaLabels,\n withTocScrollBehavior,\n withTocSpy,\n withTocTemplates,\n} from './config/features';\nexport {\n provideTocConfig,\n provideTocConfigAt,\n type CngxTocConfigFeature,\n} from './config/provide-toc-config';\nexport { injectTocAriaLabels, injectTocConfig } from './config/inject-toc-config';\nexport { CNGX_TOC_LANGUAGE_EN, type CngxTocLanguageSection } from './i18n/toc-language-section';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAcA;;;;;;;AAOG;AACI,MAAM,oBAAoB,GAA2B;AAC1D,IAAA,GAAG,EAAE,cAAc;;;ACnBrB;;;AAGG;AACI,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,CAAC;;ACJnF;;;;;;;;;;;;;AAaG;AACI,MAAM,iBAAiB,GAAkB;AAC9C,IAAA,cAAc,EAAE,QAAQ;AACxB,IAAA,GAAG,EAAE;AACH,QAAA,UAAU,EAAE,KAAK;AACjB,QAAA,SAAS,EAAE,GAAG;AACf,KAAA;;AAGH;;;;;;;;;;;;;;;;;;AAkBG;MACU,eAAe,GAAG,IAAI,cAAc,CAAgB,iBAAiB,EAAE;AAClF,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,iBAAiB;AACjC,CAAA;;ACzCD;;;;;;;;;;;;;;;;AAgBG;SACa,eAAe,GAAA;AAC7B,IAAA,OAAO,MAAM,CAAC,eAAe,CAAC;AAChC;AAEA;;;;;;;;;AASG;SACa,mBAAmB,GAAA;IACjC,OAAO,yBAAyB,CAAC,iBAAiB,EAAE,EAAE,eAAe,EAAE,CAAC,UAAU,CAAC;AACrF;;ACpCA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MAMU,eAAe,CAAA;AACjB,IAAA,WAAW,GAAG,MAAM,CAAkC,WAAW,CAAC;AAE3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GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE;KACvD;AACH;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,SAAU,gBAAgB,CAAC,GAAG,QAAgC,EAAA;;;;AAIlE,IAAA,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACzB,QAAA,OAAO,wBAAwB,CAAC,EAAE,CAAC;IACrC;AACA,IAAA,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC;AACxC,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA;AACE,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,QAAQ,EAAE,WAAW,CAAC,iBAAiB,EAAE,OAAO,CAAC;AAClD,SAAA;AACF,KAAA,CAAC;AACJ;AAEA;;;;;;;;;;;;;;;;;;;;AAoBG;AACG,SAAU,kBAAkB,CAAC,GAAG,QAAgC,EAAA;;;AAGpE,IAAA,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACzB,QAAA,OAAO,EAAE;IACX;AACA,IAAA,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC;IACxC,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,eAAe;YACxB,UAAU,EAAE,MAAK;AACf,gBAAA,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC1D,gBAAA,OAAO,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC;YACrC,CAAC;AACF,SAAA;KACF;AACH;;ACnLA;;AAEG;;ACFH;;AAEG;;;;"}
|
package/fesm2022/cngx-ui.mjs
CHANGED
|
@@ -17,7 +17,7 @@ export { CngxFailed, CngxPending, CngxSucceeded } from '@cngx/common/interactive
|
|
|
17
17
|
* small backwards-compat set (see public-api.ts).
|
|
18
18
|
*/
|
|
19
19
|
/** @internal - replaced at publish time, not part of consumer API. */
|
|
20
|
-
const VERSION = makeVersion('0.1.0-rc.
|
|
20
|
+
const VERSION = makeVersion('0.1.0-rc.9');
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Public API Surface of @cngx/ui
|
package/mat-tabs/README.md
CHANGED
|
@@ -55,7 +55,7 @@ per-instance or globally via `--cngx-mat-tab-error-*`:
|
|
|
55
55
|
|-|-|-|
|
|
56
56
|
| `--cngx-mat-tab-error-color` | `var(--mat-sys-error, #c62828)` | Foreground / outline colour |
|
|
57
57
|
| `--cngx-mat-tab-error-outline` | `2px solid currentColor` | Full `outline` shorthand |
|
|
58
|
-
| `--cngx-mat-tab-error-outline-offset` | `
|
|
58
|
+
| `--cngx-mat-tab-error-outline-offset` | `-2px` | Outline inset; negative so the clipped label container keeps every edge |
|
|
59
59
|
| `--cngx-mat-tab-error-font-weight` | `600` | Label-glyph weight bump |
|
|
60
60
|
|
|
61
61
|
Three-tier fallback: consumer override → Material design token →
|
|
@@ -67,16 +67,22 @@ surface inherit the rejection skin automatically.
|
|
|
67
67
|
`[cngxMatTabs]` projects the `presenter.lastFailedIndex()` signal onto
|
|
68
68
|
the matching `.mat-mdc-tab` button via `Renderer2`:
|
|
69
69
|
|
|
70
|
-
- **Set**
|
|
70
|
+
- **Set** when a commit does not land (both optimistic and pessimistic
|
|
71
|
+
modes): a refusal (`commitAction` answered `false`) or a failure
|
|
72
|
+
(it threw, rejected or errored). `presenter.lastOutcome()` tells the
|
|
73
|
+
two apart; the descriptor reads the refused copy for a refusal and
|
|
74
|
+
the rolled-back copy for a failure, and the
|
|
75
|
+
`*cngxMatTabRejectionContent` context carries `reason`.
|
|
71
76
|
- **Cleared** on the next successful re-pick of the same tab.
|
|
72
77
|
- **Cleared** on programmatic `presenter.clearLastFailed()` call.
|
|
73
78
|
|
|
74
|
-
The decoration adds `class="cngx-mat-tab--error"` and
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
The decoration adds `class="cngx-mat-tab--error"` and an SR-only
|
|
80
|
+
descriptor span referenced from the tab's `aria-describedby` (no
|
|
81
|
+
`aria-invalid`: it is form-field vocabulary, not a tab state). For a richer announcement phrase, compose
|
|
77
82
|
`<cngx-toast-on />` next to `[cngxMatTabs]` on the `<mat-tab-group>`
|
|
78
83
|
element; the bridge reads the same `CNGX_STATEFUL` source as the
|
|
79
|
-
decoration
|
|
84
|
+
decoration and reacts to failures only (a refusal leaves the commit
|
|
85
|
+
state at `'idle'`).
|
|
80
86
|
|
|
81
87
|
## Per-tab error aggregation
|
|
82
88
|
|
|
@@ -111,6 +117,24 @@ commit-action rejection lifecycle - a tab can carry both
|
|
|
111
117
|
the `--has-errors` badge slightly when both classes co-occur so the
|
|
112
118
|
two signals read as distinct.
|
|
113
119
|
|
|
120
|
+
### Direct error flag
|
|
121
|
+
|
|
122
|
+
When one value already says "this tab is invalid", skip the
|
|
123
|
+
aggregator: `[cngxMatTabErrorFlag]` takes a `string | boolean`. It
|
|
124
|
+
lands the same `--has-errors` class, descriptor span and
|
|
125
|
+
`aria-describedby` token as `[cngxMatTabError]`. The descriptor text
|
|
126
|
+
resolves aggregator `announcement()` -> the flag's string -> the
|
|
127
|
+
`tabHasErrors(count)` phrase from `CNGX_TABS_I18N`, so a bare `true`
|
|
128
|
+
still reads "1 error". `false` or `''` clears everything. On
|
|
129
|
+
`<nav mat-tab-nav-bar cngxMatTabNav>` the `[error]` input of
|
|
130
|
+
`[cngxMatTabLink]` does the same for `.mat-mdc-tab-link`.
|
|
131
|
+
|
|
132
|
+
```html
|
|
133
|
+
<mat-tab label="Profile" [cngxMatTabErrorFlag]="nameInvalid() ? 'Name is required' : false">
|
|
134
|
+
…
|
|
135
|
+
</mat-tab>
|
|
136
|
+
```
|
|
137
|
+
|
|
114
138
|
## Smart overflow
|
|
115
139
|
|
|
116
140
|
`[cngxMatTabs]` ships a smart overflow story: when Material's tab
|