@cngx/common 0.1.0-rc.6 → 0.1.0-rc.7

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.
Files changed (62) hide show
  1. package/chart/README.md +85 -0
  2. package/command/README.md +157 -0
  3. package/data/README.md +23 -0
  4. package/fesm2022/cngx-common-a11y.mjs +247 -85
  5. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  6. package/fesm2022/cngx-common-audio.mjs +37 -37
  7. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  8. package/fesm2022/cngx-common-card.mjs +13 -9
  9. package/fesm2022/cngx-common-card.mjs.map +1 -1
  10. package/fesm2022/cngx-common-chart.mjs +3404 -1392
  11. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  12. package/fesm2022/cngx-common-command.mjs +144 -0
  13. package/fesm2022/cngx-common-command.mjs.map +1 -0
  14. package/fesm2022/cngx-common-data.mjs +304 -213
  15. package/fesm2022/cngx-common-data.mjs.map +1 -1
  16. package/fesm2022/cngx-common-dialog.mjs +369 -100
  17. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  18. package/fesm2022/cngx-common-display.mjs +138 -24
  19. package/fesm2022/cngx-common-display.mjs.map +1 -1
  20. package/fesm2022/cngx-common-interactive.mjs +1089 -459
  21. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  22. package/fesm2022/cngx-common-layout.mjs +113 -61
  23. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  24. package/fesm2022/cngx-common-popover.mjs +430 -54
  25. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  26. package/fesm2022/cngx-common-stepper.mjs +107 -49
  27. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  28. package/fesm2022/cngx-common-tabs.mjs +1170 -752
  29. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  30. package/fesm2022/cngx-common-timeline.mjs +1086 -0
  31. package/fesm2022/cngx-common-timeline.mjs.map +1 -0
  32. package/fesm2022/cngx-common.mjs +2 -2
  33. package/fesm2022/cngx-common.mjs.map +1 -1
  34. package/package.json +11 -1
  35. package/stepper/README.md +1 -1
  36. package/theming/components/cngx-accordion.css +3 -0
  37. package/theming/components/cngx-badge.css +22 -0
  38. package/theming/components/cngx-bottom-sheet.css +14 -2
  39. package/theming/components/cngx-breadcrumb.css +8 -0
  40. package/theming/components/cngx-button-toggle.css +44 -2
  41. package/theming/components/cngx-data-grid.css +66 -0
  42. package/theming/components/cngx-dialog.css +12 -0
  43. package/theming/components/cngx-divider.css +12 -0
  44. package/theming/components/cngx-listbox.css +27 -0
  45. package/theming/components/cngx-menu.css +36 -0
  46. package/theming/components/cngx-ripple.css +1 -1
  47. package/theming/components/cngx-tooltip.css +11 -0
  48. package/types/cngx-common-a11y.d.ts +63 -17
  49. package/types/cngx-common-audio.d.ts +32 -32
  50. package/types/cngx-common-card.d.ts +10 -3
  51. package/types/cngx-common-chart.d.ts +1281 -141
  52. package/types/cngx-common-command.d.ts +167 -0
  53. package/types/cngx-common-data.d.ts +264 -98
  54. package/types/cngx-common-dialog.d.ts +214 -25
  55. package/types/cngx-common-display.d.ts +83 -13
  56. package/types/cngx-common-interactive.d.ts +708 -174
  57. package/types/cngx-common-layout.d.ts +48 -1
  58. package/types/cngx-common-popover.d.ts +120 -3
  59. package/types/cngx-common-stepper.d.ts +55 -5
  60. package/types/cngx-common-tabs.d.ts +386 -25
  61. package/types/cngx-common-timeline.d.ts +1059 -0
  62. package/types/cngx-common.d.ts +1 -1
@@ -1,11 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, model, input, inject, Injector, computed, output, signal, Directive, TemplateRef, contentChild, DestroyRef, Renderer2, ElementRef, effect, afterNextRender, untracked, makeEnvironmentProviders, isDevMode, linkedSignal, runInInjectionContext } from '@angular/core';
2
+ import { InjectionToken, model, input, inject, Injector, computed, output, signal, Directive, TemplateRef, contentChild, DestroyRef, makeEnvironmentProviders, Renderer2, ElementRef, effect, afterNextRender, untracked, isDevMode, linkedSignal, runInInjectionContext } from '@angular/core';
3
3
  import { CNGX_COMMIT_CONTROLLER_FACTORY } from '@cngx/common/data';
4
4
  import { createTransitionTracker, CNGX_STATEFUL, nextUid } from '@cngx/core/utils';
5
5
  import { isObservable, Observable } from 'rxjs';
6
6
  import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
7
- import { Router, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router';
7
+ import { Router, NavigationEnd, NavigationCancel, NavigationError, ActivatedRoute } from '@angular/router';
8
8
  import { filter, take } from 'rxjs/operators';
9
+ import { resolveInlineStep } from '@cngx/core';
9
10
 
10
11
  /**
11
12
  * DI fallback the presenter reads when its `[commitAction]` input is
@@ -478,6 +479,173 @@ function tabsEqual(a, b) {
478
479
  */
479
480
  const CNGX_TAB_PANEL_HOST = new InjectionToken('CngxTabPanelHost');
480
481
 
482
+ /**
483
+ * Marks a tab presenter as the **navigation** flavour rather than the
484
+ * tablist flavour. \
485
+ * Provided by `<cngx-tab-nav>` (`@cngx/ui/tabs`) and `[cngxMatTabNav]`
486
+ * (`@cngx/ui/mat-tabs`); deliberately not provided by `<cngx-tab-group>`.
487
+ *
488
+ * Presence-only by design. There is no contract interface: providers
489
+ * register `{ provide: CNGX_TAB_NAV_HOST, useValue: true }` and readers
490
+ * only ever test `navHost != null`. Nothing here can be widened into a
491
+ * second host contract - {@link CNGX_TAB_GROUP_HOST} already owns the
492
+ * presenter surface, and this token sits beside it so the tablist path
493
+ * gains no dead field.
494
+ *
495
+ * **Why a token and not the host class.** A sub-directive talks to its
496
+ * host through DI, never through a concrete class: importing `CngxTabNav`
497
+ * from `@cngx/common` would be a `common -> ui` edge that Sheriff rejects,
498
+ * and element-tag sniffing breaks the moment a decomposed skin renames the
499
+ * element.
500
+ *
501
+ * **What reads it.** {@link CngxTabsRouteSync} injects it
502
+ * `{ optional: true, host: true }` to pick its URL-matching semantics: a
503
+ * nav link owns a whole subtree and stays current for every URL beneath it
504
+ * (prefix), while a tablist tab is a leaf and matches only its own route
505
+ * (suffix). The `[match]` input overrides the token-derived default when a
506
+ * consumer needs the other mode.
507
+ *
508
+ * ```ts
509
+ * @Component({
510
+ * selector: 'my-section-nav',
511
+ * providers: [{ provide: CNGX_TAB_NAV_HOST, useValue: true }],
512
+ * hostDirectives: [CngxTabGroupPresenter],
513
+ * })
514
+ * export class MySectionNav {}
515
+ * ```
516
+ *
517
+ * @category common/tabs
518
+ * @wcag AA
519
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab-nav-host.token.ts
520
+ * @since 0.1.0
521
+ * @relatedTo CngxTabsRouteSync, CNGX_TAB_GROUP_HOST, CngxTabNav, CngxMatTabNav
522
+ */
523
+ const CNGX_TAB_NAV_HOST = new InjectionToken('CngxTabNavHost');
524
+
525
+ /**
526
+ * Path-segment count of a resolved `UrlTree`, used to rank prefix
527
+ * matches: `/rounds/explorer` outranks `/rounds` on a URL both match.
528
+ */
529
+ function urlTreeSegmentCount(tree) {
530
+ let count = 0;
531
+ const walk = (group) => {
532
+ count += group.segments.length;
533
+ for (const key of Object.keys(group.children)) {
534
+ walk(group.children[key]);
535
+ }
536
+ };
537
+ walk(tree.root);
538
+ return count;
539
+ }
540
+ /**
541
+ * Find the tab whose route is the trailing segment(s) of the current URL
542
+ * path. Anchors on position, not a loose "appears anywhere" scan - a tab
543
+ * id that happens to equal an unrelated parent segment cannot win. The
544
+ * path is taken before any query/fragment. If two tabs produce the same
545
+ * trailing segment(s) (only possible with a colliding custom `routeFor`),
546
+ * the first registered tab wins; the default id-based mapping never
547
+ * collides.
548
+ */
549
+ function resolveBySuffix(ctx) {
550
+ const path = ctx.router.url.split(/[?#]/)[0];
551
+ const segments = path.split('/').filter(Boolean);
552
+ for (const tab of ctx.tabs) {
553
+ const route = ctx.routeFor(tab).map((command) => String(command));
554
+ if (route.length === 0 || route.length > segments.length) {
555
+ continue;
556
+ }
557
+ const tail = segments.slice(-route.length);
558
+ if (tail.every((segment, i) => segment === route[i])) {
559
+ return tab.id;
560
+ }
561
+ }
562
+ return null;
563
+ }
564
+ /**
565
+ * Find the tab that owns the current URL's subtree: the one whose
566
+ * resolved `UrlTree` is a subset of the active tree, ignoring query
567
+ * params, fragment, and matrix params.
568
+ *
569
+ * Routes resolve `{ relativeTo: ActivatedRoute }` rather than against the
570
+ * URL root. A root-anchored segment compare breaks a nav mounted under a
571
+ * base path - at `/app/rounds` a `['rounds']` route would compare
572
+ * `'app' === 'rounds'`, resolve `null`, and hand the first link a wrong
573
+ * `aria-current`, which is the exact defect prefix mode exists to fix.
574
+ * Relative resolution is safe on the read side because the nav path is
575
+ * commit-free: links navigate through their own `routerLink`, so nothing
576
+ * here can diverge from a commit navigation.
577
+ *
578
+ * Longest route wins, so a `/rounds` tab cannot shadow `/rounds/explorer`
579
+ * in the same set.
580
+ */
581
+ function resolveByPrefix(ctx) {
582
+ let winner = null;
583
+ let winnerDepth = -1;
584
+ for (const tab of ctx.tabs) {
585
+ const route = ctx.routeFor(tab);
586
+ if (route.length === 0) {
587
+ continue;
588
+ }
589
+ const tree = ctx.router.createUrlTree(route, { relativeTo: ctx.activatedRoute });
590
+ const active = ctx.router.isActive(tree, {
591
+ paths: 'subset',
592
+ queryParams: 'ignored',
593
+ fragment: 'ignored',
594
+ matrixParams: 'ignored',
595
+ });
596
+ if (!active) {
597
+ continue;
598
+ }
599
+ const depth = urlTreeSegmentCount(tree);
600
+ if (depth > winnerDepth) {
601
+ winner = tab.id;
602
+ winnerDepth = depth;
603
+ }
604
+ }
605
+ return winner;
606
+ }
607
+ /**
608
+ * The two URL-matching policies `[cngxTabsRouteSync]` ships, dispatched
609
+ * on {@link CngxTabUrlMatchContext.mode}. Same exact-versus-prefix
610
+ * distinction `routerLinkActive` draws.
611
+ *
612
+ * Pure: no injection context, no signal reads. The directive resolves the
613
+ * mode cascade and the tab registry, then hands both in.
614
+ *
615
+ * @category common/tabs
616
+ */
617
+ function createTabUrlMatch() {
618
+ return {
619
+ resolve(ctx) {
620
+ return ctx.mode === 'prefix' ? resolveByPrefix(ctx) : resolveBySuffix(ctx);
621
+ },
622
+ };
623
+ }
624
+ /**
625
+ * Swap point for how a routed tab set decides which tab the URL belongs
626
+ * to. Default {@link createTabUrlMatch}.
627
+ *
628
+ * Override when neither shipped policy fits: locale-segment-insensitive
629
+ * comparison (`/de/rounds` and `/en/rounds` are the same tab), matching
630
+ * on a route `data` key instead of the path, or a permission-aware read
631
+ * that skips tabs the user cannot open. `routeFor` only changes what a
632
+ * tab's route *is*; this changes how it is *compared*.
633
+ *
634
+ * Mirrors {@link CNGX_TABS_COMMIT_ACTION} on the write side: the
635
+ * navigation a tab switch performs is already swappable, so the read that
636
+ * mirrors navigation back onto `activeIndex` should be too.
637
+ *
638
+ * @category common/tabs
639
+ * @wcag AA
640
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/url-match.ts
641
+ * @since 0.1.0
642
+ * @relatedTo CngxTabsRouteSync, createTabUrlMatch, createTabRouterCommit
643
+ */
644
+ const CNGX_TAB_URL_MATCH_STRATEGY = new InjectionToken('CngxTabUrlMatchStrategy', {
645
+ providedIn: 'root',
646
+ factory: () => createTabUrlMatch(),
647
+ });
648
+
481
649
  /**
482
650
  * Structural slot directive marking the per-tab panel-body template. \
483
651
  * Discovered by `<cngx-tab-group>` via `contentChild` on each
@@ -607,6 +775,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
607
775
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab.directive.ts
608
776
  * @since 0.1.0
609
777
  * @relatedTo CngxTabGroupPresenter, CngxTabLabel, CngxTabContent, CngxTabErrorBadge
778
+ * @slot cngxTabLabel The tab's own header label.
779
+ * @slot cngxTabSubLabel Secondary line under the label, e.g. a count or status.
780
+ * @slot cngxTabContent The panel body, rendered lazily when the tab activates.
610
781
  */
611
782
  class CngxTab {
612
783
  id = input(nextUid('cngx-tab-'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
@@ -704,787 +875,276 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
704
875
  }]
705
876
  }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], subLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "subLabel", required: false }] }], errorAggregator: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorAggregator", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], labelTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTabLabel), { isSignal: true }] }], subLabelTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTabSubLabel), { isSignal: true }] }], contentTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTabContent), { isSignal: true }] }] } });
706
877
 
