@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.
- package/README.md +22 -48
- package/action-button/README.md +9 -11
- package/empty-state/README.md +11 -26
- package/feedback/README.md +3 -3
- package/fesm2022/cngx-ui-action-button.mjs +30 -26
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +26 -21
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +498 -261
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +32 -5
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +119 -297
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +455 -120
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-material.mjs +14 -3
- package/fesm2022/cngx-ui-material.mjs.map +1 -1
- package/fesm2022/cngx-ui-overlay.mjs +22 -3
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +107 -28
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +61 -20
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +14 -5
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +659 -163
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +306 -55
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +2 -1
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/layout/README.md +9 -44
- package/mat-stepper/README.md +37 -17
- package/mat-tabs/README.md +13 -13
- package/mat-tabs/styles/mat-tabs.css +357 -213
- package/material/README.md +19 -19
- package/overlay/README.md +11 -11
- package/package.json +7 -6
- package/sidenav/README.md +4 -19
- package/skeleton/README.md +3 -17
- package/speak/README.md +15 -15
- package/stepper/README.md +213 -5
- package/tabs/README.md +22 -4
- package/theming/system-tokens.css +29 -0
- package/types/cngx-ui-action-button.d.ts +28 -13
- package/types/cngx-ui-empty-state.d.ts +21 -9
- package/types/cngx-ui-feedback.d.ts +437 -121
- package/types/cngx-ui-layout.d.ts +38 -8
- package/types/cngx-ui-mat-stepper.d.ts +100 -134
- package/types/cngx-ui-mat-tabs.d.ts +291 -84
- package/types/cngx-ui-material.d.ts +12 -1
- package/types/cngx-ui-overlay.d.ts +25 -4
- package/types/cngx-ui-sidenav.d.ts +106 -12
- package/types/cngx-ui-skeleton.d.ts +62 -8
- package/types/cngx-ui-speak.d.ts +10 -2
- package/types/cngx-ui-stepper.d.ts +390 -57
- package/types/cngx-ui-tabs.d.ts +182 -18
- package/types/cngx-ui.d.ts +1 -0
- package/speak/speak-button-theme.scss +0 -78
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cngx-ui-mat-stepper.mjs","sources":["../../../projects/ui/mat-stepper/material-bridge/bidirectional-sync.ts","../../../projects/ui/mat-stepper/mat-stepper.component.ts","../../../projects/ui/mat-stepper/mat-stepper.component.html","../../../projects/ui/mat-stepper/material-bridge/handle.ts","../../../projects/ui/mat-stepper/mat-stepper.directive.ts","../../../projects/ui/mat-stepper/public-api.ts","../../../projects/ui/mat-stepper/cngx-ui-mat-stepper.ts"],"sourcesContent":["import type { DestroyRef, Injector } from '@angular/core';\nimport type { MatStepper } from '@angular/material/stepper';\n\nimport { createMaterialBidirectionalSync } from '@cngx/common/data';\nimport type { CngxStepperHost } from '@cngx/common/stepper';\n\n/**\n * Options for {@link createMatStepperBidirectionalSync}.\n */\nexport interface CngxMatStepperBidirectionalSyncOptions {\n /** Material stepper the helper bridges against. */\n readonly matStepper: MatStepper;\n /** cngx stepper presenter — write target for Material→presenter. */\n readonly presenter: CngxStepperHost;\n /** Injection context for the underlying `effect()` in `@cngx/common/data`. */\n readonly injector: Injector;\n /**\n * Destroy ref the underlying subscriber teardown attaches to.\n * Same lifetime as the host directive / component.\n */\n readonly destroyRef: DestroyRef;\n}\n\n/**\n * Stepper-specific glue over {@link createMaterialBidirectionalSync}\n * (`@cngx/common/data`). Both `<cngx-mat-stepper>` (Component) and\n * `[cngxMatStepper]` (Directive) need to install the same\n * presenter↔Material `selectedIndex` sync; the option-mapping body\n * was identical at both call sites — same `presenterIndex`, same\n * `readSelectedIndex` / `writeSelectedIndex` shape, same\n * `selectedIndexChange.asObservable()` source, same\n * `onMaterialSelection` write-back. This helper is the single entry\n * point: each call site reduces to one line.\n *\n * Behaviour stays identical to the prior inline blocks — the helper\n * is a pure shape-adapter, no policy. The underlying generic factory\n * owns:\n * - presenter→Material `effect()` with read-equality guard.\n * - Material→presenter subscription with re-entrancy guard.\n * - Material-eager-advance reconciliation\n * (`tabs-accepted-debt §6` closure path; same code path applies\n * here because Material's MDC click handler advances\n * `selectedIndex` synchronously before the bidirectional sync sees\n * the event).\n * - `destroyRef` cleanup of both directions.\n *\n * Phase 7.2 of `mat-stepper-mat-tabs-hardening-plan` extracted this\n * helper to close E-C12 + E-C13 (duplicated bidirectional-sync glue\n * between the wrapper component and the instrumentation directive).\n */\nexport function createMatStepperBidirectionalSync(\n opts: CngxMatStepperBidirectionalSyncOptions,\n): void {\n createMaterialBidirectionalSync({\n presenterIndex: opts.presenter.activeStepIndex,\n readSelectedIndex: () => opts.matStepper.selectedIndex,\n writeSelectedIndex: (i) => {\n opts.matStepper.selectedIndex = i;\n },\n // `MatStepper.selectedIndexChange` already emits a plain index,\n // so no `.pipe(map(e => e.selectedIndex))` adapter is needed —\n // mirrors the `MatTabGroup.selectedIndexChange` shape used by\n // `[cngxMatTabs]`.\n selectionChange$: opts.matStepper.selectedIndexChange.asObservable(),\n onMaterialSelection: (i) => opts.presenter.select(i),\n injector: opts.injector,\n destroyRef: opts.destroyRef,\n });\n}\n","import { CommonModule } from '@angular/common';\nimport {\n afterNextRender,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n computed,\n contentChildren,\n DestroyRef,\n effect,\n inject,\n Injector,\n type Signal,\n type TemplateRef,\n untracked,\n viewChild,\n} from '@angular/core';\nimport {\n MatStepperModule,\n MatStepper,\n MatStepperIcon,\n} from '@angular/material/stepper';\n\nimport {\n CNGX_STEP_PANEL_HOST,\n CngxStep,\n type CngxStepContentContext,\n type CngxStepLabelContext,\n CngxStepperPresenter,\n CNGX_STEPPER_HOST,\n flatStepsEqual,\n type CngxStepNode,\n type CngxStepPanelHost,\n} from '@cngx/common/stepper';\n\nimport { createMatStepperBidirectionalSync } from './material-bridge/bidirectional-sync';\nimport { CNGX_DIRECTIVE_BY_ID_MAP_FACTORY } from '@cngx/common/tabs';\nimport type { MaterialPrivateSurfaces } from '@cngx/ui/mat-tabs';\n\n/**\n * Material-twin stepper organism. Wraps `<mat-stepper>` and shares\n * the `CngxStepperPresenter` brain with `<cngx-stepper>` — Material\n * consumers gain the commit-action lifecycle, router sync, and error\n * aggregation.\n *\n * Bidirectional sync between presenter and `MatStepper.selectedIndex`\n * runs in a single `effect()` with `untracked()` writes so neither\n * direction tracks the other.\n *\n * Material owns keyboard nav and focus on `MatStepperHeader`, so the\n * organism does NOT compose `CngxRovingTabindex` /\n * `CngxFocusRestore`. Group nodes flatten — `<mat-stepper>` does not\n * support nesting — with the depth preserved as a `data-step-depth`\n * hint on the rendered label.\n */\n@Component({\n selector: 'cngx-mat-stepper',\n exportAs: 'cngxMatStepper',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CommonModule, MatStepperModule],\n hostDirectives: [\n {\n directive: CngxStepperPresenter,\n inputs: ['activeStepIndex', 'linear', 'orientation', 'commitAction', 'commitMode'],\n outputs: ['activeStepIndexChange'],\n },\n ],\n providers: [{ provide: CNGX_STEP_PANEL_HOST, useExisting: CngxMatStepper }],\n templateUrl: './mat-stepper.component.html',\n})\nexport class CngxMatStepper implements CngxStepPanelHost {\n protected readonly presenter = inject(CNGX_STEPPER_HOST);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n protected readonly matStepper = viewChild.required(MatStepper);\n // Host CD nudge after the `_iconOverrides` patch — Material reads\n // the map into per-header `[iconOverrides]` bindings on the next\n // CD pass, so the patch only takes effect once we mark the host\n // view dirty.\n private readonly hostCdr = inject(ChangeDetectorRef);\n\n readonly flatSteps: Signal<readonly CngxStepNode[]> = this.presenter.flatSteps;\n readonly activeStepIndex: Signal<number> = this.presenter.activeStepIndex;\n readonly activeStepId: Signal<string | null> = this.presenter.activeStepId;\n private readonly stepDirectives = contentChildren(CngxStep, { descendants: true });\n\n /**\n * Consumer-projected `<ng-template matStepperIcon>` templates,\n * forwarded into `MatStepper._iconOverrides` from the\n * `afterNextRender` patch below. `<ng-content>` projection cannot\n * reach Material's `@ContentChildren(MatStepperIcon)` — content-init\n * resolves the inner query before the wrapper's projection lands.\n * `_iconOverrides` is a Material-internal slot;\n * `tabs-accepted-debt §5`.\n */\n private readonly stepperIcons = contentChildren(MatStepperIcon);\n\n /**\n * `Map<id, CngxStep>` so `labelTemplateFor` / `contentTemplateFor`\n * are O(1). Structural `equal` on the id-set + per-id directive\n * identity stops the map from cascading on shape-stable\n * `contentChildren` re-emits.\n */\n private readonly stepDirectiveById = inject(CNGX_DIRECTIVE_BY_ID_MAP_FACTORY)({\n source: this.stepDirectives,\n });\n\n /**\n * Step-only flat projection — `<mat-step>` does not nest, so\n * groups collapse into the same level. Memoised via\n * `flatStepsEqual` so consumers (`stepLabel`, panel `@for`,\n * `stepLabelContextFor`) don't re-walk on shape-stable\n * `flatSteps()` re-emits. Sibling-symmetric with\n * `CngxStepper.stepsOnly`.\n */\n protected readonly stepsOnly: Signal<readonly CngxStepNode[]> = computed(\n () => this.presenter.flatSteps().filter((n) => n.kind === 'step'),\n { equal: flatStepsEqual },\n );\n\n /** Material orientation literal — narrows our `'horizontal'|'vertical'` to its own union. */\n protected readonly matOrientation = computed<'horizontal' | 'vertical'>(\n () => (this.presenter.orientation() === 'vertical' ? 'vertical' : 'horizontal'),\n );\n\n protected stepIndexOf(node: CngxStepNode): number {\n return node.flatIndex;\n }\n\n /** Editability rule — non-linear lets every step click; linear only past completed. */\n protected isEditable(node: CngxStepNode): boolean {\n return !this.presenter.linear() || node.state() === 'success';\n }\n\n protected hasError(node: CngxStepNode): boolean {\n return node.state() === 'error';\n }\n\n protected isCompleted(node: CngxStepNode): boolean {\n return node.state() === 'success';\n }\n\n protected stepLabel(node: CngxStepNode): string {\n return node.label();\n }\n\n /** Group nodes carry a depth marker so the label can distinguish nested rows. */\n protected stepDepth(node: CngxStepNode): number {\n return node.depth;\n }\n\n // Material twin honours only `*cngxStepLabel` / `*cngxStepContent`\n // — the six other cngx slot directives are silently dropped because\n // Material owns the indicator/badge/busy chrome. The override path\n // is `<ng-template matStepperIcon>`. stepper-accepted-debt §4.\n labelTemplateFor(id: string): TemplateRef<CngxStepLabelContext> | null {\n return this.stepDirectiveById().get(id)?.labelTemplate()?.templateRef ?? null;\n }\n\n contentTemplateFor(id: string): TemplateRef<CngxStepContentContext> | null {\n return this.stepDirectiveById().get(id)?.contentTemplate()?.templateRef ?? null;\n }\n\n /**\n * Per-node-id slot-context cache for `*cngxStepLabel` /\n * `*cngxStepContent`. Mutating fields in place preserves the\n * object reference, so `*ngTemplateOutlet`'s `Object.is` diff\n * short-circuits the embedded-view rebind; the embedded view's\n * `let-` bindings re-read the mutated fields on the next CD pass.\n * Stale ids are pruned by the constructor effect tied to\n * `presenter.flatSteps`.\n */\n private readonly stepLabelContextCache = new Map<string, CngxStepLabelContext>();\n\n /** Build the {@link CngxStepLabelContext} for the projected label template. */\n protected stepLabelContextFor(node: CngxStepNode): CngxStepLabelContext {\n const flatStep = node.flatIndex;\n const active = node.id === this.presenter.activeStepId();\n const busy =\n this.presenter.commitState.status() === 'pending' &&\n this.presenter.intendedStepIndex() === flatStep;\n const disabled = node.disabled();\n\n const existing = this.stepLabelContextCache.get(node.id);\n if (!existing) {\n const fresh: CngxStepLabelContext = {\n node,\n index: flatStep + 1,\n active,\n busy,\n disabled,\n };\n this.stepLabelContextCache.set(node.id, fresh);\n return fresh;\n }\n // Mutate cached fields in place. `readonly` is a TS-only annotation;\n // the cast removes it for the assignment without affecting the\n // public consumer surface.\n const mutable = existing as {\n -readonly [K in keyof CngxStepLabelContext]: CngxStepLabelContext[K];\n };\n mutable.node = node;\n mutable.index = flatStep + 1;\n mutable.active = active;\n mutable.busy = busy;\n mutable.disabled = disabled;\n return existing;\n }\n\n /** Build the {@link CngxStepContentContext} for the projected content template. */\n protected stepContentContextFor(node: CngxStepNode): CngxStepContentContext {\n return this.stepLabelContextFor(node);\n }\n\n constructor() {\n // Prune stale `stepLabelContextCache` entries when the flat-step\n // set changes shape — without this, removed node-ids leak their\n // entries forever.\n effect(() => {\n const flat = this.presenter.flatSteps();\n untracked(() => {\n const liveIds = new Set<string>();\n for (const n of flat) {\n liveIds.add(n.id);\n }\n for (const id of Array.from(this.stepLabelContextCache.keys())) {\n if (!liveIds.has(id)) {\n this.stepLabelContextCache.delete(id);\n }\n }\n });\n });\n\n // `afterNextRender` — `viewChild.required(MatStepper)` isn't\n // resolved until the view commits.\n afterNextRender(() => {\n const stepper = this.matStepper();\n createMatStepperBidirectionalSync({\n matStepper: stepper,\n presenter: this.presenter,\n injector: this.injector,\n destroyRef: this.destroyRef,\n });\n\n // Forward consumer-projected `<ng-template matStepperIcon>` into\n // `MatStepper._iconOverrides`. Direct `<ng-content>` projection\n // never reaches Material's `@ContentChildren(MatStepperIcon)` —\n // content-init resolves the inner queries before the wrapper's\n // projection lands. Underscore reach typed via\n // `MaterialPrivateSurfaces.IconOverrideHost`; tabs-accepted-debt §5.\n // Dev-mode guard surfaces a Material rename/removal early.\n const stepperRef =\n stepper as unknown as MaterialPrivateSurfaces.IconOverrideHost;\n const iconList = this.stepperIcons();\n if (!stepperRef._iconOverrides) {\n if (typeof ngDevMode !== 'undefined' && ngDevMode && iconList.length) {\n console.warn(\n '[CngxMatStepper] MatStepper._iconOverrides is missing — ' +\n 'consumer-projected <ng-template matStepperIcon> templates ' +\n 'will not flow through to Material. Likely cause: a ' +\n 'Material upgrade renamed or removed the internal slot. ' +\n 'See stepper-accepted-debt §4 for the closure mechanism.',\n );\n }\n return;\n }\n for (const icon of iconList) {\n stepperRef._iconOverrides[icon.name] = icon.templateRef;\n }\n // Material reads `_iconOverrides` into per-header bindings on\n // the next CD pass — mark the host view dirty so Angular\n // re-runs CD over `<mat-stepper>` and the patched map flows\n // through. Touching `selectedIndex` would echo through\n // `createMaterialBidirectionalSync`; `markForCheck` does not.\n this.hostCdr.markForCheck();\n });\n }\n}\n","<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","import {\n computed,\n InjectionToken,\n signal,\n type Signal,\n type TemplateRef,\n} from '@angular/core';\nimport type { MatStep } from '@angular/material/stepper';\n\nimport type { CngxErrorAggregatorContract } from '@cngx/common/interactive';\nimport type { CngxStepRegistration, CngxStepStatus } from '@cngx/common/stepper';\n\n/**\n * Shared `signal(undefined)` constant used as the `errorAggregator`\n * slot for every Material-instrumented step handle. The\n * instrumentation path does not bind cngx error-aggregation per\n * `MatStep` — Material's own visual error surface (driven by\n * `MatStep.hasError` / `MatStep.optional`) stays authoritative — so\n * per-step allocation of a writable signal would be dead capacity.\n *\n * @internal\n */\nconst NO_ERROR_AGGREGATOR: Signal<CngxErrorAggregatorContract | undefined> =\n signal<CngxErrorAggregatorContract | undefined>(undefined).asReadonly();\n\n/**\n * Wiring bundle returned from {@link createMatStepHandle}. The\n * instrumentation directive holds the bundle in a `Map<MatStep,\n * Setup>` for diff-only registry churn; only `handle` is exposed to\n * the presenter.\n */\nexport interface CngxMatStepHandleSetup {\n readonly handle: CngxStepRegistration;\n}\n\n/**\n * Best-effort static-text extraction from a `<ng-template matStepLabel>`\n * `TemplateRef`. Used as a label fallback when consumers project a\n * template label without setting `MatStep.label` or\n * `MatStep.ariaLabel` — without it the cngx-side label slot would\n * be empty, leaving aria-label phrases that include the step label\n * with a measurable gap on the Material variant. Static markup\n * (`<ng-template matStepLabel>Review</ng-template>`) extracts cleanly\n * via a detached embedded view; templates with dynamic interpolation\n * fall through (the detached view's CD has no consumer-context\n * bindings) and the caller's deterministic id-based fallback wins.\n *\n * Idempotent: never mutates the source template; the embedded view is\n * created and destroyed inside one frame's worth of synchronous work.\n *\n * @internal\n */\nfunction readMatStepLabelTemplateText(\n template: TemplateRef<unknown>,\n): string | undefined {\n try {\n const view = template.createEmbeddedView({});\n try {\n view.detectChanges();\n const text = view.rootNodes\n .map((node: Node) => node.textContent ?? '')\n .join('')\n .trim();\n return text || undefined;\n } finally {\n view.destroy();\n }\n } catch {\n return undefined;\n }\n}\n\n/**\n * Translates a Material `MatStep` into a cngx\n * {@link CngxStepRegistration}.\n *\n * - `id` — always a fresh `idSeed()` value. Mirrors the tabs\n * instrumentation handle: a label-keyed id would collide when\n * two steps share a label.\n * - `kind` — fixed at `'step'`. The instrumentation path does not\n * project nested `<mat-step>` groups (Material's stepper has no\n * group-of-steps concept; group-aware semantics belong to the\n * `<cngx-stepper>` thin-wrapper organism).\n * - `label` — snapshot signal resolved through a four-tier fallback at\n * registration time so cngx-side phrases (announcements,\n * `aria-label` composition, telemetry) never read empty when\n * Material consumers project a `<ng-template matStepLabel>`:\n * 1. `MatStep.label` when it is a plain string — the canonical\n * shape and the only one that emits a runtime change Material\n * itself observes.\n * 2. `MatStep.ariaLabel` when the consumer set the input —\n * designed exactly as the substitute for template labels.\n * 3. Static-text read from `MatStep.stepLabel.template` via a\n * throwaway detached `EmbeddedViewRef` ({@link readMatStepLabelTemplateText}).\n * Captures literal `matStepLabel` markup; dynamic interpolation\n * bails through to (4).\n * 4. `Step <id>` — deterministic, derived from the cngx handle\n * id. Always non-empty.\n * Phase-2 limitation: runtime label changes do not propagate. CDK's\n * `CdkStep` does not expose a `_stateChanges` Subject analogous to\n * `MatTab._stateChanges`, so cngx cannot re-trigger the snapshot\n * when Material flips the input later. Tracked under\n * `stepper-accepted-debt §4` alongside the matStepperIcon\n * forwarding limitations — both surface the same Material-internal\n * coupling family typed in\n * `MaterialPrivateSurfaces.CompletedOverrideSource` (see Phase 6.1).\n * - `disabled` — fixed `false`. Material owns step gating via\n * `linear` + `editable` + `completed`; surfacing a cngx-side\n * `disabled` would duplicate Material's own click-time enforcement\n * and is ignored by `<mat-stepper>` itself.\n * - `state` — `computed()` over `MatStep.hasError` / `MatStep.completed`.\n * `CdkStep.completed`'s getter reads `_completedOverride()` — a\n * `WritableSignal<boolean | null>` typed in\n * `MaterialPrivateSurfaces.CompletedOverrideSource`. The cngx\n * computed transitively tracks that signal through the getter and\n * re-fires whenever Material flips completion. `hasError` is a\n * plain property setter on `CdkStep`, NOT a Signal — a `hasError`\n * write that is not paired with a `completed` change does not\n * re-trigger this computed. In practice Material wizards write the\n * two together (`step.hasError = true; step.completed = false` in\n * error-handler patterns and inside Material's own error-state\n * matchers) so the limitation is benign for the documented usage\n * pattern. Tracked under `stepper-accepted-debt §4` as the\n * `_completedOverride` re-fire contract; the Re-Eval Trigger fires\n * when Material exposes a public `_stateChanges`-equivalent Subject\n * on `CdkStep` OR a consumer issue confirms an unpaired-`hasError`\n * write reaches production.\n * - `errorAggregator` — points at the shared\n * {@link NO_ERROR_AGGREGATOR} constant.\n */\nexport function createMatStepHandle(\n matStep: MatStep,\n idSeed: () => string,\n): CngxMatStepHandleSetup {\n const id = idSeed();\n const labelText = resolveStepLabel(matStep, id);\n const label = signal<string>(labelText).asReadonly();\n const disabled = signal<boolean>(false).asReadonly();\n const state = computed<CngxStepStatus>(() => {\n if (matStep.hasError) {\n return 'error';\n }\n if (matStep.completed) {\n return 'success';\n }\n return 'idle';\n });\n return {\n handle: {\n id,\n kind: 'step',\n label,\n disabled,\n state,\n errorAggregator: NO_ERROR_AGGREGATOR,\n },\n };\n}\n\n/**\n * Four-tier label fallback walked once at registration time. See the\n * {@link createMatStepHandle} JSDoc for the full ladder rationale.\n *\n * @internal\n */\nfunction resolveStepLabel(matStep: MatStep, id: string): string {\n const labelInput = matStep.label;\n if (typeof labelInput === 'string' && labelInput.length > 0) {\n return labelInput;\n }\n const ariaLabel = matStep.ariaLabel;\n if (typeof ariaLabel === 'string' && ariaLabel.length > 0) {\n return ariaLabel;\n }\n const tpl = matStep.stepLabel?.template;\n if (tpl) {\n const text = readMatStepLabelTemplateText(tpl);\n if (text) {\n return text;\n }\n }\n return `Step ${id}`;\n}\n\n/**\n * Factory signature for {@link createMatStepHandle}. The DI token\n * {@link CNGX_MAT_STEP_HANDLE_FACTORY} resolves to a function with\n * this exact shape — overrides match it identically.\n */\nexport type CngxMatStepHandleFactory = typeof createMatStepHandle;\n\n/**\n * DI token fronting the per-step handle factory used by the\n * `[cngxMatStepper]` instrumentation directive. Default is\n * {@link createMatStepHandle}.\n *\n * Symmetric with the tabs sibling\n * `CNGX_MAT_TAB_HANDLE_FACTORY` and with `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY`\n * — every Material-bridge logic block ships the same swap surface so\n * consumers can layer telemetry, alternate id strategies, or\n * test-environment id keying via `providers` / `viewProviders`\n * without forking the directive.\n *\n * Override capability — the swap surface separates **handle shape**\n * (factory body) from **id keying** (the supplied `idSeed` closure).\n * The directive constructs `idSeed` as `() => nextUid('cngx-mat-step-')`\n * and hands it to the factory as a default suggestion; an override is\n * free to call it, ignore it, or replace it with a server-synced /\n * deterministic-test / consumer-domain id strategy. Both axes are\n * independently swappable from one DI seam.\n *\n * Tracked-debt: ships under family-uniformity staging (single\n * in-package consumer today). See `stepper-accepted-debt §7`.\n *\n * ```ts\n * providers: [\n * {\n * provide: CNGX_MAT_STEP_HANDLE_FACTORY,\n * useValue: ((step, idSeed) => {\n * const setup = createMatStepHandle(step, idSeed);\n * reportStepRegistered(setup.handle.id);\n * return setup;\n * }) satisfies CngxMatStepHandleFactory,\n * },\n * ]\n * ```\n */\nexport const CNGX_MAT_STEP_HANDLE_FACTORY =\n new InjectionToken<CngxMatStepHandleFactory>('CNGX_MAT_STEP_HANDLE_FACTORY', {\n providedIn: 'root',\n factory: () => createMatStepHandle,\n });\n","import {\n contentChildren,\n type DestroyRef,\n Directive,\n effect,\n inject,\n type Injector,\n untracked,\n DestroyRef as InjectableDestroyRef,\n Injector as InjectableInjector,\n} from '@angular/core';\nimport { MatStep, MatStepper } from '@angular/material/stepper';\n\nimport {\n CNGX_STEPPER_HOST,\n CngxStepperPresenter,\n} from '@cngx/common/stepper';\nimport { nextUid } from '@cngx/core/utils';\n\nimport { createMatStepperBidirectionalSync } from './material-bridge/bidirectional-sync';\nimport {\n CNGX_MAT_STEP_HANDLE_FACTORY,\n type CngxMatStepHandleSetup,\n} from './material-bridge/handle';\n\n/**\n * Attaches to an existing `<mat-stepper>` and bridges it to a\n * {@link CngxStepperPresenter} — consumers gain the commit-action\n * lifecycle, `CNGX_STATEFUL` (so `<cngx-toast-on />` /\n * `<cngx-banner-on />` compose as children), and the step-handle\n * registry from one attribute.\n *\n * Sibling-additive to `<cngx-mat-stepper>` (the thin-wrapper\n * organism in `@cngx/ui/mat-stepper`): the wrapper authors fresh\n * markup, this directive upgrades existing Material markup.\n * `exportAs` differs (`cngxMatStepperDirective`) to avoid colliding\n * with the wrapper's `cngxMatStepper`.\n *\n * Topology mirrors `[cngxMatTabs]`: Material is the host, cngx is\n * the instrumentation layer. `stepper-accepted-debt §1`'s blocker\n * applies to adoption, not this direction.\n */\n@Directive({\n selector: '[cngxMatStepper]',\n exportAs: 'cngxMatStepperDirective',\n standalone: true,\n hostDirectives: [\n {\n directive: CngxStepperPresenter,\n inputs: [\n 'activeStepIndex',\n 'linear',\n 'orientation',\n 'commitAction',\n 'commitMode',\n ],\n outputs: ['activeStepIndexChange'],\n },\n ],\n})\nexport class CngxMatStepperBridge {\n private readonly matStepper = inject(MatStepper, { self: true });\n private readonly presenter = inject(CNGX_STEPPER_HOST);\n private readonly destroyRef: DestroyRef = inject(InjectableDestroyRef);\n private readonly injector: Injector = inject(InjectableInjector);\n\n private readonly matSteps = contentChildren(MatStep, { descendants: true });\n // Per-step registry — strong refs are bounded by the directive's\n // lifetime; `Map` (not `WeakMap`) so the diff loop in\n // `syncHandles` can iterate to find removed steps without a\n // parallel `Set<MatStep>`.\n private readonly setupsByStep = new Map<MatStep, CngxMatStepHandleSetup>();\n private readonly createHandle = inject(CNGX_MAT_STEP_HANDLE_FACTORY);\n\n constructor() {\n effect(() => {\n const steps = this.matSteps();\n untracked(() => this.syncHandles(steps));\n });\n\n this.destroyRef.onDestroy(() => {\n for (const setup of this.setupsByStep.values()) {\n this.presenter.unregister(setup.handle.id);\n }\n this.setupsByStep.clear();\n });\n\n createMatStepperBidirectionalSync({\n matStepper: this.matStepper,\n presenter: this.presenter,\n injector: this.injector,\n destroyRef: this.destroyRef,\n });\n }\n\n private syncHandles(steps: readonly MatStep[]): void {\n const liveSteps = new Set<MatStep>(steps);\n\n // Add: only fresh MatSteps get a setup + handle registration.\n // Cached MatSteps survive untouched — no register-churn.\n for (const step of steps) {\n if (this.setupsByStep.has(step)) {\n continue;\n }\n const setup = this.createHandle(step, () => nextUid('cngx-mat-step-'));\n this.setupsByStep.set(step, setup);\n this.presenter.register(setup.handle);\n }\n\n // Snapshot before iterating — defends against future edits that\n // introduce non-current-key deletes inside the body.\n for (const [step, setup] of Array.from(this.setupsByStep.entries())) {\n if (liveSteps.has(step)) {\n continue;\n }\n this.setupsByStep.delete(step);\n this.presenter.unregister(setup.handle.id);\n }\n }\n}\n","/**\n * Public API surface of `@cngx/ui/mat-stepper`.\n *\n * Material-twin organism for the cngx stepper family. Composes the same\n * `CngxStepperPresenter` brain as `<cngx-stepper>` (in `@cngx/ui/stepper`)\n * via `hostDirectives`, so commit-action lifecycle, router sync, and\n * error aggregation all work identically against `<mat-stepper>`.\n */\nexport { CngxMatStepper } from './mat-stepper.component';\nexport { CngxMatStepperBridge } from './mat-stepper.directive';\nexport {\n CNGX_MAT_STEP_HANDLE_FACTORY,\n createMatStepHandle,\n type CngxMatStepHandleFactory,\n} from './material-bridge/handle';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["InjectableDestroyRef","InjectableInjector"],"mappings":";;;;;;;;;;;;AAuBA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;AACG,SAAU,iCAAiC,CAC/C,IAA4C,EAAA;AAE5C,IAAA,+BAA+B,CAAC;AAC9B,QAAA,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe;QAC9C,iBAAiB,EAAE,MAAM,IAAI,CAAC,UAAU,CAAC,aAAa;AACtD,QAAA,kBAAkB,EAAE,CAAC,CAAC,KAAI;AACxB,YAAA,IAAI,CAAC,UAAU,CAAC,aAAa,GAAG,CAAC;QACnC,CAAC;;;;;QAKD,gBAAgB,EAAE,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,YAAY,EAAE;AACpE,QAAA,mBAAmB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QACpD,QAAQ,EAAE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,CAAA;kBAlBhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,QAAQ,EAAE,yBAAyB;AACnC,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,cAAc,EAAE;AACd,wBAAA;AACE,4BAAA,SAAS,EAAE,oBAAoB;AAC/B,4BAAA,MAAM,EAAE;gCACN,iBAAiB;gCACjB,QAAQ;gCACR,aAAa;gCACb,cAAc;gCACd,YAAY;AACb,6BAAA;4BACD,OAAO,EAAE,CAAC,uBAAuB,CAAC;AACnC,yBAAA;AACF,qBAAA;AACF,iBAAA;AAO6C,SAAA,CAAA,EAAA,cAAA,EAAA,MAAA,EAAA,EAAA,cAAA,EAAA,EAAA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAAA,OAAO,CAAA,EAAA,EAAA,GAAE,EAAE,WAAW,EAAE,IAAI,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AClE5E;;;;;;;AAOG;;ACPH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cngx-ui-mat-stepper.mjs","sources":["../../../projects/ui/mat-stepper/material-bridge/bidirectional-sync.ts","../../../projects/ui/mat-stepper/material-bridge/handle.ts","../../../projects/ui/mat-stepper/mat-stepper.directive.ts","../../../projects/ui/mat-stepper/public-api.ts","../../../projects/ui/mat-stepper/cngx-ui-mat-stepper.ts"],"sourcesContent":["import type { DestroyRef, Injector } from '@angular/core';\nimport type { MatStepper } from '@angular/material/stepper';\n\nimport { createMaterialBidirectionalSync } from '@cngx/common/data';\nimport type { CngxStepperHost } from '@cngx/common/stepper';\n\n/**\n * Options for {@link createMatStepperBidirectionalSync}.\n *\n * @internal\n */\nexport interface CngxMatStepperBidirectionalSyncOptions {\n /** Material stepper the helper bridges against. */\n readonly matStepper: MatStepper;\n /** cngx stepper presenter - write target for Material→presenter. */\n readonly presenter: CngxStepperHost;\n /** Injection context for the underlying `effect()` in `@cngx/common/data`. */\n readonly injector: Injector;\n /**\n * Destroy ref the underlying subscriber teardown attaches to.\n * Same lifetime as the host directive / component.\n */\n readonly destroyRef: DestroyRef;\n}\n\n/**\n * Stepper-specific glue over {@link createMaterialBidirectionalSync}\n * (`@cngx/common/data`). Both `<cngx-mat-stepper>` (Component) and\n * `[cngxMatStepper]` (Directive) need to install the same\n * presenter↔Material `selectedIndex` sync; the option-mapping body\n * was identical at both call sites - same `presenterIndex`, same\n * `readSelectedIndex` / `writeSelectedIndex` shape, same\n * `selectedIndexChange.asObservable()` source, same\n * `onMaterialSelection` write-back. This helper is the single entry\n * point: each call site reduces to one line.\n *\n * Behaviour stays identical to the prior inline blocks - the helper\n * is a pure shape-adapter, no policy. The underlying generic factory\n * owns:\n * - presenter→Material `effect()` with read-equality guard.\n * - Material→presenter subscription with re-entrancy guard.\n * - Material-eager-advance reconciliation (Material's MDC click\n * handler advances `selectedIndex` synchronously before the\n * bidirectional sync sees the event).\n * - `destroyRef` cleanup of both directions.\n *\n * @internal\n */\nexport function createMatStepperBidirectionalSync(\n opts: CngxMatStepperBidirectionalSyncOptions,\n): void {\n createMaterialBidirectionalSync({\n presenterIndex: opts.presenter.activeStepIndex,\n readSelectedIndex: () => opts.matStepper.selectedIndex,\n writeSelectedIndex: (i) => {\n opts.matStepper.selectedIndex = i;\n },\n // `MatStepper.selectedIndexChange` emits a plain index - no adapter needed,\n // unlike `MatTabGroup.selectedIndexChange`.\n selectionChange$: opts.matStepper.selectedIndexChange.asObservable(),\n onMaterialSelection: (i) => opts.presenter.select(i),\n injector: opts.injector,\n destroyRef: opts.destroyRef,\n });\n}\n","import { computed, InjectionToken, signal, type Signal, type TemplateRef } from '@angular/core';\nimport type { MatStep } from '@angular/material/stepper';\n\nimport type { CngxErrorAggregatorContract } from '@cngx/common/interactive';\nimport type { CngxStepRegistration, CngxStepStatus } from '@cngx/common/stepper';\n\n/**\n * Shared `signal(undefined)` constant used as the `errorAggregator`\n * slot for every Material-instrumented step handle. The\n * instrumentation path does not bind cngx error-aggregation per\n * `MatStep` - Material's own visual error surface (driven by\n * `MatStep.hasError` / `MatStep.optional`) stays authoritative - so\n * per-step allocation of a writable signal would be dead capacity.\n *\n * @internal\n */\nconst NO_ERROR_AGGREGATOR: Signal<CngxErrorAggregatorContract | undefined> = signal<\n CngxErrorAggregatorContract | undefined\n>(undefined).asReadonly();\n\n/**\n * Wiring bundle returned from {@link createMatStepHandle}. The\n * instrumentation directive holds the bundle in a `Map<MatStep,\n * Setup>` for diff-only registry churn; only `handle` is exposed to\n * the presenter.\n */\nexport interface CngxMatStepHandleSetup {\n readonly handle: CngxStepRegistration;\n}\n\n/**\n * Best-effort static-text extraction from a `<ng-template matStepLabel>`\n * `TemplateRef`. Used as a label fallback when consumers project a\n * template label without setting `MatStep.label` or\n * `MatStep.ariaLabel` - without it the cngx-side label slot would\n * be empty, leaving aria-label phrases that include the step label\n * with a measurable gap on the Material variant. Static markup\n * (`<ng-template matStepLabel>Review</ng-template>`) extracts cleanly\n * via a detached embedded view; templates with dynamic interpolation\n * fall through (the detached view's CD has no consumer-context\n * bindings) and the caller's deterministic id-based fallback wins.\n *\n * Idempotent: never mutates the source template; the embedded view is\n * created and destroyed inside one frame's worth of synchronous work.\n *\n * @internal\n */\nfunction readMatStepLabelTemplateText(template: TemplateRef<unknown>): string | undefined {\n try {\n const view = template.createEmbeddedView({});\n try {\n view.detectChanges();\n const text = view.rootNodes\n .map((node: Node) => node.textContent ?? '')\n .join('')\n .trim();\n return text || undefined;\n } finally {\n view.destroy();\n }\n } catch {\n return undefined;\n }\n}\n\n/**\n * Translates a Material `MatStep` into a cngx\n * {@link CngxStepRegistration}.\n *\n * - `id` - always a fresh `idSeed()` value. Mirrors the tabs\n * instrumentation handle: a label-keyed id would collide when\n * two steps share a label.\n * - `kind` - fixed at `'step'`. The instrumentation path does not\n * project nested `<mat-step>` groups (Material's stepper has no\n * group-of-steps concept; group-aware semantics belong to the\n * `<cngx-stepper>` thin-wrapper organism).\n * - `label` - snapshot signal resolved through a four-tier fallback at\n * registration time so cngx-side phrases (announcements,\n * `aria-label` composition, telemetry) never read empty when\n * Material consumers project a `<ng-template matStepLabel>`:\n * 1. `MatStep.label` when it is a plain string - the canonical\n * shape and the only one that emits a runtime change Material\n * itself observes.\n * 2. `MatStep.ariaLabel` when the consumer set the input -\n * designed exactly as the substitute for template labels.\n * 3. Static-text read from `MatStep.stepLabel.template` via a\n * throwaway detached `EmbeddedViewRef` ({@link readMatStepLabelTemplateText}).\n * Captures literal `matStepLabel` markup; dynamic interpolation\n * bails through to (4).\n * 4. `Step <id>` - deterministic, derived from the cngx handle\n * id. Always non-empty.\n * Documented limitation: runtime label changes do not propagate.\n * CDK's `CdkStep` does not expose a `_stateChanges` Subject\n * analogous to `MatTab._stateChanges`, so cngx cannot re-trigger\n * the snapshot when Material flips the input later. Surface the\n * same Material-internal coupling family typed in\n * `MaterialPrivateSurfaces.CompletedOverrideSource`.\n * - `disabled` - fixed `false`. Material owns step gating via\n * `linear` + `editable` + `completed`; surfacing a cngx-side\n * `disabled` would duplicate Material's own click-time enforcement\n * and is ignored by `<mat-stepper>` itself.\n * - `state` - `computed()` over `MatStep.hasError` / `MatStep.completed`.\n * `CdkStep.completed`'s getter reads `_completedOverride()` - a\n * `WritableSignal<boolean | null>` typed in\n * `MaterialPrivateSurfaces.CompletedOverrideSource`. The cngx\n * computed transitively tracks that signal through the getter and\n * re-fires whenever Material flips completion. `hasError` is a\n * plain property setter on `CdkStep`, NOT a Signal - a `hasError`\n * write that is not paired with a `completed` change does not\n * re-trigger this computed. In practice Material wizards write the\n * two together (`step.hasError = true; step.completed = false` in\n * error-handler patterns and inside Material's own error-state\n * matchers) so the limitation is benign for the documented usage\n * pattern.\n * - `errorAggregator` - points at the shared\n * {@link NO_ERROR_AGGREGATOR} constant.\n *\n * @category ui/mat-stepper\n */\nexport function createMatStepHandle(\n matStep: MatStep,\n idSeed: () => string,\n): CngxMatStepHandleSetup {\n const id = idSeed();\n const labelText = resolveStepLabel(matStep, id);\n const label = signal<string>(labelText).asReadonly();\n const disabled = signal<boolean>(false).asReadonly();\n const state = computed<CngxStepStatus>(() => {\n if (matStep.hasError) {\n return 'error';\n }\n if (matStep.completed) {\n return 'success';\n }\n return 'idle';\n });\n return {\n handle: {\n id,\n kind: 'step',\n label,\n disabled,\n state,\n errorAggregator: NO_ERROR_AGGREGATOR,\n },\n };\n}\n\n/**\n * Four-tier label fallback walked once at registration time. See the\n * {@link createMatStepHandle} JSDoc for the full ladder rationale.\n *\n * @internal\n */\nfunction resolveStepLabel(matStep: MatStep, id: string): string {\n const labelInput = matStep.label;\n if (typeof labelInput === 'string' && labelInput.length > 0) {\n return labelInput;\n }\n const ariaLabel = matStep.ariaLabel;\n if (typeof ariaLabel === 'string' && ariaLabel.length > 0) {\n return ariaLabel;\n }\n const tpl = matStep.stepLabel?.template;\n if (tpl) {\n const text = readMatStepLabelTemplateText(tpl);\n if (text) {\n return text;\n }\n }\n return `Step ${id}`;\n}\n\n/**\n * Factory signature for {@link createMatStepHandle}. The DI token\n * {@link CNGX_MAT_STEP_HANDLE_FACTORY} resolves to a function with\n * this exact shape - overrides match it identically.\n *\n * @category ui/mat-stepper\n */\nexport type CngxMatStepHandleFactory = typeof createMatStepHandle;\n\n/**\n * DI token fronting the per-step handle factory used by the\n * `[cngxMatStepper]` instrumentation directive. Default is\n * {@link createMatStepHandle}.\n *\n * Symmetric with the tabs sibling\n * `CNGX_MAT_TAB_HANDLE_FACTORY` and with `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY`\n * - every Material-bridge logic block ships the same swap surface so\n * consumers can layer telemetry, alternate id strategies, or\n * test-environment id keying via `providers` / `viewProviders`\n * without forking the directive.\n *\n * Override capability - the swap surface separates **handle shape**\n * (factory body) from **id keying** (the supplied `idSeed` closure).\n * The directive constructs `idSeed` as `() => nextUid('cngx-mat-step-')`\n * and hands it to the factory as a default suggestion; an override is\n * free to call it, ignore it, or replace it with a server-synced /\n * deterministic-test / consumer-domain id strategy. Both axes are\n * independently swappable from one DI seam.\n *\n * ```ts\n * providers: [\n * {\n * provide: CNGX_MAT_STEP_HANDLE_FACTORY,\n * useValue: ((step, idSeed) => {\n * const setup = createMatStepHandle(step, idSeed);\n * reportStepRegistered(setup.handle.id);\n * return setup;\n * }) satisfies CngxMatStepHandleFactory,\n * },\n * ]\n * ```\n *\n * @category ui/mat-stepper\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-stepper/material-bridge/handle.ts\n * @since 0.1.0\n */\nexport const CNGX_MAT_STEP_HANDLE_FACTORY = new InjectionToken<CngxMatStepHandleFactory>(\n 'CNGX_MAT_STEP_HANDLE_FACTORY',\n {\n providedIn: 'root',\n factory: () => createMatStepHandle,\n },\n);\n","import {\n contentChildren,\n type DestroyRef,\n Directive,\n effect,\n inject,\n type Injector,\n untracked,\n DestroyRef as InjectableDestroyRef,\n Injector as InjectableInjector,\n} from '@angular/core';\nimport { MatStep, MatStepper } from '@angular/material/stepper';\n\nimport { CNGX_STEPPER_HOST, CngxStepperPresenter } from '@cngx/common/stepper';\nimport { nextUid } from '@cngx/core/utils';\n\nimport { createMatStepperBidirectionalSync } from './material-bridge/bidirectional-sync';\nimport {\n CNGX_MAT_STEP_HANDLE_FACTORY,\n type CngxMatStepHandleSetup,\n} from './material-bridge/handle';\n\n/**\n * The Material twin of the CNGX stepper: attach `cngxMatStepper` to a\n * vanilla `<mat-stepper>` and it is bridged to a\n * {@link CngxStepperPresenter}. \\\n * Consumers gain the commit-action\n * lifecycle, `CNGX_STATEFUL` (so `<cngx-toast-on />` /\n * `<cngx-banner-on />` compose as children), the shared\n * `CNGX_STEPPER_HOST` contract (so a `<cngx-stepper-footer>` can drive\n * Back / Next instead of Material's own buttons via\n * `[host]=\"ref.presenter\"`), and the step-handle registry - all from\n * one attribute.\n *\n * This is the instrumentation pattern: Material owns the rendering and\n * the consumer authors native `<mat-step>` markup; CNGX is the\n * behaviour layer. Topology mirrors `[cngxMatTabs]`.\n *\n * Inputs/outputs are forwarded from {@link CngxStepperPresenter}:\n * - `activeStepIndex` (two-way, with `activeStepIndexChange`),\n * - `linear`,\n * - `orientation`,\n * - `commitAction`,\n * - `commitMode`. \\\n * See the presenter for their semantics.\n * ```html\n * <mat-stepper\n * cngxMatStepper\n * #s=\"cngxMatStepper\"\n * [(activeStepIndex)]=\"active\"\n * [commitAction]=\"commitAction\"\n * [commitMode]=\"mode()\"\n * cngxToastOn\n * [toastError]=\"'Step transition failed'\"\n * cngxBannerOn\n * bannerId=\"stepper:commit-error\"\n * [bannerError]=\"'The server rejected the step change.'\"\n * aria-label=\"Account setup\"\n * >\n * <mat-step label=\"Personal info\">\n * <p>Tell us who you are.</p>\n * </mat-step>\n * <mat-step\n * label=\"Account\"\n * [hasError]=\"!accepted()\"\n * errorMessage=\"Accept the terms to continue\"\n * >\n * <p>Choose your sign-in method.</p>\n * </mat-step>\n * <mat-step label=\"Confirm\">\n * <p>Review everything, then finish.</p>\n * </mat-step>\n * </mat-stepper>\n * ```\n * @playground Bridge instrumentation ./examples/bridge/bridge-example.component.ts\n *\n * @category ui/mat-stepper\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-stepper/mat-stepper.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepper, CngxStepperPresenter, CngxMatTabs, CngxStepperFooter\n */\n@Directive({\n selector: '[cngxMatStepper]',\n exportAs: 'cngxMatStepper',\n standalone: true,\n hostDirectives: [\n {\n directive: CngxStepperPresenter,\n inputs: ['activeStepIndex', 'linear', 'orientation', 'commitAction', 'commitMode'],\n outputs: ['activeStepIndexChange'],\n },\n ],\n})\nexport class CngxMatStepper {\n private readonly matStepper = inject(MatStepper, { self: true });\n /**\n * Shared host contract. Public so a `<cngx-stepper-footer>` placed\n * outside the `<mat-stepper>` can bind `[host]=\"ref.presenter\"` (via\n * `#ref=\"cngxMatStepper\"`) and drive navigation.\n */\n readonly presenter = inject(CNGX_STEPPER_HOST);\n private readonly destroyRef: DestroyRef = inject(InjectableDestroyRef);\n private readonly injector: Injector = inject(InjectableInjector);\n\n private readonly matSteps = contentChildren(MatStep, { descendants: true });\n // Map not WeakMap - syncHandles needs to iterate to find removed steps.\n private readonly setupsByStep = new Map<MatStep, CngxMatStepHandleSetup>();\n private readonly createHandle = inject(CNGX_MAT_STEP_HANDLE_FACTORY);\n\n constructor() {\n effect(() => {\n const steps = this.matSteps();\n untracked(() => this.syncHandles(steps));\n });\n\n this.destroyRef.onDestroy(() => {\n for (const setup of this.setupsByStep.values()) {\n this.presenter.unregister(setup.handle.id);\n }\n this.setupsByStep.clear();\n });\n\n createMatStepperBidirectionalSync({\n matStepper: this.matStepper,\n presenter: this.presenter,\n injector: this.injector,\n destroyRef: this.destroyRef,\n });\n }\n\n private syncHandles(steps: readonly MatStep[]): void {\n const liveSteps = new Set<MatStep>(steps);\n\n // Only fresh MatSteps get registered; cached ones survive untouched.\n for (const step of steps) {\n if (this.setupsByStep.has(step)) {\n continue;\n }\n const setup = this.createHandle(step, () => nextUid('cngx-mat-step-'));\n this.setupsByStep.set(step, setup);\n this.presenter.register(setup.handle);\n }\n\n // Snapshot before iterating - guards against non-current-key deletes inside the body.\n for (const [step, setup] of Array.from(this.setupsByStep.entries())) {\n if (liveSteps.has(step)) {\n continue;\n }\n this.setupsByStep.delete(step);\n this.presenter.unregister(setup.handle.id);\n }\n }\n}\n","/**\n * Public API surface of `@cngx/ui/mat-stepper`.\n *\n * The Material twin of the cngx stepper family, shipped as the\n * instrumentation directive `[cngxMatStepper]`: attach it to a vanilla\n * `<mat-stepper>` and it composes the same `CngxStepperPresenter` brain\n * as `<cngx-stepper>` (in `@cngx/ui/stepper`) via `hostDirectives`, so\n * commit-action lifecycle, router sync, and error aggregation all work\n * against Material's own markup. Mirrors `[cngxMatTabs]`.\n */\nexport { CngxMatStepper } from './mat-stepper.directive';\nexport {\n CNGX_MAT_STEP_HANDLE_FACTORY,\n createMatStepHandle,\n type CngxMatStepHandleFactory,\n} from './material-bridge/handle';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["InjectableDestroyRef","InjectableInjector"],"mappings":";;;;;;;;AAyBA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACG,SAAU,iCAAiC,CAC/C,IAA4C,EAAA;AAE5C,IAAA,+BAA+B,CAAC;AAC9B,QAAA,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe;QAC9C,iBAAiB,EAAE,MAAM,IAAI,CAAC,UAAU,CAAC,aAAa;AACtD,QAAA,kBAAkB,EAAE,CAAC,CAAC,KAAI;AACxB,YAAA,IAAI,CAAC,UAAU,CAAC,aAAa,GAAG,CAAC;QACnC,CAAC;;;QAGD,gBAAgB,EAAE,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,YAAY,EAAE;AACpE,QAAA,mBAAmB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QACpD,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,UAAU,EAAE,IAAI,CAAC,UAAU;AAC5B,KAAA,CAAC;AACJ;;AC1DA;;;;;;;;;AASG;AACH,MAAM,mBAAmB,GAAoD,MAAM,CAEjF,SAAS,CAAC,CAAC,UAAU,EAAE;AAYzB;;;;;;;;;;;;;;;;AAgBG;AACH,SAAS,4BAA4B,CAAC,QAA8B,EAAA;AAClE,IAAA,IAAI;QACF,MAAM,IAAI,GAAG,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;AAC5C,QAAA,IAAI;YACF,IAAI,CAAC,aAAa,EAAE;AACpB,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC;iBACf,GAAG,CAAC,CAAC,IAAU,KAAK,IAAI,CAAC,WAAW,IAAI,EAAE;iBAC1C,IAAI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