@cngx/ui 0.0.1-rc.0 → 0.1.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +22 -48
  2. package/action-button/README.md +9 -11
  3. package/empty-state/README.md +11 -26
  4. package/feedback/README.md +3 -3
  5. package/fesm2022/cngx-ui-action-button.mjs +30 -26
  6. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  7. package/fesm2022/cngx-ui-empty-state.mjs +26 -21
  8. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  9. package/fesm2022/cngx-ui-feedback.mjs +498 -261
  10. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  11. package/fesm2022/cngx-ui-layout.mjs +32 -5
  12. package/fesm2022/cngx-ui-layout.mjs.map +1 -1
  13. package/fesm2022/cngx-ui-mat-stepper.mjs +119 -297
  14. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
  15. package/fesm2022/cngx-ui-mat-tabs.mjs +455 -120
  16. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  17. package/fesm2022/cngx-ui-material.mjs +14 -3
  18. package/fesm2022/cngx-ui-material.mjs.map +1 -1
  19. package/fesm2022/cngx-ui-overlay.mjs +22 -3
  20. package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
  21. package/fesm2022/cngx-ui-sidenav.mjs +107 -28
  22. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  23. package/fesm2022/cngx-ui-skeleton.mjs +61 -20
  24. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  25. package/fesm2022/cngx-ui-speak.mjs +14 -5
  26. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  27. package/fesm2022/cngx-ui-stepper.mjs +659 -163
  28. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  29. package/fesm2022/cngx-ui-tabs.mjs +306 -55
  30. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  31. package/fesm2022/cngx-ui.mjs +2 -1
  32. package/fesm2022/cngx-ui.mjs.map +1 -1
  33. package/layout/README.md +9 -44
  34. package/mat-stepper/README.md +37 -17
  35. package/mat-tabs/README.md +13 -13
  36. package/mat-tabs/styles/mat-tabs.css +357 -213
  37. package/material/README.md +19 -19
  38. package/overlay/README.md +11 -11
  39. package/package.json +7 -6
  40. package/sidenav/README.md +4 -19
  41. package/skeleton/README.md +3 -17
  42. package/speak/README.md +15 -15
  43. package/stepper/README.md +213 -5
  44. package/tabs/README.md +22 -4
  45. package/theming/system-tokens.css +29 -0
  46. package/types/cngx-ui-action-button.d.ts +28 -13
  47. package/types/cngx-ui-empty-state.d.ts +21 -9
  48. package/types/cngx-ui-feedback.d.ts +437 -121
  49. package/types/cngx-ui-layout.d.ts +38 -8
  50. package/types/cngx-ui-mat-stepper.d.ts +100 -134
  51. package/types/cngx-ui-mat-tabs.d.ts +291 -84
  52. package/types/cngx-ui-material.d.ts +12 -1
  53. package/types/cngx-ui-overlay.d.ts +25 -4
  54. package/types/cngx-ui-sidenav.d.ts +106 -12
  55. package/types/cngx-ui-skeleton.d.ts +62 -8
  56. package/types/cngx-ui-speak.d.ts +10 -2
  57. package/types/cngx-ui-stepper.d.ts +390 -57
  58. package/types/cngx-ui-tabs.d.ts +182 -18
  59. package/types/cngx-ui.d.ts +1 -0
  60. package/speak/speak-button-theme.scss +0 -78
@@ -1,41 +1,33 @@
1
- import * as i2 from '@angular/common';
2
- import { CommonModule } from '@angular/common';
3
1
  import * as i0 from '@angular/core';
4
- import { inject, DestroyRef, Injector, viewChild, ChangeDetectorRef, contentChildren, computed, effect, untracked, afterNextRender, ChangeDetectionStrategy, Component, signal, InjectionToken, Directive } from '@angular/core';
5
- import * as i3 from '@angular/material/stepper';
6
- import { MatStepper, MatStepperIcon, MatStepperModule, MatStep } from '@angular/material/stepper';
2
+ import { signal, computed, InjectionToken, inject, DestroyRef, Injector, contentChildren, effect, untracked, Directive } from '@angular/core';
3
+ import { MatStepper, MatStep } from '@angular/material/stepper';
7
4
  import * as i1 from '@cngx/common/stepper';
8
- import { CNGX_STEPPER_HOST, CngxStep, flatStepsEqual, CNGX_STEP_PANEL_HOST, CngxStepperPresenter } from '@cngx/common/stepper';
9
- import { createMaterialBidirectionalSync } from '@cngx/common/data';
10
- import { CNGX_DIRECTIVE_BY_ID_MAP_FACTORY } from '@cngx/common/tabs';
5
+ import { CNGX_STEPPER_HOST, CngxStepperPresenter } from '@cngx/common/stepper';
11
6
  import { nextUid } from '@cngx/core/utils';
7
+ import { createMaterialBidirectionalSync } from '@cngx/common/data';
12
8
 