878
+ const TABS_CONFIG_DEFAULTS = {
879
+ defaultOrientation: 'horizontal',
880
+ defaultLoop: true,
881
+ defaultCommitMode: 'optimistic',
882
+ fragmentSyncMode: 'fragment',
883
+ fragmentSyncParam: 'tab',
884
+ // routeMatch stays unset: the host-flavour default is the right answer
885
+ // for both organisms, and pinning one here would silently flip the
886
+ // other. linkAriaCurrent defaults at the link, not here.
887
+ linkAriaCurrent: 'page',
888
+ ariaLabels: {
889
+ tabsRegion: 'Tabs',
890
+ },
891
+ fallbackLabels: {
892
+ // W3C ARIA tablist convention - kept distinct from
893
+ // `i18n.tabsLabel` so AT doesn't read the same string twice
894
+ // back-to-back across `aria-roledescription` and `aria-label`.
895
+ tabRoleDescription: 'tab list',
896
+ tabPanelRoleDescription: 'tab panel',
897
+ },
898
+ overflowStabilizeMs: 100,
899
+ overflowMaxDeferMs: 250,
900
+ templates: {},
901
+ };
707
902
  /**
708
- * Turns a consumer `<a routerLink>` into a registered {@link CngxTabHandle}
709
- * inside a {@link CngxTabNav}. \
710
- * Native parallel of {@link CngxMatTabLink}: in a
711
- * navigation bar the link IS the tab, so this per-anchor directive is the
712
- * registration seam - symmetric with how `CngxTab` registers each `[cngxTab]`.
713
- *
714
- * Carries no rendering and no click handler. Navigation is the native
715
- * `routerLink` (middle-click, open-in-new-tab and the hover URL all work),
716
- * gating is the link's own `CanDeactivate`, and the active marker comes from
717
- * the route: `[cngxTabsRouteSync]` on the nav reflects `NavigationEnd` onto the
718
- * presenter's `activeId`, which this link matches against its own `id`. \
719
- * There is no `select()` call - invoking it would re-enter the commit path the
720
- * routed-nav model deliberately keeps dormant.
721
- *
722
- * **Error communication is reactive:** `aria-invalid` plus the
723
- * `--error` skin glyph signal the state, and an injected screen-reader
724
- * descriptor span (referenced by a permanent `aria-describedby`) carries the
725
- * direct `[error]` message string so assistive tech reads *why* the link is
726
- * invalid.
727
- *
728
- * ```html
729
- * <cngx-tab-nav cngxTabsRouteSync>
730
- * <a cngxTabLink id="overview" routerLink="overview">Overview</a>
731
- * <a cngxTabLink id="profile" routerLink="profile" [error]="profileInvalid">Profile</a>
732
- * </cngx-tab-nav>
733
- * ```
903
+ * DI token for the resolved tabs config. \
904
+ * `providedIn: 'root'` with the library defaults; override via {@link provideTabsConfig}
905
+ * (root) or {@link provideTabsConfigAt} (component scope).
734
906
  *
735
907
  * @category common/tabs
736
- * @docsKind primary
737
908
  * @wcag AA
738
- * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab-link.directive.ts
909
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tabs-config.ts
739
910
  * @since 0.1.0
740
- * @relatedTo CngxTabNav, CngxTabsRouteSync, CngxTab, CngxMatTabLink
741
911
  */
742
- class CngxTabLink {
743
- host = inject(CNGX_TAB_GROUP_HOST, { optional: true });
744
- destroyRef = inject(DestroyRef);
745
- renderer = inject(Renderer2);
746
- hostEl = inject(ElementRef).nativeElement;
747
- /**
748
- * Handle id. Set it to the link's route segment so the nav's
749
- * `[cngxTabsRouteSync]` reflects the active route onto this link via the
750
- * default `(h) => [h.id]` mapping. Defaults to a fresh uid when route-sync
751
- * is not used.
752
- */
753
- id = input(nextUid('cngx-tab-link-'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
754
- /** Accessible label fed to the nav's live-region announcer. */
755
- label = input(undefined, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
756
- /**
757
- * Direct error flag for the link - `true` or a non-empty string marks it
758
- * invalid (the string doubles as the message). Mirrors `CngxTab.error`.
759
- */
760
- error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
761
- /** Optional rich error aggregator for the link. */
762
- errorAggregator = input(undefined, ...(ngDevMode ? [{ debugName: "errorAggregator" }] : /* istanbul ignore next */ []));
763
- /**
764
- * Resolved direct-error message: the `[error]` string when non-empty, else
765
- * `undefined`. Carried onto the registration handle by reference.
766
- * `computed` over the input - never written.
767
- */
768
- errorMessage = computed(() => {
769
- const value = this.error();
770
- return typeof value === 'string' && value !== '' ? value : undefined;
771
- }, ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
772
- /**
773
- * Per-link error fold driving `aria-invalid` and the `--error` class.
774
- * `true` when the direct `[error]` flag is set OR the optional aggregator
775
- * wants to reveal (`shouldShow()`, so deferred-reveal validation stays
776
- * silent until revealed). Mirrors `CngxTab.hasError`.
777
- */
778
- hasError = computed(() => {
779
- const direct = this.error();
780
- return ((direct !== false && direct !== '') || (this.errorAggregator()?.shouldShow?.() ?? false));
781
- }, { ...(ngDevMode ? { debugName: "hasError" } : /* istanbul ignore next */ {}), equal: Object.is });
782
- /** `true` when the presenter's `activeId` equals this link's id. */
783
- selected = computed(() => this.host?.activeId() === this.id(), { ...(ngDevMode ? { debugName: "selected" } : /* istanbul ignore next */ {}), equal: Object.is });
784
- /**
785
- * Id of the injected SR error-message descriptor. Always referenced by the
786
- * `aria-describedby` host binding (Pillar 2 - the id is permanent; the
787
- * span's content and `aria-hidden` toggle, never the id itself).
788
- */
789
- descriptorId = computed(() => `${this.id()}-desc`, ...(ngDevMode ? [{ debugName: "descriptorId" }] : /* istanbul ignore next */ []));
790
- /** The injected descriptor `<span>`, created in {@link ngOnInit}. */
791
- descriptorEl = null;
792
- constructor() {
793
- if (!this.host) {
794
- throw new Error('CngxTabLink: no enclosing CngxTabGroupPresenter found. Wrap the link inside <cngx-tab-nav> (or an element carrying [cngxTabGroup]).');
795
- }
796
- // Mirror the direct-error message into the describedby span. DOM side
797
- // effect only - no signal writes. Guards until the span exists (created
798
- // in ngOnInit); errorMessage / descriptorId changes re-run it after.
799
- effect(() => {
800
- const el = this.descriptorEl;
801
- if (el) {
802
- this.syncDescriptor(el);
803
- }
804
- });
805
- }
806
- ngOnInit() {
807
- // Register in ngOnInit, NOT the constructor: a dynamically-bound `[id]`
808
- // signal input is not applied until the first change detection, so a
809
- // constructor read would capture the default auto-id. The handle id is the
810
- // stable key the nav's route-sync matches the URL segment against.
811
- const host = this.host;
812
- const handle = {
813
- id: this.id(),
814
- label: this.label,
815
- subLabel: signal(undefined),
816
- disabled: signal(false),
817
- errorAggregator: this.errorAggregator,
818
- hasError: this.hasError,
819
- errorMessage: this.errorMessage,
820
- closable: signal(undefined),
821
- };
822
- host.register(handle);
823
- // Inject the SR error-message descriptor as a SIBLING of the anchor: a
824
- // child span would fold into the link's accessible name, so it lives
825
- // beside it and is reached only via the aria-describedby id.
826
- const descriptor = this.renderer.createElement('span');
827
- this.renderer.addClass(descriptor, 'cngx-sr-only');
828
- const parent = this.renderer.parentNode(this.hostEl);
829
- if (parent) {
830
- this.renderer.insertBefore(parent, descriptor, this.renderer.nextSibling(this.hostEl));
831
- }
832
- this.descriptorEl = descriptor;
833
- this.syncDescriptor(descriptor);
834
- this.destroyRef.onDestroy(() => {
835
- host.unregister(handle.id);
836
- if (parent) {
837
- this.renderer.removeChild(parent, descriptor);
838
- }
839
- });
840
- }
841
- /**
842
- * Write the current direct-error message into the descriptor span and
843
- * toggle its `aria-hidden` so a clear link exposes no description. Keeps
844
- * the span id in sync with {@link descriptorId} (read here so the effect
845
- * tracks an id change too).
846
- */
847
- syncDescriptor(el) {
848
- this.renderer.setAttribute(el, 'id', this.descriptorId());
849
- const message = this.errorMessage() ?? '';
850
- this.renderer.setProperty(el, 'textContent', message);
851
- if (message) {
852
- this.renderer.removeAttribute(el, 'aria-hidden');
853
- }
854
- else {
855
- this.renderer.setAttribute(el, 'aria-hidden', 'true');
856
- }
857
- }
858
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabLink, deps: [], target: i0.ɵɵFactoryTarget.Directive });
859
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxTabLink, isStandalone: true, selector: "[cngxTabLink]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, errorAggregator: { classPropertyName: "errorAggregator", publicName: "errorAggregator", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-current": "selected() ? 'page' : null", "attr.aria-invalid": "hasError() ? 'true' : null", "attr.aria-describedby": "descriptorId()", "class.cngx-tab-nav__link--active": "selected()", "class.cngx-tab-nav__link--error": "hasError()" }, classAttribute: "cngx-tab-nav__link" }, exportAs: ["cngxTabLink"], ngImport: i0 });
860
- }
861
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabLink, decorators: [{
862
- type: Directive,
863
- args: [{
864
- selector: '[cngxTabLink]',
865
- exportAs: 'cngxTabLink',
866
- standalone: true,
867
- host: {
868
- class: 'cngx-tab-nav__link',
869
- '[attr.aria-current]': "selected() ? 'page' : null",
870
- '[attr.aria-invalid]': "hasError() ? 'true' : null",
871
- '[attr.aria-describedby]': 'descriptorId()',
872
- '[class.cngx-tab-nav__link--active]': 'selected()',
873
- '[class.cngx-tab-nav__link--error]': 'hasError()',
874
- },
875
- }]
876
- }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], errorAggregator: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorAggregator", required: false }] }] } });
877
-
912
+ const CNGX_TABS_CONFIG = new InjectionToken('CngxTabsConfig', {
913
+ providedIn: 'root',
914
+ factory: () => TABS_CONFIG_DEFAULTS,
915
+ });
878
916
  /**
879
- * Single dev-warning both tab sync directives emit when `@angular/router`
880
- * is not provided. Shared so the message stays identical across
881
- * {@link CngxTabsFragmentSync} (deep-linking) and {@link CngxTabsRouteSync}
882
- * (router-outlet); only the `enables` clause differs. The URL readers
883
- * themselves stay separate - they target different surfaces (fragment /
884
- * query-param vs route path) and must not converge.
917
+ * Internal helper that brands a config-mutator function with the
918
+ * `_target` discriminator. \
919
+ * Every `with*` config feature returns one
920
+ * of these.
885
921
  *
886
922
  * @internal
887
923
  */
