@cngx/ui 0.0.1-rc.0 → 0.1.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -48
- package/action-button/README.md +9 -11
- package/empty-state/README.md +11 -26
- package/feedback/README.md +3 -3
- package/fesm2022/cngx-ui-action-button.mjs +30 -26
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +26 -21
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +498 -261
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +32 -5
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +79 -104
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +111 -83
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-material.mjs +14 -3
- package/fesm2022/cngx-ui-material.mjs.map +1 -1
- package/fesm2022/cngx-ui-overlay.mjs +22 -3
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +107 -28
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +61 -20
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +14 -5
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +484 -161
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +75 -39
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +2 -1
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/layout/README.md +9 -44
- package/mat-stepper/README.md +7 -10
- package/mat-tabs/README.md +13 -13
- package/mat-tabs/styles/mat-tabs.css +339 -213
- package/material/README.md +19 -19
- package/overlay/README.md +11 -11
- package/package.json +5 -4
- package/sidenav/README.md +4 -19
- package/skeleton/README.md +3 -17
- package/speak/README.md +15 -15
- package/stepper/README.md +139 -5
- package/tabs/README.md +4 -4
- package/theming/system-tokens.css +29 -0
- package/types/cngx-ui-action-button.d.ts +28 -13
- package/types/cngx-ui-empty-state.d.ts +21 -9
- package/types/cngx-ui-feedback.d.ts +437 -121
- package/types/cngx-ui-layout.d.ts +38 -8
- package/types/cngx-ui-mat-stepper.d.ts +58 -43
- package/types/cngx-ui-mat-tabs.d.ts +122 -72
- package/types/cngx-ui-material.d.ts +12 -1
- package/types/cngx-ui-overlay.d.ts +25 -4
- package/types/cngx-ui-sidenav.d.ts +106 -12
- package/types/cngx-ui-skeleton.d.ts +62 -8
- package/types/cngx-ui-speak.d.ts +10 -2
- package/types/cngx-ui-stepper.d.ts +280 -56
- package/types/cngx-ui-tabs.d.ts +38 -10
- package/types/cngx-ui.d.ts +1 -0
- package/speak/speak-button-theme.scss +0 -78
|
@@ -19,21 +19,10 @@ import { toSignal } from '@angular/core/rxjs-interop';
|
|
|
19
19
|
* Every leading-underscore field cngx reaches into and every
|
|
20
20
|
* Material-internal CSS selector cngx queries against has its
|
|
21
21
|
* declaration here. A Material-version upgrade audit only needs to
|
|
22
|
-
* grep this file
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* Tracked-debt cross-links:
|
|
28
|
-
* - tabs-accepted-debt §5 — `MatTab._stateChanges` plus the three
|
|
29
|
-
* `.mat-mdc-tab*` selectors used by `[cngxMatTabs]` and the
|
|
30
|
-
* Material-twin overflow adapter. The closing paragraph of §5
|
|
31
|
-
* explicitly names this namespace as the family-shared
|
|
32
|
-
* upgrade-watch surface.
|
|
33
|
-
* - stepper-accepted-debt §4 — `MatStepper._iconOverrides` reach
|
|
34
|
-
* from `<cngx-mat-stepper>`.
|
|
35
|
-
* - stepper-accepted-debt §1, handle.ts JSDoc — `CdkStep._completedOverride`
|
|
36
|
-
* read from `createMatStepHandle`'s `state` computed.
|
|
22
|
+
* grep this file. The grep value is the consumer-facing benefit, so
|
|
23
|
+
* this namespace is part of the published surface of
|
|
24
|
+
* `@cngx/ui/mat-tabs` (re-exported from the package barrel) rather
|
|
25
|
+
* than a private implementation detail.
|
|
37
26
|
*
|
|
38
27
|
* The grouping uses a TypeScript `namespace` so a single
|
|
39
28
|
* `MaterialPrivateSurfaces.<member>` access path covers both the
|
|
@@ -42,6 +31,8 @@ import { toSignal } from '@angular/core/rxjs-interop';
|
|
|
42
31
|
* grouped name through ESLint's `@typescript-eslint` type resolver
|
|
43
32
|
* — a flat `export * as` re-export from `public-api.ts` does not
|
|
44
33
|
* resolve nested members through the path-alias.
|
|
34
|
+
*
|
|
35
|
+
* @category ui/mat-tabs
|
|
45
36
|
*/
|
|
46
37
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
47
38
|
var MaterialPrivateSurfaces;
|
|
@@ -92,8 +83,6 @@ var MaterialPrivateSurfaces;
|
|
|
92
83
|
* projectors stack on the same target without collision; the shared
|
|
93
84
|
* token-list append preserves consumer-supplied tokens.
|
|
94
85
|
*
|
|
95
|
-
* Index-based DOM lookup tracks `tabs-accepted-debt §5`.
|
|
96
|
-
*
|
|
97
86
|
* @internal package-private — consumers bind `[cngxMatTabError]` on
|
|
98
87
|
* each `<mat-tab>`; the directive owns the projection mechanics.
|
|
99
88
|
*/
|
|
@@ -531,6 +520,10 @@ const CNGX_MAT_TABS_CONFIG_DEFAULTS = {
|
|
|
531
520
|
* {@link provideMatTabsConfigAt} (component scope). Read via
|
|
532
521
|
* {@link injectMatTabsConfig}, which merges with the library
|
|
533
522
|
* defaults so callers never see `undefined`.
|
|
523
|
+
*
|
|
524
|
+
* @category ui/mat-tabs
|
|
525
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs-config.ts
|
|
526
|
+
* @since 0.1.0
|
|
534
527
|
*/
|
|
535
528
|
const CNGX_MAT_TABS_CONFIG = new InjectionToken('CngxMatTabsConfig');
|
|
536
529
|
function feature(config) {
|
|
@@ -539,6 +532,8 @@ function feature(config) {
|
|
|
539
532
|
/**
|
|
540
533
|
* Cap on the `[cngxMatTabs]` overflow-anchor retry loop.
|
|
541
534
|
* See {@link CngxMatTabsConfig.anchorMaxAttempts} for default + rationale.
|
|
535
|
+
*
|
|
536
|
+
* @category ui/mat-tabs
|
|
542
537
|
*/
|
|
543
538
|
function withAnchorRetryAttempts(n) {
|
|
544
539
|
return feature({ anchorMaxAttempts: n });
|
|
@@ -546,6 +541,8 @@ function withAnchorRetryAttempts(n) {
|
|
|
546
541
|
/**
|
|
547
542
|
* Override the half-wired-slot diagnostic sink.
|
|
548
543
|
* See {@link CngxMatTabsConfig.halfWiredSlotSink}.
|
|
544
|
+
*
|
|
545
|
+
* @category ui/mat-tabs
|
|
549
546
|
*/
|
|
550
547
|
function withHalfWiredSlotSink(sink) {
|
|
551
548
|
return feature({ halfWiredSlotSink: sink });
|
|
@@ -572,6 +569,8 @@ function mergeFeatures(features) {
|
|
|
572
569
|
* ],
|
|
573
570
|
* });
|
|
574
571
|
* ```
|
|
572
|
+
*
|
|
573
|
+
* @category ui/mat-tabs
|
|
575
574
|
*/
|
|
576
575
|
function provideMatTabsConfig(...features) {
|
|
577
576
|
return makeEnvironmentProviders([
|
|
@@ -593,6 +592,8 @@ function provideMatTabsConfig(...features) {
|
|
|
593
592
|
* ...
|
|
594
593
|
* })
|
|
595
594
|
* ```
|
|
595
|
+
*
|
|
596
|
+
* @category ui/mat-tabs
|
|
596
597
|
*/
|
|
597
598
|
function provideMatTabsConfigAt(...features) {
|
|
598
599
|
return [{ provide: CNGX_MAT_TABS_CONFIG, useValue: mergeFeatures(features) }];
|
|
@@ -606,6 +607,8 @@ function provideMatTabsConfigAt(...features) {
|
|
|
606
607
|
* 1. `CNGX_MAT_TABS_CONFIG` value (set via
|
|
607
608
|
* {@link provideMatTabsConfig} / {@link provideMatTabsConfigAt}).
|
|
608
609
|
* 2. {@link CNGX_MAT_TABS_CONFIG_DEFAULTS} (library default).
|
|
610
|
+
*
|
|
611
|
+
* @category ui/mat-tabs
|
|
609
612
|
*/
|
|
610
613
|
function injectMatTabsConfig() {
|
|
611
614
|
const user = inject(CNGX_MAT_TABS_CONFIG, { optional: true }) ?? {};
|
|
@@ -622,18 +625,14 @@ function injectMatTabsConfig() {
|
|
|
622
625
|
* this template into the SR-only descriptor span instead of writing
|
|
623
626
|
* the aggregator's `announcement()` string verbatim.
|
|
624
627
|
*
|
|
625
|
-
* Pure marker
|
|
628
|
+
* Pure marker - zero logic. Holds only a typed
|
|
626
629
|
* {@link TemplateRef} reference. Mirrors the family-standard slot
|
|
627
630
|
* pattern (`CngxStepBadge`, `CngxTabErrorBadge`, `CngxTabOverflowItem`).
|
|
628
631
|
*
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
* consumer-visible decoration seam, so this slot directive lands
|
|
634
|
-
* with one consumer (the package-private aggregator-decoration
|
|
635
|
-
* projector). The shape is uniform with the rest of the family
|
|
636
|
-
* pattern; the staging is acknowledged debt.
|
|
632
|
+
* Material owns the tab-button chrome; the cngx descriptor span is
|
|
633
|
+
* the only consumer-visible decoration seam, so this slot directive
|
|
634
|
+
* lands with one in-package consumer (the package-private
|
|
635
|
+
* aggregator-decoration projector).
|
|
637
636
|
*
|
|
638
637
|
* ```html
|
|
639
638
|
* <mat-tab-group cngxMatTabs>
|
|
@@ -647,6 +646,12 @@ function injectMatTabsConfig() {
|
|
|
647
646
|
* <mat-tab label="Profile" cngxMatTabError="profile">…</mat-tab>
|
|
648
647
|
* </mat-tab-group>
|
|
649
648
|
* ```
|
|
649
|
+
*
|
|
650
|
+
* @category ui/mat-tabs
|
|
651
|
+
* @wcag AA
|
|
652
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/decorations/mat-tab-aggregator-content.directive.ts
|
|
653
|
+
* @since 0.1.0
|
|
654
|
+
* @relatedTo CngxMatTabs, CngxMatTabError, CngxMatTabRejectionContent
|
|
650
655
|
*/
|
|
651
656
|
class CngxMatTabAggregatorContent {
|
|
652
657
|
templateRef = inject(TemplateRef);
|
|
@@ -669,22 +674,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
669
674
|
* this template into the SR-only descriptor span instead of writing
|
|
670
675
|
* the resolved fallback string verbatim.
|
|
671
676
|
*
|
|
672
|
-
* Pure marker
|
|
677
|
+
* Pure marker - zero logic. Holds only a typed
|
|
673
678
|
* {@link TemplateRef} reference. Mirrors the family-standard slot
|
|
674
679
|
* pattern (`CngxMatTabAggregatorContent`, `CngxStepBadge`,
|
|
675
680
|
* `CngxTabErrorBadge`).
|
|
676
681
|
*
|
|
677
|
-
* Cascade resolution
|
|
678
|
-
* `architecture-summary.md` slot-cascade rule):
|
|
682
|
+
* Cascade resolution:
|
|
679
683
|
* 1. Per-instance `*cngxMatTabRejectionContent` template wins
|
|
680
684
|
* via `contentChild(CngxMatTabRejectionContent)`.
|
|
681
|
-
* 2.
|
|
682
|
-
* lands on main, the config-tier
|
|
683
|
-
* `CNGX_MAT_TABS_CONFIG.templates.rejection` slot fills the
|
|
684
|
-
* middle tier (planned follow-up — gated by Phase 2 merge;
|
|
685
|
-
* `tabs-accepted-debt §12` binds the staging with
|
|
686
|
-
* Re-Eval Triggers).
|
|
687
|
-
* 3. Library default — imperative `Renderer2.createElement('span')`
|
|
685
|
+
* 2. Library default - imperative `Renderer2.createElement('span')`
|
|
688
686
|
* with `textContent = fallbackText` (the resolved
|
|
689
687
|
* `commitRolledBackTo(originLabel)` / `commitFailedRetry`
|
|
690
688
|
* phrase from `injectTabsI18n()`).
|
|
@@ -706,6 +704,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
706
704
|
* <mat-tab label="Profile">…</mat-tab>
|
|
707
705
|
* </mat-tab-group>
|
|
708
706
|
* ```
|
|
707
|
+
*
|
|
708
|
+
* @category ui/mat-tabs
|
|
709
|
+
* @wcag AA
|
|
710
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/decorations/mat-tab-rejection-content.directive.ts
|
|
711
|
+
* @since 0.1.0
|
|
712
|
+
* @relatedTo CngxMatTabs, CngxMatTabAggregatorContent, CngxMatTabError
|
|
709
713
|
*/
|
|
710
714
|
class CngxMatTabRejectionContent {
|
|
711
715
|
templateRef = inject(TemplateRef);
|
|
@@ -733,12 +737,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
733
737
|
* live-region never lands inside Material's component DOM. The
|
|
734
738
|
* element's host bindings replicate {@link CngxLiveRegion}
|
|
735
739
|
* imperatively (this attribute directive owns no template, so the
|
|
736
|
-
* declarative `cngxLiveRegion` selector is unreachable).
|
|
737
|
-
* duplication of `CngxLiveRegion`'s host-binding shape is
|
|
738
|
-
* acknowledged debt — `tabs-accepted-debt §12` covers the
|
|
739
|
-
* single-consumer family-uniformity staging and the Re-Eval
|
|
740
|
-
* Triggers that would graduate this helper to a
|
|
741
|
-
* `CNGX_MAT_TAB_LIVE_ANNOUNCER_FACTORY` swap surface.
|
|
740
|
+
* declarative `cngxLiveRegion` selector is unreachable).
|
|
742
741
|
* Cleaned up via the supplied `DestroyRef`.
|
|
743
742
|
*
|
|
744
743
|
* @internal — package-private helper for `[cngxMatTabs]`. Not
|
|
@@ -817,25 +816,27 @@ function createRejectionState(presenter, i18n) {
|
|
|
817
816
|
* plus a writable `errorAggregator` slot the `[cngxMatTabError]`
|
|
818
817
|
* directive binds.
|
|
819
818
|
*
|
|
820
|
-
* - `id`
|
|
819
|
+
* - `id` - fresh `idSeed()` value; a label-keyed id would collide
|
|
821
820
|
* when two tabs share a label.
|
|
822
|
-
* - `label` / `disabled`
|
|
821
|
+
* - `label` / `disabled` - `computed` signals retriggered by
|
|
823
822
|
* `toSignal(matTab._stateChanges)`. Bridge lifetime is tied to
|
|
824
823
|
* the supplied `injector` (typically a per-tab child
|
|
825
824
|
* `EnvironmentInjector`). `_stateChanges` is a Material-internal
|
|
826
|
-
* surface
|
|
827
|
-
* - `errorAggregator`
|
|
825
|
+
* surface.
|
|
826
|
+
* - `errorAggregator` - writable seeded at `undefined`;
|
|
828
827
|
* `[cngxMatTabError]` writes its bound aggregator in and resets
|
|
829
828
|
* on teardown. The handle exposes `.asReadonly()` to preserve the
|
|
830
829
|
* `CngxTabHandle` contract.
|
|
830
|
+
*
|
|
831
|
+
* @category ui/mat-tabs
|
|
831
832
|
*/
|
|
832
833
|
function createMatTabHandle(matTab, idSeed, injector) {
|
|
833
|
-
// Typed local
|
|
834
|
+
// Typed local - anchors `MaterialPrivateSurfaces.StateChangeSource`
|
|
834
835
|
// at the consumer site so an upgrade-watch grep lands here too.
|
|
835
836
|
// Documentation-only at runtime; MatTab's public typing already
|
|
836
|
-
// exposes `_stateChanges`.
|
|
837
|
+
// exposes `_stateChanges`.
|
|
837
838
|
const stateChangeSource = matTab;
|
|
838
|
-
// `equal: () => false` is load-bearing
|
|
839
|
+
// `equal: () => false` is load-bearing - `_stateChanges` is a
|
|
839
840
|
// `Subject<void>`, so `Object.is(undefined, undefined)` would dedup
|
|
840
841
|
// every emission and the dependent computeds would never recompute.
|
|
841
842
|
const stateChangeTrigger = toSignal(stateChangeSource._stateChanges, {
|
|
@@ -875,11 +876,8 @@ function createMatTabHandle(matTab, idSeed, injector) {
|
|
|
875
876
|
*
|
|
876
877
|
* The seam separates handle shape (factory body) from id keying
|
|
877
878
|
* (the supplied `idSeed` closure). Overrides may call, ignore, or
|
|
878
|
-
* replace `idSeed`
|
|
879
|
-
* consumer-domain ids
|
|
880
|
-
*
|
|
881
|
-
* Tracked-debt: family-uniformity staging, single in-package
|
|
882
|
-
* consumer today. See `tabs-accepted-debt §10`.
|
|
879
|
+
* replace `idSeed` - server-synced ids, deterministic test ids,
|
|
880
|
+
* consumer-domain ids - without touching the factory body.
|
|
883
881
|
*
|
|
884
882
|
* ```ts
|
|
885
883
|
* providers: [
|
|
@@ -893,6 +891,11 @@ function createMatTabHandle(matTab, idSeed, injector) {
|
|
|
893
891
|
* },
|
|
894
892
|
* ]
|
|
895
893
|
* ```
|
|
894
|
+
*
|
|
895
|
+
* @category ui/mat-tabs
|
|
896
|
+
* @wcag AA
|
|
897
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/material-bridge/handle.ts
|
|
898
|
+
* @since 0.1.0
|
|
896
899
|
*/
|
|
897
900
|
const CNGX_MAT_TAB_HANDLE_FACTORY = new InjectionToken('CNGX_MAT_TAB_HANDLE_FACTORY', {
|
|
898
901
|
providedIn: 'root',
|
|
@@ -904,13 +907,18 @@ const CNGX_MAT_TAB_HANDLE_FACTORY = new InjectionToken('CNGX_MAT_TAB_HANDLE_FACT
|
|
|
904
907
|
* `useExisting`. Sibling per-tab directives inject this with
|
|
905
908
|
* `{ host: true }` to reach per-handle slots without walking the
|
|
906
909
|
* concrete registry class.
|
|
910
|
+
*
|
|
911
|
+
* @category ui/mat-tabs
|
|
912
|
+
* @wcag AA
|
|
913
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs-registry.directive.ts
|
|
914
|
+
* @since 0.1.0
|
|
907
915
|
*/
|
|
908
916
|
const CNGX_MAT_TABS_REGISTRY_HOST = new InjectionToken('CngxMatTabsRegistryHost');
|
|
909
917
|
/**
|
|
910
918
|
* Sibling host-directive that owns the per-MatTab handle registry
|
|
911
|
-
* for `[cngxMatTabs]`.
|
|
912
|
-
*
|
|
913
|
-
*
|
|
919
|
+
* for `[cngxMatTabs]`. Keeps the parent under the level-4 organism
|
|
920
|
+
* LOC guard and lets per-tab decoration directives reach the
|
|
921
|
+
* registry through a typed token.
|
|
914
922
|
*
|
|
915
923
|
* Owns: `contentChildren(MatTab)` query, the `setupsByTab` map
|
|
916
924
|
* (per-tab cngx setup paired with a child `EnvironmentInjector`
|
|
@@ -920,8 +928,14 @@ const CNGX_MAT_TABS_REGISTRY_HOST = new InjectionToken('CngxMatTabsRegistryHost'
|
|
|
920
928
|
*
|
|
921
929
|
* Composition: `[cngxMatTabs]` declares this in `hostDirectives`;
|
|
922
930
|
* both share the parent's `CngxTabGroupPresenter` and the same
|
|
923
|
-
* `<mat-tab-group>` content-children scope.
|
|
924
|
-
*
|
|
931
|
+
* `<mat-tab-group>` content-children scope.
|
|
932
|
+
*
|
|
933
|
+
* @category ui/mat-tabs
|
|
934
|
+
* @docsKind primary
|
|
935
|
+
* @wcag AA
|
|
936
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs-registry.directive.ts
|
|
937
|
+
* @since 0.1.0
|
|
938
|
+
* @relatedTo CngxMatTabs, CngxMatTabError, CNGX_MAT_TABS_REGISTRY_HOST
|
|
925
939
|
*/
|
|
926
940
|
class CngxMatTabsRegistry {
|
|
927
941
|
presenter = inject(CNGX_TAB_GROUP_HOST);
|
|
@@ -957,8 +971,8 @@ class CngxMatTabsRegistry {
|
|
|
957
971
|
continue;
|
|
958
972
|
}
|
|
959
973
|
// Per-tab child injector scopes the `toSignal(_stateChanges)`
|
|
960
|
-
// bridge inside createMatTabHandle
|
|
961
|
-
// removal fires `takeUntilDestroyed`.
|
|
974
|
+
// bridge inside createMatTabHandle - destroying it on tab
|
|
975
|
+
// removal fires `takeUntilDestroyed`.
|
|
962
976
|
const childInjector = createEnvironmentInjector([], this.envInjector);
|
|
963
977
|
const idSeed = () => nextUid('cngx-mat-tab-');
|
|
964
978
|
const setup = this.createHandle(tab, idSeed, childInjector);
|
|
@@ -1005,7 +1019,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1005
1019
|
* `resolveStripRoot` walks from host up to `<mat-tab-header>` and
|
|
1006
1020
|
* locates `.mat-mdc-tab-label-container` via any rendered
|
|
1007
1021
|
* `.mat-mdc-tab` descendant — Material's IO-friendly scroll
|
|
1008
|
-
* container
|
|
1022
|
+
* container.
|
|
1009
1023
|
*
|
|
1010
1024
|
* `resolveTabButton` indexes positionally; Material owns the DOM
|
|
1011
1025
|
* and cngx handle ids never reach the button elements. Index
|
|
@@ -1020,6 +1034,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1020
1034
|
* useValue: createCngxMatTabOverflowDomAdapter }
|
|
1021
1035
|
* ]
|
|
1022
1036
|
* ```
|
|
1037
|
+
*
|
|
1038
|
+
* @category ui/mat-tabs
|
|
1023
1039
|
*/
|
|
1024
1040
|
function createCngxMatTabOverflowDomAdapter() {
|
|
1025
1041
|
return {
|
|
@@ -1074,20 +1090,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1074
1090
|
}] });
|
|
1075
1091
|
/**
|
|
1076
1092
|
* Attaches to an existing `<mat-tab-group>` and wires it to a
|
|
1077
|
-
* {@link CngxTabGroupPresenter}
|
|
1093
|
+
* {@link CngxTabGroupPresenter} - consumers get the commit-action
|
|
1078
1094
|
* lifecycle, `CNGX_STATEFUL` (so `<cngx-toast-on />` and
|
|
1079
1095
|
* `<cngx-banner-on />` compose as children), and the tab-handle
|
|
1080
1096
|
* registry from one attribute.
|
|
1081
1097
|
*
|
|
1082
1098
|
* Topology inverts `<cngx-mat-stepper>`: Material is the host, cngx
|
|
1083
1099
|
* is the instrumentation layer. `inject(MatTabGroup, { self: true })`
|
|
1084
|
-
* resolves on the consumer's own element
|
|
1085
|
-
* blocker
|
|
1100
|
+
* resolves on the consumer's own element - no content projection
|
|
1101
|
+
* blocker applies here.
|
|
1086
1102
|
*
|
|
1087
1103
|
* Rejection (`--error`) and aggregator (`--has-errors`) visuals
|
|
1088
1104
|
* live in the package-private projector factories under
|
|
1089
1105
|
* `./decorations/`; this directive supplies their reactive triggers
|
|
1090
1106
|
* and the delegators consumer templates call.
|
|
1107
|
+
*
|
|
1108
|
+
* @playground Form error aggregation ./examples/form-errors/form-errors.component.ts
|
|
1109
|
+
*
|
|
1110
|
+
* @category ui/mat-tabs
|
|
1111
|
+
* @docsKind primary
|
|
1112
|
+
* @wcag AA
|
|
1113
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs.directive.ts
|
|
1114
|
+
* @since 0.1.0
|
|
1115
|
+
* @relatedTo CngxMatTabsRegistry, CngxMatTabError, CngxMatStepperBridge
|
|
1091
1116
|
*/
|
|
1092
1117
|
class CngxMatTabs {
|
|
1093
1118
|
matTabGroup = inject(MatTabGroup, { self: true });
|
|
@@ -1096,12 +1121,12 @@ class CngxMatTabs {
|
|
|
1096
1121
|
injector = inject(Injector);
|
|
1097
1122
|
renderer = inject(Renderer2);
|
|
1098
1123
|
hostEl = inject(ElementRef).nativeElement;
|
|
1099
|
-
// Field order matters
|
|
1124
|
+
// Field order matters - `overflowRef` reads `viewContainerRef` at
|
|
1100
1125
|
// class-init time. The VCR also feeds the aggregator-decoration
|
|
1101
1126
|
// slot path further down.
|
|
1102
1127
|
viewContainerRef = inject(ViewContainerRef);
|
|
1103
1128
|
// Programmatic mount of the cngx overflow molecule.
|
|
1104
|
-
// `injector: this.injector` is load-bearing
|
|
1129
|
+
// `injector: this.injector` is load-bearing - without it,
|
|
1105
1130
|
// `vcr.createComponent` walks the host-template's parent VCR for
|
|
1106
1131
|
// DI resolution, missing this directive's `CNGX_TAB_PANEL_HOST`
|
|
1107
1132
|
// and `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY` providers, and the
|
|
@@ -1116,11 +1141,8 @@ class CngxMatTabs {
|
|
|
1116
1141
|
aggregatorContentTemplate = computed(() => this.aggregatorContentSlot()?.templateRef ?? null, ...(ngDevMode ? [{ debugName: "aggregatorContentTemplate" }] : /* istanbul ignore next */ []));
|
|
1117
1142
|
rejectionContentSlot = contentChild(CngxMatTabRejectionContent, ...(ngDevMode ? [{ debugName: "rejectionContentSlot" }] : /* istanbul ignore next */ []));
|
|
1118
1143
|
rejectionContentTemplate = computed(() => this.rejectionContentSlot()?.templateRef ?? null, ...(ngDevMode ? [{ debugName: "rejectionContentTemplate" }] : /* istanbul ignore next */ []));
|
|
1119
|
-
// Per-tab registry lives on the `[cngxMatTabsRegistry]` host-
|
|
1120
|
-
// directive — sibling per-tab directives reach the per-handle
|
|
1121
|
-
// slots via `CNGX_MAT_TABS_REGISTRY_HOST`.
|
|
1122
1144
|
i18n = injectTabsI18n();
|
|
1123
|
-
// Identity equal on `string | null`
|
|
1145
|
+
// Identity equal on `string | null` - collapses `tabs()` re-emits
|
|
1124
1146
|
// that don't change the failed-target id.
|
|
1125
1147
|
failedHandleId = computed(() => {
|
|
1126
1148
|
const idx = this.presenter.lastFailedIndex();
|
|
@@ -1130,9 +1152,9 @@ class CngxMatTabs {
|
|
|
1130
1152
|
return this.presenter.tabs()[idx]?.id ?? null;
|
|
1131
1153
|
}, ...(ngDevMode ? [{ debugName: "failedHandleId" }] : /* istanbul ignore next */ []));
|
|
1132
1154
|
// Bundle shares one source-walk across descriptorText / originLabel
|
|
1133
|
-
// / liveAnnouncement
|
|
1155
|
+
// / liveAnnouncement - pillar-2 phrasing parity with cngx-native.
|
|
1134
1156
|
rejectionState = createRejectionState(this.presenter, this.i18n);
|
|
1135
|
-
// Structural equal
|
|
1157
|
+
// Structural equal - drops re-runs whose entry list is shape-
|
|
1136
1158
|
// identical so the projector doesn't churn on no-op aggregator
|
|
1137
1159
|
// re-emissions.
|
|
1138
1160
|
aggregatedErrorTabs = computed(() => {
|
|
@@ -1169,7 +1191,7 @@ class CngxMatTabs {
|
|
|
1169
1191
|
} });
|
|
1170
1192
|
constructor() {
|
|
1171
1193
|
const matTabsConfig = injectMatTabsConfig();
|
|
1172
|
-
// Polite live region
|
|
1194
|
+
// Polite live region - attribute directive owns no template, so
|
|
1173
1195
|
// the helper attaches the span at document.body (CDK
|
|
1174
1196
|
// LiveAnnouncer convention) and mirrors `CngxLiveRegion`'s host
|
|
1175
1197
|
// bindings imperatively.
|
|
@@ -1209,7 +1231,7 @@ class CngxMatTabs {
|
|
|
1209
1231
|
// `createDomAnchorRetry` covers the deferred-host case
|
|
1210
1232
|
// (`<mat-tab-group>` gated behind `*ngIf` / `@defer`); the cap
|
|
1211
1233
|
// dev-warns when consumer DOM never materialises. The
|
|
1212
|
-
// flex-layout skin in `mat-tabs.css` handles positioning
|
|
1234
|
+
// flex-layout skin in `mat-tabs.css` handles positioning - no
|
|
1213
1235
|
// imperative layout work needed.
|
|
1214
1236
|
const anchorMaxAttempts = matTabsConfig.anchorMaxAttempts;
|
|
1215
1237
|
const anchorRetry = inject(CNGX_DOM_ANCHOR_RETRY_FACTORY)({
|
|
@@ -1231,7 +1253,7 @@ class CngxMatTabs {
|
|
|
1231
1253
|
onGiveUp: () => {
|
|
1232
1254
|
if (isDevMode()) {
|
|
1233
1255
|
console.warn(`[CngxMatTabs] Could not anchor <cngx-tab-overflow> after ${anchorMaxAttempts} ` +
|
|
1234
|
-
'attempts
|
|
1256
|
+
'attempts - .mat-mdc-tab-header was not found inside the ' +
|
|
1235
1257
|
'host. The More popover will fall back to a sibling-of-' +
|
|
1236
1258
|
'<mat-tab-group> position; verify Material rendered the ' +
|
|
1237
1259
|
'strip (e.g. consumer is not gating <mat-tab-group> behind ' +
|
|
@@ -1256,7 +1278,7 @@ class CngxMatTabs {
|
|
|
1256
1278
|
/**
|
|
1257
1279
|
* Clears `presenter.lastFailedIndex`, dismissing the rejection
|
|
1258
1280
|
* decoration. Mirrors `CngxTabGroup.clearLastFailed()` so a
|
|
1259
|
-
* template ref (`#mt="cngxMatTabs"`) is enough
|
|
1281
|
+
* template ref (`#mt="cngxMatTabs"`) is enough - no host-token
|
|
1260
1282
|
* injection needed.
|
|
1261
1283
|
*/
|
|
1262
1284
|
clearLastFailed() {
|
|
@@ -1276,7 +1298,7 @@ class CngxMatTabs {
|
|
|
1276
1298
|
// molecule. `useExisting` binding below ensures every injection
|
|
1277
1299
|
// resolves to the single per-host instance. The cngx-native
|
|
1278
1300
|
// `<cngx-tab-group>` path keeps its own `useExisting:
|
|
1279
|
-
// CngxTabGroup` provider
|
|
1301
|
+
// CngxTabGroup` provider - sits one injector layer closer.
|
|
1280
1302
|
CngxMatTabsPanelHostAdapter,
|
|
1281
1303
|
{
|
|
1282
1304
|
provide: CNGX_TAB_PANEL_HOST,
|
|
@@ -1314,7 +1336,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1314
1336
|
// molecule. `useExisting` binding below ensures every injection
|
|
1315
1337
|
// resolves to the single per-host instance. The cngx-native
|
|
1316
1338
|
// `<cngx-tab-group>` path keeps its own `useExisting:
|
|
1317
|
-
// CngxTabGroup` provider
|
|
1339
|
+
// CngxTabGroup` provider - sits one injector layer closer.
|
|
1318
1340
|
CngxMatTabsPanelHostAdapter,
|
|
1319
1341
|
{
|
|
1320
1342
|
provide: CNGX_TAB_PANEL_HOST,
|
|
@@ -1330,14 +1352,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1330
1352
|
* the matching Material tab button (badge + descriptor span) via
|
|
1331
1353
|
* the Renderer2 effect inside {@link CngxMatTabs}.
|
|
1332
1354
|
*
|
|
1333
|
-
* Material owns `<mat-tab>` declarations
|
|
1334
|
-
* here
|
|
1355
|
+
* Material owns `<mat-tab>` declarations - `[cngxTab]` cannot host
|
|
1356
|
+
* here - so a sibling attribute directive carries the input.
|
|
1335
1357
|
* Empty-string transform handles the bare-attribute case per
|
|
1336
1358
|
* `feedback_bridge_input_not_required` (a developer typing
|
|
1337
1359
|
* `cngxMatTabError` without `[]` brackets must not poison the
|
|
1338
1360
|
* slot).
|
|
1339
1361
|
*
|
|
1340
|
-
* Locates its target via {@link CNGX_MAT_TABS_REGISTRY_HOST}
|
|
1362
|
+
* Locates its target via {@link CNGX_MAT_TABS_REGISTRY_HOST} -
|
|
1341
1363
|
* the registry provides the token with `useExisting`, so sibling
|
|
1342
1364
|
* directives reach per-handle slots through a typed contract
|
|
1343
1365
|
* instead of the concrete class. Tracks `presenter.tabs()` to
|
|
@@ -1345,6 +1367,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1345
1367
|
* before the registry's sync runs. `destroyRef.onDestroy` clears
|
|
1346
1368
|
* the slot so an `*ngIf`-toggled binding returns to the
|
|
1347
1369
|
* no-aggregator default.
|
|
1370
|
+
*
|
|
1371
|
+
* @category ui/mat-tabs
|
|
1372
|
+
* @wcag AA
|
|
1373
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tab-error.directive.ts
|
|
1374
|
+
* @since 0.1.0
|
|
1375
|
+
* @relatedTo CngxMatTabs, CngxMatTabsRegistry, CngxMatTabRejectionContent
|
|
1348
1376
|
*/
|
|
1349
1377
|
class CngxMatTabError {
|
|
1350
1378
|
matTab = inject(MatTab, { self: true });
|
|
@@ -1364,7 +1392,7 @@ class CngxMatTabError {
|
|
|
1364
1392
|
// pre-empts a future regression where `getHandleSetup` reads a
|
|
1365
1393
|
// signal and self-triggers the aggregator pump.
|
|
1366
1394
|
const aggregator = this.aggregator();
|
|
1367
|
-
// Race-recovery dependency
|
|
1395
|
+
// Race-recovery dependency - tracks `setupsByTab` population so
|
|
1368
1396
|
// the effect re-fires once our `MatTab` is registered. The bare
|
|
1369
1397
|
// read is intentional; full rationale lives in the effect's
|
|
1370
1398
|
// opening comment above. Do NOT tag as dead code.
|