13
9
  /**
14
10
  * Stepper-specific glue over {@link createMaterialBidirectionalSync}
15
11
  * (`@cngx/common/data`). Both `<cngx-mat-stepper>` (Component) and
16
12
  * `[cngxMatStepper]` (Directive) need to install the same
17
13
  * presenter↔Material `selectedIndex` sync; the option-mapping body
18
- * was identical at both call sites — same `presenterIndex`, same
14
+ * was identical at both call sites - same `presenterIndex`, same
19
15
  * `readSelectedIndex` / `writeSelectedIndex` shape, same
20
16
  * `selectedIndexChange.asObservable()` source, same
21
17
  * `onMaterialSelection` write-back. This helper is the single entry
22
18
  * point: each call site reduces to one line.
23
19
  *
24
- * Behaviour stays identical to the prior inline blocks — the helper
20
+ * Behaviour stays identical to the prior inline blocks - the helper
25
21
  * is a pure shape-adapter, no policy. The underlying generic factory
26
22
  * owns:
27
23
  * - presenter→Material `effect()` with read-equality guard.
28
24
  * - Material→presenter subscription with re-entrancy guard.
29
- * - Material-eager-advance reconciliation
30
- * (`tabs-accepted-debt §6` closure path; same code path applies
31
- * here because Material's MDC click handler advances
32
- * `selectedIndex` synchronously before the bidirectional sync sees
33
- * the event).
25
+ * - Material-eager-advance reconciliation (Material's MDC click
26
+ * handler advances `selectedIndex` synchronously before the
27
+ * bidirectional sync sees the event).
34
28
  * - `destroyRef` cleanup of both directions.
35
29
  *
36
- * Phase 7.2 of `mat-stepper-mat-tabs-hardening-plan` extracted this
37
- * helper to close E-C12 + E-C13 (duplicated bidirectional-sync glue
38
- * between the wrapper component and the instrumentation directive).
30
+ * @internal
39
31
  */