888
- function warnTabsRouterAbsent(directive, enables) {
889
- console.warn(`${directive}: no Router available - directive is a no-op. ` +
890
- `Provide @angular/router via provideRouter(...) to enable ${enables}.`);
924
+ function defineTabsConfigFeature(fn) {
925
+ return Object.assign(fn, { _target: 'config' });
891
926
  }
892
-
893
927
  /**
894
- * URL deep-linking for tab groups. \
895
- * Bidirectional sync between `activeId` and a URL fragment or query-param. Opt-in via
896
- * `[cngxTabsFragmentSync]` on the presenter element.
897
- *
898
- * - `mode = 'fragment'` (default) → `#tab=settings`
899
- * - `mode = 'queryParam'` with `paramName = 'tab'` → `?tab=settings`
928
+ * Override the default orientation. Per-instance `[orientation]`
929
+ * still wins; this changes the cascade default only.
900
930
  *
901
- * `Router` is optional - without it the directive logs a dev warning
902
- * via `afterNextRender` and becomes a no-op. \
903
- * Every `router.navigate` and `host.selectById` inside the effects sits in `untracked()`.
931
+ * @category common/tabs
932
+ */
933
+ function withTabsDefaultOrientation(orientation) {
934
+ return defineTabsConfigFeature((cfg) => ({
935
+ ...cfg,
936
+ defaultOrientation: orientation,
937
+ }));
938
+ }
939
+ /**
940
+ * @deprecated Use {@link withTabsDefaultOrientation}. The unprefixed name
941
+ * collides with the stepper family's identical symbol when both libs
942
+ * are auto-imported. The alias stays for one minor release before
943
+ * removal.
904
944
  *
905
- * ```html
906
- * <!-- Default fragment mode: the active tab reflects to #tab=<id>, and a
907
- * deep link like /account#tab=settings selects that tab on load. -->
908
- * <cngx-tab-group cngxTabsFragmentSync>
909
- * <div cngxTab id="overview" label="Overview"></div>
910
- * <div cngxTab id="settings" label="Settings"></div>
911
- * </cngx-tab-group>
945
+ * @category common/tabs
946
+ */
947
+ const withDefaultOrientation = withTabsDefaultOrientation;
948
+ /**
949
+ * Override whether roving-tabindex navigation loops from last back to
950
+ * first (and vice versa). Per-instance `[loop]` Input still wins.
912
951
  *
913
- * <!-- Query-param mode with a custom name -> ?section=settings -->
914
- * <cngx-tab-group cngxTabsFragmentSync mode="queryParam" paramName="section">
915
- * <!-- ...tabs... -->
916
- * </cngx-tab-group>
917
- * ```
952
+ * @category common/tabs
953
+ */
954
+ function withTabsRovingLoop(loop) {
955
+ return defineTabsConfigFeature((cfg) => ({ ...cfg, defaultLoop: loop }));
956
+ }
957
+ /**
958
+ * Override the default commit mode for async tab transitions.
959
+ * `'optimistic'` activates the tab on action dispatch and rolls back
960
+ * on error; `'pessimistic'` waits for success. Per-instance
961
+ * `[commitMode]` Input still wins.
918
962
  *
919
963
  * @category common/tabs
920
- * @docsKind primary
921
- * @wcag AA
922
- * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/router-sync.directive.ts
923
- * @since 0.1.0
924
- * @relatedTo CngxTabGroupPresenter, CngxTab
925
964
  */
926
- class CngxTabsFragmentSync {
927
- mode = input('fragment', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
928
- paramName = input('tab', ...(ngDevMode ? [{ debugName: "paramName" }] : /* istanbul ignore next */ []));
929
- host = inject(CNGX_TAB_GROUP_HOST, { host: true });
930
- router = inject(Router, { optional: true });
931
- constructor() {
932
- if (!this.router) {
933
- afterNextRender(() => warnTabsRouterAbsent('CngxTabsFragmentSync', 'deep-linking'));
934
- return;
935
- }
936
- const router = this.router;
937
- const destroyRef = inject(DestroyRef);
938
- afterNextRender(() => {
939
- const initial = this.readUrlValue(router);
940
- if (initial) {
941
- untracked(() => this.host.selectById(initial));
942
- }
943
- });
944
- effect(() => {
945
- const id = this.host.activeId();
946
- if (!id) {
947
- return;
948
- }
949
- untracked(() => {
950
- const navigation = this.mode() === 'fragment'
951
- ? router.navigate([], {
952
- fragment: `${this.paramName()}=${id}`,
953
- queryParamsHandling: 'merge',
954
- replaceUrl: true,
955
- })
956
- : router.navigate([], {
957
- queryParams: { [this.paramName()]: id },
958
- queryParamsHandling: 'merge',
959
- replaceUrl: true,
960
- });
961
- // Router rejection (e.g. cancelled navigation) has no recovery path.
962
- navigation.catch?.(() => undefined);
963
- });
964
- });
965
- const navEnd = toSignal(router.events.pipe(filter((e) => e instanceof NavigationEnd), takeUntilDestroyed(destroyRef)), { initialValue: null });
966
- effect(() => {
967
- const e = navEnd();
968
- if (!e) {
969
- return;
970
- }
971
- untracked(() => {
972
- const next = this.readUrlValue(router);
973
- if (next && next !== this.host.activeId()) {
974
- this.host.selectById(next);
975
- }
976
- });
977
- });
978
- }
979
- readUrlValue(router) {
980
- if (this.mode() === 'fragment') {
981
- const fragment = router.routerState.snapshot.root.fragment ?? '';
982
- return this.parseFragment(fragment);
983
- }
984
- return router.routerState.snapshot.root.queryParamMap.get(this.paramName()) ?? null;
985
- }
986
- parseFragment(fragment) {
987
- const param = this.paramName();
988
- const segments = fragment.split('&');
989
- for (const seg of segments) {
990
- const [key, val] = seg.split('=');
991
- if (key === param && val) {
992
- return val;
993
- }
994
- }
995
- return null;
996
- }
997
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabsFragmentSync, deps: [], target: i0.ɵɵFactoryTarget.Directive });
998
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxTabsFragmentSync, isStandalone: true, selector: "[cngxTabsFragmentSync]", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, paramName: { classPropertyName: "paramName", publicName: "paramName", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cngxTabsFragmentSync"], ngImport: i0 });
965
+ function withTabsCommitMode(mode) {
966
+ return defineTabsConfigFeature((cfg) => ({
967
+ ...cfg,
968
+ defaultCommitMode: mode,
969
+ }));
999
970
  }
1000
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabsFragmentSync, decorators: [{
1001
- type: Directive,
1002
- args: [{
1003
- selector: '[cngxTabsFragmentSync]',
1004
- exportAs: 'cngxTabsFragmentSync',
1005
- standalone: true,
1006
- }]
1007
- }], ctorParameters: () => [], propDecorators: { mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], paramName: [{ type: i0.Input, args: [{ isSignal: true, alias: "paramName", required: false }] }] } });
1008
-
1009
971
  /**
1010
- * Default tab-to-route mapping: the tab id is the child segment.
1011
- * Shared so the factory and `[cngxTabsRouteSync]` reference one
1012
- * definition instead of inlining the closure twice.
972
+ * Configure URL fragment / query-param deep-linking for the active tab
973
+ * (the {@link CngxTabsFragmentSync} directive). \
974
+ * `mode` chooses the URL surface (URL fragment or query parameter); `param` names the key
975
+ * (default `'tab'`).
1013
976
  *
1014
- * @internal
977
+ * Not to be confused with `[cngxTabsRouteSync]`, the router-outlet
978
+ * integration - this feature configures fragment deep-linking only.
979
+ *
980
+ * @category common/tabs
1015
981
  */
1016
- const cngxDefaultTabRoute = (handle) => [handle.id];
982
+ function withTabsFragmentSync(mode, param = 'tab') {
983
+ return defineTabsConfigFeature((cfg) => ({
984
+ ...cfg,
985
+ fragmentSyncMode: mode,
986
+ fragmentSyncParam: param,
987
+ }));
988
+ }
1017
989
  /**
1018
- * Builds a {@link CngxTabsCommitAction} that gates a tab switch through
1019
- * `@angular/router`. The action navigates to the target tab's route and
1020
- * resolves on the router's own outcome:
990
+ * Force one URL-matching mode app-wide for `[cngxTabsRouteSync]`. \
991
+ * `'suffix'` treats every tab as a leaf route, `'prefix'` as a section
992
+ * that stays active for URLs beneath it.
1021
993
  *
1022
- * - `NavigationEnd` → `true` (commit the switch)
1023
- * - `NavigationCancel` (a `CanDeactivate` guard blocked) → `false`
1024
- * - `NavigationError` (guard/resolver threw) → `false`
994
+ * Reach for this only when the host-flavour default is wrong for your
995
+ * app. Unset, a `<cngx-tab-nav>` matches by prefix and a
996
+ * `<cngx-tab-group>` by suffix, which is what each markup implies; this
997
+ * feature overrides *both*. Per-instance `[match]` still wins.
1025
998
  *
1026
- * Routed tabs reuse the presenter's commit lifecycle verbatim - the
1027
- * router navigation is simply the async op. \
1028
- * In pessimistic mode the active tab follows the *resolved* route, so a cancelled guard keeps
1029
- * the old tab with zero extra gate machinery. The events subscription
1030
- * is opened *before* `navigate(...)` so a synchronously-resolving
1031
- * navigation cannot emit before the action is listening; the commit
1032
- * controller's `cancel()` unsubscribes on supersede.
999
+ * Changes which policy runs, not the policies themselves - swap those via
1000
+ * {@link CNGX_TAB_URL_MATCH_STRATEGY}.
1033
1001
  *
1034
1002
  * @category common/tabs
1035
- * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/router-commit.ts
1036
- * @since 0.1.0
1037
1003
  */
