@cngx/ui 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.
- package/README.md +112 -0
- package/a11y/README.md +81 -0
- package/context-menu/README.md +98 -0
- package/data-grid-accordion/README.md +27 -0
- package/feedback/README.md +2 -0
- package/fesm2022/cngx-ui-a11y.mjs +320 -0
- package/fesm2022/cngx-ui-a11y.mjs.map +1 -0
- package/fesm2022/cngx-ui-accordion.mjs +17 -6
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +5 -2
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +11 -6
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-chart-panel.mjs +429 -0
- package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -0
- package/fesm2022/cngx-ui-collection.mjs +15 -6
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +1005 -0
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -0
- package/fesm2022/cngx-ui-context-menu.mjs +742 -0
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -0
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +88 -18
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +97 -106
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +18 -9
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +9 -9
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +64 -70
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-paginator.mjs +18 -8
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +2 -2
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +20 -7
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +2 -2
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stat-card.mjs +618 -0
- package/fesm2022/cngx-ui-stat-card.mjs.map +1 -0
- package/fesm2022/cngx-ui-stepper.mjs +30 -12
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +36 -19
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +495 -0
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -0
- package/fesm2022/cngx-ui-toc.mjs +704 -0
- package/fesm2022/cngx-ui-toc.mjs.map +1 -0
- package/fesm2022/cngx-ui.mjs +2 -2
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-accordion/README.md +1 -1
- package/mat-tabs/styles/mat-tabs.css +20 -17
- package/package.json +32 -1
- package/skeleton/README.md +2 -0
- package/stepper/README.md +2 -2
- package/timeline/README.md +350 -0
- package/toc/README.md +183 -0
- package/types/cngx-ui-a11y.d.ts +303 -0
- package/types/cngx-ui-accordion.d.ts +9 -4
- package/types/cngx-ui-action-button.d.ts +3 -0
- package/types/cngx-ui-breadcrumb.d.ts +5 -0
- package/types/cngx-ui-chart-panel.d.ts +278 -0
- package/types/cngx-ui-collection.d.ts +12 -3
- package/types/cngx-ui-command-palette.d.ts +451 -0
- package/types/cngx-ui-context-menu.d.ts +467 -0
- package/types/cngx-ui-data-grid-accordion.d.ts +72 -15
- package/types/cngx-ui-feedback.d.ts +71 -18
- package/types/cngx-ui-layout.d.ts +8 -3
- package/types/cngx-ui-mat-accordion.d.ts +3 -3
- package/types/cngx-ui-mat-tabs.d.ts +11 -9
- package/types/cngx-ui-paginator.d.ts +13 -3
- package/types/cngx-ui-skeleton.d.ts +13 -1
- package/types/cngx-ui-stat-card.d.ts +327 -0
- package/types/cngx-ui-stepper.d.ts +15 -2
- package/types/cngx-ui-tabs.d.ts +20 -4
- package/types/cngx-ui-timeline.d.ts +479 -0
- package/types/cngx-ui-toc.d.ts +514 -0
- package/types/cngx-ui.d.ts +1 -1
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
|
|
4
|
+
// Chain per rung: consumer override hook (--cngx-gap-*, set nowhere by the
|
|
5
|
+
// library) -> density scale (--cngx-space-*, registered inherits: true, so a
|
|
6
|
+
// root [data-density] swap rescales the stack) -> literal for token-less
|
|
7
|
+
// environments.
|
|
4
8
|
const GAP_DEFAULTS = {
|
|
5
9
|
none: '0',
|
|
6
|
-
xs: 'var(--cngx-gap-xs, 4px)',
|
|
7
|
-
sm: 'var(--cngx-gap-sm, 8px)',
|
|
8
|
-
md: 'var(--cngx-gap-md, 16px)',
|
|
9
|
-
lg: 'var(--cngx-gap-lg, 24px)',
|
|
10
|
-
xl: 'var(--cngx-gap-xl, 32px)',
|
|
10
|
+
xs: 'var(--cngx-gap-xs, var(--cngx-space-xs, 4px))',
|
|
11
|
+
sm: 'var(--cngx-gap-sm, var(--cngx-space-sm, 8px))',
|
|
12
|
+
md: 'var(--cngx-gap-md, var(--cngx-space-md, 16px))',
|
|
13
|
+
lg: 'var(--cngx-gap-lg, var(--cngx-space-lg, 24px))',
|
|
14
|
+
xl: 'var(--cngx-gap-xl, var(--cngx-space-xl, 32px))',
|
|
11
15
|
};
|
|
12
16
|
/**
|
|
13
17
|
* Composable flex-based stack layout component.
|
|
14
18
|
*
|
|
15
19
|
* Gap tokens use CSS custom properties (`--cngx-gap-xs` through `--cngx-gap-xl`)
|
|
16
|
-
*
|
|
17
|
-
*
|
|
20
|
+
* that fall back to the density scale (`--cngx-space-*`), so a root
|
|
21
|
+
* `[data-density]` swap rescales the stack. Override the `--cngx-gap-*`
|
|
22
|
+
* hooks at any scope to detach a stack from the scale.
|
|
18
23
|
*
|
|
19
24
|
* <cngx-stack direction="row" gap="md" align="center">
|
|
20
25
|
* <div>Item 1</div>
|
|
@@ -76,8 +81,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
76
81
|
class CngxGrid {
|
|
77
82
|
/** Number of equal columns, or a custom `grid-template-columns` value. */
|
|
78
83
|
columns = input(1, { ...(ngDevMode ? { debugName: "columns" } : /* istanbul ignore next */ {}), transform: coerceColumns });
|
|
79
|
-
/**
|
|
80
|
-
|
|
84
|
+
/**
|
|
85
|
+
* CSS gap between cells. The default reads the `--cngx-gap-md` override
|
|
86
|
+
* hook and falls back to the density scale (`--cngx-space-md`), so a root
|
|
87
|
+
* `[data-density]` swap rescales the grid; any CSS gap value is accepted.
|
|
88
|
+
*/
|
|
89
|
+
gap = input('var(--cngx-gap-md, var(--cngx-space-md, 16px))', ...(ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []));
|
|
81
90
|
/** @internal */
|
|
82
91
|
gridTemplateColumns = computed(() => {
|
|
83
92
|
const cols = this.columns();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cngx-ui-layout.mjs","sources":["../../../projects/ui/layout/stack.component.ts","../../../projects/ui/layout/grid.component.ts","../../../projects/ui/layout/public-api.ts","../../../projects/ui/layout/cngx-ui-layout.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\n\n/**\n * Main-axis direction for {@link CngxStack}.\n *\n * @category ui/layout\n */\nexport type StackDirection = 'row' | 'column';\n/**\n * Cross-axis alignment for {@link CngxStack}.\n *\n * @category ui/layout\n */\nexport type StackAlign = 'start' | 'center' | 'end' | 'stretch';\n/**\n * Spacing scale for {@link CngxStack}. Maps to `--cngx-gap-*` tokens.\n *\n * @category ui/layout\n */\nexport type StackGap = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\nconst GAP_DEFAULTS: Record<StackGap, string> = {\n none: '0',\n xs: 'var(--cngx-gap-xs, 4px)',\n sm: 'var(--cngx-gap-sm, 8px)',\n md: 'var(--cngx-gap-md, 16px)',\n lg: 'var(--cngx-gap-lg, 24px)',\n xl: 'var(--cngx-gap-xl, 32px)',\n};\n\n/**\n * Composable flex-based stack layout component.\n *\n * Gap tokens use CSS custom properties (`--cngx-gap-xs` through `--cngx-gap-xl`)\n *
|
|
1
|
+
{"version":3,"file":"cngx-ui-layout.mjs","sources":["../../../projects/ui/layout/stack.component.ts","../../../projects/ui/layout/grid.component.ts","../../../projects/ui/layout/public-api.ts","../../../projects/ui/layout/cngx-ui-layout.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\n\n/**\n * Main-axis direction for {@link CngxStack}.\n *\n * @category ui/layout\n */\nexport type StackDirection = 'row' | 'column';\n/**\n * Cross-axis alignment for {@link CngxStack}.\n *\n * @category ui/layout\n */\nexport type StackAlign = 'start' | 'center' | 'end' | 'stretch';\n/**\n * Spacing scale for {@link CngxStack}. Maps to `--cngx-gap-*` tokens.\n *\n * @category ui/layout\n */\nexport type StackGap = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\n// Chain per rung: consumer override hook (--cngx-gap-*, set nowhere by the\n// library) -> density scale (--cngx-space-*, registered inherits: true, so a\n// root [data-density] swap rescales the stack) -> literal for token-less\n// environments.\nconst GAP_DEFAULTS: Record<StackGap, string> = {\n none: '0',\n xs: 'var(--cngx-gap-xs, var(--cngx-space-xs, 4px))',\n sm: 'var(--cngx-gap-sm, var(--cngx-space-sm, 8px))',\n md: 'var(--cngx-gap-md, var(--cngx-space-md, 16px))',\n lg: 'var(--cngx-gap-lg, var(--cngx-space-lg, 24px))',\n xl: 'var(--cngx-gap-xl, var(--cngx-space-xl, 32px))',\n};\n\n/**\n * Composable flex-based stack layout component.\n *\n * Gap tokens use CSS custom properties (`--cngx-gap-xs` through `--cngx-gap-xl`)\n * that fall back to the density scale (`--cngx-space-*`), so a root\n * `[data-density]` swap rescales the stack. Override the `--cngx-gap-*`\n * hooks at any scope to detach a stack from the scale.\n *\n * <cngx-stack direction=\"row\" gap=\"md\" align=\"center\">\n * <div>Item 1</div>\n * <div>Item 2</div>\n * </cngx-stack>\n *\n * @category ui/layout\n * @docsKind primary\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/layout/stack.component.ts\n * @since 0.1.0\n * @relatedTo CngxGrid\n */\n@Component({\n selector: 'cngx-stack',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: '<ng-content />',\n styles: [\n `\n :host {\n display: flex;\n }\n `,\n ],\n host: {\n '[style.flex-direction]': 'direction()',\n '[style.align-items]': 'alignItems()',\n '[style.gap]': 'gapValue()',\n },\n})\nexport class CngxStack {\n /** Flex direction of the stack. */\n readonly direction = input<StackDirection>('column');\n /** Named spacing token between stack items. Resolves via `--cngx-gap-*` CSS custom properties. */\n readonly gap = input<StackGap>('md');\n /** Cross-axis alignment of stack items. */\n readonly align = input<StackAlign>('stretch');\n\n /** @internal */\n protected readonly alignItems = computed(() => {\n const alignValue = this.align();\n return alignValue === 'stretch' ? 'stretch' : `flex-${alignValue}`;\n });\n\n /** @internal */\n protected readonly gapValue = computed(() => GAP_DEFAULTS[this.gap()]);\n}\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\n\n/**\n * Composable CSS grid layout component.\n ``` html\n <cngx-grid columns=\"3\" gap=\"16px\">\n <div>Cell 1</div>\n <div>Cell 2</div>\n </cngx-grid>\n ```\n * `columns` accepts either a positive integer for the\n * `repeat(N, 1fr)` shortcut or any `grid-template-columns` value\n * (`\"200px 1fr\"`, `\"repeat(auto-fit, minmax(120px, 1fr))\"`).\n * Bare attribute syntax works for both forms: `columns=\"3\"` and\n * `[columns]=\"3\"` produce identical output.\n *\n * @category ui/layout\n * @docsKind primary\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/layout/grid.component.ts\n * @since 0.1.0\n * @relatedTo CngxStack\n */\n@Component({\n selector: 'cngx-grid',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: '<ng-content />',\n styles: [\n `\n :host {\n display: grid;\n }\n `,\n ],\n host: {\n '[style.grid-template-columns]': 'gridTemplateColumns()',\n '[style.gap]': 'gap()',\n },\n})\nexport class CngxGrid {\n /** Number of equal columns, or a custom `grid-template-columns` value. */\n readonly columns = input<number | string, number | string>(1, {\n transform: coerceColumns,\n });\n /**\n * CSS gap between cells. The default reads the `--cngx-gap-md` override\n * hook and falls back to the density scale (`--cngx-space-md`), so a root\n * `[data-density]` swap rescales the grid; any CSS gap value is accepted.\n */\n readonly gap = input('var(--cngx-gap-md, var(--cngx-space-md, 16px))');\n\n /** @internal */\n protected readonly gridTemplateColumns = computed(() => {\n const cols = this.columns();\n return typeof cols === 'number' ? `repeat(${cols}, 1fr)` : cols;\n });\n}\n\n// Bare integer attribute (`columns=\"3\"`) coerces to a number so the\n// `repeat(N, 1fr)` branch fires; anything else is a track-list string\n// (`\"200px 1fr\"`) and passes through to `grid-template-columns`.\nfunction coerceColumns(value: number | string): number | string {\n if (typeof value === 'number') {\n return value;\n }\n return /^\\d+$/.test(value) ? Number(value) : value;\n}\n","/**\n * Public API Surface of @cngx/ui/layout\n * @module @cngx/ui/layout\n */\n\nexport * from './stack.component';\nexport * from './grid.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAqBA;AACA;AACA;AACA;AACA,MAAM,YAAY,GAA6B;AAC7C,IAAA,IAAI,EAAE,GAAG;AACT,IAAA,EAAE,EAAE,+CAA+C;AACnD,IAAA,EAAE,EAAE,+CAA+C;AACnD,IAAA,EAAE,EAAE,gDAAgD;AACpD,IAAA,EAAE,EAAE,gDAAgD;AACpD,IA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KAAK;IACd;AACA,IAAA,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK;AACpD;;AClEA;;;AAGG;;ACHH;;AAEG;;;;"}
|
|
@@ -10,22 +10,22 @@ import { nextUid } from '@cngx/core/utils';
|
|
|
10
10
|
* `<mat-expansion-panel>` tree and the headless {@link CngxAccordion}
|
|
11
11
|
* open-set. The accordion open-set is a multi-membership
|
|
12
12
|
* `Set<string>`, so the index-based `createMaterialBidirectionalSync`
|
|
13
|
-
* (`@cngx/common/data`) does not fit
|
|
13
|
+
* (`@cngx/common/data`) does not fit - this helper syncs per-panel
|
|
14
14
|
* `expanded` against set membership instead.
|
|
15
15
|
*
|
|
16
16
|
* Installs two effects and one listener-set:
|
|
17
17
|
*
|
|
18
|
-
* 1. **brain→Material**
|
|
18
|
+
* 1. **brain→Material** - an `effect()` tracking `panels()` and, per
|
|
19
19
|
* panel, `accordion.isOpen(id)`. When the open-set (or the panel
|
|
20
20
|
* list) changes it writes `panel.expanded` to match, guarded by a
|
|
21
21
|
* re-entrancy flag so the resulting synchronous `expandedChange`
|
|
22
22
|
* echo does not loop back. The Material writes run inside
|
|
23
23
|
* `untracked()` per `reference_signal_architecture` rule 2.
|
|
24
|
-
* 2. **subscription reconcile**
|
|
24
|
+
* 2. **subscription reconcile** - an `effect()` tracking only
|
|
25
25
|
* `panels()`; inside `untracked()` it subscribes freshly-added
|
|
26
26
|
* panels' `expandedChange` and drops removed ones (diff-only churn,
|
|
27
27
|
* a `Map<P, subscription>`).
|
|
28
|
-
* 3. **Material→brain**
|
|
28
|
+
* 3. **Material→brain** - each `expandedChange` listener flips the
|
|
29
29
|
* brain via `accordion.toggle(id)`, but only when the incoming
|
|
30
30
|
* `expanded` differs from the brain's current (clamped) membership,
|
|
31
31
|
* so a programmatic echo (or a redundant Material emit) is a no-op.
|
|
@@ -45,7 +45,7 @@ function createMatExpansionSetSync(opts) {
|
|
|
45
45
|
const { panels, panelId, accordion, injector, destroyRef } = opts;
|
|
46
46
|
// True while effect 1 is writing Material. `CdkAccordionItem` emits
|
|
47
47
|
// `expandedChange` synchronously from its `expanded` setter, so the
|
|
48
|
-
// Material→brain listener fires re-entrantly during our own write
|
|
48
|
+
// Material→brain listener fires re-entrantly during our own write -
|
|
49
49
|
// the flag drops that echo before the idempotent check even runs.
|
|
50
50
|
let writingToMaterial = false;
|
|
51
51
|
const subscriptions = new Map();
|
|
@@ -111,7 +111,7 @@ function createMatExpansionSetSync(opts) {
|
|
|
111
111
|
* a vanilla `<mat-accordion>` and it is driven by the headless
|
|
112
112
|
* {@link CngxAccordion} brain. Consumers gain the controlled
|
|
113
113
|
* `[(openIds)]` group model and single-open arbitration on Material
|
|
114
|
-
* markup
|
|
114
|
+
* markup - neither of which `<mat-accordion>` exposes (Material has only
|
|
115
115
|
* per-panel `[expanded]`). Mirrors `[cngxMatStepper]` / `[cngxMatTabs]`.
|
|
116
116
|
*
|
|
117
117
|
* This is the instrumentation pattern: Material owns rendering and the
|
|
@@ -134,7 +134,7 @@ function createMatExpansionSetSync(opts) {
|
|
|
134
134
|
*
|
|
135
135
|
* `multi` is authoritative on the cngx side. `MatAccordion` inherits its
|
|
136
136
|
* own `multi` input from `CdkAccordion`, and both directives sit on the
|
|
137
|
-
* same host element, so a single `[multi]` binding feeds both
|
|
137
|
+
* same host element, so a single `[multi]` binding feeds both - the
|
|
138
138
|
* directive therefore pins `matAccordion.multi = true` (via an `effect`
|
|
139
139
|
* that re-asserts on every `multi` change) so Material never runs its own
|
|
140
140
|
* single-open close while the cngx `effectiveOpenIds` clamp arbitrates.
|
|
@@ -151,14 +151,14 @@ class CngxMatAccordion {
|
|
|
151
151
|
matAccordion = inject(MatAccordion, { self: true });
|
|
152
152
|
/**
|
|
153
153
|
* The accordion brain on this host element (declared in
|
|
154
|
-
* `hostDirectives`). Same-host ownership
|
|
154
|
+
* `hostDirectives`). Same-host ownership - not a child→parent inject -
|
|
155
155
|
* so it stays decompose-safe.
|
|
156
156
|
*/
|
|
157
157
|
accordion = inject(CngxAccordion, { self: true });
|
|
158
158
|
injector = inject(Injector);
|
|
159
159
|
destroyRef = inject(DestroyRef);
|
|
160
160
|
panels = contentChildren(MatExpansionPanel, { ...(ngDevMode ? { debugName: "panels" } : /* istanbul ignore next */ {}), descendants: true });
|
|
161
|
-
// Stable id per panel
|
|
161
|
+
// Stable id per panel - the key the brain's open-set stores. A WeakMap:
|
|
162
162
|
// the id is assigned first-seen and never needs enumeration, so a removed
|
|
163
163
|
// panel's entry drops with the panel instead of accumulating over churn.
|
|
164
164
|
idByPanel = new WeakMap();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cngx-ui-mat-accordion.mjs","sources":["../../../projects/ui/mat-accordion/material-bridge/set-sync.ts","../../../projects/ui/mat-accordion/mat-accordion.directive.ts","../../../projects/ui/mat-accordion/public-api.ts","../../../projects/ui/mat-accordion/cngx-ui-mat-accordion.ts"],"sourcesContent":["import { type DestroyRef, effect, type Injector, runInInjectionContext, type Signal, untracked } from '@angular/core';\n\n/**\n * Minimal structural view of a `MatExpansionPanel` the set-sync needs:\n * a read/write `expanded` boolean and an `expandedChange` stream. Kept\n * host-agnostic (no `@angular/material` type in the signature) so the\n * helper is unit-testable with plain fakes, mirroring the Material-\n * agnostic shape of `createMaterialBidirectionalSync` in\n * `@cngx/common/data`. `MatExpansionPanel` satisfies it structurally\n * (`expanded` getter/setter from `CdkAccordionItem`, `expandedChange`\n * is an `EventEmitter<boolean>` whose `.subscribe` matches).\n *\n * @category ui/mat-accordion/material-bridge\n */\nexport interface CngxExpansionPanelLike {\n /** Current expanded state; assigning it drives the Material panel open/closed. */\n expanded: boolean;\n /** Emits the new expanded state on every Material-driven or programmatic change. */\n readonly expandedChange: {\n subscribe(next: (expanded: boolean) => void): { unsubscribe(): void };\n };\n}\n\n/**\n * Minimal structural view of the accordion brain the sync drives:\n * a reactive membership read plus the same `toggle` the native\n * `CngxAccordionPanel` calls. `CngxAccordion` satisfies it — `isOpen`\n * reads the clamped `effectiveOpenIds` computed and `toggle` mutates\n * from that clamped view, so single-open arbitration stays authoritative\n * and the exposed `openIds` model never retains a clamped-out id. The\n * sync writes membership exclusively through `toggle`, never a raw\n * set-write, so it can never diverge from the brain's own DOM path.\n *\n * @category ui/mat-accordion/material-bridge\n */\nexport interface CngxAccordionOpenSet {\n /** Reactive membership read — reflects single-mode arbitration. Tracked inside the sync effect. */\n isOpen(panelId: string): boolean;\n /** Flip a panel's open state, arbitrated by the brain (clamps siblings in single mode). */\n toggle(panelId: string): void;\n}\n\n/**\n * Options for {@link createMatExpansionSetSync}.\n *\n * @category ui/mat-accordion/material-bridge\n */\nexport interface CngxMatExpansionSetSyncOptions<P extends CngxExpansionPanelLike> {\n /** Reactive list of projected expansion panels (a `contentChildren` signal). */\n readonly panels: Signal<readonly P[]>;\n /** Stable id for a panel — the key the brain's open-set stores. */\n readonly panelId: (panel: P) => string;\n /** The accordion brain's open-set (membership read + settable model). */\n readonly accordion: CngxAccordionOpenSet;\n /** Injection context for the underlying `effect()`s. */\n readonly injector: Injector;\n /** Same lifetime as the host directive; tears down the `expandedChange` listeners. */\n readonly destroyRef: DestroyRef;\n}\n\n/**\n * Set-based bidirectional sync between a `<mat-accordion>`'s projected\n * `<mat-expansion-panel>` tree and the headless {@link CngxAccordion}\n * open-set. The accordion open-set is a multi-membership\n * `Set<string>`, so the index-based `createMaterialBidirectionalSync`\n * (`@cngx/common/data`) does not fit — this helper syncs per-panel\n * `expanded` against set membership instead.\n *\n * Installs two effects and one listener-set:\n *\n * 1. **brain→Material** — an `effect()` tracking `panels()` and, per\n * panel, `accordion.isOpen(id)`. When the open-set (or the panel\n * list) changes it writes `panel.expanded` to match, guarded by a\n * re-entrancy flag so the resulting synchronous `expandedChange`\n * echo does not loop back. The Material writes run inside\n * `untracked()` per `reference_signal_architecture` rule 2.\n * 2. **subscription reconcile** — an `effect()` tracking only\n * `panels()`; inside `untracked()` it subscribes freshly-added\n * panels' `expandedChange` and drops removed ones (diff-only churn,\n * a `Map<P, subscription>`).\n * 3. **Material→brain** — each `expandedChange` listener flips the\n * brain via `accordion.toggle(id)`, but only when the incoming\n * `expanded` differs from the brain's current (clamped) membership,\n * so a programmatic echo (or a redundant Material emit) is a no-op.\n * Routing through `toggle` (not a raw set-write) means single-mode\n * arbitration and the exposed `openIds` model stay identical to the\n * native `CngxAccordionPanel` DOM path.\n *\n * The idempotent membership check plus the re-entrancy flag together\n * close the loop: the flag drops the synchronous echo `CdkAccordionItem`\n * emits from its `expanded` setter during our own write, and the\n * membership check drops any Material emit that already agrees with the\n * brain.\n *\n * @category ui/mat-accordion/material-bridge\n */\nexport function createMatExpansionSetSync<P extends CngxExpansionPanelLike>(\n opts: CngxMatExpansionSetSyncOptions<P>,\n): void {\n const { panels, panelId, accordion, injector, destroyRef } = opts;\n\n // True while effect 1 is writing Material. `CdkAccordionItem` emits\n // `expandedChange` synchronously from its `expanded` setter, so the\n // Material→brain listener fires re-entrantly during our own write —\n // the flag drops that echo before the idempotent check even runs.\n let writingToMaterial = false;\n\n const subscriptions = new Map<P, { unsubscribe(): void }>();\n\n const writeBackFromMaterial = (id: string, expanded: boolean): void => {\n if (writingToMaterial) {\n return;\n }\n if (accordion.isOpen(id) === expanded) {\n return;\n }\n accordion.toggle(id);\n };\n\n runInInjectionContext(injector, () => {\n // brain→Material.\n effect(() => {\n const list = panels();\n const desired = list.map((panel) => accordion.isOpen(panelId(panel)));\n untracked(() => {\n writingToMaterial = true;\n try {\n list.forEach((panel, index) => {\n if (panel.expanded !== desired[index]) {\n panel.expanded = desired[index];\n }\n });\n } finally {\n writingToMaterial = false;\n }\n });\n });\n\n // Subscription reconcile.\n effect(() => {\n const live = new Set(panels());\n untracked(() => {\n for (const panel of live) {\n if (subscriptions.has(panel)) {\n continue;\n }\n const id = panelId(panel);\n subscriptions.set(\n panel,\n panel.expandedChange.subscribe((expanded) => writeBackFromMaterial(id, expanded)),\n );\n }\n for (const [panel, subscription] of Array.from(subscriptions.entries())) {\n if (live.has(panel)) {\n continue;\n }\n subscription.unsubscribe();\n subscriptions.delete(panel);\n }\n });\n });\n });\n\n destroyRef.onDestroy(() => {\n for (const subscription of subscriptions.values()) {\n subscription.unsubscribe();\n }\n subscriptions.clear();\n });\n}\n","import {\n contentChildren,\n DestroyRef,\n Directive,\n effect,\n inject,\n Injector,\n untracked,\n} from '@angular/core';\nimport { MatAccordion, MatExpansionPanel } from '@angular/material/expansion';\n\nimport { CngxAccordion } from '@cngx/common/interactive';\nimport { nextUid } from '@cngx/core/utils';\n\nimport { createMatExpansionSetSync } from './material-bridge/set-sync';\n\n/**\n * The Material twin of the cngx accordion: attach `cngxMatAccordion` to\n * a vanilla `<mat-accordion>` and it is driven by the headless\n * {@link CngxAccordion} brain. Consumers gain the controlled\n * `[(openIds)]` group model and single-open arbitration on Material\n * markup — neither of which `<mat-accordion>` exposes (Material has only\n * per-panel `[expanded]`). Mirrors `[cngxMatStepper]` / `[cngxMatTabs]`.\n *\n * This is the instrumentation pattern: Material owns rendering and the\n * consumer authors native `<mat-expansion-panel>` markup; cngx is the\n * behaviour layer. `[multi]` and the two-way `[(openIds)]` are forwarded\n * from {@link CngxAccordion} via `hostDirectives`.\n *\n * ```html\n * <mat-accordion cngxMatAccordion [(openIds)]=\"openIds\" [multi]=\"false\">\n * <mat-expansion-panel>\n * <mat-expansion-panel-header>Personal info</mat-expansion-panel-header>\n * <p>Tell us who you are.</p>\n * </mat-expansion-panel>\n * <mat-expansion-panel>\n * <mat-expansion-panel-header>Account</mat-expansion-panel-header>\n * <p>Choose your sign-in method.</p>\n * </mat-expansion-panel>\n * </mat-accordion>\n * ```\n *\n * `multi` is authoritative on the cngx side. `MatAccordion` inherits its\n * own `multi` input from `CdkAccordion`, and both directives sit on the\n * same host element, so a single `[multi]` binding feeds both — the\n * directive therefore pins `matAccordion.multi = true` (via an `effect`\n * that re-asserts on every `multi` change) so Material never runs its own\n * single-open close while the cngx `effectiveOpenIds` clamp arbitrates.\n *\n * @playground Controlled open-set ./examples/bridge/bridge-example.component.ts\n * @category ui/mat-accordion\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-accordion/mat-accordion.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAccordion, CngxAccordionItem, CngxMatStepper, CngxMatTabs\n */\n@Directive({\n selector: '[cngxMatAccordion]',\n exportAs: 'cngxMatAccordion',\n standalone: true,\n hostDirectives: [\n {\n directive: CngxAccordion,\n inputs: ['multi', 'openIds'],\n outputs: ['openIdsChange'],\n },\n ],\n})\nexport class CngxMatAccordion {\n private readonly matAccordion = inject(MatAccordion, { self: true });\n /**\n * The accordion brain on this host element (declared in\n * `hostDirectives`). Same-host ownership — not a child→parent inject —\n * so it stays decompose-safe.\n */\n private readonly accordion = inject(CngxAccordion, { self: true });\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly panels = contentChildren(MatExpansionPanel, { descendants: true });\n\n // Stable id per panel — the key the brain's open-set stores. A WeakMap:\n // the id is assigned first-seen and never needs enumeration, so a removed\n // panel's entry drops with the panel instead of accumulating over churn.\n private readonly idByPanel = new WeakMap<MatExpansionPanel, string>();\n\n constructor() {\n // Pin Material's own `multi` so it never arbitrates single-open: the\n // brain's `effectiveOpenIds` clamp is the sole arbiter. A single\n // `[multi]` binding on the host also sets `MatAccordion.multi`\n // (inherited from `CdkAccordion`); Angular applies that input during\n // change detection, so re-assert from an `effect` that flushes after\n // CD and re-runs whenever the consumer's `multi` changes.\n effect(() => {\n this.accordion.multi();\n untracked(() => {\n this.matAccordion.multi = true;\n });\n });\n\n createMatExpansionSetSync<MatExpansionPanel>({\n panels: this.panels,\n panelId: (panel) => this.panelId(panel),\n accordion: this.accordion,\n injector: this.injector,\n destroyRef: this.destroyRef,\n });\n }\n\n private panelId(panel: MatExpansionPanel): string {\n let id = this.idByPanel.get(panel);\n if (id === undefined) {\n id = nextUid('cngx-mat-panel-');\n this.idByPanel.set(panel, id);\n }\n return id;\n }\n}\n","/**\n * @module @cngx/ui/mat-accordion\n *\n * Material instrumentation directive for `<mat-accordion>`: attach\n * `[cngxMatAccordion]` and it composes the same {@link CngxAccordion}\n * brain as `<cngx-accordion-group>` (in `@cngx/ui/accordion`) via\n * `hostDirectives`, so the controlled `[(openIds)]` group model and\n * single-open arbitration work against Material's own markup. Mirrors\n * `[cngxMatStepper]` / `[cngxMatTabs]`.\n */\nexport { CngxMatAccordion } from './mat-accordion.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AA4DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCG;AACG,SAAU,yBAAyB,CACvC,IAAuC,EAAA;AAEvC,IAAA,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI;;;;;IAMjE,IAAI,iBAAiB,GAAG,KAAK;AAE7B,IAAA,MAAM,aAAa,GAAG,IAAI,GAAG,EAA8B;AAE3D,IAAA,MAAM,qBAAqB,GAAG,CAAC,EAAU,EAAE,QAAiB,KAAU;QACpE,IAAI,iBAAiB,EAAE;YACrB;QACF;QACA,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,QAAQ,EAAE;YACrC;QACF;AACA,QAAA,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;AACtB,IAAA,CAAC;AAED,IAAA,qBAAqB,CAAC,QAAQ,EAAE,MAAK;;QAEnC,MAAM,CAAC,MAAK;AACV,YAAA,MAAM,IAAI,GAAG,MAAM,EAAE;YACrB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YACrE,SAAS,CAAC,MAAK;gBACb,iBAAiB,GAAG,IAAI;AACxB,gBAAA,IAAI;oBACF,I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EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAAA,iBAAiB,CAAA,EAAA,EAAA,GAAE,EAAE,WAAW,EAAE,IAAI,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AChFpF;;;;;;;;;AASG;;ACTH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cngx-ui-mat-accordion.mjs","sources":["../../../projects/ui/mat-accordion/material-bridge/set-sync.ts","../../../projects/ui/mat-accordion/mat-accordion.directive.ts","../../../projects/ui/mat-accordion/public-api.ts","../../../projects/ui/mat-accordion/cngx-ui-mat-accordion.ts"],"sourcesContent":["import { type DestroyRef, effect, type Injector, runInInjectionContext, type Signal, untracked } from '@angular/core';\n\n/**\n * Minimal structural view of a `MatExpansionPanel` the set-sync needs:\n * a read/write `expanded` boolean and an `expandedChange` stream. Kept\n * host-agnostic (no `@angular/material` type in the signature) so the\n * helper is unit-testable with plain fakes, mirroring the Material-\n * agnostic shape of `createMaterialBidirectionalSync` in\n * `@cngx/common/data`. `MatExpansionPanel` satisfies it structurally\n * (`expanded` getter/setter from `CdkAccordionItem`, `expandedChange`\n * is an `EventEmitter<boolean>` whose `.subscribe` matches).\n *\n * @category ui/mat-accordion/material-bridge\n */\nexport interface CngxExpansionPanelLike {\n /** Current expanded state; assigning it drives the Material panel open/closed. */\n expanded: boolean;\n /** Emits the new expanded state on every Material-driven or programmatic change. */\n readonly expandedChange: {\n subscribe(next: (expanded: boolean) => void): { unsubscribe(): void };\n };\n}\n\n/**\n * Minimal structural view of the accordion brain the sync drives:\n * a reactive membership read plus the same `toggle` the native\n * `CngxAccordionPanel` calls. `CngxAccordion` satisfies it - `isOpen`\n * reads the clamped `effectiveOpenIds` computed and `toggle` mutates\n * from that clamped view, so single-open arbitration stays authoritative\n * and the exposed `openIds` model never retains a clamped-out id. The\n * sync writes membership exclusively through `toggle`, never a raw\n * set-write, so it can never diverge from the brain's own DOM path.\n *\n * @category ui/mat-accordion/material-bridge\n */\nexport interface CngxAccordionOpenSet {\n /** Reactive membership read - reflects single-mode arbitration. Tracked inside the sync effect. */\n isOpen(panelId: string): boolean;\n /** Flip a panel's open state, arbitrated by the brain (clamps siblings in single mode). */\n toggle(panelId: string): void;\n}\n\n/**\n * Options for {@link createMatExpansionSetSync}.\n *\n * @category ui/mat-accordion/material-bridge\n */\nexport interface CngxMatExpansionSetSyncOptions<P extends CngxExpansionPanelLike> {\n /** Reactive list of projected expansion panels (a `contentChildren` signal). */\n readonly panels: Signal<readonly P[]>;\n /** Stable id for a panel - the key the brain's open-set stores. */\n readonly panelId: (panel: P) => string;\n /** The accordion brain's open-set (membership read + settable model). */\n readonly accordion: CngxAccordionOpenSet;\n /** Injection context for the underlying `effect()`s. */\n readonly injector: Injector;\n /** Same lifetime as the host directive; tears down the `expandedChange` listeners. */\n readonly destroyRef: DestroyRef;\n}\n\n/**\n * Set-based bidirectional sync between a `<mat-accordion>`'s projected\n * `<mat-expansion-panel>` tree and the headless {@link CngxAccordion}\n * open-set. The accordion open-set is a multi-membership\n * `Set<string>`, so the index-based `createMaterialBidirectionalSync`\n * (`@cngx/common/data`) does not fit - this helper syncs per-panel\n * `expanded` against set membership instead.\n *\n * Installs two effects and one listener-set:\n *\n * 1. **brain→Material** - an `effect()` tracking `panels()` and, per\n * panel, `accordion.isOpen(id)`. When the open-set (or the panel\n * list) changes it writes `panel.expanded` to match, guarded by a\n * re-entrancy flag so the resulting synchronous `expandedChange`\n * echo does not loop back. The Material writes run inside\n * `untracked()` per `reference_signal_architecture` rule 2.\n * 2. **subscription reconcile** - an `effect()` tracking only\n * `panels()`; inside `untracked()` it subscribes freshly-added\n * panels' `expandedChange` and drops removed ones (diff-only churn,\n * a `Map<P, subscription>`).\n * 3. **Material→brain** - each `expandedChange` listener flips the\n * brain via `accordion.toggle(id)`, but only when the incoming\n * `expanded` differs from the brain's current (clamped) membership,\n * so a programmatic echo (or a redundant Material emit) is a no-op.\n * Routing through `toggle` (not a raw set-write) means single-mode\n * arbitration and the exposed `openIds` model stay identical to the\n * native `CngxAccordionPanel` DOM path.\n *\n * The idempotent membership check plus the re-entrancy flag together\n * close the loop: the flag drops the synchronous echo `CdkAccordionItem`\n * emits from its `expanded` setter during our own write, and the\n * membership check drops any Material emit that already agrees with the\n * brain.\n *\n * @category ui/mat-accordion/material-bridge\n */\nexport function createMatExpansionSetSync<P extends CngxExpansionPanelLike>(\n opts: CngxMatExpansionSetSyncOptions<P>,\n): void {\n const { panels, panelId, accordion, injector, destroyRef } = opts;\n\n // True while effect 1 is writing Material. `CdkAccordionItem` emits\n // `expandedChange` synchronously from its `expanded` setter, so the\n // Material→brain listener fires re-entrantly during our own write -\n // the flag drops that echo before the idempotent check even runs.\n let writingToMaterial = false;\n\n const subscriptions = new Map<P, { unsubscribe(): void }>();\n\n const writeBackFromMaterial = (id: string, expanded: boolean): void => {\n if (writingToMaterial) {\n return;\n }\n if (accordion.isOpen(id) === expanded) {\n return;\n }\n accordion.toggle(id);\n };\n\n runInInjectionContext(injector, () => {\n // brain→Material.\n effect(() => {\n const list = panels();\n const desired = list.map((panel) => accordion.isOpen(panelId(panel)));\n untracked(() => {\n writingToMaterial = true;\n try {\n list.forEach((panel, index) => {\n if (panel.expanded !== desired[index]) {\n panel.expanded = desired[index];\n }\n });\n } finally {\n writingToMaterial = false;\n }\n });\n });\n\n // Subscription reconcile.\n effect(() => {\n const live = new Set(panels());\n untracked(() => {\n for (const panel of live) {\n if (subscriptions.has(panel)) {\n continue;\n }\n const id = panelId(panel);\n subscriptions.set(\n panel,\n panel.expandedChange.subscribe((expanded) => writeBackFromMaterial(id, expanded)),\n );\n }\n for (const [panel, subscription] of Array.from(subscriptions.entries())) {\n if (live.has(panel)) {\n continue;\n }\n subscription.unsubscribe();\n subscriptions.delete(panel);\n }\n });\n });\n });\n\n destroyRef.onDestroy(() => {\n for (const subscription of subscriptions.values()) {\n subscription.unsubscribe();\n }\n subscriptions.clear();\n });\n}\n","import {\n contentChildren,\n DestroyRef,\n Directive,\n effect,\n inject,\n Injector,\n untracked,\n} from '@angular/core';\nimport { MatAccordion, MatExpansionPanel } from '@angular/material/expansion';\n\nimport { CngxAccordion } from '@cngx/common/interactive';\nimport { nextUid } from '@cngx/core/utils';\n\nimport { createMatExpansionSetSync } from './material-bridge/set-sync';\n\n/**\n * The Material twin of the cngx accordion: attach `cngxMatAccordion` to\n * a vanilla `<mat-accordion>` and it is driven by the headless\n * {@link CngxAccordion} brain. Consumers gain the controlled\n * `[(openIds)]` group model and single-open arbitration on Material\n * markup - neither of which `<mat-accordion>` exposes (Material has only\n * per-panel `[expanded]`). Mirrors `[cngxMatStepper]` / `[cngxMatTabs]`.\n *\n * This is the instrumentation pattern: Material owns rendering and the\n * consumer authors native `<mat-expansion-panel>` markup; cngx is the\n * behaviour layer. `[multi]` and the two-way `[(openIds)]` are forwarded\n * from {@link CngxAccordion} via `hostDirectives`.\n *\n * ```html\n * <mat-accordion cngxMatAccordion [(openIds)]=\"openIds\" [multi]=\"false\">\n * <mat-expansion-panel>\n * <mat-expansion-panel-header>Personal info</mat-expansion-panel-header>\n * <p>Tell us who you are.</p>\n * </mat-expansion-panel>\n * <mat-expansion-panel>\n * <mat-expansion-panel-header>Account</mat-expansion-panel-header>\n * <p>Choose your sign-in method.</p>\n * </mat-expansion-panel>\n * </mat-accordion>\n * ```\n *\n * `multi` is authoritative on the cngx side. `MatAccordion` inherits its\n * own `multi` input from `CdkAccordion`, and both directives sit on the\n * same host element, so a single `[multi]` binding feeds both - the\n * directive therefore pins `matAccordion.multi = true` (via an `effect`\n * that re-asserts on every `multi` change) so Material never runs its own\n * single-open close while the cngx `effectiveOpenIds` clamp arbitrates.\n *\n * @playground Controlled open-set ./examples/bridge/bridge-example.component.ts\n * @category ui/mat-accordion\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-accordion/mat-accordion.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAccordion, CngxAccordionItem, CngxMatStepper, CngxMatTabs\n */\n@Directive({\n selector: '[cngxMatAccordion]',\n exportAs: 'cngxMatAccordion',\n standalone: true,\n hostDirectives: [\n {\n directive: CngxAccordion,\n inputs: ['multi', 'openIds'],\n outputs: ['openIdsChange'],\n },\n ],\n})\nexport class CngxMatAccordion {\n private readonly matAccordion = inject(MatAccordion, { self: true });\n /**\n * The accordion brain on this host element (declared in\n * `hostDirectives`). Same-host ownership - not a child→parent inject -\n * so it stays decompose-safe.\n */\n private readonly accordion = inject(CngxAccordion, { self: true });\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly panels = contentChildren(MatExpansionPanel, { descendants: true });\n\n // Stable id per panel - the key the brain's open-set stores. A WeakMap:\n // the id is assigned first-seen and never needs enumeration, so a removed\n // panel's entry drops with the panel instead of accumulating over churn.\n private readonly idByPanel = new WeakMap<MatExpansionPanel, string>();\n\n constructor() {\n // Pin Material's own `multi` so it never arbitrates single-open: the\n // brain's `effectiveOpenIds` clamp is the sole arbiter. A single\n // `[multi]` binding on the host also sets `MatAccordion.multi`\n // (inherited from `CdkAccordion`); Angular applies that input during\n // change detection, so re-assert from an `effect` that flushes after\n // CD and re-runs whenever the consumer's `multi` changes.\n effect(() => {\n this.accordion.multi();\n untracked(() => {\n this.matAccordion.multi = true;\n });\n });\n\n createMatExpansionSetSync<MatExpansionPanel>({\n panels: this.panels,\n panelId: (panel) => this.panelId(panel),\n accordion: this.accordion,\n injector: this.injector,\n destroyRef: this.destroyRef,\n });\n }\n\n private panelId(panel: MatExpansionPanel): string {\n let id = this.idByPanel.get(panel);\n if (id === undefined) {\n id = nextUid('cngx-mat-panel-');\n this.idByPanel.set(panel, id);\n }\n return id;\n }\n}\n","/**\n * @module @cngx/ui/mat-accordion\n *\n * Material instrumentation directive for `<mat-accordion>`: attach\n * `[cngxMatAccordion]` and it composes the same {@link CngxAccordion}\n * brain as `<cngx-accordion-group>` (in `@cngx/ui/accordion`) via\n * `hostDirectives`, so the controlled `[(openIds)]` group model and\n * single-open arbitration work against Material's own markup. Mirrors\n * `[cngxMatStepper]` / `[cngxMatTabs]`.\n */\nexport { CngxMatAccordion } from './mat-accordion.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AA4DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCG;AACG,SAAU,yBAAyB,CACvC,IAAuC,EAAA;AAEvC,IAAA,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI;;;;;IAMjE,IAAI,iBAAiB,GAAG,KAAK;AAE7B,IAAA,MAAM,aAAa,GAAG,IAAI,GAAG,EAA8B;AAE3D,IAAA,MAAM,qBAAqB,GAAG,CAAC,EAAU,EAAE,QAAiB,KAAU;QACpE,IAAI,iBAAiB,EAAE;YACrB;QACF;QACA,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,QAAQ,EAAE;YACrC;QACF;AACA,QAAA,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;AACtB,IAAA,CAAC;AAED,IAAA,qBAAqB,CAAC,QAAQ,EAAE,MAAK;;QAEnC,MAAM,CAAC,MAAK;AACV,YAAA,MAAM,IAAI,GAAG,MAAM,EAAE;YACrB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YACrE,SAAS,CAAC,MAAK;gBACb,iBAAiB,GAAG,IAAI;AACxB,gBAAA,IAAI;oBACF,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,KAAI;wBAC5B,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO,CAAC,KAAK,CAAC,EAAE;AACrC,4BAAA,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC;wBACjC;AACF,oB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;;AAEG;;;;"}
|
|
@@ -3,9 +3,9 @@ import { runInInjectionContext, effect, untracked, afterNextRender, isDevMode, c
|
|
|
3
3
|
import { MatTab, MatTabGroup, MatTabLink } from '@angular/material/tabs';
|
|
4
4
|
import { createMaterialBidirectionalSync } from '@cngx/common/data';
|
|
5
5
|
import * as i1 from '@cngx/common/tabs';
|
|
6
|
-
import { CNGX_TAB_GROUP_HOST, injectTabsI18n, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CngxTabGroupPresenter } from '@cngx/common/tabs';
|
|
6
|
+
import { CNGX_TAB_GROUP_HOST, injectTabsI18n, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CngxTabGroupPresenter, CNGX_TAB_NAV_HOST } from '@cngx/common/tabs';
|
|
7
7
|
import { CngxTabOverflow } from '@cngx/ui/tabs';
|
|
8
|
-
import {
|
|
8
|
+
import { CngxLiveAnnouncer } from '@cngx/common/a11y';
|
|
9
9
|
import { nextUid } from '@cngx/core/utils';
|
|
10
10
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
11
11
|
|
|
@@ -29,7 +29,7 @@ import { toSignal } from '@angular/core/rxjs-interop';
|
|
|
29
29
|
* type façades and the selector constants. The TS namespace also
|
|
30
30
|
* lets cross-package consumers (`@cngx/ui/mat-stepper`) read the
|
|
31
31
|
* grouped name through ESLint's `@typescript-eslint` type resolver
|
|
32
|
-
*
|
|
32
|
+
* - a flat `export * as` re-export from `public-api.ts` does not
|
|
33
33
|
* resolve nested members through the path-alias.
|
|
34
34
|
*
|
|
35
35
|
* @category ui/mat-tabs
|
|
@@ -38,17 +38,17 @@ import { toSignal } from '@angular/core/rxjs-interop';
|
|
|
38
38
|
var MaterialPrivateSurfaces;
|
|
39
39
|
(function (MaterialPrivateSurfaces) {
|
|
40
40
|
/**
|
|
41
|
-
* `.mat-mdc-tab`
|
|
41
|
+
* `.mat-mdc-tab` - the class Material applies to the rendered
|
|
42
42
|
* tab `<button>` elements inside `MatTabHeader`. cngx
|
|
43
43
|
* index-correlates `presenter.tabs()` registration order against
|
|
44
44
|
* `host.querySelectorAll('.mat-mdc-tab')` because `MatTab` is a
|
|
45
|
-
* portal
|
|
45
|
+
* portal - the rendered buttons live inside `MatTabHeader`'s
|
|
46
46
|
* template, not on the `<mat-tab>` declaration site, and Material
|
|
47
47
|
* exposes no public per-tab element accessor.
|
|
48
48
|
*/
|
|
49
49
|
MaterialPrivateSurfaces.MAT_MDC_TAB_SELECTOR = '.mat-mdc-tab';
|
|
50
50
|
/**
|
|
51
|
-
* `.mat-mdc-tab-header`
|
|
51
|
+
* `.mat-mdc-tab-header` - the strip element rendered by
|
|
52
52
|
* `MatTabHeader`. `[cngxMatTabs]` walks
|
|
53
53
|
* `host.querySelector('.mat-mdc-tab-header')` to locate the mount
|
|
54
54
|
* anchor for the cngx overflow molecule (so the More button pins
|
|
@@ -57,7 +57,7 @@ var MaterialPrivateSurfaces;
|
|
|
57
57
|
*/
|
|
58
58
|
MaterialPrivateSurfaces.MAT_MDC_TAB_HEADER_SELECTOR = '.mat-mdc-tab-header';
|
|
59
59
|
/**
|
|
60
|
-
* `.mat-mdc-tab-label-container`
|
|
60
|
+
* `.mat-mdc-tab-label-container` - Material's IO-friendly scroll
|
|
61
61
|
* viewport ancestor of the rendered tab buttons. The Material-
|
|
62
62
|
* twin overflow adapter walks `host → header → any tab → closest
|
|
63
63
|
* label-container` to attach the molecule's
|
|
@@ -70,12 +70,12 @@ var MaterialPrivateSurfaces;
|
|
|
70
70
|
/**
|
|
71
71
|
* Package-private DOM-mutation projectors for `[cngxMatTabs]`.
|
|
72
72
|
*
|
|
73
|
-
* - {@link createMatTabRejectionDecoration}
|
|
73
|
+
* - {@link createMatTabRejectionDecoration} - mirrors
|
|
74
74
|
* `presenter.lastFailedIndex` onto the matching `.mat-mdc-tab` as a
|
|
75
75
|
* class flag plus a hidden `cngx-sr-only` descriptor span linked via
|
|
76
76
|
* `aria-describedby`. `aria-invalid` is intentionally absent: ARIA
|
|
77
77
|
* 1.2 scopes it to form-field vocabulary, not `role="tab"`.
|
|
78
|
-
* - {@link createMatTabAggregatorDecoration}
|
|
78
|
+
* - {@link createMatTabAggregatorDecoration} - projects each handle's
|
|
79
79
|
* `shouldShow()` flag onto the matching button as a class +
|
|
80
80
|
* descriptor span pair, same `aria-describedby` token-append pattern.
|
|
81
81
|
*
|
|
@@ -83,19 +83,19 @@ var MaterialPrivateSurfaces;
|
|
|
83
83
|
* projectors stack on the same target without collision; the shared
|
|
84
84
|
* token-list append preserves consumer-supplied tokens.
|
|
85
85
|
*
|
|
86
|
-
* @internal package-private
|
|
86
|
+
* @internal package-private - consumers bind `[cngxMatTabError]` on
|
|
87
87
|
* each `<mat-tab>`; the directive owns the projection mechanics.
|
|
88
88
|
*/
|
|
89
89
|
/**
|
|
90
90
|
* Diff-restore the `aria-describedby` token list after a decoration's
|
|
91
|
-
* descriptor span detaches
|
|
91
|
+
* descriptor span detaches - drops the decoration's own id token from
|
|
92
92
|
* the live attribute, leaving any third-party tokens written between
|
|
93
93
|
* apply and clear (tooltip refs, Material's own runtime additions)
|
|
94
94
|
* intact. Treats the attribute as a token-set per the cngx ARIA-by-value
|
|
95
95
|
* rule, not as a single-owner string.
|
|
96
96
|
*
|
|
97
97
|
* Empty-result + originally-absent attribute removes the attribute
|
|
98
|
-
* entirely
|
|
98
|
+
* entirely - a dangling `aria-describedby=""` would be a malformed
|
|
99
99
|
* reference in some AT readers.
|
|
100
100
|
*
|
|
101
101
|
* @internal
|
|
@@ -124,7 +124,7 @@ function restoreAriaDescribedbyExceptToken(el, tokenToRemove, renderer, priorAri
|
|
|
124
124
|
* Two effects split the work: one tracks `failedHandleId` and
|
|
125
125
|
* mounts/unmounts the span; the other tracks `descriptorText` and
|
|
126
126
|
* mutates `textContent` in place. The split keeps late label
|
|
127
|
-
* resolution O(1)
|
|
127
|
+
* resolution O(1) - no DOM rebuild when the origin label arrives
|
|
128
128
|
* via a downstream `tabs()` re-emission.
|
|
129
129
|
*
|
|
130
130
|
* @internal
|
|
@@ -135,15 +135,15 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
135
135
|
const srOnlyClassName = opts.srOnlyClassName ?? 'cngx-sr-only';
|
|
136
136
|
const descriptorIdSuffix = opts.descriptorIdSuffix ?? 'rejected';
|
|
137
137
|
// Slot path needs both halves; either alone degrades to imperative
|
|
138
|
-
// textContent. No diagnostic
|
|
138
|
+
// textContent. No diagnostic - single in-package consumer always
|
|
139
139
|
// passes both.
|
|
140
140
|
const slotEnabled = !!opts.contentTemplate && !!opts.viewContainerRef;
|
|
141
141
|
let decoratedEl = null;
|
|
142
|
-
// Cached across the projector's lifetime
|
|
142
|
+
// Cached across the projector's lifetime - reusing the same node
|
|
143
143
|
// keeps AT-reader / observer references live across A→B→A flips.
|
|
144
144
|
let cachedSpan = null;
|
|
145
145
|
let priorAriaDescribedby = null;
|
|
146
|
-
// Pillar 1
|
|
146
|
+
// Pillar 1 - short-circuits structurally-identical re-emissions of
|
|
147
147
|
// `failedHandleId` so a `tabs()` re-eval doesn't clobber the AT
|
|
148
148
|
// descriptor mid-flight.
|
|
149
149
|
let lastAppliedId = null;
|
|
@@ -175,7 +175,7 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
175
175
|
injector: opts.injector,
|
|
176
176
|
});
|
|
177
177
|
// Force CD before moving rootNodes out of the embedded view's
|
|
178
|
-
// logical parent
|
|
178
|
+
// logical parent - zoneless + OnPush would otherwise leave the
|
|
179
179
|
// first SR read stale.
|
|
180
180
|
view.detectChanges();
|
|
181
181
|
for (const node of view.rootNodes) {
|
|
@@ -184,7 +184,7 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
184
184
|
embeddedView = view;
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
|
-
// Imperative fallback
|
|
187
|
+
// Imperative fallback - also covers the path where a slot was
|
|
188
188
|
// previously bound and is now removed (destroy any prior view).
|
|
189
189
|
destroyEmbeddedView();
|
|
190
190
|
opts.renderer.setProperty(span, 'textContent', text);
|
|
@@ -197,7 +197,7 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
197
197
|
destroyEmbeddedView();
|
|
198
198
|
opts.renderer.removeClass(decoratedEl, className);
|
|
199
199
|
opts.renderer.removeChild(decoratedEl, cachedSpan);
|
|
200
|
-
// `cachedSpan` deliberately retained
|
|
200
|
+
// `cachedSpan` deliberately retained - reused on the next apply.
|
|
201
201
|
restoreAriaDescribedbyExceptToken(decoratedEl, ownTokenId, opts.renderer, priorAriaDescribedby);
|
|
202
202
|
decoratedEl = null;
|
|
203
203
|
priorAriaDescribedby = null;
|
|
@@ -217,13 +217,13 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
217
217
|
opts.renderer.addClass(span, srOnlyClassName);
|
|
218
218
|
cachedSpan = span;
|
|
219
219
|
}
|
|
220
|
-
// Always rewrite id + textContent
|
|
220
|
+
// Always rewrite id + textContent - the cached span carries stale
|
|
221
221
|
// values from the prior mount. The live-text effect below picks
|
|
222
222
|
// up subsequent `descriptorText` changes in place.
|
|
223
223
|
opts.renderer.setAttribute(span, 'id', spanId);
|
|
224
224
|
opts.renderer.appendChild(targetEl, span);
|
|
225
225
|
writeDescriptorContent(span, handleId, opts.descriptorText());
|
|
226
|
-
// Renderer2 has no `getAttribute` counterpart
|
|
226
|
+
// Renderer2 has no `getAttribute` counterpart - read off the
|
|
227
227
|
// native element. Browser-only; SSR would need a platform adapter.
|
|
228
228
|
const prior = targetEl.getAttribute('aria-describedby');
|
|
229
229
|
const tokens = prior ? prior.split(/\s+/).filter(Boolean) : [];
|
|
@@ -256,7 +256,7 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
256
256
|
lastAppliedId = id;
|
|
257
257
|
});
|
|
258
258
|
});
|
|
259
|
-
// Live-text effect
|
|
259
|
+
// Live-text effect - tracks `descriptorText` plus the slot
|
|
260
260
|
// template (when wired) so a late-mounted template re-renders
|
|
261
261
|
// into the existing span. Mount-state checks live in untracked.
|
|
262
262
|
effect(() => {
|
|
@@ -284,7 +284,7 @@ function createMatTabRejectionDecoration(opts) {
|
|
|
284
284
|
* descriptor span + `aria-describedby` token follow `errorTabs`
|
|
285
285
|
* reactively; pruned on entry drop and on directive destroy.
|
|
286
286
|
*
|
|
287
|
-
* Race recovery
|
|
287
|
+
* Race recovery - when the effect fires before MatTabHeader has
|
|
288
288
|
* rendered the matching buttons (initial-render race), schedules a
|
|
289
289
|
* single `afterNextRender` retry, bounded by `maxRetryAttempts`.
|
|
290
290
|
*
|
|
@@ -299,7 +299,7 @@ function createMatTabAggregatorDecoration(opts) {
|
|
|
299
299
|
// textContent. Re-evaluated per fire so a lazy-mounted template
|
|
300
300
|
// (`*ngIf` / `@defer`) picks up on first materialisation.
|
|
301
301
|
const isFullyWired = () => !!opts.contentTemplate && !!opts.viewContainerRef;
|
|
302
|
-
// Half-wired diagnostic
|
|
302
|
+
// Half-wired diagnostic - graceful degradation hides the mistake
|
|
303
303
|
// at runtime, so the signal has to come from a deliberate sink.
|
|
304
304
|
if (!isFullyWired() && (opts.contentTemplate || opts.viewContainerRef)) {
|
|
305
305
|
const missing = opts.contentTemplate ? 'viewContainerRef' : 'contentTemplate';
|
|
@@ -340,7 +340,7 @@ function createMatTabAggregatorDecoration(opts) {
|
|
|
340
340
|
entry.embeddedView = view;
|
|
341
341
|
return;
|
|
342
342
|
}
|
|
343
|
-
// Imperative fallback
|
|
343
|
+
// Imperative fallback - also covers the path where a slot was
|
|
344
344
|
// previously bound and is now removed (destroy any prior view).
|
|
345
345
|
destroyEmbeddedView(entry);
|
|
346
346
|
opts.renderer.setProperty(entry.descriptorSpan, 'textContent', announcement);
|
|
@@ -364,7 +364,7 @@ function createMatTabAggregatorDecoration(opts) {
|
|
|
364
364
|
opts.renderer.addClass(descriptorSpan, srOnlyClassName);
|
|
365
365
|
opts.renderer.setAttribute(descriptorSpan, 'id', spanId);
|
|
366
366
|
opts.renderer.appendChild(targetEl, descriptorSpan);
|
|
367
|
-
// See the read-via-nativeElement note in `applyDecorationAt` above
|
|
367
|
+
// See the read-via-nativeElement note in `applyDecorationAt` above -
|
|
368
368
|
// Renderer2 has no `getAttribute` counterpart, so attribute reads
|
|
369
369
|
// go through the native element directly.
|
|
370
370
|
const priorAriaDescribedby = targetEl.getAttribute('aria-describedby');
|
|
@@ -460,7 +460,7 @@ function defaultHalfWiredSlotWarn(missing) {
|
|
|
460
460
|
if (!isDevMode()) {
|
|
461
461
|
return;
|
|
462
462
|
}
|
|
463
|
-
console.warn('[cngxMatTabs] aggregator-content slot half-wired
|
|
463
|
+
console.warn('[cngxMatTabs] aggregator-content slot half-wired - ' +
|
|
464
464
|
`\`${missing}\` is missing while the other half is supplied. ` +
|
|
465
465
|
'The decoration projector will silently fall back to the ' +
|
|
466
466
|
'imperative `textContent` path, and the consumer-projected ' +
|
|
@@ -473,7 +473,7 @@ function defaultRetryCeilingWarn(max) {
|
|
|
473
473
|
return;
|
|
474
474
|
}
|
|
475
475
|
console.warn('[cngxMatTabs] aggregator decoration retry ceiling reached ' +
|
|
476
|
-
`(${max} attempts)
|
|
476
|
+
`(${max} attempts) - MatTabHeader did not render ` +
|
|
477
477
|
'`.mat-mdc-tab` buttons within the expected window. Likely ' +
|
|
478
478
|
'cause: Material upgrade broke the `.mat-mdc-tab` selector ' +
|
|
479
479
|
'contract or a consumer-side render stall. ' +
|
|
@@ -532,11 +532,11 @@ function createAggregatedErrorTabs(presenter) {
|
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
/**
|
|
535
|
-
* Default sink
|
|
535
|
+
* Default sink - gated on dev-mode. Production callers see no
|
|
536
536
|
* output; production telemetry lands only when a consumer overrides
|
|
537
537
|
* via `withHalfWiredSlotSink(fn)`.
|
|
538
538
|
*
|
|
539
|
-
* @internal
|
|
539
|
+
* @internal - exported only for {@link CngxMatTabsConfig.halfWiredSlotSink}'s
|
|
540
540
|
* library default. Consumers should override via the config feature
|
|
541
541
|
* rather than reach for this reference directly.
|
|
542
542
|
*/
|
|
@@ -544,7 +544,7 @@ const CNGX_DEFAULT_HALF_WIRED_SLOT_SINK = (missing) => {
|
|
|
544
544
|
if (!isDevMode()) {
|
|
545
545
|
return;
|
|
546
546
|
}
|
|
547
|
-
console.warn('[cngxMatTabs] aggregator-content slot half-wired
|
|
547
|
+
console.warn('[cngxMatTabs] aggregator-content slot half-wired - ' +
|
|
548
548
|
`\`${missing}\` is missing while the other half is supplied. ` +
|
|
549
549
|
'The decoration projector will silently fall back to the ' +
|
|
550
550
|
'imperative `textContent` path, and the consumer-projected ' +
|
|
@@ -775,53 +775,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
775
775
|
}] });
|
|
776
776
|
|
|
777
777
|
/**
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
*
|
|
783
|
-
*
|
|
784
|
-
*
|
|
785
|
-
*
|
|
786
|
-
*
|
|
787
|
-
*
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
778
|
+
* Keep the shared {@link CngxLiveAnnouncer} in sync with the supplied
|
|
779
|
+
* `announcement` signal: an `effect` reads the reactive text and
|
|
780
|
+
* forwards every non-empty value to the root announcer at the
|
|
781
|
+
* configured politeness (default `'polite'`). An empty string between
|
|
782
|
+
* transitions keeps the region quiet on no-op CD ticks.
|
|
783
|
+
*
|
|
784
|
+
* Delegates to {@link CngxLiveAnnouncer} instead of mounting its own
|
|
785
|
+
* body span, so the announcer owns the persistent polite/assertive
|
|
786
|
+
* region pair, the clear-then-set re-announce, and teardown. The
|
|
787
|
+
* delegated region carries `aria-live` + `aria-atomic="true"` and no
|
|
788
|
+
* explicit `role`; `aria-atomic` re-reads full content and `aria-live`
|
|
789
|
+
* carries the politeness, so a tab-change status utterance still reads.
|
|
790
|
+
*
|
|
791
|
+
* The `effect` is created in `opts.injector`'s context, so it is torn
|
|
792
|
+
* down with the host directive; the service call is wrapped in
|
|
793
|
+
* `untracked` - the announcer owns its own clear-then-set timer, so it
|
|
794
|
+
* stays out of the effect's dependency graph.
|
|
795
|
+
*
|
|
796
|
+
* @internal - package-private helper for `[cngxMatTabs]`. Not
|
|
793
797
|
* exported from `public-api.ts`.
|
|
794
798
|
*/
|
|
795
799
|
function mountLiveRegionAnnouncer(opts) {
|
|
796
|
-
const srOnlyClassName = opts.srOnlyClassName ?? 'cngx-sr-only';
|
|
797
800
|
const politeness = opts.politeness ?? 'polite';
|
|
798
|
-
const role = politeness === 'assertive' ? 'alert' : 'status';
|
|
799
|
-
const doc = runInInjectionContext(opts.injector, () => inject(DOCUMENT));
|
|
800
|
-
const liveRegionEl = opts.renderer.createElement('span');
|
|
801
|
-
opts.renderer.addClass(liveRegionEl, srOnlyClassName);
|
|
802
|
-
opts.renderer.setAttribute(liveRegionEl, 'aria-live', politeness);
|
|
803
|
-
opts.renderer.setAttribute(liveRegionEl, 'aria-atomic', 'true');
|
|
804
|
-
opts.renderer.setAttribute(liveRegionEl, 'aria-relevant', 'additions text');
|
|
805
|
-
opts.renderer.setAttribute(liveRegionEl, 'role', role);
|
|
806
|
-
opts.renderer.appendChild(doc.body, liveRegionEl);
|
|
807
801
|
runInInjectionContext(opts.injector, () => {
|
|
802
|
+
const announcer = inject(CngxLiveAnnouncer);
|
|
808
803
|
effect(() => {
|
|
809
804
|
const text = opts.announcement();
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
}
|
|
805
|
+
if (!text) {
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
untracked(() => announcer.announce(text, politeness));
|
|
813
809
|
});
|
|
814
810
|
});
|
|
815
|
-
opts.destroyRef.onDestroy(() => {
|
|
816
|
-
opts.renderer.removeChild(doc.body, liveRegionEl);
|
|
817
|
-
});
|
|
818
811
|
}
|
|
819
812
|
|
|
820
813
|
/**
|
|
821
814
|
* Build the {@link CngxMatTabRejectionState} bundle for a given
|
|
822
815
|
* presenter + i18n pair. Two computeds share one source-walk
|
|
823
816
|
* (`lastFailedIndex` → `originIndexDuringCommit` → `tabs[idx].label()`)
|
|
824
|
-
* via Angular's signal memoisation
|
|
817
|
+
* via Angular's signal memoisation - the second computed re-uses
|
|
825
818
|
* the first's cached `originLabel` value, so the `tabs()` traversal
|
|
826
819
|
* happens at most once per state change.
|
|
827
820
|
*
|
|
@@ -1099,7 +1092,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1099
1092
|
*
|
|
1100
1093
|
* `resolveStripRoot` walks from host up to `<mat-tab-header>` and
|
|
1101
1094
|
* locates `.mat-mdc-tab-label-container` via any rendered
|
|
1102
|
-
* `.mat-mdc-tab` descendant
|
|
1095
|
+
* `.mat-mdc-tab` descendant - Material's IO-friendly scroll
|
|
1103
1096
|
* container.
|
|
1104
1097
|
*
|
|
1105
1098
|
* `resolveTabButton` indexes positionally; Material owns the DOM
|
|
@@ -1124,7 +1117,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1124
1117
|
function createCngxMatTabOverflowDomAdapter() {
|
|
1125
1118
|
return {
|
|
1126
1119
|
resolveStripRoot(_panelHost, host) {
|
|
1127
|
-
// Returning null is a retry signal
|
|
1120
|
+
// Returning null is a retry signal - the rAF loop polls again
|
|
1128
1121
|
// on the next frame, succeeds once MatTabHeader has committed.
|
|
1129
1122
|
const header = host.closest(MaterialPrivateSurfaces.MAT_MDC_TAB_HEADER_SELECTOR);
|
|
1130
1123
|
const anyTab = header?.querySelector(MaterialPrivateSurfaces.MAT_MDC_TAB_SELECTOR);
|
|
@@ -1197,6 +1190,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1197
1190
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs.directive.ts
|
|
1198
1191
|
* @since 0.1.0
|
|
1199
1192
|
* @relatedTo CngxMatTabsRegistry, CngxMatTabError, CngxMatStepper
|
|
1193
|
+
* @slot cngxMatTabAggregatorContent Replaces the aggregated error summary projected into a Material tab.
|
|
1194
|
+
* @slot cngxMatTabRejectionContent Replaces the rejection notice on a rolled-back Material tab.
|
|
1200
1195
|
*/
|
|
1201
1196
|
class CngxMatTabs {
|
|
1202
1197
|
matTabGroup = inject(MatTabGroup, { self: true });
|
|
@@ -1250,9 +1245,7 @@ class CngxMatTabs {
|
|
|
1250
1245
|
// bindings imperatively.
|
|
1251
1246
|
mountLiveRegionAnnouncer({
|
|
1252
1247
|
announcement: this.rejectionState.liveAnnouncement,
|
|
1253
|
-
renderer: this.renderer,
|
|
1254
1248
|
injector: this.injector,
|
|
1255
|
-
destroyRef: this.destroyRef,
|
|
1256
1249
|
});
|
|
1257
1250
|
// Decoration projectors own DOM-mutation state plus `effect()`
|
|
1258
1251
|
// registration; the directive only supplies reactive triggers.
|
|
@@ -1472,9 +1465,7 @@ class CngxMatTabNav {
|
|
|
1472
1465
|
constructor() {
|
|
1473
1466
|
mountLiveRegionAnnouncer({
|
|
1474
1467
|
announcement: this.rejectionState.liveAnnouncement,
|
|
1475
|
-
renderer: this.renderer,
|
|
1476
1468
|
injector: this.injector,
|
|
1477
|
-
destroyRef: this.destroyRef,
|
|
1478
1469
|
});
|
|
1479
1470
|
// Same projector bodies as `[cngxMatTabs]`; only the per-tab element
|
|
1480
1471
|
// selector differs (`.mat-mdc-tab-link` vs `.mat-mdc-tab`).
|
|
@@ -1507,7 +1498,7 @@ class CngxMatTabNav {
|
|
|
1507
1498
|
this.presenter.clearLastFailed();
|
|
1508
1499
|
}
|
|
1509
1500
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabNav, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1510
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxMatTabNav, isStandalone: true, selector: "[cngxMatTabNav]", exportAs: ["cngxMatTabNav"], hostDirectives: [{ directive: i1.CngxTabGroupPresenter }], ngImport: i0 });
|
|
1501
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxMatTabNav, isStandalone: true, selector: "[cngxMatTabNav]", providers: [{ provide: CNGX_TAB_NAV_HOST, useValue: true }], exportAs: ["cngxMatTabNav"], hostDirectives: [{ directive: i1.CngxTabGroupPresenter }], ngImport: i0 });
|
|
1511
1502
|
}
|
|
1512
1503
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabNav, decorators: [{
|
|
1513
1504
|
type: Directive,
|
|
@@ -1515,6 +1506,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1515
1506
|
selector: '[cngxMatTabNav]',
|
|
1516
1507
|
exportAs: 'cngxMatTabNav',
|
|
1517
1508
|
standalone: true,
|
|
1509
|
+
// Presence-only marker: it tells a stacked [cngxTabsRouteSync] that its
|
|
1510
|
+
// links own subtrees, so the URL match is prefix rather than suffix.
|
|
1511
|
+
providers: [{ provide: CNGX_TAB_NAV_HOST, useValue: true }],
|
|
1518
1512
|
hostDirectives: [CngxTabGroupPresenter],
|
|
1519
1513
|
}]
|
|
1520
1514
|
}], ctorParameters: () => [] });
|