40
32
  function createMatStepperBidirectionalSync(opts) {
41
33
  createMaterialBidirectionalSync({
@@ -44,10 +36,8 @@ function createMatStepperBidirectionalSync(opts) {
44
36
  writeSelectedIndex: (i) => {
45
37
  opts.matStepper.selectedIndex = i;
46
38
  },
47
- // `MatStepper.selectedIndexChange` already emits a plain index,
48
- // so no `.pipe(map(e => e.selectedIndex))` adapter is needed —
49
- // mirrors the `MatTabGroup.selectedIndexChange` shape used by
50
- // `[cngxMatTabs]`.
39
+ // `MatStepper.selectedIndexChange` emits a plain index - no adapter needed,
40
+ // unlike `MatTabGroup.selectedIndexChange`.
51
41
  selectionChange$: opts.matStepper.selectedIndexChange.asObservable(),
52
42
  onMaterialSelection: (i) => opts.presenter.select(i),
53
43
  injector: opts.injector,
@@ -55,218 +45,12 @@ function createMatStepperBidirectionalSync(opts) {
55
45
  });
56
46
  }
57
47
 
58
- /**
59
- * Material-twin stepper organism. Wraps `<mat-stepper>` and shares
60
- * the `CngxStepperPresenter` brain with `<cngx-stepper>` — Material
61
- * consumers gain the commit-action lifecycle, router sync, and error
62
- * aggregation.
63
- *
64
- * Bidirectional sync between presenter and `MatStepper.selectedIndex`
65
- * runs in a single `effect()` with `untracked()` writes so neither
66
- * direction tracks the other.
67
- *
68
- * Material owns keyboard nav and focus on `MatStepperHeader`, so the
69
- * organism does NOT compose `CngxRovingTabindex` /
70
- * `CngxFocusRestore`. Group nodes flatten — `<mat-stepper>` does not
71
- * support nesting — with the depth preserved as a `data-step-depth`
72
- * hint on the rendered label.
73
- */
74
- class CngxMatStepper {
75
- presenter = inject(CNGX_STEPPER_HOST);
76
- destroyRef = inject(DestroyRef);
77
- injector = inject(Injector);
78
- matStepper = viewChild.required(MatStepper);
79
- // Host CD nudge after the `_iconOverrides` patch — Material reads
80
- // the map into per-header `[iconOverrides]` bindings on the next
81
- // CD pass, so the patch only takes effect once we mark the host
82
- // view dirty.
83
- hostCdr = inject(ChangeDetectorRef);
84
- flatSteps = this.presenter.flatSteps;
85
- activeStepIndex = this.presenter.activeStepIndex;
86
- activeStepId = this.presenter.activeStepId;
87
- stepDirectives = contentChildren(CngxStep, { ...(ngDevMode ? { debugName: "stepDirectives" } : /* istanbul ignore next */ {}), descendants: true });
88
- /**
89
- * Consumer-projected `<ng-template matStepperIcon>` templates,
90
- * forwarded into `MatStepper._iconOverrides` from the
91
- * `afterNextRender` patch below. `<ng-content>` projection cannot
92
- * reach Material's `@ContentChildren(MatStepperIcon)` — content-init
93
- * resolves the inner query before the wrapper's projection lands.
94
- * `_iconOverrides` is a Material-internal slot;
95
- * `tabs-accepted-debt §5`.
96
- */
97
- stepperIcons = contentChildren(MatStepperIcon, ...(ngDevMode ? [{ debugName: "stepperIcons" }] : /* istanbul ignore next */ []));
98
- /**
99
- * `Map<id, CngxStep>` so `labelTemplateFor` / `contentTemplateFor`
100
- * are O(1). Structural `equal` on the id-set + per-id directive
101
- * identity stops the map from cascading on shape-stable
102
- * `contentChildren` re-emits.
103
- */
104
- stepDirectiveById = inject(CNGX_DIRECTIVE_BY_ID_MAP_FACTORY)({
105
- source: this.stepDirectives,
106
- });
107
- /**
108
- * Step-only flat projection — `<mat-step>` does not nest, so
109
- * groups collapse into the same level. Memoised via
110
- * `flatStepsEqual` so consumers (`stepLabel`, panel `@for`,
111
- * `stepLabelContextFor`) don't re-walk on shape-stable
112
- * `flatSteps()` re-emits. Sibling-symmetric with
113
- * `CngxStepper.stepsOnly`.
114
- */
115
- stepsOnly = computed(() => this.presenter.flatSteps().filter((n) => n.kind === 'step'), { ...(ngDevMode ? { debugName: "stepsOnly" } : /* istanbul ignore next */ {}), equal: flatStepsEqual });
116
- /** Material orientation literal — narrows our `'horizontal'|'vertical'` to its own union. */
117
- matOrientation = computed(() => (this.presenter.orientation() === 'vertical' ? 'vertical' : 'horizontal'), ...(ngDevMode ? [{ debugName: "matOrientation" }] : /* istanbul ignore next */ []));
118
- stepIndexOf(node) {
119
- return node.flatIndex;
120
- }
121
- /** Editability rule — non-linear lets every step click; linear only past completed. */
122
- isEditable(node) {
123
- return !this.presenter.linear() || node.state() === 'success';
124
- }
125
- hasError(node) {
126
- return node.state() === 'error';
127
- }
128
- isCompleted(node) {
129
- return node.state() === 'success';
130
- }
131
- stepLabel(node) {
132
- return node.label();
133
- }
134
- /** Group nodes carry a depth marker so the label can distinguish nested rows. */
135
- stepDepth(node) {
136
- return node.depth;
137
- }
138
- // Material twin honours only `*cngxStepLabel` / `*cngxStepContent`
139
- // — the six other cngx slot directives are silently dropped because
140
- // Material owns the indicator/badge/busy chrome. The override path
141
- // is `<ng-template matStepperIcon>`. stepper-accepted-debt §4.
142
- labelTemplateFor(id) {
143
- return this.stepDirectiveById().get(id)?.labelTemplate()?.templateRef ?? null;
144
- }
145
- contentTemplateFor(id) {
146
- return this.stepDirectiveById().get(id)?.contentTemplate()?.templateRef ?? null;
147
- }
148
- /**
149
- * Per-node-id slot-context cache for `*cngxStepLabel` /
150
- * `*cngxStepContent`. Mutating fields in place preserves the
151
- * object reference, so `*ngTemplateOutlet`'s `Object.is` diff
152
- * short-circuits the embedded-view rebind; the embedded view's
153
- * `let-` bindings re-read the mutated fields on the next CD pass.
154
- * Stale ids are pruned by the constructor effect tied to
155
- * `presenter.flatSteps`.
156
- */
157
- stepLabelContextCache = new Map();
158
- /** Build the {@link CngxStepLabelContext} for the projected label template. */
159
- stepLabelContextFor(node) {
160
- const flatStep = node.flatIndex;
161
- const active = node.id === this.presenter.activeStepId();
162
- const busy = this.presenter.commitState.status() === 'pending' &&
163
- this.presenter.intendedStepIndex() === flatStep;
164
- const disabled = node.disabled();
165
- const existing = this.stepLabelContextCache.get(node.id);
166
- if (!existing) {
167
- const fresh = {
168
- node,
169
- index: flatStep + 1,
170
- active,
171
- busy,
172
- disabled,
173
- };
174
- this.stepLabelContextCache.set(node.id, fresh);
175
- return fresh;
176
- }
177
- // Mutate cached fields in place. `readonly` is a TS-only annotation;
178
- // the cast removes it for the assignment without affecting the
179
- // public consumer surface.
180
- const mutable = existing;
181
- mutable.node = node;
182
- mutable.index = flatStep + 1;
183
- mutable.active = active;
184
- mutable.busy = busy;
185
- mutable.disabled = disabled;
186
- return existing;
187
- }
188
- /** Build the {@link CngxStepContentContext} for the projected content template. */
189
- stepContentContextFor(node) {
190
- return this.stepLabelContextFor(node);
191
- }
192
- constructor() {
193
- // Prune stale `stepLabelContextCache` entries when the flat-step
194
- // set changes shape — without this, removed node-ids leak their
195
- // entries forever.
196
- effect(() => {
197
- const flat = this.presenter.flatSteps();
198
- untracked(() => {
199
- const liveIds = new Set();
200
- for (const n of flat) {
201
- liveIds.add(n.id);
202
- }
203
- for (const id of Array.from(this.stepLabelContextCache.keys())) {
204
- if (!liveIds.has(id)) {
205
- this.stepLabelContextCache.delete(id);
206
- }
207
- }
208
- });
209
- });
210
- // `afterNextRender` — `viewChild.required(MatStepper)` isn't
211
- // resolved until the view commits.
212
- afterNextRender(() => {
213
- const stepper = this.matStepper();
214
- createMatStepperBidirectionalSync({
215
- matStepper: stepper,
216
- presenter: this.presenter,
217
- injector: this.injector,
218
- destroyRef: this.destroyRef,
219
- });
220
- // Forward consumer-projected `<ng-template matStepperIcon>` into
221
- // `MatStepper._iconOverrides`. Direct `<ng-content>` projection
222
- // never reaches Material's `@ContentChildren(MatStepperIcon)` —
223
- // content-init resolves the inner queries before the wrapper's
224
- // projection lands. Underscore reach typed via
225
- // `MaterialPrivateSurfaces.IconOverrideHost`; tabs-accepted-debt §5.
226
- // Dev-mode guard surfaces a Material rename/removal early.
227
- const stepperRef = stepper;
228
- const iconList = this.stepperIcons();
229
- if (!stepperRef._iconOverrides) {
230
- if (typeof ngDevMode !== 'undefined' && ngDevMode && iconList.length) {
231
- console.warn('[CngxMatStepper] MatStepper._iconOverrides is missing — ' +
232
- 'consumer-projected <ng-template matStepperIcon> templates ' +
233
- 'will not flow through to Material. Likely cause: a ' +
234
- 'Material upgrade renamed or removed the internal slot. ' +
235
- 'See stepper-accepted-debt §4 for the closure mechanism.');
236
- }
237
- return;
238
- }
239
- for (const icon of iconList) {
240
- stepperRef._iconOverrides[icon.name] = icon.templateRef;
241
- }
242
- // Material reads `_iconOverrides` into per-header bindings on
243
- // the next CD pass — mark the host view dirty so Angular
244
- // re-runs CD over `<mat-stepper>` and the patched map flows
245
- // through. Touching `selectedIndex` would echo through
246
- // `createMaterialBidirectionalSync`; `markForCheck` does not.
247
- this.hostCdr.markForCheck();
248
- });
249
- }
250
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatStepper, deps: [], target: i0.ɵɵFactoryTarget.Component });
251
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxMatStepper, isStandalone: true, selector: "cngx-mat-stepper", providers: [{ provide: CNGX_STEP_PANEL_HOST, useExisting: CngxMatStepper }], queries: [{ propertyName: "stepDirectives", predicate: CngxStep, descendants: true, isSignal: true }, { propertyName: "stepperIcons", predicate: MatStepperIcon, isSignal: true }], viewQueries: [{ propertyName: "matStepper", first: true, predicate: MatStepper, descendants: true, isSignal: true }], exportAs: ["cngxMatStepper"], hostDirectives: [{ directive: i1.CngxStepperPresenter, inputs: ["activeStepIndex", "activeStepIndex", "linear", "linear", "orientation", "orientation", "commitAction", "commitAction", "commitMode", "commitMode"], outputs: ["activeStepIndexChange", "activeStepIndexChange"] }], ngImport: i0, template: "<mat-stepper\n [orientation]=\"matOrientation()\"\n [linear]=\"presenter.linear()\"\n>\n @for (node of stepsOnly(); track node.id) {\n <mat-step\n [completed]=\"isCompleted(node)\"\n [hasError]=\"hasError(node)\"\n [editable]=\"isEditable(node)\"\n >\n <ng-template matStepLabel>\n @let labelTpl = labelTemplateFor(node.id);\n @if (labelTpl) {\n <ng-container\n *ngTemplateOutlet=\"labelTpl; context: stepLabelContextFor(node)\"\n ></ng-container>\n } @else {\n <span [attr.data-step-depth]=\"stepDepth(node)\">{{ stepLabel(node) }}</span>\n }\n </ng-template>\n @let contentTpl = contentTemplateFor(node.id);\n @if (contentTpl) {\n <ng-container\n *ngTemplateOutlet=\"contentTpl; context: stepContentContextFor(node)\"\n ></ng-container>\n }\n </mat-step>\n }\n</mat-stepper>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatStepperModule }, { kind: "component", type: i3.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "directive", type: i3.MatStepLabel, selector: "[matStepLabel]" }, { kind: "component", type: i3.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["disableRipple", "color", "labelPosition", "headerPosition", "headerPrefix", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
252
- }
253
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatStepper, decorators: [{
254
- type: Component,
255
- args: [{ selector: 'cngx-mat-stepper', exportAs: 'cngxMatStepper', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, MatStepperModule], hostDirectives: [
256
- {
257
- directive: CngxStepperPresenter,
258
- inputs: ['activeStepIndex', 'linear', 'orientation', 'commitAction', 'commitMode'],
259
- outputs: ['activeStepIndexChange'],
260
- },
261
- ], providers: [{ provide: CNGX_STEP_PANEL_HOST, useExisting: CngxMatStepper }], template: "<mat-stepper\n [orientation]=\"matOrientation()\"\n [linear]=\"presenter.linear()\"\n>\n @for (node of stepsOnly(); track node.id) {\n <mat-step\n [completed]=\"isCompleted(node)\"\n [hasError]=\"hasError(node)\"\n [editable]=\"isEditable(node)\"\n >\n <ng-template matStepLabel>\n @let labelTpl = labelTemplateFor(node.id);\n @if (labelTpl) {\n <ng-container\n *ngTemplateOutlet=\"labelTpl; context: stepLabelContextFor(node)\"\n ></ng-container>\n } @else {\n <span [attr.data-step-depth]=\"stepDepth(node)\">{{ stepLabel(node) }}</span>\n }\n </ng-template>\n @let contentTpl = contentTemplateFor(node.id);\n @if (contentTpl) {\n <ng-container\n *ngTemplateOutlet=\"contentTpl; context: stepContentContextFor(node)\"\n ></ng-container>\n }\n </mat-step>\n }\n</mat-stepper>\n" }]
262
- }], ctorParameters: () => [], propDecorators: { matStepper: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatStepper), { isSignal: true }] }], stepDirectives: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxStep), { ...{ descendants: true }, isSignal: true }] }], stepperIcons: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => MatStepperIcon), { isSignal: true }] }] } });
263
-
264
48
  /**
265
49
  * Shared `signal(undefined)` constant used as the `errorAggregator`
266
50
  * slot for every Material-instrumented step handle. The
267
51
  * instrumentation path does not bind cngx error-aggregation per
268
- * `MatStep` — Material's own visual error surface (driven by
269
- * `MatStep.hasError` / `MatStep.optional`) stays authoritative — so
52
+ * `MatStep` - Material's own visual error surface (driven by
53
+ * `MatStep.hasError` / `MatStep.optional`) stays authoritative - so
270
54
  * per-step allocation of a writable signal would be dead capacity.
271
55
  *
272
56
  * @internal
@@ -276,7 +60,7 @@ const NO_ERROR_AGGREGATOR = signal(undefined).asReadonly();
276
60
  * Best-effort static-text extraction from a `<ng-template matStepLabel>`
277
61
  * `TemplateRef`. Used as a label fallback when consumers project a
278
62
  * template label without setting `MatStep.label` or
279
- * `MatStep.ariaLabel` — without it the cngx-side label slot would
63
+ * `MatStep.ariaLabel` - without it the cngx-side label slot would
280
64
  * be empty, leaving aria-label phrases that include the step label
281
65
  * with a measurable gap on the Material variant. Static markup
282
66
  * (`<ng-template matStepLabel>Review</ng-template>`) extracts cleanly
@@ -312,59 +96,55 @@ function readMatStepLabelTemplateText(template) {
312
96
  * Translates a Material `MatStep` into a cngx
313
97
  * {@link CngxStepRegistration}.
314
98
  *
315
- * - `id` — always a fresh `idSeed()` value. Mirrors the tabs
99
+ * - `id` - always a fresh `idSeed()` value. Mirrors the tabs
316
100
  * instrumentation handle: a label-keyed id would collide when
317
101
  * two steps share a label.
318
- * - `kind` — fixed at `'step'`. The instrumentation path does not
102
+ * - `kind` - fixed at `'step'`. The instrumentation path does not
319
103
  * project nested `<mat-step>` groups (Material's stepper has no
320
104
  * group-of-steps concept; group-aware semantics belong to the
321
105
  * `<cngx-stepper>` thin-wrapper organism).
322
- * - `label` — snapshot signal resolved through a four-tier fallback at
106
+ * - `label` - snapshot signal resolved through a four-tier fallback at
323
107
  * registration time so cngx-side phrases (announcements,
324
108
  * `aria-label` composition, telemetry) never read empty when
325
109
  * Material consumers project a `<ng-template matStepLabel>`:
326
- * 1. `MatStep.label` when it is a plain string — the canonical
110
+ * 1. `MatStep.label` when it is a plain string - the canonical
327
111
  * shape and the only one that emits a runtime change Material
328
112
  * itself observes.
329
- * 2. `MatStep.ariaLabel` when the consumer set the input —
113
+ * 2. `MatStep.ariaLabel` when the consumer set the input -
330
114
  * designed exactly as the substitute for template labels.
331
115
  * 3. Static-text read from `MatStep.stepLabel.template` via a
332
116
  * throwaway detached `EmbeddedViewRef` ({@link readMatStepLabelTemplateText}).
333
117
  * Captures literal `matStepLabel` markup; dynamic interpolation
334
118
  * bails through to (4).
335
- * 4. `Step <id>` — deterministic, derived from the cngx handle
119
+ * 4. `Step <id>` - deterministic, derived from the cngx handle
336
120
  * id. Always non-empty.
337
- * Phase-2 limitation: runtime label changes do not propagate. CDK's
338
- * `CdkStep` does not expose a `_stateChanges` Subject analogous to
339
- * `MatTab._stateChanges`, so cngx cannot re-trigger the snapshot
340
- * when Material flips the input later. Tracked under
341
- * `stepper-accepted-debt §4` alongside the matStepperIcon
342
- * forwarding limitations — both surface the same Material-internal
343
- * coupling family typed in
344
- * `MaterialPrivateSurfaces.CompletedOverrideSource` (see Phase 6.1).
345
- * - `disabled` — fixed `false`. Material owns step gating via
121
+ * Documented limitation: runtime label changes do not propagate.
122
+ * CDK's `CdkStep` does not expose a `_stateChanges` Subject
123
+ * analogous to `MatTab._stateChanges`, so cngx cannot re-trigger
124
+ * the snapshot when Material flips the input later. Surface the
125
+ * same Material-internal coupling family typed in
126
+ * `MaterialPrivateSurfaces.CompletedOverrideSource`.
127
+ * - `disabled` - fixed `false`. Material owns step gating via
346
128
  * `linear` + `editable` + `completed`; surfacing a cngx-side
347
129
  * `disabled` would duplicate Material's own click-time enforcement
348
130
  * and is ignored by `<mat-stepper>` itself.
349
- * - `state` — `computed()` over `MatStep.hasError` / `MatStep.completed`.
350
- * `CdkStep.completed`'s getter reads `_completedOverride()` — a
131
+ * - `state` - `computed()` over `MatStep.hasError` / `MatStep.completed`.
132
+ * `CdkStep.completed`'s getter reads `_completedOverride()` - a
351
133
  * `WritableSignal<boolean | null>` typed in
352
134
  * `MaterialPrivateSurfaces.CompletedOverrideSource`. The cngx
353
135
  * computed transitively tracks that signal through the getter and
354
136
  * re-fires whenever Material flips completion. `hasError` is a
355
- * plain property setter on `CdkStep`, NOT a Signal — a `hasError`
137
+ * plain property setter on `CdkStep`, NOT a Signal - a `hasError`
356
138
  * write that is not paired with a `completed` change does not
357
139
  * re-trigger this computed. In practice Material wizards write the
358
140
  * two together (`step.hasError = true; step.completed = false` in
359
141
  * error-handler patterns and inside Material's own error-state
360
142
  * matchers) so the limitation is benign for the documented usage
361
- * pattern. Tracked under `stepper-accepted-debt §4` as the
362
- * `_completedOverride` re-fire contract; the Re-Eval Trigger fires
363
- * when Material exposes a public `_stateChanges`-equivalent Subject
364
- * on `CdkStep` OR a consumer issue confirms an unpaired-`hasError`
365
- * write reaches production.
366
- * - `errorAggregator` — points at the shared
143
+ * pattern.
144
+ * - `errorAggregator` - points at the shared
367
145
  * {@link NO_ERROR_AGGREGATOR} constant.
146
+ *
147
+ * @category ui/mat-stepper
368
148
  */