1038
- function createTabRouterCommit(opts) {
1039
- const routeFor = opts.routeFor ?? cngxDefaultTabRoute;
1040
- return (_fromIndex, toIndex) => new Observable((subscriber) => {
1041
- const target = opts.tabs()[toIndex];
1042
- if (!target) {
1043
- subscriber.next(false);
1044
- subscriber.complete();
1045
- return;
1046
- }
1047
- const sub = opts.router.events
1048
- .pipe(filter((e) => e instanceof NavigationEnd ||
1049
- e instanceof NavigationCancel ||
1050
- e instanceof NavigationError), take(1))
1051
- .subscribe((event) => {
1052
- subscriber.next(event instanceof NavigationEnd);
1053
- subscriber.complete();
1054
- });
1055
- // A rejected promise surfaces on the events stream as
1056
- // NavigationError, so the subscription above is the single
1057
- // resolution path; swallow the promise rejection to avoid an
1058
- // unhandled-rejection warning.
1059
- opts.router.navigate(routeFor(target)).catch(() => undefined);
1060
- return () => sub.unsubscribe();
1061
- });
1004
+ function withTabsRouteMatch(mode) {
1005
+ return defineTabsConfigFeature((cfg) => ({ ...cfg, routeMatch: mode }));
1062
1006
  }
1063
-
1064
1007
  /**
1065
- * Router-outlet integration for tab groups. \
1066
- * Opt-in via `[cngxTabsRouteSync]` on the presenter element. Each tab is an
1067
- * Angular child route whose component renders into a `<router-outlet>`;
1068
- * switching tabs navigates, and a `CanDeactivate` guard can gate the
1069
- * leave.
1008
+ * Set the `aria-current` token `[cngxTabLink]` publishes while active. \
1009
+ * Default `'page'`.
1070
1010
  *
1071
- * Supplies the presenter's commit-action through the
1072
- * {@link CNGX_TABS_COMMIT_ACTION} DI fallback (no consumer
1073
- * `[commitAction]` hand-binding) and pins **pessimistic** mode so the
1074
- * active tab follows the *resolved* route - a guard-cancelled switch
1075
- * keeps the old tab. The routing gate reuses the presenter's commit
1076
- * lifecycle verbatim; the router navigation is the async op.
1011
+ * Use `'true'` for a section nav whose links stay active across a whole
1012
+ * subtree: the active link is then the current *section*, and `page`
1013
+ * would tell AT it is the page being viewed. Scope it to one nav with
1014
+ * `provideTabsConfigAt` in that component's `viewProviders` rather than
1015
+ * setting it app-wide, unless every nav in the app is section-shaped.
1016
+ * Per-link `[ariaCurrent]` still wins.
1077
1017
  *
1078
- * Seeds the active tab from the current URL on mount and reflects
1079
- * external navigations (back/forward, direct URL) into `activeIndex`
1080
- * *without* re-navigating - those writes bypass the commit-action,
1081
- * since the router is already at the resolved route.
1018
+ * @category common/tabs
1019
+ */
1020
+ function withTabsLinkAriaCurrent(token) {
1021
+ return defineTabsConfigFeature((cfg) => ({ ...cfg, linkAriaCurrent: token }));
1022
+ }
1023
+ /**
1024
+ * @deprecated Use {@link withTabsFragmentSync}. "Router sync" collided
1025
+ * with the new `[cngxTabsRouteSync]` router-outlet directive; this
1026
+ * feature only ever configured fragment / query-param deep-linking. The
1027
+ * alias stays for one minor release before removal.
1082
1028
  *
1083
- * `Router` is optional - without it the directive logs a single dev
1084
- * warning via `afterNextRender`, exposes a null action, and becomes a
1085
- * no-op. Mirrors {@link CngxTabsFragmentSync}; every `activeIndex`
1086
- * write inside an effect sits in `untracked()`.
1029
+ * @category common/tabs
1030
+ */
1031
+ const withTabsRouterSync = withTabsFragmentSync;
1032
+ /**
1033
+ * Select the app-wide default visual skin for `<cngx-tab-group>`. \
1034
+ * Default `'line'`. Per-instance `[skin]` Input still wins; this moves
1035
+ * the cascade default. Structure, slots, ARIA, and keyboard behaviour
1036
+ * are identical across skins - only the `[data-skin]` host attribute
1037
+ * changes the CSS layer. The Material twin (`[cngxMatTabs]`) ignores it.
1087
1038
  *
1088
- * **The mental model.** It turns the tab group into the router's view
1089
- * switcher: the tabs choose *which child route* renders in the
1090
- * `<router-outlet>`, not which inline template shows. \
1091
- * Concretely, a Settings page with Profile / Security / Billing tabs then gets, for
1092
- * free: each tab its own URL (`/settings/profile`) so a refresh or a
1093
- * shared link stays on the tab; browser back/forward between tabs;
1094
- * `Billing` lazy-loading its chunk only when first opened; and `Profile`
1095
- * blocking the switch via a `CanDeactivate` guard while its form is
1096
- * dirty - all while keeping the `role="tab"` keyboard and ARIA model.
1097
- *
1098
- * **Use it when** each tab's content is a real Angular route - a lazy
1099
- * chunk, a resolver, or a `CanActivate` / `CanDeactivate` guard -
1100
- * rendered into a `<router-outlet>`, and you want browser back/forward
1101
- * and deep links to move between tabs while the route's own guard gates
1102
- * the switch (e.g. an unsaved-changes prompt on leave). \
1103
- * If the tabs are purely visual, use a plain `<cngx-tab-group>` with no sync directive;
1104
- * if you only want the active tab reflected in the URL while content
1105
- * stays inline, use {@link CngxTabsFragmentSync}.
1106
- *
1107
- * **What this is not.** \
1108
- * Not a per-tab `routerLink`: \
1109
- * the tabs stay `role="tab"` buttons and the directive drives `router.navigate`
1110
- * centrally through the commit lifecycle, so there are no anchors, no
1111
- * `href`, and no native open-in-new-tab / middle-click / copy-link. \
1112
- * For real link semantics (right-click, ctrl-click) reach for the CNGX
1113
- * `<cngx-tab-nav>` and `<a cngx-tab-link routerLink>` variant
1114
- * instead. \
1115
- * Not URL deep-linking either - that is {@link CngxTabsFragmentSync} (a `#tab=` fragment or `?tab=`
1116
- * query-param); this directive renders child route *components* into a
1117
- * `<router-outlet>`. \
1118
- * And not optimistic: the active tab moves only once
1119
- * the route resolves, so a `CanDeactivate` guard can cancel the switch.
1120
- *
1121
- * ```ts
1122
- * // Each tab is a child route; the editor guards its own exit.
1123
- * const ROUTES: Routes = [
1124
- * { path: '', pathMatch: 'full', redirectTo: 'editor' },
1125
- * { path: 'editor', component: EditorPage, canDeactivate: [unsavedChangesGuard] },
1126
- * { path: 'preview', component: PreviewPage },
1127
- * { path: 'settings', component: SettingsPage },
1128
- * ];
1129
- * ```
1130
- *
1131
- * ```html
1132
- * <!-- Tab ids match the child segments (default routeFor = (h) => [h.id]).
1133
- * Switching a tab navigates; the guard gates leaving the editor;
1134
- * back/forward and /account/settings deep links move the active tab. -->
1135
- * <cngx-tab-group cngxTabsRouteSync aria-label="Account">
1136
- * <div cngxTab id="editor" label="Editor"></div>
1137
- * <div cngxTab id="preview" label="Preview"></div>
1138
- * <div cngxTab id="settings" label="Settings"></div>
1139
- * </cngx-tab-group>
1140
- *
1141
- * <!-- The active tab's routed component renders here. -->
1142
- * <router-outlet></router-outlet>
1143
- * ```
1039
+ * @category common/tabs
1040
+ */
1041
+ function withTabsSkin(skin) {
1042
+ return defineTabsConfigFeature((cfg) => ({ ...cfg, skin }));
1043
+ }
1044
+ /**
1045
+ * Set the app-wide default icon layout for `<cngx-tab-group>`. \
1046
+ * Default`'start'`. Per-instance `[iconLayout]` Input still wins. Orthogonal to
1047
+ * skin and orientation - only the `[data-icon-layout]` host attribute
1048
+ * changes.
1144
1049
  *
1145
1050
  * @category common/tabs
1146
- * @docsKind primary
1147
- * @wcag AA
1148
- * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/route-sync.directive.ts
1149
- * @since 0.1.0
1150
- * @relatedTo CngxTabGroupPresenter, CngxTabsFragmentSync, createTabRouterCommit, CngxTabNav, CngxTabLink
1151
1051
  */
1152
- class CngxTabsRouteSync {
1153
- /**
1154
- * Maps a tab handle to its router command array. Default
1155
- * `(handle) => [handle.id]` - the tab id is the child segment.
1156
- * Override for real route paths.
1157
- */
1158
- routeFor = input(cngxDefaultTabRoute, ...(ngDevMode ? [{ debugName: "routeFor" }] : /* istanbul ignore next */ []));
1159
- host = inject(CNGX_TAB_GROUP_HOST, { host: true });
1160
- router = inject(Router, { optional: true });
1161
- /**
1162
- * Pessimistic-only - not exposed as an input. The route-sync owns the
1163
- * mode so optimistic (show-then-revert) can never flash the target
1164
- * tab before a `CanDeactivate` guard decides.
1165
- */
1166
- mode = signal('pessimistic', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
1167
- /**
1168
- * Router commit-action read by the presenter via the DI fallback.
1169
- * `null` when no `Router` is available (graceful no-op). Rebuilt only
1170
- * when `routeFor` changes; the navigation gate itself is the async
1171
- * op inside the action.
1172
- */
1173
- action = computed(() => {
1174
- const router = this.router;
1175
- if (!router) {
1176
- return null;
1177
- }
1178
- return createTabRouterCommit({
1179
- router,
1180
- tabs: this.host.tabs,
1181
- routeFor: this.routeFor(),
1182
- });
1183
- }, ...(ngDevMode ? [{ debugName: "action" }] : /* istanbul ignore next */ []));
1184
- constructor() {
1185
- if (!this.router) {
1186
- afterNextRender(() => warnTabsRouterAbsent('CngxTabsRouteSync', 'routed tabs'));
1187
- return;
1188
- }
1189
- const router = this.router;
1190
- const destroyRef = inject(DestroyRef);
1191
- // Seed from the current URL once the registry has populated.
1192
- afterNextRender(() => {
1193
- untracked(() => this.reflectFromUrl(router));
1194
- });
1195
- const navEnd = toSignal(router.events.pipe(filter((e) => e instanceof NavigationEnd), takeUntilDestroyed(destroyRef)), { initialValue: null });
1196
- effect(() => {
1197
- const e = navEnd();
1198
- if (!e) {
1199
- return;
1200
- }
1201
- untracked(() => this.reflectFromUrl(router));
1202
- });
1203
- }
1204
- /**
1205
- * Mirror the URL's active tab onto `activeIndex` without navigating.
1206
- * Writing the index directly (not via `select()`) is the re-entry
1207
- * guard: `select()` would re-run the commit-action and navigate to
1208
- * the route the router is already on, leaving the commit pending
1209
- * forever.
1210
- */
1211
- reflectFromUrl(router) {
1212
- const next = this.readActiveId(router);
1213
- if (!next || next === this.host.activeId()) {
1214
- return;
1215
- }
1216
- const index = this.host.tabs().findIndex((t) => t.id === next);
1217
- if (index >= 0) {
1218
- this.host.activeIndex.set(index);
1219
- }
1220
- }
1221
- /**
1222
- * Find the tab whose route is the trailing segment(s) of the current
1223
- * URL path. Anchors on position (a suffix match), not a loose
1224
- * "appears anywhere" scan - a tab id that happens to equal an
1225
- * unrelated parent segment cannot win. The path is taken before any
1226
- * query/fragment. If two tabs produce the same trailing segment(s)
1227
- * (only possible with a custom `routeFor` that collides), the first
1228
- * registered tab wins - the default id-based mapping never collides.
1229
- */
1230
- readActiveId(router) {
1231
- const path = router.url.split(/[?#]/)[0];
1232
- const segments = path.split('/').filter(Boolean);
1233
- const routeFor = this.routeFor();
1234
- for (const tab of this.host.tabs()) {
1235
- const route = routeFor(tab).map((command) => String(command));
1236
- if (route.length === 0 || route.length > segments.length) {
1237
- continue;
1238
- }
1239
- const tail = segments.slice(-route.length);
1240
- if (tail.every((segment, i) => segment === route[i])) {
1241
- return tab.id;
1242
- }
1243
- }
1244
- return null;
1245
- }
1246
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabsRouteSync, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1247
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxTabsRouteSync, isStandalone: true, selector: "[cngxTabsRouteSync]", inputs: { routeFor: { classPropertyName: "routeFor", publicName: "routeFor", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_TABS_COMMIT_ACTION, useExisting: CngxTabsRouteSync }], exportAs: ["cngxTabsRouteSync"], ngImport: i0 });
1052
+ function withTabsIconLayout(layout) {
1053
+ return defineTabsConfigFeature((cfg) => ({ ...cfg, iconLayout: layout }));
1248
1054
  }
1249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabsRouteSync, decorators: [{
1250
- type: Directive,
1251
- args: [{
1252
- selector: '[cngxTabsRouteSync]',
1253
- exportAs: 'cngxTabsRouteSync',
1254
- standalone: true,
1255
- providers: [{ provide: CNGX_TABS_COMMIT_ACTION, useExisting: CngxTabsRouteSync }],
1256
- }]
1257
- }], ctorParameters: () => [], propDecorators: { routeFor: [{ type: i0.Input, args: [{ isSignal: true, alias: "routeFor", required: false }] }] } });
1258
-
1259
- const TABS_CONFIG_DEFAULTS = {
1260
- defaultOrientation: 'horizontal',
1261
- defaultLoop: true,
1262
- defaultCommitMode: 'optimistic',
1263
- fragmentSyncMode: 'fragment',
1264
- fragmentSyncParam: 'tab',
1265
- ariaLabels: {
1266
- tabsRegion: 'Tabs',
1267
- },
1268
- fallbackLabels: {
1269
- // W3C ARIA tablist convention - kept distinct from
1270
- // `i18n.tabsLabel` so AT doesn't read the same string twice
1271
- // back-to-back across `aria-roledescription` and `aria-label`.
1272
- tabRoleDescription: 'tab list',
1273
- tabPanelRoleDescription: 'tab panel',
1274
- },
1275
- overflowStabilizeMs: 100,
1276
- overflowMaxDeferMs: 250,
1277
- templates: {},
1278
- };
1279
1055
  /**
1280
- * DI token for the resolved tabs config. \
1281
- * `providedIn: 'root'` with the library defaults; override via {@link provideTabsConfig}
1282
- * (root) or {@link provideTabsConfigAt} (component scope).
1056
+ * Set the app-wide default panel render strategy for `<cngx-tab-group>`. \
1057
+ * Default `'eager'` (every panel's content rendered up front, toggled
1058
+ * via `[hidden]`). `'lazy'` keep-alives content after first activation;
1059
+ * `'lazy-destroy'` renders only the active panel's content. Per-instance
1060
+ * `[panelMode]` Input still wins. The panel `<div>` always stays in the
1061
+ * DOM regardless of mode (the `aria-controls` target).
1062
+ *
1063
+ * Under `'lazy'`, a deep link mounts only the panel it names: both sync
1064
+ * directives seed the active tab before the first panel render.
1283
1065
  *
1284
1066
  * @category common/tabs
1285
- * @wcag AA
1286
- * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tabs-config.ts
1287
- * @since 0.1.0
1288
1067
  */
1289
- const CNGX_TABS_CONFIG = new InjectionToken('CngxTabsConfig', {
1290
- providedIn: 'root',
1291
- factory: () => TABS_CONFIG_DEFAULTS,
1292
- });
1068
+ function withTabsPanelMode(mode) {
1069
+ return defineTabsConfigFeature((cfg) => ({ ...cfg, panelMode: mode }));
1070
+ }
1293
1071
  /**
1294
- * Internal helper that brands a config-mutator function with the
1295
- * `_target` discriminator. \
1296
- * Every `with*` config feature returns one
1297
- * of these.
1072
+ * Set the app-wide default for stretching tabs to the full strip width
1073
+ * (horizontal only). \
1074
+ * Default `false`. Per-instance `[fitted]` Input still
1075
+ * wins. No effect under `orientation="vertical"`.
1298
1076
  *
1299
- * @internal
1077
+ * @category common/tabs
1300
1078
  */
1301
- function defineTabsConfigFeature(fn) {
1302
- return Object.assign(fn, { _target: 'config' });
1079
+ function withTabsFitted(fitted) {
1080
+ return defineTabsConfigFeature((cfg) => ({ ...cfg, fitted }));
1303
1081
  }
1304
1082
  /**
1305
- * Override the default orientation. Per-instance `[orientation]`
1306
- * still wins; this changes the cascade default only.
1083
+ * Set the app-wide default tab-cluster alignment (horizontal only). \
1084
+ * Default `'start'`. Per-instance `[tabAlign]` Input still wins. Ignored
1085
+ * under `orientation="vertical"` and when the group is `fitted`.
1307
1086
  *
1308
1087
  * @category common/tabs
1309
1088
  */
1310
- function withTabsDefaultOrientation(orientation) {
1311
- return defineTabsConfigFeature((cfg) => ({
1312
- ...cfg,
1313
- defaultOrientation: orientation,
1314
- }));
1089
+ function withTabsAlign(align) {
1090
+ return defineTabsConfigFeature((cfg) => ({ ...cfg, tabAlign: align }));
1315
1091
  }
1316
1092
  /**
1317
- * @deprecated Use {@link withTabsDefaultOrientation}. The unprefixed name
1318
- * collides with the stepper family's identical symbol when both libs
1319
- * are auto-imported. The alias stays for one minor release before
1320
- * removal.
1093
+ * Set the app-wide default for whether tabs render a close affordance. \
1094
+ * Default `false`. Per-instance `[closable]` Input wins; a per-`CngxTab`
1095
+ * `[closable]` override wins over both.
1321
1096
  *
1322
1097
  * @category common/tabs
1323
1098
  */
1324
- const withDefaultOrientation = withTabsDefaultOrientation;
1099
+ function withTabsClosable(closable) {
1100
+ return defineTabsConfigFeature((cfg) => ({ ...cfg, closable }));
1101
+ }
1325
1102
  /**
1326
- * Override whether roving-tabindex navigation loops from last back to
1327
- * first (and vice versa). Per-instance `[loop]` Input still wins.
1103
+ * Set the app-wide default for whether the group renders an add-tab
1104
+ * button. \
1105
+ * Default `false`. Per-instance `[addable]` Input wins.
1328
1106
  *
1329
1107
  * @category common/tabs
1330
1108
  */
1331
- function withTabsRovingLoop(loop) {
1332
- return defineTabsConfigFeature((cfg) => ({ ...cfg, defaultLoop: loop }));
1109
+ function withTabsAddable(addable) {
1110
+ return defineTabsConfigFeature((cfg) => ({ ...cfg, addable }));
1333
1111
  }
1334
1112
  /**
1335
- * Override the default commit mode for async tab transitions.
1336
- * `'optimistic'` activates the tab on action dispatch and rolls back
1337
- * on error; `'pessimistic'` waits for success. Per-instance
1338
- * `[commitMode]` Input still wins.
1113
+ * Merge ARIA labels into the cascade. Keys not provided keep their
1114
+ * library defaults; per-instance overrides on the tab group still win.
1339
1115
  *
1340
1116
  * @category common/tabs
1341
1117
  */
1342
- function withTabsCommitMode(mode) {
1118
+ function withTabsAriaLabels(labels) {
1343
1119
  return defineTabsConfigFeature((cfg) => ({
1344
1120
  ...cfg,
1345
- defaultCommitMode: mode,
1121
+ ariaLabels: { ...cfg.ariaLabels, ...labels },
1346
1122
  }));
1347
1123
  }
1348
1124
  /**
1349
- * Configure URL fragment / query-param deep-linking for the active tab
1350
- * (the {@link CngxTabsFragmentSync} directive). \
1351
- * `mode` chooses the URL surface (URL fragment or query parameter); `param` names the key
1352
- * (default `'tab'`).
1353
- *
1354
- * Not to be confused with `[cngxTabsRouteSync]`, the router-outlet
1355
- * integration - this feature configures fragment deep-linking only.
1125
+ * Merge text fallback labels (overflow trigger, busy / rejection text)
1126
+ * into the cascade. Used when a slot directive is not present.
1356
1127
  *
1357
1128
  * @category common/tabs
1358
1129
  */
1359
- function withTabsFragmentSync(mode, param = 'tab') {
1130
+ function withTabsFallbackLabels(labels) {
1360
1131
  return defineTabsConfigFeature((cfg) => ({
1361
1132
  ...cfg,
1362
- fragmentSyncMode: mode,
1363
- fragmentSyncParam: param,
1133
+ fallbackLabels: { ...cfg.fallbackLabels, ...labels },
1364
1134
  }));
1365
1135
  }
1366
1136
  /**
1367
- * @deprecated Use {@link withTabsFragmentSync}. "Router sync" collided
1368
- * with the new `[cngxTabsRouteSync]` router-outlet directive; this
1369
- * feature only ever configured fragment / query-param deep-linking. The
1370
- * alias stays for one minor release before removal.
1137
+ * Override the IO-debounce window (ms). See
1138
+ * {@link CngxTabsConfig.overflowStabilizeMs}.
1371
1139
  *
1372
1140
  * @category common/tabs
1373
1141
  */
1374
- const withTabsRouterSync = withTabsFragmentSync;
1375
- /**
1376
- * Select the app-wide default visual skin for `<cngx-tab-group>`. \
1377
- * Default `'line'`. Per-instance `[skin]` Input still wins; this moves
1378
- * the cascade default. Structure, slots, ARIA, and keyboard behaviour
1379
- * are identical across skins - only the `[data-skin]` host attribute
1380
- * changes the CSS layer. The Material twin (`[cngxMatTabs]`) ignores it.
1381
- *
1382
- * @category common/tabs
1383
- */
1384
- function withTabsSkin(skin) {
1385
- return defineTabsConfigFeature((cfg) => ({ ...cfg, skin }));
1386
- }
1387
- /**
1388
- * Set the app-wide default icon layout for `<cngx-tab-group>`. \
1389
- * Default`'start'`. Per-instance `[iconLayout]` Input still wins. Orthogonal to
1390
- * skin and orientation - only the `[data-icon-layout]` host attribute
1391
- * changes.
1392
- *
1393
- * @category common/tabs
1394
- */
1395
- function withTabsIconLayout(layout) {
1396
- return defineTabsConfigFeature((cfg) => ({ ...cfg, iconLayout: layout }));
1397
- }
1398
- /**
1399
- * Set the app-wide default panel render strategy for `<cngx-tab-group>`. \
1400
- * Default `'eager'` (every panel's content rendered up front, toggled
1401
- * via `[hidden]`). `'lazy'` keep-alives content after first activation;
1402
- * `'lazy-destroy'` renders only the active panel's content. Per-instance
1403
- * `[panelMode]` Input still wins. The panel `<div>` always stays in the
1404
- * DOM regardless of mode (the `aria-controls` target).
1405
- *
1406
- * @category common/tabs
1407
- */
1408
- function withTabsPanelMode(mode) {
1409
- return defineTabsConfigFeature((cfg) => ({ ...cfg, panelMode: mode }));
1410
- }
1411
- /**
1412
- * Set the app-wide default for stretching tabs to the full strip width
1413
- * (horizontal only). \
1414
- * Default `false`. Per-instance `[fitted]` Input still
1415
- * wins. No effect under `orientation="vertical"`.
1416
- *
1417
- * @category common/tabs
1418
- */
1419
- function withTabsFitted(fitted) {
1420
- return defineTabsConfigFeature((cfg) => ({ ...cfg, fitted }));
1421
- }
1422
- /**
1423
- * Set the app-wide default tab-cluster alignment (horizontal only). \
1424
- * Default `'start'`. Per-instance `[tabAlign]` Input still wins. Ignored
1425
- * under `orientation="vertical"` and when the group is `fitted`.
1426
- *
1427
- * @category common/tabs
1428
- */
1429
- function withTabsAlign(align) {
1430
- return defineTabsConfigFeature((cfg) => ({ ...cfg, tabAlign: align }));
1431
- }
1432
- /**
1433
- * Set the app-wide default for whether tabs render a close affordance. \
1434
- * Default `false`. Per-instance `[closable]` Input wins; a per-`CngxTab`
1435
- * `[closable]` override wins over both.
1436
- *
1437
- * @category common/tabs
1438
- */
1439
- function withTabsClosable(closable) {
1440
- return defineTabsConfigFeature((cfg) => ({ ...cfg, closable }));
1441
- }
1442
- /**
1443
- * Set the app-wide default for whether the group renders an add-tab
1444
- * button. \
1445
- * Default `false`. Per-instance `[addable]` Input wins.
1446
- *
1447
- * @category common/tabs
1448
- */
1449
- function withTabsAddable(addable) {
1450
- return defineTabsConfigFeature((cfg) => ({ ...cfg, addable }));
1451
- }
1452
- /**
1453
- * Merge ARIA labels into the cascade. Keys not provided keep their
1454
- * library defaults; per-instance overrides on the tab group still win.
1455
- *
1456
- * @category common/tabs
1457
- */
1458
- function withTabsAriaLabels(labels) {
1459
- return defineTabsConfigFeature((cfg) => ({
1460
- ...cfg,
1461
- ariaLabels: { ...cfg.ariaLabels, ...labels },
1462
- }));
1463
- }
1464
- /**
1465
- * Merge text fallback labels (overflow trigger, busy / rejection text)
1466
- * into the cascade. Used when a slot directive is not present.
1467
- *
1468
- * @category common/tabs
1469
- */
1470
- function withTabsFallbackLabels(labels) {
1471
- return defineTabsConfigFeature((cfg) => ({
1472
- ...cfg,
1473
- fallbackLabels: { ...cfg.fallbackLabels, ...labels },
1474
- }));
1475
- }
1476
- /**
1477
- * Override the IO-debounce window (ms). See
1478
- * {@link CngxTabsConfig.overflowStabilizeMs}.
1479
- *
1480
- * @category common/tabs
1481
- */
1482
- function withTabOverflowStabilizeMs(ms) {
1483
- return defineTabsConfigFeature((cfg) => ({
1484
- ...cfg,
1485
- overflowStabilizeMs: ms,
1486
- }));
1487
- }
1142
+ function withTabOverflowStabilizeMs(ms) {
1143
+ return defineTabsConfigFeature((cfg) => ({
1144
+ ...cfg,
1145
+ overflowStabilizeMs: ms,
1146
+ }));
1147
+ }
1488
1148
  /**
1489
1149
  * Override the worst-case staleness ceiling on the visibility-map
1490
1150
  * commit. See {@link CngxTabsConfig.overflowMaxDeferMs}.
@@ -1601,52 +1261,743 @@ function withTabCloseIconTemplate(template) {
1601
1261
  *
1602
1262
  * @category common/tabs
1603
1263
  */
1604
- function withTabAddIconTemplate(template) {
1605
- return defineTabsConfigFeature((cfg) => ({
1606
- ...cfg,
1607
- templates: { ...cfg.templates, addIcon: template },
1608
- }));
1609
- }
1610
- function resolveFeatures(features) {
1611
- return features.reduce((cfg, feat) => feat(cfg), TABS_CONFIG_DEFAULTS);
1264
+ function withTabAddIconTemplate(template) {
1265
+ return defineTabsConfigFeature((cfg) => ({
1266
+ ...cfg,
1267
+ templates: { ...cfg.templates, addIcon: template },
1268
+ }));
1269
+ }
1270
+ function resolveFeatures(features) {
1271
+ return features.reduce((cfg, feat) => feat(cfg), TABS_CONFIG_DEFAULTS);
1272
+ }
1273
+ /**
1274
+ * Root-level provider. Apply once in `bootstrapApplication` /
1275
+ * `appConfig.providers`. Returns {@link EnvironmentProviders} per
1276
+ * the canonical cngx config-cascade signature.
1277
+ *
1278
+ * @category common/tabs
1279
+ */
1280
+ function provideTabsConfig(...features) {
1281
+ return makeEnvironmentProviders([
1282
+ { provide: CNGX_TABS_CONFIG, useValue: resolveFeatures(features) },
1283
+ ]);
1284
+ }
1285
+ /**
1286
+ * Component-scoped override. Returns `Provider[]` (not
1287
+ * {@link EnvironmentProviders}) because `viewProviders` rejects
1288
+ * opaque environment providers. Resolution priority: per-instance
1289
+ * Input > viewProviders (`At`) > root > default.
1290
+ *
1291
+ * ```ts
1292
+ * @Component({
1293
+ * viewProviders: [...provideTabsConfigAt(withTabsDefaultOrientation('vertical'))],
1294
+ * })
1295
+ * ```
1296
+ *
1297
+ * @category common/tabs
1298
+ */
1299
+ function provideTabsConfigAt(...features) {
1300
+ return [{ provide: CNGX_TABS_CONFIG, useValue: resolveFeatures(features) }];
1301
+ }
1302
+ /**
1303
+ * Inject the resolved tabs config in an injection context.
1304
+ *
1305
+ * @category common/tabs
1306
+ */
1307
+ function injectTabsConfig() {
1308
+ return inject(CNGX_TABS_CONFIG);
1309
+ }
1310
+
1311
+ /**
1312
+ * Turns a consumer `<a routerLink>` into a registered {@link CngxTabHandle}
1313
+ * inside a {@link CngxTabNav}. \
1314
+ * Native parallel of {@link CngxMatTabLink}: in a
1315
+ * navigation bar the link IS the tab, so this per-anchor directive is the
1316
+ * registration seam - symmetric with how `CngxTab` registers each `[cngxTab]`.
1317
+ *
1318
+ * Carries no rendering and no click handler. Navigation is the native
1319
+ * `routerLink` (middle-click, open-in-new-tab and the hover URL all work),
1320
+ * gating is the link's own `CanDeactivate`, and the active marker comes from
1321
+ * the route: `[cngxTabsRouteSync]` on the nav reflects `NavigationEnd` onto the
1322
+ * presenter's `activeId`, which this link matches against its own `id`. \
1323
+ * There is no `select()` call - invoking it would re-enter the commit path the
1324
+ * routed-nav model deliberately keeps dormant.
1325
+ *
1326
+ * **Error communication is reactive:** `aria-invalid` plus the
1327
+ * `--error` skin glyph signal the state, and an injected screen-reader
1328
+ * descriptor span (referenced by a permanent `aria-describedby`) carries the
1329
+ * direct `[error]` message string so assistive tech reads *why* the link is
1330
+ * invalid.
1331
+ *
1332
+ * ```html
1333
+ * <cngx-tab-nav cngxTabsRouteSync>
1334
+ * <a cngxTabLink id="overview" routerLink="overview">Overview</a>
1335
+ * <a cngxTabLink id="profile" routerLink="profile" [error]="profileInvalid">Profile</a>
1336
+ * </cngx-tab-nav>
1337
+ * ```
1338
+ *
1339
+ * @category common/tabs
1340
+ * @docsKind primary
1341
+ * @wcag AA
1342
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/tab-link.directive.ts
1343
+ * @since 0.1.0
1344
+ * @relatedTo CngxTabNav, CngxTabsRouteSync, CngxTab, CngxMatTabLink
1345
+ */
1346
+ class CngxTabLink {
1347
+ host = inject(CNGX_TAB_GROUP_HOST, { optional: true });
1348
+ config = injectTabsConfig();
1349
+ destroyRef = inject(DestroyRef);
1350
+ renderer = inject(Renderer2);
1351
+ hostEl = inject(ElementRef).nativeElement;
1352
+ /**
1353
+ * Handle id. Set it to the link's route segment so the nav's
1354
+ * `[cngxTabsRouteSync]` reflects the active route onto this link via the
1355
+ * default `(h) => [h.id]` mapping. Defaults to a fresh uid when route-sync
1356
+ * is not used.
1357
+ */
1358
+ id = input(nextUid('cngx-tab-link-'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
1359
+ /** Accessible label fed to the nav's live-region announcer. */
1360
+ label = input(undefined, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1361
+ /**
1362
+ * Direct error flag for the link - `true` or a non-empty string marks it
1363
+ * invalid (the string doubles as the message). Mirrors `CngxTab.error`.
1364
+ */
1365
+ error = input(false, ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
1366
+ /** Optional rich error aggregator for the link. */
1367
+ errorAggregator = input(undefined, ...(ngDevMode ? [{ debugName: "errorAggregator" }] : /* istanbul ignore next */ []));
1368
+ /**
1369
+ * Resolved direct-error message: the `[error]` string when non-empty, else
1370
+ * `undefined`. Carried onto the registration handle by reference.
1371
+ * `computed` over the input - never written.
1372
+ */
1373
+ errorMessage = computed(() => {
1374
+ const value = this.error();
1375
+ return typeof value === 'string' && value !== '' ? value : undefined;
1376
+ }, ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
1377
+ /**
1378
+ * Per-link error fold driving `aria-invalid` and the `--error` class.
1379
+ * `true` when the direct `[error]` flag is set OR the optional aggregator
1380
+ * wants to reveal (`shouldShow()`, so deferred-reveal validation stays
1381
+ * silent until revealed). Mirrors `CngxTab.hasError`.
1382
+ */
1383
+ hasError = computed(() => {
1384
+ const direct = this.error();
1385
+ return ((direct !== false && direct !== '') || (this.errorAggregator()?.shouldShow?.() ?? false));
1386
+ }, { ...(ngDevMode ? { debugName: "hasError" } : /* istanbul ignore next */ {}), equal: Object.is });
1387
+ /**
1388
+ * Which `aria-current` token the link publishes while it is active.
1389
+ * Cascade: this input -> `CngxTabsConfig.linkAriaCurrent`
1390
+ * ({@link withTabsLinkAriaCurrent}) -> `'page'`.
1391
+ *
1392
+ * Use `'true'` when the link owns a *subtree* and stays active for URLs
1393
+ * beneath it - a section nav driven by `[cngxTabsRouteSync]` in its
1394
+ * prefix mode. WAI-ARIA reserves `page` for the current page itself, so
1395
+ * `page` on an ancestor section over-claims: AT reads "current page" for
1396
+ * something that is not the page being viewed. A whole nav switches at
1397
+ * once via `provideTabsConfigAt(withTabsLinkAriaCurrent('true'))`; this
1398
+ * input is the per-link escape hatch.
1399
+ *
1400
+ * Not derived from the sync directive's match mode on purpose. `selected`
1401
+ * has exactly one source, the presenter's `activeId` (Pillar 1); reading
1402
+ * a sibling directive's mode here would fork that derivation and couple
1403
+ * the atom to a directive it does not otherwise know about.
1404
+ */
1405
+ ariaCurrent = input(undefined, ...(ngDevMode ? [{ debugName: "ariaCurrent" }] : /* istanbul ignore next */ []));
1406
+ /** Resolved token: input -> config -> `'page'`. */
1407
+ resolvedAriaCurrent = computed(() => this.ariaCurrent() ?? this.config.linkAriaCurrent ?? 'page', ...(ngDevMode ? [{ debugName: "resolvedAriaCurrent" }] : /* istanbul ignore next */ []));
1408
+ /** `true` when the presenter's `activeId` equals this link's id. */
1409
+ selected = computed(() => this.host?.activeId() === this.id(), { ...(ngDevMode ? { debugName: "selected" } : /* istanbul ignore next */ {}), equal: Object.is });
1410
+ /**
1411
+ * Id of the injected SR error-message descriptor. Always referenced by the
1412
+ * `aria-describedby` host binding (Pillar 2 - the id is permanent; the
1413
+ * span's content and `aria-hidden` toggle, never the id itself).
1414
+ */
1415
+ descriptorId = computed(() => `${this.id()}-desc`, ...(ngDevMode ? [{ debugName: "descriptorId" }] : /* istanbul ignore next */ []));
1416
+ /** The injected descriptor `<span>`, created in {@link ngOnInit}. */
1417
+ descriptorEl = null;
1418
+ constructor() {
1419
+ if (!this.host) {
1420
+ throw new Error('CngxTabLink: no enclosing CngxTabGroupPresenter found. Wrap the link inside <cngx-tab-nav> (or an element carrying [cngxTabGroup]).');
1421
+ }
1422
+ // Mirror the direct-error message into the describedby span. DOM side
1423
+ // effect only - no signal writes. Guards until the span exists (created
1424
+ // in ngOnInit); errorMessage / descriptorId changes re-run it after.
1425
+ effect(() => {
1426
+ const el = this.descriptorEl;
1427
+ if (el) {
1428
+ this.syncDescriptor(el);
1429
+ }
1430
+ });
1431
+ }
1432
+ ngOnInit() {
1433
+ // Register in ngOnInit, NOT the constructor: a dynamically-bound `[id]`
1434
+ // signal input is not applied until the first change detection, so a
1435
+ // constructor read would capture the default auto-id. The handle id is the
1436
+ // stable key the nav's route-sync matches the URL segment against.
1437
+ const host = this.host;
1438
+ const handle = {
1439
+ id: this.id(),
1440
+ label: this.label,
1441
+ subLabel: signal(undefined),
1442
+ disabled: signal(false),
1443
+ errorAggregator: this.errorAggregator,
1444
+ hasError: this.hasError,
1445
+ errorMessage: this.errorMessage,
1446
+ closable: signal(undefined),
1447
+ };
1448
+ host.register(handle);
1449
+ // Inject the SR error-message descriptor as a SIBLING of the anchor: a
1450
+ // child span would fold into the link's accessible name, so it lives
1451
+ // beside it and is reached only via the aria-describedby id.
1452
+ const descriptor = this.renderer.createElement('span');
1453
+ this.renderer.addClass(descriptor, 'cngx-sr-only');
1454
+ const parent = this.renderer.parentNode(this.hostEl);
1455
+ if (parent) {
1456
+ this.renderer.insertBefore(parent, descriptor, this.renderer.nextSibling(this.hostEl));
1457
+ }
1458
+ this.descriptorEl = descriptor;
1459
+ this.syncDescriptor(descriptor);
1460
+ this.destroyRef.onDestroy(() => {
1461
+ host.unregister(handle.id);
1462
+ if (parent) {
1463
+ this.renderer.removeChild(parent, descriptor);
1464
+ }
1465
+ });
1466
+ }
1467
+ /**
1468
+ * Write the current direct-error message into the descriptor span and
1469
+ * toggle its `aria-hidden` so a clear link exposes no description. Keeps
1470
+ * the span id in sync with {@link descriptorId} (read here so the effect
1471
+ * tracks an id change too).
1472
+ */
1473
+ syncDescriptor(el) {
1474
+ this.renderer.setAttribute(el, 'id', this.descriptorId());
1475
+ const message = this.errorMessage() ?? '';
1476
+ this.renderer.setProperty(el, 'textContent', message);
1477
+ if (message) {
1478
+ this.renderer.removeAttribute(el, 'aria-hidden');
1479
+ }
1480
+ else {
1481
+ this.renderer.setAttribute(el, 'aria-hidden', 'true');
1482
+ }
1483
+ }
1484
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabLink, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1485
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxTabLink, isStandalone: true, selector: "[cngxTabLink]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, errorAggregator: { classPropertyName: "errorAggregator", publicName: "errorAggregator", isSignal: true, isRequired: false, transformFunction: null }, ariaCurrent: { classPropertyName: "ariaCurrent", publicName: "ariaCurrent", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-current": "selected() ? resolvedAriaCurrent() : null", "attr.aria-invalid": "hasError() ? 'true' : null", "attr.aria-describedby": "descriptorId()", "class.cngx-tab-nav__link--active": "selected()", "class.cngx-tab-nav__link--error": "hasError()" }, classAttribute: "cngx-tab-nav__link" }, exportAs: ["cngxTabLink"], ngImport: i0 });
1486
+ }
1487
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabLink, decorators: [{
1488
+ type: Directive,
1489
+ args: [{
1490
+ selector: '[cngxTabLink]',
1491
+ exportAs: 'cngxTabLink',
1492
+ standalone: true,
1493
+ host: {
1494
+ class: 'cngx-tab-nav__link',
1495
+ '[attr.aria-current]': 'selected() ? resolvedAriaCurrent() : null',
1496
+ '[attr.aria-invalid]': "hasError() ? 'true' : null",
1497
+ '[attr.aria-describedby]': 'descriptorId()',
1498
+ '[class.cngx-tab-nav__link--active]': 'selected()',
1499
+ '[class.cngx-tab-nav__link--error]': 'hasError()',
1500
+ },
1501
+ }]
1502
+ }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], errorAggregator: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorAggregator", required: false }] }], ariaCurrent: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaCurrent", required: false }] }] } });
1503
+
1504
+ /**
1505
+ * Single dev-warning both tab sync directives emit when `@angular/router`
1506
+ * is not provided. Shared so the message stays identical across
1507
+ * {@link CngxTabsFragmentSync} (deep-linking) and {@link CngxTabsRouteSync}
1508
+ * (router-outlet); only the `enables` clause differs. The URL readers
1509
+ * themselves stay separate - they target different surfaces (fragment /
1510
+ * query-param vs route path) and must not converge.
1511
+ *
1512
+ * @internal
1513
+ */
1514
+ function warnTabsRouterAbsent(directive, enables) {
1515
+ console.warn(`${directive}: no Router available - directive is a no-op. ` +
1516
+ `Provide @angular/router via provideRouter(...) to enable ${enables}.`);
1517
+ }
1518
+
1519
+ /**
1520
+ * URL deep-linking for tab groups. \
1521
+ * Bidirectional sync between `activeId` and a URL fragment or query-param. Opt-in via
1522
+ * `[cngxTabsFragmentSync]` on the presenter element.
1523
+ *
1524
+ * - `mode = 'fragment'` (default) → `#tab=settings`
1525
+ * - `mode = 'queryParam'` with `paramName = 'tab'` → `?tab=settings`
1526
+ *
1527
+ * Reflecting the active tab replaces the current history entry by
1528
+ * default, so browser-back leaves the page instead of stepping through
1529
+ * the tabs opened on the way. Set `[replaceUrl]="false"` when the tabs
1530
+ * read as distinct destinations.
1531
+ *
1532
+ * `Router` is optional - without it the directive logs a dev warning
1533
+ * via `afterNextRender` and becomes a no-op. \
1534
+ * Every `router.navigate` and `host.selectById` inside the effects sits in `untracked()`.
1535
+ *
1536
+ * ```html
1537
+ * <!-- Default fragment mode: the active tab reflects to #tab=<id>, and a
1538
+ * deep link like /account#tab=settings selects that tab on load. -->
1539
+ * <cngx-tab-group cngxTabsFragmentSync>
1540
+ * <div cngxTab id="overview" label="Overview"></div>
1541
+ * <div cngxTab id="settings" label="Settings"></div>
1542
+ * </cngx-tab-group>
1543
+ *
1544
+ * <!-- Query-param mode with a custom name -> ?section=settings -->
1545
+ * <cngx-tab-group cngxTabsFragmentSync mode="queryParam" paramName="section">
1546
+ * <!-- ...tabs... -->
1547
+ * </cngx-tab-group>
1548
+ * ```
1549
+ *
1550
+ * @category common/tabs
1551
+ * @docsKind primary
1552
+ * @wcag AA
1553
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/router-sync.directive.ts
1554
+ * @since 0.1.0
1555
+ * @relatedTo CngxTabGroupPresenter, CngxTab
1556
+ */
1557
+ class CngxTabsFragmentSync {
1558
+ mode = input('fragment', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
1559
+ paramName = input('tab', ...(ngDevMode ? [{ debugName: "paramName" }] : /* istanbul ignore next */ []));
1560
+ /**
1561
+ * Whether reflecting the active tab into the URL replaces the current
1562
+ * history entry instead of pushing a new one. Default `true`, which is
1563
+ * right for a view toggle: browser-back leaves the page rather than
1564
+ * stepping through the tabs the user opened on the way.
1565
+ *
1566
+ * Set `false` when the tabs read as distinct destinations and back
1567
+ * should step between them. Note that every tab switch then costs a
1568
+ * history entry.
1569
+ */
1570
+ replaceUrl = input(true, ...(ngDevMode ? [{ debugName: "replaceUrl" }] : /* istanbul ignore next */ []));
1571
+ host = inject(CNGX_TAB_GROUP_HOST, { host: true });
1572
+ router = inject(Router, { optional: true });
1573
+ /**
1574
+ * Latched once the URL seed has reached a registered tab, so the
1575
+ * `afterNextRender` fallback cannot run it twice.
1576
+ *
1577
+ * Not symmetric with {@link CngxTabsRouteSync}, and it has to be: that
1578
+ * sibling writes `activeIndex` directly, so its second seed bails on
1579
+ * the already-matching id. This one goes through `select()`, and under
1580
+ * a pessimistic commit `activeIndex` still holds the *previous* value
1581
+ * while the action is in flight - so the presenter's `target ===
1582
+ * previous` bail does not catch the repeat, and a consumer's async
1583
+ * commit action would fire a second time and supersede the first.
1584
+ */
1585
+ seeded = false;
1586
+ constructor() {
1587
+ if (!this.router) {
1588
+ afterNextRender(() => warnTabsRouterAbsent('CngxTabsFragmentSync', 'deep-linking'));
1589
+ return;
1590
+ }
1591
+ const router = this.router;
1592
+ const destroyRef = inject(DestroyRef);
1593
+ // Fallback seed for tabs that register after content-init (a
1594
+ // dynamic @for over an async list). Idempotent against the
1595
+ // content-init seed: selectById is a no-op when the id is already
1596
+ // active.
1597
+ afterNextRender(() => {
1598
+ this.seedFromUrl(router);
1599
+ });
1600
+ effect(() => {
1601
+ const id = this.host.activeId();
1602
+ if (!id) {
1603
+ return;
1604
+ }
1605
+ untracked(() => {
1606
+ const replaceUrl = this.replaceUrl();
1607
+ const navigation = this.mode() === 'fragment'
1608
+ ? router.navigate([], {
1609
+ fragment: `${this.paramName()}=${id}`,
1610
+ queryParamsHandling: 'merge',
1611
+ replaceUrl,
1612
+ })
1613
+ : router.navigate([], {
1614
+ queryParams: { [this.paramName()]: id },
1615
+ queryParamsHandling: 'merge',
1616
+ replaceUrl,
1617
+ });
1618
+ // Router rejection (e.g. cancelled navigation) has no recovery path.
1619
+ navigation.catch?.(() => undefined);
1620
+ });
1621
+ });
1622
+ const navEnd = toSignal(router.events.pipe(filter((e) => e instanceof NavigationEnd), takeUntilDestroyed(destroyRef)), { initialValue: null });
1623
+ effect(() => {
1624
+ const e = navEnd();
1625
+ if (!e) {
1626
+ return;
1627
+ }
1628
+ untracked(() => {
1629
+ const next = this.readUrlValue(router);
1630
+ if (next && next !== this.host.activeId()) {
1631
+ this.host.selectById(next);
1632
+ }
1633
+ });
1634
+ });
1635
+ }
1636
+ /**
1637
+ * Seed from the URL before the group renders its panels. `CngxTab`
1638
+ * registers in `ngOnInit`, so the registry is populated by the time
1639
+ * this runs, and the group's own view has not rendered yet - which is
1640
+ * what keeps `panelMode="lazy"` from counting the default tab's first
1641
+ * render as its first activation on a deep link.
1642
+ *
1643
+ * Unlike {@link CngxTabsRouteSync}, this seed goes through
1644
+ * `selectById`, so it runs `select()` and any consumer-bound
1645
+ * commit-action. Moving it earlier therefore also moves when that
1646
+ * action first fires; it still fires exactly once for the seed.
1647
+ *
1648
+ * Its own router guard: the constructor's early return does not stop
1649
+ * lifecycle hooks from running.
1650
+ */
1651
+ ngAfterContentInit() {
1652
+ if (!this.router) {
1653
+ return;
1654
+ }
1655
+ this.seedFromUrl(this.router);
1656
+ }
1657
+ seedFromUrl(router) {
1658
+ if (this.seeded) {
1659
+ return;
1660
+ }
1661
+ const initial = this.readUrlValue(router);
1662
+ if (!initial) {
1663
+ return;
1664
+ }
1665
+ // Only latch once the target is actually registered. A seed that
1666
+ // found no matching tab leaves the fallback armed for tabs that
1667
+ // register after content-init.
1668
+ if (!this.host.tabs().some((tab) => tab.id === initial)) {
1669
+ return;
1670
+ }
1671
+ this.seeded = true;
1672
+ untracked(() => this.host.selectById(initial));
1673
+ }
1674
+ readUrlValue(router) {
1675
+ if (this.mode() === 'fragment') {
1676
+ const fragment = router.routerState.snapshot.root.fragment ?? '';
1677
+ return this.parseFragment(fragment);
1678
+ }
1679
+ return router.routerState.snapshot.root.queryParamMap.get(this.paramName()) ?? null;
1680
+ }
1681
+ parseFragment(fragment) {
1682
+ const param = this.paramName();
1683
+ const segments = fragment.split('&');
1684
+ for (const seg of segments) {
1685
+ const [key, val] = seg.split('=');
1686
+ if (key === param && val) {
1687
+ return val;
1688
+ }
1689
+ }
1690
+ return null;
1691
+ }
1692
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabsFragmentSync, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1693
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxTabsFragmentSync, isStandalone: true, selector: "[cngxTabsFragmentSync]", inputs: { mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, paramName: { classPropertyName: "paramName", publicName: "paramName", isSignal: true, isRequired: false, transformFunction: null }, replaceUrl: { classPropertyName: "replaceUrl", publicName: "replaceUrl", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cngxTabsFragmentSync"], ngImport: i0 });
1694
+ }
1695
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabsFragmentSync, decorators: [{
1696
+ type: Directive,
1697
+ args: [{
1698
+ selector: '[cngxTabsFragmentSync]',
1699
+ exportAs: 'cngxTabsFragmentSync',
1700
+ standalone: true,
1701
+ }]
1702
+ }], ctorParameters: () => [], propDecorators: { mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], paramName: [{ type: i0.Input, args: [{ isSignal: true, alias: "paramName", required: false }] }], replaceUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "replaceUrl", required: false }] }] } });
1703
+
1704
+ /**
1705
+ * Default tab-to-route mapping: the tab id is the child segment.
1706
+ * Shared so the factory and `[cngxTabsRouteSync]` reference one
1707
+ * definition instead of inlining the closure twice.
1708
+ *
1709
+ * @internal
1710
+ */
1711
+ const cngxDefaultTabRoute = (handle) => [handle.id];
1712
+ /**
1713
+ * Builds a {@link CngxTabsCommitAction} that gates a tab switch through
1714
+ * `@angular/router`. The action navigates to the target tab's route and
1715
+ * resolves on the router's own outcome:
1716
+ *
1717
+ * - `NavigationEnd` → `true` (commit the switch)
1718
+ * - `NavigationCancel` (a `CanDeactivate` guard blocked) → `false`
1719
+ * - `NavigationError` (guard/resolver threw) → `false`
1720
+ *
1721
+ * Routed tabs reuse the presenter's commit lifecycle verbatim - the
1722
+ * router navigation is simply the async op. \
1723
+ * In pessimistic mode the active tab follows the *resolved* route, so a cancelled guard keeps
1724
+ * the old tab with zero extra gate machinery. The events subscription
1725
+ * is opened *before* `navigate(...)` so a synchronously-resolving
1726
+ * navigation cannot emit before the action is listening; the commit
1727
+ * controller's `cancel()` unsubscribes on supersede.
1728
+ *
1729
+ * @category common/tabs
1730
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/router-commit.ts
1731
+ * @since 0.1.0
1732
+ */
1733
+ function createTabRouterCommit(opts) {
1734
+ const routeFor = opts.routeFor ?? cngxDefaultTabRoute;
1735
+ return (_fromIndex, toIndex) => new Observable((subscriber) => {
1736
+ const target = opts.tabs()[toIndex];
1737
+ if (!target) {
1738
+ subscriber.next(false);
1739
+ subscriber.complete();
1740
+ return;
1741
+ }
1742
+ const sub = opts.router.events
1743
+ .pipe(filter((e) => e instanceof NavigationEnd ||
1744
+ e instanceof NavigationCancel ||
1745
+ e instanceof NavigationError), take(1))
1746
+ .subscribe((event) => {
1747
+ subscriber.next(event instanceof NavigationEnd);
1748
+ subscriber.complete();
1749
+ });
1750
+ // A rejected promise surfaces on the events stream as
1751
+ // NavigationError, so the subscription above is the single
1752
+ // resolution path; swallow the promise rejection to avoid an
1753
+ // unhandled-rejection warning.
1754
+ opts.router.navigate(routeFor(target)).catch(() => undefined);
1755
+ return () => sub.unsubscribe();
1756
+ });
1612
1757
  }
