@cngx/common 0.1.0-rc.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/a11y/README.md +15 -2
  2. package/button/README.md +258 -0
  3. package/command/README.md +19 -8
  4. package/data/README.md +10 -10
  5. package/fesm2022/cngx-common-a11y.mjs +701 -263
  6. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  7. package/fesm2022/cngx-common-audio.mjs +83 -64
  8. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  9. package/fesm2022/cngx-common-button.mjs +1084 -0
  10. package/fesm2022/cngx-common-button.mjs.map +1 -0
  11. package/fesm2022/cngx-common-card.mjs +135 -76
  12. package/fesm2022/cngx-common-card.mjs.map +1 -1
  13. package/fesm2022/cngx-common-chart.mjs +749 -296
  14. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  15. package/fesm2022/cngx-common-command.mjs +51 -29
  16. package/fesm2022/cngx-common-command.mjs.map +1 -1
  17. package/fesm2022/cngx-common-data.mjs +695 -405
  18. package/fesm2022/cngx-common-data.mjs.map +1 -1
  19. package/fesm2022/cngx-common-dialog.mjs +112 -112
  20. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  21. package/fesm2022/cngx-common-display.mjs +668 -308
  22. package/fesm2022/cngx-common-display.mjs.map +1 -1
  23. package/fesm2022/cngx-common-interactive.mjs +7066 -2739
  24. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  25. package/fesm2022/cngx-common-layout.mjs +2121 -492
  26. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  27. package/fesm2022/cngx-common-menu-button.mjs +557 -0
  28. package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
  29. package/fesm2022/cngx-common-popover.mjs +1207 -569
  30. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  31. package/fesm2022/cngx-common-stepper.mjs +256 -261
  32. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  33. package/fesm2022/cngx-common-tabs.mjs +202 -262
  34. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  35. package/fesm2022/cngx-common-timeline.mjs +28 -61
  36. package/fesm2022/cngx-common-timeline.mjs.map +1 -1
  37. package/fesm2022/cngx-common.mjs +10 -10
  38. package/fesm2022/cngx-common.mjs.map +1 -1
  39. package/interactive/README.md +30 -19
  40. package/layout/README.md +1 -1
  41. package/menu-button/README.md +234 -0
  42. package/package.json +14 -4
  43. package/popover/README.md +42 -5
  44. package/popover/tooltip-indicator.scss +52 -0
  45. package/schematics/ng-add/index.js +7 -7
  46. package/schematics/ng-add/schema.json +5 -0
  47. package/stepper/README.md +0 -1
  48. package/theming/components/cngx-accordion.css +36 -7
  49. package/theming/components/cngx-async.css +185 -37
  50. package/theming/components/cngx-backdrop.css +3 -1
  51. package/theming/components/cngx-badge.css +20 -5
  52. package/theming/components/cngx-bottom-sheet.css +2 -0
  53. package/theming/components/cngx-breadcrumb.css +3 -1
  54. package/theming/components/cngx-button-group.css +325 -0
  55. package/theming/components/cngx-button-toggle.css +55 -23
  56. package/theming/components/cngx-button.css +975 -0
  57. package/theming/components/cngx-data-grid.css +2 -0
  58. package/theming/components/cngx-dialog.css +3 -1
  59. package/theming/components/cngx-divider.css +24 -9
  60. package/theming/components/cngx-drawer.css +153 -0
  61. package/theming/components/cngx-icon-glyph.css +76 -0
  62. package/theming/components/cngx-listbox.css +79 -25
  63. package/theming/components/cngx-menu.css +112 -52
  64. package/theming/components/cngx-nav.css +1220 -0
  65. package/theming/components/cngx-popover-sheet.css +43 -11
  66. package/theming/components/cngx-popover.css +37 -13
  67. package/theming/components/cngx-recycler-placeholder.css +2 -0
  68. package/theming/components/cngx-ripple.css +74 -16
  69. package/theming/components/cngx-sidebar.css +71 -0
  70. package/theming/components/cngx-slider.css +3 -1
  71. package/theming/components/cngx-tooltip.css +2 -0
  72. package/timeline/README.md +2 -2
  73. package/types/cngx-common-a11y.d.ts +343 -120
  74. package/types/cngx-common-audio.d.ts +60 -88
  75. package/types/cngx-common-button.d.ts +698 -0
  76. package/types/cngx-common-card.d.ts +104 -78
  77. package/types/cngx-common-chart.d.ts +671 -384
  78. package/types/cngx-common-command.d.ts +44 -47
  79. package/types/cngx-common-data.d.ts +350 -342
  80. package/types/cngx-common-dialog.d.ts +91 -120
  81. package/types/cngx-common-display.d.ts +475 -300
  82. package/types/cngx-common-interactive.d.ts +4350 -1723
  83. package/types/cngx-common-layout.d.ts +1365 -286
  84. package/types/cngx-common-menu-button.d.ts +382 -0
  85. package/types/cngx-common-popover.d.ts +671 -289
  86. package/types/cngx-common-stepper.d.ts +217 -347
  87. package/types/cngx-common-tabs.d.ts +173 -386
  88. package/types/cngx-common-timeline.d.ts +25 -104
@@ -1 +1 @@
1
- {"version":3,"file":"cngx-common-stepper.mjs","sources":["../../../projects/common/stepper/commit-handler.ts","../../../projects/common/stepper/i18n/stepper-language-section.ts","../../../projects/common/stepper/i18n/stepper-i18n.ts","../../../projects/common/stepper/stepper-config.ts","../../../projects/common/stepper/stepper-host.token.ts","../../../projects/common/stepper/step-tree.util.ts","../../../projects/common/stepper/presenter.directive.ts","../../../projects/common/stepper/step-group-host.token.ts","../../../projects/common/stepper/step-panel-host.token.ts","../../../projects/common/stepper/step-content.directive.ts","../../../projects/common/stepper/step-label.directive.ts","../../../projects/common/stepper/step.directive.ts","../../../projects/common/stepper/step-group.directive.ts","../../../projects/common/stepper/slots/step-indicator.directive.ts","../../../projects/common/stepper/slots/step-badge.directive.ts","../../../projects/common/stepper/slots/step-busy-spinner.directive.ts","../../../projects/common/stepper/slots/step-rejection.directive.ts","../../../projects/common/stepper/slots/step-error.directive.ts","../../../projects/common/stepper/slots/step-group-header.directive.ts","../../../projects/common/stepper/slots/stepper-empty.directive.ts","../../../projects/common/stepper/slots/dot-stepper-dot.directive.ts","../../../projects/common/stepper/slots/stepper-template-cascade.ts","../../../projects/common/stepper/glyphs.ts","../../../projects/common/stepper/router-sync.directive.ts","../../../projects/common/stepper/status-label.ts","../../../projects/common/stepper/display-mode.ts","../../../projects/common/stepper/group-summary.ts","../../../projects/common/stepper/group-navigation.ts","../../../projects/common/stepper/stepper-host-attrs.ts","../../../projects/common/stepper/strip-keyboard-nav.ts","../../../projects/common/stepper/stepper-state-view.ts","../../../projects/common/stepper/slot-context-builders.ts","../../../projects/common/stepper/announcement-builders.ts","../../../projects/common/stepper/swipe-nav.directive.ts","../../../projects/common/stepper/warn-stepper-unhosted.ts","../../../projects/common/stepper/stepper-count.ts","../../../projects/common/stepper/controls/stepper-previous.directive.ts","../../../projects/common/stepper/controls/stepper-next.directive.ts","../../../projects/common/stepper/controls/stepper-complete.directive.ts","../../../projects/common/stepper/create-stepper-host-proxy.ts","../../../projects/common/stepper/provide-cngx-stepper.ts","../../../projects/common/stepper/public-api.ts","../../../projects/common/stepper/cngx-common-stepper.ts"],"sourcesContent":["import { InjectionToken, type Signal } from '@angular/core';\nimport { isObservable, type Observable, type Subscription } from 'rxjs';\n\nimport { type CngxCommitController, type CngxCommitHandle } from '@cngx/common/data';\nimport { CngxRuntimeError } from '@cngx/utils';\n\nimport type { CngxStepperCommitAction } from './presenter.directive';\n\n/**\n * How a commit-gated step change settled. `'refused'` is a `false` answer\n * from `commitAction` (the action declined on purpose, nothing failed);\n * `'failed'` is a throw, a rejected promise or an erroring observable.\n *\n * @category common/stepper\n */\nexport type CngxStepperCommitResolution = 'accepted' | 'refused' | 'failed';\n\n/**\n * Adapter between the lifted commit-controller and the stepper's\n * action shape. The presenter delegates to `beginTransition` on\n * every step change driven by `commitAction`.\n *\n * @category common/stepper\n */\nexport interface CngxStepperCommitHandler {\n /**\n * Start a transition commit. Returns synchronously; the controller's\n * `state` signal reports the in-flight status.\n *\n * @param onResolve fires `'accepted'` when the action answers `true`,\n * `'refused'` when it answers `false`, `'failed'` when\n * it throws, rejects or errors; skipped on supersede.\n */\n beginTransition(\n fromIndex: number,\n toIndex: number,\n action: CngxStepperCommitAction,\n onResolve: (outcome: CngxStepperCommitResolution) => void,\n ): void;\n\n /** Cancel the in-flight transition without firing callbacks. */\n cancel(): void;\n\n /** Live `pending` flag from the controller. */\n readonly isCommitting: Signal<boolean>;\n}\n\n/**\n * Options for {@link createStepperCommitHandler}.\n *\n * @category common/stepper\n */\nexport interface CngxStepperCommitHandlerOptions {\n readonly controller: CngxCommitController<number>;\n}\n\n/**\n * Build a stepper commit handler over an existing {@link CngxCommitController}.\n * Resolves `Observable<boolean>` / `Promise<boolean>` / `boolean` returns into\n * one {@link CngxStepperCommitResolution}: `true` accepts, `false` refuses\n * (the controller settles to `'idle'` and stores no error), a throw fails.\n *\n * @category common/stepper\n */\nexport function createStepperCommitHandler(\n opts: CngxStepperCommitHandlerOptions,\n): CngxStepperCommitHandler {\n const { controller } = opts;\n return {\n isCommitting: controller.isCommitting,\n\n beginTransition(fromIndex, toIndex, action, onResolve) {\n controller.begin(\n (handlers) => runStepperAction(action, fromIndex, toIndex, handlers),\n toIndex,\n fromIndex,\n {\n onSuccess: () => onResolve('accepted'),\n onError: () => onResolve('failed'),\n onRefused: () => onResolve('refused'),\n },\n );\n },\n\n cancel() {\n controller.cancel();\n },\n };\n}\n\n/** @internal */\nfunction runStepperAction(\n action: CngxStepperCommitAction,\n fromIndex: number,\n toIndex: number,\n handlers: {\n readonly onSuccess: (committed: number | undefined) => void;\n readonly onError: (err: unknown) => void;\n readonly onRefused: () => void;\n },\n): CngxCommitHandle {\n let cancelled = false;\n let unsubscribe: (() => void) | null = null;\n\n const safeSuccess = (accept: boolean): void => {\n if (cancelled) {\n return;\n }\n if (accept) {\n handlers.onSuccess(toIndex);\n } else {\n handlers.onRefused();\n }\n };\n const safeError = (err: unknown): void => {\n if (cancelled) {\n return;\n }\n handlers.onError(err);\n };\n\n let result: boolean | Promise<boolean> | Observable<boolean>;\n try {\n result = action(fromIndex, toIndex);\n } catch (err: unknown) {\n safeError(err);\n return {\n cancel: () => {\n cancelled = true;\n },\n };\n }\n\n if (isObservable(result)) {\n // Synchronous Observables (`of(true)`) emit inside `.subscribe`\n // before the assignment binds - `sub` would be in TDZ. Declare\n // the handle on a `let` first.\n let sub: Subscription | null = null;\n let done = false;\n sub = result.subscribe({\n next: (accept) => {\n if (done) {\n return;\n }\n // Done-latch, not just unsubscribe: a synchronous emission fires\n // while `sub` is still null, so a non-completing source would\n // otherwise stay live and re-resolve on its next emission.\n done = true;\n safeSuccess(accept);\n sub?.unsubscribe();\n },\n error: (err: unknown) => {\n if (done) {\n return;\n }\n safeError(err);\n },\n complete: () => {\n // EMPTY-style sources complete without emitting; without this arm\n // the commit stays 'pending' forever and busy() latches true.\n if (!done) {\n safeError(\n new CngxRuntimeError(\n 'CNGX1059',\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n '[cngxStepper] commitAction completed without emitting true or false.',\n ),\n );\n }\n },\n });\n if (done) {\n // The in-next unsubscribe was a no-op for a sync emission; close\n // the still-live subscription now that `sub` is bound.\n sub.unsubscribe();\n }\n unsubscribe = () => sub?.unsubscribe();\n } else if (result != null && typeof (result as { then?: unknown }).then === 'function') {\n (result as Promise<boolean>).then(safeSuccess, safeError);\n } else {\n safeSuccess(result as boolean);\n }\n\n return {\n cancel: () => {\n cancelled = true;\n unsubscribe?.();\n },\n };\n}\n\n/**\n * Factory signature for {@link CngxStepperCommitHandler}. Override\n * {@link CNGX_STEPPER_COMMIT_HANDLER_FACTORY} for retry-with-backoff,\n * telemetry, or offline queues.\n *\n * @category common/stepper\n */\nexport type CngxStepperCommitHandlerFactory = (\n opts: CngxStepperCommitHandlerOptions,\n) => CngxStepperCommitHandler;\n\n/**\n * DI token carrying the factory the presenter uses to allocate its commit\n * handler. Symmetric to the select family's `CNGX_ARRAY_COMMIT_HANDLER_FACTORY`.\n *\n * @category common/stepper\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/commit-handler.ts\n * @since 0.1.0\n */\nexport const CNGX_STEPPER_COMMIT_HANDLER_FACTORY =\n new InjectionToken<CngxStepperCommitHandlerFactory>('CngxStepperCommitHandlerFactory', {\n providedIn: 'root',\n factory: () => createStepperCommitHandler,\n });\n","import type { CngxMessage } from '@cngx/core/i18n';\n\n/**\n * The status-pill words of the stepper section.\n *\n * @category common/stepper/i18n\n * @since 0.1.0\n */\nexport interface CngxStepperStatusLanguage {\n readonly done: string;\n readonly inProgress: string;\n readonly upNext: string;\n readonly errored: string;\n /** The status word of a step whose change the commit action refused. */\n readonly refused: string;\n}\n\n/**\n * The stepper section of a {@link CngxLanguagePack}: the copy of\n * `@cngx/common/stepper` and of the steppers in `@cngx/ui/stepper` and\n * `@cngx/ui/mat-stepper`. It feeds `CNGX_STEPPER_I18N` and the copy keys of\n * `CNGX_STEPPER_CONFIG` (`ariaLabels`, `fallbackLabels`). Messages use\n * `{name}` placeholders; a plural message picks its form from `{count}`.\n *\n * @category common/stepper/i18n\n * @since 0.1.0\n * @relatedTo CNGX_STEPPER_I18N, CNGX_STEPPER_CONFIG\n */\nexport interface CngxStepperLanguageSection {\n /** Accessible name of the stepper landmark. */\n readonly stepperRegion: string;\n /** Last-tier landmark label and role description, used when the config keys are unset. */\n readonly stepperLabel: string;\n /** `aria-roledescription` of the stepper organism. */\n readonly stepRoleDescription: string;\n /** Role description of compact step indicators (dot stepper, mobile dots). */\n readonly stepIndicatorRoleDescription: string;\n /** Role description of a step group header. */\n readonly groupRoleDescription: string;\n /** `{label}`, `{position}`, `{count}`: the accessible name of a step. */\n readonly selectedStep: CngxMessage;\n /** `{step}`, `{detail}`: a step name followed by its status or its label. */\n readonly stepWithDetail: CngxMessage;\n /** Plural on `{count}`: the number of steps with errors. */\n readonly stepHasErrors: CngxMessage;\n readonly previousStep: string;\n readonly nextStep: string;\n readonly commitFailedRetry: string;\n /** Announced while a step commit is in flight. */\n readonly commitInFlight: string;\n /** `{origin}`: announced when a failed commit reverts to the origin step. */\n readonly commitRolledBackTo: CngxMessage;\n /** `{base}`: the description of a rolled-back step, `{base}` being its name. */\n readonly stepRolledBack: CngxMessage;\n /** `{origin}`: announced when the commit action refuses a step change. */\n readonly commitRefused: CngxMessage;\n /** Announced when the commit action refuses a step change from an unlabelled step. */\n readonly commitRefusedGeneric: string;\n /** `{base}`: the description of a step whose change was refused, `{base}` being its name. */\n readonly stepRefused: CngxMessage;\n readonly statusLabels: CngxStepperStatusLanguage;\n /** `{current}`, `{count}`: the short progress caption. */\n readonly textStepperFormat: CngxMessage;\n /** Plural on `{count}`: a collapsed group's step count for screen readers. */\n readonly groupSummaryCount: CngxMessage;\n /** `{completed}`, plural on `{count}`: a collapsed group's progress for screen readers. */\n readonly groupSummaryProgress: CngxMessage;\n /** `{count}`: a collapsed group's visible step count. */\n readonly groupSummaryCountShort: CngxMessage;\n /** `{completed}`, `{count}`: a collapsed group's visible progress. */\n readonly groupSummaryProgressShort: CngxMessage;\n /** `{id}`: the last-resort label of an unlabelled Material step. */\n readonly stepFallbackLabel: CngxMessage;\n}\n\n/**\n * The English stepper section: the single source of the stepper's English\n * copy. `CNGX_STEPPER_I18N` and the `CNGX_STEPPER_CONFIG` labels default to it.\n *\n * @category common/stepper/i18n\n * @since 0.1.0\n * @relatedTo CNGX_STEPPER_I18N\n */\nexport const CNGX_STEPPER_LANGUAGE_EN: CngxStepperLanguageSection = {\n stepperRegion: 'Steps',\n stepperLabel: 'Steps',\n stepRoleDescription: 'stepper',\n stepIndicatorRoleDescription: 'step indicator',\n groupRoleDescription: 'step group',\n selectedStep: 'Step {position} of {count}: {label}',\n stepWithDetail: '{step}: {detail}',\n stepHasErrors: { one: '{count} error', other: '{count} errors' },\n previousStep: 'Previous step',\n nextStep: 'Next step',\n commitFailedRetry: 'Could not save step - retry?',\n commitInFlight: 'Saving step…',\n commitRolledBackTo: 'Reverted to step \"{origin}\".',\n stepRolledBack: '{base} This step was rolled back.',\n commitRefused: 'Step change not allowed - stayed on step \"{origin}\".',\n commitRefusedGeneric: 'Step change not allowed.',\n stepRefused: '{base} This step change was not allowed.',\n statusLabels: {\n done: 'Done',\n inProgress: 'In progress',\n upNext: 'Up next',\n errored: 'Errored',\n refused: 'Not allowed',\n },\n textStepperFormat: 'Step {current} of {count}',\n groupSummaryCount: { one: '{count} step', other: '{count} steps' },\n groupSummaryProgress: {\n one: '{completed} of {count} step complete',\n other: '{completed} of {count} steps complete',\n },\n groupSummaryCountShort: '{count}',\n groupSummaryProgressShort: '{completed}/{count}',\n stepFallbackLabel: 'Step {id}',\n};\n\ndeclare module '@cngx/core/i18n' {\n interface CngxLanguagePack {\n readonly stepper: CngxStepperLanguageSection;\n }\n}\n","import { inject, InjectionToken, type Provider, type Signal } from '@angular/core';\nimport { createNestedLanguageSection, createSectionBundle, formatMessage } from '@cngx/core/i18n';\nimport { createNestedOverrideMerge } from '@cngx/core/utils';\n\nimport {\n CNGX_STEPPER_LANGUAGE_EN,\n type CngxStepperLanguageSection,\n type CngxStepperStatusLanguage,\n} from './stepper-language-section';\n\n/**\n * Status-pill labels used by the `stripe-status-rich` skin (and any\n * future skin / variant that surfaces a per-step status pill). Sub-\n * bundle of {@link CngxStepperI18n}; consumers override partial keys\n * via {@link withStepperI18nLabels} - un-overridden keys keep their\n * English defaults. The same shape as the section's status words, declared\n * once as {@link CngxStepperStatusLanguage}.\n *\n * @category common/stepper/i18n\n */\nexport type CngxStepperStatusLabels = CngxStepperStatusLanguage;\n\n/**\n * Stepper i18n surface. Library defaults are English; locales come from\n * consumer overrides via {@link provideStepperI18n}. Sibling of\n * `CNGX_TABS_I18N` / `CNGX_CHART_I18N`.\n *\n * @category common/stepper/i18n\n */\nexport interface CngxStepperI18n {\n /**\n * Last tier of the landmark `aria-label` and of the organism's\n * `aria-roledescription`. The label applies only while\n * `CNGX_STEPPER_CONFIG.ariaLabels.stepperRegion` (default `'Steps'`) is\n * unset, the role description only while `fallbackLabels.stepRoleDescription`\n * (default `'stepper'`) is unset. Localise both through\n * `withStepperAriaLabels(...)` and `withStepperFallbackLabels(...)`.\n */\n readonly stepperLabel: string;\n /**\n * Landmark `aria-roledescription` for compact step-indicator\n * surfaces such as the dot stepper and the mobile-dot collapse\n * fallback. Mirrors the W3C APG step-indicator pattern.\n *\n * @category common/stepper/i18n\n */\n readonly stepIndicatorRoleDescription: string;\n /** `aria-roledescription` of a step group header. English `step group`. */\n readonly groupRoleDescription: string;\n readonly selectedStep: (label: string, position: number, count: number) => string;\n /**\n * A step name followed by a detail - its status (`Step 2 of 3: Shipping:\n * Errored`) or its label (`Step 2 of 3: Shipping`). One message, so a\n * locale owns the joiner and the order.\n */\n readonly stepWithDetail: (step: string, detail: string) => string;\n readonly stepHasErrors: (count: number) => string;\n readonly previousStep: string;\n readonly nextStep: string;\n /**\n * @deprecated Superseded by {@link commitRolledBackTo}. Retained as\n * defensive fallback in `liveAnnouncement` when the origin label is\n * unresolvable (unlabeled step, or `commitState` driven outside `select()`).\n */\n readonly commitFailedRetry: string;\n /**\n * Polite SR announcement on `idle → pending`. Pillar 2.\n */\n readonly commitInFlight: string;\n /**\n * Origin-aware rollback phrase. Read on `pending → error` when both\n * `lastFailedIndex` and `originIndexDuringCommit` resolve. Receives\n * the safe-harbour label, yields e.g. `Reverted to step \"Customer\".`.\n */\n readonly commitRolledBackTo: (originLabel: string) => string;\n /**\n * Per-step `aria-describedby` text while `presenter.lastFailedIndex()`\n * matches the step. Receives the step's base description (e.g.\n * `Step 2 of 3: Shipping`) and owns the whole sentence, so a locale can\n * place the rolled-back note before, after or inside it. Distinct from\n * {@link commitRolledBackTo} (transient live-region phrase) - this text\n * is reachable when AT users navigate back to the rejected step after\n * the announcement has faded. Pillar 2.\n */\n readonly stepRolledBack: (base: string) => string;\n /**\n * Origin-aware refusal phrase. Read when the commit action answered\n * `false` and the origin label resolves. Receives the label of the step\n * the user stayed on, yields e.g. `Step change not allowed - stayed on\n * step \"Customer\".`. A refusal is not a failure, so it never reads the\n * failure copy ({@link commitRolledBackTo}, {@link commitFailedRetry}).\n */\n readonly commitRefused: (originLabel: string) => string;\n /**\n * Refusal phrase for an origin without a label. Twin of\n * {@link commitFailedRetry} for the refused outcome.\n */\n readonly commitRefusedGeneric: string;\n /**\n * Per-step `aria-describedby` text while the step carries the marker\n * of a refused change. Refused twin of {@link stepRolledBack}; same\n * `{base}` contract.\n */\n readonly stepRefused: (base: string) => string;\n /**\n * Per-state pill labels surfaced by the `stripe-status-rich` skin\n * (and any future skin / variant that paints a state pill). English\n * defaults; consumer partial overrides via\n * {@link withStepperI18nLabels} keep un-overridden keys intact.\n */\n readonly statusLabels: CngxStepperStatusLabels;\n /**\n * Short progress format used by `CngxProgressBarStepper`'s optional\n * step-count subtext and by `CngxTextStepper`. Receives the\n * 1-based current position and total step count; default\n * `(current, total) => 'Step ${current} of ${total}'`.\n *\n * @category common/stepper/i18n\n */\n readonly textStepperFormat: (current: number, total: number) => string;\n /** Collapsed-group SR phrase for `groupCollapseSummary: 'count'`. */\n readonly groupSummaryCount: (total: number) => string;\n /** Collapsed-group SR phrase for `groupCollapseSummary: 'progress'`. */\n readonly groupSummaryProgress: (completed: number, total: number) => string;\n /** Visible collapsed-group badge for `groupCollapseSummary: 'count'`. */\n readonly groupSummaryCountShort: (total: number) => string;\n /** Visible collapsed-group badge for `groupCollapseSummary: 'progress'`. */\n readonly groupSummaryProgressShort: (completed: number, total: number) => string;\n /**\n * Last-resort label of a Material `<mat-step>` instrumented by\n * `[cngxMatStepper]` when it has no `label`, `ariaLabel` or static\n * `matStepLabel` text. Receives the cngx handle id. English default\n * `Step <id>`.\n */\n readonly stepFallbackLabel: (id: string) => string;\n}\n\n/**\n * Partial-override shape for {@link withStepperI18nLabels}. Behaves as\n * `Partial<CngxStepperI18n>` for top-level keys, plus a nested partial\n * for {@link CngxStepperStatusLabels} so consumers can override one\n * pill label without restating the full status-label bundle.\n *\n * @category common/stepper/i18n\n */\nexport type CngxStepperI18nOverrides = Omit<Partial<CngxStepperI18n>, 'statusLabels'> & {\n readonly statusLabels?: Partial<CngxStepperStatusLabels>;\n};\n\n/** @internal Turns a stepper section into the token's keys for a locale. */\nfunction stepperBundleFrom(section: CngxStepperLanguageSection, locale: string): CngxStepperI18n {\n return {\n stepperLabel: section.stepperLabel,\n stepIndicatorRoleDescription: section.stepIndicatorRoleDescription,\n groupRoleDescription: section.groupRoleDescription,\n selectedStep: (label, position, count) =>\n formatMessage(section.selectedStep, { label, position, count }, locale),\n stepWithDetail: (step, detail) =>\n formatMessage(section.stepWithDetail, { step, detail }, locale),\n stepHasErrors: (count) => formatMessage(section.stepHasErrors, { count }, locale),\n previousStep: section.previousStep,\n nextStep: section.nextStep,\n commitFailedRetry: section.commitFailedRetry,\n commitInFlight: section.commitInFlight,\n commitRolledBackTo: (origin) => formatMessage(section.commitRolledBackTo, { origin }, locale),\n stepRolledBack: (base) => formatMessage(section.stepRolledBack, { base }, locale),\n commitRefused: (origin) => formatMessage(section.commitRefused, { origin }, locale),\n commitRefusedGeneric: section.commitRefusedGeneric,\n stepRefused: (base) => formatMessage(section.stepRefused, { base }, locale),\n statusLabels: section.statusLabels,\n textStepperFormat: (current, count) =>\n formatMessage(section.textStepperFormat, { current, count }, locale),\n groupSummaryCount: (count) => formatMessage(section.groupSummaryCount, { count }, locale),\n groupSummaryProgress: (completed, count) =>\n formatMessage(section.groupSummaryProgress, { completed, count }, locale),\n groupSummaryCountShort: (count) =>\n formatMessage(section.groupSummaryCountShort, { count }, locale),\n groupSummaryProgressShort: (completed, count) =>\n formatMessage(section.groupSummaryProgressShort, { completed, count }, locale),\n stepFallbackLabel: (id) => formatMessage(section.stepFallbackLabel, { id }, locale),\n };\n}\n\n/**\n * @internal The English stepper section with the active pack's stepper\n * section on top. Feeds both `CNGX_STEPPER_I18N` and the\n * `CNGX_STEPPER_CONFIG` labels.\n */\nexport const injectStepperLanguage = createNestedLanguageSection(\n 'stepper',\n CNGX_STEPPER_LANGUAGE_EN,\n 'statusLabels',\n);\n\n/** @internal Builds and reads the token, formatted for the reading locale. */\nconst stepperBundle = createSectionBundle<CngxStepperLanguageSection, CngxStepperI18n>({\n section: injectStepperLanguage,\n toBundle: stepperBundleFrom,\n});\n\n/**\n * DI token for the resolved stepper i18n bundle, as a `Signal` so a\n * runtime language switch re-renders every label it feeds.\n * `providedIn: 'root'`: the stepper section of the active language pack over\n * the English defaults, formatted for the app locale. Provide it through\n * {@link provideStepperI18n}; a `{ provide, useValue }` entry must supply a\n * `Signal<CngxStepperI18n>`.\n *\n * @category common/stepper/i18n\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/i18n/stepper-i18n.ts\n * @since 0.1.0\n */\nexport const CNGX_STEPPER_I18N = new InjectionToken<Signal<CngxStepperI18n>>('CngxStepperI18n', {\n providedIn: 'root',\n factory: () => stepperBundle.build(),\n});\n\n/**\n * Feature shape consumed by {@link provideStepperI18n} and {@link provideCngxStepper}.\n * Hidden `_target: 'i18n'` discriminator routes through the family aggregator.\n * Sibling of `CngxTabsI18nFeature`.\n *\n * @category common/stepper/i18n\n */\nexport type CngxStepperI18nFeature = ((\n bundle: Signal<CngxStepperI18n>,\n) => Signal<CngxStepperI18n>) & {\n readonly _target: 'i18n';\n};\n\n/**\n * Brands an i18n mutator with `_target: 'i18n'`. Every `with*` i18n\n * feature returns one of these.\n *\n * @internal\n */\nfunction defineStepperI18nFeature(\n fn: (bundle: Signal<CngxStepperI18n>) => Signal<CngxStepperI18n>,\n): CngxStepperI18nFeature {\n return Object.assign(fn, { _target: 'i18n' as const });\n}\n\n/**\n * Override stepper i18n labels. Partial override - unset keys keep\n * the language pack's copy, or the English default. {@link CngxStepperStatusLabels} is merged\n * key-by-key so consumers can override one pill label without\n * restating the rest. Pass a `Signal` to switch the language at runtime.\n * Sibling of `withStepperAriaLabels` / `withStepperFallbackLabels`.\n *\n * @category common/stepper/i18n\n */\nexport function withStepperI18nLabels(\n overrides: CngxStepperI18nOverrides | Signal<CngxStepperI18nOverrides>,\n): CngxStepperI18nFeature {\n return defineStepperI18nFeature((bundle) =>\n createNestedOverrideMerge(bundle, overrides, 'statusLabels'),\n );\n}\n\n/**\n * Provider for the stepper i18n bundle. Compose `withStepperI18nLabels(...)`\n * (plus any future i18n `with*`) - unset keys fall back to the language\n * pack, then English. The features apply on top of the active pack.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideStepperI18n(\n * withStepperI18nLabels({ stepperLabel: 'Schrittfolge', previousStep: 'Vorheriger' }),\n * ),\n * ],\n * });\n * ```\n *\n * @category common/stepper/i18n\n */\nexport function provideStepperI18n(...features: readonly CngxStepperI18nFeature[]): Provider {\n return {\n provide: CNGX_STEPPER_I18N,\n useFactory: () => stepperBundle.build(features),\n };\n}\n\n/**\n * Inject the resolved stepper i18n bundle in an injection context. Read it\n * inside a `computed()`, template or handler so a language switch reaches\n * the label.\n *\n * @category common/stepper/i18n\n */\nexport function injectStepperI18n(): Signal<CngxStepperI18n> {\n return stepperBundle.resolve(inject(CNGX_STEPPER_I18N));\n}\n","import {\n computed,\n type EnvironmentProviders,\n inject,\n InjectionToken,\n makeEnvironmentProviders,\n type Provider,\n type Signal,\n type TemplateRef,\n} from '@angular/core';\n\nimport { createOverrideMerge } from '@cngx/core/utils';\nimport { recordEqual } from '@cngx/utils';\n\nimport { injectStepperLanguage } from './i18n/stepper-i18n';\nimport { CNGX_STEPPER_LANGUAGE_EN } from './i18n/stepper-language-section';\n\nimport type { CngxDotStepperDotContext } from './slots/dot-stepper-dot.directive';\nimport type { CngxStepBadgeContext } from './slots/step-badge.directive';\nimport type { CngxStepBusySpinnerContext } from './slots/step-busy-spinner.directive';\nimport type { CngxStepErrorContext } from './slots/step-error.directive';\nimport type { CngxStepGroupHeaderContext } from './slots/step-group-header.directive';\nimport type { CngxStepIndicatorContext } from './slots/step-indicator.directive';\nimport type { CngxStepRejectionContext } from './slots/step-rejection.directive';\n\n/**\n * Aria-label overrides for the stepper landmark region. Library\n * defaults are English; locales come from consumer overrides.\n *\n * Per-step navigation labels (`previousStep`, `nextStep`) live in\n * {@link CngxStepperI18n} - SR phrasing, not landmark naming.\n * Splitting the surfaces avoids a dual-override path for the same string.\n *\n * @category common/stepper\n */\nexport interface CngxStepperAriaLabels {\n readonly stepperRegion?: string;\n}\n\n/**\n * Fallback labels for derived strings (group descriptors, badge SR\n * announcements). English defaults; consumer overrides per locale.\n *\n * @category common/stepper\n */\nexport interface CngxStepperFallbackLabels {\n readonly groupRoleDescription?: string;\n readonly stepRoleDescription?: string;\n}\n\n/**\n * Per-slot template overrides for `<cngx-stepper>`. Middle tier of\n * the 3-stage cascade: per-instance directive > this field > built-in\n * markup. Apply via the `with*Template` feature builders below.\n *\n * @category common/stepper\n */\nexport interface CngxStepperTemplates {\n readonly indicator?: TemplateRef<CngxStepIndicatorContext>;\n readonly badge?: TemplateRef<CngxStepBadgeContext>;\n readonly busySpinner?: TemplateRef<CngxStepBusySpinnerContext>;\n readonly rejection?: TemplateRef<CngxStepRejectionContext>;\n readonly stepError?: TemplateRef<CngxStepErrorContext>;\n readonly groupHeader?: TemplateRef<CngxStepGroupHeaderContext>;\n readonly empty?: TemplateRef<void>;\n readonly dotStepperDot?: TemplateRef<CngxDotStepperDotContext>;\n}\n\n/**\n * Selectable visual skin for the cngx-standard stepper. The skin is a\n * pure thematic concern - every value renders the same structure, same\n * slots, same ARIA, same keyboard behaviour, and only redirects CSS via\n * the `[data-skin]` host attribute. The Material twin\n * (`<cngx-mat-stepper>`) ignores this setting.\n *\n * @category common/stepper\n */\nexport type CngxStepperSkin =\n | 'classic'\n | 'linear-minimal'\n | 'stripe-status-rich'\n | 'path-chevron'\n | 'pill-segment'\n | 'chips'\n | 'breadcrumb';\n\n/**\n * Mobile auto-collapse target. Below `30rem` of the stepper's own\n * container width, `<cngx-stepper>` falls back to one of the compact\n * variants instead of rendering the full strip. Set to `'off'` to retain\n * the classic strip at every width.\n *\n * The width itself is not configurable - it is a `@container` rule in\n * `stepper-base.css`, overridable in consumer CSS. This setting picks\n * *what* the strip collapses into, not *where*.\n *\n * @category common/stepper\n */\nexport type CngxStepperMobileCollapse = 'text' | 'dots' | 'off';\n\n/**\n * Header-navigation policy for `<cngx-stepper>`. `'none'` renders the\n * step headers as inert labels - the footer is the sole navigation\n * control. `'visited'` (default) keeps the headers as focusable\n * buttons; reachability folds into the `linear` axis (`linear=false`\n * is free click-through, `linear=true` is backward-to-visited only,\n * with linear-unreachable headers marked `aria-disabled`). There is no\n * discrete `'free'` value - `'free'` is `'visited'` + `linear=false`.\n *\n * @category common/stepper\n */\nexport type CngxStepperHeaderNavigation = 'none' | 'visited';\n\n/**\n * Focus-driven group-collapse policy for grouped `<cngx-stepper>` flows.\n * `'expand-active'` collapses every non-active `cngxStepGroup` branch to\n * its header node and expands only the group holding the active step;\n * `'off'` (default) keeps every group's children rendered in the strip -\n * the browser-native baseline. Orthogonal to the `mobileCollapse` axis;\n * the two never edit each other. The Material twin (`[cngxMatStepper]`)\n * ignores this setting.\n *\n * @category common/stepper\n */\nexport type CngxStepperGroupCollapse = 'expand-active' | 'off';\n\n/**\n * What a collapsed `cngxStepGroup` header shows next to its label under\n * `groupCollapse: 'expand-active'`. `'progress'` (default) shows\n * completed/total steps; `'count'` shows the step count; `'status'`\n * shows a status dot coloured by the group's rolled-up state; `'off'`\n * shows the bare label. Only ever rendered on a collapsed group header.\n *\n * @category common/stepper\n */\nexport type CngxStepperGroupSummary = 'progress' | 'count' | 'status' | 'off';\n\n/**\n * Space-driven density policy for the classic `<cngx-stepper>` strip.\n * `'auto'` degrades the strip on its own container width\n * (full labels -> ellipsis-truncated -> indicators-only with the active\n * label kept); `'comfortable'` (default) keeps full labels at every\n * width. Orthogonal to `mobileCollapse` and `groupCollapse`; the\n * Material twin ignores this setting.\n *\n * @category common/stepper\n */\nexport type CngxStepperDensity = 'comfortable' | 'auto';\n\n/**\n * Where the mobile auto-collapse indicator (text caption or dot row)\n * sits relative to the active step's panel content under narrow\n * viewports. `'top'` (default) keeps the indicator above the panel;\n * `'bottom'` flips it below so the user reads content first and the\n * navigation cue sits at the thumb zone. Ignored when the classic\n * strip is on screen (`displayMode === 'classic'`).\n *\n * @category common/stepper\n */\nexport type CngxStepperMobileIndicatorPosition = 'top' | 'bottom';\n\n/**\n * Stepper config surface. Resolution priority: per-instance Input\n * > `provideStepperConfigAt` (viewProviders) > `provideStepperConfig`\n * (root) > library default. Canonical cngx config shape.\n *\n * @category common/stepper\n */\nexport interface CngxStepperConfig {\n readonly defaultOrientation?: 'horizontal' | 'vertical';\n readonly defaultLinear?: boolean;\n readonly defaultCommitMode?: 'optimistic' | 'pessimistic';\n readonly routerSyncMode?: 'fragment' | 'queryParam';\n readonly routerSyncParam?: string;\n readonly skin?: CngxStepperSkin;\n /**\n * Header-navigation policy. `'none'` makes the step headers inert\n * labels (footer-only navigation); `'visited'` (default) keeps them\n * focusable buttons whose reachability folds into the `linear` axis.\n * Per-instance `[headerNavigation]` Input still wins.\n */\n readonly headerNavigation?: CngxStepperHeaderNavigation;\n /**\n * Focus-driven group-collapse policy. `'expand-active'` collapses\n * non-active `cngxStepGroup` branches to their header node and expands\n * only the active group; `'off'` (default) keeps the full strip.\n * Orthogonal to `mobileCollapse`. Apply app-wide via\n * {@link withStepperGroupCollapse}.\n */\n readonly groupCollapse?: CngxStepperGroupCollapse;\n /**\n * What a collapsed `cngxStepGroup` header shows beside its label.\n * Default `'progress'` (completed/total). Only applies when\n * `groupCollapse` is `'expand-active'`. Set via\n * {@link withStepperGroupCollapseSummary}.\n */\n readonly groupCollapseSummary?: CngxStepperGroupSummary;\n /**\n * Space-driven density policy for the classic strip. `'auto'`\n * shrinks the labels in flow (a cqi budget under `[data-density-auto]`)\n * instead of overflowing the strip; `'comfortable'`\n * (default) keeps full labels. Orthogonal to `mobileCollapse`. Apply\n * app-wide via {@link withStepperDensity}.\n */\n readonly density?: CngxStepperDensity;\n /**\n * Opt-in connector rail between adjacent step indicators on the\n * classic skin. Off by default. The rule is double-scoped on\n * `[data-skin='classic']`, so the four other skins are mechanically\n * untouched (each ships its own inter-step decoration). Per-instance\n * `[connectors]` Input still wins.\n */\n readonly connectors?: boolean;\n readonly mobileCollapse?: CngxStepperMobileCollapse;\n /**\n * Where the mobile auto-collapse indicator sits relative to the\n * panel content. Default `'top'`. Override per-instance via the\n * `[mobileIndicatorPosition]` input or app-wide via\n * {@link withStepperMobileIndicatorPosition}.\n */\n readonly mobileIndicatorPosition?: CngxStepperMobileIndicatorPosition;\n /**\n * Whether horizontal swipe gestures advance/retreat the active step\n * while the stepper is in mobile-collapse mode (`'dots'` / `'text'`).\n * Default `true`. Override per-instance via the `[mobileSwipe]` input\n * or app-wide via {@link withStepperMobileSwipe}. Ignored on the\n * classic strip and on the Material twin (`<cngx-mat-stepper>`).\n */\n readonly mobileSwipe?: boolean;\n /** Landmark labels; a `Signal` switches the language at runtime. */\n readonly ariaLabels?: CngxStepperAriaLabels | Signal<CngxStepperAriaLabels>;\n /** Role descriptions; a `Signal` switches the language at runtime. */\n readonly fallbackLabels?: CngxStepperFallbackLabels | Signal<CngxStepperFallbackLabels>;\n readonly templates?: CngxStepperTemplates;\n}\n\n/** @internal */\nconst STEPPER_CONFIG_DEFAULTS: Required<\n Omit<CngxStepperConfig, 'ariaLabels' | 'fallbackLabels' | 'templates'>\n> & {\n ariaLabels: CngxStepperAriaLabels;\n fallbackLabels: CngxStepperFallbackLabels;\n templates: CngxStepperTemplates;\n} = {\n defaultOrientation: 'horizontal',\n defaultLinear: false,\n defaultCommitMode: 'pessimistic',\n routerSyncMode: 'fragment',\n routerSyncParam: 'step',\n skin: 'classic',\n headerNavigation: 'visited',\n groupCollapse: 'off',\n groupCollapseSummary: 'progress',\n density: 'comfortable',\n connectors: false,\n mobileCollapse: 'text',\n mobileIndicatorPosition: 'top',\n mobileSwipe: true,\n ariaLabels: {\n stepperRegion: CNGX_STEPPER_LANGUAGE_EN.stepperRegion,\n },\n fallbackLabels: {\n groupRoleDescription: CNGX_STEPPER_LANGUAGE_EN.groupRoleDescription,\n stepRoleDescription: CNGX_STEPPER_LANGUAGE_EN.stepRoleDescription,\n },\n templates: {},\n};\n\n/** @internal - shared empty base, so label merges over an unset key memoize. */\nconst NO_LABELS: object = {};\n\n/**\n * DI token for the resolved stepper config. `providedIn: 'root'` with\n * library defaults; override via {@link provideStepperConfig} (root)\n * or {@link provideStepperConfigAt} (component scope).\n *\n * @category common/stepper\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/stepper-config.ts\n * @since 0.1.0\n */\nexport const CNGX_STEPPER_CONFIG = new InjectionToken<CngxStepperConfig>('CngxStepperConfig', {\n providedIn: 'root',\n factory: () => resolveFeatures([]),\n});\n\n/**\n * Feature signature - each `with*` builder reduces over the config.\n * Hidden `_target: 'config'` discriminator routes through the family\n * aggregator {@link provideCngxStepper}.\n *\n * @category common/stepper\n */\nexport type CngxStepperConfigFeature = ((config: CngxStepperConfig) => CngxStepperConfig) & {\n readonly _target: 'config';\n};\n\n/**\n * Brands a config mutator with `_target: 'config'`. Every `with*`\n * config feature returns one of these.\n *\n * @internal\n */\nfunction defineStepperConfigFeature(\n fn: (config: CngxStepperConfig) => CngxStepperConfig,\n): CngxStepperConfigFeature {\n return Object.assign(fn, { _target: 'config' as const });\n}\n\n/**\n * Override the default orientation. Per-instance `[orientation]`\n * Input still wins; this only moves the cascade default.\n *\n * @category common/stepper\n */\nexport function withStepperDefaultOrientation(\n orientation: 'horizontal' | 'vertical',\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n defaultOrientation: orientation,\n }));\n}\n\n/**\n * Override the default linear-progression setting. Per-instance\n * `[linear]` Input still wins.\n *\n * @category common/stepper\n */\nexport function withStepperLinear(linear: boolean): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, defaultLinear: linear }));\n}\n\n/**\n * Override the default commit mode for async step transitions.\n * `'optimistic'` advances on action dispatch and rolls back on error;\n * `'pessimistic'` waits for success. Per-instance `[commitMode]`\n * Input still wins.\n *\n * @category common/stepper\n */\nexport function withStepperCommitMode(\n mode: 'optimistic' | 'pessimistic',\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n defaultCommitMode: mode,\n }));\n}\n\n/**\n * Configure router synchronisation for the active step. `mode` chooses\n * the URL surface (URL fragment or query parameter); `param` names the\n * key (default `'step'`).\n *\n * @category common/stepper\n */\nexport function withStepperRouterSync(\n mode: 'fragment' | 'queryParam',\n param = 'step',\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n routerSyncMode: mode,\n routerSyncParam: param,\n }));\n}\n\n/**\n * Select the visual skin for the cngx-standard `<cngx-stepper>`. The\n * default is `'classic'`. Per-instance `[skin]` Input still wins; this\n * moves the cascade default. Structure, slots, ARIA, and keyboard\n * behaviour are identical across skins - only the `[data-skin]` host\n * attribute changes the CSS layer that paints the strip.\n *\n * @category common/stepper\n */\nexport function withStepperSkin(skin: CngxStepperSkin): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, skin }));\n}\n\n/**\n * Opt the classic `<cngx-stepper>` skin into the connector-rail\n * presentation: a solid completed/upcoming rail between adjacent step\n * indicators, horizontal and vertical, with per-segment coloring driven\n * by the preceding step's `[data-state]`. The rule is double-scoped on\n * `[data-skin='classic']`; the four other skins each ship their own\n * inter-step decoration and ignore this flag. Per-instance\n * `[connectors]` Input still wins.\n *\n * @category common/stepper\n */\nexport function withStepperConnectors(on: boolean): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, connectors: on }));\n}\n\n/**\n * Configure the mobile auto-collapse target for `<cngx-stepper>`. Below\n * `30rem` of the stepper's own container width, the classic strip swaps\n * to the chosen variant - `'text'` (default) renders\n * `<cngx-text-stepper>`, `'dots'` renders `<cngx-dot-stepper>`, `'off'`\n * keeps the classic strip. The Material twin `<cngx-mat-stepper>` ignores\n * this setting.\n *\n * @category common/stepper\n */\nexport function withStepperMobileCollapse(\n mode: CngxStepperMobileCollapse,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, mobileCollapse: mode }));\n}\n\n/**\n * Set the app-wide default position of the mobile auto-collapse\n * indicator relative to panel content. `'top'` keeps the indicator\n * above (library default); `'bottom'` flips it below so panel content\n * reads first and the navigation cue sits at thumb height. Per-\n * instance `[mobileIndicatorPosition]` on `<cngx-stepper>` still\n * wins.\n *\n * @category common/stepper\n */\nexport function withStepperMobileIndicatorPosition(\n position: CngxStepperMobileIndicatorPosition,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, mobileIndicatorPosition: position }));\n}\n\n/**\n * Toggle the built-in horizontal-swipe navigation on `<cngx-stepper>`\n * in mobile-collapse mode. Default `true` - the `'dots'` and `'text'`\n * variants read as carousels, so users expect to swipe. Per-instance\n * `[mobileSwipe]` Input still wins; the classic strip is unaffected.\n *\n * @category common/stepper\n */\nexport function withStepperMobileSwipe(enabled: boolean): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, mobileSwipe: enabled }));\n}\n\n/**\n * Set the app-wide default header-navigation policy for\n * `<cngx-stepper>`. `'none'` renders inert label headers (footer-only\n * navigation); `'visited'` (library default) keeps the headers as\n * focusable buttons whose reachability folds into the `linear` axis.\n * Per-instance `[headerNavigation]` Input still wins.\n *\n * @category common/stepper\n */\nexport function withStepperHeaderNavigation(\n mode: CngxStepperHeaderNavigation,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, headerNavigation: mode }));\n}\n\n/**\n * Set the app-wide focus-driven group-collapse policy for grouped\n * `<cngx-stepper>` flows. `'expand-active'` collapses every non-active\n * `cngxStepGroup` branch to its header node and expands only the group\n * holding the active step; `'off'` (library default) keeps the full\n * strip. Orthogonal to the `mobileCollapse` axis. The Material twin\n * ignores this setting.\n *\n * @category common/stepper\n */\nexport function withStepperGroupCollapse(mode: CngxStepperGroupCollapse): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, groupCollapse: mode }));\n}\n\n/**\n * Choose what a collapsed `cngxStepGroup` header shows beside its label\n * under `groupCollapse: 'expand-active'`. `'progress'` (library default)\n * shows completed/total steps; `'count'` the step count; `'status'` a\n * status dot coloured by the group's rolled-up state; `'off'` the bare\n * label. No effect unless `groupCollapse` is `'expand-active'`.\n *\n * @category common/stepper\n */\nexport function withStepperGroupCollapseSummary(\n mode: CngxStepperGroupSummary,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, groupCollapseSummary: mode }));\n}\n\n/**\n * Set the app-wide space-driven density policy for the classic\n * `<cngx-stepper>` strip. `'auto'` sets `[data-density-auto]`, under\n * which the labels shrink in flow within a cqi budget (the step furthest\n * from the active one gives way first) instead of overflowing the strip;\n * `'comfortable'` (library default) keeps full labels at every width.\n * Orthogonal to the `mobileCollapse` axis; the Material twin ignores this\n * setting.\n *\n * @category common/stepper\n */\nexport function withStepperDensity(mode: CngxStepperDensity): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, density: mode }));\n}\n\n/**\n * Merge ARIA labels into the cascade. Keys not provided keep their\n * library defaults; per-instance overrides on the stepper still win.\n * Pass a `Signal` to switch the language at runtime.\n *\n * @category common/stepper\n */\nexport function withStepperAriaLabels(\n labels: CngxStepperAriaLabels | Signal<CngxStepperAriaLabels>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n ariaLabels: createOverrideMerge<CngxStepperAriaLabels>(cfg.ariaLabels ?? NO_LABELS, labels),\n }));\n}\n\n/**\n * Merge fallback role descriptions (`groupRoleDescription` /\n * `stepRoleDescription`) into the cascade. These feed the strip's\n * `aria-roledescription` attributes when the consumer supplies none.\n * Pass a `Signal` to switch the language at runtime.\n *\n * @category common/stepper\n */\nexport function withStepperFallbackLabels(\n labels: CngxStepperFallbackLabels | Signal<CngxStepperFallbackLabels>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n fallbackLabels: createOverrideMerge<CngxStepperFallbackLabels>(\n cfg.fallbackLabels ?? NO_LABELS,\n labels,\n ),\n }));\n}\n\n/**\n * Override the default `*cngxStepIndicator` template app-wide.\n * Per-instance directive still wins; this only moves the cascade\n * middle tier.\n *\n * @category common/stepper\n */\nexport function withStepIndicatorTemplate(\n template: TemplateRef<CngxStepIndicatorContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, indicator: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepBadge` template app-wide.\n *\n * @category common/stepper\n */\nexport function withStepBadgeTemplate(\n template: TemplateRef<CngxStepBadgeContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, badge: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepBusySpinner` template app-wide.\n *\n * @category common/stepper\n */\nexport function withStepBusySpinnerTemplate(\n template: TemplateRef<CngxStepBusySpinnerContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, busySpinner: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepRejection` template app-wide.\n * Symmetric with the upcoming tabs `cngxTabRejectionIcon` (Phase 4).\n *\n * @category common/stepper\n */\nexport function withStepRejectionTemplate(\n template: TemplateRef<CngxStepRejectionContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, rejection: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepError` template app-wide. The slot\n * renders the per-step validation reason on the skins with a label area\n * (classic / stripe-status-rich). Per-instance directive still wins;\n * this moves the cascade middle tier.\n *\n * @category common/stepper\n */\nexport function withStepErrorTemplate(\n template: TemplateRef<CngxStepErrorContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, stepError: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepGroupHeader` template app-wide.\n *\n * @category common/stepper\n */\nexport function withStepGroupHeaderTemplate(\n template: TemplateRef<CngxStepGroupHeaderContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, groupHeader: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepperEmpty` template app-wide.\n *\n * @category common/stepper\n */\nexport function withStepperEmptyTemplate(template: TemplateRef<void>): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, empty: template },\n }));\n}\n\n/**\n * Override the default `*cngxDotStepperDot` template app-wide. Both dot\n * hosts resolve the cascade per dot - `<cngx-dot-stepper>` and the dots\n * mobile-collapse branch of `<cngx-stepper>`: per-instance directive >\n * this feature > built-in empty body (the dot fill is painted by the dot\n * element's CSS regardless).\n *\n * @category common/stepper\n */\nexport function withDotStepperDotTemplate(\n template: TemplateRef<CngxDotStepperDotContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, dotStepperDot: template },\n }));\n}\n\n/**\n * @internal The defaults with the copy keys read from the stepper section of\n * the active language pack. Runs in an injection context.\n */\nfunction stepperConfigDefaultsFromPack(): CngxStepperConfig {\n const language = injectStepperLanguage();\n return {\n ...STEPPER_CONFIG_DEFAULTS,\n ariaLabels: computed(() => ({ stepperRegion: language().stepperRegion }), {\n equal: recordEqual,\n }),\n fallbackLabels: computed(\n () => ({\n groupRoleDescription: language().groupRoleDescription,\n stepRoleDescription: language().stepRoleDescription,\n }),\n { equal: recordEqual },\n ),\n };\n}\n\n/** @internal Runs in an injection context; features apply on top of the pack. */\nfunction resolveFeatures(features: readonly CngxStepperConfigFeature[]): CngxStepperConfig {\n return features.reduce<CngxStepperConfig>(\n (cfg, feat) => feat(cfg),\n stepperConfigDefaultsFromPack(),\n );\n}\n\n/**\n * Root-level provider for the stepper config. Apply once in the\n * application providers array. Sibling of `provideTabsConfig` /\n * `provideSelectConfig`.\n *\n * @category common/stepper\n */\nexport function provideStepperConfig(\n ...features: readonly CngxStepperConfigFeature[]\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: CNGX_STEPPER_CONFIG, useFactory: () => resolveFeatures(features) },\n ]);\n}\n\n/**\n * Component-scoped config override. Spread the returned `Provider[]`\n * into `providers` or `viewProviders` - `viewProviders` cannot accept\n * opaque {@link EnvironmentProviders}, so the twin returns a list.\n * Sibling of `provideTabsConfigAt`.\n *\n * Resolution priority: per-instance Input > viewProviders (`At`) >\n * root provider > library default.\n *\n * ```ts\n * @Component({\n * viewProviders: [...provideStepperConfigAt(withStepperLinear(true))],\n * })\n * ```\n *\n * @category common/stepper\n */\nexport function provideStepperConfigAt(\n ...features: readonly CngxStepperConfigFeature[]\n): Provider[] {\n return [{ provide: CNGX_STEPPER_CONFIG, useFactory: () => resolveFeatures(features) }];\n}\n\n/**\n * Inject the resolved stepper config in an injection context.\n *\n * @category common/stepper\n */\nexport function injectStepperConfig(): CngxStepperConfig {\n return inject(CNGX_STEPPER_CONFIG);\n}\n","import { inject, InjectionToken, type Signal } from '@angular/core';\n\nimport type { CngxTransitionOutcome } from '@cngx/common/data';\nimport type { CngxAsyncState, StatusTransition } from '@cngx/core/utils';\nimport { CngxRuntimeError } from '@cngx/utils';\n\nimport type { CngxErrorAggregatorContract } from '@cngx/common/interactive';\n\n/**\n * Status enum for a single step. Driven by the presenter's commit-controller\n * lifecycle plus the optional `errorAggregator`.\n *\n * @category common/stepper\n */\nexport type CngxStepStatus = 'idle' | 'pending' | 'success' | 'error' | 'disabled' | 'busy';\n\n/**\n * Step-tree node. Either a terminal `step` (has its own panel) or a\n * `group` carrying nested children. Discriminated by `kind`.\n *\n * @category common/stepper\n */\nexport interface CngxStepNode {\n readonly id: string;\n readonly kind: 'step' | 'group';\n readonly label: Signal<string>;\n readonly disabled: Signal<boolean>;\n /** Live step status. Reactive to commit-controller + aggregator. */\n readonly state: Signal<CngxStepStatus>;\n /** Optional error aggregator signal for badge / SR phrasing. */\n readonly errorAggregator?: Signal<CngxErrorAggregatorContract | undefined>;\n /**\n * Message carried by a direct `[error]` string input on the step, or\n * `undefined` when `[error]` is boolean / absent. Pure data carrier\n * read by the `*cngxStepError` slot + the mini-skin aggregate line -\n * not a swap surface.\n */\n readonly errorMessage?: Signal<string | undefined>;\n /** Direct children for group nodes; empty for step nodes. */\n readonly children: readonly CngxStepNode[];\n /** DFS depth (root = 0). */\n readonly depth: number;\n /** Parent group id, or `null` for root. */\n readonly parentId: string | null;\n /** Flat-projection index inside `flatSteps()`. -1 for groups. */\n readonly flatIndex: number;\n}\n\n/**\n * Handle a `CngxStep` / `CngxStepGroup` passes to its host. The host owns\n * the registry; the atom owns its own state slot.\n *\n * @internal\n */\nexport interface CngxStepRegistration {\n readonly id: string;\n readonly kind: 'step' | 'group';\n readonly label: Signal<string>;\n readonly disabled: Signal<boolean>;\n readonly state: Signal<CngxStepStatus>;\n readonly errorAggregator?: Signal<CngxErrorAggregatorContract | undefined>;\n /**\n * Resolved message from a direct `[error]` string input, or\n * `undefined` for boolean / absent. Pure data carrier (not a swap\n * token); surfaced on {@link CngxStepNode.errorMessage}.\n */\n readonly errorMessage?: Signal<string | undefined>;\n}\n\n/**\n * Contract atoms see via {@link CNGX_STEPPER_HOST}. Mirrors the\n * directive's surface 1:1 - atoms never reach the concrete class.\n *\n * @category common/stepper\n */\nexport interface CngxStepperHost {\n readonly stepTree: Signal<readonly CngxStepNode[]>;\n readonly flatSteps: Signal<readonly CngxStepNode[]>;\n /**\n * Step-only flat projection (group nodes filtered out).\n * Structural-equal via `flatStepsEqual`; the single source for any\n * step-count / step-position lookup.\n *\n * **Contract:** variant and skin organisms MUST read this signal\n * directly. Local re-derivation (e.g. `flatSteps().filter(...)`\n * inside a variant's `computed`) is rejected at review time -\n * the projection's equality contract is the load-bearing\n * invariant, and a local re-filter breaks the shape-stable\n * short-circuit that downstream consumers rely on. Add lookup\n * helpers as methods on this contract rather than re-deriving.\n *\n * @category common/stepper\n */\n readonly stepsOnly: Signal<readonly CngxStepNode[]>;\n\n /**\n * Flat strip projection under the focus-driven group-collapse policy:\n * identical to {@link flatSteps} when `groupCollapse` is `'off'`, and\n * with every non-active root-level group's children dropped (header\n * node alone) under `'expand-active'`. The strip `@for` reads this;\n * `stepsOnly` stays the single counting / announcement source.\n *\n * **Contract:** variant and skin organisms drive the strip off this\n * projection, never re-derive it. Structural-equal via `flatStepsEqual`\n * (each retained node keeps its `flatSteps` `flatIndex`), so a\n * shape-stable re-emit short-circuits the strip render.\n *\n * @category common/stepper\n */\n readonly visibleStripNodes: Signal<readonly CngxStepNode[]>;\n readonly activeStepIndex: Signal<number>;\n readonly activeStepId: Signal<string | null>;\n\n /**\n * Root-level group whose subtree contains the active step, or `null`\n * when the active step is a root-level step (e.g. a trailing\n * `Finish`). The single focus-driven-collapse source: atoms read it\n * via this contract, never the concrete presenter. Drives\n * `CngxStepGroup.isCollapsed`, the strip `aria-expanded` binding, and\n * {@link visibleStripNodes}.\n */\n readonly activeGroupId: Signal<string | null>;\n\n /** Step-only count - the length of {@link stepsOnly}. */\n readonly stepCount: Signal<number>;\n\n /** `true` when the active step is the first one (no earlier step). */\n readonly isFirstStep: Signal<boolean>;\n\n /** `true` when the active step is the last one (no later step). */\n readonly isLastStep: Signal<boolean>;\n\n /**\n * `true` when {@link selectPrevious} would move - i.e. an enabled\n * step precedes the active one. The single gate a Back affordance\n * reads; never re-derive it from {@link stepsOnly} at the call site.\n */\n readonly canGoPrevious: Signal<boolean>;\n\n /**\n * `true` when {@link selectNext} would move - i.e. an enabled,\n * linear-unblocked step follows the active one. Derived from the same\n * predicates `select()` enforces, so a Next affordance can never\n * drift from the navigation it gates.\n */\n readonly canGoNext: Signal<boolean>;\n\n /**\n * `true` while a commit is in flight (`commitState.status() ===\n * 'pending'`). Drives the busy-disable on nav affordances. Keyed on\n * the strict `'pending'` status, consistent with the per-step busy\n * gate.\n */\n readonly busy: Signal<boolean>;\n\n /**\n * Label of the step {@link selectNext} would land on, or `undefined`\n * when none follows. Resolved through the enabled-step traversal so a\n * \"Continue to {{ label }}\" affordance announces the real target.\n */\n readonly nextStepLabel: Signal<string | undefined>;\n\n /**\n * Label of the step {@link selectPrevious} would land on, or\n * `undefined` when none precedes.\n */\n readonly previousStepLabel: Signal<string | undefined>;\n\n readonly linear: Signal<boolean>;\n readonly orientation: Signal<'horizontal' | 'vertical'>;\n /**\n * Resolved commit mode (`input ?? config ?? default`, with the DI\n * fallback's pinned mode winning while a routed action is active).\n * On the contract so Level-2 builders can gate mode-dependent\n * behaviour - e.g. the pending-to-success announcement only applies\n * in pessimistic mode, where the accept is what moves the step.\n * Optional so pre-existing custom host implementations stay\n * assignable; readers treat absence as `'pessimistic'` (the stepper\n * default).\n */\n readonly commitMode?: Signal<'optimistic' | 'pessimistic'>;\n readonly commitState: CngxAsyncState<number | undefined>;\n readonly intendedStepIndex: Signal<number | undefined>;\n\n /**\n * Reactive current/previous pair for the commit-state status. The\n * organism's `<span cngxLiveRegion>` reads this tracker on every\n * `pending → success / error` transition. Allocated once per\n * presenter - consumers MUST read this rather than calling\n * `createTransitionTracker` locally so the `linkedSignal` is shared.\n */\n readonly commitTransition: StatusTransition;\n\n /**\n * Settle record of the most recent commit that did not land:\n * `kind: 'refused'` when `commitAction` answered `false`, `'failed'`\n * when it threw, rejected or errored; `index` is the rejected target,\n * `sequence` is bumped once per settled refusal or failure. Kept\n * through {@link clearLastFailed} (which only hides the marker), so the\n * announcement record survives a cleared decoration; dropped by\n * `reset()`. A refusal leaves `commitState` at `'idle'` with its data\n * intact, so this is the only place a refusal is visible as such.\n */\n readonly lastOutcome: Signal<CngxTransitionOutcome | undefined>;\n\n /**\n * Index of the most recently rejected (refused or failed) commit\n * target, or `undefined` when no rejection marker is shown. Derived\n * from {@link lastOutcome}; cleared by a successful re-pick of the\n * same target or via {@link clearLastFailed}. Drives strip rejection\n * decoration and the `commitRolledBackTo` chain in `liveAnnouncement`.\n */\n readonly lastFailedIndex: Signal<number | undefined>;\n\n /**\n * Origin captured at commit-window open - the safe-harbour the user\n * is returned to on optimistic rollback. Resolves the origin label\n * for the `commitRolledBackTo(originLabel)` phrase. Cleared on\n * success; retained on rejection through the persistence window.\n */\n readonly originIndexDuringCommit: Signal<number | undefined>;\n\n /**\n * `true` when the header at the given step-only index may be\n * navigated to: the step is enabled and not blocked by the `linear`\n * gate. The single reachability predicate a header affordance reads -\n * the organism MUST call this rather than reaching the presenter's\n * private linear-block check. Out-of-range indices return `false`.\n */\n canNavigateTo(index: number): boolean;\n\n select(index: number): void;\n selectNext(): void;\n selectPrevious(): void;\n selectById(id: string): void;\n reset(): void;\n\n /**\n * Drop the persisted {@link lastFailedIndex} marker. Idempotent;\n * safe to wire to a Dismiss button or aggregator-cleared. Leaves\n * {@link lastOutcome} untouched.\n */\n clearLastFailed(): void;\n\n register(handle: CngxStepRegistration, parentId?: string | null): void;\n /**\n * Remove a registration. Pass the registering `handle` so a destroyed\n * instance can only evict itself: under an id collision the presenter's\n * idempotent re-register replaces the stored handle, and the OLD\n * instance's late destroy must not tear down the NEW instance's entry.\n */\n unregister(id: string, handle?: CngxStepRegistration): void;\n}\n\n/**\n * DI token carrying the presenter's contract to atoms + organism shells.\n * Atoms inject `optional: true` and either register here or fall through\n * {@link CNGX_STEP_GROUP_HOST} when nested in a group.\n *\n * @category common/stepper\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/stepper-host.token.ts\n * @since 0.1.0\n */\nexport const CNGX_STEPPER_HOST = new InjectionToken<CngxStepperHost>('CngxStepperHost');\n\n/**\n * Inject the {@link CNGX_STEPPER_HOST} for a stepper add-on directive.\n * Throws a `CngxRuntimeError` with code `CNGX1055` when no stepper presenter\n * is found, in development and production alike. With `host: true` the\n * lookup stops at the declaring template's host, so the presenter has to sit\n * on the same element or an ancestor in the same template. `selector` names\n * the add-on in the development message.\n *\n * @internal\n */\nexport function injectStepperHost(\n selector: string,\n options: { readonly host: boolean },\n): CngxStepperHost {\n const stepper = inject(CNGX_STEPPER_HOST, { host: options.host, optional: true });\n if (!stepper) {\n throw new CngxRuntimeError(\n 'CNGX1055',\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n `[${selector}] must be placed on or inside an element with [cngxStepper], such as <cngx-stepper>.`,\n );\n }\n return stepper;\n}\n","import type { CngxStepNode } from './stepper-host.token';\n\n/**\n * DFS-flatten a step tree. Group nodes emit before their children;\n * the consumer keys off `kind` to render a panel container vs. a\n * group header.\n *\n * @internal\n */\nexport function flattenStepTree(nodes: readonly CngxStepNode[]): readonly CngxStepNode[] {\n const out: CngxStepNode[] = [];\n let flatIndex = 0;\n const visit = (list: readonly CngxStepNode[]): void => {\n for (const node of list) {\n // Re-emit with the live flatIndex; registry-builder seeds -1\n // so it doesn't need to know the final ordering.\n out.push({ ...node, flatIndex: node.kind === 'step' ? flatIndex : -1 });\n if (node.kind === 'step') {\n flatIndex++;\n }\n if (node.children.length > 0) {\n visit(node.children);\n }\n }\n };\n visit(nodes);\n return out;\n}\n\n/**\n * Structural equality for the step-tree registry signal. Shape only -\n * id, kind, depth, parentId, children length. Reactive fields\n * (`label`, `disabled`, `state`, `errorAggregator`) are signals; their\n * own subscribers track identity changes.\n *\n * @internal\n */\nexport function stepTreeEqual(a: readonly CngxStepNode[], b: readonly CngxStepNode[]): boolean {\n if (a === b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n const x = a[i];\n const y = b[i];\n if (x.id !== y.id || x.kind !== y.kind || x.depth !== y.depth || x.parentId !== y.parentId) {\n return false;\n }\n if (!stepTreeEqual(x.children, y.children)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Structural equality for `flatSteps`. Adds `flatIndex` (shifts when\n * a sibling is inserted) on top of the {@link stepTreeEqual} fields.\n *\n * Use only on projections where every step carries a real\n * DFS-assigned `flatIndex` and `depth`.\n *\n * @internal Exported from `public-api.ts` so the cngx-stepper and\n * cngx-mat-stepper organisms share the comparator across the\n * secondary-entry boundary (Sheriff forbids deep-relative imports).\n *\n * @category common/stepper\n */\nexport function flatStepsEqual(a: readonly CngxStepNode[], b: readonly CngxStepNode[]): boolean {\n if (a === b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (\n a[i].id !== b[i].id ||\n a[i].kind !== b[i].kind ||\n a[i].depth !== b[i].depth ||\n a[i].flatIndex !== b[i].flatIndex\n ) {\n return false;\n }\n }\n return true;\n}\n","import {\n afterNextRender,\n computed,\n Directive,\n inject,\n input,\n model,\n signal,\n type Signal,\n} from '@angular/core';\n\nimport {\n CNGX_COMMIT_CONTROLLER_FACTORY,\n type CngxCommitController,\n type CngxTransitionOutcome,\n} from '@cngx/common/data';\nimport { resolveStepFrom } from '@cngx/core';\nimport {\n CNGX_STATEFUL,\n createTransitionTracker,\n type CngxAsyncState,\n type StatusTransition,\n} from '@cngx/core/utils';\nimport { cngxDevWarn } from '@cngx/utils';\nimport type { Observable } from 'rxjs';\n\nimport {\n CNGX_STEPPER_COMMIT_HANDLER_FACTORY,\n type CngxStepperCommitHandler,\n} from './commit-handler';\nimport { injectStepperConfig } from './stepper-config';\nimport {\n CNGX_STEPPER_HOST,\n type CngxStepperHost,\n type CngxStepNode,\n type CngxStepRegistration,\n} from './stepper-host.token';\nimport { flatStepsEqual, flattenStepTree, stepTreeEqual } from './step-tree.util';\n\n/**\n * Async-commit action for stepper transitions. Receives the origin\n * and target indices; resolves `true` to advance, `false` to refuse.\n * The `Observable | Promise | sync` union matches every cngx\n * commit-action signature.\n *\n * @category common/stepper\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/presenter.directive.ts\n * @since 0.1.0\n */\nexport type CngxStepperCommitAction = (\n fromIndex: number,\n toIndex: number,\n) => boolean | Promise<boolean> | Observable<boolean>;\n\n/**\n * Stepper presenter - the brain of every stepper / wizard flow.\n * Holds the active-step model, registry, linear policy, orientation,\n * and commit-controller lifecycle. Provides {@link CNGX_STEPPER_HOST}\n * for atom registration and {@link CNGX_STATEFUL} so transition\n * bridges (`<cngx-toast-on />`, `<cngx-banner-on />`) compose without\n * explicit `[state]` wiring.\n *\n * Sheriff: common Level 2. Pure directive - zero template, zero CSS.\n * Level-4 organisms compose this via `hostDirectives`.\n *\n * @category common/stepper\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/presenter.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStep, CngxStepGroup, CngxStepperRouterSync, CNGX_STEPPER_HOST, CNGX_STEPPER_CONFIG\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-commit-action/pessimistic-optimistic-commits-with-bridge-directives</example-url>\n */\n@Directive({\n selector: '[cngxStepper]',\n exportAs: 'cngxStepper',\n standalone: true,\n providers: [\n { provide: CNGX_STEPPER_HOST, useExisting: CngxStepperPresenter },\n { provide: CNGX_STATEFUL, useExisting: CngxStepperPresenter },\n ],\n})\nexport class CngxStepperPresenter implements CngxStepperHost {\n private readonly config = injectStepperConfig();\n\n readonly activeStepIndex = model<number>(0);\n // Raw *Input slots default undefined so the cascade resolves through\n // CNGX_STEPPER_CONFIG. Must stay public - the template type-checker\n // rejects protected/private on hostDirective alias bindings.\n readonly linearInput = input<boolean | undefined>(undefined, {\n alias: 'linear',\n });\n readonly linear = computed<boolean>(\n () => this.linearInput() ?? this.config.defaultLinear ?? false,\n );\n\n readonly orientationInput = input<'horizontal' | 'vertical' | undefined>(undefined, {\n alias: 'orientation',\n });\n readonly orientation = computed<'horizontal' | 'vertical'>(\n () => this.orientationInput() ?? this.config.defaultOrientation ?? 'horizontal',\n );\n\n readonly commitAction = input<CngxStepperCommitAction | null>(null);\n readonly commitModeInput = input<'optimistic' | 'pessimistic' | undefined>(undefined, {\n alias: 'commitMode',\n });\n readonly commitMode = computed<'optimistic' | 'pessimistic'>(\n () => this.commitModeInput() ?? this.config.defaultCommitMode ?? 'pessimistic',\n );\n\n private readonly genericFactory = inject(CNGX_COMMIT_CONTROLLER_FACTORY);\n private readonly commitController: CngxCommitController<number> = this.genericFactory<number>();\n private readonly commitHandler: CngxStepperCommitHandler = inject(\n CNGX_STEPPER_COMMIT_HANDLER_FACTORY,\n )({ controller: this.commitController });\n\n /** Producer surface for the `CNGX_STATEFUL` bridge contract. */\n readonly state: CngxAsyncState<number | undefined> = this.commitController.state;\n\n /**\n * Step index the user is committing to. Tracked separately from\n * `state.data()` because the AsyncState data slot only updates on\n * success. Drives per-step `aria-busy` in the organism.\n */\n readonly intendedStepIndex: Signal<number | undefined> = this.commitController.intendedValue;\n\n /**\n * Reactive current/previous pair for the commit-state status. Skin\n * sub-components mount a `<span cngxLiveRegion>` reading this\n * tracker. Allocated once per presenter - the underlying\n * `linkedSignal` is shared across all consumers.\n */\n readonly commitTransition: StatusTransition = createTransitionTracker(() =>\n this.commitController.state.status(),\n );\n\n // Persistence-of-rejection surface - see CngxStepperHost.lastOutcome /\n // lastFailedIndex / originIndexDuringCommit for the contract. Two\n // event sources, never synced: the settle record and the sequence whose\n // visual marker was cleared. lastFailedIndex derives from both, so\n // clearing the marker never touches the announcement record.\n private readonly lastOutcomeState = signal<CngxTransitionOutcome | undefined>(undefined);\n private readonly clearedSequenceState = signal<number | undefined>(undefined);\n // Bumped once per settled refusal or failure. Plain field - only read\n // inside the resolve handler.\n private outcomeSequence = 0;\n\n // Last index a commit actually landed on (or a sync/back move settled\n // on). Rollback + origin resolution use this instead of the per-call\n // `previous`: a rapid second select() supersedes the first while\n // `previous` already points at the never-committed optimistic index,\n // and rolling back there would strand the user mid-air. Plain field -\n // read only inside handlers, never rendered.\n private lastCommittedIndex: number | undefined;\n private readonly originIndexDuringCommitState = signal<number | undefined>(undefined);\n /** {@inheritDoc CngxStepperHost.lastOutcome} */\n readonly lastOutcome: Signal<CngxTransitionOutcome | undefined> =\n this.lastOutcomeState.asReadonly();\n /** {@inheritDoc CngxStepperHost.lastFailedIndex} */\n readonly lastFailedIndex: Signal<number | undefined> = computed(() => {\n const outcome = this.lastOutcomeState();\n return outcome && outcome.sequence !== this.clearedSequenceState() ? outcome.index : undefined;\n });\n /** {@inheritDoc CngxStepperHost.originIndexDuringCommit} */\n readonly originIndexDuringCommit: Signal<number | undefined> =\n this.originIndexDuringCommitState.asReadonly();\n\n private readonly treeState = signal<readonly CngxStepNode[]>([], {\n equal: stepTreeEqual,\n });\n readonly stepTree: Signal<readonly CngxStepNode[]> = this.treeState.asReadonly();\n\n readonly flatSteps: Signal<readonly CngxStepNode[]> = computed(\n () => flattenStepTree(this.stepTree()),\n { equal: flatStepsEqual },\n );\n\n /**\n * Step-only flat projection - terminal nodes in DFS order.\n * Structural-equal via `flatStepsEqual` so downstream computeds\n * don't cascade on shape-stable re-emits. Single source for every\n * `select*` / `clamp` / `activeStepId` lookup - never re-filter\n * `flatSteps()`.\n */\n readonly stepsOnly: Signal<readonly CngxStepNode[]> = computed(\n () => this.flatSteps().filter((n) => n.kind === 'step'),\n { equal: flatStepsEqual },\n );\n\n private readonly clampedIndex = computed(() => {\n const stepCount = this.stepsOnly().length;\n if (stepCount === 0) {\n return 0;\n }\n const i = this.activeStepIndex();\n return Math.max(0, Math.min(i, stepCount - 1));\n });\n\n readonly activeStepId: Signal<string | null> = computed(() => {\n const idx = this.clampedIndex();\n return this.stepsOnly()[idx]?.id ?? null;\n });\n\n /**\n * {@inheritDoc CngxStepperHost.activeGroupId}\n *\n * Single derivation over `activeStepId` and `stepTree` - the root-level\n * group whose subtree holds the active step, or `null` for a\n * root-level active step (e.g. a trailing `Finish`). Walked once here;\n * `CngxStepGroup.isCollapsed`, the strip `aria-expanded` binding, and\n * `visibleStripNodes` read this rather than re-walking the tree.\n */\n readonly activeGroupId: Signal<string | null> = computed(() => {\n const activeId = this.activeStepId();\n if (activeId === null) {\n return null;\n }\n const subtreeHasActive = (node: CngxStepNode): boolean =>\n node.id === activeId || node.children.some(subtreeHasActive);\n for (const root of this.stepTree()) {\n if (root.kind === 'group' && subtreeHasActive(root)) {\n return root.id;\n }\n }\n return null;\n });\n\n /**\n * {@inheritDoc CngxStepperHost.visibleStripNodes}\n *\n * Flat strip projection honouring the focus-driven group-collapse\n * policy. Under `'off'` it returns `flatSteps()` verbatim (same\n * reference, so the `equal` short-circuits). Under `'expand-active'`\n * every non-active root-level group's subtree is dropped, leaving the\n * group header node alone - the active group and all root-level steps\n * stay. Each retained node keeps its canonical `flatIndex` from\n * `flatSteps`, so per-step state/announcement lookups are unaffected.\n * Returns a fresh array, so it MUST carry `{ equal: flatStepsEqual }`\n * or every re-emit cascades the strip `@for`.\n */\n readonly visibleStripNodes: Signal<readonly CngxStepNode[]> = computed(\n () => {\n const flat = this.flatSteps();\n if (this.config.groupCollapse !== 'expand-active') {\n return flat;\n }\n const activeGroup = this.activeGroupId();\n const collapsedRootIds = new Set(\n this.stepTree()\n .filter((n) => n.kind === 'group' && n.children.length > 0 && n.id !== activeGroup)\n .map((n) => n.id),\n );\n if (collapsedRootIds.size === 0) {\n return flat;\n }\n const byId = new Map(flat.map((n) => [n.id, n] as const));\n const rootAncestorId = (node: CngxStepNode): string => {\n let cur = node;\n while (cur.parentId !== null) {\n const parent = byId.get(cur.parentId);\n if (!parent) {\n break;\n }\n cur = parent;\n }\n return cur.id;\n };\n return flat.filter(\n (node) => collapsedRootIds.has(node.id) || !collapsedRootIds.has(rootAncestorId(node)),\n );\n },\n { equal: flatStepsEqual },\n );\n\n readonly commitState = this.commitController.state;\n\n /**\n * Next enabled step-only index after the active one, skipping\n * disabled steps. Returns `stepsOnly().length` when no enabled step\n * follows. Single source for `selectNext()` and the `canGoNext`\n * bound - the traversal lives here, never re-walked at the call site.\n */\n private readonly nextEnabledIndex = computed(() => {\n const stepsOnly = this.stepsOnly();\n return (\n resolveStepFrom(this.activeStepIndex(), 1, {\n count: stepsOnly.length,\n isDisabledAt: (i) => stepsOnly[i]?.disabled() ?? false,\n }) ?? stepsOnly.length\n );\n });\n\n /**\n * Previous enabled step-only index before the active one, skipping\n * disabled steps. Returns `-1` when no enabled step precedes - also for\n * a stale out-of-range active index (consumer-writable model), which\n * must resolve to \"none\" instead of wrapping or throwing. Single\n * source for `selectPrevious()` and the `canGoPrevious` bound.\n */\n private readonly previousEnabledIndex = computed(() => {\n const stepsOnly = this.stepsOnly();\n return (\n resolveStepFrom(Math.max(this.activeStepIndex(), 0), -1, {\n count: stepsOnly.length,\n isDisabledAt: (i) => stepsOnly[i]?.disabled() ?? false,\n }) ?? -1\n );\n });\n\n /** {@inheritDoc CngxStepperHost.stepCount} */\n readonly stepCount: Signal<number> = computed(() => this.stepsOnly().length);\n\n /** {@inheritDoc CngxStepperHost.isFirstStep} */\n readonly isFirstStep: Signal<boolean> = computed(() => this.clampedIndex() <= 0);\n\n /** {@inheritDoc CngxStepperHost.isLastStep} */\n readonly isLastStep: Signal<boolean> = computed(\n () => this.clampedIndex() >= this.stepCount() - 1,\n );\n\n /**\n * {@inheritDoc CngxStepperHost.canGoNext}\n *\n * Derives from the same `nextEnabledIndex` + `isLinearBlocked`\n * predicates `select()`/`selectNext()` enforce, so the affordance can\n * never drift from the navigation it gates.\n */\n readonly canGoNext: Signal<boolean> = computed(() => {\n const next = this.nextEnabledIndex();\n return next < this.stepCount() && !this.isLinearBlocked(next);\n });\n\n /** {@inheritDoc CngxStepperHost.canGoPrevious} */\n readonly canGoPrevious: Signal<boolean> = computed(() => this.previousEnabledIndex() >= 0);\n\n /** {@inheritDoc CngxStepperHost.busy} */\n readonly busy: Signal<boolean> = computed(() => this.commitState.status() === 'pending');\n\n /** {@inheritDoc CngxStepperHost.nextStepLabel} */\n readonly nextStepLabel: Signal<string | undefined> = computed(() =>\n this.stepsOnly()[this.nextEnabledIndex()]?.label(),\n );\n\n /** {@inheritDoc CngxStepperHost.previousStepLabel} */\n readonly previousStepLabel: Signal<string | undefined> = computed(() =>\n this.stepsOnly()[this.previousEnabledIndex()]?.label(),\n );\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n afterNextRender(() => {\n const stepNodes = this.flatSteps().filter((n) => n.kind === 'step');\n if (stepNodes.length > 6 && stepNodes.every((n) => n.parentId === null)) {\n cngxDevWarn(\n 'CNGX1039',\n '[cngxStepper] more than 6 steps and none inside a [cngxStepGroup]; consider wrapping logical groups of steps in [cngxStepGroup] for better UX',\n );\n }\n });\n }\n }\n\n // Flat id lookup; rebuilt into the hierarchical tree on each\n // register/unregister.\n private readonly registry = new Map<\n string,\n { reg: CngxStepRegistration; parentId: string | null; childIds: string[] }\n >();\n private readonly insertionOrder: string[] = [];\n\n register(handle: CngxStepRegistration, parentId: string | null = null): void {\n if (this.registry.has(handle.id)) {\n // Idempotent re-register - replace the handle, keep the ordering slot.\n const entry = this.registry.get(handle.id)!;\n entry.reg = handle;\n entry.parentId = parentId;\n } else {\n this.registry.set(handle.id, { reg: handle, parentId, childIds: [] });\n this.insertionOrder.push(handle.id);\n if (parentId !== null) {\n const parent = this.registry.get(parentId);\n if (parent) {\n parent.childIds.push(handle.id);\n }\n }\n }\n this.rebuildTree();\n }\n\n unregister(id: string, handle?: CngxStepRegistration): void {\n const entry = this.registry.get(id);\n if (!entry) {\n return;\n }\n // Instance guard: after an idempotent re-register replaced the stored\n // handle, the superseded instance's destroy is a no-op.\n if (handle !== undefined && entry.reg !== handle) {\n return;\n }\n if (entry.parentId !== null) {\n const parent = this.registry.get(entry.parentId);\n if (parent) {\n parent.childIds = parent.childIds.filter((c) => c !== id);\n }\n }\n this.registry.delete(id);\n const insertIdx = this.insertionOrder.indexOf(id);\n if (insertIdx >= 0) {\n this.insertionOrder.splice(insertIdx, 1);\n }\n this.rebuildTree();\n }\n\n private rebuildTree(): void {\n const buildNode = (id: string, depth: number): CngxStepNode => {\n const entry = this.registry.get(id)!;\n const children = entry.childIds.map((cid) => buildNode(cid, depth + 1));\n return {\n id,\n kind: entry.reg.kind,\n label: entry.reg.label,\n disabled: entry.reg.disabled,\n state: entry.reg.state,\n errorAggregator: entry.reg.errorAggregator,\n errorMessage: entry.reg.errorMessage,\n children,\n depth,\n parentId: entry.parentId,\n flatIndex: -1,\n };\n };\n const rootIds = this.insertionOrder.filter((id) => this.registry.get(id)!.parentId === null);\n this.treeState.set(rootIds.map((id) => buildNode(id, 0)));\n }\n\n /** {@inheritDoc CngxStepperHost.clearLastFailed} */\n clearLastFailed(): void {\n this.clearedSequenceState.set(this.lastOutcomeState()?.sequence);\n }\n\n /**\n * Linear-gate predicate: `true` when linear mode forbids advancing to\n * `target` because an incomplete (non-`success`, non-disabled) step\n * sits between the active index and `target`. The single home for the\n * linear slice check - `select()` and the `canGoNext` bound both\n * consume it so the gate can never drift between navigation and its\n * affordance.\n */\n private isLinearBlocked(target: number): boolean {\n if (!this.linear() || target <= this.activeStepIndex()) {\n return false;\n }\n return this.stepsOnly()\n .slice(this.activeStepIndex(), target)\n .some((n) => n.state() !== 'success' && !n.disabled());\n }\n\n /**\n * {@inheritDoc CngxStepperHost.canNavigateTo}\n *\n * Wraps the private {@link isLinearBlocked} predicate plus the\n * per-step `disabled` check. The header-reachability contract surface;\n * `isLinearBlocked` stays private so the organism reads this method,\n * never the internal gate.\n */\n canNavigateTo(index: number): boolean {\n const stepsOnly = this.stepsOnly();\n if (index < 0 || index >= stepsOnly.length) {\n return false;\n }\n if (stepsOnly[index].disabled()) {\n return false;\n }\n return !this.isLinearBlocked(index);\n }\n\n select(index: number): void {\n const stepsOnly = this.stepsOnly();\n if (stepsOnly.length === 0) {\n return;\n }\n const target = Math.max(0, Math.min(index, stepsOnly.length - 1));\n if (this.isLinearBlocked(target)) {\n return;\n }\n if (stepsOnly[target].disabled()) {\n return;\n }\n const previous = this.activeStepIndex();\n if (target === previous) {\n return;\n }\n\n const action = this.commitAction();\n if (!action) {\n // No-action fast path - sync move, no commit window opens, so\n // `originIndexDuringCommit` stays untouched. Clear the rejection\n // flag if the user re-picked a previously-failed target.\n this.activeStepIndex.set(target);\n this.lastCommittedIndex = target;\n if (this.lastFailedIndex() === target) {\n this.clearLastFailed();\n }\n return;\n }\n\n // Commit-gated transition. Pessimistic holds at `previous` until\n // the action resolves; optimistic advances now and rolls back on\n // rejection. Supersede comes from the lifted commit-controller -\n // a rapid second select() cancels the in-flight runner.\n //\n // Capture the safe-harbour origin exactly once on commit-window\n // open. Written ONLY on this path so a stale origin never lingers\n // into a non-commit navigation. The origin is the last TRULY\n // committed index, not `previous`: under a superseded optimistic\n // commit `previous` is the never-committed optimistic position.\n const origin = this.lastCommittedIndex ?? previous;\n // Record the origin as truly committed on window open: for the first\n // window `previous` IS the settled start position; for a superseding\n // select the field already holds the real one (idempotent).\n this.lastCommittedIndex = origin;\n this.originIndexDuringCommitState.set(origin);\n const mode = this.commitMode();\n if (mode === 'optimistic') {\n this.activeStepIndex.set(target);\n }\n this.commitHandler.beginTransition(previous, target, action, (outcome) => {\n if (outcome === 'accepted') {\n // Success - origin no longer needed; clear the rejection\n // marker if the user re-picked the rejected target.\n this.lastCommittedIndex = target;\n this.originIndexDuringCommitState.set(undefined);\n if (this.lastFailedIndex() === target) {\n this.clearLastFailed();\n }\n if (mode === 'pessimistic') {\n this.activeStepIndex.set(target);\n }\n return;\n }\n // Refused or failed - record the outcome on the target; RETAIN the\n // origin so `liveAnnouncement` can resolve the origin label for\n // the rich phrase. Both kinds roll back: optimistic returns to the\n // last truly-committed index, pessimistic never moved off it.\n this.lastOutcomeState.set({\n kind: outcome,\n index: target,\n sequence: ++this.outcomeSequence,\n });\n if (mode === 'optimistic') {\n this.activeStepIndex.set(origin);\n }\n });\n }\n\n selectNext(): void {\n const next = this.nextEnabledIndex();\n if (next < this.stepsOnly().length) {\n this.select(next);\n }\n }\n\n /**\n * Ungated back-move. Supersedes an in-flight commit: the runner is\n * canceled and the commit state settles to idle, so `busy` cannot\n * latch and a late resolve cannot yank the user forward off the step\n * they explicitly returned to.\n */\n selectPrevious(): void {\n const prev = this.previousEnabledIndex();\n if (prev >= 0) {\n this.cancelAndSettleCommit();\n this.originIndexDuringCommitState.set(undefined);\n this.lastCommittedIndex = prev;\n this.activeStepIndex.set(prev);\n }\n }\n\n selectById(id: string): void {\n const stepsOnly = this.stepsOnly();\n const idx = stepsOnly.findIndex((n) => n.id === id);\n if (idx >= 0) {\n this.select(idx);\n }\n }\n\n reset(): void {\n this.activeStepIndex.set(0);\n this.lastCommittedIndex = 0;\n this.originIndexDuringCommitState.set(undefined);\n this.lastOutcomeState.set(undefined);\n this.clearedSequenceState.set(undefined);\n // Settle mid-commit resets to idle - the surface lives on, so a\n // dangling 'pending' would latch busy() forever.\n this.cancelAndSettleCommit();\n }\n\n /**\n * Cancels the in-flight commit and settles the state to idle. The\n * settle option is load-bearing here - a custom\n * `CNGX_COMMIT_CONTROLLER_FACTORY` implementation that ignores it\n * leaves `busy` latched, which is invisible until a user backs out\n * mid-commit; the dev-mode probe surfaces that immediately.\n */\n private cancelAndSettleCommit(): void {\n this.commitController.cancel({ settle: true });\n if (typeof ngDevMode !== 'undefined' && ngDevMode && this.commitState.status() === 'pending') {\n cngxDevWarn(\n 'CNGX1040',\n '[cngxStepper] the commit controller ignored cancel({ settle: true }) - busy stays ' +\n 'latched. Honor the settle option in your CNGX_COMMIT_CONTROLLER_FACTORY override.',\n );\n }\n }\n}\n\nexport { type CngxStepStatus } from './stepper-host.token';\n","import { InjectionToken } from '@angular/core';\n\nimport type { CngxStepRegistration } from './stepper-host.token';\n\n/**\n * Contract a `CngxStep` sees when it injects a parent group via\n * {@link CNGX_STEP_GROUP_HOST}. Mirrors the presenter's `register` /\n * `unregister` so atoms stay agnostic of root vs. nested host.\n *\n * Surface is registration-only - `id` and `aggregatedStatus` are\n * concrete-class details, not part of the token contract.\n *\n * @category common/stepper\n */\nexport interface CngxStepGroupHost {\n register(handle: CngxStepRegistration): void;\n /** Instance-guarded like `CngxStepperHost.unregister` - see there. */\n unregister(id: string, handle?: CngxStepRegistration): void;\n}\n\n/**\n * DI token providing a `CngxStepGroup`'s contract to nested `CngxStep` atoms.\n * Steps inject this `optional: true` and fall back to {@link CNGX_STEPPER_HOST}.\n *\n * @category common/stepper\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-group-host.token.ts\n * @since 0.1.0\n */\nexport const CNGX_STEP_GROUP_HOST = new InjectionToken<CngxStepGroupHost>('CngxStepGroupHost');\n","import { InjectionToken, type Signal, type TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from './stepper-host.token';\n\n/**\n * Context delivered to `*cngxStepLabel` templates. Gives typed access\n * to live step state without reaching into the host token.\n *\n * `index` is 1-based in the step-only flat projection (groups excluded).\n * `active` reflects `presenter.activeStepId`; `busy` mirrors\n * `presenter.intendedStepIndex` matching this step; `disabled` reads\n * `node.disabled()`.\n *\n * @category common/stepper\n */\nexport interface CngxStepLabelContext {\n readonly node: CngxStepNode;\n readonly index: number;\n readonly active: boolean;\n readonly busy: boolean;\n readonly disabled: boolean;\n}\n\n/**\n * Context delivered to `*cngxStepContent` templates. Mirrors\n * {@link CngxStepLabelContext} - content templates need the same\n * derivations to gate inner controls on `disabled` / `busy`.\n *\n * @category common/stepper\n */\nexport interface CngxStepContentContext {\n readonly node: CngxStepNode;\n readonly index: number;\n readonly active: boolean;\n readonly busy: boolean;\n readonly disabled: boolean;\n}\n\n/**\n * Contract Level-4 organisms (and consumer-authored stepper skins)\n * consume to render the panel body. Narrower than the presenter's\n * full interface - just enough to project label / content templates\n * and react to active-step changes.\n *\n * @category common/stepper\n */\nexport interface CngxStepPanelHost {\n readonly flatSteps: Signal<readonly CngxStepNode[]>;\n readonly activeStepIndex: Signal<number>;\n readonly activeStepId: Signal<string | null>;\n /** Resolves a step id to its `*cngxStepLabel` template (consumer-supplied). */\n labelTemplateFor(id: string): TemplateRef<CngxStepLabelContext> | null;\n /** Resolves a step id to its `*cngxStepContent` template (consumer-supplied). */\n contentTemplateFor(id: string): TemplateRef<CngxStepContentContext> | null;\n}\n\n/**\n * DI token providing the rendering-surface contract to organism shells\n * (`<cngx-stepper>`, `<cngx-mat-stepper>`) and consumer-authored skins.\n *\n * @category common/stepper\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-panel-host.token.ts\n * @since 0.1.0\n */\nexport const CNGX_STEP_PANEL_HOST = new InjectionToken<CngxStepPanelHost>('CngxStepPanelHost');\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepContentContext } from './step-panel-host.token';\n\n/**\n * Marker directive carrying a `CngxStep`'s content template.\n * Discovered via `contentChild(CngxStepContent)`. Typed with\n * {@link CngxStepContentContext} so `let-busy=\"busy\"` etc. gives\n * typed access to live step state.\n *\n * ```html\n * <ng-template cngxStepContent let-busy=\"busy\">\n * <input [disabled]=\"busy\">\n * </ng-template>\n * ```\n *\n * @category common/stepper\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-content.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStep, CngxStepLabel\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-step-content/typed-lazy-panels</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepContent]',\n standalone: true,\n})\nexport class CngxStepContent {\n readonly templateRef = inject<TemplateRef<CngxStepContentContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepLabelContext } from './step-panel-host.token';\n\n/**\n * Marker directive carrying a `CngxStep`'s label template.\n * Discovered via `contentChild(CngxStepLabel)`. Typed with\n * {@link CngxStepLabelContext} for typed `let-node=\"node\"` /\n * `let-active=\"active\"` access.\n *\n * ```html\n * <ng-template cngxStepLabel let-node=\"node\">\n * {{ node.label() }}\n * </ng-template>\n * ```\n *\n * @category common/stepper\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-label.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStep, CngxStepContent, CngxStepGroupHeader\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-custom-labels/mixing-code-label-code-input-with-code-cngxsteplabel-code-slot</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepLabel]',\n standalone: true,\n})\nexport class CngxStepLabel {\n readonly templateRef = inject<TemplateRef<CngxStepLabelContext>>(TemplateRef);\n}\n","import {\n computed,\n contentChild,\n DestroyRef,\n Directive,\n inject,\n input,\n type OnInit,\n type Signal,\n} from '@angular/core';\n\nimport { nextUid } from '@cngx/core/utils';\nimport { CngxRuntimeError } from '@cngx/utils';\n\nimport type { CngxErrorAggregatorContract } from '@cngx/common/interactive';\n\nimport { CNGX_STEP_GROUP_HOST } from './step-group-host.token';\nimport { CngxStepContent } from './step-content.directive';\nimport { CngxStepLabel } from './step-label.directive';\nimport {\n CNGX_STEPPER_HOST,\n type CngxStepRegistration,\n type CngxStepStatus,\n} from './stepper-host.token';\n\n/**\n * Single-step atom. Registers with the nearest host - either a\n * `CngxStepGroup` ({@link CNGX_STEP_GROUP_HOST}) or the root\n * `CngxStepperPresenter` ({@link CNGX_STEPPER_HOST}).\n *\n * `state` is a pure `computed` over `[disabled]`, `[completed]`, and\n * the optional `[errorAggregator]`'s `hasError()`.\n *\n * @category common/stepper\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepGroup, CngxStepperPresenter, CngxStepLabel, CngxStepContent\n * @slot cngxStepLabel The step's own header label.\n * @slot cngxStepContent The step body, rendered lazily when the step activates.\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-step-content/typed-lazy-panels</example-url>\n */\n@Directive({\n selector: '[cngxStep]',\n exportAs: 'cngxStep',\n standalone: true,\n})\nexport class CngxStep implements OnInit {\n readonly id = input<string>(nextUid('cngx-step'));\n readonly disabled = input<boolean>(false);\n readonly completed = input<boolean>(false);\n readonly label = input<string>('');\n readonly errorAggregator = input<CngxErrorAggregatorContract | undefined>(undefined);\n\n /**\n * Direct error flag for the common \"this step is invalid\" case - no\n * `errorAggregator` boilerplate required. `true` or a non-empty string\n * drives the error state; a string doubles as the inline message\n * (surfaced via the `*cngxStepError` slot and the mini-skin aggregate\n * line). `false` / `''` clear it. The aggregator stays the rich\n * multi-source forms path; the two channels compose (either errors).\n */\n readonly error = input<string | boolean>(false);\n\n /**\n * Resolved direct-error message: the `[error]` string when non-empty,\n * else `undefined`. Carried onto the registration / node so the error\n * slot + aggregate line can render it. `computed` over the input -\n * never written.\n */\n readonly errorMessage: Signal<string | undefined> = computed(() => {\n const value = this.error();\n return typeof value === 'string' && value !== '' ? value : undefined;\n });\n\n protected readonly labelSlot = contentChild(CngxStepLabel);\n protected readonly contentSlot = contentChild(CngxStepContent);\n\n readonly labelTemplate = this.labelSlot;\n readonly contentTemplate = this.contentSlot;\n\n /** Per-step status derived from inputs + aggregator - never written. */\n readonly state: Signal<CngxStepStatus> = computed(() => {\n if (this.disabled()) {\n return 'disabled';\n }\n const directError = this.error();\n const errored =\n (directError !== false && directError !== '') ||\n (this.errorAggregator()?.hasError?.() ?? false);\n if (errored) {\n return 'error';\n }\n if (this.completed()) {\n return 'success';\n }\n return 'idle';\n });\n\n private readonly groupHost = inject(CNGX_STEP_GROUP_HOST, { optional: true });\n private readonly stepperHost = inject(CNGX_STEPPER_HOST, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n\n constructor() {\n if (!this.groupHost && !this.stepperHost) {\n throw new CngxRuntimeError(\n 'CNGX1046',\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n '[cngxStep] must be placed inside an element with [cngxStepper], such as ' +\n '<cngx-stepper>, directly or through a [cngxStepGroup] inside it.',\n );\n }\n }\n\n ngOnInit(): void {\n // Register in ngOnInit, NOT the constructor: a bound `[id]` signal\n // input is not applied until the first change detection, so a\n // constructor read captures the default auto-id. The registered id is\n // the key the router-sync deep-link seed and consumers match against,\n // so it must reflect the bound `[id]`. ngOnInit still runs before the\n // host's ngAfterContentInit, so the seed's registry precondition holds;\n // and it fires ancestor-group-before-descendant-step in DOM order, so\n // the presenter's insertion-order tree is unchanged. Mirrors CngxTab.\n const host = this.groupHost ?? this.stepperHost!;\n const stepId = this.id();\n const handle: CngxStepRegistration = {\n id: stepId,\n kind: 'step',\n label: this.label,\n disabled: this.disabled,\n state: this.state,\n errorAggregator: this.errorAggregator,\n errorMessage: this.errorMessage,\n };\n host.register(handle);\n this.destroyRef.onDestroy(() => host.unregister(stepId, handle));\n }\n}\n","import {\n computed,\n DestroyRef,\n Directive,\n inject,\n input,\n signal,\n type OnInit,\n type Signal,\n} from '@angular/core';\n\nimport { nextUid } from '@cngx/core/utils';\nimport { CngxRuntimeError } from '@cngx/utils';\n\nimport { CNGX_STEP_GROUP_HOST, type CngxStepGroupHost } from './step-group-host.token';\nimport { injectStepperConfig } from './stepper-config';\nimport {\n CNGX_STEPPER_HOST,\n type CngxStepRegistration,\n type CngxStepStatus,\n} from './stepper-host.token';\n\n/**\n * Step-group atom. Registers with the root presenter as a `kind: 'group'`\n * node and provides {@link CNGX_STEP_GROUP_HOST} so nested `CngxStep`\n * atoms register with the group, not the root.\n *\n * `aggregatedStatus` rolls up child states: `error` if any errored,\n * `success` if all are success, `pending` if any is pending or busy,\n * otherwise `idle`.\n *\n * @category common/stepper\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-group.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStep, CngxStepperPresenter, CngxStepGroupHeader\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-hierarchical/group-nested-steps-trailing-root-step</example-url>\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-hierarchical/expand-active-group-collapse</example-url>\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-hierarchical/group-collapse-summary-count</example-url>\n */\n@Directive({\n selector: '[cngxStepGroup]',\n exportAs: 'cngxStepGroup',\n standalone: true,\n providers: [{ provide: CNGX_STEP_GROUP_HOST, useExisting: CngxStepGroup }],\n})\nexport class CngxStepGroup implements CngxStepGroupHost, OnInit {\n readonly id = input<string>(nextUid('cngx-step-group'));\n readonly disabled = input<boolean>(false);\n readonly label = input<string>('');\n\n private readonly config = injectStepperConfig();\n\n // Local child registry - only feeds `aggregatedStatus` below.\n // The presenter owns the canonical tree.\n private readonly childRegistry = signal<readonly CngxStepRegistration[]>([]);\n\n readonly aggregatedStatus: Signal<CngxStepStatus> = computed(\n () => {\n const states = this.childRegistry().map((c) => c.state());\n if (states.length === 0) {\n return 'idle';\n }\n if (states.some((s) => s === 'error')) {\n return 'error';\n }\n if (states.some((s) => s === 'pending')) {\n // 'pending' can only come from a nested group's own rollup; leaf\n // steps never produce it ('busy' is a per-step presenter concern,\n // not a step state, so no 'busy' arm exists here).\n return 'pending';\n }\n if (states.every((s) => s === 'success')) {\n return 'success';\n }\n return 'idle';\n },\n { equal: Object.is },\n );\n\n private readonly stepperHost = inject(CNGX_STEPPER_HOST, { optional: true });\n\n // A group nested inside another group must register through its parent\n // (skipSelf past our own CNGX_STEP_GROUP_HOST provider), or it would\n // silently register as a root and flatten the tree.\n private readonly parentGroupHost = inject(CNGX_STEP_GROUP_HOST, {\n optional: true,\n skipSelf: true,\n });\n\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * `true` when this group's children are collapsed to the header node:\n * the focus-driven policy is `'expand-active'`, this group does not\n * hold the active step, and it has at least one child. Pure\n * `computed()` over the host's `activeGroupId` + the resolved policy -\n * never toggled in an event handler (Pillar 1).\n *\n * Consumer-readable via `exportAs: 'cngxStepGroup'` (e.g.\n * `#g=\"cngxStepGroup\"` then `g.isCollapsed()`). The rendered strip\n * group header owns the reactive `aria-expanded` disclosure attribute\n * (`<cngx-stepper>` `groupAriaExpanded`); the projected `[cngxStepGroup]`\n * host element is not rendered in the strip, so it carries no ARIA.\n */\n readonly isCollapsed: Signal<boolean> = computed(() => {\n if (this.config.groupCollapse !== 'expand-active') {\n return false;\n }\n if (this.childRegistry().length === 0) {\n return false;\n }\n return this.stepperHost?.activeGroupId() !== this.id();\n });\n\n constructor() {\n if (!this.stepperHost) {\n throw new CngxRuntimeError(\n 'CNGX1047',\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n '[cngxStepGroup] must be placed inside an element with [cngxStepper], ' +\n 'such as <cngx-stepper>.',\n );\n }\n }\n\n ngOnInit(): void {\n // Register in ngOnInit, not the constructor, so a bound `[id]` reaches\n // the registry (see CngxStep). A group MUST register before its child\n // steps or the presenter drops the orphaned children; ngOnInit fires an\n // ancestor group before its descendant steps, so that order holds, and\n // groups and steps share one lifecycle phase - keeping the presenter's\n // insertion-order tree identical to the previous constructor ordering.\n const registrationHost = this.parentGroupHost ?? this.stepperHost!;\n const groupId = this.id();\n const handle: CngxStepRegistration = {\n id: groupId,\n kind: 'group',\n label: this.label,\n disabled: this.disabled,\n state: this.aggregatedStatus,\n };\n registrationHost.register(handle);\n this.destroyRef.onDestroy(() => registrationHost.unregister(groupId, handle));\n }\n\n register(handle: CngxStepRegistration): void {\n this.childRegistry.update((cur) => [...cur, handle]);\n // Forward to the root with this group as parent so the tree shape is correct.\n this.stepperHost!.register(handle, this.id());\n }\n\n unregister(id: string, handle?: CngxStepRegistration): void {\n // Same instance guard as the presenter: only evict the exact handle\n // (or fall back to id-keyed removal for handle-less callers).\n this.childRegistry.update((cur) =>\n cur.filter((c) => (handle !== undefined ? c !== handle : c.id !== id)),\n );\n this.stepperHost!.unregister(id, handle);\n }\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode, CngxStepStatus } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepIndicator` template. Drives the\n * numbered / checkmark / error glyph inside each step button. The\n * `<button>` shell - `aria-current`, `aria-controls`, click handler -\n * stays library-owned.\n *\n * `status` mirrors `node.state()`. `busy` is the presenter-derived\n * \"this step is the in-flight commit target\" flag - independent of\n * `status === 'pending'` (which is the aggregate landmark state).\n *\n * @category common/stepper/slots\n */\nexport interface CngxStepIndicatorContext {\n /** Convenience alias for `position` - usable as `let-position` shorthand. */\n readonly $implicit: number;\n /** 1-based position of this step in the flat step-only projection. */\n readonly position: number;\n /** The step node carrying id / label / disabled / state signals. */\n readonly node: CngxStepNode;\n /** `true` when this step is the current `activeStepId`. */\n readonly active: boolean;\n /** Live step status - drives the visual variant (idle / success / error / busy). */\n readonly status: CngxStepStatus;\n /** `true` when this step is the in-flight commit target. */\n readonly busy: boolean;\n}\n\n/**\n * Slot directive for the indicator-glyph template on `<cngx-stepper>`.\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.indicator` before falling back to\n * the built-in numeric span (`{{ position }}`).\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepIndicator let-position let-node=\"node\" let-status=\"status\">\n * @if (status === 'success') {\n * <my-icon name=\"check\" />\n * } @else if (status === 'error') {\n * <my-icon name=\"alert\" />\n * } @else {\n * <span class=\"my-step-num\">{{ position }}</span>\n * }\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @category common/stepper/slots\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-indicator.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepBadge, CngxStepBusySpinner, CngxStepRejection, CngxStepGroupHeader\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/custom-indicator-glyph-via-code-cngxstepindicator-code</example-url>\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/cross-skin-indicator-override</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepIndicator]',\n exportAs: 'cngxStepIndicator',\n standalone: true,\n})\nexport class CngxStepIndicator {\n readonly templateRef = inject<TemplateRef<CngxStepIndicatorContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepBadge` template. Drives the error\n * badge inside a step button when `errorAggregator?.shouldShow()` is\n * truthy. Consumers swap the built-in `'!'` glyph for a counter pill\n * or branded marker; the visibility gate stays library-owned.\n *\n * @category common/stepper/slots\n */\nexport interface CngxStepBadgeContext {\n /** Aggregated error count for this step (≥ 1 when shown). */\n readonly count: number;\n /** The step node carrying id / label / state signals. */\n readonly node: CngxStepNode;\n}\n\n/**\n * Slot directive for the error-badge template on `<cngx-stepper>`.\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.badge` before falling back to\n * `CNGX_STEPPER_GLYPHS.errorBadge`.\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepBadge let-count=\"count\">\n * <span class=\"my-badge-pill\">{{ count }}</span>\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @category common/stepper/slots\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-badge.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepIndicator, CngxStepBusySpinner, CngxStepRejection\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/custom-error-badge-via-code-cngxstepbadge-code</example-url>\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-error-aggregation/per-step-error-badges</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepBadge]',\n exportAs: 'cngxStepBadge',\n standalone: true,\n})\nexport class CngxStepBadge {\n readonly templateRef = inject<TemplateRef<CngxStepBadgeContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepBusySpinner` template. Drives the\n * pending-commit overlay on the in-flight target step. Renders only\n * when the step matches `presenter.intendedStepIndex()` with\n * `commitState.status() === 'pending'`.\n *\n * @category common/stepper/slots\n */\nexport interface CngxStepBusySpinnerContext {\n /** The step node carrying id / label / state signals. */\n readonly node: CngxStepNode;\n}\n\n/**\n * Slot directive for the busy-spinner template on `<cngx-stepper>`.\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.busySpinner` before falling back to\n * the built-in pulse-animation span.\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepBusySpinner>\n * <my-spinner size=\"sm\" />\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @category common/stepper/slots\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-busy-spinner.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepIndicator, CngxStepBadge, CngxStepRejection\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/custom-busy-spinner-via-code-cngxstepbusyspinner-code</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepBusySpinner]',\n exportAs: 'cngxStepBusySpinner',\n standalone: true,\n})\nexport class CngxStepBusySpinner {\n readonly templateRef = inject<TemplateRef<CngxStepBusySpinnerContext>>(\n TemplateRef,\n );\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepRejection` template. Renders on the\n * strip step the most recent commit was rolled back FROM - sibling of\n * the tabs `cngxTabRejectionIcon` slot. Renders only when\n * `presenter.lastFailedIndex()` matches the step's flat-index.\n *\n * `reason` tells the two commit outcomes apart: `'refused'` when the\n * commit action answered `false`, `'failed'` when it threw, rejected or\n * errored. Both render the slot; pick a glyph or copy per reason.\n *\n * `originLabel` is the safe-harbour step's label, derived from\n * `presenter.originIndexDuringCommit()`. May be `undefined` when the\n * origin index is out of range (synchronous-rejection edge case);\n * gate richer UI on its presence.\n *\n * @category common/stepper/slots\n */\nexport interface CngxStepRejectionContext {\n /** Flat-index of the rejected step (`presenter.lastFailedIndex()`). */\n readonly failedIndex: number;\n /** Resolved label of the safe-harbour step, when derivable. */\n readonly originLabel: string | undefined;\n /** The rejected step node carrying id / label / state signals. */\n readonly node: CngxStepNode;\n /** Why the commit did not land (`presenter.lastOutcome().kind`). */\n readonly reason: 'refused' | 'failed';\n}\n\n/**\n * Slot directive for the rejection-decoration template on\n * `<cngx-stepper>`. Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.rejection` before falling back to\n * `CNGX_STEPPER_GLYPHS.rejectionIcon`.\n *\n * Symmetric context shape with the upcoming tabs `cngxTabRejectionIcon`\n * slot so consumer templates port directly between the two families.\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepRejection let-failedIndex=\"failedIndex\" let-originLabel=\"originLabel\">\n * <my-icon name=\"rollback\" />\n * @if (originLabel) {\n * <span class=\"cngx-sr-only\">Rolled back to {{ originLabel }}</span>\n * }\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @category common/stepper/slots\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-rejection.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepBadge, CngxStepIndicator, CngxStepBusySpinner\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/rejection-decoration-via-code-cngxsteprejection-code</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepRejection]',\n exportAs: 'cngxStepRejection',\n standalone: true,\n})\nexport class CngxStepRejection {\n readonly templateRef = inject<TemplateRef<CngxStepRejectionContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepError` template. Renders the\n * validation-error reason for a step in the error state - sibling of\n * the commit-channel `*cngxStepRejection` slot. The two channels stay\n * distinct: rejection decorates the step a commit rolled back FROM;\n * this slot surfaces the per-step validation message.\n *\n * `message` resolves the direct `[error]` string > the first\n * aggregator label > the i18n `errored` status phrase, so a template\n * that renders `{{ message }}` always shows a non-empty reason.\n * `errorLabels` / `announcement` expose the richer aggregator surface\n * for consumers that want a list or the full SR phrase.\n *\n * @category common/stepper/slots\n */\nexport interface CngxStepErrorContext {\n /** The errored step node carrying id / label / state signals. */\n readonly node: CngxStepNode;\n /** Resolved error reason (direct `[error]` string > aggregator label > i18n). */\n readonly message: string;\n /** Aggregator error labels, or an empty array when none. */\n readonly errorLabels: readonly string[];\n /** Aggregator SR announcement phrase, or an empty string when none. */\n readonly announcement: string;\n}\n\n/**\n * Slot directive for the per-step error-message template on\n * `<cngx-stepper>`. Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.stepError` before falling back to the\n * built-in `{{ message }}` text. Mirrors {@link CngxStepRejection} so\n * consumer-authored templates read the same way across both channels.\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepError let-message=\"message\" let-errorLabels=\"errorLabels\">\n * <strong>{{ message }}</strong>\n * @if (errorLabels.length > 1) {\n * <ul>\n * @for (label of errorLabels; track label) {\n * <li>{{ label }}</li>\n * }\n * </ul>\n * }\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @category common/stepper/slots\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-error.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepRejection, CngxStepBadge, CngxStep\n */\n@Directive({\n selector: 'ng-template[cngxStepError]',\n exportAs: 'cngxStepError',\n standalone: true,\n})\nexport class CngxStepError {\n readonly templateRef = inject<TemplateRef<CngxStepErrorContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode, CngxStepStatus } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepGroupHeader` template. Drives the\n * group-row landmark for `kind === 'group'` nodes. The `role=\"group\"`\n * + `aria-roledescription` shell stays library-owned.\n *\n * `group` carries a `CngxStepNode` with the runtime guarantee\n * `kind === 'group'` (the slot only fires for group nodes).\n * `expanded` is reserved for future collapsible groups - passed `true`\n * today; declaring it now avoids a breaking change later.\n *\n * @category common/stepper/slots\n */\nexport interface CngxStepGroupHeaderContext {\n /** The group node carrying id / label / state / children signals. */\n readonly group: CngxStepNode;\n /** Reserved - `true` while the group's children are visible. */\n readonly expanded: boolean;\n /** Aggregated group status (rolls up children - drives heading variant). */\n readonly status: CngxStepStatus;\n}\n\n/**\n * Slot directive for the group-header template on `<cngx-stepper>`.\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.groupHeader` before falling back to\n * the built-in `<span class=\"cngx-stepper__group-label\">`.\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepGroupHeader let-group=\"group\" let-status=\"status\">\n * <h4 [class.is-error]=\"status === 'error'\">{{ group.label() }}</h4>\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @category common/stepper/slots\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-group-header.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepGroup, CngxStepIndicator, CngxStepLabel\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/custom-group-header-via-code-cngxstepgroupheader-code</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepGroupHeader]',\n exportAs: 'cngxStepGroupHeader',\n standalone: true,\n})\nexport class CngxStepGroupHeader {\n readonly templateRef = inject<TemplateRef<CngxStepGroupHeaderContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\n/**\n * Slot directive for the empty-state placeholder on `<cngx-stepper>`.\n * Rendered when `flatSteps()` is empty - async-loading or\n * server-driven step lists get a \"no steps yet\" landmark rather than\n * a collapsed strip.\n *\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.empty` before falling back to no\n * markup (Honest-Absence default).\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepperEmpty>\n * <cngx-empty-state heading=\"No steps configured yet\" />\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @category common/stepper/slots\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/stepper-empty.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepIndicator, CngxStepGroupHeader\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/empty-state-placeholder-via-code-cngxstepperempty-code</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepperEmpty]',\n exportAs: 'cngxStepperEmpty',\n standalone: true,\n})\nexport class CngxStepperEmpty {\n readonly templateRef = inject<TemplateRef<void>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxDotStepperDot` template. Drives the dot\n * body inside `<cngx-dot-stepper>` and inside the dots mobile-collapse\n * branch of `<cngx-stepper>`. The dot shell - role, `aria-current`,\n * `aria-label`, class modifiers - stays library-owned; only the dot body content becomes\n * overrideable so consumers can swap the default empty body for an\n * icon, glyph, or branded indicator.\n *\n * Smaller than {@link CngxStepIndicatorContext} on purpose - the dot\n * stepper does not surface step status/busy state visually, so the\n * context strips to the four fields a consumer actually needs.\n *\n * @category common/stepper/slots\n */\nexport interface CngxDotStepperDotContext {\n /** Convenience alias for `index` - usable as `let-index` shorthand. */\n readonly $implicit: number;\n /** 0-based position of this dot in the step-only projection. */\n readonly index: number;\n /** The step node carrying id / label / state signals. */\n readonly node: CngxStepNode;\n /** `true` when this dot represents the current active step. */\n readonly active: boolean;\n /** `true` when this dot represents a completed (already-traversed) step. */\n readonly completed: boolean;\n}\n\n/**\n * Slot directive for the dot-body template on `<cngx-dot-stepper>` and on\n * `<cngx-stepper>` (dots mobile-collapse branch, `mobileCollapse: 'dots'`).\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.dotStepperDot` before falling back to\n * the built-in empty body (the span itself paints the dot fill via CSS).\n *\n * ```html\n * <cngx-dot-stepper [(activeStepIndex)]=\"active\" aria-label=\"Carousel\">\n * <ng-template cngxDotStepperDot let-index let-active=\"active\" let-completed=\"completed\">\n * @if (active) {\n * <svg viewBox=\"0 0 10 10\" aria-hidden=\"true\"><circle cx=\"5\" cy=\"5\" r=\"3\" fill=\"currentColor\" /></svg>\n * } @else if (completed) {\n * <svg viewBox=\"0 0 10 10\" aria-hidden=\"true\"><path d=\"M2 5l2 2 4-4\" stroke=\"currentColor\" fill=\"none\" /></svg>\n * }\n * </ng-template>\n * <div cngxStep label=\"Slide 1\"></div>\n * <div cngxStep label=\"Slide 2\"></div>\n * </cngx-dot-stepper>\n * ```\n *\n * @category common/stepper/slots\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/dot-stepper-dot.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepIndicator, CngxStepBadge, CngxStepBusySpinner, CngxStepRejection\n * <example-url>http://localhost:4200/#/ui/stepper/dot-stepper/icon-dots-via-code-cngxdotstepperdot-code</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxDotStepperDot]',\n exportAs: 'cngxDotStepperDot',\n standalone: true,\n})\nexport class CngxDotStepperDot {\n readonly templateRef = inject<TemplateRef<CngxDotStepperDotContext>>(TemplateRef);\n}\n","import { computed, type Signal, type TemplateRef } from '@angular/core';\n\nimport type { CngxStepperConfig } from '../stepper-config';\nimport type {\n CngxStepBadge,\n CngxStepBadgeContext,\n} from './step-badge.directive';\nimport type {\n CngxStepBusySpinner,\n CngxStepBusySpinnerContext,\n} from './step-busy-spinner.directive';\nimport type {\n CngxStepGroupHeader,\n CngxStepGroupHeaderContext,\n} from './step-group-header.directive';\nimport type {\n CngxStepIndicator,\n CngxStepIndicatorContext,\n} from './step-indicator.directive';\nimport type {\n CngxStepError,\n CngxStepErrorContext,\n} from './step-error.directive';\nimport type {\n CngxStepRejection,\n CngxStepRejectionContext,\n} from './step-rejection.directive';\nimport type { CngxStepperEmpty } from './stepper-empty.directive';\nimport type {\n CngxDotStepperDot,\n CngxDotStepperDotContext,\n} from './dot-stepper-dot.directive';\n\n/**\n * Inputs to {@link createStepperTemplateBindings}. The organism owns\n * the `contentChild()` queries (NG8110 - must run in component\n * injection context) and the resolved {@link CngxStepperConfig}; this\n * factory absorbs the 3-stage cascade per slot key.\n *\n * @category common/stepper/slots\n */\nexport interface CngxStepperTemplateBindingsOptions {\n readonly indicatorSlot: Signal<CngxStepIndicator | undefined>;\n readonly badgeSlot: Signal<CngxStepBadge | undefined>;\n readonly busySpinnerSlot: Signal<CngxStepBusySpinner | undefined>;\n readonly rejectionSlot: Signal<CngxStepRejection | undefined>;\n /** Optional - the error slot is desktop-label-area only; absent on variants that have no label region. */\n readonly errorSlot?: Signal<CngxStepError | undefined>;\n readonly groupHeaderSlot: Signal<CngxStepGroupHeader | undefined>;\n readonly emptySlot: Signal<CngxStepperEmpty | undefined>;\n /** Optional - only hosts with a dots branch query `*cngxDotStepperDot`; without it the config template still applies. */\n readonly dotSlot?: Signal<CngxDotStepperDot | undefined>;\n readonly config: CngxStepperConfig;\n}\n\n/**\n * Output of {@link createStepperTemplateBindings}. One resolved\n * `Signal<TemplateRef | null>` per slot - `null` falls through to the\n * organism's built-in default markup.\n *\n * @category common/stepper/slots\n */\nexport interface CngxStepperTemplateBindings {\n readonly indicator: Signal<TemplateRef<CngxStepIndicatorContext> | null>;\n readonly badge: Signal<TemplateRef<CngxStepBadgeContext> | null>;\n readonly busySpinner: Signal<TemplateRef<CngxStepBusySpinnerContext> | null>;\n readonly rejection: Signal<TemplateRef<CngxStepRejectionContext> | null>;\n readonly stepError: Signal<TemplateRef<CngxStepErrorContext> | null>;\n readonly groupHeader: Signal<TemplateRef<CngxStepGroupHeaderContext> | null>;\n readonly empty: Signal<TemplateRef<void> | null>;\n readonly dot: Signal<TemplateRef<CngxDotStepperDotContext> | null>;\n}\n\n/**\n * Wires the 3-stage template cascade for the `<cngx-stepper>` skin\n * slots: per-instance directive > `CNGX_STEPPER_CONFIG.templates.<key>`\n * > `null` (built-in default).\n *\n * Pure - no DI, no side effects. Safe to call from a field-init\n * block. Sibling of `createTabOverflowTemplateBindings` and the\n * family-wide `createTemplateRegistry`.\n *\n * Tabs has no parallel slot surface yet - see\n * `stepper-accepted-debt §3` for the planned Phase-4 closure.\n *\n * @category common/stepper/slots\n */\nexport function createStepperTemplateBindings(\n opts: CngxStepperTemplateBindingsOptions,\n): CngxStepperTemplateBindings {\n return {\n indicator: computed<TemplateRef<CngxStepIndicatorContext> | null>(\n () =>\n opts.indicatorSlot()?.templateRef ??\n opts.config.templates?.indicator ??\n null,\n ),\n badge: computed<TemplateRef<CngxStepBadgeContext> | null>(\n () =>\n opts.badgeSlot()?.templateRef ??\n opts.config.templates?.badge ??\n null,\n ),\n busySpinner: computed<TemplateRef<CngxStepBusySpinnerContext> | null>(\n () =>\n opts.busySpinnerSlot()?.templateRef ??\n opts.config.templates?.busySpinner ??\n null,\n ),\n rejection: computed<TemplateRef<CngxStepRejectionContext> | null>(\n () =>\n opts.rejectionSlot()?.templateRef ??\n opts.config.templates?.rejection ??\n null,\n ),\n stepError: computed<TemplateRef<CngxStepErrorContext> | null>(\n () =>\n opts.errorSlot?.()?.templateRef ??\n opts.config.templates?.stepError ??\n null,\n ),\n groupHeader: computed<TemplateRef<CngxStepGroupHeaderContext> | null>(\n () =>\n opts.groupHeaderSlot()?.templateRef ??\n opts.config.templates?.groupHeader ??\n null,\n ),\n empty: computed<TemplateRef<void> | null>(\n () =>\n opts.emptySlot()?.templateRef ??\n opts.config.templates?.empty ??\n null,\n ),\n dot: computed<TemplateRef<CngxDotStepperDotContext> | null>(\n () =>\n opts.dotSlot?.()?.templateRef ??\n opts.config.templates?.dotStepperDot ??\n null,\n ),\n };\n}\n","/**\n * Default glyphs for `<cngx-stepper>` skin slots. Used when neither a\n * per-instance slot directive nor `CNGX_STEPPER_CONFIG.templates.<key>`\n * overrides the built-in span. Sibling of `CNGX_SELECT_GLYPHS` /\n * `CNGX_TABS_GLYPHS`.\n *\n * Exported with `@internal` so the organism (and mat-twin) can share\n * the literals across the secondary-entry boundary that Sheriff\n * forbids deep-relative imports across. Consumers customise via\n * `*cngxStep*` slots or `withStep*Template` features.\n *\n * @internal\n * @category common/stepper\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/glyphs.ts\n * @since 0.1.0\n */\nexport const CNGX_STEPPER_GLYPHS = {\n /** Default visual for `*cngxStepBadge` when no override is bound. */\n errorBadge: '!',\n /** Default visual for `*cngxStepRejection` on a failed commit when no override is bound. */\n rejectionIcon: '!',\n /**\n * Default visual for `*cngxStepRejection` on a refused commit (the action\n * answered `false`). A distinct glyph, so a refusal never differs from a\n * failure by colour alone (WCAG 1.4.1).\n */\n refusedIcon: '\\u2298',\n} as const;\n","import {\n afterNextRender,\n computed,\n DestroyRef,\n Directive,\n effect,\n inject,\n input,\n output,\n untracked,\n type AfterContentInit,\n} from '@angular/core';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, NavigationEnd, Router } from '@angular/router';\nimport { cngxDevWarn } from '@cngx/utils';\nimport { filter } from 'rxjs/operators';\n\nimport { injectStepperConfig } from './stepper-config';\nimport { injectStepperHost } from './stepper-host.token';\n\n/**\n * URL deep-linking for the stepper. Bidirectional sync between\n * `activeStepId` and a URL fragment / query-param. Opt-in via\n * `[cngxStepperRouterSync]` on the presenter element.\n *\n * - `mode = 'fragment'` (default) → `#step=customer`\n * - `mode = 'queryParam'` with `paramName = 'step'` → `?step=customer`\n *\n * `Router` is optional - without `@angular/router` the directive\n * dev-warns once and becomes a no-op.\n *\n * @category common/stepper\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/router-sync.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepperPresenter, CNGX_STEPPER_CONFIG\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-router-sync/deep-linking-with-fragment-queryparam-modes</example-url>\n */\n@Directive({\n selector: '[cngxStepperRouterSync]',\n exportAs: 'cngxStepperRouterSync',\n standalone: true,\n})\nexport class CngxStepperRouterSync implements AfterContentInit {\n // Default undefined so the cascade resolves through CNGX_STEPPER_CONFIG.\n // Init-only: the seed and the write effect capture the resolved mode /\n // param on their first run; changing either after init leaves the old\n // URL key behind. Rebuild the directive to change them.\n readonly modeInput = input<'fragment' | 'queryParam' | undefined>(undefined, { alias: 'mode' });\n readonly paramNameInput = input<string | undefined>(undefined, {\n alias: 'paramName',\n });\n\n private readonly config = injectStepperConfig();\n\n readonly mode = computed<'fragment' | 'queryParam'>(\n () => this.modeInput() ?? this.config.routerSyncMode ?? 'fragment',\n );\n readonly paramName = computed<string>(\n () => this.paramNameInput() ?? this.config.routerSyncParam ?? 'step',\n );\n\n /** Emits when a `router.navigate` rejection is observed. */\n readonly syncError = output<unknown>();\n\n private readonly host = injectStepperHost('cngxStepperRouterSync', { host: true });\n private readonly router = inject(Router, { optional: true });\n\n /**\n * Latched once the URL seed has reached a registered step, so the\n * `afterNextRender` fallback cannot run it twice.\n *\n * The latch is load-bearing, not decorative: the seed goes through\n * `selectById` → `select()`, which opens a commit window. Under a\n * pessimistic commit `activeStepIndex` still holds the *previous* index\n * while the action is in flight, so the presenter's `target === previous`\n * bail does not catch the repeat - an unlatched fallback would fire the\n * consumer's commit-action a second time and supersede the first.\n */\n private seeded = false;\n\n constructor() {\n // Router is providedIn: 'root' and resolves without provideRouter(...);\n // ActivatedRoute does not, so it is the \"router is set up\" signal.\n const route = inject(ActivatedRoute, { optional: true });\n if (!this.router || !route) {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n afterNextRender(() => {\n cngxDevWarn(\n 'CNGX1031',\n '[cngxStepperRouterSync] no Router / ActivatedRoute available - the URL sync is a no-op. ' +\n 'Provide @angular/router via provideRouter(...) to enable deep-linking.',\n );\n });\n }\n return;\n }\n const router = this.router;\n\n // Fallback seed for steps that register after content-init (a dynamic\n // @for over an async step list). Idempotent against the content-init\n // seed via the `seeded` latch.\n afterNextRender(() => this.seedFromUrl(router));\n\n effect(() => {\n const id = this.host.activeStepId();\n if (!id) {\n return;\n }\n untracked(() => this.writeUrl(router, id));\n });\n\n const navEnd = toSignal(\n router.events.pipe(\n filter((e): e is NavigationEnd => e instanceof NavigationEnd),\n takeUntilDestroyed(inject(DestroyRef)),\n ),\n { initialValue: null },\n );\n effect(() => {\n const e = navEnd();\n if (!e) {\n return;\n }\n untracked(() => {\n const next = this.readUrlValue(router);\n if (next && next !== this.host.activeStepId()) {\n this.host.selectById(next);\n }\n });\n });\n }\n\n /**\n * Seed from the URL before the stepper renders its panels. `CngxStep`\n * registers in `ngOnInit` (so a bound `[id]` reaches the registry), which\n * runs before the host's `ngAfterContentInit` - the registry is populated\n * by the time this runs, and the host view has not rendered yet, which is\n * what keeps a `panelMode=\"lazy\"` default step from counting its first\n * render as a first activation on a deep link that named another step.\n *\n * Own router guard: the constructor's early return does not stop\n * lifecycle hooks from running.\n */\n ngAfterContentInit(): void {\n if (!this.router) {\n return;\n }\n this.seedFromUrl(this.router);\n }\n\n private seedFromUrl(router: Router): void {\n if (this.seeded) {\n return;\n }\n const initial = this.readUrlValue(router);\n if (!initial) {\n return;\n }\n // Only latch once the target is actually registered. A seed that found\n // no matching step leaves the fallback armed for steps that register\n // after content-init.\n if (!this.host.stepsOnly().some((n) => n.id === initial)) {\n return;\n }\n this.seeded = true;\n // No explicit URL correction on a refused (linear-blocked / disabled)\n // seed: the activeStepId write effect's first run flushes AFTER this\n // content-init hook and unconditionally reflects the ACTUAL active id\n // into the URL, so a refused deep link is rewritten on the same tick.\n // The refused-seed spec pins that guarantee.\n untracked(() => this.host.selectById(initial));\n }\n\n /**\n * Reflect `id` into the URL. Fragment mode re-serializes the existing\n * fragment params so foreign state (`#foo=1&step=x`) survives the\n * write; values are URI-encoded symmetric to {@link parseFragment}.\n */\n private writeUrl(router: Router, id: string): void {\n const navigation =\n this.mode() === 'fragment'\n ? router.navigate([], {\n fragment: this.serializeFragment(router, id),\n queryParamsHandling: 'merge',\n replaceUrl: true,\n })\n : router.navigate([], {\n queryParams: { [this.paramName()]: id },\n queryParamsHandling: 'merge',\n replaceUrl: true,\n });\n navigation.catch?.((err: unknown) => this.syncError.emit(err));\n }\n\n private serializeFragment(router: Router, id: string): string {\n const param = this.paramName();\n const current = router.routerState.snapshot.root.fragment ?? '';\n const segments = current\n .split('&')\n .filter((seg) => seg !== '' && seg.split('=')[0] !== param);\n segments.push(`${param}=${encodeURIComponent(id)}`);\n return segments.join('&');\n }\n\n private readUrlValue(router: Router): string | null {\n if (this.mode() === 'fragment') {\n return this.parseFragment(router.routerState.snapshot.root.fragment ?? '');\n }\n return router.routerState.snapshot.root.queryParamMap.get(this.paramName()) ?? null;\n }\n\n private parseFragment(fragment: string): string | null {\n const param = this.paramName();\n const segments = fragment.split('&');\n for (const seg of segments) {\n const [key, val] = seg.split('=');\n if (key === param && val) {\n return decodeURIComponent(val);\n }\n }\n return null;\n }\n}\n","import type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type { CngxStepNode } from './stepper-host.token';\n\n/**\n * Resolve the status-pill label for a step node against the resolved\n * i18n bundle. Used by skins that surface a per-step status pill\n * (e.g. `stripe-status-rich`). Pure factory - no injection context,\n * no signal graph involvement.\n *\n * Resolution order:\n * 1. `success` data-state -> `statusLabels.done`\n * 2. `error` data-state -> `statusLabels.errored`\n * 3. `aria-current=\"step\"` -> `statusLabels.inProgress`\n * 4. otherwise -> `statusLabels.upNext`\n *\n * Group nodes (non-step) return an empty string.\n *\n * @category common/stepper\n */\nexport function resolveStepperStatusLabel(\n node: CngxStepNode,\n i18n: CngxStepperI18n,\n isActive: boolean,\n): string {\n if (node.kind !== 'step') {\n return '';\n }\n const labels = i18n.statusLabels;\n const state = node.state();\n return state === 'success'\n ? labels.done\n : state === 'error'\n ? labels.errored\n : isActive\n ? labels.inProgress\n : labels.upNext;\n}\n","import { computed, type Signal } from '@angular/core';\nimport { injectContainerSize } from '@cngx/common/layout';\n\nimport type { CngxStepperMobileCollapse } from './stepper-config';\n\n/**\n * Reads the stepper's collapse flag off its own container.\n *\n * The threshold is a `@container` rule in `stepper-base.css` writing\n * `--cngx-stepper-collapse` onto `.cngx-stepper::after`. It lands on the\n * pseudo-element because a container query cannot style its own container,\n * and the query container for a pseudo-element is selected from its\n * originating element's inclusive ancestors. Nothing here parses a width, so\n * a consumer re-aims the collapse with a plain CSS rule.\n *\n * Requires an injection context - it observes through `injectContainerSize`,\n * so the observer is scoped to the caller's `DestroyRef`. A field initialiser\n * on the stepper component is one; a bare call from a lifecycle hook is not.\n *\n * @param host The `<cngx-stepper>` host element, which is its own container.\n * @category common/stepper\n * @relatedTo createStepperDisplayMode, injectContainerSize\n */\nexport function injectStepperCollapse(host: Element): Signal<boolean> {\n const raw = injectContainerSize(host).property('--cngx-stepper-collapse', host, '::after');\n return computed(() => raw() === '1');\n}\n\n/**\n * Resolves the active stepper display mode by combining the collapse *signal*\n * - whether the stepper's own container is narrow - with the configured\n * `mobileCollapse` policy. `'classic'` keeps the full strip; `'text'` /\n * `'dots'` swap to the matching compact variant, `'off'` stays classic at any\n * width.\n *\n * The factory takes no DOM API and holds no threshold: *where* the collapse\n * happens is a `@container` rule in the stepper stylesheet, *what* it collapses\n * into is this policy. See `core-concepts/responsive-by-default.md`.\n *\n * @param collapsed `true` while the container sits below the collapse rung.\n * @param mobileCollapse The configured collapse policy, read lazily.\n * @category common/stepper\n */\nexport function createStepperDisplayMode(\n collapsed: Signal<boolean>,\n mobileCollapse: () => CngxStepperMobileCollapse | undefined,\n): Signal<'classic' | 'text' | 'dots'> {\n return computed(() => {\n if (!collapsed()) {\n return 'classic';\n }\n const mode = mobileCollapse() ?? 'text';\n return mode === 'off' ? 'classic' : mode;\n });\n}\n","import { computed, type Signal } from '@angular/core';\n\nimport type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type { CngxStepperGroupSummary } from './stepper-config';\nimport type { CngxStepNode } from './stepper-host.token';\n\n/**\n * Collapsed-group summary view consumed by `<cngx-stepper>`. Resolves\n * the `groupCollapseSummary` mode and the per-group `progress` / `count`\n * text, the `status`-dot gate, and the SR phrase. Pure derivation over\n * the group's subtree step states; rendered only on collapsed groups.\n *\n * @category common/stepper\n */\nexport interface CngxStepperGroupSummaryView {\n /** Resolved summary mode (config cascade, default `'progress'`). */\n readonly mode: Signal<CngxStepperGroupSummary>;\n /** Visible badge text for `progress`/`count`, else `null`. */\n text(node: CngxStepNode): string | null;\n /** `true` when a status dot should render (mode `status`, group collapsed). */\n showStatus(node: CngxStepNode): boolean;\n /** Screen-reader phrase for `progress`/`count`, else `null`. */\n srText(node: CngxStepNode): string | null;\n}\n\n/**\n * Options for {@link createStepperGroupSummary}.\n *\n * @internal\n */\nexport interface CngxStepperGroupSummaryOptions {\n /** Raw `groupCollapseSummary` config value (may be undefined). */\n readonly summaryMode: () => CngxStepperGroupSummary | undefined;\n /** Whether a given group node is currently collapsed. */\n readonly isCollapsed: (node: CngxStepNode) => boolean;\n /** Resolved i18n bundle Signal for the SR phrases. */\n readonly i18n: Signal<\n Pick<\n CngxStepperI18n,\n | 'groupSummaryCount'\n | 'groupSummaryProgress'\n | 'groupSummaryCountShort'\n | 'groupSummaryProgressShort'\n >\n >;\n}\n\n/** Terminal-step totals for a group's subtree; reads each step `state()`. */\nfunction subtreeStats(node: CngxStepNode): { total: number; completed: number } {\n let total = 0;\n let completed = 0;\n const visit = (n: CngxStepNode): void => {\n if (n.kind === 'step') {\n total++;\n if (n.state() === 'success') {\n completed++;\n }\n }\n n.children.forEach(visit);\n };\n node.children.forEach(visit);\n return { total, completed };\n}\n\n/**\n * Builds the collapsed-group summary view. Level-2 helper so the\n * organism stays a thin renderer. `status` mode defers its SR phrasing\n * to the group's existing status-phrase span, so {@link srText} returns\n * `null` there. SR phrases resolve through the `CngxStepperI18n` bundle\n * when passed; English defaults otherwise.\n *\n * @category common/stepper\n */\nexport function createStepperGroupSummary(\n options: CngxStepperGroupSummaryOptions,\n): CngxStepperGroupSummaryView {\n const mode = computed<CngxStepperGroupSummary>(() => options.summaryMode() ?? 'progress');\n\n const text = (node: CngxStepNode): string | null => {\n const current = mode();\n if (current === 'off' || current === 'status' || !options.isCollapsed(node)) {\n return null;\n }\n const { total, completed } = subtreeStats(node);\n const i18n = options.i18n();\n return current === 'count'\n ? i18n.groupSummaryCountShort(total)\n : i18n.groupSummaryProgressShort(completed, total);\n };\n\n const showStatus = (node: CngxStepNode): boolean =>\n mode() === 'status' && options.isCollapsed(node);\n\n const srText = (node: CngxStepNode): string | null => {\n const current = mode();\n if (current === 'off' || current === 'status' || !options.isCollapsed(node)) {\n return null;\n }\n const { total, completed } = subtreeStats(node);\n if (current === 'count') {\n return options.i18n().groupSummaryCount(total);\n }\n return options.i18n().groupSummaryProgress(completed, total);\n };\n\n return { mode, text, showStatus, srText };\n}\n","import type { CngxStepNode, CngxStepperHost } from './stepper-host.token';\n\n/**\n * Collapsed-group pointer-navigation view consumed by `<cngx-stepper>`\n * under `groupCollapse: 'expand-active'`. A folded group header becomes a\n * click shortcut into its branch: activating it selects the group's first\n * navigable step, which then becomes the active group and expands as a\n * consequence (no in-place disclosure). Keyboard users reach the same\n * steps via the arrow-key contract, which already steps into a collapsed\n * group, so this is a supplementary pointer affordance.\n *\n * @category common/stepper\n */\nexport interface CngxStepperGroupNavigationView {\n /**\n * `true` when a collapsed group header offers a click shortcut: header\n * navigation is on, the group is folded, and at least one descendant\n * step is navigable right now. The expanded (active) group header is\n * never navigable - its steps are already on screen and clickable.\n */\n isNavigable(node: CngxStepNode): boolean;\n /**\n * Selects the group's first navigable step. No-op for an expanded\n * header, a navigation-off header, or a group with no reachable step.\n */\n select(node: CngxStepNode): void;\n /**\n * `true` when the group owns the active step (`activeGroupId`). Drives\n * the active-branch chip treatment on the header, independent of\n * `groupCollapse`, so the branch in focus reads distinctly even when\n * every group stays expanded.\n */\n isActive(node: CngxStepNode): boolean;\n}\n\n/**\n * Options for {@link createStepperGroupNavigation}.\n *\n * @internal\n */\nexport interface CngxStepperGroupNavigationOptions {\n /**\n * Host slice owning the flat projection (`flatSteps`, DFS order with\n * live `flatIndex`), the reachability predicate (`canNavigateTo`), the\n * commit-in-flight gate (`busy`), and the selection method (`select`).\n */\n readonly presenter: Pick<\n CngxStepperHost,\n 'flatSteps' | 'canNavigateTo' | 'busy' | 'select' | 'activeGroupId'\n >;\n /** Whether a given group node is currently folded. */\n readonly isCollapsed: (node: CngxStepNode) => boolean;\n /** `false` when `headerNavigation: 'none'` keeps every header inert. */\n readonly navigationEnabled: () => boolean;\n}\n\n/**\n * Builds the collapsed-group pointer-navigation view. Level-2 helper so\n * the organism stays a thin renderer.\n *\n * Indices resolve against `flatSteps` (DFS order, live `flatIndex`) rather\n * than `group.children` - the flattener spreads group nodes but leaves\n * their `children` as the tree projection where every step still carries\n * the seeded `-1`. Each candidate is gated by `canNavigateTo` + `busy`\n * (mirroring the step-header reachability), so a linear-blocked leading\n * step is skipped to the first reachable one.\n *\n * @category common/stepper\n */\nexport function createStepperGroupNavigation(\n options: CngxStepperGroupNavigationOptions,\n): CngxStepperGroupNavigationView {\n const { presenter } = options;\n const firstNavigableStepIndex = (group: CngxStepNode): number => {\n const flat = presenter.flatSteps();\n const byId = new Map(flat.map((node) => [node.id, node] as const));\n const isInGroup = (node: CngxStepNode): boolean => {\n let cur: CngxStepNode | undefined = node;\n while (cur && cur.parentId !== null) {\n if (cur.parentId === group.id) {\n return true;\n }\n cur = byId.get(cur.parentId);\n }\n return false;\n };\n for (const node of flat) {\n if (\n node.kind === 'step' &&\n isInGroup(node) &&\n presenter.canNavigateTo(node.flatIndex) &&\n !presenter.busy()\n ) {\n return node.flatIndex;\n }\n }\n return -1;\n };\n\n const isNavigable = (node: CngxStepNode): boolean =>\n options.navigationEnabled() &&\n options.isCollapsed(node) &&\n firstNavigableStepIndex(node) !== -1;\n\n const select = (node: CngxStepNode): void => {\n if (!isNavigable(node)) {\n return;\n }\n presenter.select(firstNavigableStepIndex(node));\n };\n\n const isActive = (node: CngxStepNode): boolean =>\n node.kind === 'group' && presenter.activeGroupId() === node.id;\n\n return { isNavigable, select, isActive };\n}\n","import { computed, type Signal } from '@angular/core';\n\nimport { coerceSignal } from '@cngx/core/utils';\n\nimport type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type {\n CngxStepperConfig,\n CngxStepperMobileIndicatorPosition,\n CngxStepperSkin,\n} from './stepper-config';\n\n/**\n * Input bundle for {@link createStepperHostAttrs}: the three per-instance\n * inputs (each `Signal<T | undefined>`) and the resolved config (read\n * synchronously at construction). Each cascade collapses through\n * `input ?? config ?? library-default`.\n *\n * @internal\n */\nexport interface CngxStepperHostAttrsInputs {\n readonly skin: Signal<CngxStepperSkin | undefined>;\n readonly connectors: Signal<boolean | undefined>;\n readonly mobileIndicatorPosition: Signal<CngxStepperMobileIndicatorPosition | undefined>;\n readonly config: CngxStepperConfig;\n}\n\n/**\n * Three host-attribute signals for `<cngx-stepper>`. Each is read by a\n * `[attr.data-*]` host binding on the organism.\n *\n * @internal\n */\nexport interface CngxStepperHostAttrs {\n readonly resolvedSkin: Signal<CngxStepperSkin>;\n readonly resolvedConnectors: Signal<boolean>;\n readonly resolvedMobileIndicatorPosition: Signal<CngxStepperMobileIndicatorPosition>;\n}\n\n/**\n * Level-2 helper resolving the three host-attribute cascades for\n * `<cngx-stepper>` (skin / connectors / mobileIndicatorPosition). Keeps\n * the organism class under the LOC guard while making the cascade\n * pattern reusable for any future host-attr the strip surfaces.\n *\n * Each computed honors Pillar 1 (Ableitung statt Verwaltung): per-instance\n * input wins over root config wins over library default. No manual sync.\n *\n * @internal\n */\nexport function createStepperHostAttrs(\n inputs: CngxStepperHostAttrsInputs,\n): CngxStepperHostAttrs {\n return {\n resolvedSkin: computed<CngxStepperSkin>(\n () => inputs.skin() ?? inputs.config.skin ?? 'classic',\n ),\n resolvedConnectors: computed<boolean>(\n () => inputs.connectors() ?? inputs.config.connectors ?? false,\n ),\n resolvedMobileIndicatorPosition: computed<CngxStepperMobileIndicatorPosition>(\n () => inputs.mobileIndicatorPosition() ?? inputs.config.mobileIndicatorPosition ?? 'top',\n ),\n };\n}\n\n/**\n * Input bundle for {@link createStepperAccname}: the two per-instance\n * accname inputs plus the resolved config and the i18n bundle Signal.\n *\n * @internal\n */\nexport interface CngxStepperAccnameInputs {\n readonly ariaLabel: Signal<string | undefined>;\n readonly ariaLabelledBy: Signal<string | undefined>;\n readonly config: CngxStepperConfig;\n readonly i18n: Signal<CngxStepperI18n>;\n}\n\n/**\n * Shared `aria-label` cascade for every stepper organism host\n * (`<cngx-stepper>` and the compact variants): a bound\n * `aria-labelledby` trumps and nulls the label out; otherwise the\n * per-instance input wins over `ariaLabels.stepperRegion` wins over\n * `i18n.stepperLabel`. One source so the variants cannot drift from\n * the parent's naming behaviour.\n *\n * @internal\n */\nexport function createStepperAccname(inputs: CngxStepperAccnameInputs): Signal<string | null> {\n const ariaLabels = coerceSignal(inputs.config.ariaLabels);\n return computed<string | null>(() => {\n if (inputs.ariaLabelledBy()) {\n return null; // labelledby trumps label\n }\n return inputs.ariaLabel() ?? ariaLabels()?.stepperRegion ?? inputs.i18n().stepperLabel;\n });\n}\n","import { afterNextRender, type Injector, type Signal } from '@angular/core';\nimport { resolveBoundaryStep, resolveInlineStep, type CngxDirection } from '@cngx/core';\n\nimport type { CngxStepperHost } from './stepper-host.token';\n\n/**\n * Options for {@link createStepperStripKeyboardNav}.\n *\n * @internal\n */\nexport interface CngxStepperStripKeyboardNavOptions {\n /** Host contract that owns the active-step state and selection methods. */\n readonly presenter: CngxStepperHost;\n /** Host element used to locate the active step button after the move. */\n readonly hostElement: HTMLElement;\n /**\n * Document writing direction. Flips the horizontal-strip inline arrows\n * under `rtl` (APG); the vertical strip and Home/End stay invariant.\n */\n readonly direction: Signal<CngxDirection>;\n /**\n * Maps a CngxStepNode id to its DOM button id (e.g. `${id}-header`).\n * The strip selects by stable DOM id rather than waiting for the\n * `aria-current` attribute to flip - the id binding does not depend\n * on the active-step signal, so the lookup is correct the same tick\n * the presenter's `activeStepId` updates.\n */\n readonly stepButtonIdFor: (stepId: string) => string;\n /**\n * Optional class name guard - the handler only runs when\n * `event.target.classList.contains(stepClassName)`. Defaults to the\n * canonical strip button class so panel-content key presses pass\n * through untouched.\n */\n readonly stepClassName?: string;\n /**\n * Optional gate - when supplied and returning `false`, the handler is\n * a complete no-op. Used to switch arrow-key navigation off in the\n * `headerNavigation: 'none'` mode, where the step headers are inert\n * labels rather than focusable buttons. Omitted defaults to enabled.\n */\n readonly enabled?: () => boolean;\n /**\n * Injector used to defer the post-move focus to `afterNextRender`.\n * Required when the strip can re-render its node set on navigation\n * (focus-driven group collapse: crossing a group boundary removes the\n * old button and adds the target's), so the focus lands after the new\n * DOM exists. Omitted, focus falls back to a `queueMicrotask` defer -\n * correct for a static strip where every button is always present.\n */\n readonly injector?: Injector;\n}\n\n/**\n * Builds the WAI-ARIA APG arrow-key handler for a stepper strip. The\n * composed `CngxRovingTabindex` cannot reach view-template step buttons\n * (its `contentChildren` query only sees projected content), so the\n * organism wires this factory's return value to its host `(keydown)`\n * binding to honour the documented keyboard contract.\n *\n * Horizontal orientation: ArrowLeft / ArrowRight navigate. Vertical:\n * ArrowUp / ArrowDown. Home / End jump to the first / last flat step\n * regardless of orientation. The presenter's `select*` methods enforce\n * linear-mode gating so callers do not duplicate that check here.\n *\n * @internal\n */\nexport function createStepperStripKeyboardNav(\n options: CngxStepperStripKeyboardNavOptions,\n): (event: KeyboardEvent) => void {\n const stepClass = options.stepClassName ?? 'cngx-stepper__step';\n const scheduleFocus = (focus: () => void): void => {\n // After the next render when an injector is supplied (the strip may\n // re-render its node set on a group-boundary crossing); a microtask\n // otherwise. Either way the focus runs after the active-step signal\n // has settled, so the target button exists.\n if (options.injector) {\n afterNextRender(focus, { injector: options.injector });\n } else {\n queueMicrotask(focus);\n }\n };\n const focusActive = (): void => {\n // Focus the INTENDED target only while the commit is actually in\n // flight (pessimistic mode holds activeStepId at the origin until\n // the action settles). The controller retains intendedValue after a\n // rejection for the commit-error surface, so an unguarded read\n // would teleport focus to the refused step on any later no-op key.\n const intendedIdx = options.presenter.busy()\n ? options.presenter.intendedStepIndex()\n : undefined;\n const intendedId =\n intendedIdx !== undefined\n ? (options.presenter.stepsOnly()[intendedIdx]?.id ?? null)\n : null;\n const targetId = intendedId ?? options.presenter.activeStepId();\n if (!targetId) {\n return;\n }\n const buttonId = options.stepButtonIdFor(targetId);\n scheduleFocus(() => {\n const el = options.hostElement.querySelector(`[id=\"${buttonId}\"]`);\n if (el instanceof HTMLElement) {\n el.focus();\n }\n });\n };\n return (event: KeyboardEvent): void => {\n if (options.enabled && !options.enabled()) {\n return;\n }\n const target = event.target as HTMLElement | null;\n if (!target?.classList.contains(stepClass)) {\n return;\n }\n const isHorizontal = options.presenter.orientation() === 'horizontal';\n // Horizontal: the inline arrows flip under rtl. Vertical: the block\n // arrows (ArrowUp/ArrowDown) never flip.\n const inlineStep = isHorizontal ? resolveInlineStep(event.key, options.direction()) : null;\n const isNext = inlineStep === 1 || (!isHorizontal && event.key === 'ArrowDown');\n const isPrev = inlineStep === -1 || (!isHorizontal && event.key === 'ArrowUp');\n if (isNext) {\n event.preventDefault();\n options.presenter.selectNext();\n focusActive();\n } else if (isPrev) {\n event.preventDefault();\n // A stray back-arrow must not supersede an in-flight commit - the\n // programmatic selectPrevious() cancels deliberately; the gesture\n // path waits.\n if (options.presenter.busy()) {\n return;\n }\n options.presenter.selectPrevious();\n focusActive();\n } else if (event.key === 'Home') {\n event.preventDefault();\n const stepsOnly = options.presenter.stepsOnly();\n const first = resolveBoundaryStep(1, {\n count: stepsOnly.length,\n isDisabledAt: (i) => stepsOnly[i].disabled(),\n });\n if (first !== null) {\n options.presenter.select(first);\n focusActive();\n }\n } else if (event.key === 'End') {\n event.preventDefault();\n const stepsOnly = options.presenter.stepsOnly();\n const last = resolveBoundaryStep(-1, {\n count: stepsOnly.length,\n isDisabledAt: (i) => stepsOnly[i].disabled(),\n });\n if (last !== null) {\n options.presenter.select(last);\n focusActive();\n }\n }\n };\n}\n","import { computed, untracked, type Signal } from '@angular/core';\nimport { arrayEqual } from '@cngx/utils';\n\nimport type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type { CngxStepNode, CngxStepperHost, CngxStepStatus } from './stepper-host.token';\n\n/**\n * Per-step + aggregate state derivations shared by every stepper skin.\n *\n * The classic organism historically derived \"is this step errored / busy /\n * rejected\" inline in {@link createStepperSlotContextBuilders}; the dot,\n * text, and progress-bar variants derived nothing, so a step error (per-step\n * `state`, an error aggregator, or a commit rejection) was structurally\n * invisible in those three. This view is the single source those four skins\n * read from - \"Ableitung statt Verwaltung\" - so the error contract can never\n * drift between them.\n *\n * @internal\n */\nexport interface CngxStepperStateView {\n /** Raw step status. Group nodes still report their own `state()`. */\n readonly statusOf: (node: CngxStepNode) => CngxStepStatus;\n\n /**\n * `true` while a commit is in flight AND targets this step. Mirrors the\n * classic `isStepBusy` predicate.\n */\n readonly isBusy: (node: CngxStepNode) => boolean;\n\n /**\n * `true` when this step is the one a commit just rejected\n * (`flatIndex === lastFailedIndex`), refused or failed alike. The\n * commit-rejection marker your pessimistic / optimistic flows hit.\n */\n readonly isRejected: (node: CngxStepNode) => boolean;\n\n /**\n * `true` when this step carries the rejection marker AND the commit\n * action refused it (`lastOutcome().kind === 'refused'`). A refusal is\n * not an error: it marks the step but never sets `aria-invalid` or\n * counts towards {@link errorCount}.\n */\n readonly isRefused: (node: CngxStepNode) => boolean;\n\n /**\n * Badge-level error: per-step `state === 'error'` OR the bound error\n * aggregator's `shouldShow()`. Deliberately excludes commit rejection -\n * the classic skin renders rejection through its own dedicated slot, so\n * folding it in here would double-render the icon.\n */\n readonly hasErrorBadge: (node: CngxStepNode) => boolean;\n\n /**\n * Why the step carries a commit-rejection marker, for the `data-reason`\n * styling hook: `'refused'` or `'failed'` while {@link isRejected} holds,\n * `null` otherwise. Independent of a validation error on the same step.\n */\n readonly rejectionReason: (node: CngxStepNode) => 'refused' | 'failed' | null;\n\n /**\n * Visual marker predicate - the hook the minimal skins (dot / text /\n * progress-bar) and the mobile dots paint (`data-state=\"error\"`,\n * `--error`). `true` when {@link hasErrorBadge} fires OR the step carries\n * a commit rejection of either kind ({@link isRejected}). Those skins have\n * no separate rejection slot, so every marker shares one visual state.\n */\n readonly hasErrorMarker: (node: CngxStepNode) => boolean;\n\n /**\n * Semantic error predicate - what `aria-invalid`, the errored status word\n * and {@link errorCount} read. `true` when {@link hasErrorBadge} fires OR\n * a commit failed on this step. A refused step is marked\n * ({@link hasErrorMarker}) but not in error.\n */\n readonly hasError: (node: CngxStepNode) => boolean;\n\n /** Count of step-only nodes where {@link hasError} is `true`. */\n readonly errorCount: Signal<number>;\n\n /** Flat index of the first errored step, or `-1` when none. */\n readonly firstErrorIndex: Signal<number>;\n\n /** `true` when `errorCount() > 0`. Drives skin-level `aria-invalid`. */\n readonly hasAnyError: Signal<boolean>;\n\n /** Count of step-only nodes where {@link hasErrorMarker} is `true`. */\n readonly errorMarkerCount: Signal<number>;\n\n /** Flat index of the first marked step, or `-1` when none. */\n readonly firstErrorMarkerIndex: Signal<number>;\n\n /**\n * `true` when `errorMarkerCount() > 0`. Drives skin-level visual hooks\n * (`data-state=\"error\"`); `aria-invalid` stays on {@link hasAnyError}.\n */\n readonly hasAnyErrorMarker: Signal<boolean>;\n\n /**\n * `true` when steps are marked but none is in error: every marker is a\n * refused commit. Drives the refused tone of skin-level hooks (the\n * aggregate error line, the progress bar) that stand for all steps.\n */\n readonly refusalOnly: Signal<boolean>;\n}\n\n/**\n * Build the shared {@link CngxStepperStateView} over a presenter host and its\n * step-only projection. Pure factory - `computed()` only, no injection\n * context required, so any skin can allocate it in a field initializer.\n *\n * @category common/stepper\n * @since 0.1.0\n * @relatedTo CngxStepperHost, createStepperSlotContextBuilders\n */\nexport function createStepperStateView(inputs: {\n presenter: CngxStepperHost;\n stepsOnly: Signal<readonly CngxStepNode[]>;\n}): CngxStepperStateView {\n const { presenter, stepsOnly } = inputs;\n\n const statusOf = (node: CngxStepNode): CngxStepStatus => node.state();\n\n const isBusy = (node: CngxStepNode): boolean =>\n node.kind === 'step' &&\n presenter.commitState.status() === 'pending' &&\n presenter.intendedStepIndex() === node.flatIndex;\n\n const isRejected = (node: CngxStepNode): boolean =>\n node.kind === 'step' && node.flatIndex >= 0 && node.flatIndex === presenter.lastFailedIndex();\n\n const hasErrorBadge = (node: CngxStepNode): boolean => {\n if (node.kind !== 'step') {\n return false;\n }\n if (node.state() === 'error') {\n return true;\n }\n return !!node.errorAggregator?.()?.shouldShow?.();\n };\n\n const isRefused = (node: CngxStepNode): boolean =>\n isRejected(node) && presenter.lastOutcome()?.kind === 'refused';\n\n const rejectionReason = (node: CngxStepNode): 'refused' | 'failed' | null => {\n if (!isRejected(node)) {\n return null;\n }\n return isRefused(node) ? 'refused' : 'failed';\n };\n\n const hasErrorMarker = (node: CngxStepNode): boolean => hasErrorBadge(node) || isRejected(node);\n\n const hasError = (node: CngxStepNode): boolean =>\n hasErrorBadge(node) || (isRejected(node) && !isRefused(node));\n\n const erroredSteps = computed<readonly CngxStepNode[]>(\n () => stepsOnly().filter((node) => hasError(node)),\n { equal: arrayEqual },\n );\n\n const errorCount = computed<number>(() => erroredSteps().length);\n\n const firstErrorIndex = computed<number>(() => erroredSteps()[0]?.flatIndex ?? -1);\n\n const hasAnyError = computed<boolean>(() => errorCount() > 0);\n\n const markedSteps = computed<readonly CngxStepNode[]>(\n () => stepsOnly().filter((node) => hasErrorMarker(node)),\n { equal: arrayEqual },\n );\n\n const errorMarkerCount = computed<number>(() => markedSteps().length);\n\n const firstErrorMarkerIndex = computed<number>(() => markedSteps()[0]?.flatIndex ?? -1);\n\n const hasAnyErrorMarker = computed<boolean>(() => errorMarkerCount() > 0);\n\n const refusalOnly = computed<boolean>(() => hasAnyErrorMarker() && !hasAnyError());\n\n return {\n statusOf,\n isBusy,\n isRejected,\n isRefused,\n rejectionReason,\n hasErrorBadge,\n hasErrorMarker,\n hasError,\n errorCount,\n firstErrorIndex,\n hasAnyError,\n errorMarkerCount,\n firstErrorMarkerIndex,\n hasAnyErrorMarker,\n refusalOnly,\n };\n}\n\n/**\n * Aggregate error phrase shared by the minimal skins (text / progress-bar)\n * and the classic mobile-collapse text branch. Walks the marked steps\n * ({@link CngxStepperStateView.hasErrorMarker}). A single marked step names\n * itself with the word of its kind: `\"Payment: Errored\"` (or the custom\n * reason) for an error, `\"Payment: Not allowed\"` for a refused step change;\n * several failed steps collapse to the i18n count phrase (`\"2 errors\"`),\n * which never counts a refusal. Returns `''`\n * when no step is marked, so the error line stays quiet.\n *\n * The optional `messageOf` resolver lets callers surface a per-step\n * reason (a direct `[error]` string or the first aggregator label) in the\n * single-error case instead of the generic `errored` status word. The\n * reason is still prefixed with the step label (`\"Payment: Card declined\"`),\n * because the summary line stays visible while another step is active and\n * a bare reason would read as belonging to the active step. When\n * omitted - or when it returns `undefined`/`''` - the helper produces\n * byte-identical output to the no-resolver form, so existing callers\n * (the classic mobile-collapse summary) are a guaranteed no-op.\n *\n * Pure helper - reads signals at call time, intended to be wrapped in the\n * caller's `computed()`. The phrase feeds live regions, so the step label\n * is read untracked: a label that follows a language switch must not\n * re-announce the line. Pass the i18n bundle as an untracked snapshot for\n * the same reason.\n *\n * @category common/stepper\n * @since 0.1.0\n */\nexport function resolveStepperErrorSummary(\n view: Pick<\n CngxStepperStateView,\n | 'errorMarkerCount'\n | 'firstErrorMarkerIndex'\n | 'errorCount'\n | 'firstErrorIndex'\n | 'isRefused'\n | 'hasErrorBadge'\n >,\n stepsOnly: Signal<readonly CngxStepNode[]>,\n i18n: CngxStepperI18n,\n messageOf?: (node: CngxStepNode) => string | undefined,\n): string {\n const count = view.errorMarkerCount();\n if (count === 0) {\n return '';\n }\n if (count === 1) {\n return singleStepPhrase(view, stepsOnly()[view.firstErrorMarkerIndex()], i18n, messageOf);\n }\n // A refusal is not an error: the count phrase counts failed steps only. One\n // error beside a refused step names that error; the refusal keeps its own\n // marker and announcement.\n const errors = view.errorCount();\n if (errors > 1) {\n return i18n.stepHasErrors(errors);\n }\n const index = errors === 1 ? view.firstErrorIndex() : view.firstErrorMarkerIndex();\n return singleStepPhrase(view, stepsOnly()[index], i18n, messageOf);\n}\n\n/** @internal `\"<label>: <detail>\"` for one marked step. */\nfunction singleStepPhrase(\n view: Pick<CngxStepperStateView, 'isRefused' | 'hasErrorBadge'>,\n node: CngxStepNode | undefined,\n i18n: CngxStepperI18n,\n messageOf?: (node: CngxStepNode) => string | undefined,\n): string {\n const detail = node ? summaryDetail(view, node, i18n, messageOf) : i18n.statusLabels.errored;\n const label = node ? untracked(node.label) : undefined;\n return label ? i18n.stepWithDetail(label, detail) : detail;\n}\n\n/**\n * @internal The word for one marked step: a validation error keeps its\n * reason, a refused-only step reads the refused word.\n */\nfunction summaryDetail(\n view: Pick<CngxStepperStateView, 'isRefused' | 'hasErrorBadge'>,\n node: CngxStepNode,\n i18n: CngxStepperI18n,\n messageOf?: (node: CngxStepNode) => string | undefined,\n): string {\n const refusedOnly = view.isRefused(node) && !view.hasErrorBadge(node);\n if (refusedOnly) {\n return i18n.statusLabels.refused;\n }\n const custom = messageOf?.(node);\n return custom !== undefined && custom !== '' ? custom : i18n.statusLabels.errored;\n}\n","import { computed, type Signal } from '@angular/core';\n\nimport type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type { CngxStepBadgeContext } from './slots/step-badge.directive';\nimport type { CngxStepBusySpinnerContext } from './slots/step-busy-spinner.directive';\nimport type { CngxDotStepperDotContext } from './slots/dot-stepper-dot.directive';\nimport type { CngxStepErrorContext } from './slots/step-error.directive';\nimport type { CngxStepGroupHeaderContext } from './slots/step-group-header.directive';\nimport type { CngxStepIndicatorContext } from './slots/step-indicator.directive';\nimport type { CngxStepRejectionContext } from './slots/step-rejection.directive';\nimport { createStepperStateView } from './stepper-state-view';\nimport type { CngxStepContentContext, CngxStepLabelContext } from './step-panel-host.token';\nimport type { CngxStepNode, CngxStepperHost } from './stepper-host.token';\n\n/**\n * Input bundle for {@link createStepperSlotContextBuilders}: the presenter\n * surface and the step-only flat projection. Builders read both reactively\n * so the produced context objects always reflect current presenter state.\n *\n * @internal\n */\nexport interface CngxStepperSlotContextBuildersInputs {\n readonly presenter: CngxStepperHost;\n readonly stepsOnly: Signal<readonly CngxStepNode[]>;\n /**\n * Whether a group node is currently collapsed (focus-driven collapse\n * policy). Optional so header contexts of collapse-free steppers keep\n * reporting `expanded: true` without the caller wiring a predicate.\n */\n readonly isGroupCollapsed?: (node: CngxStepNode) => boolean;\n /** i18n bundle Signal - supplies the `errored` status label as the message fallback. */\n readonly i18n: Signal<CngxStepperI18n>;\n}\n\n/**\n * Per-step status / activity / rejection / labelling derivations shared by\n * every slot context shape. The organism reads these through the bundle\n * instead of duplicating the logic next to each `*ContextFor` builder.\n *\n * @internal\n */\nexport interface CngxStepperSlotContextBuilders {\n readonly isActive: (node: CngxStepNode) => boolean;\n readonly isStepBusy: (node: CngxStepNode) => boolean;\n readonly showRejection: (node: CngxStepNode) => boolean;\n readonly showErrorBadge: (node: CngxStepNode) => boolean;\n /** Validation-channel error gate - mirrors the error badge, independent of commit rejection. */\n readonly showStepError: (node: CngxStepNode) => boolean;\n readonly indicatorContextFor: (node: CngxStepNode) => CngxStepIndicatorContext;\n readonly badgeContextFor: (node: CngxStepNode) => CngxStepBadgeContext;\n readonly busySpinnerContextFor: (node: CngxStepNode) => CngxStepBusySpinnerContext;\n readonly rejectionContextFor: (node: CngxStepNode) => CngxStepRejectionContext;\n readonly stepErrorContextFor: (node: CngxStepNode) => CngxStepErrorContext;\n readonly groupHeaderContextFor: (node: CngxStepNode) => CngxStepGroupHeaderContext;\n readonly stepLabelContextFor: (node: CngxStepNode) => CngxStepLabelContext;\n readonly stepContentContextFor: (node: CngxStepNode) => CngxStepContentContext;\n /** Context of the `*cngxDotStepperDot` body in the dots mobile-collapse branch. */\n readonly dotContextFor: (node: CngxStepNode) => CngxDotStepperDotContext;\n}\n\n/**\n * Wrap a `(node) => TContext` builder so identical results return the\n * same reference. Keyed by the node object via `WeakMap`, so step-list\n * re-emits drop stale entries automatically. The structural comparison\n * is shallow because every context shape is a flat object.\n *\n * @internal\n */\nfunction memoizeByNode<TContext extends object>(\n build: (node: CngxStepNode) => TContext,\n): (node: CngxStepNode) => TContext {\n const cache = new WeakMap<CngxStepNode, TContext>();\n return (node) => {\n const next = build(node);\n const prev = cache.get(node);\n if (prev !== undefined && shallowEqual(prev, next)) {\n return prev;\n }\n cache.set(node, next);\n return next;\n };\n}\n\n/** @internal */\nfunction shallowEqual<T extends object>(a: T, b: T): boolean {\n if (a === b) {\n return true;\n }\n const keysA = Object.keys(a);\n if (keysA.length !== Object.keys(b).length) {\n return false;\n }\n const ra = a as Record<string, unknown>;\n const rb = b as Record<string, unknown>;\n for (const k of keysA) {\n if (ra[k] !== rb[k]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Bundle the `*ContextFor` slot-context builders plus the small\n * `isActive` / `isStepBusy` / `showRejection` / `showErrorBadge` /\n * `showStepError` predicates the organism's template reads. Lives at\n * Level 2 so the `<cngx-stepper>` organism stays a thin shell.\n *\n * @internal\n */\nexport function createStepperSlotContextBuilders(\n inputs: CngxStepperSlotContextBuildersInputs,\n): CngxStepperSlotContextBuilders {\n const { presenter, stepsOnly, i18n } = inputs;\n\n // Single source for every per-step status / error / busy / rejection\n // derivation. The dot / text / progress-bar skins read the same view,\n // so the error contract stays identical across all four.\n const stateView = createStepperStateView({ presenter, stepsOnly });\n\n const isActive = (node: CngxStepNode): boolean =>\n node.kind === 'step' && node.id === presenter.activeStepId();\n\n const isStepBusy = stateView.isBusy;\n\n const showRejection = stateView.isRejected;\n\n const showErrorBadge = stateView.hasErrorBadge;\n\n // Validation-channel gate for the per-step error message. Mirrors the\n // error badge (state === 'error' via [error] / aggregator); the commit\n // rejection keeps its own `showRejection` slot, so the two channels\n // stay distinct.\n const showStepError = stateView.hasErrorBadge;\n\n // Memoize per-node so identical contexts return the same reference.\n // *ngTemplateOutlet pays an ngOnChanges shallow comparison on its\n // `context:` binding every CD pass; without this cache the outlet\n // sees a fresh literal each tick and re-pushes context to the\n // embedded view even when no source signal changed. Cache keys are\n // the node objects themselves so the WeakMap evicts naturally with\n // step-list re-emits.\n const indicatorContextFor = memoizeByNode<CngxStepIndicatorContext>((node) => {\n const position = node.flatIndex + 1;\n return {\n $implicit: position,\n position,\n node,\n active: isActive(node),\n status: node.state(),\n busy: isStepBusy(node),\n };\n });\n\n const badgeContextFor = memoizeByNode<CngxStepBadgeContext>((node) => {\n const aggregator = node.errorAggregator?.();\n const count = aggregator?.errorCount() ?? 0;\n return { count, node };\n });\n\n const busySpinnerContextFor = memoizeByNode<CngxStepBusySpinnerContext>((node) => ({ node }));\n\n const rejectionContextFor = memoizeByNode<CngxStepRejectionContext>((node) => {\n const failedIndex = node.flatIndex;\n const originIdx = presenter.originIndexDuringCommit();\n const originLabel = originIdx !== undefined ? stepsOnly()[originIdx]?.label() : undefined;\n const reason = stateView.isRefused(node) ? 'refused' : 'failed';\n return { failedIndex, originLabel, node, reason };\n });\n\n const stepErrorContextFor = memoizeByNode<CngxStepErrorContext>((node) => {\n const aggregator = node.errorAggregator?.();\n const errorLabels = aggregator?.errorLabels?.() ?? [];\n const announcement = aggregator?.announcement?.() ?? '';\n // Resolution order: direct [error] string > first aggregator label >\n // i18n errored status phrase. Always non-empty so a bare\n // `{{ message }}` template renders a reason.\n const message = node.errorMessage?.() ?? errorLabels[0] ?? i18n().statusLabels.errored;\n return { node, message, errorLabels, announcement };\n });\n\n const groupHeaderContextFor = memoizeByNode<CngxStepGroupHeaderContext>((node) => ({\n group: node,\n expanded: !(inputs.isGroupCollapsed?.(node) ?? false),\n status: node.state(),\n }));\n\n const stepLabelContextFor = memoizeByNode<CngxStepLabelContext>((node) => ({\n node,\n index: node.flatIndex + 1,\n active: isActive(node),\n busy: isStepBusy(node),\n disabled: node.disabled(),\n }));\n\n // Independent builder + independent cache: content + label contexts\n // share a shape today but the slot directives are separate contracts\n // (CngxStepContentContext vs CngxStepLabelContext) and will diverge\n // when one side gains a field. Aliasing the function would couple\n // both call sites to that future divergence.\n const stepContentContextFor = memoizeByNode<CngxStepContentContext>((node) => ({\n node,\n index: node.flatIndex + 1,\n active: isActive(node),\n busy: isStepBusy(node),\n disabled: node.disabled(),\n }));\n\n // One pass per step-list change, so a dot reads its index in O(1)\n // instead of scanning the list on every change-detection pass.\n const stepIndexByNode = computed(\n () => new Map(stepsOnly().map((node, index) => [node, index] as const)),\n );\n\n // Same fields as <cngx-dot-stepper>: index in the step-only projection,\n // completed = before the active step.\n const dotContextFor = memoizeByNode<CngxDotStepperDotContext>((node) => {\n const index = stepIndexByNode().get(node) ?? -1;\n return {\n $implicit: index,\n index,\n node,\n active: isActive(node),\n completed: index < presenter.activeStepIndex(),\n };\n });\n\n return {\n isActive,\n isStepBusy,\n showRejection,\n showErrorBadge,\n showStepError,\n indicatorContextFor,\n badgeContextFor,\n busySpinnerContextFor,\n rejectionContextFor,\n stepErrorContextFor,\n groupHeaderContextFor,\n stepLabelContextFor,\n stepContentContextFor,\n dotContextFor,\n };\n}\n","import { computed, untracked, type Signal } from '@angular/core';\n\nimport { createRefusedPhrase } from '@cngx/common/data';\n\nimport type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type { CngxStepNode, CngxStepperHost } from './stepper-host.token';\n\n/**\n * Input bundle for {@link createStepperAnnouncementBuilders}. The presenter\n * surface (commit transition + failed-index signals), the step-only flat\n * projection, and the resolved i18n bundle Signal.\n *\n * @internal\n */\nexport interface CngxStepperAnnouncementBuildersInputs {\n readonly presenter: CngxStepperHost;\n readonly stepsOnly: Signal<readonly CngxStepNode[]>;\n readonly i18n: Signal<CngxStepperI18n>;\n}\n\n/**\n * Reactive SR-announcement surface for the stepper organism: the\n * `aria-live` content for commit lifecycle transitions, the per-step\n * descriptor phrase including the rejected-suffix, and the group rollup\n * phrase. Bundles three small functions the organism's template binds\n * against.\n *\n * @internal\n */\nexport interface CngxStepperAnnouncementBuilders {\n /**\n * Live-region content driven by the commit transition tracker.\n * Empty string between transitions keeps the region quiet on no-op\n * CD ticks. A refusal speaks `commitRefused(originLabel)` (or\n * `commitRefusedGeneric` without a label) once and holds it until the\n * next commit, step move or reset. Error-arm priority:\n * `commitRolledBackTo(originLabel)` when both `lastFailedIndex` and a\n * resolvable origin label exist; otherwise `commitFailedRetry`.\n */\n readonly liveAnnouncement: Signal<string>;\n /**\n * SR descriptor phrase. Aggregator-announced or \"Step N of M: <label>\";\n * routes a refused row through `stepRefused(base)` and a failed row\n * through `stepRolledBack(base)`.\n */\n readonly statusPhrase: (node: CngxStepNode) => string;\n /**\n * Step-header descriptor: `statusPhrase` plus the done / errored status\n * the stepper skins draw as a CSS glyph, joined through `stepWithDetail`.\n * The glyphs carry `/ ''` alt text, so this text is where their meaning\n * reaches a screen reader.\n */\n readonly headerStatusPhrase: (node: CngxStepNode) => string;\n /** Group descriptor - rolls up children's aggregated status. */\n readonly groupStatusPhrase: (node: CngxStepNode) => string;\n /** Stable descriptor-span id for a node (`<node-id>-desc`). */\n readonly descriptorId: (node: CngxStepNode) => string;\n /**\n * `aria-describedby` value for a node: `descriptorId(node)` while the\n * node's phrase (`headerStatusPhrase` for steps, `groupStatusPhrase` for\n * groups) is non-empty, else `null`. The descriptor span stays in the\n * DOM; only the reference is gated - accname 1.2 §2A traverses a\n * directly-referenced node even when it is empty or hidden.\n */\n readonly describedBy: (node: CngxStepNode) => string | null;\n}\n\n/**\n * Build the reactive SR-announcement surface for `<cngx-stepper>`.\n * Lives at Level 2 so the Level-4 organism stays a thin shell per\n * `reference_atomic_decompose`.\n *\n * @internal\n */\nexport function createStepperAnnouncementBuilders(\n inputs: CngxStepperAnnouncementBuildersInputs,\n): CngxStepperAnnouncementBuilders {\n const { presenter, stepsOnly } = inputs;\n\n // A refusal leaves the commit status at 'idle', so no status edge can\n // voice it. The phrase arms on each new refused outcome (a new\n // sequence) and is spent by the next commit activity, a step move or a\n // cleared outcome (reset). Arm wins over spend in the same flush, so an\n // optimistic rollback that moves the step still arms.\n const refusedPhrase = createRefusedPhrase({\n outcome: () => presenter.lastOutcome(),\n status: () => presenter.commitTransition.current(),\n activeIndex: () => presenter.activeStepIndex(),\n copy: refusedCopy,\n });\n\n function refusedCopy(): string {\n const originIdx = presenter.originIndexDuringCommit();\n const origin = originIdx !== undefined ? stepsOnly()[originIdx] : undefined;\n const originLabel = origin?.label();\n const i18n = inputs.i18n();\n return originLabel ? i18n.commitRefused(originLabel) : i18n.commitRefusedGeneric;\n }\n\n // The live region reads copy untracked: a language switch must not\n // re-speak the last phrase. The next commit transition speaks the new\n // language.\n const liveAnnouncement = computed<string>(() => {\n // Read the refused phrase EAGERLY: linkedSignal only observes the\n // snapshots it is read under, so a read behind the pending arm would\n // miss the status change that spends it.\n const refused = refusedPhrase();\n if (refused) {\n return refused;\n }\n const current = presenter.commitTransition.current();\n if (current === 'pending') {\n return untracked(() => inputs.i18n().commitInFlight);\n }\n if (\n current === 'success' &&\n presenter.commitTransition.previous() === 'pending' &&\n (presenter.commitMode?.() ?? 'pessimistic') === 'pessimistic'\n ) {\n // Announce where the commit landed - without this arm a pessimistic\n // accept moves the step silently (the pending phrase just goes quiet).\n // Pessimistic only: an optimistic accept already moved (and thereby\n // announced) the step at dispatch - repeating it here would\n // double-announce a position the SR user already reached.\n const landed = presenter.stepsOnly()[presenter.activeStepIndex()];\n if (landed) {\n // A step label can itself derive from copy (the Material bridge's\n // `Step <id>` fallback), so it is read untracked too.\n const label = untracked(landed.label);\n const count = presenter.stepsOnly().length;\n return untracked(() => inputs.i18n().selectedStep(label, landed.flatIndex + 1, count));\n }\n return '';\n }\n if (current === 'error') {\n // Sync commit-handler failures collapse pending -> error in one signal\n // flush; tracker sees `previous === 'idle'`. Guard stays loose so a\n // synchronously throwing `commitAction` still announces. A `false`\n // answer never reaches this arm: it settles to 'idle' as a refusal.\n const failedIdx = presenter.lastFailedIndex();\n const originIdx = presenter.originIndexDuringCommit();\n if (failedIdx !== undefined && originIdx !== undefined) {\n const origin = stepsOnly()[originIdx];\n const originLabel = origin ? untracked(origin.label) : undefined;\n if (originLabel) {\n return untracked(() => inputs.i18n().commitRolledBackTo(originLabel));\n }\n }\n return untracked(() => inputs.i18n().commitFailedRetry);\n }\n return '';\n });\n\n const statusPhrase = (node: CngxStepNode): string => {\n const i18n = inputs.i18n();\n const aggregator = node.errorAggregator?.();\n let base = aggregator?.shouldShow?.() ? (aggregator.announcement?.() ?? '') : '';\n if (!base && node.kind === 'step') {\n const idx = node.flatIndex;\n if (idx >= 0) {\n base = i18n.selectedStep(node.label(), idx + 1, stepsOnly().length);\n }\n }\n if (!base) {\n return '';\n }\n if (node.kind !== 'step' || node.flatIndex !== presenter.lastFailedIndex()) {\n return base;\n }\n return presenter.lastOutcome()?.kind === 'refused'\n ? i18n.stepRefused(base)\n : i18n.stepRolledBack(base);\n };\n\n // Converged on `statusLabels` - the same phrase map the status pill\n // (resolveStepperStatusLabel) renders, so a group's SR description can\n // never disagree with its visible pill.\n const groupStatusPhrase = (node: CngxStepNode): string => {\n const i18n = inputs.i18n();\n const status = node.state();\n if (status === 'error') {\n return i18n.statusLabels.errored;\n }\n if (status === 'success') {\n return i18n.statusLabels.done;\n }\n return '';\n };\n\n const headerStatusPhrase = (node: CngxStepNode): string => {\n const phrase = statusPhrase(node);\n const status = glyphStatus(node, inputs.i18n());\n if (!status) {\n return phrase;\n }\n return phrase ? inputs.i18n().stepWithDetail(phrase, status) : status;\n };\n\n const descriptorId = (node: CngxStepNode): string => `${node.id}-desc`;\n\n const describedBy = (node: CngxStepNode): string | null => {\n const phrase = node.kind === 'step' ? headerStatusPhrase(node) : groupStatusPhrase(node);\n return phrase ? descriptorId(node) : null;\n };\n\n return {\n liveAnnouncement,\n statusPhrase,\n headerStatusPhrase,\n groupStatusPhrase,\n descriptorId,\n describedBy,\n };\n}\n\n/** The status word behind a skin's done / errored glyph, or `''`. */\nfunction glyphStatus(node: CngxStepNode, i18n: CngxStepperI18n): string {\n const state = node.state();\n if (state === 'error') {\n return i18n.statusLabels.errored;\n }\n return state === 'success' ? i18n.statusLabels.done : '';\n}\n\n/**\n * Input bundle for {@link createStepperPanelRefs}: the resolved display\n * mode, the strip projection that decides which headers exist, and the\n * organism's id/describedby schemes.\n *\n * @internal\n */\nexport interface CngxStepperPanelRefsInputs {\n readonly displayMode: Signal<'classic' | 'text' | 'dots'>;\n readonly visibleStripNodes: Signal<readonly CngxStepNode[]>;\n readonly headerIdFor: (node: CngxStepNode) => string;\n readonly describedByFor: (node: CngxStepNode) => string | null;\n}\n\n/**\n * Per-mode panel naming surface for `<cngx-stepper>`'s region panels.\n *\n * @internal\n */\nexport interface CngxStepperPanelRefs {\n /** Header id when a header element is rendered for the node, else `null`. */\n readonly labelledBy: (node: CngxStepNode) => string | null;\n /** Self-naming fallback whenever {@link labelledBy} emits no id. */\n readonly ariaLabel: (node: CngxStepNode) => string | null;\n /** Gated describedby - suppressed when the descriptor span is header-hosted and the header is not rendered. */\n readonly describedBy: (node: CngxStepNode) => string | null;\n}\n\n/**\n * Build the mode-aware panel ref surface. The dots branch always\n * renders one dot per step; the classic strip only renders headers the\n * group-collapse policy exposes; the text branch has no header element\n * at all. A panel must never reference an id that is not in the DOM -\n * a dangling IDREF names the region as empty - so header-less panels\n * self-name via `aria-label` and drop the describedby reference (the\n * classic descriptor spans live inside the strip headers; the\n * collapsed branches mount theirs inside the panel).\n *\n * @internal\n */\nexport function createStepperPanelRefs(inputs: CngxStepperPanelRefsInputs): CngxStepperPanelRefs {\n const { displayMode, visibleStripNodes, headerIdFor, describedByFor } = inputs;\n\n const renderedHeaderIds = computed<ReadonlySet<string>>(\n () => new Set(visibleStripNodes().map((node) => node.id)),\n { equal: (a, b) => a.size === b.size && [...a].every((id) => b.has(id)) },\n );\n\n const labelledBy = (node: CngxStepNode): string | null => {\n const mode = displayMode();\n if (mode === 'text') {\n return null;\n }\n if (mode === 'dots') {\n return headerIdFor(node);\n }\n return renderedHeaderIds().has(node.id) ? headerIdFor(node) : null;\n };\n\n const ariaLabel = (node: CngxStepNode): string | null => (labelledBy(node) ? null : node.label());\n\n const describedBy = (node: CngxStepNode): string | null => {\n if (displayMode() === 'classic' && !renderedHeaderIds().has(node.id)) {\n return null;\n }\n return describedByFor(node);\n };\n\n return { labelledBy, ariaLabel, describedBy };\n}\n","import { computed, Directive, input } from '@angular/core';\nimport { injectDirection } from '@cngx/core';\n\nimport type { SwipeDirection } from '@cngx/common/interactive';\n\nimport { injectStepperConfig } from './stepper-config';\nimport { injectStepperHost } from './stepper-host.token';\n\n/**\n * Routes a `CngxSwipe` gesture into the stepper presenter so the\n * organism's mobile-collapse panels gain swipe-driven navigation\n * without duplicating pointer handling. Applied via `hostDirectives`\n * on `<cngx-stepper>`; consumer-facing input `[mobileSwipe]` is\n * forwarded through the host metadata.\n *\n * Cascade for `swipeEnabled`: per-instance `[mobileSwipe]` ->\n * `CNGX_STEPPER_CONFIG.mobileSwipe` -> library default `true`.\n *\n * Direction routing is asymmetric, matching the presenter's existing\n * navigation surface: the forward swipe (`left` under `ltr`, `right`\n * under `rtl`) -> `selectNext()` -> `select()` (linear gate + commit\n * window apply identically to a click); the back swipe ->\n * `selectPrevious()`, gated on `busy()` like the strip back-arrow.\n *\n * @category common/stepper\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/swipe-nav.directive.ts\n * @since 0.1.0\n */\n@Directive({\n selector: '[cngxStepperSwipeNav]',\n standalone: true,\n})\nexport class CngxStepperSwipeNav {\n /**\n * Per-instance opt-out for the built-in swipe navigation. `undefined`\n * defers to the config cascade.\n */\n readonly mobileSwipe = input<boolean | undefined>(undefined);\n\n private readonly host = injectStepperHost('cngxStepperSwipeNav', { host: false });\n private readonly config = injectStepperConfig();\n private readonly direction = injectDirection();\n\n /** Resolved enabled flag (Input -> config -> default(true)). Boolean output, no `equal` fn required. */\n readonly swipeEnabled = computed<boolean>(\n () => this.mobileSwipe() ?? this.config.mobileSwipe ?? true,\n );\n\n /**\n * Route a swipe direction into the presenter. The inline mapping\n * resolves against the document direction like the keyboard path:\n * under `ltr` a left swipe advances; under `rtl` the roles flip.\n * Vertical directions are ignored. The back path waits while a\n * commit is in flight - a stray gesture must not supersede it (the\n * programmatic `selectPrevious()` cancels deliberately).\n */\n handleSwipe(direction: SwipeDirection): void {\n if (direction !== 'left' && direction !== 'right') {\n return;\n }\n const forward = direction === (this.direction() === 'rtl' ? 'right' : 'left');\n if (forward) {\n this.host.selectNext();\n } else {\n if (this.host.busy()) {\n return;\n }\n this.host.selectPrevious();\n }\n }\n}\n","import { afterNextRender } from '@angular/core';\nimport { cngxDevWarn } from '@cngx/utils';\n\n/**\n * Dev-warning for a stepper control (`[cngxStepperNext]`,\n * `[cngxStepperPrevious]`, `[cngxStepperComplete]`, `<cngx-stepper-count>`)\n * that has neither a bound `[host]` nor an ambient stepper presenter. Such a\n * control stays disabled or empty for good, so it warns once per instance\n * after the first render, when the `[host]` binding has settled. Call it from\n * an injection context.\n *\n * @internal\n */\nexport function warnStepperControlUnhosted(selector: string, host: () => unknown): void {\n if (!(typeof ngDevMode !== 'undefined' && ngDevMode)) {\n return;\n }\n afterNextRender(() => {\n if (host()) {\n return;\n }\n cngxDevWarn(\n 'CNGX1056',\n `[${selector}] has no stepper. Place it inside a stepper, or bind [host] to the ` +\n `stepper's presenter when it sits outside.`,\n );\n });\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n type Signal,\n untracked,\n ViewEncapsulation,\n} from '@angular/core';\n\nimport { CNGX_STEPPER_HOST, type CngxStepNode } from './stepper-host.token';\nimport { injectStepperI18n } from './i18n/stepper-i18n';\nimport { warnStepperControlUnhosted } from './warn-stepper-unhosted';\n\n/**\n * Minimal contract `CngxStepperCount` reads off the host. A full\n * {@link CngxStepperHost} satisfies it, but consumers can also supply\n * a narrower stub (useful in tests, custom layouts, or non-standard\n * step containers that surface just these two signals).\n *\n * @category common/stepper\n */\nexport interface CngxStepperCountHost {\n readonly activeStepIndex: Signal<number>;\n readonly stepsOnly: Signal<readonly CngxStepNode[]>;\n}\n\n/**\n * Reusable progress-hint atom for any stepper organism. Renders the\n * resolved `CngxStepperI18n.textStepperFormat(current, total)` string\n * inside a `<span>` and pipes the value through an `aria-live` region\n * so screen readers announce step transitions.\n *\n * The text shape is fully owned by the i18n format function - drop the\n * atom inside any `<cngx-stepper>` / `<cngx-mat-stepper>` /\n * `<cngx-progress-bar-stepper>` tree and override the format upstream\n * to change every instance at once:\n *\n * ```ts\n * provideStepperI18n(withStepperI18nLabels({\n * textStepperFormat: (c, t) => `${c}/${t} complete`,\n * }));\n * ```\n *\n * Canonical shapes the atom supports without any markup changes:\n * - `Step N of M` (default)\n * - `N/M complete`\n * - `N/M`\n * - `Math.round(c/t * 100)%`\n * - any consumer-defined string the closure returns.\n *\n * `[live]=\"false\"` opts the atom out of the `aria-live` region when\n * the caption sits next to another live region (e.g. a stepper that\n * already mounts its own live announcer) to prevent double announces.\n *\n * @category common/stepper\n * @docsKind primary\n * @since 0.1.0\n * @relatedTo CngxStepperHost, CngxStepperI18n\n * <example-url>http://localhost:4200/#/ui/stepper/stepper-count/multi-instance-format-overrides</example-url>\n */\n@Component({\n selector: 'cngx-stepper-count',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n // Two spans so only the live one reads copy untracked: a language switch\n // re-renders a plain caption at once, while a live caption keeps its text\n // until the next step change (no re-announcement). `live` is a mount-time\n // choice; the live span exists from the first render, before any change\n // it announces.\n template: `\n @if (live()) {\n <span aria-live=\"polite\">{{ liveLabel() }}</span>\n } @else {\n <span>{{ label() }}</span>\n }\n `,\n // isolate fences the caption from the surrounding text. The direction is\n // inherited: the default caption is translated text and reads in the\n // language's direction. A consumer `format` that renders a bare `N / M`\n // ratio can pin it with --cngx-stepper-count-direction: ltr. Bidi is\n // visual-only - AT reads DOM order, so the announced string is unchanged.\n styles: `\n .cngx-stepper-count span {\n unicode-bidi: var(--cngx-stepper-count-bidi, isolate);\n direction: var(--cngx-stepper-count-direction, inherit);\n }\n `,\n host: {\n class: 'cngx-stepper-count',\n },\n})\nexport class CngxStepperCount {\n /**\n * When `true`, wraps the rendered string in an `aria-live=\"polite\"` span.\n * Set it once per instance: toggling it swaps the span, and the region\n * content present at that moment is not announced.\n */\n readonly live = input<boolean>(true);\n\n /**\n * Per-instance format override. Receives `(current, total)` where\n * `current` is the 1-based active step position and `total` is\n * `host.stepsOnly().length`. When omitted, the resolved\n * `CngxStepperI18n.textStepperFormat` is used so two siblings can\n * each show a different shape inside the same stepper tree.\n */\n readonly format = input<((current: number, total: number) => string) | undefined>(undefined);\n\n /**\n * Explicit stepper-host reference. Set this when the atom sits\n * *outside* a `<cngx-stepper>` (e.g. in a sibling layout header)\n * by exporting the stepper as a template ref:\n * `<cngx-stepper #s=\"cngxStepper\">` then `[host]=\"s.presenter\"`.\n * When unset, the atom injects the ambient `CNGX_STEPPER_HOST` from\n * its DI tree. Accepts {@link CngxStepperCountHost} so a narrow stub\n * (active index + steps signal) also fits.\n */\n readonly host = input<CngxStepperCountHost | null>(null);\n\n private readonly injectedHost = inject(CNGX_STEPPER_HOST, { optional: true });\n private readonly i18n = injectStepperI18n();\n private readonly resolvedHost = computed<CngxStepperCountHost | null>(\n () => this.host() ?? this.injectedHost,\n );\n\n /** 1-based active position and step total, or `null` while there is nothing to count. */\n private readonly position = computed<{ current: number; total: number } | null>(\n () => {\n const host = this.resolvedHost();\n if (!host) {\n return null;\n }\n const total = host.stepsOnly().length;\n if (total === 0) {\n return null;\n }\n // Clamp against the live total - a transiently out-of-range active\n // index (steps removed at runtime) must not render \"Step 5 of 3\".\n const current = Math.min(Math.max(host.activeStepIndex() + 1, 1), total);\n return { current, total };\n },\n { equal: (a, b) => a?.current === b?.current && a?.total === b?.total },\n );\n\n /** Resolved caption - reactive on activeStepIndex / stepsOnly / format / i18n. */\n protected readonly label = computed<string>(() => {\n const position = this.position();\n if (!position) {\n return '';\n }\n const fmt = this.format() ?? this.i18n().textStepperFormat;\n return fmt(position.current, position.total);\n });\n\n /**\n * {@link label} for the live span: the bundle and a consumer `format`\n * (which may itself be language-dependent) are read untracked.\n */\n protected readonly liveLabel = computed<string>(() => {\n const position = this.position();\n if (!position) {\n return '';\n }\n return untracked(() =>\n (this.format() ?? this.i18n().textStepperFormat)(position.current, position.total),\n );\n });\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n warnStepperControlUnhosted('cngx-stepper-count', this.resolvedHost);\n }\n }\n}\n","import {\n afterEveryRender,\n afterRenderEffect,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n type Signal,\n} from '@angular/core';\n\nimport { CngxAsyncClick } from '@cngx/common/interactive';\nimport { cngxDevWarn } from '@cngx/utils';\n\nimport { injectStepperI18n } from '../i18n/stepper-i18n';\nimport { CNGX_STEPPER_HOST, type CngxStepperHost } from '../stepper-host.token';\nimport { warnStepperControlUnhosted } from '../warn-stepper-unhosted';\n\n/**\n * Turns any clickable element into a stepper \"Back\" control. Resolves\n * its host the same way `CngxStepperCount` does - an explicit `[host]`\n * input (for placement outside the stepper tree) falling back to the\n * ambient {@link CNGX_STEPPER_HOST}.\n *\n * `(click)` retreats via `selectPrevious()`. The control disables itself\n * when there is no earlier step (`!canGoPrevious()`) OR while a commit is\n * in flight (`busy()`): `selectPrevious()` writes `activeStepIndex`\n * directly, bypassing the commit controller, so disabling it during an\n * in-flight forward commit prevents a navigate-mid-commit race. The gate\n * is the host's `canGoPrevious` bound - never re-derived from `stepsOnly`.\n *\n * Reflects the disabled state via `aria-disabled` only - never native\n * `disabled` - so the control stays focusable and AT-reachable; the\n * `handleClick` guard blocks the action while disabled.\n *\n * ```html\n * <button cngxStepperPrevious>Back</button>\n * ```\n *\n * @category common/stepper\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/controls/stepper-previous.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepperNext, CngxStepperComplete, CngxStepperHost\n */\n@Directive({\n selector: '[cngxStepperPrevious]',\n standalone: true,\n exportAs: 'cngxStepperPrevious',\n host: {\n '(click)': 'handleClick($event)',\n '[attr.aria-disabled]': 'disabled() || null',\n },\n})\nexport class CngxStepperPrevious {\n /**\n * Explicit stepper-host reference for placement *outside* the stepper\n * tree (`[host]=\"s.presenter\"`). When unset, the ambient\n * {@link CNGX_STEPPER_HOST} is injected.\n */\n readonly host = input<CngxStepperHost | null>(null);\n\n private readonly injectedHost = inject(CNGX_STEPPER_HOST, { optional: true });\n private readonly resolvedHost = computed<CngxStepperHost | null>(\n () => this.host() ?? this.injectedHost,\n );\n\n private readonly coPlacedAsyncClick = inject(CngxAsyncClick, { self: true, optional: true });\n\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly i18n = injectStepperI18n();\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n warnStepperControlUnhosted('cngxStepperPrevious', this.resolvedHost);\n }\n\n // Fallback accessible name for icon-only hosts: while the element\n // renders no text and the consumer supplied no label of their own,\n // the i18n `previousStep` phrase fills the gap. Re-checked after every\n // render (cheap string read) so a late-arriving visible label wins\n // again - a forced aria-label over visible text would break\n // label-in-name (WCAG 2.5.3). The data flag marks ownership so a\n // consumer-authored aria-label is never touched.\n afterEveryRender(() => {\n const el = this.elementRef.nativeElement;\n const ownsFallback = el.hasAttribute('data-cngx-label-fallback');\n const consumerLabelled =\n (!ownsFallback && el.hasAttribute('aria-label')) || el.hasAttribute('aria-labelledby');\n if (consumerLabelled) {\n return;\n }\n const hasText = (el.textContent ?? '').trim() !== '';\n if (hasText && ownsFallback) {\n el.removeAttribute('aria-label');\n el.removeAttribute('data-cngx-label-fallback');\n } else if (!hasText && !ownsFallback) {\n el.setAttribute('aria-label', this.i18n().previousStep);\n el.setAttribute('data-cngx-label-fallback', '');\n }\n });\n\n // A language switch re-labels a fallback this directive owns.\n afterRenderEffect(() => {\n const label = this.i18n().previousStep;\n const el = this.elementRef.nativeElement;\n if (el.hasAttribute('data-cngx-label-fallback')) {\n el.setAttribute('aria-label', label);\n }\n });\n\n if (typeof ngDevMode !== 'undefined' && ngDevMode && this.coPlacedAsyncClick) {\n cngxDevWarn(\n 'CNGX1038',\n '[cngxStepperPrevious] and [cngxAsyncClick] on the same element ' +\n 'both gate aria-disabled. Use one or the other.',\n );\n }\n }\n\n /** `true` when retreat is unavailable: no earlier step or commit busy. */\n protected readonly disabled: Signal<boolean> = computed(() => {\n const host = this.resolvedHost();\n return !host || !host.canGoPrevious() || host.busy();\n });\n\n /** @internal */\n protected handleClick(event: Event): void {\n if (this.disabled()) {\n event.preventDefault();\n return;\n }\n this.resolvedHost()?.selectPrevious();\n }\n}\n","import {\n afterEveryRender,\n afterRenderEffect,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n type Signal,\n} from '@angular/core';\n\nimport { CngxAsyncClick } from '@cngx/common/interactive';\nimport { cngxDevWarn } from '@cngx/utils';\n\nimport { injectStepperI18n } from '../i18n/stepper-i18n';\nimport { CNGX_STEPPER_HOST, type CngxStepperHost } from '../stepper-host.token';\nimport { warnStepperControlUnhosted } from '../warn-stepper-unhosted';\n\n/**\n * Turns any clickable element into a stepper \"Continue\" control. Same\n * host resolution as `CngxStepperCount` - explicit `[host]` input\n * falling back to the ambient {@link CNGX_STEPPER_HOST}.\n *\n * `(click)` advances via `selectNext()`. A turnkey re-entrancy guard\n * disables the control when there is no enabled next step\n * (`!canGoNext()`) OR while a commit is in flight (`busy()`) - an opt-in\n * guard a consumer forgets is a silent double-commit (Pillar 2). The\n * gate reads the host's `canGoNext` bound, which derives from the same\n * `select()` predicates, so the affordance can never drift from the\n * navigation it triggers.\n *\n * Reflects the disabled state via `aria-disabled` only - never native\n * `disabled` (which would steal focus, so AT could not reach the control\n * to learn it is at-a-bound / busy) and never `aria-busy` (that is\n * `CngxAsyncStatus`'s sole responsibility). The `handleClick` guard\n * blocks the action while disabled. Co-placing `[cngxAsyncClick]` here\n * (which also gates `aria-disabled` and adds native `disabled`) warns in\n * dev mode.\n *\n * ```html\n * <button cngxStepperNext>Continue</button>\n * ```\n *\n * @category common/stepper\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/controls/stepper-next.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepperPrevious, CngxStepperComplete, CngxAsyncStatus, CngxStepperHost\n */\n@Directive({\n selector: '[cngxStepperNext]',\n standalone: true,\n exportAs: 'cngxStepperNext',\n host: {\n '(click)': 'handleClick($event)',\n '[attr.aria-disabled]': 'disabled() || null',\n },\n})\nexport class CngxStepperNext {\n /**\n * Explicit stepper-host reference for placement *outside* the stepper\n * tree (`[host]=\"s.presenter\"`). When unset, the ambient\n * {@link CNGX_STEPPER_HOST} is injected.\n */\n readonly host = input<CngxStepperHost | null>(null);\n\n private readonly injectedHost = inject(CNGX_STEPPER_HOST, { optional: true });\n private readonly resolvedHost = computed<CngxStepperHost | null>(\n () => this.host() ?? this.injectedHost,\n );\n\n private readonly coPlacedAsyncClick = inject(CngxAsyncClick, { self: true, optional: true });\n\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly i18n = injectStepperI18n();\n\n /** `true` when advancing is unavailable: no enabled next step or commit busy. */\n protected readonly disabled: Signal<boolean> = computed(() => {\n const host = this.resolvedHost();\n return !host || !host.canGoNext() || host.busy();\n });\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n warnStepperControlUnhosted('cngxStepperNext', this.resolvedHost);\n }\n\n // Fallback accessible name for icon-only hosts: while the element\n // renders no text and the consumer supplied no label of their own,\n // the i18n `nextStep` phrase fills the gap. Re-checked after every\n // render (cheap string read) so a late-arriving visible label wins\n // again - a forced aria-label over visible text would break\n // label-in-name (WCAG 2.5.3). The data flag marks ownership so a\n // consumer-authored aria-label is never touched.\n afterEveryRender(() => {\n const el = this.elementRef.nativeElement;\n const ownsFallback = el.hasAttribute('data-cngx-label-fallback');\n const consumerLabelled =\n (!ownsFallback && el.hasAttribute('aria-label')) || el.hasAttribute('aria-labelledby');\n if (consumerLabelled) {\n return;\n }\n const hasText = (el.textContent ?? '').trim() !== '';\n if (hasText && ownsFallback) {\n el.removeAttribute('aria-label');\n el.removeAttribute('data-cngx-label-fallback');\n } else if (!hasText && !ownsFallback) {\n el.setAttribute('aria-label', this.i18n().nextStep);\n el.setAttribute('data-cngx-label-fallback', '');\n }\n });\n\n // A language switch re-labels a fallback this directive owns.\n afterRenderEffect(() => {\n const label = this.i18n().nextStep;\n const el = this.elementRef.nativeElement;\n if (el.hasAttribute('data-cngx-label-fallback')) {\n el.setAttribute('aria-label', label);\n }\n });\n\n if (typeof ngDevMode !== 'undefined' && ngDevMode && this.coPlacedAsyncClick) {\n cngxDevWarn(\n 'CNGX1038',\n '[cngxStepperNext] and [cngxAsyncClick] on the same element ' +\n 'both gate aria-disabled. Use one or the other.',\n );\n }\n }\n\n /** @internal */\n protected handleClick(event: Event): void {\n if (this.disabled()) {\n event.preventDefault();\n return;\n }\n this.resolvedHost()?.selectNext();\n }\n}\n","import {\n computed,\n Directive,\n effect,\n inject,\n input,\n output,\n untracked,\n type Signal,\n} from '@angular/core';\n\nimport { CngxAsyncClick } from '@cngx/common/interactive';\nimport { createTransitionTracker } from '@cngx/core/utils';\n\nimport { CNGX_STEPPER_HOST, type CngxStepperHost } from '../stepper-host.token';\nimport { warnStepperControlUnhosted } from '../warn-stepper-unhosted';\n\n/**\n * Turns any clickable element into a stepper \"Finish\" control. Unlike\n * `CngxStepperNext` (which *reflects* the commit state and advances),\n * the finish action *runs*: the directive composes `CngxAsyncClick` via\n * `hostDirectives`, so the runner owns the click lifecycle, `aria-busy`,\n * and the pending-disable exactly as it does on a standalone button. The\n * finish action is fed through the aliased `[cngxStepperComplete]` input.\n *\n * Resolves its host like the sibling controls - explicit `[host]` input\n * falling back to the ambient {@link CNGX_STEPPER_HOST}. {@link isActive}\n * exposes whether the active step is the last one, so a consumer renders\n * the finish control only on the final step. `(completed)` emits once\n * after the action resolves successfully.\n *\n * ```html\n * @if (s.presenter.isLastStep()) {\n * <button [cngxStepperComplete]=\"submit\" (completed)=\"done()\">Finish</button>\n * }\n * ```\n *\n * @category common/stepper\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/controls/stepper-complete.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStepperNext, CngxStepperPrevious, CngxAsyncClick, CngxStepperHost\n */\n@Directive({\n selector: '[cngxStepperComplete]',\n standalone: true,\n exportAs: 'cngxStepperComplete',\n hostDirectives: [\n {\n directive: CngxAsyncClick,\n inputs: [\n 'cngxAsyncClick: cngxStepperComplete',\n 'feedbackDuration',\n 'enabled',\n 'succeededAnnouncement',\n 'failedAnnouncement',\n ],\n },\n ],\n})\nexport class CngxStepperComplete {\n /**\n * Explicit stepper-host reference for placement *outside* the stepper\n * tree (`[host]=\"s.presenter\"`). When unset, the ambient\n * {@link CNGX_STEPPER_HOST} is injected.\n */\n readonly host = input<CngxStepperHost | null>(null);\n\n /**\n * Emits once per `pending → success` transition of the finish action.\n * Does NOT re-emit when the `feedbackDuration` window resets the runner\n * back to idle - the transition tracker guards on the success edge only.\n */\n readonly completed = output<void>();\n\n private readonly injectedHost = inject(CNGX_STEPPER_HOST, { optional: true });\n private readonly resolvedHost = computed<CngxStepperHost | null>(\n () => this.host() ?? this.injectedHost,\n );\n private readonly runner = inject(CngxAsyncClick, { host: true });\n\n /** `true` when the active step is the last one - the finish step. */\n readonly isActive: Signal<boolean> = computed(() => this.resolvedHost()?.isLastStep() ?? false);\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n warnStepperControlUnhosted('cngxStepperComplete', this.resolvedHost);\n }\n\n const tracker = createTransitionTracker(() => this.runner.status());\n effect(() => {\n if (tracker.current() === 'success' && tracker.previous() !== 'success') {\n // Consumer handlers run outside the tracking context so their\n // ambient signal reads cannot widen this effect's dep graph.\n untracked(() => this.completed.emit());\n }\n });\n }\n}\n","import { computed } from '@angular/core';\n\nimport { buildAsyncStateView, type StatusTransition } from '@cngx/core/utils';\n\nimport type { CngxStepNode, CngxStepRegistration, CngxStepperHost } from './stepper-host.token';\n\nconst EMPTY_NODES: readonly CngxStepNode[] = Object.freeze([]);\n\n/**\n * Builds a live delegating {@link CngxStepperHost} proxy over a supplier\n * signal. Every signal member is a `computed()` reading\n * `supplier()?.<member>()`, every method forwards to\n * `supplier()?.<method>(...)`. This is the spelled-out shape for\n * re-providing an input-derived host through DI - you cannot\n * `useExisting` an `input()` value, so the footer provides this proxy\n * once and it tracks whichever host the supplier currently resolves.\n *\n * **Null-supplier neutral set (the disabled-by-default contract).** When\n * the supplier resolves `null` (a standalone footer with neither `[host]`\n * nor an ambient stepper), every navigation affordance must render\n * *inert*, never falsely enabled: `canGoPrevious` / `canGoNext` collapse\n * to `false` so Back / Next render disabled, and every method is a no-op.\n *\n * `create*` pure factory - no injection context required (`computed()`\n * only). Single consumer (the footer); the surface is load-bearing, not\n * speculative.\n *\n * @category common/stepper\n * @since 0.1.0\n * @relatedTo CngxStepperFooter, CngxStepperHost\n */\nexport function createStepperHostProxy(supplier: () => CngxStepperHost | null): CngxStepperHost {\n return {\n // Core projection / state - empty / out-of-range when null. The array\n // fallbacks return the shared frozen EMPTY_NODES reference, so no `equal`\n // fn is needed: the output is reference-stable across reads (either the\n // supplier's own structural-equal signal value, or this one constant).\n stepTree: computed(() => supplier()?.stepTree() ?? EMPTY_NODES),\n flatSteps: computed(() => supplier()?.flatSteps() ?? EMPTY_NODES),\n stepsOnly: computed(() => supplier()?.stepsOnly() ?? EMPTY_NODES),\n visibleStripNodes: computed(() => supplier()?.visibleStripNodes() ?? EMPTY_NODES),\n activeStepIndex: computed(() => supplier()?.activeStepIndex() ?? -1),\n activeStepId: computed(() => supplier()?.activeStepId() ?? null),\n activeGroupId: computed(() => supplier()?.activeGroupId() ?? null),\n linear: computed(() => supplier()?.linear() ?? false),\n commitMode: computed(() => supplier()?.commitMode?.() ?? 'pessimistic'),\n orientation: computed(() => supplier()?.orientation() ?? 'horizontal'),\n intendedStepIndex: computed(() => supplier()?.intendedStepIndex()),\n lastOutcome: computed(() => supplier()?.lastOutcome()),\n lastFailedIndex: computed(() => supplier()?.lastFailedIndex()),\n originIndexDuringCommit: computed(() => supplier()?.originIndexDuringCommit()),\n\n // Bounds + labels - the safety-critical canGo* pair collapses to\n // `false` so a null host yields disabled Back / Next, never clickable.\n stepCount: computed(() => supplier()?.stepCount() ?? 0),\n isFirstStep: computed(() => supplier()?.isFirstStep() ?? true),\n isLastStep: computed(() => supplier()?.isLastStep() ?? true),\n canGoPrevious: computed(() => supplier()?.canGoPrevious() ?? false),\n canGoNext: computed(() => supplier()?.canGoNext() ?? false),\n busy: computed(() => supplier()?.busy() ?? false),\n nextStepLabel: computed(() => supplier()?.nextStepLabel()),\n previousStepLabel: computed(() => supplier()?.previousStepLabel()),\n\n // Composite members delegate their sub-signals, idle when null. The\n // proxy only forwards - the real tracker is the presenter's, so build\n // the static neutral shape rather than calling createTransitionTracker.\n commitState: buildAsyncStateView<number | undefined>({\n status: computed(() => supplier()?.commitState.status() ?? 'idle'),\n data: computed(() => supplier()?.commitState.data()),\n error: computed(() => supplier()?.commitState.error()),\n lastUpdated: computed(() => supplier()?.commitState.lastUpdated()),\n }),\n commitTransition: {\n current: computed(() => supplier()?.commitTransition.current() ?? 'idle'),\n previous: computed(() => supplier()?.commitTransition.previous() ?? 'idle'),\n } satisfies StatusTransition,\n\n // Reachability predicate - neutral `false` when null so a header\n // over a missing host is never falsely navigable.\n canNavigateTo: (index: number) => supplier()?.canNavigateTo(index) ?? false,\n\n // Methods forward; no-op when null.\n select: (index: number) => supplier()?.select(index),\n selectNext: () => supplier()?.selectNext(),\n selectPrevious: () => supplier()?.selectPrevious(),\n selectById: (id: string) => supplier()?.selectById(id),\n reset: () => supplier()?.reset(),\n clearLastFailed: () => supplier()?.clearLastFailed(),\n register: (handle: CngxStepRegistration, parentId?: string | null) =>\n supplier()?.register(handle, parentId),\n unregister: (id: string) => supplier()?.unregister(id),\n };\n}\n","import { type EnvironmentProviders, makeEnvironmentProviders, type Provider } from '@angular/core';\nimport { cngxDevWarn } from '@cngx/utils';\n\nimport { provideStepperI18n, type CngxStepperI18nFeature } from './i18n/stepper-i18n';\nimport {\n provideStepperConfig,\n provideStepperConfigAt,\n type CngxStepperConfigFeature,\n} from './stepper-config';\n\n/**\n * Union of every feature kind {@link provideCngxStepper} accepts. Today:\n * config (`CNGX_STEPPER_CONFIG`) and i18n (`CNGX_STEPPER_I18N`). Future\n * surfaces widen this union and dispatch via the hidden `_target`\n * discriminator.\n *\n * @category common/stepper\n */\nexport type CngxStepperFeature = CngxStepperConfigFeature | CngxStepperI18nFeature;\n\n/** @internal */\ninterface PartitionedFeatures {\n readonly config: CngxStepperConfigFeature[];\n readonly i18n: CngxStepperI18nFeature[];\n}\n\n/** @internal */\nfunction partitionFeatures(\n features: readonly CngxStepperFeature[],\n caller: 'provideCngxStepper' | 'provideCngxStepperAt',\n): PartitionedFeatures {\n const config: CngxStepperConfigFeature[] = [];\n const i18n: CngxStepperI18nFeature[] = [];\n for (const feat of features) {\n if (feat._target === 'i18n') {\n i18n.push(feat);\n continue;\n }\n if (feat._target === 'config') {\n config.push(feat);\n continue;\n }\n // Unbranded feature - drop + dev-warn (mirrors `provideCngxTabs`).\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n if (caller === 'provideCngxStepperAt') {\n cngxDevWarn(\n 'CNGX1041',\n 'provideCngxStepperAt(): dropped feature without a `_target` ' +\n 'discriminator. Pass config through the `with*` helpers of @cngx/common/stepper ' +\n 'and labels through `withStepperI18nLabels(...)`.',\n );\n } else {\n cngxDevWarn(\n 'CNGX1041',\n 'provideCngxStepper(): dropped feature without a `_target` ' +\n 'discriminator. Pass config through the `with*` helpers of @cngx/common/stepper ' +\n 'and labels through `withStepperI18nLabels(...)`.',\n );\n }\n }\n }\n return { config, i18n };\n}\n\n/**\n * Unified aggregator for the stepper family. Filters by `_target` and\n * forwards: config features to {@link provideStepperConfig}, i18n\n * features to {@link provideStepperI18n}. Mirrors `provideCngxTabs` /\n * `provideCngxSelect`.\n *\n * Returns {@link EnvironmentProviders} for app-root use; the\n * component-scoped twin {@link provideCngxStepperAt} returns\n * `Provider[]` because `viewProviders` cannot accept opaque\n * `EnvironmentProviders`.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideCngxStepper(\n * withStepperDefaultOrientation('vertical'),\n * withStepperLinear(true),\n * withStepperAriaLabels({ stepperRegion: 'Schrittfolge' }),\n * withStepperI18nLabels({ stepperLabel: 'Schrittfolge', previousStep: 'Vorheriger' }),\n * ),\n * ],\n * });\n * ```\n *\n * @category common/stepper\n */\nexport function provideCngxStepper(\n ...features: readonly CngxStepperFeature[]\n): EnvironmentProviders {\n const { config, i18n } = partitionFeatures(features, 'provideCngxStepper');\n // `provideStepperConfig` returns EnvironmentProviders, `provideStepperI18n`\n // returns Provider - `makeEnvironmentProviders` takes both.\n return makeEnvironmentProviders([\n provideStepperConfig(...config),\n ...(i18n.length > 0 ? [provideStepperI18n(...i18n)] : []),\n ]);\n}\n\n/**\n * Component-scoped twin of {@link provideCngxStepper}. Spread into\n * `viewProviders` or `providers`. Same dispatch semantics - only the\n * provider scope differs.\n *\n * ```ts\n * @Component({\n * viewProviders: [\n * ...provideCngxStepperAt(\n * withStepperDefaultOrientation('vertical'),\n * withStepperI18nLabels({ stepperLabel: 'Schrittfolge' }),\n * ),\n * ],\n * })\n * ```\n *\n * @category common/stepper\n */\nexport function provideCngxStepperAt(...features: readonly CngxStepperFeature[]): Provider[] {\n const { config, i18n } = partitionFeatures(features, 'provideCngxStepperAt');\n return [\n // Gate like i18n: an i18n-only call must not plant an empty config\n // at this injector level and shadow an app-wide provideStepperConfig.\n ...(config.length > 0 ? provideStepperConfigAt(...config) : []),\n ...(i18n.length > 0 ? [provideStepperI18n(...i18n)] : []),\n ];\n}\n","/**\n * @module @cngx/common/stepper\n *\n * Level-2 directive-only logic for stepper / wizard flows. Ships the\n * presenter brain, atom directives, host tokens, router-sync, config\n * cascade, and i18n. Zero `@Component`, zero `.html`, zero `.css` -\n * those live in `@cngx/ui/stepper` (CNGX-standard skin) and\n * `@cngx/ui/mat-stepper` (Material twin).\n */\n\nexport { CngxStepperPresenter, type CngxStepperCommitAction } from './presenter.directive';\n\nexport {\n CNGX_STEPPER_HOST,\n type CngxStepperHost,\n type CngxStepNode,\n type CngxStepRegistration,\n type CngxStepStatus,\n} from './stepper-host.token';\n\nexport { CNGX_STEP_GROUP_HOST, type CngxStepGroupHost } from './step-group-host.token';\n\nexport {\n CNGX_STEP_PANEL_HOST,\n type CngxStepContentContext,\n type CngxStepLabelContext,\n type CngxStepPanelHost,\n} from './step-panel-host.token';\n\nexport { flatStepsEqual } from './step-tree.util';\n\nexport { CngxStep } from './step.directive';\nexport { CngxStepGroup } from './step-group.directive';\nexport { CngxStepLabel } from './step-label.directive';\nexport { CngxStepContent } from './step-content.directive';\n\nexport { CngxStepIndicator, type CngxStepIndicatorContext } from './slots/step-indicator.directive';\n\nexport { CngxStepBadge, type CngxStepBadgeContext } from './slots/step-badge.directive';\n\nexport {\n CngxStepBusySpinner,\n type CngxStepBusySpinnerContext,\n} from './slots/step-busy-spinner.directive';\n\nexport { CngxStepRejection, type CngxStepRejectionContext } from './slots/step-rejection.directive';\n\nexport { CngxStepError, type CngxStepErrorContext } from './slots/step-error.directive';\n\nexport {\n CngxStepGroupHeader,\n type CngxStepGroupHeaderContext,\n} from './slots/step-group-header.directive';\n\nexport { CngxStepperEmpty } from './slots/stepper-empty.directive';\n\nexport {\n CngxDotStepperDot,\n type CngxDotStepperDotContext,\n} from './slots/dot-stepper-dot.directive';\n\nexport {\n createStepperTemplateBindings,\n type CngxStepperTemplateBindings,\n type CngxStepperTemplateBindingsOptions,\n} from './slots/stepper-template-cascade';\n\nexport { CNGX_STEPPER_GLYPHS } from './glyphs';\n\nexport { CngxStepperRouterSync } from './router-sync.directive';\n\nexport {\n CNGX_STEPPER_CONFIG,\n type CngxStepperAriaLabels,\n type CngxStepperConfig,\n type CngxStepperConfigFeature,\n type CngxStepperDensity,\n type CngxStepperFallbackLabels,\n type CngxStepperGroupCollapse,\n type CngxStepperGroupSummary,\n type CngxStepperHeaderNavigation,\n type CngxStepperMobileCollapse,\n type CngxStepperMobileIndicatorPosition,\n type CngxStepperSkin,\n type CngxStepperTemplates,\n injectStepperConfig,\n provideStepperConfig,\n provideStepperConfigAt,\n withStepperDefaultOrientation,\n withStepperDensity,\n withStepperAriaLabels,\n withStepperCommitMode,\n withStepperConnectors,\n withStepperFallbackLabels,\n withStepperGroupCollapse,\n withStepperGroupCollapseSummary,\n withStepperHeaderNavigation,\n withStepperLinear,\n withStepperMobileCollapse,\n withStepperMobileIndicatorPosition,\n withStepperMobileSwipe,\n withStepperRouterSync,\n withStepperSkin,\n withStepIndicatorTemplate,\n withStepBadgeTemplate,\n withStepBusySpinnerTemplate,\n withStepRejectionTemplate,\n withStepErrorTemplate,\n withStepGroupHeaderTemplate,\n withStepperEmptyTemplate,\n withDotStepperDotTemplate,\n} from './stepper-config';\n\nexport {\n CNGX_STEPPER_I18N,\n type CngxStepperI18n,\n type CngxStepperI18nFeature,\n type CngxStepperI18nOverrides,\n type CngxStepperStatusLabels,\n injectStepperI18n,\n provideStepperI18n,\n withStepperI18nLabels,\n} from './i18n/stepper-i18n';\nexport {\n CNGX_STEPPER_LANGUAGE_EN,\n type CngxStepperLanguageSection,\n type CngxStepperStatusLanguage,\n} from './i18n/stepper-language-section';\nexport { resolveStepperStatusLabel } from './status-label';\n\nexport { createStepperDisplayMode, injectStepperCollapse } from './display-mode';\n\nexport {\n createStepperGroupSummary,\n type CngxStepperGroupSummaryView,\n type CngxStepperGroupSummaryOptions,\n} from './group-summary';\n\nexport {\n createStepperGroupNavigation,\n type CngxStepperGroupNavigationView,\n type CngxStepperGroupNavigationOptions,\n} from './group-navigation';\n\n// The following three blocks ship `@internal` factory helpers. They are\n// exported through `public-api.ts` so the sibling `@cngx/ui/stepper`\n// organism can consume them across the secondary-entry boundary\n// (ng-packagr has no cross-entry private surface). `disableInternal: true`\n// in `.compodocrc.json` hides them from generated docs; the LLM-md export\n// honours the same tag. Precedent: `CNGX_STEPPER_GLYPHS`, `flatStepsEqual`.\nexport {\n createStepperAccname,\n createStepperHostAttrs,\n type CngxStepperAccnameInputs,\n type CngxStepperHostAttrs,\n type CngxStepperHostAttrsInputs,\n} from './stepper-host-attrs';\n\nexport {\n createStepperStripKeyboardNav,\n type CngxStepperStripKeyboardNavOptions,\n} from './strip-keyboard-nav';\n\nexport {\n createStepperStateView,\n resolveStepperErrorSummary,\n type CngxStepperStateView,\n} from './stepper-state-view';\n\nexport {\n createStepperSlotContextBuilders,\n type CngxStepperSlotContextBuilders,\n type CngxStepperSlotContextBuildersInputs,\n} from './slot-context-builders';\n\nexport {\n createStepperAnnouncementBuilders,\n createStepperPanelRefs,\n type CngxStepperAnnouncementBuilders,\n type CngxStepperAnnouncementBuildersInputs,\n type CngxStepperPanelRefs,\n type CngxStepperPanelRefsInputs,\n} from './announcement-builders';\n\nexport { CngxStepperSwipeNav } from './swipe-nav.directive';\n\nexport { CngxStepperCount, type CngxStepperCountHost } from './stepper-count';\n\nexport { CngxStepperPrevious } from './controls/stepper-previous.directive';\nexport { CngxStepperNext } from './controls/stepper-next.directive';\nexport { CngxStepperComplete } from './controls/stepper-complete.directive';\nexport { createStepperHostProxy } from './create-stepper-host-proxy';\n\nexport {\n CNGX_STEPPER_COMMIT_HANDLER_FACTORY,\n type CngxStepperCommitHandler,\n type CngxStepperCommitHandlerFactory,\n type CngxStepperCommitHandlerOptions,\n type CngxStepperCommitResolution,\n createStepperCommitHandler,\n} from './commit-handler';\n\nexport {\n provideCngxStepper,\n provideCngxStepperAt,\n type CngxStepperFeature,\n} from './provide-cngx-stepper';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAwDA;;;;;;;AAOG;AACG,SAAU,0BAA0B,CACxC,IAAqC,EAAA;AAErC,IAAA,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI;IAC3B,OAAO;QACL,YAAY,EAAE,UAAU,CAAC,YAAY;AAErC,QAAA,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAA;YACnD,UAAU,CAAC,KAAK,CACd,CAAC,QAAQ,KAAK,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,EACpE,OAAO,EACP,SAAS,EACT;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UAAU,EACV,8DAA8D;oBAC5D,iFAAiF;AACjF,oBAAA,kDAAkD,CACrD;YACH;iBAAO;gBACL,WAAW,CACT,UAAU,EACV,4DAA4D;oBAC1D,iFAAiF;AACjF,oBAAA,kDAAkD,CACrD;YACH;QACF;IACF;AACA,IAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;AACzB;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACG,SAAU,kBAAkB,CAChC,GAAG,QAAuC,EAAA;AAE1C,IAAA,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB,CAAC;;;AAG1E,IAAA,OAAO,wBAAwB,CAAC;QAC9B,oBAAoB,CAAC,GAAG,MAAM,CAAC;QAC/B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;AAC1D,KAAA,CAAC;AACJ;AAEA;;;;;;;;;;;;;;;;;AAiBG;AACG,SAAU,oBAAoB,CAAC,GAAG,QAAuC,EAAA;AAC7E,IAAA,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,iBAAiB,CAAC,QAAQ,EAAE,sBAAsB,CAAC;IAC5E,OAAO;;;AAGL,QAAA,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,sBAAsB,CAAC,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;QAC/D,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;KAC1D;AACH;;AChIA;;;;;;;;AAQG;;ACRH;;AAEG;;;;"}
1
+ {"version":3,"file":"cngx-common-stepper.mjs","sources":["../../../projects/common/stepper/commit-handler.ts","../../../projects/common/stepper/i18n/stepper-language-section.ts","../../../projects/common/stepper/i18n/stepper-i18n.ts","../../../projects/common/stepper/stepper-config.ts","../../../projects/common/stepper/stepper-host.token.ts","../../../projects/common/stepper/step-tree.util.ts","../../../projects/common/stepper/presenter.directive.ts","../../../projects/common/stepper/step-group-host.token.ts","../../../projects/common/stepper/step-panel-host.token.ts","../../../projects/common/stepper/step-content.directive.ts","../../../projects/common/stepper/step-label.directive.ts","../../../projects/common/stepper/step.directive.ts","../../../projects/common/stepper/step-group.directive.ts","../../../projects/common/stepper/slots/step-indicator.directive.ts","../../../projects/common/stepper/slots/step-badge.directive.ts","../../../projects/common/stepper/slots/step-busy-spinner.directive.ts","../../../projects/common/stepper/slots/step-rejection.directive.ts","../../../projects/common/stepper/slots/step-error.directive.ts","../../../projects/common/stepper/slots/step-group-header.directive.ts","../../../projects/common/stepper/slots/stepper-empty.directive.ts","../../../projects/common/stepper/slots/dot-stepper-dot.directive.ts","../../../projects/common/stepper/slots/stepper-template-cascade.ts","../../../projects/common/stepper/router-sync.directive.ts","../../../projects/common/stepper/status-label.ts","../../../projects/common/stepper/display-mode.ts","../../../projects/common/stepper/group-summary.ts","../../../projects/common/stepper/group-navigation.ts","../../../projects/common/stepper/stepper-host-attrs.ts","../../../projects/common/stepper/strip-keyboard-nav.ts","../../../projects/common/stepper/stepper-state-view.ts","../../../projects/common/stepper/slot-context-builders.ts","../../../projects/common/stepper/announcement-builders.ts","../../../projects/common/stepper/swipe-nav.directive.ts","../../../projects/common/stepper/warn-stepper-unhosted.ts","../../../projects/common/stepper/stepper-count.ts","../../../projects/common/stepper/controls/stepper-previous.directive.ts","../../../projects/common/stepper/controls/stepper-next.directive.ts","../../../projects/common/stepper/controls/stepper-complete.directive.ts","../../../projects/common/stepper/create-stepper-host-proxy.ts","../../../projects/common/stepper/provide-cngx-stepper.ts","../../../projects/common/stepper/public-api.ts","../../../projects/common/stepper/cngx-common-stepper.ts"],"sourcesContent":["import { InjectionToken, type Signal } from '@angular/core';\nimport { isObservable, type Observable, type Subscription } from 'rxjs';\n\nimport { type CngxCommitController, type CngxCommitHandle } from '@cngx/common/data';\nimport { CngxRuntimeError } from '@cngx/utils';\n\nimport type { CngxStepperCommitAction } from './presenter.directive';\n\n/**\n * How a commit-gated step change settled. `'refused'` is a `false` answer\n * from `commitAction` (the action declined on purpose, nothing failed);\n * `'failed'` is a throw, a rejected promise or an erroring observable.\n */\nexport type CngxStepperCommitResolution = 'accepted' | 'refused' | 'failed';\n\n/**\n * Adapter between the lifted commit-controller and the stepper's\n * action shape. The presenter delegates to `beginTransition` on\n * every step change driven by `commitAction`.\n */\nexport interface CngxStepperCommitHandler {\n /**\n * Start a transition commit. Returns synchronously; the controller's\n * `state` signal reports the in-flight status.\n *\n * @param onResolve fires `'accepted'` when the action answers `true`,\n * `'refused'` when it answers `false`, `'failed'` when\n * it throws, rejects or errors; skipped on supersede.\n */\n beginTransition(\n fromIndex: number,\n toIndex: number,\n action: CngxStepperCommitAction,\n onResolve: (outcome: CngxStepperCommitResolution) => void,\n ): void;\n\n /** Cancel the in-flight transition without firing callbacks. */\n cancel(): void;\n\n /** Live `pending` flag from the controller. */\n readonly isCommitting: Signal<boolean>;\n}\n\n/**\n * Options for {@link createStepperCommitHandler}.\n */\nexport interface CngxStepperCommitHandlerOptions {\n readonly controller: CngxCommitController<number>;\n}\n\n/**\n * Build a stepper commit handler over an existing {@link CngxCommitController}.\n * Resolves `Observable<boolean>` / `Promise<boolean>` / `boolean` returns into\n * one {@link CngxStepperCommitResolution}: `true` accepts, `false` refuses\n * (the controller settles to `'idle'` and stores no error), a throw fails.\n */\nexport function createStepperCommitHandler(\n opts: CngxStepperCommitHandlerOptions,\n): CngxStepperCommitHandler {\n const { controller } = opts;\n return {\n isCommitting: controller.isCommitting,\n\n beginTransition(fromIndex, toIndex, action, onResolve) {\n controller.begin(\n (handlers) => runStepperAction(action, fromIndex, toIndex, handlers),\n toIndex,\n fromIndex,\n {\n onSuccess: () => onResolve('accepted'),\n onError: () => onResolve('failed'),\n onRefused: () => onResolve('refused'),\n },\n );\n },\n\n cancel() {\n controller.cancel();\n },\n };\n}\n\n/** @internal */\nfunction runStepperAction(\n action: CngxStepperCommitAction,\n fromIndex: number,\n toIndex: number,\n handlers: {\n readonly onSuccess: (committed: number | undefined) => void;\n readonly onError: (err: unknown) => void;\n readonly onRefused: () => void;\n },\n): CngxCommitHandle {\n let cancelled = false;\n let unsubscribe: (() => void) | null = null;\n\n const safeSuccess = (accept: boolean): void => {\n if (cancelled) {\n return;\n }\n if (accept) {\n handlers.onSuccess(toIndex);\n } else {\n handlers.onRefused();\n }\n };\n const safeError = (err: unknown): void => {\n if (cancelled) {\n return;\n }\n handlers.onError(err);\n };\n\n let result: boolean | Promise<boolean> | Observable<boolean>;\n try {\n result = action(fromIndex, toIndex);\n } catch (err: unknown) {\n safeError(err);\n return {\n cancel: () => {\n cancelled = true;\n },\n };\n }\n\n if (isObservable(result)) {\n // Synchronous Observables (`of(true)`) emit inside `.subscribe`\n // before the assignment binds - `sub` would be in TDZ. Declare\n // the handle on a `let` first.\n let sub: Subscription | null = null;\n let done = false;\n sub = result.subscribe({\n next: (accept) => {\n if (done) {\n return;\n }\n // Done-latch, not just unsubscribe: a synchronous emission fires\n // while `sub` is still null, so a non-completing source would\n // otherwise stay live and re-resolve on its next emission.\n done = true;\n safeSuccess(accept);\n sub?.unsubscribe();\n },\n error: (err: unknown) => {\n if (done) {\n return;\n }\n safeError(err);\n },\n complete: () => {\n // EMPTY-style sources complete without emitting; without this arm\n // the commit stays 'pending' forever and busy() latches true.\n if (!done) {\n safeError(\n new CngxRuntimeError(\n 'CNGX1059',\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n '[cngxStepper] commitAction completed without emitting true or false.',\n ),\n );\n }\n },\n });\n if (done) {\n // The in-next unsubscribe was a no-op for a sync emission; close\n // the still-live subscription now that `sub` is bound.\n sub.unsubscribe();\n }\n unsubscribe = () => sub?.unsubscribe();\n } else if (result != null && typeof (result as { then?: unknown }).then === 'function') {\n (result as Promise<boolean>).then(safeSuccess, safeError);\n } else {\n safeSuccess(result as boolean);\n }\n\n return {\n cancel: () => {\n cancelled = true;\n unsubscribe?.();\n },\n };\n}\n\n/**\n * Factory signature for {@link CngxStepperCommitHandler}. Override\n * {@link CNGX_STEPPER_COMMIT_HANDLER_FACTORY} for retry-with-backoff,\n * telemetry, or offline queues.\n */\nexport type CngxStepperCommitHandlerFactory = (\n opts: CngxStepperCommitHandlerOptions,\n) => CngxStepperCommitHandler;\n\n/**\n * DI token carrying the factory the presenter uses to allocate its commit\n * handler. Symmetric to the select family's `CNGX_ARRAY_COMMIT_HANDLER_FACTORY`.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/commit-handler.ts\n * @since 0.3.0\n */\nexport const CNGX_STEPPER_COMMIT_HANDLER_FACTORY =\n new InjectionToken<CngxStepperCommitHandlerFactory>('CngxStepperCommitHandlerFactory', {\n providedIn: 'root',\n factory: () => createStepperCommitHandler,\n });\n","import type { CngxMessage } from '@cngx/core/i18n';\n\n/**\n * The status-pill words of the stepper section.\n *\n * @since 0.3.0\n */\nexport interface CngxStepperStatusLanguage {\n readonly done: string;\n readonly inProgress: string;\n readonly upNext: string;\n readonly errored: string;\n /** The status word of a step whose change the commit action refused. */\n readonly refused: string;\n}\n\n/**\n * The stepper section of a {@link CngxLanguagePack}: the copy of\n * `@cngx/common/stepper` and of the steppers in `@cngx/ui/stepper` and\n * `@cngx/ui/mat-stepper`. It feeds `CNGX_STEPPER_I18N` and the copy keys of\n * `CNGX_STEPPER_CONFIG` (`fallbackLabels`). Messages use\n * `{name}` placeholders; a plural message picks its form from `{count}`.\n *\n * @since 0.3.0\n * @relatedTo CNGX_STEPPER_I18N, CNGX_STEPPER_CONFIG\n */\nexport interface CngxStepperLanguageSection {\n /** Accessible name of the stepper. */\n readonly stepperLabel: string;\n /** `aria-roledescription` of the stepper organism. */\n readonly stepRoleDescription: string;\n /** Role description of compact step indicators (dot stepper, mobile dots). */\n readonly stepIndicatorRoleDescription: string;\n /** Role description of a step group header. */\n readonly groupRoleDescription: string;\n /** `{label}`, `{position}`, `{count}`: the accessible name of a step. */\n readonly selectedStep: CngxMessage;\n /** `{step}`, `{detail}`: a step name followed by its status or its label. */\n readonly stepWithDetail: CngxMessage;\n /** Plural on `{count}`: the number of steps with errors. */\n readonly stepHasErrors: CngxMessage;\n readonly previousStep: string;\n readonly nextStep: string;\n readonly commitFailedRetry: string;\n /** Announced while a step commit is in flight. */\n readonly commitInFlight: string;\n /** `{origin}`: announced when a failed commit reverts to the origin step. */\n readonly commitRolledBackTo: CngxMessage;\n /** `{base}`: the description of a rolled-back step, `{base}` being its name. */\n readonly stepRolledBack: CngxMessage;\n /** `{origin}`: announced when the commit action refuses a step change. */\n readonly commitRefused: CngxMessage;\n /** Announced when the commit action refuses a step change from an unlabelled step. */\n readonly commitRefusedGeneric: string;\n /** `{base}`: the description of a step whose change was refused, `{base}` being its name. */\n readonly stepRefused: CngxMessage;\n readonly statusLabels: CngxStepperStatusLanguage;\n /** `{current}`, `{count}`: the short progress caption. */\n readonly textStepperFormat: CngxMessage;\n /** Plural on `{count}`: a collapsed group's step count for screen readers. */\n readonly groupSummaryCount: CngxMessage;\n /** `{completed}`, plural on `{count}`: a collapsed group's progress for screen readers. */\n readonly groupSummaryProgress: CngxMessage;\n /** `{count}`: a collapsed group's visible step count. */\n readonly groupSummaryCountShort: CngxMessage;\n /** `{completed}`, `{count}`: a collapsed group's visible progress. */\n readonly groupSummaryProgressShort: CngxMessage;\n /** `{id}`: the last-resort label of an unlabelled Material step. */\n readonly stepFallbackLabel: CngxMessage;\n}\n\n/**\n * The English stepper section: the single source of the stepper's English\n * copy. `CNGX_STEPPER_I18N` and the `CNGX_STEPPER_CONFIG` labels default to it.\n *\n * @since 0.3.0\n * @relatedTo CNGX_STEPPER_I18N\n */\nexport const CNGX_STEPPER_LANGUAGE_EN: CngxStepperLanguageSection = {\n stepperLabel: 'Steps',\n stepRoleDescription: 'stepper',\n stepIndicatorRoleDescription: 'step indicator',\n groupRoleDescription: 'step group',\n selectedStep: 'Step {position} of {count}: {label}',\n stepWithDetail: '{step}: {detail}',\n stepHasErrors: { one: '{count} error', other: '{count} errors' },\n previousStep: 'Previous step',\n nextStep: 'Next step',\n commitFailedRetry: 'Could not save step - retry?',\n commitInFlight: 'Saving step…',\n commitRolledBackTo: 'Reverted to step \"{origin}\".',\n stepRolledBack: '{base} This step was rolled back.',\n commitRefused: 'Step change not allowed - stayed on step \"{origin}\".',\n commitRefusedGeneric: 'Step change not allowed.',\n stepRefused: '{base} This step change was not allowed.',\n statusLabels: {\n done: 'Done',\n inProgress: 'In progress',\n upNext: 'Up next',\n errored: 'Errored',\n refused: 'Not allowed',\n },\n textStepperFormat: 'Step {current} of {count}',\n groupSummaryCount: { one: '{count} step', other: '{count} steps' },\n groupSummaryProgress: {\n one: '{completed} of {count} step complete',\n other: '{completed} of {count} steps complete',\n },\n groupSummaryCountShort: '{count}',\n groupSummaryProgressShort: '{completed}/{count}',\n stepFallbackLabel: 'Step {id}',\n};\n\ndeclare module '@cngx/core/i18n' {\n interface CngxLanguagePack {\n readonly stepper: CngxStepperLanguageSection;\n }\n}\n","import { inject, InjectionToken, type Provider, type Signal } from '@angular/core';\nimport { createNestedLanguageSection, createSectionBundle, formatMessage } from '@cngx/core/i18n';\nimport { createNestedOverrideMerge } from '@cngx/core/utils';\n\nimport {\n CNGX_STEPPER_LANGUAGE_EN,\n type CngxStepperLanguageSection,\n type CngxStepperStatusLanguage,\n} from './stepper-language-section';\n\n/**\n * Status-pill labels used by the `stripe-status-rich` skin (and any\n * future skin / variant that surfaces a per-step status pill). Sub-\n * bundle of {@link CngxStepperI18n}; consumers override partial keys\n * via {@link withStepperI18nLabels} - un-overridden keys keep their\n * English defaults. The same shape as the section's status words, declared\n * once as {@link CngxStepperStatusLanguage}.\n */\nexport type CngxStepperStatusLabels = CngxStepperStatusLanguage;\n\n/**\n * Stepper i18n surface. Library defaults are English; locales come from\n * consumer overrides via {@link provideStepperI18n}. Sibling of\n * `CNGX_TABS_I18N` / `CNGX_CHART_I18N`.\n */\nexport interface CngxStepperI18n {\n /**\n * Accessible name of the stepper; only a per-instance `[aria-label]` or\n * `[aria-labelledby]` overrides it.\n */\n readonly stepperLabel: string;\n /**\n * Landmark `aria-roledescription` for compact step-indicator\n * surfaces such as the dot stepper and the mobile-dot collapse\n * fallback. Mirrors the W3C APG step-indicator pattern.\n */\n readonly stepIndicatorRoleDescription: string;\n /** `aria-roledescription` of a step group header. English `step group`. */\n readonly groupRoleDescription: string;\n readonly selectedStep: (label: string, position: number, count: number) => string;\n /**\n * A step name followed by a detail - its status (`Step 2 of 3: Shipping:\n * Errored`) or its label (`Step 2 of 3: Shipping`). One message, so a\n * locale owns the joiner and the order.\n */\n readonly stepWithDetail: (step: string, detail: string) => string;\n readonly stepHasErrors: (count: number) => string;\n readonly previousStep: string;\n readonly nextStep: string;\n /**\n * @deprecated Superseded by {@link commitRolledBackTo}. Retained as\n * defensive fallback in `liveAnnouncement` when the origin label is\n * unresolvable (unlabeled step, or `commitState` driven outside `select()`).\n */\n readonly commitFailedRetry: string;\n /**\n * Polite SR announcement on `idle → pending`. Pillar 2.\n */\n readonly commitInFlight: string;\n /**\n * Origin-aware rollback phrase. Read on `pending → error` when both\n * `lastFailedIndex` and `originIndexDuringCommit` resolve. Receives\n * the safe-harbour label, yields e.g. `Reverted to step \"Customer\".`.\n */\n readonly commitRolledBackTo: (originLabel: string) => string;\n /**\n * Per-step `aria-describedby` text while `presenter.lastFailedIndex()`\n * matches the step. Receives the step's base description (e.g.\n * `Step 2 of 3: Shipping`) and owns the whole sentence, so a locale can\n * place the rolled-back note before, after or inside it. Distinct from\n * {@link commitRolledBackTo} (transient live-region phrase) - this text\n * is reachable when AT users navigate back to the rejected step after\n * the announcement has faded. Pillar 2.\n */\n readonly stepRolledBack: (base: string) => string;\n /**\n * Origin-aware refusal phrase. Read when the commit action answered\n * `false` and the origin label resolves. Receives the label of the step\n * the user stayed on, yields e.g. `Step change not allowed - stayed on\n * step \"Customer\".`. A refusal is not a failure, so it never reads the\n * failure copy ({@link commitRolledBackTo}, {@link commitFailedRetry}).\n */\n readonly commitRefused: (originLabel: string) => string;\n /**\n * Refusal phrase for an origin without a label. Twin of\n * {@link commitFailedRetry} for the refused outcome.\n */\n readonly commitRefusedGeneric: string;\n /**\n * Per-step `aria-describedby` text while the step carries the marker\n * of a refused change. Refused twin of {@link stepRolledBack}; same\n * `{base}` contract.\n */\n readonly stepRefused: (base: string) => string;\n /**\n * Per-state pill labels surfaced by the `stripe-status-rich` skin\n * (and any future skin / variant that paints a state pill). English\n * defaults; consumer partial overrides via\n * {@link withStepperI18nLabels} keep un-overridden keys intact.\n */\n readonly statusLabels: CngxStepperStatusLabels;\n /**\n * Short progress format used by `CngxProgressBarStepper`'s optional\n * step-count subtext and by `CngxTextStepper`. Receives the\n * 1-based current position and total step count; default\n * `(current, total) => 'Step ${current} of ${total}'`.\n */\n readonly textStepperFormat: (current: number, total: number) => string;\n /** Collapsed-group SR phrase for `groupCollapseSummary: 'count'`. */\n readonly groupSummaryCount: (total: number) => string;\n /** Collapsed-group SR phrase for `groupCollapseSummary: 'progress'`. */\n readonly groupSummaryProgress: (completed: number, total: number) => string;\n /** Visible collapsed-group badge for `groupCollapseSummary: 'count'`. */\n readonly groupSummaryCountShort: (total: number) => string;\n /** Visible collapsed-group badge for `groupCollapseSummary: 'progress'`. */\n readonly groupSummaryProgressShort: (completed: number, total: number) => string;\n /**\n * Last-resort label of a Material `<mat-step>` instrumented by\n * `[cngxMatStepper]` when it has no `label`, `ariaLabel` or static\n * `matStepLabel` text. Receives the cngx handle id. English default\n * `Step <id>`.\n */\n readonly stepFallbackLabel: (id: string) => string;\n}\n\n/**\n * Partial-override shape for {@link withStepperI18nLabels}. Behaves as\n * `Partial<CngxStepperI18n>` for top-level keys, plus a nested partial\n * for {@link CngxStepperStatusLabels} so consumers can override one\n * pill label without restating the full status-label bundle.\n */\nexport type CngxStepperI18nOverrides = Omit<Partial<CngxStepperI18n>, 'statusLabels'> & {\n readonly statusLabels?: Partial<CngxStepperStatusLabels>;\n};\n\n/** @internal Turns a stepper section into the token's keys for a locale. */\nfunction stepperBundleFrom(section: CngxStepperLanguageSection, locale: string): CngxStepperI18n {\n return {\n stepperLabel: section.stepperLabel,\n stepIndicatorRoleDescription: section.stepIndicatorRoleDescription,\n groupRoleDescription: section.groupRoleDescription,\n selectedStep: (label, position, count) =>\n formatMessage(section.selectedStep, { label, position, count }, locale),\n stepWithDetail: (step, detail) =>\n formatMessage(section.stepWithDetail, { step, detail }, locale),\n stepHasErrors: (count) => formatMessage(section.stepHasErrors, { count }, locale),\n previousStep: section.previousStep,\n nextStep: section.nextStep,\n commitFailedRetry: section.commitFailedRetry,\n commitInFlight: section.commitInFlight,\n commitRolledBackTo: (origin) => formatMessage(section.commitRolledBackTo, { origin }, locale),\n stepRolledBack: (base) => formatMessage(section.stepRolledBack, { base }, locale),\n commitRefused: (origin) => formatMessage(section.commitRefused, { origin }, locale),\n commitRefusedGeneric: section.commitRefusedGeneric,\n stepRefused: (base) => formatMessage(section.stepRefused, { base }, locale),\n statusLabels: section.statusLabels,\n textStepperFormat: (current, count) =>\n formatMessage(section.textStepperFormat, { current, count }, locale),\n groupSummaryCount: (count) => formatMessage(section.groupSummaryCount, { count }, locale),\n groupSummaryProgress: (completed, count) =>\n formatMessage(section.groupSummaryProgress, { completed, count }, locale),\n groupSummaryCountShort: (count) =>\n formatMessage(section.groupSummaryCountShort, { count }, locale),\n groupSummaryProgressShort: (completed, count) =>\n formatMessage(section.groupSummaryProgressShort, { completed, count }, locale),\n stepFallbackLabel: (id) => formatMessage(section.stepFallbackLabel, { id }, locale),\n };\n}\n\n/**\n * @internal The English stepper section with the active pack's stepper\n * section on top. Feeds both `CNGX_STEPPER_I18N` and the\n * `CNGX_STEPPER_CONFIG` labels.\n */\nexport const injectStepperLanguage = createNestedLanguageSection(\n 'stepper',\n CNGX_STEPPER_LANGUAGE_EN,\n 'statusLabels',\n);\n\n/** @internal Builds and reads the token, formatted for the reading locale. */\nconst stepperBundle = createSectionBundle<CngxStepperLanguageSection, CngxStepperI18n>({\n section: injectStepperLanguage,\n toBundle: stepperBundleFrom,\n});\n\n/**\n * DI token for the resolved stepper i18n bundle, as a `Signal` so a\n * runtime language switch re-renders every label it feeds.\n * `providedIn: 'root'`: the stepper section of the active language pack over\n * the English defaults, formatted for the app locale. Provide it through\n * {@link provideStepperI18n}; a `{ provide, useValue }` entry must supply a\n * `Signal<CngxStepperI18n>`.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/i18n/stepper-i18n.ts\n * @since 0.3.0\n */\nexport const CNGX_STEPPER_I18N = new InjectionToken<Signal<CngxStepperI18n>>('CngxStepperI18n', {\n providedIn: 'root',\n factory: () => stepperBundle.build(),\n});\n\n/**\n * Feature shape consumed by {@link provideStepperI18n} and {@link provideCngxStepper}.\n * Hidden `_target: 'i18n'` discriminator routes through the family aggregator.\n * Sibling of `CngxTabsI18nFeature`.\n */\nexport type CngxStepperI18nFeature = ((\n bundle: Signal<CngxStepperI18n>,\n) => Signal<CngxStepperI18n>) & {\n readonly _target: 'i18n';\n};\n\n/**\n * Brands an i18n mutator with `_target: 'i18n'`. Every `with*` i18n\n * feature returns one of these.\n *\n * @internal\n */\nfunction defineStepperI18nFeature(\n fn: (bundle: Signal<CngxStepperI18n>) => Signal<CngxStepperI18n>,\n): CngxStepperI18nFeature {\n return Object.assign(fn, { _target: 'i18n' as const });\n}\n\n/**\n * Override stepper i18n labels. Partial override - unset keys keep\n * the language pack's copy, or the English default. {@link CngxStepperStatusLabels} is merged\n * key-by-key so consumers can override one pill label without\n * restating the rest. Pass a `Signal` to switch the language at runtime.\n * Sibling of `withStepperFallbackLabels`.\n */\nexport function withStepperI18nLabels(\n overrides: CngxStepperI18nOverrides | Signal<CngxStepperI18nOverrides>,\n): CngxStepperI18nFeature {\n return defineStepperI18nFeature((bundle) =>\n createNestedOverrideMerge(bundle, overrides, 'statusLabels'),\n );\n}\n\n/**\n * Provider for the stepper i18n bundle. Compose `withStepperI18nLabels(...)`\n * (plus any future i18n `with*`) - unset keys fall back to the language\n * pack, then English. The features apply on top of the active pack.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideStepperI18n(\n * withStepperI18nLabels({ stepperLabel: 'Bestellschritte', previousStep: 'Vorheriger' }),\n * ),\n * ],\n * });\n * ```\n */\nexport function provideStepperI18n(...features: readonly CngxStepperI18nFeature[]): Provider {\n return {\n provide: CNGX_STEPPER_I18N,\n useFactory: () => stepperBundle.build(features),\n };\n}\n\n/**\n * Inject the resolved stepper i18n bundle in an injection context. Read it\n * inside a `computed()`, template or handler so a language switch reaches\n * the label.\n */\nexport function injectStepperI18n(): Signal<CngxStepperI18n> {\n return stepperBundle.resolve(inject(CNGX_STEPPER_I18N));\n}\n","import {\n computed,\n type EnvironmentProviders,\n inject,\n InjectionToken,\n makeEnvironmentProviders,\n type Provider,\n type Signal,\n type TemplateRef,\n} from '@angular/core';\n\nimport { createOverrideMerge } from '@cngx/core/utils';\nimport { recordEqual } from '@cngx/utils';\n\nimport { injectStepperLanguage } from './i18n/stepper-i18n';\nimport { CNGX_STEPPER_LANGUAGE_EN } from './i18n/stepper-language-section';\n\nimport type { CngxDotStepperDotContext } from './slots/dot-stepper-dot.directive';\nimport type { CngxStepBadgeContext } from './slots/step-badge.directive';\nimport type { CngxStepBusySpinnerContext } from './slots/step-busy-spinner.directive';\nimport type { CngxStepErrorContext } from './slots/step-error.directive';\nimport type { CngxStepGroupHeaderContext } from './slots/step-group-header.directive';\nimport type { CngxStepIndicatorContext } from './slots/step-indicator.directive';\nimport type { CngxStepRejectionContext } from './slots/step-rejection.directive';\n\n/**\n * Fallback labels for derived strings (group descriptors, badge SR\n * announcements). English defaults; consumer overrides per locale.\n */\nexport interface CngxStepperFallbackLabels {\n readonly groupRoleDescription?: string;\n readonly stepRoleDescription?: string;\n}\n\n/**\n * Per-slot template overrides for `<cngx-stepper>`. Middle tier of\n * the 3-stage cascade: per-instance directive > this field > built-in\n * markup. Apply via the `with*Template` feature builders below.\n */\nexport interface CngxStepperTemplates {\n readonly indicator?: TemplateRef<CngxStepIndicatorContext>;\n readonly badge?: TemplateRef<CngxStepBadgeContext>;\n readonly busySpinner?: TemplateRef<CngxStepBusySpinnerContext>;\n readonly rejection?: TemplateRef<CngxStepRejectionContext>;\n readonly stepError?: TemplateRef<CngxStepErrorContext>;\n readonly groupHeader?: TemplateRef<CngxStepGroupHeaderContext>;\n readonly empty?: TemplateRef<void>;\n readonly dotStepperDot?: TemplateRef<CngxDotStepperDotContext>;\n}\n\n/**\n * Selectable visual skin for the cngx-standard stepper. The skin is a\n * pure thematic concern - every value renders the same structure, same\n * slots, same ARIA, same keyboard behaviour, and only redirects CSS via\n * the `[data-skin]` host attribute. The Material twin\n * (`<cngx-mat-stepper>`) ignores this setting.\n */\nexport type CngxStepperSkin =\n | 'classic'\n | 'linear-minimal'\n | 'stripe-status-rich'\n | 'path-chevron'\n | 'pill-segment'\n | 'chips'\n | 'breadcrumb';\n\n/**\n * Mobile auto-collapse target. Below `30rem` of the stepper's own\n * container width, `<cngx-stepper>` falls back to one of the compact\n * variants instead of rendering the full strip. Set to `'off'` to retain\n * the classic strip at every width.\n *\n * The width itself is not configurable - it is a `@container` rule in\n * `stepper-base.css`, overridable in consumer CSS. This setting picks\n * *what* the strip collapses into, not *where*.\n */\nexport type CngxStepperMobileCollapse = 'text' | 'dots' | 'off';\n\n/**\n * Header-navigation policy for `<cngx-stepper>`. `'none'` renders the\n * step headers as inert labels - the footer is the sole navigation\n * control. `'visited'` (default) keeps the headers as focusable\n * buttons; reachability folds into the `linear` axis (`linear=false`\n * is free click-through, `linear=true` is backward-to-visited only,\n * with linear-unreachable headers marked `aria-disabled`). There is no\n * discrete `'free'` value - `'free'` is `'visited'` + `linear=false`.\n */\nexport type CngxStepperHeaderNavigation = 'none' | 'visited';\n\n/**\n * Focus-driven group-collapse policy for grouped `<cngx-stepper>` flows.\n * `'expand-active'` collapses every non-active `cngxStepGroup` branch to\n * its header node and expands only the group holding the active step;\n * `'off'` (default) keeps every group's children rendered in the strip -\n * the browser-native baseline. Orthogonal to the `mobileCollapse` axis;\n * the two never edit each other. The Material twin (`[cngxMatStepper]`)\n * ignores this setting.\n */\nexport type CngxStepperGroupCollapse = 'expand-active' | 'off';\n\n/**\n * What a collapsed `cngxStepGroup` header shows next to its label under\n * `groupCollapse: 'expand-active'`. `'progress'` (default) shows\n * completed/total steps; `'count'` shows the step count; `'status'`\n * shows a status dot coloured by the group's rolled-up state; `'off'`\n * shows the bare label. Only ever rendered on a collapsed group header.\n */\nexport type CngxStepperGroupSummary = 'progress' | 'count' | 'status' | 'off';\n\n/**\n * Space-driven density policy for the classic `<cngx-stepper>` strip.\n * `'auto'` degrades the strip on its own container width\n * (full labels -> ellipsis-truncated -> indicators-only with the active\n * label kept); `'comfortable'` (default) keeps full labels at every\n * width. Orthogonal to `mobileCollapse` and `groupCollapse`; the\n * Material twin ignores this setting.\n */\nexport type CngxStepperDensity = 'comfortable' | 'auto';\n\n/**\n * Where the mobile auto-collapse indicator (text caption or dot row)\n * sits relative to the active step's panel content under narrow\n * viewports. `'top'` (default) keeps the indicator above the panel;\n * `'bottom'` flips it below so the user reads content first and the\n * navigation cue sits at the thumb zone. Ignored when the classic\n * strip is on screen (`displayMode === 'classic'`).\n */\nexport type CngxStepperMobileIndicatorPosition = 'top' | 'bottom';\n\n/**\n * Stepper config surface. Resolution priority: per-instance Input\n * > `provideStepperConfigAt` (viewProviders) > `provideStepperConfig`\n * (root) > library default. Canonical cngx config shape.\n */\nexport interface CngxStepperConfig {\n readonly defaultOrientation?: 'horizontal' | 'vertical';\n readonly defaultLinear?: boolean;\n readonly defaultCommitMode?: 'optimistic' | 'pessimistic';\n readonly routerSyncMode?: 'fragment' | 'queryParam';\n readonly routerSyncParam?: string;\n readonly skin?: CngxStepperSkin;\n /**\n * Header-navigation policy. `'none'` makes the step headers inert\n * labels (footer-only navigation); `'visited'` (default) keeps them\n * focusable buttons whose reachability folds into the `linear` axis.\n * Per-instance `[headerNavigation]` Input still wins.\n */\n readonly headerNavigation?: CngxStepperHeaderNavigation;\n /**\n * Focus-driven group-collapse policy. `'expand-active'` collapses\n * non-active `cngxStepGroup` branches to their header node and expands\n * only the active group; `'off'` (default) keeps the full strip.\n * Orthogonal to `mobileCollapse`. Apply app-wide via\n * {@link withStepperGroupCollapse}.\n */\n readonly groupCollapse?: CngxStepperGroupCollapse;\n /**\n * What a collapsed `cngxStepGroup` header shows beside its label.\n * Default `'progress'` (completed/total). Only applies when\n * `groupCollapse` is `'expand-active'`. Set via\n * {@link withStepperGroupCollapseSummary}.\n */\n readonly groupCollapseSummary?: CngxStepperGroupSummary;\n /**\n * Space-driven density policy for the classic strip. `'auto'`\n * shrinks the labels in flow (a cqi budget under `[data-density-auto]`)\n * instead of overflowing the strip; `'comfortable'`\n * (default) keeps full labels. Orthogonal to `mobileCollapse`. Apply\n * app-wide via {@link withStepperDensity}.\n */\n readonly density?: CngxStepperDensity;\n /**\n * Opt-in connector rail between adjacent step indicators on the\n * classic skin. Off by default. The rule is double-scoped on\n * `[data-skin='classic']`, so the four other skins are mechanically\n * untouched (each ships its own inter-step decoration). Per-instance\n * `[connectors]` Input still wins.\n */\n readonly connectors?: boolean;\n readonly mobileCollapse?: CngxStepperMobileCollapse;\n /**\n * Where the mobile auto-collapse indicator sits relative to the\n * panel content. Default `'top'`. Override per-instance via the\n * `[mobileIndicatorPosition]` input or app-wide via\n * {@link withStepperMobileIndicatorPosition}.\n */\n readonly mobileIndicatorPosition?: CngxStepperMobileIndicatorPosition;\n /**\n * Whether horizontal swipe gestures advance/retreat the active step\n * while the stepper is in mobile-collapse mode (`'dots'` / `'text'`).\n * Default `true`. Override per-instance via the `[mobileSwipe]` input\n * or app-wide via {@link withStepperMobileSwipe}. Ignored on the\n * classic strip and on the Material twin (`<cngx-mat-stepper>`).\n */\n readonly mobileSwipe?: boolean;\n /** Role descriptions; a `Signal` switches the language at runtime. */\n readonly fallbackLabels?: CngxStepperFallbackLabels | Signal<CngxStepperFallbackLabels>;\n readonly templates?: CngxStepperTemplates;\n}\n\n/** @internal */\nconst STEPPER_CONFIG_DEFAULTS: Required<\n Omit<CngxStepperConfig, 'fallbackLabels' | 'templates'>\n> & {\n fallbackLabels: CngxStepperFallbackLabels;\n templates: CngxStepperTemplates;\n} = {\n defaultOrientation: 'horizontal',\n defaultLinear: false,\n defaultCommitMode: 'pessimistic',\n routerSyncMode: 'fragment',\n routerSyncParam: 'step',\n skin: 'classic',\n headerNavigation: 'visited',\n groupCollapse: 'off',\n groupCollapseSummary: 'progress',\n density: 'comfortable',\n connectors: false,\n mobileCollapse: 'text',\n mobileIndicatorPosition: 'top',\n mobileSwipe: true,\n fallbackLabels: {\n groupRoleDescription: CNGX_STEPPER_LANGUAGE_EN.groupRoleDescription,\n stepRoleDescription: CNGX_STEPPER_LANGUAGE_EN.stepRoleDescription,\n },\n templates: {},\n};\n\n/** @internal - shared empty base, so label merges over an unset key memoize. */\nconst NO_LABELS: object = {};\n\n/**\n * DI token for the resolved stepper config. `providedIn: 'root'` with\n * library defaults; override via {@link provideStepperConfig} (root)\n * or {@link provideStepperConfigAt} (component scope).\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/stepper-config.ts\n * @since 0.3.0\n */\nexport const CNGX_STEPPER_CONFIG = new InjectionToken<CngxStepperConfig>('CngxStepperConfig', {\n providedIn: 'root',\n factory: () => resolveFeatures([]),\n});\n\n/**\n * Feature signature - each `with*` builder reduces over the config.\n * Hidden `_target: 'config'` discriminator routes through the family\n * aggregator {@link provideCngxStepper}.\n */\nexport type CngxStepperConfigFeature = ((config: CngxStepperConfig) => CngxStepperConfig) & {\n readonly _target: 'config';\n};\n\n/**\n * Brands a config mutator with `_target: 'config'`. Every `with*`\n * config feature returns one of these.\n *\n * @internal\n */\nfunction defineStepperConfigFeature(\n fn: (config: CngxStepperConfig) => CngxStepperConfig,\n): CngxStepperConfigFeature {\n return Object.assign(fn, { _target: 'config' as const });\n}\n\n/**\n * Override the default orientation. Per-instance `[orientation]`\n * Input still wins; this only moves the cascade default.\n */\nexport function withStepperDefaultOrientation(\n orientation: 'horizontal' | 'vertical',\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n defaultOrientation: orientation,\n }));\n}\n\n/**\n * Override the default linear-progression setting. Per-instance\n * `[linear]` Input still wins.\n */\nexport function withStepperLinear(linear: boolean): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, defaultLinear: linear }));\n}\n\n/**\n * Override the default commit mode for async step transitions.\n * `'optimistic'` advances on action dispatch and rolls back on error;\n * `'pessimistic'` waits for success. Per-instance `[commitMode]`\n * Input still wins.\n */\nexport function withStepperCommitMode(\n mode: 'optimistic' | 'pessimistic',\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n defaultCommitMode: mode,\n }));\n}\n\n/**\n * Configure router synchronisation for the active step. `mode` chooses\n * the URL surface (URL fragment or query parameter); `param` names the\n * key (default `'step'`).\n */\nexport function withStepperRouterSync(\n mode: 'fragment' | 'queryParam',\n param = 'step',\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n routerSyncMode: mode,\n routerSyncParam: param,\n }));\n}\n\n/**\n * Select the visual skin for the cngx-standard `<cngx-stepper>`. The\n * default is `'classic'`. Per-instance `[skin]` Input still wins; this\n * moves the cascade default. Structure, slots, ARIA, and keyboard\n * behaviour are identical across skins - only the `[data-skin]` host\n * attribute changes the CSS layer that paints the strip.\n */\nexport function withStepperSkin(skin: CngxStepperSkin): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, skin }));\n}\n\n/**\n * Opt the classic `<cngx-stepper>` skin into the connector-rail\n * presentation: a solid completed/upcoming rail between adjacent step\n * indicators, horizontal and vertical, with per-segment coloring driven\n * by the preceding step's `[data-state]`. The rule is double-scoped on\n * `[data-skin='classic']`; the four other skins each ship their own\n * inter-step decoration and ignore this flag. Per-instance\n * `[connectors]` Input still wins.\n */\nexport function withStepperConnectors(on: boolean): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, connectors: on }));\n}\n\n/**\n * Configure the mobile auto-collapse target for `<cngx-stepper>`. Below\n * `30rem` of the stepper's own container width, the classic strip swaps\n * to the chosen variant - `'text'` (default) renders\n * `<cngx-text-stepper>`, `'dots'` renders `<cngx-dot-stepper>`, `'off'`\n * keeps the classic strip. The Material twin `<cngx-mat-stepper>` ignores\n * this setting.\n */\nexport function withStepperMobileCollapse(\n mode: CngxStepperMobileCollapse,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, mobileCollapse: mode }));\n}\n\n/**\n * Set the app-wide default position of the mobile auto-collapse\n * indicator relative to panel content. `'top'` keeps the indicator\n * above (library default); `'bottom'` flips it below so panel content\n * reads first and the navigation cue sits at thumb height. Per-\n * instance `[mobileIndicatorPosition]` on `<cngx-stepper>` still\n * wins.\n */\nexport function withStepperMobileIndicatorPosition(\n position: CngxStepperMobileIndicatorPosition,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, mobileIndicatorPosition: position }));\n}\n\n/**\n * Toggle the built-in horizontal-swipe navigation on `<cngx-stepper>`\n * in mobile-collapse mode. Default `true` - the `'dots'` and `'text'`\n * variants read as carousels, so users expect to swipe. Per-instance\n * `[mobileSwipe]` Input still wins; the classic strip is unaffected.\n */\nexport function withStepperMobileSwipe(enabled: boolean): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, mobileSwipe: enabled }));\n}\n\n/**\n * Set the app-wide default header-navigation policy for\n * `<cngx-stepper>`. `'none'` renders inert label headers (footer-only\n * navigation); `'visited'` (library default) keeps the headers as\n * focusable buttons whose reachability folds into the `linear` axis.\n * Per-instance `[headerNavigation]` Input still wins.\n */\nexport function withStepperHeaderNavigation(\n mode: CngxStepperHeaderNavigation,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, headerNavigation: mode }));\n}\n\n/**\n * Set the app-wide focus-driven group-collapse policy for grouped\n * `<cngx-stepper>` flows. `'expand-active'` collapses every non-active\n * `cngxStepGroup` branch to its header node and expands only the group\n * holding the active step; `'off'` (library default) keeps the full\n * strip. Orthogonal to the `mobileCollapse` axis. The Material twin\n * ignores this setting.\n */\nexport function withStepperGroupCollapse(mode: CngxStepperGroupCollapse): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, groupCollapse: mode }));\n}\n\n/**\n * Choose what a collapsed `cngxStepGroup` header shows beside its label\n * under `groupCollapse: 'expand-active'`. `'progress'` (library default)\n * shows completed/total steps; `'count'` the step count; `'status'` a\n * status dot coloured by the group's rolled-up state; `'off'` the bare\n * label. No effect unless `groupCollapse` is `'expand-active'`.\n */\nexport function withStepperGroupCollapseSummary(\n mode: CngxStepperGroupSummary,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, groupCollapseSummary: mode }));\n}\n\n/**\n * Set the app-wide space-driven density policy for the classic\n * `<cngx-stepper>` strip. `'auto'` sets `[data-density-auto]`, under\n * which the labels shrink in flow within a cqi budget (the step furthest\n * from the active one gives way first) instead of overflowing the strip;\n * `'comfortable'` (library default) keeps full labels at every width.\n * Orthogonal to the `mobileCollapse` axis; the Material twin ignores this\n * setting.\n */\nexport function withStepperDensity(mode: CngxStepperDensity): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({ ...cfg, density: mode }));\n}\n\n/**\n * Merge fallback role descriptions (`groupRoleDescription` /\n * `stepRoleDescription`) into the cascade. These feed the strip's\n * `aria-roledescription` attributes when the consumer supplies none.\n * Pass a `Signal` to switch the language at runtime.\n */\nexport function withStepperFallbackLabels(\n labels: CngxStepperFallbackLabels | Signal<CngxStepperFallbackLabels>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n fallbackLabels: createOverrideMerge<CngxStepperFallbackLabels>(\n cfg.fallbackLabels ?? NO_LABELS,\n labels,\n ),\n }));\n}\n\n/**\n * Override the default `*cngxStepIndicator` template app-wide.\n * Per-instance directive still wins; this only moves the cascade\n * middle tier.\n */\nexport function withStepIndicatorTemplate(\n template: TemplateRef<CngxStepIndicatorContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, indicator: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepBadge` template app-wide.\n */\nexport function withStepBadgeTemplate(\n template: TemplateRef<CngxStepBadgeContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, badge: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepBusySpinner` template app-wide.\n */\nexport function withStepBusySpinnerTemplate(\n template: TemplateRef<CngxStepBusySpinnerContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, busySpinner: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepRejection` template app-wide.\n * Symmetric with the upcoming tabs `cngxTabRejectionIcon` (Phase 4).\n */\nexport function withStepRejectionTemplate(\n template: TemplateRef<CngxStepRejectionContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, rejection: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepError` template app-wide. The slot\n * renders the per-step validation reason on the skins with a label area\n * (classic / stripe-status-rich). Per-instance directive still wins;\n * this moves the cascade middle tier.\n */\nexport function withStepErrorTemplate(\n template: TemplateRef<CngxStepErrorContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, stepError: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepGroupHeader` template app-wide.\n */\nexport function withStepGroupHeaderTemplate(\n template: TemplateRef<CngxStepGroupHeaderContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, groupHeader: template },\n }));\n}\n\n/**\n * Override the default `*cngxStepperEmpty` template app-wide.\n */\nexport function withStepperEmptyTemplate(template: TemplateRef<void>): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, empty: template },\n }));\n}\n\n/**\n * Override the default `*cngxDotStepperDot` template app-wide. Both dot\n * hosts resolve the cascade per dot - `<cngx-dot-stepper>` and the dots\n * mobile-collapse branch of `<cngx-stepper>`: per-instance directive >\n * this feature > built-in empty body (the dot fill is painted by the dot\n * element's CSS regardless).\n */\nexport function withDotStepperDotTemplate(\n template: TemplateRef<CngxDotStepperDotContext>,\n): CngxStepperConfigFeature {\n return defineStepperConfigFeature((cfg) => ({\n ...cfg,\n templates: { ...cfg.templates, dotStepperDot: template },\n }));\n}\n\n/**\n * @internal The defaults with the copy keys read from the stepper section of\n * the active language pack. Runs in an injection context.\n */\nfunction stepperConfigDefaultsFromPack(): CngxStepperConfig {\n const language = injectStepperLanguage();\n return {\n ...STEPPER_CONFIG_DEFAULTS,\n fallbackLabels: computed(\n () => ({\n groupRoleDescription: language().groupRoleDescription,\n stepRoleDescription: language().stepRoleDescription,\n }),\n { equal: recordEqual },\n ),\n };\n}\n\n/** @internal Runs in an injection context; features apply on top of the pack. */\nfunction resolveFeatures(features: readonly CngxStepperConfigFeature[]): CngxStepperConfig {\n return features.reduce<CngxStepperConfig>(\n (cfg, feat) => feat(cfg),\n stepperConfigDefaultsFromPack(),\n );\n}\n\n/**\n * Root-level provider for the stepper config. Apply once in the\n * application providers array. Sibling of `provideTabsConfig` /\n * `provideSelectConfig`.\n */\nexport function provideStepperConfig(\n ...features: readonly CngxStepperConfigFeature[]\n): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: CNGX_STEPPER_CONFIG, useFactory: () => resolveFeatures(features) },\n ]);\n}\n\n/**\n * Component-scoped config override. Spread the returned `Provider[]`\n * into `providers` or `viewProviders` - `viewProviders` cannot accept\n * opaque {@link EnvironmentProviders}, so the twin returns a list.\n * Sibling of `provideTabsConfigAt`.\n *\n * Resolution priority: per-instance Input > viewProviders (`At`) >\n * root provider > library default.\n *\n * ```ts\n * @Component({\n * viewProviders: [...provideStepperConfigAt(withStepperLinear(true))],\n * })\n * ```\n */\nexport function provideStepperConfigAt(\n ...features: readonly CngxStepperConfigFeature[]\n): Provider[] {\n return [{ provide: CNGX_STEPPER_CONFIG, useFactory: () => resolveFeatures(features) }];\n}\n\n/**\n * Inject the resolved stepper config in an injection context.\n */\nexport function injectStepperConfig(): CngxStepperConfig {\n return inject(CNGX_STEPPER_CONFIG);\n}\n","import { inject, InjectionToken, type Signal } from '@angular/core';\n\nimport type { CngxTransitionOutcome } from '@cngx/common/data';\nimport type { CngxAsyncState, StatusTransition } from '@cngx/core/utils';\nimport { CngxRuntimeError } from '@cngx/utils';\n\nimport type { CngxErrorAggregatorContract } from '@cngx/common/interactive';\n\n/**\n * Status enum for a single step. Driven by the presenter's commit-controller\n * lifecycle plus the optional `errorAggregator`.\n */\nexport type CngxStepStatus = 'idle' | 'pending' | 'success' | 'error' | 'disabled' | 'busy';\n\n/**\n * Step-tree node. Either a terminal `step` (has its own panel) or a\n * `group` carrying nested children. Discriminated by `kind`.\n */\nexport interface CngxStepNode {\n readonly id: string;\n readonly kind: 'step' | 'group';\n readonly label: Signal<string>;\n readonly disabled: Signal<boolean>;\n /** Live step status. Reactive to commit-controller + aggregator. */\n readonly state: Signal<CngxStepStatus>;\n /** Optional error aggregator signal for badge / SR phrasing. */\n readonly errorAggregator?: Signal<CngxErrorAggregatorContract | undefined>;\n /**\n * Message carried by a direct `[error]` string input on the step, or\n * `undefined` when `[error]` is boolean / absent. Pure data carrier\n * read by the `*cngxStepError` slot + the mini-skin aggregate line -\n * not a swap surface.\n */\n readonly errorMessage?: Signal<string | undefined>;\n /** Direct children for group nodes; empty for step nodes. */\n readonly children: readonly CngxStepNode[];\n /** DFS depth (root = 0). */\n readonly depth: number;\n /** Parent group id, or `null` for root. */\n readonly parentId: string | null;\n /** Flat-projection index inside `flatSteps()`. -1 for groups. */\n readonly flatIndex: number;\n}\n\n/**\n * Handle a `CngxStep` / `CngxStepGroup` passes to its host. The host owns\n * the registry; the atom owns its own state slot.\n *\n * @internal\n */\nexport interface CngxStepRegistration {\n readonly id: string;\n readonly kind: 'step' | 'group';\n readonly label: Signal<string>;\n readonly disabled: Signal<boolean>;\n readonly state: Signal<CngxStepStatus>;\n readonly errorAggregator?: Signal<CngxErrorAggregatorContract | undefined>;\n /**\n * Resolved message from a direct `[error]` string input, or\n * `undefined` for boolean / absent. Pure data carrier (not a swap\n * token); surfaced on {@link CngxStepNode.errorMessage}.\n */\n readonly errorMessage?: Signal<string | undefined>;\n}\n\n/**\n * Contract atoms see via {@link CNGX_STEPPER_HOST}. Mirrors the\n * directive's surface 1:1 - atoms never reach the concrete class.\n */\nexport interface CngxStepperHost {\n readonly stepTree: Signal<readonly CngxStepNode[]>;\n readonly flatSteps: Signal<readonly CngxStepNode[]>;\n /**\n * Step-only flat projection (group nodes filtered out).\n * Structural-equal via `flatStepsEqual`; the single source for any\n * step-count / step-position lookup.\n *\n * **Contract:** variant and skin organisms MUST read this signal\n * directly. Local re-derivation (e.g. `flatSteps().filter(...)`\n * inside a variant's `computed`) is rejected at review time -\n * the projection's equality contract is the load-bearing\n * invariant, and a local re-filter breaks the shape-stable\n * short-circuit that downstream consumers rely on. Add lookup\n * helpers as methods on this contract rather than re-deriving.\n */\n readonly stepsOnly: Signal<readonly CngxStepNode[]>;\n\n /**\n * Flat strip projection under the focus-driven group-collapse policy:\n * identical to {@link flatSteps} when `groupCollapse` is `'off'`, and\n * with every non-active root-level group's children dropped (header\n * node alone) under `'expand-active'`. The strip `@for` reads this;\n * `stepsOnly` stays the single counting / announcement source.\n *\n * **Contract:** variant and skin organisms drive the strip off this\n * projection, never re-derive it. Structural-equal via `flatStepsEqual`\n * (each retained node keeps its `flatSteps` `flatIndex`), so a\n * shape-stable re-emit short-circuits the strip render.\n */\n readonly visibleStripNodes: Signal<readonly CngxStepNode[]>;\n readonly activeStepIndex: Signal<number>;\n readonly activeStepId: Signal<string | null>;\n\n /**\n * Root-level group whose subtree contains the active step, or `null`\n * when the active step is a root-level step (e.g. a trailing\n * `Finish`). The single focus-driven-collapse source: atoms read it\n * via this contract, never the concrete presenter. Drives\n * `CngxStepGroup.isCollapsed`, the strip `aria-expanded` binding, and\n * {@link visibleStripNodes}.\n */\n readonly activeGroupId: Signal<string | null>;\n\n /** Step-only count - the length of {@link stepsOnly}. */\n readonly stepCount: Signal<number>;\n\n /** `true` when the active step is the first one (no earlier step). */\n readonly isFirstStep: Signal<boolean>;\n\n /** `true` when the active step is the last one (no later step). */\n readonly isLastStep: Signal<boolean>;\n\n /**\n * `true` when {@link selectPrevious} would move - i.e. an enabled\n * step precedes the active one. The single gate a Back affordance\n * reads; never re-derive it from {@link stepsOnly} at the call site.\n */\n readonly canGoPrevious: Signal<boolean>;\n\n /**\n * `true` when {@link selectNext} would move - i.e. an enabled,\n * linear-unblocked step follows the active one. Derived from the same\n * predicates `select()` enforces, so a Next affordance can never\n * drift from the navigation it gates.\n */\n readonly canGoNext: Signal<boolean>;\n\n /**\n * `true` while a commit or the finish run is in flight: the commit\n * (`commitState.status() === 'pending'`) or any source registered\n * through {@link registerBusy}. Drives the busy-disable on nav\n * affordances. Keyed on the strict `'pending'` status, consistent\n * with the per-step busy gate.\n */\n readonly busy: Signal<boolean>;\n\n /**\n * Registers a run outside the commit (the `CngxStepperComplete`\n * finish run) under `key`, so {@link busy} reads `true` while\n * `pending()` does. Returns the release. Optional: a host without it\n * reflects only its commit.\n */\n registerBusy?(key: string, pending: Signal<boolean>): () => void;\n\n /**\n * Label of the step {@link selectNext} would land on, or `undefined`\n * when none follows. Resolved through the enabled-step traversal so a\n * \"Continue to {{ label }}\" affordance announces the real target.\n */\n readonly nextStepLabel: Signal<string | undefined>;\n\n /**\n * Label of the step {@link selectPrevious} would land on, or\n * `undefined` when none precedes.\n */\n readonly previousStepLabel: Signal<string | undefined>;\n\n readonly linear: Signal<boolean>;\n readonly orientation: Signal<'horizontal' | 'vertical'>;\n /**\n * Resolved commit mode (`input ?? config ?? default`, with the DI\n * fallback's pinned mode winning while a routed action is active).\n * On the contract so Level-2 builders can gate mode-dependent\n * behaviour - e.g. the pending-to-success announcement only applies\n * in pessimistic mode, where the accept is what moves the step.\n * Optional so pre-existing custom host implementations stay\n * assignable; readers treat absence as `'pessimistic'` (the stepper\n * default).\n */\n readonly commitMode?: Signal<'optimistic' | 'pessimistic'>;\n readonly commitState: CngxAsyncState<number | undefined>;\n readonly intendedStepIndex: Signal<number | undefined>;\n\n /**\n * Reactive current/previous pair for the commit-state status. The\n * organism's `<span cngxLiveRegion>` reads this tracker on every\n * `pending → success / error` transition. Allocated once per\n * presenter - consumers MUST read this rather than calling\n * `createTransitionTracker` locally so the `linkedSignal` is shared.\n */\n readonly commitTransition: StatusTransition;\n\n /**\n * Settle record of the most recent commit that did not land:\n * `kind: 'refused'` when `commitAction` answered `false`, `'failed'`\n * when it threw, rejected or errored; `index` is the rejected target,\n * `sequence` is bumped once per settled refusal or failure. Kept\n * through {@link clearLastFailed} (which only hides the marker), so the\n * announcement record survives a cleared decoration; dropped by\n * `reset()`. A refusal leaves `commitState` at `'idle'` with its data\n * intact, so this is the only place a refusal is visible as such.\n */\n readonly lastOutcome: Signal<CngxTransitionOutcome | undefined>;\n\n /**\n * Index of the most recently rejected (refused or failed) commit\n * target, or `undefined` when no rejection marker is shown. Derived\n * from {@link lastOutcome}; cleared by a successful re-pick of the\n * same target or via {@link clearLastFailed}. Drives strip rejection\n * decoration and the `commitRolledBackTo` chain in `liveAnnouncement`.\n */\n readonly lastFailedIndex: Signal<number | undefined>;\n\n /**\n * Origin captured at commit-window open - the safe-harbour the user\n * is returned to on optimistic rollback. Resolves the origin label\n * for the `commitRolledBackTo(originLabel)` phrase. Cleared on\n * success; retained on rejection through the persistence window.\n */\n readonly originIndexDuringCommit: Signal<number | undefined>;\n\n /**\n * `true` when the header at the given step-only index may be\n * navigated to: the step is enabled and not blocked by the `linear`\n * gate. The single reachability predicate a header affordance reads -\n * the organism MUST call this rather than reaching the presenter's\n * private linear-block check. Out-of-range indices return `false`.\n */\n canNavigateTo(index: number): boolean;\n\n select(index: number): void;\n selectNext(): void;\n selectPrevious(): void;\n selectById(id: string): void;\n reset(): void;\n\n /**\n * Drop the persisted {@link lastFailedIndex} marker. Idempotent;\n * safe to wire to a Dismiss button or aggregator-cleared. Leaves\n * {@link lastOutcome} untouched.\n */\n clearLastFailed(): void;\n\n register(handle: CngxStepRegistration, parentId?: string | null): void;\n /**\n * Remove a registration. Pass the registering `handle` so a destroyed\n * instance can only evict itself: under an id collision the presenter's\n * idempotent re-register replaces the stored handle, and the OLD\n * instance's late destroy must not tear down the NEW instance's entry.\n */\n unregister(id: string, handle?: CngxStepRegistration): void;\n}\n\n/**\n * DI token carrying the presenter's contract to atoms + organism shells.\n * Atoms inject `optional: true` and either register here or fall through\n * {@link CNGX_STEP_GROUP_HOST} when nested in a group.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/stepper-host.token.ts\n * @since 0.3.0\n */\nexport const CNGX_STEPPER_HOST = new InjectionToken<CngxStepperHost>('CngxStepperHost');\n\n/**\n * Inject the {@link CNGX_STEPPER_HOST} for a stepper add-on directive.\n * Throws a `CngxRuntimeError` with code `CNGX1055` when no stepper presenter\n * is found, in development and production alike. With `host: true` the\n * lookup stops at the declaring template's host, so the presenter has to sit\n * on the same element or an ancestor in the same template. `selector` names\n * the add-on in the development message.\n *\n * @internal\n */\nexport function injectStepperHost(\n selector: string,\n options: { readonly host: boolean },\n): CngxStepperHost {\n const stepper = inject(CNGX_STEPPER_HOST, { host: options.host, optional: true });\n if (!stepper) {\n throw new CngxRuntimeError(\n 'CNGX1055',\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n `[${selector}] must be placed on or inside an element with [cngxStepper], such as <cngx-stepper>.`,\n );\n }\n return stepper;\n}\n","import type { CngxStepNode } from './stepper-host.token';\n\n/**\n * DFS-flatten a step tree. Group nodes emit before their children;\n * the consumer keys off `kind` to render a panel container vs. a\n * group header.\n *\n * @internal\n */\nexport function flattenStepTree(nodes: readonly CngxStepNode[]): readonly CngxStepNode[] {\n const out: CngxStepNode[] = [];\n let flatIndex = 0;\n const visit = (list: readonly CngxStepNode[]): void => {\n for (const node of list) {\n // Re-emit with the live flatIndex; registry-builder seeds -1\n // so it doesn't need to know the final ordering.\n out.push({ ...node, flatIndex: node.kind === 'step' ? flatIndex : -1 });\n if (node.kind === 'step') {\n flatIndex++;\n }\n if (node.children.length > 0) {\n visit(node.children);\n }\n }\n };\n visit(nodes);\n return out;\n}\n\n/**\n * Structural equality for the step-tree registry signal. Shape only -\n * id, kind, depth, parentId, children length. Reactive fields\n * (`label`, `disabled`, `state`, `errorAggregator`) are signals; their\n * own subscribers track identity changes.\n *\n * @internal\n */\nexport function stepTreeEqual(a: readonly CngxStepNode[], b: readonly CngxStepNode[]): boolean {\n if (a === b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n const x = a[i];\n const y = b[i];\n if (x.id !== y.id || x.kind !== y.kind || x.depth !== y.depth || x.parentId !== y.parentId) {\n return false;\n }\n if (!stepTreeEqual(x.children, y.children)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Structural equality for `flatSteps`. Adds `flatIndex` (shifts when\n * a sibling is inserted) on top of the {@link stepTreeEqual} fields.\n *\n * Use only on projections where every step carries a real\n * DFS-assigned `flatIndex` and `depth`.\n *\n * @internal Exported from `public-api.ts` so the cngx-stepper and\n * cngx-mat-stepper organisms share the comparator across the\n * secondary-entry boundary (Sheriff forbids deep-relative imports).\n */\nexport function flatStepsEqual(a: readonly CngxStepNode[], b: readonly CngxStepNode[]): boolean {\n if (a === b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (\n a[i].id !== b[i].id ||\n a[i].kind !== b[i].kind ||\n a[i].depth !== b[i].depth ||\n a[i].flatIndex !== b[i].flatIndex\n ) {\n return false;\n }\n }\n return true;\n}\n","import {\n afterNextRender,\n computed,\n Directive,\n inject,\n input,\n model,\n signal,\n type Signal,\n} from '@angular/core';\n\nimport {\n CNGX_COMMIT_CONTROLLER_FACTORY,\n type CngxCommitController,\n type CngxTransitionOutcome,\n} from '@cngx/common/data';\nimport { resolveStepFrom } from '@cngx/core';\nimport {\n CNGX_STATEFUL,\n createKeyedRegistry,\n createTransitionTracker,\n type CngxAsyncState,\n type StatusTransition,\n} from '@cngx/core/utils';\nimport { cngxDevWarn } from '@cngx/utils';\nimport type { Observable } from 'rxjs';\n\nimport {\n CNGX_STEPPER_COMMIT_HANDLER_FACTORY,\n type CngxStepperCommitHandler,\n} from './commit-handler';\nimport { injectStepperConfig } from './stepper-config';\nimport {\n CNGX_STEPPER_HOST,\n type CngxStepperHost,\n type CngxStepNode,\n type CngxStepRegistration,\n} from './stepper-host.token';\nimport { flatStepsEqual, flattenStepTree, stepTreeEqual } from './step-tree.util';\n\n/**\n * Async-commit action for stepper transitions. Receives the origin\n * and target indices; resolves `true` to advance, `false` to refuse.\n * The `Observable | Promise | sync` union matches every cngx\n * commit-action signature.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/presenter.directive.ts\n * @since 0.3.0\n */\nexport type CngxStepperCommitAction = (\n fromIndex: number,\n toIndex: number,\n) => boolean | Promise<boolean> | Observable<boolean>;\n\n/**\n * Stepper presenter - the brain of every stepper / wizard flow.\n * Holds the active-step model, registry, linear policy, orientation,\n * and commit-controller lifecycle. Provides {@link CNGX_STEPPER_HOST}\n * for atom registration and {@link CNGX_STATEFUL} so transition\n * bridges (`<cngx-toast-on />`, `<cngx-banner-on />`) compose without\n * explicit `[state]` wiring.\n *\n * Sheriff: common Level 2. Pure directive - zero template, zero CSS.\n * Level-4 organisms compose this via `hostDirectives`.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/presenter.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStep, CngxStepGroup, CngxStepperRouterSync, CNGX_STEPPER_HOST, CNGX_STEPPER_CONFIG\n * <example-url>/#/ui/stepper/stepper-commit-action/pessimistic-optimistic-commits-with-bridge-directives</example-url>\n */\n@Directive({\n selector: '[cngxStepper]',\n exportAs: 'cngxStepper',\n standalone: true,\n providers: [\n { provide: CNGX_STEPPER_HOST, useExisting: CngxStepperPresenter },\n { provide: CNGX_STATEFUL, useExisting: CngxStepperPresenter },\n ],\n})\nexport class CngxStepperPresenter implements CngxStepperHost {\n private readonly config = injectStepperConfig();\n\n /**\n * Zero-based index of the active step among the steps only (group nodes do not count), two-way bindable\n * as `[(activeStepIndex)]`. Defaults to `0`. The presenter writes it on navigation, so under a\n * `commitAction` in `'pessimistic'` mode it changes only after the action resolves `true`; reads are\n * clamped to the registered step count.\n */\n readonly activeStepIndex = model<number>(0);\n // Raw *Input slots default undefined so the cascade resolves through\n // CNGX_STEPPER_CONFIG. Must stay public - the template type-checker\n // rejects protected/private on hostDirective alias bindings.\n /**\n * Binding `[linear]`: when `true`, moving forward is refused while any enabled step from the active\n * one up to the target is not in the `'success'` state. Unset, it resolves through `defaultLinear` of the stepper config and then\n * `false`.\n */\n readonly linearInput = input<boolean | undefined>(undefined, {\n alias: 'linear',\n });\n readonly linear = computed<boolean>(\n () => this.linearInput() ?? this.config.defaultLinear ?? false,\n );\n\n /**\n * Binding `[orientation]`: layout axis of the stepper, `'horizontal'` or `'vertical'`. Unset, it resolves\n * through `defaultOrientation` of the stepper config and then `'horizontal'`. The organism mirrors the\n * resolved value to `aria-orientation` and `data-orientation`.\n */\n readonly orientationInput = input<'horizontal' | 'vertical' | undefined>(undefined, {\n alias: 'orientation',\n });\n readonly orientation = computed<'horizontal' | 'vertical'>(\n () => this.orientationInput() ?? this.config.defaultOrientation ?? 'horizontal',\n );\n\n /**\n * Async guard run before a step change: it receives the origin and target index and resolves `true` to\n * advance or `false` to refuse. Defaults to `null`, which makes every `select` a synchronous move.\n * Navigating back with `selectPrevious` bypasses it.\n */\n readonly commitAction = input<CngxStepperCommitAction | null>(null);\n\n /**\n * Binding `[commitMode]`: whether `activeStepIndex` moves to the target before the `commitAction` resolves\n * (`'optimistic'`, rolled back on refusal or failure) or only after it resolves `true` (`'pessimistic'`).\n * Unset, it resolves through `defaultCommitMode` of the stepper config and then `'pessimistic'`.\n */\n readonly commitModeInput = input<'optimistic' | 'pessimistic' | undefined>(undefined, {\n alias: 'commitMode',\n });\n readonly commitMode = computed<'optimistic' | 'pessimistic'>(\n () => this.commitModeInput() ?? this.config.defaultCommitMode ?? 'pessimistic',\n );\n\n private readonly genericFactory = inject(CNGX_COMMIT_CONTROLLER_FACTORY);\n private readonly commitController: CngxCommitController<number> = this.genericFactory<number>();\n private readonly commitHandler: CngxStepperCommitHandler = inject(\n CNGX_STEPPER_COMMIT_HANDLER_FACTORY,\n )({ controller: this.commitController });\n\n /** Producer surface for the `CNGX_STATEFUL` bridge contract. */\n readonly state: CngxAsyncState<number | undefined> = this.commitController.state;\n\n /**\n * Step index the user is committing to. Tracked separately from\n * `state.data()` because the AsyncState data slot only updates on\n * success. Drives per-step `aria-busy` in the organism.\n */\n readonly intendedStepIndex: Signal<number | undefined> = this.commitController.intendedValue;\n\n /**\n * Reactive current/previous pair for the commit-state status. Skin\n * sub-components mount a `<span cngxLiveRegion>` reading this\n * tracker. Allocated once per presenter - the underlying\n * `linkedSignal` is shared across all consumers.\n */\n readonly commitTransition: StatusTransition = createTransitionTracker(() =>\n this.commitController.state.status(),\n );\n\n // Persistence-of-rejection surface - see CngxStepperHost.lastOutcome /\n // lastFailedIndex / originIndexDuringCommit for the contract. Two\n // event sources, never synced: the settle record and the sequence whose\n // visual marker was cleared. lastFailedIndex derives from both, so\n // clearing the marker never touches the announcement record.\n private readonly lastOutcomeState = signal<CngxTransitionOutcome | undefined>(undefined);\n private readonly clearedSequenceState = signal<number | undefined>(undefined);\n // Bumped once per settled refusal or failure. Plain field - only read\n // inside the resolve handler.\n private outcomeSequence = 0;\n\n // Last index a commit actually landed on (or a sync/back move settled\n // on). Rollback + origin resolution use this instead of the per-call\n // `previous`: a rapid second select() supersedes the first while\n // `previous` already points at the never-committed optimistic index,\n // and rolling back there would strand the user mid-air. Plain field -\n // read only inside handlers, never rendered.\n private lastCommittedIndex: number | undefined;\n private readonly originIndexDuringCommitState = signal<number | undefined>(undefined);\n /** {@inheritDoc CngxStepperHost.lastOutcome} */\n readonly lastOutcome: Signal<CngxTransitionOutcome | undefined> =\n this.lastOutcomeState.asReadonly();\n /** {@inheritDoc CngxStepperHost.lastFailedIndex} */\n readonly lastFailedIndex: Signal<number | undefined> = computed(() => {\n const outcome = this.lastOutcomeState();\n return outcome && outcome.sequence !== this.clearedSequenceState() ? outcome.index : undefined;\n });\n /** {@inheritDoc CngxStepperHost.originIndexDuringCommit} */\n readonly originIndexDuringCommit: Signal<number | undefined> =\n this.originIndexDuringCommitState.asReadonly();\n\n private readonly treeState = signal<readonly CngxStepNode[]>([], {\n equal: stepTreeEqual,\n });\n readonly stepTree: Signal<readonly CngxStepNode[]> = this.treeState.asReadonly();\n\n readonly flatSteps: Signal<readonly CngxStepNode[]> = computed(\n () => flattenStepTree(this.stepTree()),\n { equal: flatStepsEqual },\n );\n\n /**\n * Step-only flat projection - terminal nodes in DFS order.\n * Structural-equal via `flatStepsEqual` so downstream computeds\n * don't cascade on shape-stable re-emits. Single source for every\n * `select*` / `clamp` / `activeStepId` lookup - never re-filter\n * `flatSteps()`.\n */\n readonly stepsOnly: Signal<readonly CngxStepNode[]> = computed(\n () => this.flatSteps().filter((n) => n.kind === 'step'),\n { equal: flatStepsEqual },\n );\n\n private readonly clampedIndex = computed(() => {\n const stepCount = this.stepsOnly().length;\n if (stepCount === 0) {\n return 0;\n }\n const i = this.activeStepIndex();\n return Math.max(0, Math.min(i, stepCount - 1));\n });\n\n readonly activeStepId: Signal<string | null> = computed(() => {\n const idx = this.clampedIndex();\n return this.stepsOnly()[idx]?.id ?? null;\n });\n\n /**\n * {@inheritDoc CngxStepperHost.activeGroupId}\n *\n * Single derivation over `activeStepId` and `stepTree` - the root-level\n * group whose subtree holds the active step, or `null` for a\n * root-level active step (e.g. a trailing `Finish`). Walked once here;\n * `CngxStepGroup.isCollapsed`, the strip `aria-expanded` binding, and\n * `visibleStripNodes` read this rather than re-walking the tree.\n */\n readonly activeGroupId: Signal<string | null> = computed(() => {\n const activeId = this.activeStepId();\n if (activeId === null) {\n return null;\n }\n const subtreeHasActive = (node: CngxStepNode): boolean =>\n node.id === activeId || node.children.some(subtreeHasActive);\n for (const root of this.stepTree()) {\n if (root.kind === 'group' && subtreeHasActive(root)) {\n return root.id;\n }\n }\n return null;\n });\n\n /**\n * {@inheritDoc CngxStepperHost.visibleStripNodes}\n *\n * Flat strip projection honouring the focus-driven group-collapse\n * policy. Under `'off'` it returns `flatSteps()` verbatim (same\n * reference, so the `equal` short-circuits). Under `'expand-active'`\n * every non-active root-level group's subtree is dropped, leaving the\n * group header node alone - the active group and all root-level steps\n * stay. Each retained node keeps its canonical `flatIndex` from\n * `flatSteps`, so per-step state/announcement lookups are unaffected.\n * Returns a fresh array, so it MUST carry `{ equal: flatStepsEqual }`\n * or every re-emit cascades the strip `@for`.\n */\n readonly visibleStripNodes: Signal<readonly CngxStepNode[]> = computed(\n () => {\n const flat = this.flatSteps();\n if (this.config.groupCollapse !== 'expand-active') {\n return flat;\n }\n const activeGroup = this.activeGroupId();\n const collapsedRootIds = new Set(\n this.stepTree()\n .filter((n) => n.kind === 'group' && n.children.length > 0 && n.id !== activeGroup)\n .map((n) => n.id),\n );\n if (collapsedRootIds.size === 0) {\n return flat;\n }\n const byId = new Map(flat.map((n) => [n.id, n] as const));\n const rootAncestorId = (node: CngxStepNode): string => {\n let cur = node;\n while (cur.parentId !== null) {\n const parent = byId.get(cur.parentId);\n if (!parent) {\n break;\n }\n cur = parent;\n }\n return cur.id;\n };\n return flat.filter(\n (node) => collapsedRootIds.has(node.id) || !collapsedRootIds.has(rootAncestorId(node)),\n );\n },\n { equal: flatStepsEqual },\n );\n\n readonly commitState = this.commitController.state;\n\n /**\n * Next enabled step-only index after the active one, skipping\n * disabled steps. Returns `stepsOnly().length` when no enabled step\n * follows. Single source for `selectNext()` and the `canGoNext`\n * bound - the traversal lives here, never re-walked at the call site.\n */\n private readonly nextEnabledIndex = computed(() => {\n const stepsOnly = this.stepsOnly();\n return (\n resolveStepFrom(this.activeStepIndex(), 1, {\n count: stepsOnly.length,\n isDisabledAt: (i) => stepsOnly[i]?.disabled() ?? false,\n }) ?? stepsOnly.length\n );\n });\n\n /**\n * Previous enabled step-only index before the active one, skipping\n * disabled steps. Returns `-1` when no enabled step precedes - also for\n * a stale out-of-range active index (consumer-writable model), which\n * must resolve to \"none\" instead of wrapping or throwing. Single\n * source for `selectPrevious()` and the `canGoPrevious` bound.\n */\n private readonly previousEnabledIndex = computed(() => {\n const stepsOnly = this.stepsOnly();\n return (\n resolveStepFrom(Math.max(this.activeStepIndex(), 0), -1, {\n count: stepsOnly.length,\n isDisabledAt: (i) => stepsOnly[i]?.disabled() ?? false,\n }) ?? -1\n );\n });\n\n /** {@inheritDoc CngxStepperHost.stepCount} */\n readonly stepCount: Signal<number> = computed(() => this.stepsOnly().length);\n\n /** {@inheritDoc CngxStepperHost.isFirstStep} */\n readonly isFirstStep: Signal<boolean> = computed(() => this.clampedIndex() <= 0);\n\n /** {@inheritDoc CngxStepperHost.isLastStep} */\n readonly isLastStep: Signal<boolean> = computed(\n () => this.clampedIndex() >= this.stepCount() - 1,\n );\n\n /**\n * {@inheritDoc CngxStepperHost.canGoNext}\n *\n * Derives from the same `nextEnabledIndex` + `isLinearBlocked`\n * predicates `select()`/`selectNext()` enforce, so the affordance can\n * never drift from the navigation it gates.\n */\n readonly canGoNext: Signal<boolean> = computed(() => {\n const next = this.nextEnabledIndex();\n return next < this.stepCount() && !this.isLinearBlocked(next);\n });\n\n /** {@inheritDoc CngxStepperHost.canGoPrevious} */\n readonly canGoPrevious: Signal<boolean> = computed(() => this.previousEnabledIndex() >= 0);\n\n // Runs outside the commit (the finish run) that hold the stepper busy.\n private readonly busySources = createKeyedRegistry<Signal<boolean>>({\n name: 'CngxStepperPresenter',\n });\n\n /** {@inheritDoc CngxStepperHost.busy} */\n readonly busy: Signal<boolean> = computed(\n () =>\n this.commitState.status() === 'pending' ||\n this.busySources.values().some((pending) => pending()),\n );\n\n /** {@inheritDoc CngxStepperHost.nextStepLabel} */\n readonly nextStepLabel: Signal<string | undefined> = computed(() =>\n this.stepsOnly()[this.nextEnabledIndex()]?.label(),\n );\n\n /** {@inheritDoc CngxStepperHost.previousStepLabel} */\n readonly previousStepLabel: Signal<string | undefined> = computed(() =>\n this.stepsOnly()[this.previousEnabledIndex()]?.label(),\n );\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n afterNextRender(() => {\n const stepNodes = this.flatSteps().filter((n) => n.kind === 'step');\n if (stepNodes.length > 6 && stepNodes.every((n) => n.parentId === null)) {\n cngxDevWarn(\n 'CNGX1039',\n '[cngxStepper] more than 6 steps and none inside a [cngxStepGroup]; consider wrapping logical groups of steps in [cngxStepGroup] for better UX',\n );\n }\n });\n }\n }\n\n // Flat id lookup; rebuilt into the hierarchical tree on each\n // register/unregister.\n private readonly registry = new Map<\n string,\n { reg: CngxStepRegistration; parentId: string | null; childIds: string[] }\n >();\n private readonly insertionOrder: string[] = [];\n\n /**\n * `CngxStepperHost` contract, called by `CngxStep` and `CngxStepGroup` in their `ngOnInit`, or by a\n * `CngxStepGroup` on behalf of a nested child with its own id as `parentId`. Adds the node to the step\n * tree in registration order; a second call with a known id replaces the stored handle and keeps its\n * position. A group must register before its children.\n */\n register(handle: CngxStepRegistration, parentId: string | null = null): void {\n if (this.registry.has(handle.id)) {\n // Idempotent re-register - replace the handle, keep the ordering slot.\n const entry = this.registry.get(handle.id)!;\n entry.reg = handle;\n entry.parentId = parentId;\n } else {\n this.registry.set(handle.id, { reg: handle, parentId, childIds: [] });\n this.insertionOrder.push(handle.id);\n if (parentId !== null) {\n const parent = this.registry.get(parentId);\n if (parent) {\n parent.childIds.push(handle.id);\n }\n }\n }\n this.rebuildTree();\n }\n\n /** {@inheritDoc CngxStepperHost.registerBusy} */\n registerBusy(key: string, pending: Signal<boolean>): () => void {\n this.busySources.register(key, pending);\n return () => this.busySources.unregister(key, pending);\n }\n\n /**\n * `CngxStepperHost` contract, called from the destroy hook of `CngxStep` and `CngxStepGroup`. Removes the\n * node from the step tree; when `handle` is passed and is no longer the stored one (it was replaced by a\n * re-register), the call does nothing.\n */\n unregister(id: string, handle?: CngxStepRegistration): void {\n const entry = this.registry.get(id);\n if (!entry) {\n return;\n }\n // Instance guard: after an idempotent re-register replaced the stored\n // handle, the superseded instance's destroy is a no-op.\n if (handle !== undefined && entry.reg !== handle) {\n return;\n }\n if (entry.parentId !== null) {\n const parent = this.registry.get(entry.parentId);\n if (parent) {\n parent.childIds = parent.childIds.filter((c) => c !== id);\n }\n }\n this.registry.delete(id);\n const insertIdx = this.insertionOrder.indexOf(id);\n if (insertIdx >= 0) {\n this.insertionOrder.splice(insertIdx, 1);\n }\n this.rebuildTree();\n }\n\n private rebuildTree(): void {\n const buildNode = (id: string, depth: number): CngxStepNode => {\n const entry = this.registry.get(id)!;\n const children = entry.childIds.map((cid) => buildNode(cid, depth + 1));\n return {\n id,\n kind: entry.reg.kind,\n label: entry.reg.label,\n disabled: entry.reg.disabled,\n state: entry.reg.state,\n errorAggregator: entry.reg.errorAggregator,\n errorMessage: entry.reg.errorMessage,\n children,\n depth,\n parentId: entry.parentId,\n flatIndex: -1,\n };\n };\n const rootIds = this.insertionOrder.filter((id) => this.registry.get(id)!.parentId === null);\n this.treeState.set(rootIds.map((id) => buildNode(id, 0)));\n }\n\n /** {@inheritDoc CngxStepperHost.clearLastFailed} */\n clearLastFailed(): void {\n this.clearedSequenceState.set(this.lastOutcomeState()?.sequence);\n }\n\n /**\n * Linear-gate predicate: `true` when linear mode forbids advancing to\n * `target` because an incomplete (non-`success`, non-disabled) step\n * sits between the active index and `target`. The single home for the\n * linear slice check - `select()` and the `canGoNext` bound both\n * consume it so the gate can never drift between navigation and its\n * affordance.\n */\n private isLinearBlocked(target: number): boolean {\n if (!this.linear() || target <= this.activeStepIndex()) {\n return false;\n }\n return this.stepsOnly()\n .slice(this.activeStepIndex(), target)\n .some((n) => n.state() !== 'success' && !n.disabled());\n }\n\n /**\n * {@inheritDoc CngxStepperHost.canNavigateTo}\n *\n * Wraps the private {@link isLinearBlocked} predicate plus the\n * per-step `disabled` check. The header-reachability contract surface;\n * `isLinearBlocked` stays private so the organism reads this method,\n * never the internal gate.\n */\n canNavigateTo(index: number): boolean {\n const stepsOnly = this.stepsOnly();\n if (index < 0 || index >= stepsOnly.length) {\n return false;\n }\n if (stepsOnly[index].disabled()) {\n return false;\n }\n return !this.isLinearBlocked(index);\n }\n\n /**\n * Moves to the step at the given step-only index, clamped to the registered range. Does nothing when the\n * target is the active step, is disabled, or is blocked by `linear`. Without a `commitAction` the move is\n * synchronous; with one, the move follows `commitMode`, and a newer call supersedes the pending one.\n */\n select(index: number): void {\n const stepsOnly = this.stepsOnly();\n if (stepsOnly.length === 0) {\n return;\n }\n const target = Math.max(0, Math.min(index, stepsOnly.length - 1));\n if (this.isLinearBlocked(target)) {\n return;\n }\n if (stepsOnly[target].disabled()) {\n return;\n }\n const previous = this.activeStepIndex();\n if (target === previous) {\n return;\n }\n\n const action = this.commitAction();\n if (!action) {\n // No-action fast path - sync move, no commit window opens, so\n // `originIndexDuringCommit` stays untouched. Clear the rejection\n // flag if the user re-picked a previously-failed target.\n this.activeStepIndex.set(target);\n this.lastCommittedIndex = target;\n if (this.lastFailedIndex() === target) {\n this.clearLastFailed();\n }\n return;\n }\n\n // Commit-gated transition. Pessimistic holds at `previous` until\n // the action resolves; optimistic advances now and rolls back on\n // rejection. Supersede comes from the lifted commit-controller -\n // a rapid second select() cancels the in-flight runner.\n //\n // Capture the safe-harbour origin exactly once on commit-window\n // open. Written ONLY on this path so a stale origin never lingers\n // into a non-commit navigation. The origin is the last TRULY\n // committed index, not `previous`: under a superseded optimistic\n // commit `previous` is the never-committed optimistic position.\n const origin = this.lastCommittedIndex ?? previous;\n // Record the origin as truly committed on window open: for the first\n // window `previous` IS the settled start position; for a superseding\n // select the field already holds the real one (idempotent).\n this.lastCommittedIndex = origin;\n this.originIndexDuringCommitState.set(origin);\n const mode = this.commitMode();\n if (mode === 'optimistic') {\n this.activeStepIndex.set(target);\n }\n this.commitHandler.beginTransition(previous, target, action, (outcome) => {\n if (outcome === 'accepted') {\n // Success - origin no longer needed; clear the rejection\n // marker if the user re-picked the rejected target.\n this.lastCommittedIndex = target;\n this.originIndexDuringCommitState.set(undefined);\n if (this.lastFailedIndex() === target) {\n this.clearLastFailed();\n }\n if (mode === 'pessimistic') {\n this.activeStepIndex.set(target);\n }\n return;\n }\n // Refused or failed - record the outcome on the target; RETAIN the\n // origin so `liveAnnouncement` can resolve the origin label for\n // the rich phrase. Both kinds roll back: optimistic returns to the\n // last truly-committed index, pessimistic never moved off it.\n this.lastOutcomeState.set({\n kind: outcome,\n index: target,\n sequence: ++this.outcomeSequence,\n });\n if (mode === 'optimistic') {\n this.activeStepIndex.set(origin);\n }\n });\n }\n\n /**\n * Moves to the next enabled step after the active one, through `select`. Does nothing when no enabled\n * step follows; the `linear` gate and the `commitAction` apply as for any other forward move.\n */\n selectNext(): void {\n const next = this.nextEnabledIndex();\n if (next < this.stepsOnly().length) {\n this.select(next);\n }\n }\n\n /**\n * Ungated back-move. Supersedes an in-flight commit: the runner is\n * canceled and the commit state settles to idle, so `busy` cannot\n * latch and a late resolve cannot yank the user forward off the step\n * they explicitly returned to.\n */\n selectPrevious(): void {\n const prev = this.previousEnabledIndex();\n if (prev >= 0) {\n this.cancelAndSettleCommit();\n this.originIndexDuringCommitState.set(undefined);\n this.lastCommittedIndex = prev;\n this.activeStepIndex.set(prev);\n }\n }\n\n /**\n * Moves to the step registered under the given id, through `select`. Group ids and unknown ids are\n * ignored.\n */\n selectById(id: string): void {\n const stepsOnly = this.stepsOnly();\n const idx = stepsOnly.findIndex((n) => n.id === id);\n if (idx >= 0) {\n this.select(idx);\n }\n }\n\n /**\n * Returns to the first step without running the `commitAction`. Cancels a commit in flight and clears the\n * origin, the rejection marker and the last outcome.\n */\n reset(): void {\n this.activeStepIndex.set(0);\n this.lastCommittedIndex = 0;\n this.originIndexDuringCommitState.set(undefined);\n this.lastOutcomeState.set(undefined);\n this.clearedSequenceState.set(undefined);\n // Settle mid-commit resets to idle - the surface lives on, so a\n // dangling 'pending' would latch busy() forever.\n this.cancelAndSettleCommit();\n }\n\n /**\n * Cancels the in-flight commit and settles the state to idle. The\n * settle option is load-bearing here - a custom\n * `CNGX_COMMIT_CONTROLLER_FACTORY` implementation that ignores it\n * leaves `busy` latched, which is invisible until a user backs out\n * mid-commit; the dev-mode probe surfaces that immediately.\n */\n private cancelAndSettleCommit(): void {\n this.commitController.cancel({ settle: true });\n if (typeof ngDevMode !== 'undefined' && ngDevMode && this.commitState.status() === 'pending') {\n cngxDevWarn(\n 'CNGX1040',\n '[cngxStepper] the commit controller ignored cancel({ settle: true }) - busy stays ' +\n 'latched. Honor the settle option in your CNGX_COMMIT_CONTROLLER_FACTORY override.',\n );\n }\n }\n}\n\nexport { type CngxStepStatus } from './stepper-host.token';\n","import { InjectionToken } from '@angular/core';\n\nimport type { CngxStepRegistration } from './stepper-host.token';\n\n/**\n * Contract a `CngxStep` sees when it injects a parent group via\n * {@link CNGX_STEP_GROUP_HOST}. Mirrors the presenter's `register` /\n * `unregister` so atoms stay agnostic of root vs. nested host.\n *\n * Surface is registration-only - `id` and `aggregatedStatus` are\n * concrete-class details, not part of the token contract.\n */\nexport interface CngxStepGroupHost {\n register(handle: CngxStepRegistration): void;\n /** Instance-guarded like `CngxStepperHost.unregister` - see there. */\n unregister(id: string, handle?: CngxStepRegistration): void;\n}\n\n/**\n * DI token providing a `CngxStepGroup`'s contract to nested `CngxStep` atoms.\n * Steps inject this `optional: true` and fall back to {@link CNGX_STEPPER_HOST}.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-group-host.token.ts\n * @since 0.3.0\n */\nexport const CNGX_STEP_GROUP_HOST = new InjectionToken<CngxStepGroupHost>('CngxStepGroupHost');\n","import { InjectionToken, type Signal, type TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from './stepper-host.token';\n\n/**\n * Context delivered to `*cngxStepLabel` templates. Gives typed access\n * to live step state without reaching into the host token.\n *\n * `index` is 1-based in the step-only flat projection (groups excluded).\n * `active` reflects `presenter.activeStepId`; `busy` mirrors\n * `presenter.intendedStepIndex` matching this step; `disabled` reads\n * `node.disabled()`.\n */\nexport interface CngxStepLabelContext {\n readonly node: CngxStepNode;\n readonly index: number;\n readonly active: boolean;\n readonly busy: boolean;\n readonly disabled: boolean;\n}\n\n/**\n * Context delivered to `*cngxStepContent` templates. Mirrors\n * {@link CngxStepLabelContext} - content templates need the same\n * derivations to gate inner controls on `disabled` / `busy`.\n */\nexport interface CngxStepContentContext {\n readonly node: CngxStepNode;\n readonly index: number;\n readonly active: boolean;\n readonly busy: boolean;\n readonly disabled: boolean;\n}\n\n/**\n * Contract Level-4 organisms (and consumer-authored stepper skins)\n * consume to render the panel body. Narrower than the presenter's\n * full interface - just enough to project label / content templates\n * and react to active-step changes.\n */\nexport interface CngxStepPanelHost {\n readonly flatSteps: Signal<readonly CngxStepNode[]>;\n readonly activeStepIndex: Signal<number>;\n readonly activeStepId: Signal<string | null>;\n /** Resolves a step id to its `*cngxStepLabel` template (consumer-supplied). */\n labelTemplateFor(id: string): TemplateRef<CngxStepLabelContext> | null;\n /** Resolves a step id to its `*cngxStepContent` template (consumer-supplied). */\n contentTemplateFor(id: string): TemplateRef<CngxStepContentContext> | null;\n}\n\n/**\n * DI token providing the rendering-surface contract to organism shells\n * (`<cngx-stepper>`, `<cngx-mat-stepper>`) and consumer-authored skins.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-panel-host.token.ts\n * @since 0.3.0\n */\nexport const CNGX_STEP_PANEL_HOST = new InjectionToken<CngxStepPanelHost>('CngxStepPanelHost');\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepContentContext } from './step-panel-host.token';\n\n/**\n * Marker directive carrying a `CngxStep`'s content template.\n * Discovered via `contentChild(CngxStepContent)`. Typed with\n * {@link CngxStepContentContext} so `let-busy=\"busy\"` etc. gives\n * typed access to live step state.\n *\n * ```html\n * <ng-template cngxStepContent let-busy=\"busy\">\n * <input [disabled]=\"busy\">\n * </ng-template>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-content.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStep, CngxStepLabel\n * <example-url>/#/ui/stepper/stepper-step-content/typed-lazy-panels</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepContent]',\n standalone: true,\n})\nexport class CngxStepContent {\n readonly templateRef = inject<TemplateRef<CngxStepContentContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepLabelContext } from './step-panel-host.token';\n\n/**\n * Marker directive carrying a `CngxStep`'s label template.\n * Discovered via `contentChild(CngxStepLabel)`. Typed with\n * {@link CngxStepLabelContext} for typed `let-node=\"node\"` /\n * `let-active=\"active\"` access.\n *\n * ```html\n * <ng-template cngxStepLabel let-node=\"node\">\n * {{ node.label() }}\n * </ng-template>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-label.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStep, CngxStepContent, CngxStepGroupHeader\n * <example-url>/#/ui/stepper/stepper-custom-labels/mixing-code-label-code-input-with-code-cngxsteplabel-code-slot</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepLabel]',\n standalone: true,\n})\nexport class CngxStepLabel {\n readonly templateRef = inject<TemplateRef<CngxStepLabelContext>>(TemplateRef);\n}\n","import {\n computed,\n contentChild,\n DestroyRef,\n Directive,\n inject,\n input,\n type OnInit,\n type Signal,\n} from '@angular/core';\n\nimport { nextUid } from '@cngx/core/utils';\nimport { CngxRuntimeError } from '@cngx/utils';\n\nimport type { CngxErrorAggregatorContract } from '@cngx/common/interactive';\n\nimport { CNGX_STEP_GROUP_HOST } from './step-group-host.token';\nimport { CngxStepContent } from './step-content.directive';\nimport { CngxStepLabel } from './step-label.directive';\nimport {\n CNGX_STEPPER_HOST,\n type CngxStepRegistration,\n type CngxStepStatus,\n} from './stepper-host.token';\n\n/**\n * Single-step atom. Registers with the nearest host - either a\n * `CngxStepGroup` ({@link CNGX_STEP_GROUP_HOST}) or the root\n * `CngxStepperPresenter` ({@link CNGX_STEPPER_HOST}).\n *\n * `state` is a pure `computed` over `[disabled]`, `[completed]`, and\n * the optional `[errorAggregator]`'s `hasError()`.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepGroup, CngxStepperPresenter, CngxStepLabel, CngxStepContent\n * @slot cngxStepLabel The step's own header label.\n * @slot cngxStepContent The step body, rendered lazily when the step activates.\n * <example-url>/#/ui/stepper/stepper-step-content/typed-lazy-panels</example-url>\n * @axis level molecule\n */\n@Directive({\n selector: '[cngxStep]',\n exportAs: 'cngxStep',\n standalone: true,\n})\nexport class CngxStep implements OnInit {\n /**\n * Identifier the step registers under with its host. Defaults to an auto-generated `cngx-step` uid.\n * It is read once in `ngOnInit`, so a bound `[id]` must be set before init; the router-sync deep link\n * and `selectById` match against this value.\n */\n readonly id = input<string>(nextUid('cngx-step'));\n\n /**\n * Marks the step as not navigable. Defaults to `false`. A disabled step reports `state` `'disabled'`,\n * is skipped by next/previous navigation and refused by `select`, and the strip header reflects it\n * through `aria-disabled`.\n */\n readonly disabled = input<boolean>(false);\n\n /**\n * Marks the step as done. Defaults to `false`. A completed step reports `state` `'success'` unless it is\n * disabled or errored, and a `linear` stepper only lets the user move past steps that are in that state.\n */\n readonly completed = input<boolean>(false);\n\n /**\n * Header text of the step, shown in the strip and used for the next/previous step labels and the\n * announcement phrases. Defaults to an empty string.\n */\n readonly label = input<string>('');\n\n /**\n * Optional error aggregator whose `hasError()` puts the step into the `'error'` state, for forms with\n * several error sources. Defaults to `undefined`. It composes with `[error]`: either one errors the step.\n */\n readonly errorAggregator = input<CngxErrorAggregatorContract | undefined>(undefined);\n\n /**\n * Direct error flag for the common \"this step is invalid\" case - no\n * `errorAggregator` boilerplate required. `true` or a non-empty string\n * drives the error state; a string doubles as the inline message\n * (surfaced via the `*cngxStepError` slot and the mini-skin aggregate\n * line). `false` / `''` clear it. The aggregator stays the rich\n * multi-source forms path; the two channels compose (either errors).\n */\n readonly error = input<string | boolean>(false);\n\n /**\n * Resolved direct-error message: the `[error]` string when non-empty,\n * else `undefined`. Carried onto the registration / node so the error\n * slot + aggregate line can render it. `computed` over the input -\n * never written.\n */\n readonly errorMessage: Signal<string | undefined> = computed(() => {\n const value = this.error();\n return typeof value === 'string' && value !== '' ? value : undefined;\n });\n\n protected readonly labelSlot = contentChild(CngxStepLabel);\n protected readonly contentSlot = contentChild(CngxStepContent);\n\n readonly labelTemplate = this.labelSlot;\n readonly contentTemplate = this.contentSlot;\n\n /** Per-step status derived from inputs + aggregator - never written. */\n readonly state: Signal<CngxStepStatus> = computed(() => {\n if (this.disabled()) {\n return 'disabled';\n }\n const directError = this.error();\n const errored =\n (directError !== false && directError !== '') ||\n (this.errorAggregator()?.hasError?.() ?? false);\n if (errored) {\n return 'error';\n }\n if (this.completed()) {\n return 'success';\n }\n return 'idle';\n });\n\n private readonly groupHost = inject(CNGX_STEP_GROUP_HOST, { optional: true });\n private readonly stepperHost = inject(CNGX_STEPPER_HOST, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n\n constructor() {\n if (!this.groupHost && !this.stepperHost) {\n throw new CngxRuntimeError(\n 'CNGX1046',\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n '[cngxStep] must be placed inside an element with [cngxStepper], such as ' +\n '<cngx-stepper>, directly or through a [cngxStepGroup] inside it.',\n );\n }\n }\n\n ngOnInit(): void {\n // Register in ngOnInit, NOT the constructor: a bound `[id]` signal\n // input is not applied until the first change detection, so a\n // constructor read captures the default auto-id. The registered id is\n // the key the router-sync deep-link seed and consumers match against,\n // so it must reflect the bound `[id]`. ngOnInit still runs before the\n // host's ngAfterContentInit, so the seed's registry precondition holds;\n // and it fires ancestor-group-before-descendant-step in DOM order, so\n // the presenter's insertion-order tree is unchanged. Mirrors CngxTab.\n const host = this.groupHost ?? this.stepperHost!;\n const stepId = this.id();\n const handle: CngxStepRegistration = {\n id: stepId,\n kind: 'step',\n label: this.label,\n disabled: this.disabled,\n state: this.state,\n errorAggregator: this.errorAggregator,\n errorMessage: this.errorMessage,\n };\n host.register(handle);\n this.destroyRef.onDestroy(() => host.unregister(stepId, handle));\n }\n}\n","import {\n computed,\n DestroyRef,\n Directive,\n inject,\n input,\n signal,\n type OnInit,\n type Signal,\n} from '@angular/core';\n\nimport { nextUid } from '@cngx/core/utils';\nimport { CngxRuntimeError } from '@cngx/utils';\n\nimport { CNGX_STEP_GROUP_HOST, type CngxStepGroupHost } from './step-group-host.token';\nimport { injectStepperConfig } from './stepper-config';\nimport {\n CNGX_STEPPER_HOST,\n type CngxStepRegistration,\n type CngxStepStatus,\n} from './stepper-host.token';\n\n/**\n * Step-group atom. Registers with the root presenter as a `kind: 'group'`\n * node and provides {@link CNGX_STEP_GROUP_HOST} so nested `CngxStep`\n * atoms register with the group, not the root.\n *\n * `aggregatedStatus` rolls up child states: `error` if any errored,\n * `success` if all are success, `pending` if any is pending or busy,\n * otherwise `idle`.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-group.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStep, CngxStepperPresenter, CngxStepGroupHeader\n * <example-url>/#/ui/stepper/stepper-hierarchical/group-nested-steps-trailing-root-step</example-url>\n * <example-url>/#/ui/stepper/stepper-hierarchical/expand-active-group-collapse</example-url>\n * <example-url>/#/ui/stepper/stepper-hierarchical/group-collapse-summary-count</example-url>\n */\n@Directive({\n selector: '[cngxStepGroup]',\n exportAs: 'cngxStepGroup',\n standalone: true,\n providers: [{ provide: CNGX_STEP_GROUP_HOST, useExisting: CngxStepGroup }],\n})\nexport class CngxStepGroup implements CngxStepGroupHost, OnInit {\n /**\n * Identifier the group registers under with the root presenter. Defaults to an auto-generated\n * `cngx-step-group` uid. It is read once in `ngOnInit`, so a bound `[id]` must be set before init;\n * child steps are registered with this id as their parent.\n */\n readonly id = input<string>(nextUid('cngx-step-group'));\n\n /**\n * Disabled flag of the group node in the step tree. Defaults to `false`. It does not disable the child\n * steps, which keep their own `[disabled]`.\n */\n readonly disabled = input<boolean>(false);\n\n /**\n * Header text of the group, rendered as the group label in the stepper strip. Defaults to an empty string.\n */\n readonly label = input<string>('');\n\n private readonly config = injectStepperConfig();\n\n // Local child registry - only feeds `aggregatedStatus` below.\n // The presenter owns the canonical tree.\n private readonly childRegistry = signal<readonly CngxStepRegistration[]>([]);\n\n readonly aggregatedStatus: Signal<CngxStepStatus> = computed(\n () => {\n const states = this.childRegistry().map((c) => c.state());\n if (states.length === 0) {\n return 'idle';\n }\n if (states.some((s) => s === 'error')) {\n return 'error';\n }\n if (states.some((s) => s === 'pending')) {\n // 'pending' can only come from a nested group's own rollup; leaf\n // steps never produce it ('busy' is a per-step presenter concern,\n // not a step state, so no 'busy' arm exists here).\n return 'pending';\n }\n if (states.every((s) => s === 'success')) {\n return 'success';\n }\n return 'idle';\n },\n { equal: Object.is },\n );\n\n private readonly stepperHost = inject(CNGX_STEPPER_HOST, { optional: true });\n\n // A group nested inside another group must register through its parent\n // (skipSelf past our own CNGX_STEP_GROUP_HOST provider), or it would\n // silently register as a root and flatten the tree.\n private readonly parentGroupHost = inject(CNGX_STEP_GROUP_HOST, {\n optional: true,\n skipSelf: true,\n });\n\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * `true` when this group's children are collapsed to the header node:\n * the focus-driven policy is `'expand-active'`, this group does not\n * hold the active step, and it has at least one child. Pure\n * `computed()` over the host's `activeGroupId` + the resolved policy -\n * never toggled in an event handler (Pillar 1).\n *\n * Consumer-readable via `exportAs: 'cngxStepGroup'` (e.g.\n * `#g=\"cngxStepGroup\"` then `g.isCollapsed()`). The rendered strip\n * group header owns the reactive `aria-expanded` disclosure attribute\n * (`<cngx-stepper>` `groupAriaExpanded`); the projected `[cngxStepGroup]`\n * host element is not rendered in the strip, so it carries no ARIA.\n */\n readonly isCollapsed: Signal<boolean> = computed(() => {\n if (this.config.groupCollapse !== 'expand-active') {\n return false;\n }\n if (this.childRegistry().length === 0) {\n return false;\n }\n return this.stepperHost?.activeGroupId() !== this.id();\n });\n\n constructor() {\n if (!this.stepperHost) {\n throw new CngxRuntimeError(\n 'CNGX1047',\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n '[cngxStepGroup] must be placed inside an element with [cngxStepper], ' +\n 'such as <cngx-stepper>.',\n );\n }\n }\n\n ngOnInit(): void {\n // Register in ngOnInit, not the constructor, so a bound `[id]` reaches\n // the registry (see CngxStep). A group MUST register before its child\n // steps or the presenter drops the orphaned children; ngOnInit fires an\n // ancestor group before its descendant steps, so that order holds, and\n // groups and steps share one lifecycle phase - keeping the presenter's\n // insertion-order tree identical to the previous constructor ordering.\n const registrationHost = this.parentGroupHost ?? this.stepperHost!;\n const groupId = this.id();\n const handle: CngxStepRegistration = {\n id: groupId,\n kind: 'group',\n label: this.label,\n disabled: this.disabled,\n state: this.aggregatedStatus,\n };\n registrationHost.register(handle);\n this.destroyRef.onDestroy(() => registrationHost.unregister(groupId, handle));\n }\n\n /**\n * `CngxStepGroupHost` contract, called by a nested `CngxStep` (or a nested `CngxStepGroup`) in its\n * `ngOnInit`. Adds the handle to the group's own registry, which feeds `aggregatedStatus`, and forwards\n * it to the root presenter with this group's id as parent.\n */\n register(handle: CngxStepRegistration): void {\n this.childRegistry.update((cur) => [...cur, handle]);\n // Forward to the root with this group as parent so the tree shape is correct.\n this.stepperHost!.register(handle, this.id());\n }\n\n /**\n * `CngxStepGroupHost` contract, called from the destroy hook of a nested `CngxStep` or\n * `CngxStepGroup`. Removes the registration from the group's registry and from the root presenter; when\n * `handle` is passed, only that exact instance is evicted.\n */\n unregister(id: string, handle?: CngxStepRegistration): void {\n // Same instance guard as the presenter: only evict the exact handle\n // (or fall back to id-keyed removal for handle-less callers).\n this.childRegistry.update((cur) =>\n cur.filter((c) => (handle !== undefined ? c !== handle : c.id !== id)),\n );\n this.stepperHost!.unregister(id, handle);\n }\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode, CngxStepStatus } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepIndicator` template. Drives the\n * numbered / checkmark / error glyph inside each step button. The\n * `<button>` shell - `aria-current`, `aria-controls`, click handler -\n * stays library-owned.\n *\n * `status` mirrors `node.state()`. `busy` is the presenter-derived\n * \"this step is the in-flight commit target\" flag - independent of\n * `status === 'pending'` (which is the aggregate landmark state).\n */\nexport interface CngxStepIndicatorContext {\n /** Convenience alias for `position` - usable as `let-position` shorthand. */\n readonly $implicit: number;\n /** 1-based position of this step in the flat step-only projection. */\n readonly position: number;\n /** The step node carrying id / label / disabled / state signals. */\n readonly node: CngxStepNode;\n /** `true` when this step is the current `activeStepId`. */\n readonly active: boolean;\n /** Live step status - drives the visual variant (idle / success / error / busy). */\n readonly status: CngxStepStatus;\n /** `true` when this step is the in-flight commit target. */\n readonly busy: boolean;\n}\n\n/**\n * Slot directive for the indicator-glyph template on `<cngx-stepper>`.\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.indicator` before falling back to\n * the built-in numeric span (`{{ position }}`).\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepIndicator let-position let-node=\"node\" let-status=\"status\">\n * @if (status === 'success') {\n * <my-icon name=\"check\" />\n * } @else if (status === 'error') {\n * <my-icon name=\"alert\" />\n * } @else {\n * <span class=\"my-step-num\">{{ position }}</span>\n * }\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-indicator.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepBadge, CngxStepBusySpinner, CngxStepRejection, CngxStepGroupHeader\n * <example-url>/#/ui/stepper/stepper-slot-overrides/custom-indicator-glyph-via-code-cngxstepindicator-code</example-url>\n * <example-url>/#/ui/stepper/stepper-slot-overrides/cross-skin-indicator-override</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepIndicator]',\n exportAs: 'cngxStepIndicator',\n standalone: true,\n})\nexport class CngxStepIndicator {\n readonly templateRef = inject<TemplateRef<CngxStepIndicatorContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepBadge` template. Drives the error\n * badge inside a step button when `errorAggregator?.shouldShow()` is\n * truthy. Consumers swap the built-in `'!'` glyph for a counter pill\n * or branded marker; the visibility gate stays library-owned.\n */\nexport interface CngxStepBadgeContext {\n /** Aggregated error count for this step (≥ 1 when shown). */\n readonly count: number;\n /** The step node carrying id / label / state signals. */\n readonly node: CngxStepNode;\n}\n\n/**\n * Slot directive for the error-badge template on `<cngx-stepper>`.\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.badge` before falling back to\n * the default alert icon (`CNGX_ICON_ALERT` from `@cngx/utils`).\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepBadge let-count=\"count\">\n * <span class=\"my-badge-pill\">{{ count }}</span>\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-badge.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepIndicator, CngxStepBusySpinner, CngxStepRejection\n * <example-url>/#/ui/stepper/stepper-slot-overrides/custom-error-badge-via-code-cngxstepbadge-code</example-url>\n * <example-url>/#/ui/stepper/stepper-error-aggregation/per-step-error-badges</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepBadge]',\n exportAs: 'cngxStepBadge',\n standalone: true,\n})\nexport class CngxStepBadge {\n readonly templateRef = inject<TemplateRef<CngxStepBadgeContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepBusySpinner` template. Drives the\n * pending-commit overlay on the in-flight target step. Renders only\n * when the step matches `presenter.intendedStepIndex()` with\n * `commitState.status() === 'pending'`.\n */\nexport interface CngxStepBusySpinnerContext {\n /** The step node carrying id / label / state signals. */\n readonly node: CngxStepNode;\n}\n\n/**\n * Slot directive for the busy-spinner template on `<cngx-stepper>`.\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.busySpinner` before falling back to\n * the built-in pulse-animation span.\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepBusySpinner>\n * <my-spinner size=\"sm\" />\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-busy-spinner.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepIndicator, CngxStepBadge, CngxStepRejection\n * <example-url>/#/ui/stepper/stepper-slot-overrides/custom-busy-spinner-via-code-cngxstepbusyspinner-code</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepBusySpinner]',\n exportAs: 'cngxStepBusySpinner',\n standalone: true,\n})\nexport class CngxStepBusySpinner {\n readonly templateRef = inject<TemplateRef<CngxStepBusySpinnerContext>>(\n TemplateRef,\n );\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepRejection` template. Renders on the\n * strip step the most recent commit was rolled back FROM - sibling of\n * the tabs `cngxTabRejectionIcon` slot. Renders only when\n * `presenter.lastFailedIndex()` matches the step's flat-index.\n *\n * `reason` tells the two commit outcomes apart: `'refused'` when the\n * commit action answered `false`, `'failed'` when it threw, rejected or\n * errored. Both render the slot; pick a glyph or copy per reason.\n *\n * `originLabel` is the safe-harbour step's label, derived from\n * `presenter.originIndexDuringCommit()`. May be `undefined` when the\n * origin index is out of range (synchronous-rejection edge case);\n * gate richer UI on its presence.\n */\nexport interface CngxStepRejectionContext {\n /** Flat-index of the rejected step (`presenter.lastFailedIndex()`). */\n readonly failedIndex: number;\n /** Resolved label of the safe-harbour step, when derivable. */\n readonly originLabel: string | undefined;\n /** The rejected step node carrying id / label / state signals. */\n readonly node: CngxStepNode;\n /** Why the commit did not land (`presenter.lastOutcome().kind`). */\n readonly reason: 'refused' | 'failed';\n}\n\n/**\n * Slot directive for the rejection-decoration template on\n * `<cngx-stepper>`. Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.rejection` before falling back to\n * the default icon (`CNGX_ICON_ALERT` on a failed commit, `CNGX_ICON_BAN` on\n * a refused one, from `@cngx/utils`).\n *\n * Symmetric context shape with the upcoming tabs `cngxTabRejectionIcon`\n * slot so consumer templates port directly between the two families.\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepRejection let-failedIndex=\"failedIndex\" let-originLabel=\"originLabel\">\n * <my-icon name=\"rollback\" />\n * @if (originLabel) {\n * <span class=\"cngx-sr-only\">Rolled back to {{ originLabel }}</span>\n * }\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-rejection.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepBadge, CngxStepIndicator, CngxStepBusySpinner\n * <example-url>/#/ui/stepper/stepper-slot-overrides/rejection-decoration-via-code-cngxsteprejection-code</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepRejection]',\n exportAs: 'cngxStepRejection',\n standalone: true,\n})\nexport class CngxStepRejection {\n readonly templateRef = inject<TemplateRef<CngxStepRejectionContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepError` template. Renders the\n * validation-error reason for a step in the error state - sibling of\n * the commit-channel `*cngxStepRejection` slot. The two channels stay\n * distinct: rejection decorates the step a commit rolled back FROM;\n * this slot surfaces the per-step validation message.\n *\n * `message` resolves the direct `[error]` string > the first\n * aggregator label > the i18n `errored` status phrase, so a template\n * that renders `{{ message }}` always shows a non-empty reason.\n * `errorLabels` / `announcement` expose the richer aggregator surface\n * for consumers that want a list or the full SR phrase.\n */\nexport interface CngxStepErrorContext {\n /** The errored step node carrying id / label / state signals. */\n readonly node: CngxStepNode;\n /** Resolved error reason (direct `[error]` string > aggregator label > i18n). */\n readonly message: string;\n /** Aggregator error labels, or an empty array when none. */\n readonly errorLabels: readonly string[];\n /** Aggregator SR announcement phrase, or an empty string when none. */\n readonly announcement: string;\n}\n\n/**\n * Slot directive for the per-step error-message template on\n * `<cngx-stepper>`. Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.stepError` before falling back to the\n * built-in `{{ message }}` text. Mirrors {@link CngxStepRejection} so\n * consumer-authored templates read the same way across both channels.\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepError let-message=\"message\" let-errorLabels=\"errorLabels\">\n * <strong>{{ message }}</strong>\n * @if (errorLabels.length > 1) {\n * <ul>\n * @for (label of errorLabels; track label) {\n * <li>{{ label }}</li>\n * }\n * </ul>\n * }\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-error.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepRejection, CngxStepBadge, CngxStep\n */\n@Directive({\n selector: 'ng-template[cngxStepError]',\n exportAs: 'cngxStepError',\n standalone: true,\n})\nexport class CngxStepError {\n readonly templateRef = inject<TemplateRef<CngxStepErrorContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode, CngxStepStatus } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxStepGroupHeader` template. Drives the\n * group-row landmark for `kind === 'group'` nodes. The `role=\"group\"`\n * + `aria-roledescription` shell stays library-owned.\n *\n * `group` carries a `CngxStepNode` with the runtime guarantee\n * `kind === 'group'` (the slot only fires for group nodes).\n * `expanded` is reserved for future collapsible groups - passed `true`\n * today; declaring it now avoids a breaking change later.\n */\nexport interface CngxStepGroupHeaderContext {\n /** The group node carrying id / label / state / children signals. */\n readonly group: CngxStepNode;\n /** Reserved - `true` while the group's children are visible. */\n readonly expanded: boolean;\n /** Aggregated group status (rolls up children - drives heading variant). */\n readonly status: CngxStepStatus;\n}\n\n/**\n * Slot directive for the group-header template on `<cngx-stepper>`.\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.groupHeader` before falling back to\n * the built-in `<span class=\"cngx-stepper__group-label\">`.\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepGroupHeader let-group=\"group\" let-status=\"status\">\n * <h4 [class.is-error]=\"status === 'error'\">{{ group.label() }}</h4>\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-group-header.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepGroup, CngxStepIndicator, CngxStepLabel\n * <example-url>/#/ui/stepper/stepper-slot-overrides/custom-group-header-via-code-cngxstepgroupheader-code</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepGroupHeader]',\n exportAs: 'cngxStepGroupHeader',\n standalone: true,\n})\nexport class CngxStepGroupHeader {\n readonly templateRef = inject<TemplateRef<CngxStepGroupHeaderContext>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\n/**\n * Slot directive for the empty-state placeholder on `<cngx-stepper>`.\n * Rendered when `flatSteps()` is empty - async-loading or\n * server-driven step lists get a \"no steps yet\" landmark rather than\n * a collapsed strip.\n *\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.empty` before falling back to no\n * markup (Honest-Absence default).\n *\n * ```html\n * <cngx-stepper>\n * <ng-template cngxStepperEmpty>\n * <cngx-empty-state heading=\"No steps configured yet\" />\n * </ng-template>\n * </cngx-stepper>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/stepper-empty.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepIndicator, CngxStepGroupHeader\n * <example-url>/#/ui/stepper/stepper-slot-overrides/empty-state-placeholder-via-code-cngxstepperempty-code</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxStepperEmpty]',\n exportAs: 'cngxStepperEmpty',\n standalone: true,\n})\nexport class CngxStepperEmpty {\n readonly templateRef = inject<TemplateRef<void>>(TemplateRef);\n}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\nimport type { CngxStepNode } from '../stepper-host.token';\n\n/**\n * Context passed to the `*cngxDotStepperDot` template. Drives the dot\n * body inside `<cngx-dot-stepper>` and inside the dots mobile-collapse\n * branch of `<cngx-stepper>`. The dot shell - role, `aria-current`,\n * `aria-label`, class modifiers - stays library-owned; only the dot body content becomes\n * overrideable so consumers can swap the default empty body for an\n * icon, glyph, or branded indicator.\n *\n * Smaller than {@link CngxStepIndicatorContext} on purpose - the dot\n * stepper does not surface step status/busy state visually, so the\n * context strips to the four fields a consumer actually needs.\n */\nexport interface CngxDotStepperDotContext {\n /** Convenience alias for `index` - usable as `let-index` shorthand. */\n readonly $implicit: number;\n /** 0-based position of this dot in the step-only projection. */\n readonly index: number;\n /** The step node carrying id / label / state signals. */\n readonly node: CngxStepNode;\n /** `true` when this dot represents the current active step. */\n readonly active: boolean;\n /** `true` when this dot represents a completed (already-traversed) step. */\n readonly completed: boolean;\n}\n\n/**\n * Slot directive for the dot-body template on `<cngx-dot-stepper>` and on\n * `<cngx-stepper>` (dots mobile-collapse branch, `mobileCollapse: 'dots'`).\n * Discovered via `contentChild`; cascades through\n * `CNGX_STEPPER_CONFIG.templates.dotStepperDot` before falling back to\n * the built-in empty body (the span itself paints the dot fill via CSS).\n *\n * ```html\n * <cngx-dot-stepper [(activeStepIndex)]=\"active\" aria-label=\"Carousel\">\n * <ng-template cngxDotStepperDot let-index let-active=\"active\" let-completed=\"completed\">\n * @if (active) {\n * <svg viewBox=\"0 0 10 10\" aria-hidden=\"true\"><circle cx=\"5\" cy=\"5\" r=\"3\" fill=\"currentColor\" /></svg>\n * } @else if (completed) {\n * <svg viewBox=\"0 0 10 10\" aria-hidden=\"true\"><path d=\"M2 5l2 2 4-4\" stroke=\"currentColor\" fill=\"none\" /></svg>\n * }\n * </ng-template>\n * <div cngxStep label=\"Slide 1\"></div>\n * <div cngxStep label=\"Slide 2\"></div>\n * </cngx-dot-stepper>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/dot-stepper-dot.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepIndicator, CngxStepBadge, CngxStepBusySpinner, CngxStepRejection\n * <example-url>/#/ui/stepper/dot-stepper/icon-dots-via-code-cngxdotstepperdot-code</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxDotStepperDot]',\n exportAs: 'cngxDotStepperDot',\n standalone: true,\n})\nexport class CngxDotStepperDot {\n readonly templateRef = inject<TemplateRef<CngxDotStepperDotContext>>(TemplateRef);\n}\n","import { computed, type Signal, type TemplateRef } from '@angular/core';\n\nimport type { CngxStepperConfig } from '../stepper-config';\nimport type {\n CngxStepBadge,\n CngxStepBadgeContext,\n} from './step-badge.directive';\nimport type {\n CngxStepBusySpinner,\n CngxStepBusySpinnerContext,\n} from './step-busy-spinner.directive';\nimport type {\n CngxStepGroupHeader,\n CngxStepGroupHeaderContext,\n} from './step-group-header.directive';\nimport type {\n CngxStepIndicator,\n CngxStepIndicatorContext,\n} from './step-indicator.directive';\nimport type {\n CngxStepError,\n CngxStepErrorContext,\n} from './step-error.directive';\nimport type {\n CngxStepRejection,\n CngxStepRejectionContext,\n} from './step-rejection.directive';\nimport type { CngxStepperEmpty } from './stepper-empty.directive';\nimport type {\n CngxDotStepperDot,\n CngxDotStepperDotContext,\n} from './dot-stepper-dot.directive';\n\n/**\n * Inputs to {@link createStepperTemplateBindings}. The organism owns\n * the `contentChild()` queries (NG8110 - must run in component\n * injection context) and the resolved {@link CngxStepperConfig}; this\n * factory absorbs the 3-stage cascade per slot key.\n */\nexport interface CngxStepperTemplateBindingsOptions {\n readonly indicatorSlot: Signal<CngxStepIndicator | undefined>;\n readonly badgeSlot: Signal<CngxStepBadge | undefined>;\n readonly busySpinnerSlot: Signal<CngxStepBusySpinner | undefined>;\n readonly rejectionSlot: Signal<CngxStepRejection | undefined>;\n /** Optional - the error slot is desktop-label-area only; absent on variants that have no label region. */\n readonly errorSlot?: Signal<CngxStepError | undefined>;\n readonly groupHeaderSlot: Signal<CngxStepGroupHeader | undefined>;\n readonly emptySlot: Signal<CngxStepperEmpty | undefined>;\n /** Optional - only hosts with a dots branch query `*cngxDotStepperDot`; without it the config template still applies. */\n readonly dotSlot?: Signal<CngxDotStepperDot | undefined>;\n readonly config: CngxStepperConfig;\n}\n\n/**\n * Output of {@link createStepperTemplateBindings}. One resolved\n * `Signal<TemplateRef | null>` per slot - `null` falls through to the\n * organism's built-in default markup.\n */\nexport interface CngxStepperTemplateBindings {\n readonly indicator: Signal<TemplateRef<CngxStepIndicatorContext> | null>;\n readonly badge: Signal<TemplateRef<CngxStepBadgeContext> | null>;\n readonly busySpinner: Signal<TemplateRef<CngxStepBusySpinnerContext> | null>;\n readonly rejection: Signal<TemplateRef<CngxStepRejectionContext> | null>;\n readonly stepError: Signal<TemplateRef<CngxStepErrorContext> | null>;\n readonly groupHeader: Signal<TemplateRef<CngxStepGroupHeaderContext> | null>;\n readonly empty: Signal<TemplateRef<void> | null>;\n readonly dot: Signal<TemplateRef<CngxDotStepperDotContext> | null>;\n}\n\n/**\n * Wires the 3-stage template cascade for the `<cngx-stepper>` skin\n * slots: per-instance directive > `CNGX_STEPPER_CONFIG.templates.<key>`\n * > `null` (built-in default).\n *\n * Pure - no DI, no side effects. Safe to call from a field-init\n * block. Sibling of `createTabOverflowTemplateBindings` and the\n * family-wide `createTemplateRegistry`.\n *\n * Tabs has no parallel slot surface yet - see\n * `stepper-accepted-debt §3` for the planned Phase-4 closure.\n */\nexport function createStepperTemplateBindings(\n opts: CngxStepperTemplateBindingsOptions,\n): CngxStepperTemplateBindings {\n return {\n indicator: computed<TemplateRef<CngxStepIndicatorContext> | null>(\n () =>\n opts.indicatorSlot()?.templateRef ??\n opts.config.templates?.indicator ??\n null,\n ),\n badge: computed<TemplateRef<CngxStepBadgeContext> | null>(\n () =>\n opts.badgeSlot()?.templateRef ??\n opts.config.templates?.badge ??\n null,\n ),\n busySpinner: computed<TemplateRef<CngxStepBusySpinnerContext> | null>(\n () =>\n opts.busySpinnerSlot()?.templateRef ??\n opts.config.templates?.busySpinner ??\n null,\n ),\n rejection: computed<TemplateRef<CngxStepRejectionContext> | null>(\n () =>\n opts.rejectionSlot()?.templateRef ??\n opts.config.templates?.rejection ??\n null,\n ),\n stepError: computed<TemplateRef<CngxStepErrorContext> | null>(\n () =>\n opts.errorSlot?.()?.templateRef ??\n opts.config.templates?.stepError ??\n null,\n ),\n groupHeader: computed<TemplateRef<CngxStepGroupHeaderContext> | null>(\n () =>\n opts.groupHeaderSlot()?.templateRef ??\n opts.config.templates?.groupHeader ??\n null,\n ),\n empty: computed<TemplateRef<void> | null>(\n () =>\n opts.emptySlot()?.templateRef ??\n opts.config.templates?.empty ??\n null,\n ),\n dot: computed<TemplateRef<CngxDotStepperDotContext> | null>(\n () =>\n opts.dotSlot?.()?.templateRef ??\n opts.config.templates?.dotStepperDot ??\n null,\n ),\n };\n}\n","import {\n afterNextRender,\n computed,\n DestroyRef,\n Directive,\n effect,\n inject,\n input,\n output,\n untracked,\n type AfterContentInit,\n} from '@angular/core';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, NavigationEnd, Router } from '@angular/router';\nimport { cngxDevWarn } from '@cngx/utils';\nimport { filter } from 'rxjs/operators';\n\nimport { injectStepperConfig } from './stepper-config';\nimport { injectStepperHost } from './stepper-host.token';\n\n/**\n * URL deep-linking for the stepper. Bidirectional sync between\n * `activeStepId` and a URL fragment / query-param. Opt-in via\n * `[cngxStepperRouterSync]` on the presenter element.\n *\n * - `mode = 'fragment'` (default) → `#step=customer`\n * - `mode = 'queryParam'` with `paramName = 'step'` → `?step=customer`\n *\n * `Router` is optional - without `@angular/router` the directive\n * dev-warns once and becomes a no-op.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/router-sync.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepperPresenter, CNGX_STEPPER_CONFIG\n * <example-url>/#/ui/stepper/stepper-router-sync/deep-linking-with-fragment-queryparam-modes</example-url>\n */\n@Directive({\n selector: '[cngxStepperRouterSync]',\n exportAs: 'cngxStepperRouterSync',\n standalone: true,\n})\nexport class CngxStepperRouterSync implements AfterContentInit {\n // Default undefined so the cascade resolves through CNGX_STEPPER_CONFIG.\n // The resolved mode / param are read on every URL write and read, not\n // only at init; changing either after init applies to the next one and\n // leaves the previous key behind in the URL.\n /**\n * Binding `[mode]`: where the active step id is kept in the URL, `'fragment'` (`#step=customer`) or\n * `'queryParam'` (`?step=customer`). Unset, it resolves through `routerSyncMode` of the stepper config\n * and then `'fragment'`. A change after init applies to the next URL write or read and leaves the\n * previous key in the URL.\n */\n readonly modeInput = input<'fragment' | 'queryParam' | undefined>(undefined, { alias: 'mode' });\n\n /**\n * Binding `[paramName]`: name of the fragment or query key that carries the step id. Unset, it resolves\n * through `routerSyncParam` of the stepper config and then `'step'`. A change after init applies to the next URL write or read and leaves the\n * previous key in the URL.\n */\n readonly paramNameInput = input<string | undefined>(undefined, {\n alias: 'paramName',\n });\n\n private readonly config = injectStepperConfig();\n\n readonly mode = computed<'fragment' | 'queryParam'>(\n () => this.modeInput() ?? this.config.routerSyncMode ?? 'fragment',\n );\n readonly paramName = computed<string>(\n () => this.paramNameInput() ?? this.config.routerSyncParam ?? 'step',\n );\n\n /** Emits when a `router.navigate` rejection is observed. */\n readonly syncError = output<unknown>();\n\n private readonly host = injectStepperHost('cngxStepperRouterSync', { host: true });\n private readonly router = inject(Router, { optional: true });\n\n /**\n * Latched once the URL seed has reached a registered step, so the\n * `afterNextRender` fallback cannot run it twice.\n *\n * The latch is load-bearing, not decorative: the seed goes through\n * `selectById` → `select()`, which opens a commit window. Under a\n * pessimistic commit `activeStepIndex` still holds the *previous* index\n * while the action is in flight, so the presenter's `target === previous`\n * bail does not catch the repeat - an unlatched fallback would fire the\n * consumer's commit-action a second time and supersede the first.\n */\n private seeded = false;\n\n constructor() {\n // Router is providedIn: 'root' and resolves without provideRouter(...);\n // ActivatedRoute does not, so it is the \"router is set up\" signal.\n const route = inject(ActivatedRoute, { optional: true });\n if (!this.router || !route) {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n afterNextRender(() => {\n cngxDevWarn(\n 'CNGX1031',\n '[cngxStepperRouterSync] no Router / ActivatedRoute available - the URL sync is a no-op. ' +\n 'Provide @angular/router via provideRouter(...) to enable deep-linking.',\n );\n });\n }\n return;\n }\n const router = this.router;\n\n // Fallback seed for steps that register after content-init (a dynamic\n // @for over an async step list). Idempotent against the content-init\n // seed via the `seeded` latch.\n afterNextRender(() => this.seedFromUrl(router));\n\n effect(() => {\n const id = this.host.activeStepId();\n if (!id) {\n return;\n }\n untracked(() => this.writeUrl(router, id));\n });\n\n const navEnd = toSignal(\n router.events.pipe(\n filter((e): e is NavigationEnd => e instanceof NavigationEnd),\n takeUntilDestroyed(inject(DestroyRef)),\n ),\n { initialValue: null },\n );\n effect(() => {\n const e = navEnd();\n if (!e) {\n return;\n }\n untracked(() => {\n const next = this.readUrlValue(router);\n if (next && next !== this.host.activeStepId()) {\n this.host.selectById(next);\n }\n });\n });\n }\n\n /**\n * Seed from the URL before the stepper renders its panels. `CngxStep`\n * registers in `ngOnInit` (so a bound `[id]` reaches the registry), which\n * runs before the host's `ngAfterContentInit` - the registry is populated\n * by the time this runs, and the host view has not rendered yet, which is\n * what keeps a `panelMode=\"lazy\"` default step from counting its first\n * render as a first activation on a deep link that named another step.\n *\n * Own router guard: the constructor's early return does not stop\n * lifecycle hooks from running.\n */\n ngAfterContentInit(): void {\n if (!this.router) {\n return;\n }\n this.seedFromUrl(this.router);\n }\n\n private seedFromUrl(router: Router): void {\n if (this.seeded) {\n return;\n }\n const initial = this.readUrlValue(router);\n if (!initial) {\n return;\n }\n // Only latch once the target is actually registered. A seed that found\n // no matching step leaves the fallback armed for steps that register\n // after content-init.\n if (!this.host.stepsOnly().some((n) => n.id === initial)) {\n return;\n }\n this.seeded = true;\n // No explicit URL correction on a refused (linear-blocked / disabled)\n // seed: the activeStepId write effect's first run flushes AFTER this\n // content-init hook and unconditionally reflects the ACTUAL active id\n // into the URL, so a refused deep link is rewritten on the same tick.\n // The refused-seed spec pins that guarantee.\n untracked(() => this.host.selectById(initial));\n }\n\n /**\n * Reflect `id` into the URL. Fragment mode re-serializes the existing\n * fragment params so foreign state (`#foo=1&step=x`) survives the\n * write; values are URI-encoded symmetric to {@link parseFragment}.\n */\n private writeUrl(router: Router, id: string): void {\n const navigation =\n this.mode() === 'fragment'\n ? router.navigate([], {\n fragment: this.serializeFragment(router, id),\n queryParamsHandling: 'merge',\n replaceUrl: true,\n })\n : router.navigate([], {\n queryParams: { [this.paramName()]: id },\n queryParamsHandling: 'merge',\n replaceUrl: true,\n });\n navigation.catch?.((err: unknown) => this.syncError.emit(err));\n }\n\n private serializeFragment(router: Router, id: string): string {\n const param = this.paramName();\n const current = router.routerState.snapshot.root.fragment ?? '';\n const segments = current\n .split('&')\n .filter((seg) => seg !== '' && seg.split('=')[0] !== param);\n segments.push(`${param}=${encodeURIComponent(id)}`);\n return segments.join('&');\n }\n\n private readUrlValue(router: Router): string | null {\n if (this.mode() === 'fragment') {\n return this.parseFragment(router.routerState.snapshot.root.fragment ?? '');\n }\n return router.routerState.snapshot.root.queryParamMap.get(this.paramName()) ?? null;\n }\n\n private parseFragment(fragment: string): string | null {\n const param = this.paramName();\n const segments = fragment.split('&');\n for (const seg of segments) {\n const [key, val] = seg.split('=');\n if (key === param && val) {\n return decodeURIComponent(val);\n }\n }\n return null;\n }\n}\n","import type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type { CngxStepNode } from './stepper-host.token';\n\n/**\n * Resolve the status-pill label for a step node against the resolved\n * i18n bundle. Used by skins that surface a per-step status pill\n * (e.g. `stripe-status-rich`). Pure factory - no injection context,\n * no signal graph involvement.\n *\n * Resolution order:\n * 1. `error` data-state -> `statusLabels.errored`\n * 2. a failed commit rejection -> `statusLabels.errored`\n * 3. a refused commit rejection -> `statusLabels.refused`\n * 4. `success` data-state -> `statusLabels.done`\n * 5. `aria-current=\"step\"` -> `statusLabels.inProgress`\n * 6. otherwise -> `statusLabels.upNext`\n *\n * The rejection outranks `done` and the position words because it is the\n * most recent event on the step: a rejected step must never read \"Up next\".\n *\n * Group nodes (non-step) return an empty string.\n */\nexport function resolveStepperStatusLabel(\n node: CngxStepNode,\n i18n: CngxStepperI18n,\n isActive: boolean,\n rejection: 'refused' | 'failed' | null = null,\n): string {\n if (node.kind !== 'step') {\n return '';\n }\n const labels = i18n.statusLabels;\n const state = node.state();\n if (state === 'error' || rejection === 'failed') {\n return labels.errored;\n }\n if (rejection === 'refused') {\n return labels.refused;\n }\n if (state === 'success') {\n return labels.done;\n }\n return isActive ? labels.inProgress : labels.upNext;\n}\n","import { computed, type Signal } from '@angular/core';\nimport { injectContainerSize } from '@cngx/common/layout';\n\nimport type { CngxStepperMobileCollapse } from './stepper-config';\n\n/**\n * Reads the stepper's collapse flag off its own container.\n *\n * The threshold is a `@container` rule in `stepper-base.css` writing\n * `--cngx-stepper-collapse` onto `.cngx-stepper::after`. It lands on the\n * pseudo-element because a container query cannot style its own container,\n * and the query container for a pseudo-element is selected from its\n * originating element's inclusive ancestors. Nothing here parses a width, so\n * a consumer re-aims the collapse with a plain CSS rule.\n *\n * Requires an injection context - it observes through `injectContainerSize`,\n * so the observer is scoped to the caller's `DestroyRef`. A field initialiser\n * on the stepper component is one; a bare call from a lifecycle hook is not.\n *\n * @param host The `<cngx-stepper>` host element, which is its own container.\n * @relatedTo createStepperDisplayMode, injectContainerSize\n */\nexport function injectStepperCollapse(host: Element): Signal<boolean> {\n const raw = injectContainerSize(host).property('--cngx-stepper-collapse', host, '::after');\n return computed(() => raw() === '1');\n}\n\n/**\n * Resolves the active stepper display mode by combining the collapse *signal*\n * - whether the stepper's own container is narrow - with the configured\n * `mobileCollapse` policy. `'classic'` keeps the full strip; `'text'` /\n * `'dots'` swap to the matching compact variant, `'off'` stays classic at any\n * width.\n *\n * The factory takes no DOM API and holds no threshold: *where* the collapse\n * happens is a `@container` rule in the stepper stylesheet, *what* it collapses\n * into is this policy. See `core-concepts/responsive-by-default.md`.\n *\n * @param collapsed `true` while the container sits below the collapse rung.\n * @param mobileCollapse The configured collapse policy, read lazily.\n */\nexport function createStepperDisplayMode(\n collapsed: Signal<boolean>,\n mobileCollapse: () => CngxStepperMobileCollapse | undefined,\n): Signal<'classic' | 'text' | 'dots'> {\n return computed(() => {\n if (!collapsed()) {\n return 'classic';\n }\n const mode = mobileCollapse() ?? 'text';\n return mode === 'off' ? 'classic' : mode;\n });\n}\n","import { computed, type Signal } from '@angular/core';\n\nimport type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type { CngxStepperGroupSummary } from './stepper-config';\nimport type { CngxStepNode } from './stepper-host.token';\n\n/**\n * Collapsed-group summary view consumed by `<cngx-stepper>`. Resolves\n * the `groupCollapseSummary` mode and the per-group `progress` / `count`\n * text, the `status`-dot gate, and the SR phrase. Pure derivation over\n * the group's subtree step states; rendered only on collapsed groups.\n */\nexport interface CngxStepperGroupSummaryView {\n /** Resolved summary mode (config cascade, default `'progress'`). */\n readonly mode: Signal<CngxStepperGroupSummary>;\n /** Visible badge text for `progress`/`count`, else `null`. */\n text(node: CngxStepNode): string | null;\n /** `true` when a status dot should render (mode `status`, group collapsed). */\n showStatus(node: CngxStepNode): boolean;\n /** Screen-reader phrase for `progress`/`count`, else `null`. */\n srText(node: CngxStepNode): string | null;\n}\n\n/**\n * Options for {@link createStepperGroupSummary}.\n *\n * @internal\n */\nexport interface CngxStepperGroupSummaryOptions {\n /** Raw `groupCollapseSummary` config value (may be undefined). */\n readonly summaryMode: () => CngxStepperGroupSummary | undefined;\n /** Whether a given group node is currently collapsed. */\n readonly isCollapsed: (node: CngxStepNode) => boolean;\n /** Resolved i18n bundle Signal for the SR phrases. */\n readonly i18n: Signal<\n Pick<\n CngxStepperI18n,\n | 'groupSummaryCount'\n | 'groupSummaryProgress'\n | 'groupSummaryCountShort'\n | 'groupSummaryProgressShort'\n >\n >;\n}\n\n/** Terminal-step totals for a group's subtree; reads each step `state()`. */\nfunction subtreeStats(node: CngxStepNode): { total: number; completed: number } {\n let total = 0;\n let completed = 0;\n const visit = (n: CngxStepNode): void => {\n if (n.kind === 'step') {\n total++;\n if (n.state() === 'success') {\n completed++;\n }\n }\n n.children.forEach(visit);\n };\n node.children.forEach(visit);\n return { total, completed };\n}\n\n/**\n * Builds the collapsed-group summary view. Level-2 helper so the\n * organism stays a thin renderer. `status` mode defers its SR phrasing\n * to the group's existing status-phrase span, so {@link srText} returns\n * `null` there. SR phrases resolve through the `CngxStepperI18n` bundle\n * when passed; English defaults otherwise.\n */\nexport function createStepperGroupSummary(\n options: CngxStepperGroupSummaryOptions,\n): CngxStepperGroupSummaryView {\n const mode = computed<CngxStepperGroupSummary>(() => options.summaryMode() ?? 'progress');\n\n const text = (node: CngxStepNode): string | null => {\n const current = mode();\n if (current === 'off' || current === 'status' || !options.isCollapsed(node)) {\n return null;\n }\n const { total, completed } = subtreeStats(node);\n const i18n = options.i18n();\n return current === 'count'\n ? i18n.groupSummaryCountShort(total)\n : i18n.groupSummaryProgressShort(completed, total);\n };\n\n const showStatus = (node: CngxStepNode): boolean =>\n mode() === 'status' && options.isCollapsed(node);\n\n const srText = (node: CngxStepNode): string | null => {\n const current = mode();\n if (current === 'off' || current === 'status' || !options.isCollapsed(node)) {\n return null;\n }\n const { total, completed } = subtreeStats(node);\n if (current === 'count') {\n return options.i18n().groupSummaryCount(total);\n }\n return options.i18n().groupSummaryProgress(completed, total);\n };\n\n return { mode, text, showStatus, srText };\n}\n","import type { CngxStepNode, CngxStepperHost } from './stepper-host.token';\n\n/**\n * Collapsed-group pointer-navigation view consumed by `<cngx-stepper>`\n * under `groupCollapse: 'expand-active'`. A folded group header becomes a\n * click shortcut into its branch: activating it selects the group's first\n * navigable step, which then becomes the active group and expands as a\n * consequence (no in-place disclosure). Keyboard users reach the same\n * steps via the arrow-key contract, which already steps into a collapsed\n * group, so this is a supplementary pointer affordance.\n */\nexport interface CngxStepperGroupNavigationView {\n /**\n * `true` when a collapsed group header offers a click shortcut: header\n * navigation is on, the group is folded, and at least one descendant\n * step is navigable right now. The expanded (active) group header is\n * never navigable - its steps are already on screen and clickable.\n */\n isNavigable(node: CngxStepNode): boolean;\n /**\n * Selects the group's first navigable step. No-op for an expanded\n * header, a navigation-off header, or a group with no reachable step.\n */\n select(node: CngxStepNode): void;\n /**\n * `true` when the group owns the active step (`activeGroupId`). Drives\n * the active-branch chip treatment on the header, independent of\n * `groupCollapse`, so the branch in focus reads distinctly even when\n * every group stays expanded.\n */\n isActive(node: CngxStepNode): boolean;\n}\n\n/**\n * Options for {@link createStepperGroupNavigation}.\n *\n * @internal\n */\nexport interface CngxStepperGroupNavigationOptions {\n /**\n * Host slice owning the flat projection (`flatSteps`, DFS order with\n * live `flatIndex`), the reachability predicate (`canNavigateTo`), the\n * commit-in-flight gate (`busy`), and the selection method (`select`).\n */\n readonly presenter: Pick<\n CngxStepperHost,\n 'flatSteps' | 'canNavigateTo' | 'busy' | 'select' | 'activeGroupId'\n >;\n /** Whether a given group node is currently folded. */\n readonly isCollapsed: (node: CngxStepNode) => boolean;\n /** `false` when `headerNavigation: 'none'` keeps every header inert. */\n readonly navigationEnabled: () => boolean;\n}\n\n/**\n * Builds the collapsed-group pointer-navigation view. Level-2 helper so\n * the organism stays a thin renderer.\n *\n * Indices resolve against `flatSteps` (DFS order, live `flatIndex`) rather\n * than `group.children` - the flattener spreads group nodes but leaves\n * their `children` as the tree projection where every step still carries\n * the seeded `-1`. Each candidate is gated by `canNavigateTo` + `busy`\n * (mirroring the step-header reachability), so a linear-blocked leading\n * step is skipped to the first reachable one.\n */\nexport function createStepperGroupNavigation(\n options: CngxStepperGroupNavigationOptions,\n): CngxStepperGroupNavigationView {\n const { presenter } = options;\n const firstNavigableStepIndex = (group: CngxStepNode): number => {\n const flat = presenter.flatSteps();\n const byId = new Map(flat.map((node) => [node.id, node] as const));\n const isInGroup = (node: CngxStepNode): boolean => {\n let cur: CngxStepNode | undefined = node;\n while (cur && cur.parentId !== null) {\n if (cur.parentId === group.id) {\n return true;\n }\n cur = byId.get(cur.parentId);\n }\n return false;\n };\n for (const node of flat) {\n if (\n node.kind === 'step' &&\n isInGroup(node) &&\n presenter.canNavigateTo(node.flatIndex) &&\n !presenter.busy()\n ) {\n return node.flatIndex;\n }\n }\n return -1;\n };\n\n const isNavigable = (node: CngxStepNode): boolean =>\n options.navigationEnabled() &&\n options.isCollapsed(node) &&\n firstNavigableStepIndex(node) !== -1;\n\n const select = (node: CngxStepNode): void => {\n if (!isNavigable(node)) {\n return;\n }\n presenter.select(firstNavigableStepIndex(node));\n };\n\n const isActive = (node: CngxStepNode): boolean =>\n node.kind === 'group' && presenter.activeGroupId() === node.id;\n\n return { isNavigable, select, isActive };\n}\n","import { computed, type Signal } from '@angular/core';\n\nimport type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type {\n CngxStepperConfig,\n CngxStepperMobileIndicatorPosition,\n CngxStepperSkin,\n} from './stepper-config';\n\n/**\n * Input bundle for {@link createStepperHostAttrs}: the three per-instance\n * inputs (each `Signal<T | undefined>`) and the resolved config (read\n * synchronously at construction). Each cascade collapses through\n * `input ?? config ?? library-default`.\n *\n * @internal\n */\nexport interface CngxStepperHostAttrsInputs {\n readonly skin: Signal<CngxStepperSkin | undefined>;\n readonly connectors: Signal<boolean | undefined>;\n readonly mobileIndicatorPosition: Signal<CngxStepperMobileIndicatorPosition | undefined>;\n readonly config: CngxStepperConfig;\n}\n\n/**\n * Three host-attribute signals for `<cngx-stepper>`. Each is read by a\n * `[attr.data-*]` host binding on the organism.\n *\n * @internal\n */\nexport interface CngxStepperHostAttrs {\n readonly resolvedSkin: Signal<CngxStepperSkin>;\n readonly resolvedConnectors: Signal<boolean>;\n readonly resolvedMobileIndicatorPosition: Signal<CngxStepperMobileIndicatorPosition>;\n}\n\n/**\n * Level-2 helper resolving the three host-attribute cascades for\n * `<cngx-stepper>` (skin / connectors / mobileIndicatorPosition). Keeps\n * the organism class under the LOC guard while making the cascade\n * pattern reusable for any future host-attr the strip surfaces.\n *\n * Each computed honors Pillar 1 (Ableitung statt Verwaltung): per-instance\n * input wins over root config wins over library default. No manual sync.\n *\n * @internal\n */\nexport function createStepperHostAttrs(\n inputs: CngxStepperHostAttrsInputs,\n): CngxStepperHostAttrs {\n return {\n resolvedSkin: computed<CngxStepperSkin>(\n () => inputs.skin() ?? inputs.config.skin ?? 'classic',\n ),\n resolvedConnectors: computed<boolean>(\n () => inputs.connectors() ?? inputs.config.connectors ?? false,\n ),\n resolvedMobileIndicatorPosition: computed<CngxStepperMobileIndicatorPosition>(\n () => inputs.mobileIndicatorPosition() ?? inputs.config.mobileIndicatorPosition ?? 'top',\n ),\n };\n}\n\n/**\n * Input bundle for {@link createStepperAccname}: the two per-instance\n * accname inputs plus the i18n bundle Signal.\n *\n * @internal\n */\nexport interface CngxStepperAccnameInputs {\n readonly ariaLabel: Signal<string | undefined>;\n readonly ariaLabelledBy: Signal<string | undefined>;\n readonly i18n: Signal<CngxStepperI18n>;\n}\n\n/**\n * Shared `aria-label` cascade for every stepper organism host\n * (`<cngx-stepper>` and the compact variants): a bound\n * `aria-labelledby` trumps and nulls the label out; otherwise the\n * per-instance input wins over `i18n.stepperLabel`. One source so the variants cannot drift from\n * the parent's naming behaviour.\n *\n * @internal\n */\nexport function createStepperAccname(inputs: CngxStepperAccnameInputs): Signal<string | null> {\n return computed<string | null>(() => {\n if (inputs.ariaLabelledBy()) {\n return null; // labelledby trumps label\n }\n return inputs.ariaLabel() ?? inputs.i18n().stepperLabel;\n });\n}\n","import { afterNextRender, type Injector, type Signal } from '@angular/core';\nimport { resolveBoundaryStep, resolveInlineStep, type CngxDirection } from '@cngx/core';\n\nimport type { CngxStepperHost } from './stepper-host.token';\n\n/**\n * Options for {@link createStepperStripKeyboardNav}.\n *\n * @internal\n */\nexport interface CngxStepperStripKeyboardNavOptions {\n /** Host contract that owns the active-step state and selection methods. */\n readonly presenter: CngxStepperHost;\n /** Host element used to locate the active step button after the move. */\n readonly hostElement: HTMLElement;\n /**\n * Document writing direction. Flips the horizontal-strip inline arrows\n * under `rtl` (APG); the vertical strip and Home/End stay invariant.\n */\n readonly direction: Signal<CngxDirection>;\n /**\n * Maps a CngxStepNode id to its DOM button id (e.g. `${id}-header`).\n * The strip selects by stable DOM id rather than waiting for the\n * `aria-current` attribute to flip - the id binding does not depend\n * on the active-step signal, so the lookup is correct the same tick\n * the presenter's `activeStepId` updates.\n */\n readonly stepButtonIdFor: (stepId: string) => string;\n /**\n * Optional class name guard - the handler only runs when\n * `event.target.classList.contains(stepClassName)`. Defaults to the\n * canonical strip button class so panel-content key presses pass\n * through untouched.\n */\n readonly stepClassName?: string;\n /**\n * Optional gate - when supplied and returning `false`, the handler is\n * a complete no-op. Used to switch arrow-key navigation off in the\n * `headerNavigation: 'none'` mode, where the step headers are inert\n * labels rather than focusable buttons. Omitted defaults to enabled.\n */\n readonly enabled?: () => boolean;\n /**\n * Injector used to defer the post-move focus to `afterNextRender`.\n * Required when the strip can re-render its node set on navigation\n * (focus-driven group collapse: crossing a group boundary removes the\n * old button and adds the target's), so the focus lands after the new\n * DOM exists. Omitted, focus falls back to a `queueMicrotask` defer -\n * correct for a static strip where every button is always present.\n */\n readonly injector?: Injector;\n}\n\n/**\n * Builds the WAI-ARIA APG arrow-key handler for a stepper strip. The\n * composed `CngxRovingTabindex` cannot reach view-template step buttons\n * (its `contentChildren` query only sees projected content), so the\n * organism wires this factory's return value to its host `(keydown)`\n * binding to honour the documented keyboard contract.\n *\n * Horizontal orientation: ArrowLeft / ArrowRight navigate. Vertical:\n * ArrowUp / ArrowDown. Home / End jump to the first / last flat step\n * regardless of orientation. The presenter's `select*` methods enforce\n * linear-mode gating so callers do not duplicate that check here.\n *\n * @internal\n */\nexport function createStepperStripKeyboardNav(\n options: CngxStepperStripKeyboardNavOptions,\n): (event: KeyboardEvent) => void {\n const stepClass = options.stepClassName ?? 'cngx-stepper__step';\n const scheduleFocus = (focus: () => void): void => {\n // After the next render when an injector is supplied (the strip may\n // re-render its node set on a group-boundary crossing); a microtask\n // otherwise. Either way the focus runs after the active-step signal\n // has settled, so the target button exists.\n if (options.injector) {\n afterNextRender(focus, { injector: options.injector });\n } else {\n queueMicrotask(focus);\n }\n };\n const focusActive = (): void => {\n // Focus the INTENDED target only while the commit is actually in\n // flight (pessimistic mode holds activeStepId at the origin until\n // the action settles). The controller retains intendedValue after a\n // rejection for the commit-error surface, so an unguarded read\n // would teleport focus to the refused step on any later no-op key.\n // Keyed on the commit, not busy(): a finish run must not move focus\n // to an intendedValue retained from an earlier refused commit.\n const intendedIdx =\n options.presenter.commitState.status() === 'pending'\n ? options.presenter.intendedStepIndex()\n : undefined;\n const intendedId =\n intendedIdx !== undefined\n ? (options.presenter.stepsOnly()[intendedIdx]?.id ?? null)\n : null;\n const targetId = intendedId ?? options.presenter.activeStepId();\n if (!targetId) {\n return;\n }\n const buttonId = options.stepButtonIdFor(targetId);\n scheduleFocus(() => {\n const el = options.hostElement.querySelector(`[id=\"${buttonId}\"]`);\n if (el instanceof HTMLElement) {\n el.focus();\n }\n });\n };\n return (event: KeyboardEvent): void => {\n if (options.enabled && !options.enabled()) {\n return;\n }\n const target = event.target as HTMLElement | null;\n if (!target?.classList.contains(stepClass)) {\n return;\n }\n const isHorizontal = options.presenter.orientation() === 'horizontal';\n // Horizontal: the inline arrows flip under rtl. Vertical: the block\n // arrows (ArrowUp/ArrowDown) never flip.\n const inlineStep = isHorizontal ? resolveInlineStep(event.key, options.direction()) : null;\n const isNext = inlineStep === 1 || (!isHorizontal && event.key === 'ArrowDown');\n const isPrev = inlineStep === -1 || (!isHorizontal && event.key === 'ArrowUp');\n if (isNext) {\n event.preventDefault();\n options.presenter.selectNext();\n focusActive();\n } else if (isPrev) {\n event.preventDefault();\n // A stray back-arrow must not supersede an in-flight commit - the\n // programmatic selectPrevious() cancels deliberately; the gesture\n // path waits.\n if (options.presenter.busy()) {\n return;\n }\n options.presenter.selectPrevious();\n focusActive();\n } else if (event.key === 'Home') {\n event.preventDefault();\n const stepsOnly = options.presenter.stepsOnly();\n const first = resolveBoundaryStep(1, {\n count: stepsOnly.length,\n isDisabledAt: (i) => stepsOnly[i].disabled(),\n });\n if (first !== null) {\n options.presenter.select(first);\n focusActive();\n }\n } else if (event.key === 'End') {\n event.preventDefault();\n const stepsOnly = options.presenter.stepsOnly();\n const last = resolveBoundaryStep(-1, {\n count: stepsOnly.length,\n isDisabledAt: (i) => stepsOnly[i].disabled(),\n });\n if (last !== null) {\n options.presenter.select(last);\n focusActive();\n }\n }\n };\n}\n","import { computed, untracked, type Signal } from '@angular/core';\nimport { arrayEqual } from '@cngx/utils';\n\nimport type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type { CngxStepNode, CngxStepperHost, CngxStepStatus } from './stepper-host.token';\n\n/**\n * Per-step + aggregate state derivations shared by every stepper skin.\n *\n * The classic organism historically derived \"is this step errored / busy /\n * rejected\" inline in {@link createStepperSlotContextBuilders}; the dot,\n * text, and progress-bar variants derived nothing, so a step error (per-step\n * `state`, an error aggregator, or a commit rejection) was structurally\n * invisible in those three. This view is the single source those four skins\n * read from - \"Ableitung statt Verwaltung\" - so the error contract can never\n * drift between them.\n *\n * @internal\n */\nexport interface CngxStepperStateView {\n /** Raw step status. Group nodes still report their own `state()`. */\n readonly statusOf: (node: CngxStepNode) => CngxStepStatus;\n\n /**\n * `true` while a commit is in flight AND targets this step. Mirrors the\n * classic `isStepBusy` predicate.\n */\n readonly isBusy: (node: CngxStepNode) => boolean;\n\n /**\n * `true` when this step is the one a commit just rejected\n * (`flatIndex === lastFailedIndex`), refused or failed alike. The\n * commit-rejection marker your pessimistic / optimistic flows hit.\n */\n readonly isRejected: (node: CngxStepNode) => boolean;\n\n /**\n * `true` when this step carries the rejection marker AND the commit\n * action refused it (`lastOutcome().kind === 'refused'`). A refusal is\n * not an error: it marks the step but never sets `aria-invalid` or\n * counts towards {@link errorCount}.\n */\n readonly isRefused: (node: CngxStepNode) => boolean;\n\n /**\n * Badge-level error: per-step `state === 'error'` OR the bound error\n * aggregator's `shouldShow()`. Deliberately excludes commit rejection -\n * the classic skin renders rejection through its own dedicated slot, so\n * folding it in here would double-render the icon.\n */\n readonly hasErrorBadge: (node: CngxStepNode) => boolean;\n\n /**\n * Why the step carries a commit-rejection marker, for the `data-reason`\n * styling hook: `'refused'` or `'failed'` while {@link isRejected} holds,\n * `null` otherwise. Independent of a validation error on the same step.\n */\n readonly rejectionReason: (node: CngxStepNode) => 'refused' | 'failed' | null;\n\n /**\n * Visual marker predicate - the hook the minimal skins (dot / text /\n * progress-bar) and the mobile dots paint (`data-state=\"error\"`,\n * `--error`). `true` when {@link hasErrorBadge} fires OR the step carries\n * a commit rejection of either kind ({@link isRejected}). Those skins have\n * no separate rejection slot, so every marker shares one visual state.\n */\n readonly hasErrorMarker: (node: CngxStepNode) => boolean;\n\n /**\n * Semantic error predicate - what `aria-invalid`, the errored status word\n * and {@link errorCount} read. `true` when {@link hasErrorBadge} fires OR\n * a commit failed on this step. A refused step is marked\n * ({@link hasErrorMarker}) but not in error.\n */\n readonly hasError: (node: CngxStepNode) => boolean;\n\n /** Count of step-only nodes where {@link hasError} is `true`. */\n readonly errorCount: Signal<number>;\n\n /** Flat index of the first errored step, or `-1` when none. */\n readonly firstErrorIndex: Signal<number>;\n\n /** `true` when `errorCount() > 0`. Drives skin-level `aria-invalid`. */\n readonly hasAnyError: Signal<boolean>;\n\n /** Count of step-only nodes where {@link hasErrorMarker} is `true`. */\n readonly errorMarkerCount: Signal<number>;\n\n /** Flat index of the first marked step, or `-1` when none. */\n readonly firstErrorMarkerIndex: Signal<number>;\n\n /**\n * `true` when `errorMarkerCount() > 0`. Drives skin-level visual hooks\n * (`data-state=\"error\"`); `aria-invalid` stays on {@link hasAnyError}.\n */\n readonly hasAnyErrorMarker: Signal<boolean>;\n\n /**\n * `true` when steps are marked but none is in error: every marker is a\n * refused commit. Drives the refused tone of skin-level hooks (the\n * aggregate error line, the progress bar) that stand for all steps.\n */\n readonly refusalOnly: Signal<boolean>;\n}\n\n/**\n * Build the shared {@link CngxStepperStateView} over a presenter host and its\n * step-only projection. Pure factory - `computed()` only, no injection\n * context required, so any skin can allocate it in a field initializer.\n *\n * @since 0.3.0\n * @relatedTo CngxStepperHost, createStepperSlotContextBuilders\n */\nexport function createStepperStateView(inputs: {\n presenter: CngxStepperHost;\n stepsOnly: Signal<readonly CngxStepNode[]>;\n}): CngxStepperStateView {\n const { presenter, stepsOnly } = inputs;\n\n const statusOf = (node: CngxStepNode): CngxStepStatus => node.state();\n\n const isBusy = (node: CngxStepNode): boolean =>\n node.kind === 'step' &&\n presenter.commitState.status() === 'pending' &&\n presenter.intendedStepIndex() === node.flatIndex;\n\n const isRejected = (node: CngxStepNode): boolean =>\n node.kind === 'step' && node.flatIndex >= 0 && node.flatIndex === presenter.lastFailedIndex();\n\n const hasErrorBadge = (node: CngxStepNode): boolean => {\n if (node.kind !== 'step') {\n return false;\n }\n if (node.state() === 'error') {\n return true;\n }\n return !!node.errorAggregator?.()?.shouldShow?.();\n };\n\n const isRefused = (node: CngxStepNode): boolean =>\n isRejected(node) && presenter.lastOutcome()?.kind === 'refused';\n\n const rejectionReason = (node: CngxStepNode): 'refused' | 'failed' | null => {\n if (!isRejected(node)) {\n return null;\n }\n return isRefused(node) ? 'refused' : 'failed';\n };\n\n const hasErrorMarker = (node: CngxStepNode): boolean => hasErrorBadge(node) || isRejected(node);\n\n const hasError = (node: CngxStepNode): boolean =>\n hasErrorBadge(node) || (isRejected(node) && !isRefused(node));\n\n const erroredSteps = computed<readonly CngxStepNode[]>(\n () => stepsOnly().filter((node) => hasError(node)),\n { equal: arrayEqual },\n );\n\n const errorCount = computed<number>(() => erroredSteps().length);\n\n const firstErrorIndex = computed<number>(() => erroredSteps()[0]?.flatIndex ?? -1);\n\n const hasAnyError = computed<boolean>(() => errorCount() > 0);\n\n const markedSteps = computed<readonly CngxStepNode[]>(\n () => stepsOnly().filter((node) => hasErrorMarker(node)),\n { equal: arrayEqual },\n );\n\n const errorMarkerCount = computed<number>(() => markedSteps().length);\n\n const firstErrorMarkerIndex = computed<number>(() => markedSteps()[0]?.flatIndex ?? -1);\n\n const hasAnyErrorMarker = computed<boolean>(() => errorMarkerCount() > 0);\n\n const refusalOnly = computed<boolean>(() => hasAnyErrorMarker() && !hasAnyError());\n\n return {\n statusOf,\n isBusy,\n isRejected,\n isRefused,\n rejectionReason,\n hasErrorBadge,\n hasErrorMarker,\n hasError,\n errorCount,\n firstErrorIndex,\n hasAnyError,\n errorMarkerCount,\n firstErrorMarkerIndex,\n hasAnyErrorMarker,\n refusalOnly,\n };\n}\n\n/**\n * Aggregate error phrase shared by the minimal skins (text / progress-bar)\n * and the classic mobile-collapse text branch. Walks the marked steps\n * ({@link CngxStepperStateView.hasErrorMarker}). A single marked step names\n * itself with the word of its kind: `\"Payment: Errored\"` (or the custom\n * reason) for an error, `\"Payment: Not allowed\"` for a refused step change;\n * several failed steps collapse to the i18n count phrase (`\"2 errors\"`),\n * which never counts a refusal. Returns `''`\n * when no step is marked, so the error line stays quiet.\n *\n * The optional `messageOf` resolver lets callers surface a per-step\n * reason (a direct `[error]` string or the first aggregator label) in the\n * single-error case instead of the generic `errored` status word. The\n * reason is still prefixed with the step label (`\"Payment: Card declined\"`),\n * because the summary line stays visible while another step is active and\n * a bare reason would read as belonging to the active step. When\n * omitted - or when it returns `undefined`/`''` - the helper produces\n * byte-identical output to the no-resolver form, so existing callers\n * (the classic mobile-collapse summary) are a guaranteed no-op.\n *\n * Pure helper - reads signals at call time, intended to be wrapped in the\n * caller's `computed()`. The phrase feeds live regions, so the step label\n * is read untracked: a label that follows a language switch must not\n * re-announce the line. Pass the i18n bundle as an untracked snapshot for\n * the same reason.\n *\n * @since 0.3.0\n */\nexport function resolveStepperErrorSummary(\n view: Pick<\n CngxStepperStateView,\n | 'errorMarkerCount'\n | 'firstErrorMarkerIndex'\n | 'errorCount'\n | 'firstErrorIndex'\n | 'isRefused'\n | 'hasErrorBadge'\n >,\n stepsOnly: Signal<readonly CngxStepNode[]>,\n i18n: CngxStepperI18n,\n messageOf?: (node: CngxStepNode) => string | undefined,\n): string {\n const count = view.errorMarkerCount();\n if (count === 0) {\n return '';\n }\n if (count === 1) {\n return singleStepPhrase(view, stepsOnly()[view.firstErrorMarkerIndex()], i18n, messageOf);\n }\n // A refusal is not an error: the count phrase counts failed steps only. One\n // error beside a refused step names that error; the refusal keeps its own\n // marker and announcement.\n const errors = view.errorCount();\n if (errors > 1) {\n return i18n.stepHasErrors(errors);\n }\n const index = errors === 1 ? view.firstErrorIndex() : view.firstErrorMarkerIndex();\n return singleStepPhrase(view, stepsOnly()[index], i18n, messageOf);\n}\n\n/** @internal `\"<label>: <detail>\"` for one marked step. */\nfunction singleStepPhrase(\n view: Pick<CngxStepperStateView, 'isRefused' | 'hasErrorBadge'>,\n node: CngxStepNode | undefined,\n i18n: CngxStepperI18n,\n messageOf?: (node: CngxStepNode) => string | undefined,\n): string {\n const detail = node ? summaryDetail(view, node, i18n, messageOf) : i18n.statusLabels.errored;\n const label = node ? untracked(node.label) : undefined;\n return label ? i18n.stepWithDetail(label, detail) : detail;\n}\n\n/**\n * @internal The word for one marked step: a validation error keeps its\n * reason, a refused-only step reads the refused word.\n */\nfunction summaryDetail(\n view: Pick<CngxStepperStateView, 'isRefused' | 'hasErrorBadge'>,\n node: CngxStepNode,\n i18n: CngxStepperI18n,\n messageOf?: (node: CngxStepNode) => string | undefined,\n): string {\n const refusedOnly = view.isRefused(node) && !view.hasErrorBadge(node);\n if (refusedOnly) {\n return i18n.statusLabels.refused;\n }\n const custom = messageOf?.(node);\n return custom !== undefined && custom !== '' ? custom : i18n.statusLabels.errored;\n}\n","import { computed, type Signal } from '@angular/core';\n\nimport type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type { CngxStepBadgeContext } from './slots/step-badge.directive';\nimport type { CngxStepBusySpinnerContext } from './slots/step-busy-spinner.directive';\nimport type { CngxDotStepperDotContext } from './slots/dot-stepper-dot.directive';\nimport type { CngxStepErrorContext } from './slots/step-error.directive';\nimport type { CngxStepGroupHeaderContext } from './slots/step-group-header.directive';\nimport type { CngxStepIndicatorContext } from './slots/step-indicator.directive';\nimport type { CngxStepRejectionContext } from './slots/step-rejection.directive';\nimport { createStepperStateView } from './stepper-state-view';\nimport type { CngxStepContentContext, CngxStepLabelContext } from './step-panel-host.token';\nimport type { CngxStepNode, CngxStepperHost } from './stepper-host.token';\n\n/**\n * Input bundle for {@link createStepperSlotContextBuilders}: the presenter\n * surface and the step-only flat projection. Builders read both reactively\n * so the produced context objects always reflect current presenter state.\n *\n * @internal\n */\nexport interface CngxStepperSlotContextBuildersInputs {\n readonly presenter: CngxStepperHost;\n readonly stepsOnly: Signal<readonly CngxStepNode[]>;\n /**\n * Whether a group node is currently collapsed (focus-driven collapse\n * policy). Optional so header contexts of collapse-free steppers keep\n * reporting `expanded: true` without the caller wiring a predicate.\n */\n readonly isGroupCollapsed?: (node: CngxStepNode) => boolean;\n /** i18n bundle Signal - supplies the `errored` status label as the message fallback. */\n readonly i18n: Signal<CngxStepperI18n>;\n}\n\n/**\n * Per-step status / activity / rejection / labelling derivations shared by\n * every slot context shape. The organism reads these through the bundle\n * instead of duplicating the logic next to each `*ContextFor` builder.\n *\n * @internal\n */\nexport interface CngxStepperSlotContextBuilders {\n readonly isActive: (node: CngxStepNode) => boolean;\n readonly isStepBusy: (node: CngxStepNode) => boolean;\n readonly showRejection: (node: CngxStepNode) => boolean;\n readonly showErrorBadge: (node: CngxStepNode) => boolean;\n /** Validation-channel error gate - mirrors the error badge, independent of commit rejection. */\n readonly showStepError: (node: CngxStepNode) => boolean;\n readonly indicatorContextFor: (node: CngxStepNode) => CngxStepIndicatorContext;\n readonly badgeContextFor: (node: CngxStepNode) => CngxStepBadgeContext;\n readonly busySpinnerContextFor: (node: CngxStepNode) => CngxStepBusySpinnerContext;\n readonly rejectionContextFor: (node: CngxStepNode) => CngxStepRejectionContext;\n readonly stepErrorContextFor: (node: CngxStepNode) => CngxStepErrorContext;\n readonly groupHeaderContextFor: (node: CngxStepNode) => CngxStepGroupHeaderContext;\n readonly stepLabelContextFor: (node: CngxStepNode) => CngxStepLabelContext;\n readonly stepContentContextFor: (node: CngxStepNode) => CngxStepContentContext;\n /** Context of the `*cngxDotStepperDot` body in the dots mobile-collapse branch. */\n readonly dotContextFor: (node: CngxStepNode) => CngxDotStepperDotContext;\n}\n\n/**\n * Wrap a `(node) => TContext` builder so identical results return the\n * same reference. Keyed by the node object via `WeakMap`, so step-list\n * re-emits drop stale entries automatically. The structural comparison\n * is shallow because every context shape is a flat object.\n *\n * @internal\n */\nfunction memoizeByNode<TContext extends object>(\n build: (node: CngxStepNode) => TContext,\n): (node: CngxStepNode) => TContext {\n const cache = new WeakMap<CngxStepNode, TContext>();\n return (node) => {\n const next = build(node);\n const prev = cache.get(node);\n if (prev !== undefined && shallowEqual(prev, next)) {\n return prev;\n }\n cache.set(node, next);\n return next;\n };\n}\n\n/** @internal */\nfunction shallowEqual<T extends object>(a: T, b: T): boolean {\n if (a === b) {\n return true;\n }\n const keysA = Object.keys(a);\n if (keysA.length !== Object.keys(b).length) {\n return false;\n }\n const ra = a as Record<string, unknown>;\n const rb = b as Record<string, unknown>;\n for (const k of keysA) {\n if (ra[k] !== rb[k]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Bundle the `*ContextFor` slot-context builders plus the small\n * `isActive` / `isStepBusy` / `showRejection` / `showErrorBadge` /\n * `showStepError` predicates the organism's template reads. Lives at\n * Level 2 so the `<cngx-stepper>` organism stays a thin shell.\n *\n * @internal\n */\nexport function createStepperSlotContextBuilders(\n inputs: CngxStepperSlotContextBuildersInputs,\n): CngxStepperSlotContextBuilders {\n const { presenter, stepsOnly, i18n } = inputs;\n\n // Single source for every per-step status / error / busy / rejection\n // derivation. The dot / text / progress-bar skins read the same view,\n // so the error contract stays identical across all four.\n const stateView = createStepperStateView({ presenter, stepsOnly });\n\n const isActive = (node: CngxStepNode): boolean =>\n node.kind === 'step' && node.id === presenter.activeStepId();\n\n const isStepBusy = stateView.isBusy;\n\n const showRejection = stateView.isRejected;\n\n const showErrorBadge = stateView.hasErrorBadge;\n\n // Validation-channel gate for the per-step error message. Mirrors the\n // error badge (state === 'error' via [error] / aggregator); the commit\n // rejection keeps its own `showRejection` slot, so the two channels\n // stay distinct.\n const showStepError = stateView.hasErrorBadge;\n\n // Memoize per-node so identical contexts return the same reference.\n // *ngTemplateOutlet pays an ngOnChanges shallow comparison on its\n // `context:` binding every CD pass; without this cache the outlet\n // sees a fresh literal each tick and re-pushes context to the\n // embedded view even when no source signal changed. Cache keys are\n // the node objects themselves so the WeakMap evicts naturally with\n // step-list re-emits.\n const indicatorContextFor = memoizeByNode<CngxStepIndicatorContext>((node) => {\n const position = node.flatIndex + 1;\n return {\n $implicit: position,\n position,\n node,\n active: isActive(node),\n status: node.state(),\n busy: isStepBusy(node),\n };\n });\n\n const badgeContextFor = memoizeByNode<CngxStepBadgeContext>((node) => {\n const aggregator = node.errorAggregator?.();\n const count = aggregator?.errorCount() ?? 0;\n return { count, node };\n });\n\n const busySpinnerContextFor = memoizeByNode<CngxStepBusySpinnerContext>((node) => ({ node }));\n\n const rejectionContextFor = memoizeByNode<CngxStepRejectionContext>((node) => {\n const failedIndex = node.flatIndex;\n const originIdx = presenter.originIndexDuringCommit();\n const originLabel = originIdx !== undefined ? stepsOnly()[originIdx]?.label() : undefined;\n const reason = stateView.isRefused(node) ? 'refused' : 'failed';\n return { failedIndex, originLabel, node, reason };\n });\n\n const stepErrorContextFor = memoizeByNode<CngxStepErrorContext>((node) => {\n const aggregator = node.errorAggregator?.();\n const errorLabels = aggregator?.errorLabels?.() ?? [];\n const announcement = aggregator?.announcement?.() ?? '';\n // Resolution order: direct [error] string > first aggregator label >\n // i18n errored status phrase. Always non-empty so a bare\n // `{{ message }}` template renders a reason.\n const message = node.errorMessage?.() ?? errorLabels[0] ?? i18n().statusLabels.errored;\n return { node, message, errorLabels, announcement };\n });\n\n const groupHeaderContextFor = memoizeByNode<CngxStepGroupHeaderContext>((node) => ({\n group: node,\n expanded: !(inputs.isGroupCollapsed?.(node) ?? false),\n status: node.state(),\n }));\n\n const stepLabelContextFor = memoizeByNode<CngxStepLabelContext>((node) => ({\n node,\n index: node.flatIndex + 1,\n active: isActive(node),\n busy: isStepBusy(node),\n disabled: node.disabled(),\n }));\n\n // Independent builder + independent cache: content + label contexts\n // share a shape today but the slot directives are separate contracts\n // (CngxStepContentContext vs CngxStepLabelContext) and will diverge\n // when one side gains a field. Aliasing the function would couple\n // both call sites to that future divergence.\n const stepContentContextFor = memoizeByNode<CngxStepContentContext>((node) => ({\n node,\n index: node.flatIndex + 1,\n active: isActive(node),\n busy: isStepBusy(node),\n disabled: node.disabled(),\n }));\n\n // One pass per step-list change, so a dot reads its index in O(1)\n // instead of scanning the list on every change-detection pass.\n const stepIndexByNode = computed(\n () => new Map(stepsOnly().map((node, index) => [node, index] as const)),\n );\n\n // Same fields as <cngx-dot-stepper>: index in the step-only projection,\n // completed = before the active step.\n const dotContextFor = memoizeByNode<CngxDotStepperDotContext>((node) => {\n const index = stepIndexByNode().get(node) ?? -1;\n return {\n $implicit: index,\n index,\n node,\n active: isActive(node),\n completed: index < presenter.activeStepIndex(),\n };\n });\n\n return {\n isActive,\n isStepBusy,\n showRejection,\n showErrorBadge,\n showStepError,\n indicatorContextFor,\n badgeContextFor,\n busySpinnerContextFor,\n rejectionContextFor,\n stepErrorContextFor,\n groupHeaderContextFor,\n stepLabelContextFor,\n stepContentContextFor,\n dotContextFor,\n };\n}\n","import { computed, untracked, type Signal } from '@angular/core';\n\nimport { createRefusedPhrase } from '@cngx/common/data';\n\nimport type { CngxStepperI18n } from './i18n/stepper-i18n';\nimport type { CngxStepNode, CngxStepperHost } from './stepper-host.token';\n\n/**\n * Input bundle for {@link createStepperAnnouncementBuilders}. The presenter\n * surface (commit transition + failed-index signals), the step-only flat\n * projection, and the resolved i18n bundle Signal.\n *\n * @internal\n */\nexport interface CngxStepperAnnouncementBuildersInputs {\n readonly presenter: CngxStepperHost;\n readonly stepsOnly: Signal<readonly CngxStepNode[]>;\n readonly i18n: Signal<CngxStepperI18n>;\n}\n\n/**\n * Reactive SR-announcement surface for the stepper organism: the\n * `aria-live` content for commit lifecycle transitions, the per-step\n * descriptor phrase including the rejected-suffix, and the group rollup\n * phrase. Bundles three small functions the organism's template binds\n * against.\n *\n * @internal\n */\nexport interface CngxStepperAnnouncementBuilders {\n /**\n * Live-region content driven by the commit transition tracker.\n * Empty string between transitions keeps the region quiet on no-op\n * CD ticks. A refusal speaks `commitRefused(originLabel)` (or\n * `commitRefusedGeneric` without a label) once and holds it until the\n * next commit, step move or reset. Error-arm priority:\n * `commitRolledBackTo(originLabel)` when both `lastFailedIndex` and a\n * resolvable origin label exist; otherwise `commitFailedRetry`.\n */\n readonly liveAnnouncement: Signal<string>;\n /**\n * SR descriptor phrase. Aggregator-announced or \"Step N of M: <label>\";\n * routes a refused row through `stepRefused(base)` and a failed row\n * through `stepRolledBack(base)`.\n */\n readonly statusPhrase: (node: CngxStepNode) => string;\n /**\n * Step-header descriptor: `statusPhrase` plus the done / errored status\n * the stepper skins draw as a CSS glyph, joined through `stepWithDetail`.\n * The glyphs carry `/ ''` alt text, so this text is where their meaning\n * reaches a screen reader.\n */\n readonly headerStatusPhrase: (node: CngxStepNode) => string;\n /** Group descriptor - rolls up children's aggregated status. */\n readonly groupStatusPhrase: (node: CngxStepNode) => string;\n /** Stable descriptor-span id for a node (`<node-id>-desc`). */\n readonly descriptorId: (node: CngxStepNode) => string;\n /**\n * `aria-describedby` value for a node: `descriptorId(node)` while the\n * node's phrase (`headerStatusPhrase` for steps, `groupStatusPhrase` for\n * groups) is non-empty, else `null`. The descriptor span stays in the\n * DOM; only the reference is gated - accname 1.2 §2A traverses a\n * directly-referenced node even when it is empty or hidden.\n */\n readonly describedBy: (node: CngxStepNode) => string | null;\n}\n\n/**\n * Build the reactive SR-announcement surface for `<cngx-stepper>`.\n * Lives at Level 2 so the Level-4 organism stays a thin shell per\n * `reference_atomic_decompose`.\n *\n * @internal\n */\nexport function createStepperAnnouncementBuilders(\n inputs: CngxStepperAnnouncementBuildersInputs,\n): CngxStepperAnnouncementBuilders {\n const { presenter, stepsOnly } = inputs;\n\n // A refusal leaves the commit status at 'idle', so no status edge can\n // voice it. The phrase arms on each new refused outcome (a new\n // sequence) and is spent by the next commit activity, a step move or a\n // cleared outcome (reset). Arm wins over spend in the same flush, so an\n // optimistic rollback that moves the step still arms.\n const refusedPhrase = createRefusedPhrase({\n outcome: () => presenter.lastOutcome(),\n status: () => presenter.commitTransition.current(),\n activeIndex: () => presenter.activeStepIndex(),\n copy: refusedCopy,\n });\n\n function refusedCopy(): string {\n const originIdx = presenter.originIndexDuringCommit();\n const origin = originIdx !== undefined ? stepsOnly()[originIdx] : undefined;\n const originLabel = origin?.label();\n const i18n = inputs.i18n();\n return originLabel ? i18n.commitRefused(originLabel) : i18n.commitRefusedGeneric;\n }\n\n // The live region reads copy untracked: a language switch must not\n // re-speak the last phrase. The next commit transition speaks the new\n // language.\n const liveAnnouncement = computed<string>(() => {\n // Read the refused phrase EAGERLY: linkedSignal only observes the\n // snapshots it is read under, so a read behind the pending arm would\n // miss the status change that spends it.\n const refused = refusedPhrase();\n if (refused) {\n return refused;\n }\n const current = presenter.commitTransition.current();\n if (current === 'pending') {\n return untracked(() => inputs.i18n().commitInFlight);\n }\n if (\n current === 'success' &&\n presenter.commitTransition.previous() === 'pending' &&\n (presenter.commitMode?.() ?? 'pessimistic') === 'pessimistic'\n ) {\n // Announce where the commit landed - without this arm a pessimistic\n // accept moves the step silently (the pending phrase just goes quiet).\n // Pessimistic only: an optimistic accept already moved (and thereby\n // announced) the step at dispatch - repeating it here would\n // double-announce a position the SR user already reached.\n const landed = presenter.stepsOnly()[presenter.activeStepIndex()];\n if (landed) {\n // A step label can itself derive from copy (the Material bridge's\n // `Step <id>` fallback), so it is read untracked too.\n const label = untracked(landed.label);\n const count = presenter.stepsOnly().length;\n return untracked(() => inputs.i18n().selectedStep(label, landed.flatIndex + 1, count));\n }\n return '';\n }\n if (current === 'error') {\n // Sync commit-handler failures collapse pending -> error in one signal\n // flush; tracker sees `previous === 'idle'`. Guard stays loose so a\n // synchronously throwing `commitAction` still announces. A `false`\n // answer never reaches this arm: it settles to 'idle' as a refusal.\n const failedIdx = presenter.lastFailedIndex();\n const originIdx = presenter.originIndexDuringCommit();\n if (failedIdx !== undefined && originIdx !== undefined) {\n const origin = stepsOnly()[originIdx];\n const originLabel = origin ? untracked(origin.label) : undefined;\n if (originLabel) {\n return untracked(() => inputs.i18n().commitRolledBackTo(originLabel));\n }\n }\n return untracked(() => inputs.i18n().commitFailedRetry);\n }\n return '';\n });\n\n const statusPhrase = (node: CngxStepNode): string => {\n const i18n = inputs.i18n();\n const aggregator = node.errorAggregator?.();\n let base = aggregator?.shouldShow?.() ? (aggregator.announcement?.() ?? '') : '';\n if (!base && node.kind === 'step') {\n const idx = node.flatIndex;\n if (idx >= 0) {\n base = i18n.selectedStep(node.label(), idx + 1, stepsOnly().length);\n }\n }\n if (!base) {\n return '';\n }\n if (node.kind !== 'step' || node.flatIndex !== presenter.lastFailedIndex()) {\n return base;\n }\n return presenter.lastOutcome()?.kind === 'refused'\n ? i18n.stepRefused(base)\n : i18n.stepRolledBack(base);\n };\n\n // Converged on `statusLabels` - the same phrase map the status pill\n // (resolveStepperStatusLabel) renders, so a group's SR description can\n // never disagree with its visible pill.\n const groupStatusPhrase = (node: CngxStepNode): string => {\n const i18n = inputs.i18n();\n const status = node.state();\n if (status === 'error') {\n return i18n.statusLabels.errored;\n }\n if (status === 'success') {\n return i18n.statusLabels.done;\n }\n return '';\n };\n\n const headerStatusPhrase = (node: CngxStepNode): string => {\n const phrase = statusPhrase(node);\n const status = glyphStatus(node, inputs.i18n());\n if (!status) {\n return phrase;\n }\n return phrase ? inputs.i18n().stepWithDetail(phrase, status) : status;\n };\n\n const descriptorId = (node: CngxStepNode): string => `${node.id}-desc`;\n\n const describedBy = (node: CngxStepNode): string | null => {\n const phrase = node.kind === 'step' ? headerStatusPhrase(node) : groupStatusPhrase(node);\n return phrase ? descriptorId(node) : null;\n };\n\n return {\n liveAnnouncement,\n statusPhrase,\n headerStatusPhrase,\n groupStatusPhrase,\n descriptorId,\n describedBy,\n };\n}\n\n/** The status word behind a skin's done / errored glyph, or `''`. */\nfunction glyphStatus(node: CngxStepNode, i18n: CngxStepperI18n): string {\n const state = node.state();\n if (state === 'error') {\n return i18n.statusLabels.errored;\n }\n return state === 'success' ? i18n.statusLabels.done : '';\n}\n\n/**\n * Input bundle for {@link createStepperPanelRefs}: the resolved display\n * mode, the strip projection that decides which headers exist, and the\n * organism's id/describedby schemes.\n *\n * @internal\n */\nexport interface CngxStepperPanelRefsInputs {\n readonly displayMode: Signal<'classic' | 'text' | 'dots'>;\n readonly visibleStripNodes: Signal<readonly CngxStepNode[]>;\n readonly headerIdFor: (node: CngxStepNode) => string;\n readonly describedByFor: (node: CngxStepNode) => string | null;\n}\n\n/**\n * Per-mode panel naming surface for `<cngx-stepper>`'s region panels.\n *\n * @internal\n */\nexport interface CngxStepperPanelRefs {\n /** Header id when a header element is rendered for the node, else `null`. */\n readonly labelledBy: (node: CngxStepNode) => string | null;\n /** Self-naming fallback whenever {@link labelledBy} emits no id. */\n readonly ariaLabel: (node: CngxStepNode) => string | null;\n /** Gated describedby - suppressed when the descriptor span is header-hosted and the header is not rendered. */\n readonly describedBy: (node: CngxStepNode) => string | null;\n}\n\n/**\n * Build the mode-aware panel ref surface. The dots branch always\n * renders one dot per step; the classic strip only renders headers the\n * group-collapse policy exposes; the text branch has no header element\n * at all. A panel must never reference an id that is not in the DOM -\n * a dangling IDREF names the region as empty - so header-less panels\n * self-name via `aria-label` and drop the describedby reference (the\n * classic descriptor spans live inside the strip headers; the\n * collapsed branches mount theirs inside the panel).\n *\n * @internal\n */\nexport function createStepperPanelRefs(inputs: CngxStepperPanelRefsInputs): CngxStepperPanelRefs {\n const { displayMode, visibleStripNodes, headerIdFor, describedByFor } = inputs;\n\n const renderedHeaderIds = computed<ReadonlySet<string>>(\n () => new Set(visibleStripNodes().map((node) => node.id)),\n { equal: (a, b) => a.size === b.size && [...a].every((id) => b.has(id)) },\n );\n\n const labelledBy = (node: CngxStepNode): string | null => {\n const mode = displayMode();\n if (mode === 'text') {\n return null;\n }\n if (mode === 'dots') {\n return headerIdFor(node);\n }\n return renderedHeaderIds().has(node.id) ? headerIdFor(node) : null;\n };\n\n const ariaLabel = (node: CngxStepNode): string | null => (labelledBy(node) ? null : node.label());\n\n const describedBy = (node: CngxStepNode): string | null => {\n if (displayMode() === 'classic' && !renderedHeaderIds().has(node.id)) {\n return null;\n }\n return describedByFor(node);\n };\n\n return { labelledBy, ariaLabel, describedBy };\n}\n","import { computed, Directive, input } from '@angular/core';\nimport { injectDirection } from '@cngx/core';\n\nimport type { SwipeDirection } from '@cngx/common/interactive';\n\nimport { injectStepperConfig } from './stepper-config';\nimport { injectStepperHost } from './stepper-host.token';\n\n/**\n * Routes a `CngxSwipe` gesture into the stepper presenter so the\n * organism's mobile-collapse panels gain swipe-driven navigation\n * without duplicating pointer handling. Applied via `hostDirectives`\n * on `<cngx-stepper>`; consumer-facing input `[mobileSwipe]` is\n * forwarded through the host metadata.\n *\n * Cascade for `swipeEnabled`: per-instance `[mobileSwipe]` ->\n * `CNGX_STEPPER_CONFIG.mobileSwipe` -> library default `true`.\n *\n * Direction routing is asymmetric, matching the presenter's existing\n * navigation surface: the forward swipe (`left` under `ltr`, `right`\n * under `rtl`) -> `selectNext()` -> `select()` (linear gate + commit\n * window apply identically to a click); the back swipe ->\n * `selectPrevious()`, gated on `busy()` like the strip back-arrow.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/swipe-nav.directive.ts\n * @since 0.3.0\n */\n@Directive({\n selector: '[cngxStepperSwipeNav]',\n standalone: true,\n})\nexport class CngxStepperSwipeNav {\n /**\n * Per-instance opt-out for the built-in swipe navigation. `undefined`\n * defers to the config cascade.\n */\n readonly mobileSwipe = input<boolean | undefined>(undefined);\n\n private readonly host = injectStepperHost('cngxStepperSwipeNav', { host: false });\n private readonly config = injectStepperConfig();\n private readonly direction = injectDirection();\n\n /** Resolved enabled flag (Input -> config -> default(true)). Boolean output, no `equal` fn required. */\n readonly swipeEnabled = computed<boolean>(\n () => this.mobileSwipe() ?? this.config.mobileSwipe ?? true,\n );\n\n /**\n * Route a swipe direction into the presenter. The inline mapping\n * resolves against the document direction like the keyboard path:\n * under `ltr` a left swipe advances; under `rtl` the roles flip.\n * Vertical directions are ignored. The back path waits while a\n * commit is in flight - a stray gesture must not supersede it (the\n * programmatic `selectPrevious()` cancels deliberately).\n */\n handleSwipe(direction: SwipeDirection): void {\n if (direction !== 'left' && direction !== 'right') {\n return;\n }\n const forward = direction === (this.direction() === 'rtl' ? 'right' : 'left');\n if (forward) {\n this.host.selectNext();\n } else {\n if (this.host.busy()) {\n return;\n }\n this.host.selectPrevious();\n }\n }\n}\n","import { afterNextRender } from '@angular/core';\nimport { cngxDevWarn } from '@cngx/utils';\n\n/**\n * Dev-warning for a stepper control (`[cngxStepperNext]`,\n * `[cngxStepperPrevious]`, `[cngxStepperComplete]`, `<cngx-stepper-count>`)\n * that has neither a bound `[host]` nor an ambient stepper presenter. Such a\n * control stays disabled or empty for good, so it warns once per instance\n * after the first render, when the `[host]` binding has settled. Call it from\n * an injection context.\n *\n * @internal\n */\nexport function warnStepperControlUnhosted(selector: string, host: () => unknown): void {\n if (!(typeof ngDevMode !== 'undefined' && ngDevMode)) {\n return;\n }\n afterNextRender(() => {\n if (host()) {\n return;\n }\n cngxDevWarn(\n 'CNGX1056',\n `[${selector}] has no stepper. Place it inside a stepper, or bind [host] to the ` +\n `stepper's presenter when it sits outside.`,\n );\n });\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n type Signal,\n untracked,\n ViewEncapsulation,\n} from '@angular/core';\n\nimport { CNGX_STEPPER_HOST, type CngxStepNode } from './stepper-host.token';\nimport { injectStepperI18n } from './i18n/stepper-i18n';\nimport { warnStepperControlUnhosted } from './warn-stepper-unhosted';\n\n/**\n * Minimal contract `CngxStepperCount` reads off the host. A full\n * {@link CngxStepperHost} satisfies it, but consumers can also supply\n * a narrower stub (useful in tests, custom layouts, or non-standard\n * step containers that surface just these two signals).\n */\nexport interface CngxStepperCountHost {\n readonly activeStepIndex: Signal<number>;\n readonly stepsOnly: Signal<readonly CngxStepNode[]>;\n}\n\n/**\n * Reusable progress-hint atom for any stepper organism. Renders the\n * resolved `CngxStepperI18n.textStepperFormat(current, total)` string\n * inside a `<span>` and pipes the value through an `aria-live` region\n * so screen readers announce step transitions.\n *\n * The text shape is fully owned by the i18n format function - drop the\n * atom inside any `<cngx-stepper>` / `<cngx-mat-stepper>` /\n * `<cngx-progress-bar-stepper>` tree and override the format upstream\n * to change every instance at once:\n *\n * ```ts\n * provideStepperI18n(withStepperI18nLabels({\n * textStepperFormat: (c, t) => `${c}/${t} complete`,\n * }));\n * ```\n *\n * Canonical shapes the atom supports without any markup changes:\n * - `Step N of M` (default)\n * - `N/M complete`\n * - `N/M`\n * - `Math.round(c/t * 100)%`\n * - any consumer-defined string the closure returns.\n *\n * `[live]=\"false\"` opts the atom out of the `aria-live` region when\n * the caption sits next to another live region (e.g. a stepper that\n * already mounts its own live announcer) to prevent double announces.\n *\n * @since 0.3.0\n * @relatedTo CngxStepperHost, CngxStepperI18n\n * <example-url>/#/ui/stepper/stepper-count/multi-instance-format-overrides</example-url>\n */\n@Component({\n selector: 'cngx-stepper-count',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n // Two spans so only the live one reads copy untracked: a language switch\n // re-renders a plain caption at once, while a live caption keeps its text\n // until the next step change (no re-announcement). `live` is a mount-time\n // choice; the live span exists from the first render, before any change\n // it announces.\n template: `\n @if (live()) {\n <span aria-live=\"polite\">{{ liveLabel() }}</span>\n } @else {\n <span>{{ label() }}</span>\n }\n `,\n // isolate fences the caption from the surrounding text. The direction is\n // inherited: the default caption is translated text and reads in the\n // language's direction. A consumer `format` that renders a bare `N / M`\n // ratio can pin it with --cngx-stepper-count-direction: ltr. Bidi is\n // visual-only - AT reads DOM order, so the announced string is unchanged.\n styles: `\n .cngx-stepper-count span {\n unicode-bidi: var(--cngx-stepper-count-bidi, isolate);\n direction: var(--cngx-stepper-count-direction, inherit);\n }\n `,\n host: {\n class: 'cngx-stepper-count',\n },\n})\nexport class CngxStepperCount {\n /**\n * When `true`, wraps the rendered string in an `aria-live=\"polite\"` span.\n * Set it once per instance: toggling it swaps the span, and the region\n * content present at that moment is not announced.\n */\n readonly live = input<boolean>(true);\n\n /**\n * Per-instance format override. Receives `(current, total)` where\n * `current` is the 1-based active step position and `total` is\n * `host.stepsOnly().length`. When omitted, the resolved\n * `CngxStepperI18n.textStepperFormat` is used so two siblings can\n * each show a different shape inside the same stepper tree.\n */\n readonly format = input<((current: number, total: number) => string) | undefined>(undefined);\n\n /**\n * Explicit stepper-host reference. Set this when the atom sits\n * *outside* a `<cngx-stepper>` (e.g. in a sibling layout header)\n * by exporting the stepper as a template ref:\n * `<cngx-stepper #s=\"cngxStepper\">` then `[host]=\"s.presenter\"`.\n * When unset, the atom injects the ambient `CNGX_STEPPER_HOST` from\n * its DI tree. Accepts {@link CngxStepperCountHost} so a narrow stub\n * (active index + steps signal) also fits.\n */\n readonly host = input<CngxStepperCountHost | null>(null);\n\n private readonly injectedHost = inject(CNGX_STEPPER_HOST, { optional: true });\n private readonly i18n = injectStepperI18n();\n private readonly resolvedHost = computed<CngxStepperCountHost | null>(\n () => this.host() ?? this.injectedHost,\n );\n\n /** 1-based active position and step total, or `null` while there is nothing to count. */\n private readonly position = computed<{ current: number; total: number } | null>(\n () => {\n const host = this.resolvedHost();\n if (!host) {\n return null;\n }\n const total = host.stepsOnly().length;\n if (total === 0) {\n return null;\n }\n // Clamp against the live total - a transiently out-of-range active\n // index (steps removed at runtime) must not render \"Step 5 of 3\".\n const current = Math.min(Math.max(host.activeStepIndex() + 1, 1), total);\n return { current, total };\n },\n { equal: (a, b) => a?.current === b?.current && a?.total === b?.total },\n );\n\n /** Resolved caption - reactive on activeStepIndex / stepsOnly / format / i18n. */\n protected readonly label = computed<string>(() => {\n const position = this.position();\n if (!position) {\n return '';\n }\n const fmt = this.format() ?? this.i18n().textStepperFormat;\n return fmt(position.current, position.total);\n });\n\n /**\n * {@link label} for the live span: the bundle and a consumer `format`\n * (which may itself be language-dependent) are read untracked.\n */\n protected readonly liveLabel = computed<string>(() => {\n const position = this.position();\n if (!position) {\n return '';\n }\n return untracked(() =>\n (this.format() ?? this.i18n().textStepperFormat)(position.current, position.total),\n );\n });\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n warnStepperControlUnhosted('cngx-stepper-count', this.resolvedHost);\n }\n }\n}\n","import {\n afterEveryRender,\n afterRenderEffect,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n type Signal,\n} from '@angular/core';\n\nimport { CNGX_ASYNC_RUN_STATE } from '@cngx/common/interactive';\nimport { cngxDevWarn } from '@cngx/utils';\n\nimport { injectStepperI18n } from '../i18n/stepper-i18n';\nimport { CNGX_STEPPER_HOST, type CngxStepperHost } from '../stepper-host.token';\nimport { warnStepperControlUnhosted } from '../warn-stepper-unhosted';\n\n/**\n * Turns any clickable element into a stepper \"Back\" control. Resolves\n * its host the same way `CngxStepperCount` does - an explicit `[host]`\n * input (for placement outside the stepper tree) falling back to the\n * ambient {@link CNGX_STEPPER_HOST}.\n *\n * `(click)` retreats via `selectPrevious()`. The control disables itself\n * when there is no earlier step (`!canGoPrevious()`) OR while a commit or\n * the finish run is in flight (`busy()`): `selectPrevious()` writes\n * `activeStepIndex` directly, bypassing the commit controller, so\n * disabling it during an in-flight forward commit or finish run prevents\n * a navigate-mid-run race. The gate is the host's `canGoPrevious` bound -\n * never re-derived from `stepsOnly`.\n *\n * Reflects the disabled state via `aria-disabled` only - never native\n * `disabled` - so the control stays focusable and AT-reachable; the\n * `handleClick` guard blocks the action while disabled.\n *\n * ```html\n * <button cngxStepperPrevious>Back</button>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/controls/stepper-previous.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepperNext, CngxStepperComplete, CngxStepperHost\n */\n@Directive({\n selector: '[cngxStepperPrevious]',\n standalone: true,\n exportAs: 'cngxStepperPrevious',\n host: {\n '(click)': 'handleClick($event)',\n '[attr.aria-disabled]': 'disabled() || null',\n },\n})\nexport class CngxStepperPrevious {\n /**\n * Explicit stepper-host reference for placement *outside* the stepper\n * tree (`[host]=\"s.presenter\"`). When unset, the ambient\n * {@link CNGX_STEPPER_HOST} is injected.\n */\n readonly host = input<CngxStepperHost | null>(null);\n\n private readonly injectedHost = inject(CNGX_STEPPER_HOST, { optional: true });\n private readonly resolvedHost = computed<CngxStepperHost | null>(\n () => this.host() ?? this.injectedHost,\n );\n\n private readonly coPlacedAsyncClick = inject(CNGX_ASYNC_RUN_STATE, {\n self: true,\n optional: true,\n });\n\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly i18n = injectStepperI18n();\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n warnStepperControlUnhosted('cngxStepperPrevious', this.resolvedHost);\n }\n\n // Fallback accessible name for icon-only hosts: while the element\n // renders no text and the consumer supplied no label of their own,\n // the i18n `previousStep` phrase fills the gap. Re-checked after every\n // render (cheap string read) so a late-arriving visible label wins\n // again - a forced aria-label over visible text would break\n // label-in-name (WCAG 2.5.3). The data flag marks ownership so a\n // consumer-authored aria-label is never touched.\n afterEveryRender(() => {\n const el = this.elementRef.nativeElement;\n const ownsFallback = el.hasAttribute('data-cngx-label-fallback');\n const consumerLabelled =\n (!ownsFallback && el.hasAttribute('aria-label')) || el.hasAttribute('aria-labelledby');\n if (consumerLabelled) {\n return;\n }\n const hasText = (el.textContent ?? '').trim() !== '';\n if (hasText && ownsFallback) {\n el.removeAttribute('aria-label');\n el.removeAttribute('data-cngx-label-fallback');\n } else if (!hasText && !ownsFallback) {\n el.setAttribute('aria-label', this.i18n().previousStep);\n el.setAttribute('data-cngx-label-fallback', '');\n }\n });\n\n // A language switch re-labels a fallback this directive owns.\n afterRenderEffect(() => {\n const label = this.i18n().previousStep;\n const el = this.elementRef.nativeElement;\n if (el.hasAttribute('data-cngx-label-fallback')) {\n el.setAttribute('aria-label', label);\n }\n });\n\n if (typeof ngDevMode !== 'undefined' && ngDevMode && this.coPlacedAsyncClick) {\n cngxDevWarn(\n 'CNGX1038',\n '[cngxStepperPrevious] and [cngxAsyncClick] on the same element ' +\n 'both gate aria-disabled. Use one or the other.',\n );\n }\n }\n\n /** `true` when retreat is unavailable: no earlier step or commit busy. */\n protected readonly disabled: Signal<boolean> = computed(() => {\n const host = this.resolvedHost();\n return !host || !host.canGoPrevious() || host.busy();\n });\n\n /** @internal */\n protected handleClick(event: Event): void {\n if (this.disabled()) {\n event.preventDefault();\n return;\n }\n this.resolvedHost()?.selectPrevious();\n }\n}\n","import {\n afterEveryRender,\n afterRenderEffect,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n type Signal,\n} from '@angular/core';\n\nimport { CNGX_ASYNC_RUN_STATE } from '@cngx/common/interactive';\nimport { cngxDevWarn } from '@cngx/utils';\n\nimport { injectStepperI18n } from '../i18n/stepper-i18n';\nimport { CNGX_STEPPER_HOST, type CngxStepperHost } from '../stepper-host.token';\nimport { warnStepperControlUnhosted } from '../warn-stepper-unhosted';\n\n/**\n * Turns any clickable element into a stepper \"Continue\" control. Same\n * host resolution as `CngxStepperCount` - explicit `[host]` input\n * falling back to the ambient {@link CNGX_STEPPER_HOST}.\n *\n * `(click)` advances via `selectNext()`. A turnkey re-entrancy guard\n * disables the control when there is no enabled next step\n * (`!canGoNext()`) OR while a commit or the finish run is in flight\n * (`busy()`) - an opt-in guard a consumer forgets is a silent\n * double-commit (Pillar 2). The\n * gate reads the host's `canGoNext` bound, which derives from the same\n * `select()` predicates, so the affordance can never drift from the\n * navigation it triggers.\n *\n * Reflects the disabled state via `aria-disabled` only - never native\n * `disabled` (which would steal focus, so AT could not reach the control\n * to learn it is at-a-bound / busy) and never `aria-busy` (that is\n * `CngxAsyncStatus`'s sole responsibility). The `handleClick` guard\n * blocks the action while disabled. Co-placing `[cngxAsyncClick]` here\n * (which also gates `aria-disabled` and adds native `disabled`) warns in\n * dev mode.\n *\n * ```html\n * <button cngxStepperNext>Continue</button>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/controls/stepper-next.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepperPrevious, CngxStepperComplete, CngxAsyncStatus, CngxStepperHost\n */\n@Directive({\n selector: '[cngxStepperNext]',\n standalone: true,\n exportAs: 'cngxStepperNext',\n host: {\n '(click)': 'handleClick($event)',\n '[attr.aria-disabled]': 'disabled() || null',\n },\n})\nexport class CngxStepperNext {\n /**\n * Explicit stepper-host reference for placement *outside* the stepper\n * tree (`[host]=\"s.presenter\"`). When unset, the ambient\n * {@link CNGX_STEPPER_HOST} is injected.\n */\n readonly host = input<CngxStepperHost | null>(null);\n\n private readonly injectedHost = inject(CNGX_STEPPER_HOST, { optional: true });\n private readonly resolvedHost = computed<CngxStepperHost | null>(\n () => this.host() ?? this.injectedHost,\n );\n\n private readonly coPlacedAsyncClick = inject(CNGX_ASYNC_RUN_STATE, {\n self: true,\n optional: true,\n });\n\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly i18n = injectStepperI18n();\n\n /** `true` when advancing is unavailable: no enabled next step or commit busy. */\n protected readonly disabled: Signal<boolean> = computed(() => {\n const host = this.resolvedHost();\n return !host || !host.canGoNext() || host.busy();\n });\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n warnStepperControlUnhosted('cngxStepperNext', this.resolvedHost);\n }\n\n // Fallback accessible name for icon-only hosts: while the element\n // renders no text and the consumer supplied no label of their own,\n // the i18n `nextStep` phrase fills the gap. Re-checked after every\n // render (cheap string read) so a late-arriving visible label wins\n // again - a forced aria-label over visible text would break\n // label-in-name (WCAG 2.5.3). The data flag marks ownership so a\n // consumer-authored aria-label is never touched.\n afterEveryRender(() => {\n const el = this.elementRef.nativeElement;\n const ownsFallback = el.hasAttribute('data-cngx-label-fallback');\n const consumerLabelled =\n (!ownsFallback && el.hasAttribute('aria-label')) || el.hasAttribute('aria-labelledby');\n if (consumerLabelled) {\n return;\n }\n const hasText = (el.textContent ?? '').trim() !== '';\n if (hasText && ownsFallback) {\n el.removeAttribute('aria-label');\n el.removeAttribute('data-cngx-label-fallback');\n } else if (!hasText && !ownsFallback) {\n el.setAttribute('aria-label', this.i18n().nextStep);\n el.setAttribute('data-cngx-label-fallback', '');\n }\n });\n\n // A language switch re-labels a fallback this directive owns.\n afterRenderEffect(() => {\n const label = this.i18n().nextStep;\n const el = this.elementRef.nativeElement;\n if (el.hasAttribute('data-cngx-label-fallback')) {\n el.setAttribute('aria-label', label);\n }\n });\n\n if (typeof ngDevMode !== 'undefined' && ngDevMode && this.coPlacedAsyncClick) {\n cngxDevWarn(\n 'CNGX1038',\n '[cngxStepperNext] and [cngxAsyncClick] on the same element ' +\n 'both gate aria-disabled. Use one or the other.',\n );\n }\n }\n\n /** @internal */\n protected handleClick(event: Event): void {\n if (this.disabled()) {\n event.preventDefault();\n return;\n }\n this.resolvedHost()?.selectNext();\n }\n}\n","import {\n computed,\n Directive,\n effect,\n inject,\n input,\n output,\n untracked,\n type Signal,\n} from '@angular/core';\n\nimport { CNGX_ASYNC_RUN_STATE, CngxAsyncClick } from '@cngx/common/interactive';\nimport { nextUid } from '@cngx/core/utils';\n\nimport { CNGX_STEPPER_HOST, type CngxStepperHost } from '../stepper-host.token';\nimport { warnStepperControlUnhosted } from '../warn-stepper-unhosted';\n\n/**\n * Turns any clickable element into a stepper \"Finish\" control. Unlike\n * `CngxStepperNext` (which *reflects* the commit state and advances),\n * the finish action *runs*: the directive composes `CngxAsyncClick` via\n * `hostDirectives`, so the runner owns the click lifecycle, `aria-busy`,\n * and the pending-disable exactly as it does on a standalone button. The\n * finish action is fed through the aliased `[cngxStepperComplete]` input.\n *\n * Resolves its host like the sibling controls - explicit `[host]` input\n * falling back to the ambient {@link CNGX_STEPPER_HOST}. {@link isActive}\n * exposes whether the active step is the last one, so a consumer renders\n * the finish control only on the final step. `(completed)` emits once\n * per successful run of the action.\n *\n * ```html\n * @if (s.presenter.isLastStep()) {\n * <button [cngxStepperComplete]=\"submit\" (completed)=\"done()\">Finish</button>\n * }\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/controls/stepper-complete.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStepperNext, CngxStepperPrevious, CngxAsyncClick, CngxStepperHost\n */\n@Directive({\n selector: '[cngxStepperComplete]',\n standalone: true,\n exportAs: 'cngxStepperComplete',\n hostDirectives: [\n {\n directive: CngxAsyncClick,\n inputs: [\n 'cngxAsyncClick: cngxStepperComplete',\n 'feedbackDuration',\n 'enabled',\n 'succeededAnnouncement',\n 'failedAnnouncement',\n 'showDelay',\n 'minDwell',\n ],\n },\n ],\n})\nexport class CngxStepperComplete {\n /**\n * Explicit stepper-host reference for placement *outside* the stepper\n * tree (`[host]=\"s.presenter\"`). When unset, the ambient\n * {@link CNGX_STEPPER_HOST} is injected.\n */\n readonly host = input<CngxStepperHost | null>(null);\n\n /**\n * Emits once per successful run of the finish action, driven by the\n * runner's `(settled)` event: two runs that succeed before change\n * detection emit twice. Never on failure, cancel or after destroy, and\n * not when the `feedbackDuration` window resets the runner to idle.\n */\n readonly completed = output<void>();\n\n private readonly injectedHost = inject(CNGX_STEPPER_HOST, { optional: true });\n private readonly resolvedHost = computed<CngxStepperHost | null>(\n () => this.host() ?? this.injectedHost,\n );\n private readonly runner = inject(CNGX_ASYNC_RUN_STATE, { host: true });\n\n // Busy for the run and for the held busy visual after it. The runner's own\n // [busy] hint and a host-reflected busy stay out: they are not this run.\n private readonly busy = computed(() => this.runner.pending() || this.runner.busyVisible());\n private readonly busyKey = nextUid('cngx-stepper-complete');\n\n /** `true` when the active step is the last one - the finish step. */\n readonly isActive: Signal<boolean> = computed(() => this.resolvedHost()?.isLastStep() ?? false);\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n warnStepperControlUnhosted('cngxStepperComplete', this.resolvedHost);\n }\n\n // The run and its dwell hold the host busy, so Back, Next and header\n // navigation refuse while Finish runs. register() reads and writes the\n // registry's own signal, so the call stays untracked; only the host is a\n // dependency.\n effect((onCleanup) => {\n const host = this.resolvedHost();\n const release = untracked(() => host?.registerBusy?.(this.busyKey, this.busy));\n if (release) {\n onCleanup(release);\n }\n });\n\n // The subscription ends with the runner, which shares this element.\n this.runner.settled.subscribe((settle) => {\n if (settle.status === 'success') {\n this.completed.emit();\n }\n });\n }\n}\n","import { computed, type Signal } from '@angular/core';\n\nimport { buildAsyncStateView, type StatusTransition } from '@cngx/core/utils';\n\nimport type { CngxStepNode, CngxStepRegistration, CngxStepperHost } from './stepper-host.token';\n\nconst EMPTY_NODES: readonly CngxStepNode[] = Object.freeze([]);\nconst NO_RELEASE = (): void => undefined;\n\n/**\n * Builds a live delegating {@link CngxStepperHost} proxy over a supplier\n * signal. Every signal member is a `computed()` reading\n * `supplier()?.<member>()`, every method forwards to\n * `supplier()?.<method>(...)`. This is the spelled-out shape for\n * re-providing an input-derived host through DI - you cannot\n * `useExisting` an `input()` value, so the footer provides this proxy\n * once and it tracks whichever host the supplier currently resolves.\n *\n * **Null-supplier neutral set (the disabled-by-default contract).** When\n * the supplier resolves `null` (a standalone footer with neither `[host]`\n * nor an ambient stepper), every navigation affordance must render\n * *inert*, never falsely enabled: `canGoPrevious` / `canGoNext` collapse\n * to `false` so Back / Next render disabled, and every method is a no-op.\n *\n * `create*` pure factory - no injection context required (`computed()`\n * only). Single consumer (the footer); the surface is load-bearing, not\n * speculative.\n *\n * @since 0.3.0\n * @relatedTo CngxStepperFooter, CngxStepperHost\n */\nexport function createStepperHostProxy(supplier: () => CngxStepperHost | null): CngxStepperHost {\n return {\n // Core projection / state - empty / out-of-range when null. The array\n // fallbacks return the shared frozen EMPTY_NODES reference, so no `equal`\n // fn is needed: the output is reference-stable across reads (either the\n // supplier's own structural-equal signal value, or this one constant).\n stepTree: computed(() => supplier()?.stepTree() ?? EMPTY_NODES),\n flatSteps: computed(() => supplier()?.flatSteps() ?? EMPTY_NODES),\n stepsOnly: computed(() => supplier()?.stepsOnly() ?? EMPTY_NODES),\n visibleStripNodes: computed(() => supplier()?.visibleStripNodes() ?? EMPTY_NODES),\n activeStepIndex: computed(() => supplier()?.activeStepIndex() ?? -1),\n activeStepId: computed(() => supplier()?.activeStepId() ?? null),\n activeGroupId: computed(() => supplier()?.activeGroupId() ?? null),\n linear: computed(() => supplier()?.linear() ?? false),\n commitMode: computed(() => supplier()?.commitMode?.() ?? 'pessimistic'),\n orientation: computed(() => supplier()?.orientation() ?? 'horizontal'),\n intendedStepIndex: computed(() => supplier()?.intendedStepIndex()),\n lastOutcome: computed(() => supplier()?.lastOutcome()),\n lastFailedIndex: computed(() => supplier()?.lastFailedIndex()),\n originIndexDuringCommit: computed(() => supplier()?.originIndexDuringCommit()),\n\n // Bounds + labels - the safety-critical canGo* pair collapses to\n // `false` so a null host yields disabled Back / Next, never clickable.\n stepCount: computed(() => supplier()?.stepCount() ?? 0),\n isFirstStep: computed(() => supplier()?.isFirstStep() ?? true),\n isLastStep: computed(() => supplier()?.isLastStep() ?? true),\n canGoPrevious: computed(() => supplier()?.canGoPrevious() ?? false),\n canGoNext: computed(() => supplier()?.canGoNext() ?? false),\n busy: computed(() => supplier()?.busy() ?? false),\n nextStepLabel: computed(() => supplier()?.nextStepLabel()),\n previousStepLabel: computed(() => supplier()?.previousStepLabel()),\n\n // Composite members delegate their sub-signals, idle when null. The\n // proxy only forwards - the real tracker is the presenter's, so build\n // the static neutral shape rather than calling createTransitionTracker.\n commitState: buildAsyncStateView<number | undefined>({\n status: computed(() => supplier()?.commitState.status() ?? 'idle'),\n data: computed(() => supplier()?.commitState.data()),\n error: computed(() => supplier()?.commitState.error()),\n lastUpdated: computed(() => supplier()?.commitState.lastUpdated()),\n }),\n commitTransition: {\n current: computed(() => supplier()?.commitTransition.current() ?? 'idle'),\n previous: computed(() => supplier()?.commitTransition.previous() ?? 'idle'),\n } satisfies StatusTransition,\n\n // Reachability predicate - neutral `false` when null so a header\n // over a missing host is never falsely navigable.\n canNavigateTo: (index: number) => supplier()?.canNavigateTo(index) ?? false,\n\n // Methods forward; no-op when null.\n select: (index: number) => supplier()?.select(index),\n selectNext: () => supplier()?.selectNext(),\n selectPrevious: () => supplier()?.selectPrevious(),\n selectById: (id: string) => supplier()?.selectById(id),\n reset: () => supplier()?.reset(),\n clearLastFailed: () => supplier()?.clearLastFailed(),\n register: (handle: CngxStepRegistration, parentId?: string | null) =>\n supplier()?.register(handle, parentId),\n unregister: (id: string) => supplier()?.unregister(id),\n // Bound to the host current at the call: a later supplier swap leaves\n // the registration where it is (stepper-accepted-debt §20).\n registerBusy: (key: string, pending: Signal<boolean>) =>\n supplier()?.registerBusy?.(key, pending) ?? NO_RELEASE,\n };\n}\n","import { type EnvironmentProviders, makeEnvironmentProviders, type Provider } from '@angular/core';\nimport { cngxDevWarn } from '@cngx/utils';\n\nimport { provideStepperI18n, type CngxStepperI18nFeature } from './i18n/stepper-i18n';\nimport {\n provideStepperConfig,\n provideStepperConfigAt,\n type CngxStepperConfigFeature,\n} from './stepper-config';\n\n/**\n * Union of every feature kind {@link provideCngxStepper} accepts. Today:\n * config (`CNGX_STEPPER_CONFIG`) and i18n (`CNGX_STEPPER_I18N`). Future\n * surfaces widen this union and dispatch via the hidden `_target`\n * discriminator.\n */\nexport type CngxStepperFeature = CngxStepperConfigFeature | CngxStepperI18nFeature;\n\n/** @internal */\ninterface PartitionedFeatures {\n readonly config: CngxStepperConfigFeature[];\n readonly i18n: CngxStepperI18nFeature[];\n}\n\n/** @internal */\nfunction partitionFeatures(\n features: readonly CngxStepperFeature[],\n caller: 'provideCngxStepper' | 'provideCngxStepperAt',\n): PartitionedFeatures {\n const config: CngxStepperConfigFeature[] = [];\n const i18n: CngxStepperI18nFeature[] = [];\n for (const feat of features) {\n if (feat._target === 'i18n') {\n i18n.push(feat);\n continue;\n }\n if (feat._target === 'config') {\n config.push(feat);\n continue;\n }\n // Unbranded feature - drop + dev-warn (mirrors `provideCngxTabs`).\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n if (caller === 'provideCngxStepperAt') {\n cngxDevWarn(\n 'CNGX1041',\n 'provideCngxStepperAt(): dropped feature without a `_target` ' +\n 'discriminator. Pass config through the `with*` helpers of @cngx/common/stepper ' +\n 'and labels through `withStepperI18nLabels(...)`.',\n );\n } else {\n cngxDevWarn(\n 'CNGX1041',\n 'provideCngxStepper(): dropped feature without a `_target` ' +\n 'discriminator. Pass config through the `with*` helpers of @cngx/common/stepper ' +\n 'and labels through `withStepperI18nLabels(...)`.',\n );\n }\n }\n }\n return { config, i18n };\n}\n\n/**\n * Unified aggregator for the stepper family. Filters by `_target` and\n * forwards: config features to {@link provideStepperConfig}, i18n\n * features to {@link provideStepperI18n}. Mirrors `provideCngxTabs` /\n * `provideCngxSelect`.\n *\n * Returns {@link EnvironmentProviders} for app-root use; the\n * component-scoped twin {@link provideCngxStepperAt} returns\n * `Provider[]` because `viewProviders` cannot accept opaque\n * `EnvironmentProviders`.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideCngxStepper(\n * withStepperDefaultOrientation('vertical'),\n * withStepperLinear(true),\n * withStepperI18nLabels({ stepperLabel: 'Bestellschritte', previousStep: 'Vorheriger' }),\n * ),\n * ],\n * });\n * ```\n */\nexport function provideCngxStepper(\n ...features: readonly CngxStepperFeature[]\n): EnvironmentProviders {\n const { config, i18n } = partitionFeatures(features, 'provideCngxStepper');\n // `provideStepperConfig` returns EnvironmentProviders, `provideStepperI18n`\n // returns Provider - `makeEnvironmentProviders` takes both.\n return makeEnvironmentProviders([\n provideStepperConfig(...config),\n ...(i18n.length > 0 ? [provideStepperI18n(...i18n)] : []),\n ]);\n}\n\n/**\n * Component-scoped twin of {@link provideCngxStepper}. Spread into\n * `viewProviders` or `providers`. Same dispatch semantics - only the\n * provider scope differs.\n *\n * ```ts\n * @Component({\n * viewProviders: [\n * ...provideCngxStepperAt(\n * withStepperDefaultOrientation('vertical'),\n * withStepperI18nLabels({ stepperLabel: 'Bestellschritte' }),\n * ),\n * ],\n * })\n * ```\n */\nexport function provideCngxStepperAt(...features: readonly CngxStepperFeature[]): Provider[] {\n const { config, i18n } = partitionFeatures(features, 'provideCngxStepperAt');\n return [\n // Gate like i18n: an i18n-only call must not plant an empty config\n // at this injector level and shadow an app-wide provideStepperConfig.\n ...(config.length > 0 ? provideStepperConfigAt(...config) : []),\n ...(i18n.length > 0 ? [provideStepperI18n(...i18n)] : []),\n ];\n}\n","/**\n * @module `@cngx/common/stepper`\n *\n * Level-2 directive-only logic for stepper / wizard flows. Ships the\n * presenter brain, atom directives, host tokens, router-sync, config\n * cascade, and i18n. Zero `@Component`, zero `.html`, zero `.css` -\n * those live in `@cngx/ui/stepper` (CNGX-standard skin) and\n * `@cngx/ui/mat-stepper` (Material twin).\n */\n\nexport { CngxStepperPresenter, type CngxStepperCommitAction } from './presenter.directive';\n\nexport {\n CNGX_STEPPER_HOST,\n type CngxStepperHost,\n type CngxStepNode,\n type CngxStepRegistration,\n type CngxStepStatus,\n} from './stepper-host.token';\n\nexport { CNGX_STEP_GROUP_HOST, type CngxStepGroupHost } from './step-group-host.token';\n\nexport {\n CNGX_STEP_PANEL_HOST,\n type CngxStepContentContext,\n type CngxStepLabelContext,\n type CngxStepPanelHost,\n} from './step-panel-host.token';\n\nexport { flatStepsEqual } from './step-tree.util';\n\nexport { CngxStep } from './step.directive';\nexport { CngxStepGroup } from './step-group.directive';\nexport { CngxStepLabel } from './step-label.directive';\nexport { CngxStepContent } from './step-content.directive';\n\nexport { CngxStepIndicator, type CngxStepIndicatorContext } from './slots/step-indicator.directive';\n\nexport { CngxStepBadge, type CngxStepBadgeContext } from './slots/step-badge.directive';\n\nexport {\n CngxStepBusySpinner,\n type CngxStepBusySpinnerContext,\n} from './slots/step-busy-spinner.directive';\n\nexport { CngxStepRejection, type CngxStepRejectionContext } from './slots/step-rejection.directive';\n\nexport { CngxStepError, type CngxStepErrorContext } from './slots/step-error.directive';\n\nexport {\n CngxStepGroupHeader,\n type CngxStepGroupHeaderContext,\n} from './slots/step-group-header.directive';\n\nexport { CngxStepperEmpty } from './slots/stepper-empty.directive';\n\nexport {\n CngxDotStepperDot,\n type CngxDotStepperDotContext,\n} from './slots/dot-stepper-dot.directive';\n\nexport {\n createStepperTemplateBindings,\n type CngxStepperTemplateBindings,\n type CngxStepperTemplateBindingsOptions,\n} from './slots/stepper-template-cascade';\n\nexport { CngxStepperRouterSync } from './router-sync.directive';\n\nexport {\n CNGX_STEPPER_CONFIG,\n type CngxStepperConfig,\n type CngxStepperConfigFeature,\n type CngxStepperDensity,\n type CngxStepperFallbackLabels,\n type CngxStepperGroupCollapse,\n type CngxStepperGroupSummary,\n type CngxStepperHeaderNavigation,\n type CngxStepperMobileCollapse,\n type CngxStepperMobileIndicatorPosition,\n type CngxStepperSkin,\n type CngxStepperTemplates,\n injectStepperConfig,\n provideStepperConfig,\n provideStepperConfigAt,\n withStepperDefaultOrientation,\n withStepperDensity,\n withStepperCommitMode,\n withStepperConnectors,\n withStepperFallbackLabels,\n withStepperGroupCollapse,\n withStepperGroupCollapseSummary,\n withStepperHeaderNavigation,\n withStepperLinear,\n withStepperMobileCollapse,\n withStepperMobileIndicatorPosition,\n withStepperMobileSwipe,\n withStepperRouterSync,\n withStepperSkin,\n withStepIndicatorTemplate,\n withStepBadgeTemplate,\n withStepBusySpinnerTemplate,\n withStepRejectionTemplate,\n withStepErrorTemplate,\n withStepGroupHeaderTemplate,\n withStepperEmptyTemplate,\n withDotStepperDotTemplate,\n} from './stepper-config';\n\nexport {\n CNGX_STEPPER_I18N,\n type CngxStepperI18n,\n type CngxStepperI18nFeature,\n type CngxStepperI18nOverrides,\n type CngxStepperStatusLabels,\n injectStepperI18n,\n provideStepperI18n,\n withStepperI18nLabels,\n} from './i18n/stepper-i18n';\nexport {\n CNGX_STEPPER_LANGUAGE_EN,\n type CngxStepperLanguageSection,\n type CngxStepperStatusLanguage,\n} from './i18n/stepper-language-section';\nexport { resolveStepperStatusLabel } from './status-label';\n\nexport { createStepperDisplayMode, injectStepperCollapse } from './display-mode';\n\nexport {\n createStepperGroupSummary,\n type CngxStepperGroupSummaryView,\n type CngxStepperGroupSummaryOptions,\n} from './group-summary';\n\nexport {\n createStepperGroupNavigation,\n type CngxStepperGroupNavigationView,\n type CngxStepperGroupNavigationOptions,\n} from './group-navigation';\n\n// The following three blocks ship `@internal` factory helpers. They are\n// exported through `public-api.ts` so the sibling `@cngx/ui/stepper`\n// organism can consume them across the secondary-entry boundary\n// (ng-packagr has no cross-entry private surface). `disableInternal: true`\n// in `.compodocrc.json` hides them from generated docs; the LLM-md export\n// honours the same tag. Precedent: `flatStepsEqual`.\nexport {\n createStepperAccname,\n createStepperHostAttrs,\n type CngxStepperAccnameInputs,\n type CngxStepperHostAttrs,\n type CngxStepperHostAttrsInputs,\n} from './stepper-host-attrs';\n\nexport {\n createStepperStripKeyboardNav,\n type CngxStepperStripKeyboardNavOptions,\n} from './strip-keyboard-nav';\n\nexport {\n createStepperStateView,\n resolveStepperErrorSummary,\n type CngxStepperStateView,\n} from './stepper-state-view';\n\nexport {\n createStepperSlotContextBuilders,\n type CngxStepperSlotContextBuilders,\n type CngxStepperSlotContextBuildersInputs,\n} from './slot-context-builders';\n\nexport {\n createStepperAnnouncementBuilders,\n createStepperPanelRefs,\n type CngxStepperAnnouncementBuilders,\n type CngxStepperAnnouncementBuildersInputs,\n type CngxStepperPanelRefs,\n type CngxStepperPanelRefsInputs,\n} from './announcement-builders';\n\nexport { CngxStepperSwipeNav } from './swipe-nav.directive';\n\nexport { CngxStepperCount, type CngxStepperCountHost } from './stepper-count';\n\nexport { CngxStepperPrevious } from './controls/stepper-previous.directive';\nexport { CngxStepperNext } from './controls/stepper-next.directive';\nexport { CngxStepperComplete } from './controls/stepper-complete.directive';\nexport { createStepperHostProxy } from './create-stepper-host-proxy';\n\nexport {\n CNGX_STEPPER_COMMIT_HANDLER_FACTORY,\n type CngxStepperCommitHandler,\n type CngxStepperCommitHandlerFactory,\n type CngxStepperCommitHandlerOptions,\n type CngxStepperCommitResolution,\n createStepperCommitHandler,\n} from './commit-handler';\n\nexport {\n provideCngxStepper,\n provideCngxStepperAt,\n type CngxStepperFeature,\n} from './provide-cngx-stepper';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAkDA;;;;;AAKG;AACG,SAAU,0BAA0B,CACxC,IAAqC,EAAA;AAErC,IAAA,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI;IAC3B,OAAO;QACL,YAAY,EAAE,UAAU,CAAC,YAAY;AAErC,QAAA,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAA;YACnD,UAAU,CAAC,KAAK,CACd,CAAC,QAAQ,KAAK,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,EACpE,OAAO,EACP,SAAS,EACT;AACE,gBAAA,SAAS,EAAE,MAAM,SAAS,CAAC,UAAU,CAAC;AACtC,gBAAA,OAAO,EAAE,MAAM,SAAS,CAAC,QAAQ,CAAC;AAClC,gBAAA,SAAS,EAAE,MAAM,SAAS,CAAC,SAAS,CAAC;AACtC,aAAA,CACF;QACH,CAAC;QAED,MAAM,GAAA;YACJ,UAAU,CAAC,MAAM,EAAE;QACrB,CAAC;KACF;AACH;AAEA;AACA,SAAS,gBAAgB,CACvB,MAA+B,EAC/B,SAAiB,EACjB,OAAe,EACf,QAIC,EAAA;IAED,IAAI,SAAS,GAAG,KAAK;IACrB,IAAI,WAAW,GAAwB,IAAI;AAE3C,IAAA,MAAM,WAAW,GAAG,CAAC,MAAe,KAAU;QAC5C,IAAI,SAAS,EAAE;YACb;QACF;QACA,IAAI,MAAM,EAAE;AACV,YAAA,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC;QAC7B;aAAO;YACL,QAAQ,CAAC,SAAS,EAAE;QACtB;AACF,IAAA,CAAC;AACD,IAAA,MAAM,SAAS,G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