369
149
  function createMatStepHandle(matStep, idSeed) {
370
150
  const id = idSeed();
@@ -422,12 +202,12 @@ function resolveStepLabel(matStep, id) {
422
202
  *
423
203
  * Symmetric with the tabs sibling
424
204
  * `CNGX_MAT_TAB_HANDLE_FACTORY` and with `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY`
425
- * — every Material-bridge logic block ships the same swap surface so
205
+ * - every Material-bridge logic block ships the same swap surface so
426
206
  * consumers can layer telemetry, alternate id strategies, or
427
207
  * test-environment id keying via `providers` / `viewProviders`
428
208
  * without forking the directive.
429
209
  *
430
- * Override capability — the swap surface separates **handle shape**
210
+ * Override capability - the swap surface separates **handle shape**
431
211
  * (factory body) from **id keying** (the supplied `idSeed` closure).
432
212
  * The directive constructs `idSeed` as `() => nextUid('cngx-mat-step-')`
433
213
  * and hands it to the factory as a default suggestion; an override is
@@ -435,9 +215,6 @@ function resolveStepLabel(matStep, id) {
435
215
  * deterministic-test / consumer-domain id strategy. Both axes are
436
216
  * independently swappable from one DI seam.
437
217
  *
438
- * Tracked-debt: ships under family-uniformity staging (single
439
- * in-package consumer today). See `stepper-accepted-debt §7`.
440
- *
441
218
  * ```ts
442
219
  * providers: [
443
220
  * {
@@ -450,6 +227,11 @@ function resolveStepLabel(matStep, id) {
450
227
  * },
451
228
  * ]
452
229
  * ```
230
+ *
231
+ * @category ui/mat-stepper
232
+ * @wcag AA
233
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-stepper/material-bridge/handle.ts
234
+ * @since 0.1.0
453
235
  */
454
236
  const CNGX_MAT_STEP_HANDLE_FACTORY = new InjectionToken('CNGX_MAT_STEP_HANDLE_FACTORY', {
455
237
  providedIn: 'root',
@@ -457,32 +239,78 @@ const CNGX_MAT_STEP_HANDLE_FACTORY = new InjectionToken('CNGX_MAT_STEP_HANDLE_FA
457
239
  });
458
240
 
459
241
  /**
460
- * Attaches to an existing `<mat-stepper>` and bridges it to a
461
- * {@link CngxStepperPresenter} — consumers gain the commit-action
242
+ * The Material twin of the CNGX stepper: attach `cngxMatStepper` to a
243
+ * vanilla `<mat-stepper>` and it is bridged to a
244
+ * {@link CngxStepperPresenter}. \
245
+ * Consumers gain the commit-action
462
246
  * lifecycle, `CNGX_STATEFUL` (so `<cngx-toast-on />` /
463
- * `<cngx-banner-on />` compose as children), and the step-handle
464
- * registry from one attribute.
247
+ * `<cngx-banner-on />` compose as children), the shared
248
+ * `CNGX_STEPPER_HOST` contract (so a `<cngx-stepper-footer>` can drive
249
+ * Back / Next instead of Material's own buttons via
250
+ * `[host]="ref.presenter"`), and the step-handle registry - all from
251
+ * one attribute.
465
252
  *
466
- * Sibling-additive to `<cngx-mat-stepper>` (the thin-wrapper
467
- * organism in `@cngx/ui/mat-stepper`): the wrapper authors fresh
468
- * markup, this directive upgrades existing Material markup.
469
- * `exportAs` differs (`cngxMatStepperDirective`) to avoid colliding
470
- * with the wrapper's `cngxMatStepper`.
253
+ * This is the instrumentation pattern: Material owns the rendering and
254
+ * the consumer authors native `<mat-step>` markup; CNGX is the
255
+ * behaviour layer. Topology mirrors `[cngxMatTabs]`.
471
256
  *
472
- * Topology mirrors `[cngxMatTabs]`: Material is the host, cngx is
473
- * the instrumentation layer. `stepper-accepted-debt §1`'s blocker
474
- * applies to adoption, not this direction.
257
+ * Inputs/outputs are forwarded from {@link CngxStepperPresenter}:
258
+ * - `activeStepIndex` (two-way, with `activeStepIndexChange`),
259
+ * - `linear`,
260
+ * - `orientation`,
261
+ * - `commitAction`,
262
+ * - `commitMode`. \
263
+ * See the presenter for their semantics.
264
+ * ```html
265
+ * <mat-stepper
266
+ * cngxMatStepper
267
+ * #s="cngxMatStepper"
268
+ * [(activeStepIndex)]="active"
269
+ * [commitAction]="commitAction"
270
+ * [commitMode]="mode()"
271
+ * cngxToastOn
272
+ * [toastError]="'Step transition failed'"
273
+ * cngxBannerOn
274
+ * bannerId="stepper:commit-error"
275
+ * [bannerError]="'The server rejected the step change.'"
276
+ * aria-label="Account setup"
277
+ * >
278
+ * <mat-step label="Personal info">
279
+ * <p>Tell us who you are.</p>
280
+ * </mat-step>
281
+ * <mat-step
282
+ * label="Account"
283
+ * [hasError]="!accepted()"
284
+ * errorMessage="Accept the terms to continue"
285
+ * >
286
+ * <p>Choose your sign-in method.</p>
287
+ * </mat-step>
288
+ * <mat-step label="Confirm">
289
+ * <p>Review everything, then finish.</p>
290
+ * </mat-step>
291
+ * </mat-stepper>
292
+ * ```
293
+ * @playground Bridge instrumentation ./examples/bridge/bridge-example.component.ts
294
+ *
295
+ * @category ui/mat-stepper
296
+ * @docsKind primary
297
+ * @wcag AA
298
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-stepper/mat-stepper.directive.ts
299
+ * @since 0.1.0
300
+ * @relatedTo CngxStepper, CngxStepperPresenter, CngxMatTabs, CngxStepperFooter
475
301
  */
476
- class CngxMatStepperBridge {
302
+ class CngxMatStepper {
477
303
  matStepper = inject(MatStepper, { self: true });
304
+ /**
305
+ * Shared host contract. Public so a `<cngx-stepper-footer>` placed
306
+ * outside the `<mat-stepper>` can bind `[host]="ref.presenter"` (via
307
+ * `#ref="cngxMatStepper"`) and drive navigation.
308
+ */
478
309
  presenter = inject(CNGX_STEPPER_HOST);
479
310
  destroyRef = inject(DestroyRef);
480
311
  injector = inject(Injector);
481
312
  matSteps = contentChildren(MatStep, { ...(ngDevMode ? { debugName: "matSteps" } : /* istanbul ignore next */ {}), descendants: true });
482
- // Per-step registry — strong refs are bounded by the directive's
483
- // lifetime; `Map` (not `WeakMap`) so the diff loop in
484
- // `syncHandles` can iterate to find removed steps without a
485
- // parallel `Set<MatStep>`.
313
+ // Map not WeakMap - syncHandles needs to iterate to find removed steps.
486
314
  setupsByStep = new Map();
487
315
  createHandle = inject(CNGX_MAT_STEP_HANDLE_FACTORY);
488
316
  constructor() {
@@ -505,8 +333,7 @@ class CngxMatStepperBridge {
505
333
  }
506
334
  syncHandles(steps) {
507
335
  const liveSteps = new Set(steps);
508
- // Add: only fresh MatSteps get a setup + handle registration.
509
- // Cached MatSteps survive untouched — no register-churn.
336
+ // Only fresh MatSteps get registered; cached ones survive untouched.
510
337
  for (const step of steps) {
511
338
  if (this.setupsByStep.has(step)) {
512
339
  continue;
@@ -515,8 +342,7 @@ class CngxMatStepperBridge {
515
342
  this.setupsByStep.set(step, setup);
516
343
  this.presenter.register(setup.handle);
517
344
  }
518
- // Snapshot before iterating — defends against future edits that
519
- // introduce non-current-key deletes inside the body.
345
+ // Snapshot before iterating - guards against non-current-key deletes inside the body.
520
346
  for (const [step, setup] of Array.from(this.setupsByStep.entries())) {
521
347
  if (liveSteps.has(step)) {
522
348
  continue;
@@ -525,25 +351,19 @@ class CngxMatStepperBridge {
525
351
  this.presenter.unregister(setup.handle.id);
526
352
  }
527
353
  }
528
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatStepperBridge, deps: [], target: i0.ɵɵFactoryTarget.Directive });
529
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.4", type: CngxMatStepperBridge, isStandalone: true, selector: "[cngxMatStepper]", queries: [{ propertyName: "matSteps", predicate: MatStep, descendants: true, isSignal: true }], exportAs: ["cngxMatStepperDirective"], hostDirectives: [{ directive: i1.CngxStepperPresenter, inputs: ["activeStepIndex", "activeStepIndex", "linear", "linear", "orientation", "orientation", "commitAction", "commitAction", "commitMode", "commitMode"], outputs: ["activeStepIndexChange", "activeStepIndexChange"] }], ngImport: i0 });
354
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatStepper, deps: [], target: i0.ɵɵFactoryTarget.Directive });
355
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.4", type: CngxMatStepper, isStandalone: true, selector: "[cngxMatStepper]", queries: [{ propertyName: "matSteps", predicate: MatStep, descendants: true, isSignal: true }], exportAs: ["cngxMatStepper"], hostDirectives: [{ directive: i1.CngxStepperPresenter, inputs: ["activeStepIndex", "activeStepIndex", "linear", "linear", "orientation", "orientation", "commitAction", "commitAction", "commitMode", "commitMode"], outputs: ["activeStepIndexChange", "activeStepIndexChange"] }], ngImport: i0 });
530
356
  }
531
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatStepperBridge, decorators: [{
357
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatStepper, decorators: [{
532
358
  type: Directive,
533
359
  args: [{
534
360
  selector: '[cngxMatStepper]',
535
- exportAs: 'cngxMatStepperDirective',
361
+ exportAs: 'cngxMatStepper',
536
362
  standalone: true,
537
363
  hostDirectives: [
538
364
  {
539
365
  directive: CngxStepperPresenter,
540
- inputs: [
541
- 'activeStepIndex',
542
- 'linear',
543
- 'orientation',
544
- 'commitAction',
545
- 'commitMode',
546
- ],
366
+ inputs: ['activeStepIndex', 'linear', 'orientation', 'commitAction', 'commitMode'],
547
367
  outputs: ['activeStepIndexChange'],
548
368
  },
549
369
  ],
@@ -553,15 +373,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
553
373
  /**
554
374
  * Public API surface of `@cngx/ui/mat-stepper`.
555
375
  *
556
- * Material-twin organism for the cngx stepper family. Composes the same
557
- * `CngxStepperPresenter` brain as `<cngx-stepper>` (in `@cngx/ui/stepper`)
558
- * via `hostDirectives`, so commit-action lifecycle, router sync, and
559
- * error aggregation all work identically against `<mat-stepper>`.
376
+ * The Material twin of the cngx stepper family, shipped as the
377
+ * instrumentation directive `[cngxMatStepper]`: attach it to a vanilla
378
+ * `<mat-stepper>` and it composes the same `CngxStepperPresenter` brain
379
+ * as `<cngx-stepper>` (in `@cngx/ui/stepper`) via `hostDirectives`, so
380
+ * commit-action lifecycle, router sync, and error aggregation all work
381
+ * against Material's own markup. Mirrors `[cngxMatTabs]`.
560
382
  */
561
383
 
562
384
  /**
563
385
  * Generated bundle index. Do not edit.
564
386
  */
565
387
 
566
- export { CNGX_MAT_STEP_HANDLE_FACTORY, CngxMatStepper, CngxMatStepperBridge, createMatStepHandle };
388
+ export { CNGX_MAT_STEP_HANDLE_FACTORY, CngxMatStepper, createMatStepHandle };
567
389
  //# sourceMappingURL=cngx-ui-mat-stepper.mjs.map