1758
+
1613
1759
  /**
1614
- * Root-level provider. Apply once in `bootstrapApplication` /
1615
- * `appConfig.providers`. Returns {@link EnvironmentProviders} per
1616
- * the canonical cngx config-cascade signature.
1760
+ * Router-outlet integration for tab groups. \
1761
+ * Opt-in via `[cngxTabsRouteSync]` on the presenter element. Each tab is an
1762
+ * Angular child route whose component renders into a `<router-outlet>`;
1763
+ * switching tabs navigates, and a `CanDeactivate` guard can gate the
1764
+ * leave.
1617
1765
  *
1618
- * @category common/tabs
1619
- */
1620
- function provideTabsConfig(...features) {
1621
- return makeEnvironmentProviders([
1622
- { provide: CNGX_TABS_CONFIG, useValue: resolveFeatures(features) },
1623
- ]);
1624
- }
1625
- /**
1626
- * Component-scoped override. Returns `Provider[]` (not
1627
- * {@link EnvironmentProviders}) because `viewProviders` rejects
1628
- * opaque environment providers. Resolution priority: per-instance
1629
- * Input > viewProviders (`At`) > root > default.
1766
+ * Supplies the presenter's commit-action through the
1767
+ * {@link CNGX_TABS_COMMIT_ACTION} DI fallback (no consumer
1768
+ * `[commitAction]` hand-binding) and pins **pessimistic** mode so the
1769
+ * active tab follows the *resolved* route - a guard-cancelled switch
1770
+ * keeps the old tab. The routing gate reuses the presenter's commit
1771
+ * lifecycle verbatim; the router navigation is the async op.
1772
+ *
1773
+ * Seeds the active tab from the current URL at content-init - before
1774
+ * the group renders its panels, so a deep link under
1775
+ * `panelMode="lazy"` mounts only the target panel - and reflects
1776
+ * external navigations (back/forward, direct URL) into `activeIndex`
1777
+ * *without* re-navigating - those writes bypass the commit-action,
1778
+ * since the router is already at the resolved route.
1779
+ *
1780
+ * **Two URL-matching modes, defaulted from the host flavour.** On a
1781
+ * `<cngx-tab-group>` tablist each tab is a *leaf* route, so the default
1782
+ * is `'suffix'`: a tab owns the trailing segment(s) of the URL and
1783
+ * nothing else. On a `<cngx-tab-nav>` (or `[cngxMatTabNav]`) each link is
1784
+ * an application *section* that owns a whole subtree, so the default
1785
+ * flips to `'prefix'` and the section stays current for every URL beneath
1786
+ * it - the non-exact flavour of `routerLinkActive`. The flavour is read
1787
+ * from the {@link CNGX_TAB_NAV_HOST} marker the nav organisms provide, so
1788
+ * neither default needs a consumer flag; `[match]` overrides both for the
1789
+ * mixed case.
1790
+ *
1791
+ * `Router` is optional - without it the directive logs a single dev
1792
+ * warning via `afterNextRender`, exposes a null action, and becomes a
1793
+ * no-op. Mirrors {@link CngxTabsFragmentSync}; every `activeIndex`
1794
+ * write inside an effect sits in `untracked()`.
1795
+ *
1796
+ * **The mental model.** It turns the tab group into the router's view
1797
+ * switcher: the tabs choose *which child route* renders in the
1798
+ * `<router-outlet>`, not which inline template shows. \
1799
+ * Concretely, a Settings page with Profile / Security / Billing tabs then gets, for
1800
+ * free: each tab its own URL (`/settings/profile`) so a refresh or a
1801
+ * shared link stays on the tab; browser back/forward between tabs;
1802
+ * `Billing` lazy-loading its chunk only when first opened; and `Profile`
1803
+ * blocking the switch via a `CanDeactivate` guard while its form is
1804
+ * dirty - all while keeping the `role="tab"` keyboard and ARIA model.
1805
+ *
1806
+ * **Use it when** each tab's content is a real Angular route - a lazy
1807
+ * chunk, a resolver, or a `CanActivate` / `CanDeactivate` guard -
1808
+ * rendered into a `<router-outlet>`, and you want browser back/forward
1809
+ * and deep links to move between tabs while the route's own guard gates
1810
+ * the switch (e.g. an unsaved-changes prompt on leave). \
1811
+ * If the tabs are purely visual, use a plain `<cngx-tab-group>` with no sync directive;
1812
+ * if you only want the active tab reflected in the URL while content
1813
+ * stays inline, use {@link CngxTabsFragmentSync}.
1814
+ *
1815
+ * **What this is not.** \
1816
+ * Not a per-tab `routerLink`: \
1817
+ * the tabs stay `role="tab"` buttons and the directive drives `router.navigate`
1818
+ * centrally through the commit lifecycle, so there are no anchors, no
1819
+ * `href`, and no native open-in-new-tab / middle-click / copy-link. \
1820
+ * For real link semantics (right-click, ctrl-click) reach for the CNGX
1821
+ * `<cngx-tab-nav>` and `<a cngx-tab-link routerLink>` variant
1822
+ * instead. \
1823
+ * Not URL deep-linking either - that is {@link CngxTabsFragmentSync} (a `#tab=` fragment or `?tab=`
1824
+ * query-param); this directive renders child route *components* into a
1825
+ * `<router-outlet>`. \
1826
+ * And not optimistic: the active tab moves only once
1827
+ * the route resolves, so a `CanDeactivate` guard can cancel the switch.
1630
1828
  *
1631
1829
  * ```ts
1632
- * @Component({
1633
- * viewProviders: [...provideTabsConfigAt(withTabsDefaultOrientation('vertical'))],
1634
- * })
1830
+ * // Each tab is a child route; the editor guards its own exit.
1831
+ * const ROUTES: Routes = [
1832
+ * { path: '', pathMatch: 'full', redirectTo: 'editor' },
1833
+ * { path: 'editor', component: EditorPage, canDeactivate: [unsavedChangesGuard] },
1834
+ * { path: 'preview', component: PreviewPage },
1835
+ * { path: 'settings', component: SettingsPage },
1836
+ * ];
1635
1837
  * ```
1636
1838
  *
1637
- * @category common/tabs
1638
- */
1639
- function provideTabsConfigAt(...features) {
1640
- return [{ provide: CNGX_TABS_CONFIG, useValue: resolveFeatures(features) }];
1641
- }
1642
- /**
1643
- * Inject the resolved tabs config in an injection context.
1839
+ * ```html
1840
+ * <!-- Tab ids match the child segments (default routeFor = (h) => [h.id]).
1841
+ * Switching a tab navigates; the guard gates leaving the editor;
1842
+ * back/forward and /account/settings deep links move the active tab. -->
1843
+ * <cngx-tab-group cngxTabsRouteSync aria-label="Account">
1844
+ * <div cngxTab id="editor" label="Editor"></div>
1845
+ * <div cngxTab id="preview" label="Preview"></div>
1846
+ * <div cngxTab id="settings" label="Settings"></div>
1847
+ * </cngx-tab-group>
1848
+ *
1849
+ * <!-- The active tab's routed component renders here. -->
1850
+ * <router-outlet></router-outlet>
1851
+ * ```
1644
1852
  *
1645
1853
  * @category common/tabs
1854
+ * @docsKind primary
1855
+ * @wcag AA
1856
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/route-sync.directive.ts
1857
+ * @since 0.1.0
1858
+ * @relatedTo CngxTabGroupPresenter, CngxTabsFragmentSync, createTabRouterCommit, CngxTabNav, CngxTabLink
1646
1859
  */
1647
- function injectTabsConfig() {
1648
- return inject(CNGX_TABS_CONFIG);
1860
+ class CngxTabsRouteSync {
1861
+ /**
1862
+ * Maps a tab handle to its router command array. Default
1863
+ * `(handle) => [handle.id]` - the tab id is the child segment.
1864
+ * Override for real route paths.
1865
+ */
1866
+ routeFor = input(cngxDefaultTabRoute, ...(ngDevMode ? [{ debugName: "routeFor" }] : /* istanbul ignore next */ []));
1867
+ /**
1868
+ * How a tab's route is matched against the current URL.
1869
+ *
1870
+ * - `'suffix'` - the tab owns the trailing segment(s). A leaf tab in a
1871
+ * tablist: `/settings/billing` activates the `billing` tab, and
1872
+ * `/billing/invoices/42` activates nothing.
1873
+ * - `'prefix'` - the tab owns a subtree. A section link in a nav:
1874
+ * `/rounds/explorer` activates the `rounds` link. Matching is a
1875
+ * `UrlTree` subset test anchored at the host's own `ActivatedRoute`,
1876
+ * so a nav mounted under a base path still resolves. When several
1877
+ * tabs match, the one with the most path segments wins.
1878
+ *
1879
+ * Cascade: this input -> `CngxTabsConfig.routeMatch`
1880
+ * ({@link withTabsRouteMatch}) -> the host flavour, which is `'prefix'`
1881
+ * when {@link CNGX_TAB_NAV_HOST} is present and `'suffix'` otherwise.
1882
+ *
1883
+ * This picks *which* policy runs. {@link CNGX_TAB_URL_MATCH_STRATEGY}
1884
+ * replaces the policies themselves.
1885
+ */
1886
+ match = input(undefined, ...(ngDevMode ? [{ debugName: "match" }] : /* istanbul ignore next */ []));
1887
+ host = inject(CNGX_TAB_GROUP_HOST, { host: true });
1888
+ router = inject(Router, { optional: true });
1889
+ navHost = inject(CNGX_TAB_NAV_HOST, { optional: true, host: true });
1890
+ config = injectTabsConfig();
1891
+ urlMatch = inject(CNGX_TAB_URL_MATCH_STRATEGY);
1892
+ /** Resolved match mode: input -> config -> host flavour. */
1893
+ effectiveMatch = computed(() => this.match() ?? this.config.routeMatch ?? (this.navHost ? 'prefix' : 'suffix'), ...(ngDevMode ? [{ debugName: "effectiveMatch" }] : /* istanbul ignore next */ []));
1894
+ activatedRoute = inject(ActivatedRoute, { optional: true });
1895
+ /**
1896
+ * Pessimistic-only - not exposed as an input. The route-sync owns the
1897
+ * mode so optimistic (show-then-revert) can never flash the target
1898
+ * tab before a `CanDeactivate` guard decides.
1899
+ */
1900
+ mode = signal('pessimistic', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
1901
+ /**
1902
+ * Router commit-action read by the presenter via the DI fallback.
1903
+ * `null` when no `Router` is available (graceful no-op). Rebuilt only
1904
+ * when `routeFor` changes; the navigation gate itself is the async
1905
+ * op inside the action.
1906
+ */
1907
+ action = computed(() => {
1908
+ const router = this.router;
1909
+ if (!router) {
1910
+ return null;
1911
+ }
1912
+ return createTabRouterCommit({
1913
+ router,
1914
+ tabs: this.host.tabs,
1915
+ routeFor: this.routeFor(),
1916
+ });
1917
+ }, ...(ngDevMode ? [{ debugName: "action" }] : /* istanbul ignore next */ []));
1918
+ constructor() {
1919
+ if (!this.router) {
1920
+ afterNextRender(() => warnTabsRouterAbsent('CngxTabsRouteSync', 'routed tabs'));
1921
+ return;
1922
+ }
1923
+ const router = this.router;
1924
+ const destroyRef = inject(DestroyRef);
1925
+ // Fallback seed for tabs that register after content-init (a
1926
+ // dynamic @for over an async list). Idempotent against the
1927
+ // content-init seed: reflectFromUrl bails when the id already
1928
+ // matches.
1929
+ afterNextRender(() => {
1930
+ untracked(() => this.reflectFromUrl(router));
1931
+ });
1932
+ const navEnd = toSignal(router.events.pipe(filter((e) => e instanceof NavigationEnd), takeUntilDestroyed(destroyRef)), { initialValue: null });
1933
+ effect(() => {
1934
+ const e = navEnd();
1935
+ if (!e) {
1936
+ return;
1937
+ }
1938
+ untracked(() => this.reflectFromUrl(router));
1939
+ });
1940
+ }
1941
+ /**
1942
+ * Seed from the URL before the group renders its panels. `CngxTab`
1943
+ * registers in `ngOnInit`, so the registry is populated by the time
1944
+ * this runs, and the group's own view has not rendered yet - which is
1945
+ * what keeps `panelMode="lazy"` from counting the default tab's first
1946
+ * render as its first activation on a deep link.
1947
+ *
1948
+ * Its own router guard: the constructor's early return does not stop
1949
+ * lifecycle hooks from running.
1950
+ */
1951
+ ngAfterContentInit() {
1952
+ if (!this.router) {
1953
+ return;
1954
+ }
1955
+ const router = this.router;
1956
+ untracked(() => this.reflectFromUrl(router));
1957
+ }
1958
+ /**
1959
+ * Mirror the URL's active tab onto `activeIndex` without navigating.
1960
+ * Writing the index directly (not via `select()`) is the re-entry
1961
+ * guard: `select()` would re-run the commit-action and navigate to
1962
+ * the route the router is already on, leaving the commit pending
1963
+ * forever.
1964
+ */
1965
+ reflectFromUrl(router) {
1966
+ const next = this.readActiveId(router);
1967
+ if (!next || next === this.host.activeId()) {
1968
+ return;
1969
+ }
1970
+ const index = this.host.tabs().findIndex((t) => t.id === next);
1971
+ if (index >= 0) {
1972
+ this.host.activeIndex.set(index);
1973
+ }
1974
+ }
1975
+ /**
1976
+ * Resolve the active tab id through the swappable match strategy.
1977
+ * The directive owns the mode cascade (input -> config -> host
1978
+ * flavour); the strategy owns the comparison.
1979
+ */
1980
+ readActiveId(router) {
1981
+ return this.urlMatch.resolve({
1982
+ router,
1983
+ activatedRoute: this.activatedRoute,
1984
+ tabs: this.host.tabs(),
1985
+ routeFor: this.routeFor(),
1986
+ mode: this.effectiveMatch(),
1987
+ });
1988
+ }
1989
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabsRouteSync, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1990
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxTabsRouteSync, isStandalone: true, selector: "[cngxTabsRouteSync]", inputs: { routeFor: { classPropertyName: "routeFor", publicName: "routeFor", isSignal: true, isRequired: false, transformFunction: null }, match: { classPropertyName: "match", publicName: "match", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_TABS_COMMIT_ACTION, useExisting: CngxTabsRouteSync }], exportAs: ["cngxTabsRouteSync"], ngImport: i0 });
1649
1991
  }
1992
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTabsRouteSync, decorators: [{
1993
+ type: Directive,
1994
+ args: [{
1995
+ selector: '[cngxTabsRouteSync]',
1996
+ exportAs: 'cngxTabsRouteSync',
1997
+ standalone: true,
1998
+ providers: [{ provide: CNGX_TABS_COMMIT_ACTION, useExisting: CngxTabsRouteSync }],
1999
+ }]
2000
+ }], ctorParameters: () => [], propDecorators: { routeFor: [{ type: i0.Input, args: [{ isSignal: true, alias: "routeFor", required: false }] }], match: [{ type: i0.Input, args: [{ isSignal: true, alias: "match", required: false }] }] } });
1650
2001
 
1651
2002
  /**
1652
2003
  * Helper resolving the host-attribute cascades for
@@ -1682,9 +2033,9 @@ const TABS_I18N_DEFAULTS = {
1682
2033
  nextTab: 'Next tab',
1683
2034
  closeTab: (label) => `Close "${label}"`,
1684
2035
  addTab: 'Add tab',
1685
- commitFailedRetry: 'Tab change refused — retry?',
2036
+ commitFailedRetry: 'Tab change refused - retry?',
1686
2037
  commitInFlight: 'Switching tab…',
1687
- commitRolledBackTo: (originLabel) => `Could not save changes — reverted to "${originLabel}".`,
2038
+ commitRolledBackTo: (originLabel) => `Could not save changes - reverted to "${originLabel}".`,
1688
2039
  };
1689
2040
  /**
1690
2041
  * DI token for the tabs i18n bundle. `providedIn: 'root'` with
@@ -1765,7 +2116,7 @@ function partitionFeatures(features) {
1765
2116
  config.push(feat);
1766
2117
  continue;
1767
2118
  }
1768
- // Unbranded feature — runtime escape from the `_target` type.
2119
+ // Unbranded feature - runtime escape from the `_target` type.
1769
2120
  // Drop with dev-warn so an i18n-shaped override never lands
1770
2121
  // silently in `CNGX_TABS_CONFIG`.
1771
2122
  if (isDevMode()) {
@@ -1785,7 +2136,7 @@ function partitionFeatures(features) {
1785
2136
  * - `provideCngxSelect`;
1786
2137
  * apply once in the app providers array. \
1787
2138
  * Returns {@link EnvironmentProviders}; for
1788
- * - `viewProviders` use {@link provideCngxTabsAt} — opaque
2139
+ * - `viewProviders` use {@link provideCngxTabsAt} - opaque
1789
2140
  * - `EnvironmentProviders` cannot live there.
1790
2141
  *
1791
2142
  * ```ts
@@ -2450,13 +2801,20 @@ function createTabKeyboardNav(opts) {
2450
2801
  tabTabindex: (tab) => (tab.id === opts.host.activeId() ? 0 : -1),
2451
2802
  handleKeydown: (event) => {
2452
2803
  const horizontal = opts.host.orientation() === 'horizontal';
2804
+ const inlineStep = (key) => {
2805
+ if (!horizontal) {
2806
+ return null;
2807
+ }
2808
+ const dir = resolveInlineStep(key, opts.direction());
2809
+ return dir === null ? null : step(dir);
2810
+ };
2453
2811
  let target;
2454
2812
  switch (event.key) {
2455
2813
  case 'ArrowRight':
2456
- target = horizontal ? step(1) : null;
2814
+ target = inlineStep('ArrowRight');
2457
2815
  break;
2458
2816
  case 'ArrowLeft':
2459
- target = horizontal ? step(-1) : null;
2817
+ target = inlineStep('ArrowLeft');
2460
2818
  break;
2461
2819
  case 'ArrowDown':
2462
2820
  target = horizontal ? null : step(1);
@@ -2497,10 +2855,10 @@ function createTabKeyboardNav(opts) {
2497
2855
  * span for the state decorations, the `CNGX_TABS_GLYPHS` glyph for
2498
2856
  * `closeIcon` / `addIcon`, and nothing for `icon`.
2499
2857
  *
2500
- * Pure — no DI, no side effects. Safe in field-init. Sibling to
2858
+ * Pure - no DI, no side effects. Safe in field-init. Sibling to
2501
2859
  * `createStepperTemplateBindings` and `createTabOverflowTemplateBindings`.
2502
2860
  *
2503
- * Single-consumer today: `[cngxMatTabs]` does not consume this —
2861
+ * Single-consumer today: `[cngxMatTabs]` does not consume this -
2504
2862
  * Material owns the rendered tab-button chrome via its own MDC
2505
2863
  * template, leaving no DOM seam. See `tabs-accepted-debt §9`.
2506
2864
  *
@@ -2531,13 +2889,13 @@ function createTabGroupTemplateBindings(opts) {
2531
2889
  };
2532
2890
  }
2533
2891
 
2534
- // Single-consumer factory — staged under family-uniformity
2892
+ // Single-consumer factory - staged under family-uniformity
2535
2893
  // (`createTabGroupTemplateBindings` and `CngxMatTabAggregatorContent`).
2536
2894
  // Re-eval on second consumer or sibling debt closure.
2537
2895
  /**
2538
2896
  * Pure factory bundling the `<cngx-tab-group>` AT-announcement +
2539
2897
  * descriptor surfaces. Owns one internal `linkedSignal`
2540
- * (prior-active-index, drives the success-arm direction prefix) —
2898
+ * (prior-active-index, drives the success-arm direction prefix) -
2541
2899
  * lazy by `linkedSignal` semantics, so the organism reads
2542
2900
  * `liveAnnouncement` once at construction to seed it.
2543
2901
  *
@@ -2575,7 +2933,7 @@ function createTabGroupAnnouncements(options) {
2575
2933
  }
2576
2934
  return ariaLabel() ?? config.ariaLabels?.tabsRegion ?? i18n.tabsLabel;
2577
2935
  }, ...(ngDevMode ? [{ debugName: "resolvedAriaLabel" }] : /* istanbul ignore next */ []));
2578
- // `prev?.source` = source value before the most recent change —
2936
+ // `prev?.source` = source value before the most recent change -
2579
2937
  // prior activeIndex without an `effect`-driven slot (Pillar 1).
2580
2938
  // Coalesce to current on first emission.
2581
2939
  const priorActiveIndex = linkedSignal({ ...(ngDevMode ? { debugName: "priorActiveIndex" } : /* istanbul ignore next */ {}), source: () => presenter.activeIndex(),
@@ -2587,7 +2945,7 @@ function createTabGroupAnnouncements(options) {
2587
2945
  return i18n.commitInFlight;
2588
2946
  }
2589
2947
  if (current === 'error') {
2590
- // No `previous === 'pending'` guard — sync rejections collapse
2948
+ // No `previous === 'pending'` guard - sync rejections collapse
2591
2949
  // pending → error in one flush, so the tracker captures
2592
2950
  // `previous = 'idle'` and an unguarded read keeps the
2593
2951
  // announcement reachable for `commitAction = () => false`.
@@ -2643,7 +3001,7 @@ function createTabGroupAnnouncements(options) {
2643
3001
  const labelPart = detail ? i18n.tabLabelWithDetail(label, detail) : label;
2644
3002
  return i18n.selectedTab(labelPart, position, tabs.length);
2645
3003
  }
2646
- // Eager seed — `linkedSignal` is lazy and the success arm doesn't
3004
+ // Eager seed - `linkedSignal` is lazy and the success arm doesn't
2647
3005
  // touch the tracker at construction (commitTransition is `idle`),
2648
3006
  // so without this read `prev?.source` is undefined on the first
2649
3007
  // nav and the direction prefix is silently lost.
@@ -2658,6 +3016,66 @@ function createTabGroupAnnouncements(options) {
2658
3016
  };
2659
3017
  }
2660
3018
 
3019
+ /**
3020
+ * Live-region content for the link-driven nav flavour: the active link's
3021
+ * accessible label, announced only when the active id actually changes.
3022
+ *
3023
+ * **Why this is not {@link createTabGroupAnnouncements}.** That bundle's
3024
+ * phrasing is built around the commit lifecycle (`pending -> success`,
3025
+ * rollback, direction prefix) and it gates on the commit transition, so
3026
+ * it stays silent at rest for free. The nav path is commit-free by
3027
+ * design: links navigate through their own `routerLink` and nothing calls
3028
+ * `presenter.select()`. Its only meaningful announcement is the landing
3029
+ * label, and it needs a different silence gate.
3030
+ *
3031
+ * **The mount window.** `announcing` stays `false` through the first
3032
+ * render and the microtask after it. On a deep link the active link is
3033
+ * the page's *initial state*, not a change, and the browser already
3034
+ * announces the document; pushing the landing section into a polite
3035
+ * region there is noise. `queueMicrotask` rather than the
3036
+ * `afterNextRender` body: every `afterNextRender` callback for one render
3037
+ * runs in a single synchronous batch, so deferring past it makes the gate
3038
+ * independent of whether a `[cngxTabsRouteSync]` seed registered before
3039
+ * or after this one.
3040
+ *
3041
+ * The prior-id tracker is seeded when that window closes, not at
3042
+ * construction, so whatever the seed resolved counts as the starting
3043
+ * point instead of as the first announcement. Returning to a section
3044
+ * that was active at mount still announces.
3045
+ *
3046
+ * @category common/tabs/announcements
3047
+ * @wcag AA
3048
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/tabs/announcements/tab-nav-announcement.ts
3049
+ * @since 0.1.0
3050
+ * @relatedTo CngxTabNav, CngxLiveRegion, createTabGroupAnnouncements
3051
+ */
3052
+ function createTabNavAnnouncement(options) {
3053
+ const { presenter, injector } = options;
3054
+ const announcing = signal(false, ...(ngDevMode ? [{ debugName: "announcing" }] : /* istanbul ignore next */ []));
3055
+ // `prev?.source` = the id before the most recent change. Mirrors the
3056
+ // tablist bundle's prior-index tracker, keyed on id.
3057
+ const priorActiveId = linkedSignal({ ...(ngDevMode ? { debugName: "priorActiveId" } : /* istanbul ignore next */ {}), source: () => presenter.activeId(),
3058
+ computation: (curr, prev) => prev?.source ?? curr,
3059
+ equal: Object.is });
3060
+ const liveAnnouncement = computed(() => {
3061
+ if (!announcing()) {
3062
+ return '';
3063
+ }
3064
+ const id = presenter.activeId();
3065
+ if (id === null || id === priorActiveId()) {
3066
+ return '';
3067
+ }
3068
+ return presenter.tabs().find((tab) => tab.id === id)?.label() ?? '';
3069
+ }, ...(ngDevMode ? [{ debugName: "liveAnnouncement" }] : /* istanbul ignore next */ []));
3070
+ afterNextRender(() => {
3071
+ queueMicrotask(() => {
3072
+ priorActiveId();
3073
+ announcing.set(true);
3074
+ });
3075
+ }, { injector });
3076
+ return { liveAnnouncement };
3077
+ }
3078
+
2661
3079
  /**
2662
3080
  * Default glyph fallbacks for `<cngx-tab-group>` skin slots. Read by
2663
3081
  * the organism when neither a per-instance slot directive nor
@@ -2987,5 +3405,5 @@ const CNGX_DIRECTIVE_BY_ID_MAP_FACTORY = new InjectionToken('CngxDirectiveByIdMa
2987
3405
  * Generated bundle index. Do not edit.
2988
3406
  */
2989
3407
 
2990
- 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 };
3408
+ 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_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 };
2991
3409
  //# sourceMappingURL=cngx-common-tabs.mjs.map