@cngx/common 0.1.0-rc.8 → 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 (90) hide show
  1. package/a11y/README.md +15 -2
  2. package/button/README.md +258 -0
  3. package/command/README.md +42 -2
  4. package/data/README.md +15 -12
  5. package/fesm2022/cngx-common-a11y.mjs +1076 -319
  6. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  7. package/fesm2022/cngx-common-audio.mjs +99 -77
  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 +138 -78
  12. package/fesm2022/cngx-common-card.mjs.map +1 -1
  13. package/fesm2022/cngx-common-chart.mjs +799 -327
  14. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  15. package/fesm2022/cngx-common-command.mjs +101 -25
  16. package/fesm2022/cngx-common-command.mjs.map +1 -1
  17. package/fesm2022/cngx-common-data.mjs +861 -423
  18. package/fesm2022/cngx-common-data.mjs.map +1 -1
  19. package/fesm2022/cngx-common-dialog.mjs +198 -160
  20. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  21. package/fesm2022/cngx-common-display.mjs +693 -329
  22. package/fesm2022/cngx-common-display.mjs.map +1 -1
  23. package/fesm2022/cngx-common-interactive.mjs +7303 -2774
  24. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  25. package/fesm2022/cngx-common-layout.mjs +2174 -442
  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 +2109 -557
  30. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  31. package/fesm2022/cngx-common-stepper.mjs +548 -419
  32. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  33. package/fesm2022/cngx-common-tabs.mjs +442 -331
  34. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  35. package/fesm2022/cngx-common-timeline.mjs +44 -71
  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 +17 -1
  41. package/menu-button/README.md +234 -0
  42. package/package.json +31 -8
  43. package/popover/README.md +81 -4
  44. package/popover/tooltip-indicator.scss +52 -0
  45. package/schematics/collection.json +9 -0
  46. package/schematics/ng-add/index.js +9 -0
  47. package/schematics/ng-add/schema.json +96 -0
  48. package/schematics/package.json +3 -0
  49. package/stepper/README.md +5 -5
  50. package/theming/components/cngx-accordion.css +36 -7
  51. package/theming/components/cngx-async.css +185 -37
  52. package/theming/components/cngx-backdrop.css +3 -1
  53. package/theming/components/cngx-badge.css +20 -5
  54. package/theming/components/cngx-bottom-sheet.css +2 -0
  55. package/theming/components/cngx-breadcrumb.css +3 -1
  56. package/theming/components/cngx-button-group.css +325 -0
  57. package/theming/components/cngx-button-toggle.css +55 -23
  58. package/theming/components/cngx-button.css +975 -0
  59. package/theming/components/cngx-data-grid.css +2 -0
  60. package/theming/components/cngx-dialog.css +3 -1
  61. package/theming/components/cngx-divider.css +24 -9
  62. package/theming/components/cngx-drawer.css +153 -0
  63. package/theming/components/cngx-icon-glyph.css +76 -0
  64. package/theming/components/cngx-listbox.css +79 -25
  65. package/theming/components/cngx-menu.css +112 -52
  66. package/theming/components/cngx-nav.css +1220 -0
  67. package/theming/components/cngx-popover-sheet.css +434 -0
  68. package/theming/components/cngx-popover.css +37 -9
  69. package/theming/components/cngx-recycler-placeholder.css +2 -0
  70. package/theming/components/cngx-ripple.css +74 -16
  71. package/theming/components/cngx-sidebar.css +71 -0
  72. package/theming/components/cngx-slider.css +3 -1
  73. package/theming/components/cngx-tooltip.css +2 -0
  74. package/timeline/README.md +2 -2
  75. package/types/cngx-common-a11y.d.ts +488 -112
  76. package/types/cngx-common-audio.d.ts +60 -88
  77. package/types/cngx-common-button.d.ts +698 -0
  78. package/types/cngx-common-card.d.ts +104 -78
  79. package/types/cngx-common-chart.d.ts +677 -389
  80. package/types/cngx-common-command.d.ts +55 -41
  81. package/types/cngx-common-data.d.ts +506 -360
  82. package/types/cngx-common-dialog.d.ts +94 -127
  83. package/types/cngx-common-display.d.ts +475 -300
  84. package/types/cngx-common-interactive.d.ts +4383 -1721
  85. package/types/cngx-common-layout.d.ts +1399 -288
  86. package/types/cngx-common-menu-button.d.ts +382 -0
  87. package/types/cngx-common-popover.d.ts +990 -268
  88. package/types/cngx-common-stepper.d.ts +374 -465
  89. package/types/cngx-common-tabs.d.ts +309 -403
  90. package/types/cngx-common-timeline.d.ts +50 -109
@@ -1,24 +1,23 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, computed, makeEnvironmentProviders, model, input, signal, isDevMode, afterNextRender, Directive, TemplateRef, contentChild, DestroyRef, output, effect, untracked, ViewEncapsulation, ChangeDetectionStrategy, Component, ElementRef, afterEveryRender, afterRenderEffect } from '@angular/core';
3
- import { CNGX_COMMIT_CONTROLLER_FACTORY } from '@cngx/common/data';
2
+ import { InjectionToken, inject, computed, makeEnvironmentProviders, model, input, signal, afterNextRender, Directive, TemplateRef, contentChild, DestroyRef, output, effect, untracked, ViewEncapsulation, ChangeDetectionStrategy, Component, ElementRef, afterEveryRender, afterRenderEffect } from '@angular/core';
3
+ import { CNGX_COMMIT_CONTROLLER_FACTORY, createRefusedPhrase } from '@cngx/common/data';
4
4
  import { resolveStepFrom, resolveInlineStep, resolveBoundaryStep, injectDirection } from '@cngx/core';
5
- import { createNestedOverrideMerge, createOverrideMerge, createTransitionTracker, CNGX_STATEFUL, nextUid, coerceSignal, buildAsyncStateView } from '@cngx/core/utils';
5
+ import { createNestedOverrideMerge, createOverrideMerge, createTransitionTracker, createKeyedRegistry, CNGX_STATEFUL, nextUid, buildAsyncStateView } from '@cngx/core/utils';
6
+ import { CngxRuntimeError, recordEqual, cngxDevWarn, arrayEqual } from '@cngx/utils';
6
7
  import { isObservable } from 'rxjs';
7
- import { recordEqual } from '@cngx/utils';
8
8
  import { formatMessage, createNestedLanguageSection, createSectionBundle } from '@cngx/core/i18n';
9
9
  import { toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
10
- import { Router, NavigationEnd } from '@angular/router';
10
+ import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
11
11
  import { filter } from 'rxjs/operators';
12
- import { injectContainerSize, createResizeSignal } from '@cngx/common/layout';
12
+ import { injectContainerSize } from '@cngx/common/layout';
13
13
  import * as i1 from '@cngx/common/interactive';
14
- import { CngxAsyncClick } from '@cngx/common/interactive';
14
+ import { CNGX_ASYNC_RUN_STATE, CngxAsyncClick } from '@cngx/common/interactive';
15
15
 
16
16
  /**
17
17
  * Build a stepper commit handler over an existing {@link CngxCommitController}.
18
18
  * Resolves `Observable<boolean>` / `Promise<boolean>` / `boolean` returns into
19
- * a unified `accept: boolean` outcome.
20
- *
21
- * @category common/stepper
19
+ * one {@link CngxStepperCommitResolution}: `true` accepts, `false` refuses
20
+ * (the controller settles to `'idle'` and stores no error), a throw fails.
22
21
  */
23
22
  function createStepperCommitHandler(opts) {
24
23
  const { controller } = opts;
@@ -26,8 +25,9 @@ function createStepperCommitHandler(opts) {
26
25
  isCommitting: controller.isCommitting,
27
26
  beginTransition(fromIndex, toIndex, action, onResolve) {
28
27
  controller.begin((handlers) => runStepperAction(action, fromIndex, toIndex, handlers), toIndex, fromIndex, {
29
- onSuccess: () => onResolve(true),
30
- onError: () => onResolve(false),
28
+ onSuccess: () => onResolve('accepted'),
29
+ onError: () => onResolve('failed'),
30
+ onRefused: () => onResolve('refused'),
31
31
  });
32
32
  },
33
33
  cancel() {
@@ -47,7 +47,7 @@ function runStepperAction(action, fromIndex, toIndex, handlers) {
47
47
  handlers.onSuccess(toIndex);
48
48
  }
49
49
  else {
50
- handlers.onError(new Error('Stepper transition refused by commitAction'));
50
+ handlers.onRefused();
51
51
  }
52
52
  };
53
53
  const safeError = (err) => {
@@ -96,7 +96,9 @@ function runStepperAction(action, fromIndex, toIndex, handlers) {
96
96
  // EMPTY-style sources complete without emitting; without this arm
97
97
  // the commit stays 'pending' forever and busy() latches true.
98
98
  if (!done) {
99
- safeError(new Error('Stepper commitAction completed without emitting'));
99
+ safeError(new CngxRuntimeError('CNGX1059', typeof ngDevMode !== 'undefined' &&
100
+ ngDevMode &&
101
+ '[cngxStepper] commitAction completed without emitting true or false.'));
100
102
  }
101
103
  },
102
104
  });
@@ -124,9 +126,8 @@ function runStepperAction(action, fromIndex, toIndex, handlers) {
124
126
  * DI token carrying the factory the presenter uses to allocate its commit
125
127
  * handler. Symmetric to the select family's `CNGX_ARRAY_COMMIT_HANDLER_FACTORY`.
126
128
  *
127
- * @category common/stepper
128
129
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/commit-handler.ts
129
- * @since 0.1.0
130
+ * @since 0.3.0
130
131
  */
131
132
  const CNGX_STEPPER_COMMIT_HANDLER_FACTORY = new InjectionToken('CngxStepperCommitHandlerFactory', {
132
133
  providedIn: 'root',
@@ -137,12 +138,10 @@ const CNGX_STEPPER_COMMIT_HANDLER_FACTORY = new InjectionToken('CngxStepperCommi
137
138
  * The English stepper section: the single source of the stepper's English
138
139
  * copy. `CNGX_STEPPER_I18N` and the `CNGX_STEPPER_CONFIG` labels default to it.
139
140
  *
140
- * @category common/stepper/i18n
141
- * @since 0.1.0
141
+ * @since 0.3.0
142
142
  * @relatedTo CNGX_STEPPER_I18N
143
143
  */
144
144
  const CNGX_STEPPER_LANGUAGE_EN = {
145
- stepperRegion: 'Steps',
146
145
  stepperLabel: 'Steps',
147
146
  stepRoleDescription: 'stepper',
148
147
  stepIndicatorRoleDescription: 'step indicator',
@@ -156,11 +155,15 @@ const CNGX_STEPPER_LANGUAGE_EN = {
156
155
  commitInFlight: 'Saving step…',
157
156
  commitRolledBackTo: 'Reverted to step "{origin}".',
158
157
  stepRolledBack: '{base} This step was rolled back.',
158
+ commitRefused: 'Step change not allowed - stayed on step "{origin}".',
159
+ commitRefusedGeneric: 'Step change not allowed.',
160
+ stepRefused: '{base} This step change was not allowed.',
159
161
  statusLabels: {
160
162
  done: 'Done',
161
163
  inProgress: 'In progress',
162
164
  upNext: 'Up next',
163
165
  errored: 'Errored',
166
+ refused: 'Not allowed',
164
167
  },
165
168
  textStepperFormat: 'Step {current} of {count}',
166
169
  groupSummaryCount: { one: '{count} step', other: '{count} steps' },
@@ -188,6 +191,9 @@ function stepperBundleFrom(section, locale) {
188
191
  commitInFlight: section.commitInFlight,
189
192
  commitRolledBackTo: (origin) => formatMessage(section.commitRolledBackTo, { origin }, locale),
190
193
  stepRolledBack: (base) => formatMessage(section.stepRolledBack, { base }, locale),
194
+ commitRefused: (origin) => formatMessage(section.commitRefused, { origin }, locale),
195
+ commitRefusedGeneric: section.commitRefusedGeneric,
196
+ stepRefused: (base) => formatMessage(section.stepRefused, { base }, locale),
191
197
  statusLabels: section.statusLabels,
192
198
  textStepperFormat: (current, count) => formatMessage(section.textStepperFormat, { current, count }, locale),
193
199
  groupSummaryCount: (count) => formatMessage(section.groupSummaryCount, { count }, locale),
@@ -216,10 +222,9 @@ const stepperBundle = createSectionBundle({
216
222
  * {@link provideStepperI18n}; a `{ provide, useValue }` entry must supply a
217
223
  * `Signal<CngxStepperI18n>`.
218
224
  *
219
- * @category common/stepper/i18n
220
225
  * @wcag AA
221
226
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/i18n/stepper-i18n.ts
222
- * @since 0.1.0
227
+ * @since 0.3.0
223
228
  */
224
229
  const CNGX_STEPPER_I18N = new InjectionToken('CngxStepperI18n', {
225
230
  providedIn: 'root',
@@ -239,9 +244,7 @@ function defineStepperI18nFeature(fn) {
239
244
  * the language pack's copy, or the English default. {@link CngxStepperStatusLabels} is merged
240
245
  * key-by-key so consumers can override one pill label without
241
246
  * restating the rest. Pass a `Signal` to switch the language at runtime.
242
- * Sibling of `withStepperAriaLabels` / `withStepperFallbackLabels`.
243
- *
244
- * @category common/stepper/i18n
247
+ * Sibling of `withStepperFallbackLabels`.
245
248
  */
246
249
  function withStepperI18nLabels(overrides) {
247
250
  return defineStepperI18nFeature((bundle) => createNestedOverrideMerge(bundle, overrides, 'statusLabels'));
@@ -255,13 +258,11 @@ function withStepperI18nLabels(overrides) {
255
258
  * bootstrapApplication(AppComponent, {
256
259
  * providers: [
257
260
  * provideStepperI18n(
258
- * withStepperI18nLabels({ stepperLabel: 'Schrittfolge', previousStep: 'Vorheriger' }),
261
+ * withStepperI18nLabels({ stepperLabel: 'Bestellschritte', previousStep: 'Vorheriger' }),
259
262
  * ),
260
263
  * ],
261
264
  * });
262
265
  * ```
263
- *
264
- * @category common/stepper/i18n
265
266
  */
266
267
  function provideStepperI18n(...features) {
267
268
  return {
@@ -273,25 +274,11 @@ function provideStepperI18n(...features) {
273
274
  * Inject the resolved stepper i18n bundle in an injection context. Read it
274
275
  * inside a `computed()`, template or handler so a language switch reaches
275
276
  * the label.
276
- *
277
- * @category common/stepper/i18n
278
277
  */
279
278
  function injectStepperI18n() {
280
279
  return stepperBundle.resolve(inject(CNGX_STEPPER_I18N));
281
280
  }
282
281
 
283
- /**
284
- * Default per-step px thresholds for the `density: 'auto'` ladder. The
285
- * literal lives on a single exported const so the runtime resolver, the
286
- * config default, and any JSDoc cross-references stay in lockstep.
287
- * Consumers override via {@link withStepperDensity}'s second argument.
288
- *
289
- * @category common/stepper
290
- */
291
- const STEPPER_DEFAULT_DENSITY_BREAKPOINTS = {
292
- compact: 120,
293
- minimal: 64,
294
- };
295
282
  /** @internal */
296
283
  const STEPPER_CONFIG_DEFAULTS = {
297
284
  defaultOrientation: 'horizontal',
@@ -304,14 +291,10 @@ const STEPPER_CONFIG_DEFAULTS = {
304
291
  groupCollapse: 'off',
305
292
  groupCollapseSummary: 'progress',
306
293
  density: 'comfortable',
307
- densityBreakpoints: STEPPER_DEFAULT_DENSITY_BREAKPOINTS,
308
294
  connectors: false,
309
295
  mobileCollapse: 'text',
310
296
  mobileIndicatorPosition: 'top',
311
297
  mobileSwipe: true,
312
- ariaLabels: {
313
- stepperRegion: CNGX_STEPPER_LANGUAGE_EN.stepperRegion,
314
- },
315
298
  fallbackLabels: {
316
299
  groupRoleDescription: CNGX_STEPPER_LANGUAGE_EN.groupRoleDescription,
317
300
  stepRoleDescription: CNGX_STEPPER_LANGUAGE_EN.stepRoleDescription,
@@ -325,10 +308,9 @@ const NO_LABELS = {};
325
308
  * library defaults; override via {@link provideStepperConfig} (root)
326
309
  * or {@link provideStepperConfigAt} (component scope).
327
310
  *
328
- * @category common/stepper
329
311
  * @wcag AA
330
312
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/stepper-config.ts
331
- * @since 0.1.0
313
+ * @since 0.3.0
332
314
  */
333
315
  const CNGX_STEPPER_CONFIG = new InjectionToken('CngxStepperConfig', {
334
316
  providedIn: 'root',
@@ -346,8 +328,6 @@ function defineStepperConfigFeature(fn) {
346
328
  /**
347
329
  * Override the default orientation. Per-instance `[orientation]`
348
330
  * Input still wins; this only moves the cascade default.
349
- *
350
- * @category common/stepper
351
331
  */
352
332
  function withStepperDefaultOrientation(orientation) {
353
333
  return defineStepperConfigFeature((cfg) => ({
@@ -358,8 +338,6 @@ function withStepperDefaultOrientation(orientation) {
358
338
  /**
359
339
  * Override the default linear-progression setting. Per-instance
360
340
  * `[linear]` Input still wins.
361
- *
362
- * @category common/stepper
363
341
  */
364
342
  function withStepperLinear(linear) {
365
343
  return defineStepperConfigFeature((cfg) => ({ ...cfg, defaultLinear: linear }));
@@ -369,8 +347,6 @@ function withStepperLinear(linear) {
369
347
  * `'optimistic'` advances on action dispatch and rolls back on error;
370
348
  * `'pessimistic'` waits for success. Per-instance `[commitMode]`
371
349
  * Input still wins.
372
- *
373
- * @category common/stepper
374
350
  */
375
351
  function withStepperCommitMode(mode) {
376
352
  return defineStepperConfigFeature((cfg) => ({
@@ -382,8 +358,6 @@ function withStepperCommitMode(mode) {
382
358
  * Configure router synchronisation for the active step. `mode` chooses
383
359
  * the URL surface (URL fragment or query parameter); `param` names the
384
360
  * key (default `'step'`).
385
- *
386
- * @category common/stepper
387
361
  */
388
362
  function withStepperRouterSync(mode, param = 'step') {
389
363
  return defineStepperConfigFeature((cfg) => ({
@@ -398,8 +372,6 @@ function withStepperRouterSync(mode, param = 'step') {
398
372
  * moves the cascade default. Structure, slots, ARIA, and keyboard
399
373
  * behaviour are identical across skins - only the `[data-skin]` host
400
374
  * attribute changes the CSS layer that paints the strip.
401
- *
402
- * @category common/stepper
403
375
  */
404
376
  function withStepperSkin(skin) {
405
377
  return defineStepperConfigFeature((cfg) => ({ ...cfg, skin }));
@@ -412,8 +384,6 @@ function withStepperSkin(skin) {
412
384
  * `[data-skin='classic']`; the four other skins each ship their own
413
385
  * inter-step decoration and ignore this flag. Per-instance
414
386
  * `[connectors]` Input still wins.
415
- *
416
- * @category common/stepper
417
387
  */
418
388
  function withStepperConnectors(on) {
419
389
  return defineStepperConfigFeature((cfg) => ({ ...cfg, connectors: on }));
@@ -425,8 +395,6 @@ function withStepperConnectors(on) {
425
395
  * `<cngx-text-stepper>`, `'dots'` renders `<cngx-dot-stepper>`, `'off'`
426
396
  * keeps the classic strip. The Material twin `<cngx-mat-stepper>` ignores
427
397
  * this setting.
428
- *
429
- * @category common/stepper
430
398
  */
431
399
  function withStepperMobileCollapse(mode) {
432
400
  return defineStepperConfigFeature((cfg) => ({ ...cfg, mobileCollapse: mode }));
@@ -438,8 +406,6 @@ function withStepperMobileCollapse(mode) {
438
406
  * reads first and the navigation cue sits at thumb height. Per-
439
407
  * instance `[mobileIndicatorPosition]` on `<cngx-stepper>` still
440
408
  * wins.
441
- *
442
- * @category common/stepper
443
409
  */
444
410
  function withStepperMobileIndicatorPosition(position) {
445
411
  return defineStepperConfigFeature((cfg) => ({ ...cfg, mobileIndicatorPosition: position }));
@@ -449,8 +415,6 @@ function withStepperMobileIndicatorPosition(position) {
449
415
  * in mobile-collapse mode. Default `true` - the `'dots'` and `'text'`
450
416
  * variants read as carousels, so users expect to swipe. Per-instance
451
417
  * `[mobileSwipe]` Input still wins; the classic strip is unaffected.
452
- *
453
- * @category common/stepper
454
418
  */
455
419
  function withStepperMobileSwipe(enabled) {
456
420
  return defineStepperConfigFeature((cfg) => ({ ...cfg, mobileSwipe: enabled }));
@@ -461,8 +425,6 @@ function withStepperMobileSwipe(enabled) {
461
425
  * navigation); `'visited'` (library default) keeps the headers as
462
426
  * focusable buttons whose reachability folds into the `linear` axis.
463
427
  * Per-instance `[headerNavigation]` Input still wins.
464
- *
465
- * @category common/stepper
466
428
  */
467
429
  function withStepperHeaderNavigation(mode) {
468
430
  return defineStepperConfigFeature((cfg) => ({ ...cfg, headerNavigation: mode }));
@@ -474,8 +436,6 @@ function withStepperHeaderNavigation(mode) {
474
436
  * holding the active step; `'off'` (library default) keeps the full
475
437
  * strip. Orthogonal to the `mobileCollapse` axis. The Material twin
476
438
  * ignores this setting.
477
- *
478
- * @category common/stepper
479
439
  */
480
440
  function withStepperGroupCollapse(mode) {
481
441
  return defineStepperConfigFeature((cfg) => ({ ...cfg, groupCollapse: mode }));
@@ -486,50 +446,27 @@ function withStepperGroupCollapse(mode) {
486
446
  * shows completed/total steps; `'count'` the step count; `'status'` a
487
447
  * status dot coloured by the group's rolled-up state; `'off'` the bare
488
448
  * label. No effect unless `groupCollapse` is `'expand-active'`.
489
- *
490
- * @category common/stepper
491
449
  */
492
450
  function withStepperGroupCollapseSummary(mode) {
493
451
  return defineStepperConfigFeature((cfg) => ({ ...cfg, groupCollapseSummary: mode }));
494
452
  }
495
453
  /**
496
454
  * Set the app-wide space-driven density policy for the classic
497
- * `<cngx-stepper>` strip. `'auto'` degrades labels on the strip's own
498
- * container width (full -> compact -> minimal); `'comfortable'`
499
- * (library default) keeps full labels at every width. The optional
500
- * second argument overrides the per-step px thresholds (default
501
- * {@link STEPPER_DEFAULT_DENSITY_BREAKPOINTS}). Orthogonal to the
502
- * `mobileCollapse` axis; the Material twin ignores this setting.
503
- *
504
- * @category common/stepper
455
+ * `<cngx-stepper>` strip. `'auto'` sets `[data-density-auto]`, under
456
+ * which the labels shrink in flow within a cqi budget (the step furthest
457
+ * from the active one gives way first) instead of overflowing the strip;
458
+ * `'comfortable'` (library default) keeps full labels at every width.
459
+ * Orthogonal to the `mobileCollapse` axis; the Material twin ignores this
460
+ * setting.
505
461
  */
506
- function withStepperDensity(mode, breakpoints) {
507
- return defineStepperConfigFeature((cfg) => ({
508
- ...cfg,
509
- density: mode,
510
- ...(breakpoints ? { densityBreakpoints: breakpoints } : {}),
511
- }));
512
- }
513
- /**
514
- * Merge ARIA labels into the cascade. Keys not provided keep their
515
- * library defaults; per-instance overrides on the stepper still win.
516
- * Pass a `Signal` to switch the language at runtime.
517
- *
518
- * @category common/stepper
519
- */
520
- function withStepperAriaLabels(labels) {
521
- return defineStepperConfigFeature((cfg) => ({
522
- ...cfg,
523
- ariaLabels: createOverrideMerge(cfg.ariaLabels ?? NO_LABELS, labels),
524
- }));
462
+ function withStepperDensity(mode) {
463
+ return defineStepperConfigFeature((cfg) => ({ ...cfg, density: mode }));
525
464
  }
526
465
  /**
527
466
  * Merge fallback role descriptions (`groupRoleDescription` /
528
467
  * `stepRoleDescription`) into the cascade. These feed the strip's
529
468
  * `aria-roledescription` attributes when the consumer supplies none.
530
469
  * Pass a `Signal` to switch the language at runtime.
531
- *
532
- * @category common/stepper
533
470
  */
534
471
  function withStepperFallbackLabels(labels) {
535
472
  return defineStepperConfigFeature((cfg) => ({
@@ -541,8 +478,6 @@ function withStepperFallbackLabels(labels) {
541
478
  * Override the default `*cngxStepIndicator` template app-wide.
542
479
  * Per-instance directive still wins; this only moves the cascade
543
480
  * middle tier.
544
- *
545
- * @category common/stepper
546
481
  */
547
482
  function withStepIndicatorTemplate(template) {
548
483
  return defineStepperConfigFeature((cfg) => ({
@@ -552,8 +487,6 @@ function withStepIndicatorTemplate(template) {
552
487
  }
553
488
  /**
554
489
  * Override the default `*cngxStepBadge` template app-wide.
555
- *
556
- * @category common/stepper
557
490
  */
558
491
  function withStepBadgeTemplate(template) {
559
492
  return defineStepperConfigFeature((cfg) => ({
@@ -563,8 +496,6 @@ function withStepBadgeTemplate(template) {
563
496
  }
564
497
  /**
565
498
  * Override the default `*cngxStepBusySpinner` template app-wide.
566
- *
567
- * @category common/stepper
568
499
  */
569
500
  function withStepBusySpinnerTemplate(template) {
570
501
  return defineStepperConfigFeature((cfg) => ({
@@ -575,8 +506,6 @@ function withStepBusySpinnerTemplate(template) {
575
506
  /**
576
507
  * Override the default `*cngxStepRejection` template app-wide.
577
508
  * Symmetric with the upcoming tabs `cngxTabRejectionIcon` (Phase 4).
578
- *
579
- * @category common/stepper
580
509
  */
581
510
  function withStepRejectionTemplate(template) {
582
511
  return defineStepperConfigFeature((cfg) => ({
@@ -589,8 +518,6 @@ function withStepRejectionTemplate(template) {
589
518
  * renders the per-step validation reason on the skins with a label area
590
519
  * (classic / stripe-status-rich). Per-instance directive still wins;
591
520
  * this moves the cascade middle tier.
592
- *
593
- * @category common/stepper
594
521
  */
595
522
  function withStepErrorTemplate(template) {
596
523
  return defineStepperConfigFeature((cfg) => ({
@@ -600,8 +527,6 @@ function withStepErrorTemplate(template) {
600
527
  }
601
528
  /**
602
529
  * Override the default `*cngxStepGroupHeader` template app-wide.
603
- *
604
- * @category common/stepper
605
530
  */
606
531
  function withStepGroupHeaderTemplate(template) {
607
532
  return defineStepperConfigFeature((cfg) => ({
@@ -611,8 +536,6 @@ function withStepGroupHeaderTemplate(template) {
611
536
  }
612
537
  /**
613
538
  * Override the default `*cngxStepperEmpty` template app-wide.
614
- *
615
- * @category common/stepper
616
539
  */
617
540
  function withStepperEmptyTemplate(template) {
618
541
  return defineStepperConfigFeature((cfg) => ({
@@ -621,12 +544,11 @@ function withStepperEmptyTemplate(template) {
621
544
  }));
622
545
  }
623
546
  /**
624
- * Override the default `*cngxDotStepperDot` template app-wide. The
625
- * `<cngx-dot-stepper>` variant resolves the cascade per dot:
626
- * per-instance directive > this feature > built-in empty body
627
- * (the dot fill is painted by `.cngx-dot-stepper__dot` regardless).
628
- *
629
- * @category common/stepper
547
+ * Override the default `*cngxDotStepperDot` template app-wide. Both dot
548
+ * hosts resolve the cascade per dot - `<cngx-dot-stepper>` and the dots
549
+ * mobile-collapse branch of `<cngx-stepper>`: per-instance directive >
550
+ * this feature > built-in empty body (the dot fill is painted by the dot
551
+ * element's CSS regardless).
630
552
  */
631
553
  function withDotStepperDotTemplate(template) {
632
554
  return defineStepperConfigFeature((cfg) => ({
@@ -642,9 +564,6 @@ function stepperConfigDefaultsFromPack() {
642
564
  const language = injectStepperLanguage();
643
565
  return {
644
566
  ...STEPPER_CONFIG_DEFAULTS,
645
- ariaLabels: computed(() => ({ stepperRegion: language().stepperRegion }), {
646
- equal: recordEqual,
647
- }),
648
567
  fallbackLabels: computed(() => ({
649
568
  groupRoleDescription: language().groupRoleDescription,
650
569
  stepRoleDescription: language().stepRoleDescription,
@@ -659,8 +578,6 @@ function resolveFeatures(features) {
659
578
  * Root-level provider for the stepper config. Apply once in the
660
579
  * application providers array. Sibling of `provideTabsConfig` /
661
580
  * `provideSelectConfig`.
662
- *
663
- * @category common/stepper
664
581
  */
665
582
  function provideStepperConfig(...features) {
666
583
  return makeEnvironmentProviders([
@@ -681,16 +598,12 @@ function provideStepperConfig(...features) {
681
598
  * viewProviders: [...provideStepperConfigAt(withStepperLinear(true))],
682
599
  * })
683
600
  * ```
684
- *
685
- * @category common/stepper
686
601
  */
687
602
  function provideStepperConfigAt(...features) {
688
603
  return [{ provide: CNGX_STEPPER_CONFIG, useFactory: () => resolveFeatures(features) }];
689
604
  }
690
605
  /**
691
606
  * Inject the resolved stepper config in an injection context.
692
- *
693
- * @category common/stepper
694
607
  */
695
608
  function injectStepperConfig() {
696
609
  return inject(CNGX_STEPPER_CONFIG);
@@ -701,12 +614,30 @@ function injectStepperConfig() {
701
614
  * Atoms inject `optional: true` and either register here or fall through
702
615
  * {@link CNGX_STEP_GROUP_HOST} when nested in a group.
703
616
  *
704
- * @category common/stepper
705
617
  * @wcag AA
706
618
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/stepper-host.token.ts
707
- * @since 0.1.0
619
+ * @since 0.3.0
708
620
  */
709
621
  const CNGX_STEPPER_HOST = new InjectionToken('CngxStepperHost');
622
+ /**
623
+ * Inject the {@link CNGX_STEPPER_HOST} for a stepper add-on directive.
624
+ * Throws a `CngxRuntimeError` with code `CNGX1055` when no stepper presenter
625
+ * is found, in development and production alike. With `host: true` the
626
+ * lookup stops at the declaring template's host, so the presenter has to sit
627
+ * on the same element or an ancestor in the same template. `selector` names
628
+ * the add-on in the development message.
629
+ *
630
+ * @internal
631
+ */
632
+ function injectStepperHost(selector, options) {
633
+ const stepper = inject(CNGX_STEPPER_HOST, { host: options.host, optional: true });
634
+ if (!stepper) {
635
+ throw new CngxRuntimeError('CNGX1055', typeof ngDevMode !== 'undefined' &&
636
+ ngDevMode &&
637
+ `[${selector}] must be placed on or inside an element with [cngxStepper], such as <cngx-stepper>.`);
638
+ }
639
+ return stepper;
640
+ }
710
641
 
711
642
  /**
712
643
  * DFS-flatten a step tree. Group nodes emit before their children;
@@ -771,8 +702,6 @@ function stepTreeEqual(a, b) {
771
702
  * @internal Exported from `public-api.ts` so the cngx-stepper and
772
703
  * cngx-mat-stepper organisms share the comparator across the
773
704
  * secondary-entry boundary (Sheriff forbids deep-relative imports).
774
- *
775
- * @category common/stepper
776
705
  */
777
706
  function flatStepsEqual(a, b) {
778
707
  if (a === b) {
@@ -803,25 +732,49 @@ function flatStepsEqual(a, b) {
803
732
  * Sheriff: common Level 2. Pure directive - zero template, zero CSS.
804
733
  * Level-4 organisms compose this via `hostDirectives`.
805
734
  *
806
- * @category common/stepper
807
- * @docsKind primary
808
735
  * @wcag AA
809
736
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/presenter.directive.ts
810
- * @since 0.1.0
737
+ * @since 0.3.0
811
738
  * @relatedTo CngxStep, CngxStepGroup, CngxStepperRouterSync, CNGX_STEPPER_HOST, CNGX_STEPPER_CONFIG
812
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-commit-action/pessimistic-optimistic-commits-with-bridge-directives</example-url>
739
+ * <example-url>/#/ui/stepper/stepper-commit-action/pessimistic-optimistic-commits-with-bridge-directives</example-url>
813
740
  */
814
741
  class CngxStepperPresenter {
815
742
  config = injectStepperConfig();
743
+ /**
744
+ * Zero-based index of the active step among the steps only (group nodes do not count), two-way bindable
745
+ * as `[(activeStepIndex)]`. Defaults to `0`. The presenter writes it on navigation, so under a
746
+ * `commitAction` in `'pessimistic'` mode it changes only after the action resolves `true`; reads are
747
+ * clamped to the registered step count.
748
+ */
816
749
  activeStepIndex = model(0, ...(ngDevMode ? [{ debugName: "activeStepIndex" }] : /* istanbul ignore next */ []));
817
750
  // Raw *Input slots default undefined so the cascade resolves through
818
751
  // CNGX_STEPPER_CONFIG. Must stay public - the template type-checker
819
752
  // rejects protected/private on hostDirective alias bindings.
753
+ /**
754
+ * Binding `[linear]`: when `true`, moving forward is refused while any enabled step from the active
755
+ * one up to the target is not in the `'success'` state. Unset, it resolves through `defaultLinear` of the stepper config and then
756
+ * `false`.
757
+ */
820
758
  linearInput = input(undefined, { ...(ngDevMode ? { debugName: "linearInput" } : /* istanbul ignore next */ {}), alias: 'linear' });
821
759
  linear = computed(() => this.linearInput() ?? this.config.defaultLinear ?? false, ...(ngDevMode ? [{ debugName: "linear" }] : /* istanbul ignore next */ []));
760
+ /**
761
+ * Binding `[orientation]`: layout axis of the stepper, `'horizontal'` or `'vertical'`. Unset, it resolves
762
+ * through `defaultOrientation` of the stepper config and then `'horizontal'`. The organism mirrors the
763
+ * resolved value to `aria-orientation` and `data-orientation`.
764
+ */
822
765
  orientationInput = input(undefined, { ...(ngDevMode ? { debugName: "orientationInput" } : /* istanbul ignore next */ {}), alias: 'orientation' });
823
766
  orientation = computed(() => this.orientationInput() ?? this.config.defaultOrientation ?? 'horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
767
+ /**
768
+ * Async guard run before a step change: it receives the origin and target index and resolves `true` to
769
+ * advance or `false` to refuse. Defaults to `null`, which makes every `select` a synchronous move.
770
+ * Navigating back with `selectPrevious` bypasses it.
771
+ */
824
772
  commitAction = input(null, ...(ngDevMode ? [{ debugName: "commitAction" }] : /* istanbul ignore next */ []));
773
+ /**
774
+ * Binding `[commitMode]`: whether `activeStepIndex` moves to the target before the `commitAction` resolves
775
+ * (`'optimistic'`, rolled back on refusal or failure) or only after it resolves `true` (`'pessimistic'`).
776
+ * Unset, it resolves through `defaultCommitMode` of the stepper config and then `'pessimistic'`.
777
+ */
825
778
  commitModeInput = input(undefined, { ...(ngDevMode ? { debugName: "commitModeInput" } : /* istanbul ignore next */ {}), alias: 'commitMode' });
826
779
  commitMode = computed(() => this.commitModeInput() ?? this.config.defaultCommitMode ?? 'pessimistic', ...(ngDevMode ? [{ debugName: "commitMode" }] : /* istanbul ignore next */ []));
827
780
  genericFactory = inject(CNGX_COMMIT_CONTROLLER_FACTORY);
@@ -842,9 +795,16 @@ class CngxStepperPresenter {
842
795
  * `linkedSignal` is shared across all consumers.
843
796
  */
844
797
  commitTransition = createTransitionTracker(() => this.commitController.state.status());
845
- // Persistence-of-error surface - see CngxStepperHost.lastFailedIndex
846
- // / originIndexDuringCommit for the contract.
847
- lastFailedIndexState = signal(undefined, ...(ngDevMode ? [{ debugName: "lastFailedIndexState" }] : /* istanbul ignore next */ []));
798
+ // Persistence-of-rejection surface - see CngxStepperHost.lastOutcome /
799
+ // lastFailedIndex / originIndexDuringCommit for the contract. Two
800
+ // event sources, never synced: the settle record and the sequence whose
801
+ // visual marker was cleared. lastFailedIndex derives from both, so
802
+ // clearing the marker never touches the announcement record.
803
+ lastOutcomeState = signal(undefined, ...(ngDevMode ? [{ debugName: "lastOutcomeState" }] : /* istanbul ignore next */ []));
804
+ clearedSequenceState = signal(undefined, ...(ngDevMode ? [{ debugName: "clearedSequenceState" }] : /* istanbul ignore next */ []));
805
+ // Bumped once per settled refusal or failure. Plain field - only read
806
+ // inside the resolve handler.
807
+ outcomeSequence = 0;
848
808
  // Last index a commit actually landed on (or a sync/back move settled
849
809
  // on). Rollback + origin resolution use this instead of the per-call
850
810
  // `previous`: a rapid second select() supersedes the first while
@@ -853,8 +813,13 @@ class CngxStepperPresenter {
853
813
  // read only inside handlers, never rendered.
854
814
  lastCommittedIndex;
855
815
  originIndexDuringCommitState = signal(undefined, ...(ngDevMode ? [{ debugName: "originIndexDuringCommitState" }] : /* istanbul ignore next */ []));
816
+ /** {@inheritDoc CngxStepperHost.lastOutcome} */
817
+ lastOutcome = this.lastOutcomeState.asReadonly();
856
818
  /** {@inheritDoc CngxStepperHost.lastFailedIndex} */
857
- lastFailedIndex = this.lastFailedIndexState.asReadonly();
819
+ lastFailedIndex = computed(() => {
820
+ const outcome = this.lastOutcomeState();
821
+ return outcome && outcome.sequence !== this.clearedSequenceState() ? outcome.index : undefined;
822
+ }, ...(ngDevMode ? [{ debugName: "lastFailedIndex" }] : /* istanbul ignore next */ []));
858
823
  /** {@inheritDoc CngxStepperHost.originIndexDuringCommit} */
859
824
  originIndexDuringCommit = this.originIndexDuringCommitState.asReadonly();
860
825
  treeState = signal([], { ...(ngDevMode ? { debugName: "treeState" } : /* istanbul ignore next */ {}), equal: stepTreeEqual });
@@ -988,18 +953,23 @@ class CngxStepperPresenter {
988
953
  }, ...(ngDevMode ? [{ debugName: "canGoNext" }] : /* istanbul ignore next */ []));
989
954
  /** {@inheritDoc CngxStepperHost.canGoPrevious} */
990
955
  canGoPrevious = computed(() => this.previousEnabledIndex() >= 0, ...(ngDevMode ? [{ debugName: "canGoPrevious" }] : /* istanbul ignore next */ []));
956
+ // Runs outside the commit (the finish run) that hold the stepper busy.
957
+ busySources = createKeyedRegistry({
958
+ name: 'CngxStepperPresenter',
959
+ });
991
960
  /** {@inheritDoc CngxStepperHost.busy} */
992
- busy = computed(() => this.commitState.status() === 'pending', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
961
+ busy = computed(() => this.commitState.status() === 'pending' ||
962
+ this.busySources.values().some((pending) => pending()), ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
993
963
  /** {@inheritDoc CngxStepperHost.nextStepLabel} */
994
964
  nextStepLabel = computed(() => this.stepsOnly()[this.nextEnabledIndex()]?.label(), ...(ngDevMode ? [{ debugName: "nextStepLabel" }] : /* istanbul ignore next */ []));
995
965
  /** {@inheritDoc CngxStepperHost.previousStepLabel} */
996
966
  previousStepLabel = computed(() => this.stepsOnly()[this.previousEnabledIndex()]?.label(), ...(ngDevMode ? [{ debugName: "previousStepLabel" }] : /* istanbul ignore next */ []));
997
967
  constructor() {
998
- if (isDevMode()) {
968
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
999
969
  afterNextRender(() => {
1000
970
  const stepNodes = this.flatSteps().filter((n) => n.kind === 'step');
1001
971
  if (stepNodes.length > 6 && stepNodes.every((n) => n.parentId === null)) {
1002
- console.warn('[cngx-stepper] more than 6 steps at the same depth; consider wrapping logical groups in <cngx-step-group> for better UX');
972
+ cngxDevWarn('CNGX1039', '[cngxStepper] more than 6 steps and none inside a [cngxStepGroup]; consider wrapping logical groups of steps in [cngxStepGroup] for better UX');
1003
973
  }
1004
974
  });
1005
975
  }
@@ -1008,6 +978,12 @@ class CngxStepperPresenter {
1008
978
  // register/unregister.
1009
979
  registry = new Map();
1010
980
  insertionOrder = [];
981
+ /**
982
+ * `CngxStepperHost` contract, called by `CngxStep` and `CngxStepGroup` in their `ngOnInit`, or by a
983
+ * `CngxStepGroup` on behalf of a nested child with its own id as `parentId`. Adds the node to the step
984
+ * tree in registration order; a second call with a known id replaces the stored handle and keeps its
985
+ * position. A group must register before its children.
986
+ */
1011
987
  register(handle, parentId = null) {
1012
988
  if (this.registry.has(handle.id)) {
1013
989
  // Idempotent re-register - replace the handle, keep the ordering slot.
@@ -1027,6 +1003,16 @@ class CngxStepperPresenter {
1027
1003
  }
1028
1004
  this.rebuildTree();
1029
1005
  }
1006
+ /** {@inheritDoc CngxStepperHost.registerBusy} */
1007
+ registerBusy(key, pending) {
1008
+ this.busySources.register(key, pending);
1009
+ return () => this.busySources.unregister(key, pending);
1010
+ }
1011
+ /**
1012
+ * `CngxStepperHost` contract, called from the destroy hook of `CngxStep` and `CngxStepGroup`. Removes the
1013
+ * node from the step tree; when `handle` is passed and is no longer the stored one (it was replaced by a
1014
+ * re-register), the call does nothing.
1015
+ */
1030
1016
  unregister(id, handle) {
1031
1017
  const entry = this.registry.get(id);
1032
1018
  if (!entry) {
@@ -1073,7 +1059,7 @@ class CngxStepperPresenter {
1073
1059
  }
1074
1060
  /** {@inheritDoc CngxStepperHost.clearLastFailed} */
1075
1061
  clearLastFailed() {
1076
- this.lastFailedIndexState.set(undefined);
1062
+ this.clearedSequenceState.set(this.lastOutcomeState()?.sequence);
1077
1063
  }
1078
1064
  /**
1079
1065
  * Linear-gate predicate: `true` when linear mode forbids advancing to
@@ -1109,6 +1095,11 @@ class CngxStepperPresenter {
1109
1095
  }
1110
1096
  return !this.isLinearBlocked(index);
1111
1097
  }
1098
+ /**
1099
+ * Moves to the step at the given step-only index, clamped to the registered range. Does nothing when the
1100
+ * target is the active step, is disabled, or is blocked by `linear`. Without a `commitAction` the move is
1101
+ * synchronous; with one, the move follows `commitMode`, and a newer call supersedes the pending one.
1102
+ */
1112
1103
  select(index) {
1113
1104
  const stepsOnly = this.stepsOnly();
1114
1105
  if (stepsOnly.length === 0) {
@@ -1132,8 +1123,8 @@ class CngxStepperPresenter {
1132
1123
  // flag if the user re-picked a previously-failed target.
1133
1124
  this.activeStepIndex.set(target);
1134
1125
  this.lastCommittedIndex = target;
1135
- if (this.lastFailedIndexState() === target) {
1136
- this.lastFailedIndexState.set(undefined);
1126
+ if (this.lastFailedIndex() === target) {
1127
+ this.clearLastFailed();
1137
1128
  }
1138
1129
  return;
1139
1130
  }
@@ -1157,31 +1148,38 @@ class CngxStepperPresenter {
1157
1148
  if (mode === 'optimistic') {
1158
1149
  this.activeStepIndex.set(target);
1159
1150
  }
1160
- this.commitHandler.beginTransition(previous, target, action, (accept) => {
1161
- if (accept) {
1151
+ this.commitHandler.beginTransition(previous, target, action, (outcome) => {
1152
+ if (outcome === 'accepted') {
1162
1153
  // Success - origin no longer needed; clear the rejection
1163
- // flag if the user re-picked the failed target.
1154
+ // marker if the user re-picked the rejected target.
1164
1155
  this.lastCommittedIndex = target;
1165
1156
  this.originIndexDuringCommitState.set(undefined);
1166
- if (this.lastFailedIndexState() === target) {
1167
- this.lastFailedIndexState.set(undefined);
1157
+ if (this.lastFailedIndex() === target) {
1158
+ this.clearLastFailed();
1168
1159
  }
1169
1160
  if (mode === 'pessimistic') {
1170
1161
  this.activeStepIndex.set(target);
1171
1162
  }
1163
+ return;
1172
1164
  }
1173
- else {
1174
- // Reject - flag the target; RETAIN the origin so
1175
- // `liveAnnouncement` can resolve the origin label for the
1176
- // rich rollback phrase. Optimistic rolls back to the last
1177
- // truly-committed index; pessimistic never moved off it.
1178
- this.lastFailedIndexState.set(target);
1179
- if (mode === 'optimistic') {
1180
- this.activeStepIndex.set(origin);
1181
- }
1165
+ // Refused or failed - record the outcome on the target; RETAIN the
1166
+ // origin so `liveAnnouncement` can resolve the origin label for
1167
+ // the rich phrase. Both kinds roll back: optimistic returns to the
1168
+ // last truly-committed index, pessimistic never moved off it.
1169
+ this.lastOutcomeState.set({
1170
+ kind: outcome,
1171
+ index: target,
1172
+ sequence: ++this.outcomeSequence,
1173
+ });
1174
+ if (mode === 'optimistic') {
1175
+ this.activeStepIndex.set(origin);
1182
1176
  }
1183
1177
  });
1184
1178
  }
1179
+ /**
1180
+ * Moves to the next enabled step after the active one, through `select`. Does nothing when no enabled
1181
+ * step follows; the `linear` gate and the `commitAction` apply as for any other forward move.
1182
+ */
1185
1183
  selectNext() {
1186
1184
  const next = this.nextEnabledIndex();
1187
1185
  if (next < this.stepsOnly().length) {
@@ -1203,6 +1201,10 @@ class CngxStepperPresenter {
1203
1201
  this.activeStepIndex.set(prev);
1204
1202
  }
1205
1203
  }
1204
+ /**
1205
+ * Moves to the step registered under the given id, through `select`. Group ids and unknown ids are
1206
+ * ignored.
1207
+ */
1206
1208
  selectById(id) {
1207
1209
  const stepsOnly = this.stepsOnly();
1208
1210
  const idx = stepsOnly.findIndex((n) => n.id === id);
@@ -1210,11 +1212,16 @@ class CngxStepperPresenter {
1210
1212
  this.select(idx);
1211
1213
  }
1212
1214
  }
1215
+ /**
1216
+ * Returns to the first step without running the `commitAction`. Cancels a commit in flight and clears the
1217
+ * origin, the rejection marker and the last outcome.
1218
+ */
1213
1219
  reset() {
1214
1220
  this.activeStepIndex.set(0);
1215
1221
  this.lastCommittedIndex = 0;
1216
1222
  this.originIndexDuringCommitState.set(undefined);
1217
- this.lastFailedIndexState.set(undefined);
1223
+ this.lastOutcomeState.set(undefined);
1224
+ this.clearedSequenceState.set(undefined);
1218
1225
  // Settle mid-commit resets to idle - the surface lives on, so a
1219
1226
  // dangling 'pending' would latch busy() forever.
1220
1227
  this.cancelAndSettleCommit();
@@ -1228,8 +1235,8 @@ class CngxStepperPresenter {
1228
1235
  */
1229
1236
  cancelAndSettleCommit() {
1230
1237
  this.commitController.cancel({ settle: true });
1231
- if (isDevMode() && this.commitState.status() === 'pending') {
1232
- console.warn('[cngxStepper] the commit controller ignored cancel({ settle: true }) - busy stays ' +
1238
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && this.commitState.status() === 'pending') {
1239
+ cngxDevWarn('CNGX1040', '[cngxStepper] the commit controller ignored cancel({ settle: true }) - busy stays ' +
1233
1240
  'latched. Honor the settle option in your CNGX_COMMIT_CONTROLLER_FACTORY override.');
1234
1241
  }
1235
1242
  }
@@ -1256,9 +1263,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1256
1263
  * DI token providing a `CngxStepGroup`'s contract to nested `CngxStep` atoms.
1257
1264
  * Steps inject this `optional: true` and fall back to {@link CNGX_STEPPER_HOST}.
1258
1265
  *
1259
- * @category common/stepper
1260
1266
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-group-host.token.ts
1261
- * @since 0.1.0
1267
+ * @since 0.3.0
1262
1268
  */
1263
1269
  const CNGX_STEP_GROUP_HOST = new InjectionToken('CngxStepGroupHost');
1264
1270
 
@@ -1266,9 +1272,8 @@ const CNGX_STEP_GROUP_HOST = new InjectionToken('CngxStepGroupHost');
1266
1272
  * DI token providing the rendering-surface contract to organism shells
1267
1273
  * (`<cngx-stepper>`, `<cngx-mat-stepper>`) and consumer-authored skins.
1268
1274
  *
1269
- * @category common/stepper
1270
1275
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-panel-host.token.ts
1271
- * @since 0.1.0
1276
+ * @since 0.3.0
1272
1277
  */
1273
1278
  const CNGX_STEP_PANEL_HOST = new InjectionToken('CngxStepPanelHost');
1274
1279
 
@@ -1284,12 +1289,11 @@ const CNGX_STEP_PANEL_HOST = new InjectionToken('CngxStepPanelHost');
1284
1289
  * </ng-template>
1285
1290
  * ```
1286
1291
  *
1287
- * @category common/stepper
1288
1292
  * @wcag AA
1289
1293
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-content.directive.ts
1290
- * @since 0.1.0
1294
+ * @since 0.3.0
1291
1295
  * @relatedTo CngxStep, CngxStepLabel
1292
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-step-content/typed-lazy-panels</example-url>
1296
+ * <example-url>/#/ui/stepper/stepper-step-content/typed-lazy-panels</example-url>
1293
1297
  */
1294
1298
  class CngxStepContent {
1295
1299
  templateRef = inject(TemplateRef);
@@ -1316,12 +1320,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1316
1320
  * </ng-template>
1317
1321
  * ```
1318
1322
  *
1319
- * @category common/stepper
1320
1323
  * @wcag AA
1321
1324
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-label.directive.ts
1322
- * @since 0.1.0
1325
+ * @since 0.3.0
1323
1326
  * @relatedTo CngxStep, CngxStepContent, CngxStepGroupHeader
1324
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-custom-labels/mixing-code-label-code-input-with-code-cngxsteplabel-code-slot</example-url>
1327
+ * <example-url>/#/ui/stepper/stepper-custom-labels/mixing-code-label-code-input-with-code-cngxsteplabel-code-slot</example-url>
1325
1328
  */
1326
1329
  class CngxStepLabel {
1327
1330
  templateRef = inject(TemplateRef);
@@ -1344,21 +1347,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1344
1347
  * `state` is a pure `computed` over `[disabled]`, `[completed]`, and
1345
1348
  * the optional `[errorAggregator]`'s `hasError()`.
1346
1349
  *
1347
- * @category common/stepper
1348
- * @docsKind primary
1349
1350
  * @wcag AA
1350
1351
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step.directive.ts
1351
- * @since 0.1.0
1352
+ * @since 0.3.0
1352
1353
  * @relatedTo CngxStepGroup, CngxStepperPresenter, CngxStepLabel, CngxStepContent
1353
1354
  * @slot cngxStepLabel The step's own header label.
1354
1355
  * @slot cngxStepContent The step body, rendered lazily when the step activates.
1355
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-step-content/typed-lazy-panels</example-url>
1356
+ * <example-url>/#/ui/stepper/stepper-step-content/typed-lazy-panels</example-url>
1357
+ * @axis level molecule
1356
1358
  */
1357
1359
  class CngxStep {
1360
+ /**
1361
+ * Identifier the step registers under with its host. Defaults to an auto-generated `cngx-step` uid.
1362
+ * It is read once in `ngOnInit`, so a bound `[id]` must be set before init; the router-sync deep link
1363
+ * and `selectById` match against this value.
1364
+ */
1358
1365
  id = input(nextUid('cngx-step'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
1366
+ /**
1367
+ * Marks the step as not navigable. Defaults to `false`. A disabled step reports `state` `'disabled'`,
1368
+ * is skipped by next/previous navigation and refused by `select`, and the strip header reflects it
1369
+ * through `aria-disabled`.
1370
+ */
1359
1371
  disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1372
+ /**
1373
+ * Marks the step as done. Defaults to `false`. A completed step reports `state` `'success'` unless it is
1374
+ * disabled or errored, and a `linear` stepper only lets the user move past steps that are in that state.
1375
+ */
1360
1376
  completed = input(false, ...(ngDevMode ? [{ debugName: "completed" }] : /* istanbul ignore next */ []));
1377
+ /**
1378
+ * Header text of the step, shown in the strip and used for the next/previous step labels and the
1379
+ * announcement phrases. Defaults to an empty string.
1380
+ */
1361
1381
  label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1382
+ /**
1383
+ * Optional error aggregator whose `hasError()` puts the step into the `'error'` state, for forms with
1384
+ * several error sources. Defaults to `undefined`. It composes with `[error]`: either one errors the step.
1385
+ */
1362
1386
  errorAggregator = input(undefined, ...(ngDevMode ? [{ debugName: "errorAggregator" }] : /* istanbul ignore next */ []));
1363
1387
  /**
1364
1388
  * Direct error flag for the common "this step is invalid" case - no
@@ -1404,8 +1428,10 @@ class CngxStep {
1404
1428
  destroyRef = inject(DestroyRef);
1405
1429
  constructor() {
1406
1430
  if (!this.groupHost && !this.stepperHost) {
1407
- throw new Error('CngxStep: no enclosing CngxStepperPresenter or CngxStepGroup found. ' +
1408
- 'Wrap the step inside an element carrying [cngxStepper] or [cngxStepGroup].');
1431
+ throw new CngxRuntimeError('CNGX1046', typeof ngDevMode !== 'undefined' &&
1432
+ ngDevMode &&
1433
+ '[cngxStep] must be placed inside an element with [cngxStepper], such as ' +
1434
+ '<cngx-stepper>, directly or through a [cngxStepGroup] inside it.');
1409
1435
  }
1410
1436
  }
1411
1437
  ngOnInit() {
@@ -1452,19 +1478,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1452
1478
  * `success` if all are success, `pending` if any is pending or busy,
1453
1479
  * otherwise `idle`.
1454
1480
  *
1455
- * @category common/stepper
1456
- * @docsKind primary
1457
1481
  * @wcag AA
1458
1482
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/step-group.directive.ts
1459
- * @since 0.1.0
1483
+ * @since 0.3.0
1460
1484
  * @relatedTo CngxStep, CngxStepperPresenter, CngxStepGroupHeader
1461
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-hierarchical/group-nested-steps-trailing-root-step</example-url>
1462
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-hierarchical/expand-active-group-collapse</example-url>
1463
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-hierarchical/group-collapse-summary-count</example-url>
1485
+ * <example-url>/#/ui/stepper/stepper-hierarchical/group-nested-steps-trailing-root-step</example-url>
1486
+ * <example-url>/#/ui/stepper/stepper-hierarchical/expand-active-group-collapse</example-url>
1487
+ * <example-url>/#/ui/stepper/stepper-hierarchical/group-collapse-summary-count</example-url>
1464
1488
  */
1465
1489
  class CngxStepGroup {
1490
+ /**
1491
+ * Identifier the group registers under with the root presenter. Defaults to an auto-generated
1492
+ * `cngx-step-group` uid. It is read once in `ngOnInit`, so a bound `[id]` must be set before init;
1493
+ * child steps are registered with this id as their parent.
1494
+ */
1466
1495
  id = input(nextUid('cngx-step-group'), ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
1496
+ /**
1497
+ * Disabled flag of the group node in the step tree. Defaults to `false`. It does not disable the child
1498
+ * steps, which keep their own `[disabled]`.
1499
+ */
1467
1500
  disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1501
+ /**
1502
+ * Header text of the group, rendered as the group label in the stepper strip. Defaults to an empty string.
1503
+ */
1468
1504
  label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1469
1505
  config = injectStepperConfig();
1470
1506
  // Local child registry - only feeds `aggregatedStatus` below.
@@ -1522,8 +1558,10 @@ class CngxStepGroup {
1522
1558
  }, ...(ngDevMode ? [{ debugName: "isCollapsed" }] : /* istanbul ignore next */ []));
1523
1559
  constructor() {
1524
1560
  if (!this.stepperHost) {
1525
- throw new Error('CngxStepGroup: no enclosing CngxStepperPresenter found. ' +
1526
- 'Wrap the group inside an element carrying [cngxStepper].');
1561
+ throw new CngxRuntimeError('CNGX1047', typeof ngDevMode !== 'undefined' &&
1562
+ ngDevMode &&
1563
+ '[cngxStepGroup] must be placed inside an element with [cngxStepper], ' +
1564
+ 'such as <cngx-stepper>.');
1527
1565
  }
1528
1566
  }
1529
1567
  ngOnInit() {
@@ -1545,11 +1583,21 @@ class CngxStepGroup {
1545
1583
  registrationHost.register(handle);
1546
1584
  this.destroyRef.onDestroy(() => registrationHost.unregister(groupId, handle));
1547
1585
  }
1586
+ /**
1587
+ * `CngxStepGroupHost` contract, called by a nested `CngxStep` (or a nested `CngxStepGroup`) in its
1588
+ * `ngOnInit`. Adds the handle to the group's own registry, which feeds `aggregatedStatus`, and forwards
1589
+ * it to the root presenter with this group's id as parent.
1590
+ */
1548
1591
  register(handle) {
1549
1592
  this.childRegistry.update((cur) => [...cur, handle]);
1550
1593
  // Forward to the root with this group as parent so the tree shape is correct.
1551
1594
  this.stepperHost.register(handle, this.id());
1552
1595
  }
1596
+ /**
1597
+ * `CngxStepGroupHost` contract, called from the destroy hook of a nested `CngxStep` or
1598
+ * `CngxStepGroup`. Removes the registration from the group's registry and from the root presenter; when
1599
+ * `handle` is passed, only that exact instance is evicted.
1600
+ */
1553
1601
  unregister(id, handle) {
1554
1602
  // Same instance guard as the presenter: only evict the exact handle
1555
1603
  // (or fall back to id-keyed removal for handle-less callers).
@@ -1589,13 +1637,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1589
1637
  * </cngx-stepper>
1590
1638
  * ```
1591
1639
  *
1592
- * @category common/stepper/slots
1593
1640
  * @wcag AA
1594
1641
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-indicator.directive.ts
1595
- * @since 0.1.0
1642
+ * @since 0.3.0
1596
1643
  * @relatedTo CngxStepBadge, CngxStepBusySpinner, CngxStepRejection, CngxStepGroupHeader
1597
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/custom-indicator-glyph-via-code-cngxstepindicator-code</example-url>
1598
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/cross-skin-indicator-override</example-url>
1644
+ * <example-url>/#/ui/stepper/stepper-slot-overrides/custom-indicator-glyph-via-code-cngxstepindicator-code</example-url>
1645
+ * <example-url>/#/ui/stepper/stepper-slot-overrides/cross-skin-indicator-override</example-url>
1599
1646
  */
1600
1647
  class CngxStepIndicator {
1601
1648
  templateRef = inject(TemplateRef);
@@ -1615,7 +1662,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1615
1662
  * Slot directive for the error-badge template on `<cngx-stepper>`.
1616
1663
  * Discovered via `contentChild`; cascades through
1617
1664
  * `CNGX_STEPPER_CONFIG.templates.badge` before falling back to
1618
- * `CNGX_STEPPER_GLYPHS.errorBadge`.
1665
+ * the default alert icon (`CNGX_ICON_ALERT` from `@cngx/utils`).
1619
1666
  *
1620
1667
  * ```html
1621
1668
  * <cngx-stepper>
@@ -1625,13 +1672,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1625
1672
  * </cngx-stepper>
1626
1673
  * ```
1627
1674
  *
1628
- * @category common/stepper/slots
1629
1675
  * @wcag AA
1630
1676
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-badge.directive.ts
1631
- * @since 0.1.0
1677
+ * @since 0.3.0
1632
1678
  * @relatedTo CngxStepIndicator, CngxStepBusySpinner, CngxStepRejection
1633
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/custom-error-badge-via-code-cngxstepbadge-code</example-url>
1634
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-error-aggregation/per-step-error-badges</example-url>
1679
+ * <example-url>/#/ui/stepper/stepper-slot-overrides/custom-error-badge-via-code-cngxstepbadge-code</example-url>
1680
+ * <example-url>/#/ui/stepper/stepper-error-aggregation/per-step-error-badges</example-url>
1635
1681
  */
1636
1682
  class CngxStepBadge {
1637
1683
  templateRef = inject(TemplateRef);
@@ -1661,12 +1707,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1661
1707
  * </cngx-stepper>
1662
1708
  * ```
1663
1709
  *
1664
- * @category common/stepper/slots
1665
1710
  * @wcag AA
1666
1711
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-busy-spinner.directive.ts
1667
- * @since 0.1.0
1712
+ * @since 0.3.0
1668
1713
  * @relatedTo CngxStepIndicator, CngxStepBadge, CngxStepRejection
1669
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/custom-busy-spinner-via-code-cngxstepbusyspinner-code</example-url>
1714
+ * <example-url>/#/ui/stepper/stepper-slot-overrides/custom-busy-spinner-via-code-cngxstepbusyspinner-code</example-url>
1670
1715
  */
1671
1716
  class CngxStepBusySpinner {
1672
1717
  templateRef = inject(TemplateRef);
@@ -1686,7 +1731,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1686
1731
  * Slot directive for the rejection-decoration template on
1687
1732
  * `<cngx-stepper>`. Discovered via `contentChild`; cascades through
1688
1733
  * `CNGX_STEPPER_CONFIG.templates.rejection` before falling back to
1689
- * `CNGX_STEPPER_GLYPHS.rejectionIcon`.
1734
+ * the default icon (`CNGX_ICON_ALERT` on a failed commit, `CNGX_ICON_BAN` on
1735
+ * a refused one, from `@cngx/utils`).
1690
1736
  *
1691
1737
  * Symmetric context shape with the upcoming tabs `cngxTabRejectionIcon`
1692
1738
  * slot so consumer templates port directly between the two families.
@@ -1702,12 +1748,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1702
1748
  * </cngx-stepper>
1703
1749
  * ```
1704
1750
  *
1705
- * @category common/stepper/slots
1706
1751
  * @wcag AA
1707
1752
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-rejection.directive.ts
1708
- * @since 0.1.0
1753
+ * @since 0.3.0
1709
1754
  * @relatedTo CngxStepBadge, CngxStepIndicator, CngxStepBusySpinner
1710
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/rejection-decoration-via-code-cngxsteprejection-code</example-url>
1755
+ * <example-url>/#/ui/stepper/stepper-slot-overrides/rejection-decoration-via-code-cngxsteprejection-code</example-url>
1711
1756
  */
1712
1757
  class CngxStepRejection {
1713
1758
  templateRef = inject(TemplateRef);
@@ -1745,10 +1790,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1745
1790
  * </cngx-stepper>
1746
1791
  * ```
1747
1792
  *
1748
- * @category common/stepper/slots
1749
1793
  * @wcag AA
1750
1794
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-error.directive.ts
1751
- * @since 0.1.0
1795
+ * @since 0.3.0
1752
1796
  * @relatedTo CngxStepRejection, CngxStepBadge, CngxStep
1753
1797
  */
1754
1798
  class CngxStepError {
@@ -1779,12 +1823,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1779
1823
  * </cngx-stepper>
1780
1824
  * ```
1781
1825
  *
1782
- * @category common/stepper/slots
1783
1826
  * @wcag AA
1784
1827
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/step-group-header.directive.ts
1785
- * @since 0.1.0
1828
+ * @since 0.3.0
1786
1829
  * @relatedTo CngxStepGroup, CngxStepIndicator, CngxStepLabel
1787
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/custom-group-header-via-code-cngxstepgroupheader-code</example-url>
1830
+ * <example-url>/#/ui/stepper/stepper-slot-overrides/custom-group-header-via-code-cngxstepgroupheader-code</example-url>
1788
1831
  */
1789
1832
  class CngxStepGroupHeader {
1790
1833
  templateRef = inject(TemplateRef);
@@ -1818,12 +1861,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1818
1861
  * </cngx-stepper>
1819
1862
  * ```
1820
1863
  *
1821
- * @category common/stepper/slots
1822
1864
  * @wcag AA
1823
1865
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/stepper-empty.directive.ts
1824
- * @since 0.1.0
1866
+ * @since 0.3.0
1825
1867
  * @relatedTo CngxStepIndicator, CngxStepGroupHeader
1826
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-slot-overrides/empty-state-placeholder-via-code-cngxstepperempty-code</example-url>
1868
+ * <example-url>/#/ui/stepper/stepper-slot-overrides/empty-state-placeholder-via-code-cngxstepperempty-code</example-url>
1827
1869
  */
1828
1870
  class CngxStepperEmpty {
1829
1871
  templateRef = inject(TemplateRef);
@@ -1840,7 +1882,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1840
1882
  }] });
1841
1883
 
1842
1884
  /**
1843
- * Slot directive for the dot-body template on `<cngx-dot-stepper>`.
1885
+ * Slot directive for the dot-body template on `<cngx-dot-stepper>` and on
1886
+ * `<cngx-stepper>` (dots mobile-collapse branch, `mobileCollapse: 'dots'`).
1844
1887
  * Discovered via `contentChild`; cascades through
1845
1888
  * `CNGX_STEPPER_CONFIG.templates.dotStepperDot` before falling back to
1846
1889
  * the built-in empty body (the span itself paints the dot fill via CSS).
@@ -1859,12 +1902,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1859
1902
  * </cngx-dot-stepper>
1860
1903
  * ```
1861
1904
  *
1862
- * @category common/stepper/slots
1863
1905
  * @wcag AA
1864
1906
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/slots/dot-stepper-dot.directive.ts
1865
- * @since 0.1.0
1907
+ * @since 0.3.0
1866
1908
  * @relatedTo CngxStepIndicator, CngxStepBadge, CngxStepBusySpinner, CngxStepRejection
1867
- * <example-url>http://localhost:4200/#/ui/stepper/dot-stepper/icon-dots-via-code-cngxdotstepperdot-code</example-url>
1909
+ * <example-url>/#/ui/stepper/dot-stepper/icon-dots-via-code-cngxdotstepperdot-code</example-url>
1868
1910
  */
1869
1911
  class CngxDotStepperDot {
1870
1912
  templateRef = inject(TemplateRef);
@@ -1891,8 +1933,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1891
1933
  *
1892
1934
  * Tabs has no parallel slot surface yet - see
1893
1935
  * `stepper-accepted-debt §3` for the planned Phase-4 closure.
1894
- *
1895
- * @category common/stepper/slots
1896
1936
  */
1897
1937
  function createStepperTemplateBindings(opts) {
1898
1938
  return {
@@ -1917,32 +1957,12 @@ function createStepperTemplateBindings(opts) {
1917
1957
  empty: computed(() => opts.emptySlot()?.templateRef ??
1918
1958
  opts.config.templates?.empty ??
1919
1959
  null),
1960
+ dot: computed(() => opts.dotSlot?.()?.templateRef ??
1961
+ opts.config.templates?.dotStepperDot ??
1962
+ null),
1920
1963
  };
1921
1964
  }
1922
1965
 
1923
- /**
1924
- * Default glyphs for `<cngx-stepper>` skin slots. Used when neither a
1925
- * per-instance slot directive nor `CNGX_STEPPER_CONFIG.templates.<key>`
1926
- * overrides the built-in span. Sibling of `CNGX_SELECT_GLYPHS` /
1927
- * `CNGX_TABS_GLYPHS`.
1928
- *
1929
- * Exported with `@internal` so the organism (and mat-twin) can share
1930
- * the literals across the secondary-entry boundary that Sheriff
1931
- * forbids deep-relative imports across. Consumers customise via
1932
- * `*cngxStep*` slots or `withStep*Template` features.
1933
- *
1934
- * @internal
1935
- * @category common/stepper
1936
- * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/glyphs.ts
1937
- * @since 0.1.0
1938
- */
1939
- const CNGX_STEPPER_GLYPHS = {
1940
- /** Default visual for `*cngxStepBadge` when no override is bound. */
1941
- errorBadge: '!',
1942
- /** Default visual for `*cngxStepRejection` when no override is bound. */
1943
- rejectionIcon: '!',
1944
- };
1945
-
1946
1966
  /**
1947
1967
  * URL deep-linking for the stepper. Bidirectional sync between
1948
1968
  * `activeStepId` and a URL fragment / query-param. Opt-in via
@@ -1954,27 +1974,36 @@ const CNGX_STEPPER_GLYPHS = {
1954
1974
  * `Router` is optional - without `@angular/router` the directive
1955
1975
  * dev-warns once and becomes a no-op.
1956
1976
  *
1957
- * @category common/stepper
1958
- * @docsKind primary
1959
1977
  * @wcag AA
1960
1978
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/router-sync.directive.ts
1961
- * @since 0.1.0
1979
+ * @since 0.3.0
1962
1980
  * @relatedTo CngxStepperPresenter, CNGX_STEPPER_CONFIG
1963
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-router-sync/deep-linking-with-fragment-queryparam-modes</example-url>
1981
+ * <example-url>/#/ui/stepper/stepper-router-sync/deep-linking-with-fragment-queryparam-modes</example-url>
1964
1982
  */
1965
1983
  class CngxStepperRouterSync {
1966
1984
  // Default undefined so the cascade resolves through CNGX_STEPPER_CONFIG.
1967
- // Init-only: the seed and the write effect capture the resolved mode /
1968
- // param on their first run; changing either after init leaves the old
1969
- // URL key behind. Rebuild the directive to change them.
1985
+ // The resolved mode / param are read on every URL write and read, not
1986
+ // only at init; changing either after init applies to the next one and
1987
+ // leaves the previous key behind in the URL.
1988
+ /**
1989
+ * Binding `[mode]`: where the active step id is kept in the URL, `'fragment'` (`#step=customer`) or
1990
+ * `'queryParam'` (`?step=customer`). Unset, it resolves through `routerSyncMode` of the stepper config
1991
+ * and then `'fragment'`. A change after init applies to the next URL write or read and leaves the
1992
+ * previous key in the URL.
1993
+ */
1970
1994
  modeInput = input(undefined, { ...(ngDevMode ? { debugName: "modeInput" } : /* istanbul ignore next */ {}), alias: 'mode' });
1995
+ /**
1996
+ * Binding `[paramName]`: name of the fragment or query key that carries the step id. Unset, it resolves
1997
+ * through `routerSyncParam` of the stepper config and then `'step'`. A change after init applies to the next URL write or read and leaves the
1998
+ * previous key in the URL.
1999
+ */
1971
2000
  paramNameInput = input(undefined, { ...(ngDevMode ? { debugName: "paramNameInput" } : /* istanbul ignore next */ {}), alias: 'paramName' });
1972
2001
  config = injectStepperConfig();
1973
2002
  mode = computed(() => this.modeInput() ?? this.config.routerSyncMode ?? 'fragment', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
1974
2003
  paramName = computed(() => this.paramNameInput() ?? this.config.routerSyncParam ?? 'step', ...(ngDevMode ? [{ debugName: "paramName" }] : /* istanbul ignore next */ []));
1975
2004
  /** Emits when a `router.navigate` rejection is observed. */
1976
2005
  syncError = output();
1977
- host = inject(CNGX_STEPPER_HOST, { host: true });
2006
+ host = injectStepperHost('cngxStepperRouterSync', { host: true });
1978
2007
  router = inject(Router, { optional: true });
1979
2008
  /**
1980
2009
  * Latched once the URL seed has reached a registered step, so the
@@ -1989,11 +2018,16 @@ class CngxStepperRouterSync {
1989
2018
  */
1990
2019
  seeded = false;
1991
2020
  constructor() {
1992
- if (!this.router) {
1993
- afterNextRender(() => {
1994
- console.warn('CngxStepperRouterSync: no Router available - directive is a no-op. ' +
1995
- 'Provide @angular/router via provideRouter(...) to enable deep-linking.');
1996
- });
2021
+ // Router is providedIn: 'root' and resolves without provideRouter(...);
2022
+ // ActivatedRoute does not, so it is the "router is set up" signal.
2023
+ const route = inject(ActivatedRoute, { optional: true });
2024
+ if (!this.router || !route) {
2025
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
2026
+ afterNextRender(() => {
2027
+ cngxDevWarn('CNGX1031', '[cngxStepperRouterSync] no Router / ActivatedRoute available - the URL sync is a no-op. ' +
2028
+ 'Provide @angular/router via provideRouter(...) to enable deep-linking.');
2029
+ });
2030
+ }
1997
2031
  return;
1998
2032
  }
1999
2033
  const router = this.router;
@@ -2125,28 +2159,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
2125
2159
  * no signal graph involvement.
2126
2160
  *
2127
2161
  * Resolution order:
2128
- * 1. `success` data-state -> `statusLabels.done`
2129
- * 2. `error` data-state -> `statusLabels.errored`
2130
- * 3. `aria-current="step"` -> `statusLabels.inProgress`
2131
- * 4. otherwise -> `statusLabels.upNext`
2162
+ * 1. `error` data-state -> `statusLabels.errored`
2163
+ * 2. a failed commit rejection -> `statusLabels.errored`
2164
+ * 3. a refused commit rejection -> `statusLabels.refused`
2165
+ * 4. `success` data-state -> `statusLabels.done`
2166
+ * 5. `aria-current="step"` -> `statusLabels.inProgress`
2167
+ * 6. otherwise -> `statusLabels.upNext`
2132
2168
  *
2133
- * Group nodes (non-step) return an empty string.
2169
+ * The rejection outranks `done` and the position words because it is the
2170
+ * most recent event on the step: a rejected step must never read "Up next".
2134
2171
  *
2135
- * @category common/stepper
2172
+ * Group nodes (non-step) return an empty string.
2136
2173
  */
2137
- function resolveStepperStatusLabel(node, i18n, isActive) {
2174
+ function resolveStepperStatusLabel(node, i18n, isActive, rejection = null) {
2138
2175
  if (node.kind !== 'step') {
2139
2176
  return '';
2140
2177
  }
2141
2178
  const labels = i18n.statusLabels;
2142
2179
  const state = node.state();
2143
- return state === 'success'
2144
- ? labels.done
2145
- : state === 'error'
2146
- ? labels.errored
2147
- : isActive
2148
- ? labels.inProgress
2149
- : labels.upNext;
2180
+ if (state === 'error' || rejection === 'failed') {
2181
+ return labels.errored;
2182
+ }
2183
+ if (rejection === 'refused') {
2184
+ return labels.refused;
2185
+ }
2186
+ if (state === 'success') {
2187
+ return labels.done;
2188
+ }
2189
+ return isActive ? labels.inProgress : labels.upNext;
2150
2190
  }
2151
2191
 
2152
2192
  /**
@@ -2164,7 +2204,6 @@ function resolveStepperStatusLabel(node, i18n, isActive) {
2164
2204
  * on the stepper component is one; a bare call from a lifecycle hook is not.
2165
2205
  *
2166
2206
  * @param host The `<cngx-stepper>` host element, which is its own container.
2167
- * @category common/stepper
2168
2207
  * @relatedTo createStepperDisplayMode, injectContainerSize
2169
2208
  */
2170
2209
  function injectStepperCollapse(host) {
@@ -2184,7 +2223,6 @@ function injectStepperCollapse(host) {
2184
2223
  *
2185
2224
  * @param collapsed `true` while the container sits below the collapse rung.
2186
2225
  * @param mobileCollapse The configured collapse policy, read lazily.
2187
- * @category common/stepper
2188
2226
  */
2189
2227
  function createStepperDisplayMode(collapsed, mobileCollapse) {
2190
2228
  return computed(() => {
@@ -2196,55 +2234,6 @@ function createStepperDisplayMode(collapsed, mobileCollapse) {
2196
2234
  });
2197
2235
  }
2198
2236
 
2199
- /**
2200
- * Tracks an element's content-box width as a reactive signal, over the shared
2201
- * resize kernel (`createResizeSignal`) rather than a hand-rolled
2202
- * `ResizeObserver`. Not the `CngxResizeObserver` directive - that can only
2203
- * attach through `hostDirectives`, and this factory is called from a field
2204
- * initialiser. In SSR / non-DOM environments the signal stays `0` and no
2205
- * observer is wired.
2206
- */
2207
- function createElementWidthSignal(element, destroyRef) {
2208
- const entry = createResizeSignal(element, 'content-box', destroyRef, globalThis);
2209
- return computed(() => entry()?.contentRect.width ?? 0);
2210
- }
2211
- /**
2212
- * Resolves the classic strip's density rung from its own container
2213
- * width against the step count and two per-step px thresholds. Pure
2214
- * `create*` factory, sibling to `createStepperDisplayMode` - both derive
2215
- * a rung from the space the stepper was given and return a single
2216
- * `Signal`; this one measures, the other reads what CSS resolved.
2217
- *
2218
- * `'comfortable'` density short-circuits to `'full'` (no measurement
2219
- * dependency). Before the first measurement (`width === 0`) and for an
2220
- * empty strip the rung is `'full'`, so the strip never flashes
2221
- * `'minimal'` on mount.
2222
- *
2223
- * @category common/stepper
2224
- */
2225
- function createStripDensity(options) {
2226
- const width = createElementWidthSignal(options.element, options.destroyRef);
2227
- return computed(() => {
2228
- if ((options.density() ?? 'comfortable') !== 'auto') {
2229
- return 'full';
2230
- }
2231
- const count = options.stepCount();
2232
- const measured = width();
2233
- if (count === 0 || measured === 0) {
2234
- return 'full';
2235
- }
2236
- const perStep = measured / count;
2237
- const { compact, minimal } = options.breakpoints();
2238
- if (perStep >= compact) {
2239
- return 'full';
2240
- }
2241
- if (perStep >= minimal) {
2242
- return 'compact';
2243
- }
2244
- return 'minimal';
2245
- });
2246
- }
2247
-
2248
2237
  /** Terminal-step totals for a group's subtree; reads each step `state()`. */
2249
2238
  function subtreeStats(node) {
2250
2239
  let total = 0;
@@ -2267,8 +2256,6 @@ function subtreeStats(node) {
2267
2256
  * to the group's existing status-phrase span, so {@link srText} returns
2268
2257
  * `null` there. SR phrases resolve through the `CngxStepperI18n` bundle
2269
2258
  * when passed; English defaults otherwise.
2270
- *
2271
- * @category common/stepper
2272
2259
  */
2273
2260
  function createStepperGroupSummary(options) {
2274
2261
  const mode = computed(() => options.summaryMode() ?? 'progress', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
@@ -2308,8 +2295,6 @@ function createStepperGroupSummary(options) {
2308
2295
  * the seeded `-1`. Each candidate is gated by `canNavigateTo` + `busy`
2309
2296
  * (mirroring the step-header reachability), so a linear-blocked leading
2310
2297
  * step is skipped to the first reachable one.
2311
- *
2312
- * @category common/stepper
2313
2298
  */
2314
2299
  function createStepperGroupNavigation(options) {
2315
2300
  const { presenter } = options;
@@ -2371,19 +2356,17 @@ function createStepperHostAttrs(inputs) {
2371
2356
  * Shared `aria-label` cascade for every stepper organism host
2372
2357
  * (`<cngx-stepper>` and the compact variants): a bound
2373
2358
  * `aria-labelledby` trumps and nulls the label out; otherwise the
2374
- * per-instance input wins over `ariaLabels.stepperRegion` wins over
2375
- * `i18n.stepperLabel`. One source so the variants cannot drift from
2359
+ * per-instance input wins over `i18n.stepperLabel`. One source so the variants cannot drift from
2376
2360
  * the parent's naming behaviour.
2377
2361
  *
2378
2362
  * @internal
2379
2363
  */
2380
2364
  function createStepperAccname(inputs) {
2381
- const ariaLabels = coerceSignal(inputs.config.ariaLabels);
2382
2365
  return computed(() => {
2383
2366
  if (inputs.ariaLabelledBy()) {
2384
2367
  return null; // labelledby trumps label
2385
2368
  }
2386
- return inputs.ariaLabel() ?? ariaLabels()?.stepperRegion ?? inputs.i18n().stepperLabel;
2369
+ return inputs.ariaLabel() ?? inputs.i18n().stepperLabel;
2387
2370
  });
2388
2371
  }
2389
2372
 
@@ -2421,7 +2404,9 @@ function createStepperStripKeyboardNav(options) {
2421
2404
  // the action settles). The controller retains intendedValue after a
2422
2405
  // rejection for the commit-error surface, so an unguarded read
2423
2406
  // would teleport focus to the refused step on any later no-op key.
2424
- const intendedIdx = options.presenter.busy()
2407
+ // Keyed on the commit, not busy(): a finish run must not move focus
2408
+ // to an intendedValue retained from an earlier refused commit.
2409
+ const intendedIdx = options.presenter.commitState.status() === 'pending'
2425
2410
  ? options.presenter.intendedStepIndex()
2426
2411
  : undefined;
2427
2412
  const intendedId = intendedIdx !== undefined
@@ -2501,8 +2486,7 @@ function createStepperStripKeyboardNav(options) {
2501
2486
  * step-only projection. Pure factory - `computed()` only, no injection
2502
2487
  * context required, so any skin can allocate it in a field initializer.
2503
2488
  *
2504
- * @category common/stepper
2505
- * @since 0.1.0
2489
+ * @since 0.3.0
2506
2490
  * @relatedTo CngxStepperHost, createStepperSlotContextBuilders
2507
2491
  */
2508
2492
  function createStepperStateView(inputs) {
@@ -2521,32 +2505,58 @@ function createStepperStateView(inputs) {
2521
2505
  }
2522
2506
  return !!node.errorAggregator?.()?.shouldShow?.();
2523
2507
  };
2524
- const hasError = (node) => hasErrorBadge(node) || isRejected(node);
2525
- const erroredSteps = computed(() => stepsOnly().filter((node) => hasError(node)), ...(ngDevMode ? [{ debugName: "erroredSteps" }] : /* istanbul ignore next */ []));
2508
+ const isRefused = (node) => isRejected(node) && presenter.lastOutcome()?.kind === 'refused';
2509
+ const rejectionReason = (node) => {
2510
+ if (!isRejected(node)) {
2511
+ return null;
2512
+ }
2513
+ return isRefused(node) ? 'refused' : 'failed';
2514
+ };
2515
+ const hasErrorMarker = (node) => hasErrorBadge(node) || isRejected(node);
2516
+ const hasError = (node) => hasErrorBadge(node) || (isRejected(node) && !isRefused(node));
2517
+ const erroredSteps = computed(() => stepsOnly().filter((node) => hasError(node)), { ...(ngDevMode ? { debugName: "erroredSteps" } : /* istanbul ignore next */ {}), equal: arrayEqual });
2526
2518
  const errorCount = computed(() => erroredSteps().length, ...(ngDevMode ? [{ debugName: "errorCount" }] : /* istanbul ignore next */ []));
2527
2519
  const firstErrorIndex = computed(() => erroredSteps()[0]?.flatIndex ?? -1, ...(ngDevMode ? [{ debugName: "firstErrorIndex" }] : /* istanbul ignore next */ []));
2528
2520
  const hasAnyError = computed(() => errorCount() > 0, ...(ngDevMode ? [{ debugName: "hasAnyError" }] : /* istanbul ignore next */ []));
2521
+ const markedSteps = computed(() => stepsOnly().filter((node) => hasErrorMarker(node)), { ...(ngDevMode ? { debugName: "markedSteps" } : /* istanbul ignore next */ {}), equal: arrayEqual });
2522
+ const errorMarkerCount = computed(() => markedSteps().length, ...(ngDevMode ? [{ debugName: "errorMarkerCount" }] : /* istanbul ignore next */ []));
2523
+ const firstErrorMarkerIndex = computed(() => markedSteps()[0]?.flatIndex ?? -1, ...(ngDevMode ? [{ debugName: "firstErrorMarkerIndex" }] : /* istanbul ignore next */ []));
2524
+ const hasAnyErrorMarker = computed(() => errorMarkerCount() > 0, ...(ngDevMode ? [{ debugName: "hasAnyErrorMarker" }] : /* istanbul ignore next */ []));
2525
+ const refusalOnly = computed(() => hasAnyErrorMarker() && !hasAnyError(), ...(ngDevMode ? [{ debugName: "refusalOnly" }] : /* istanbul ignore next */ []));
2529
2526
  return {
2530
2527
  statusOf,
2531
2528
  isBusy,
2532
2529
  isRejected,
2530
+ isRefused,
2531
+ rejectionReason,
2533
2532
  hasErrorBadge,
2533
+ hasErrorMarker,
2534
2534
  hasError,
2535
2535
  errorCount,
2536
2536
  firstErrorIndex,
2537
2537
  hasAnyError,
2538
+ errorMarkerCount,
2539
+ firstErrorMarkerIndex,
2540
+ hasAnyErrorMarker,
2541
+ refusalOnly,
2538
2542
  };
2539
2543
  }
2540
2544
  /**
2541
2545
  * Aggregate error phrase shared by the minimal skins (text / progress-bar)
2542
- * and the classic mobile-collapse text branch. A single errored step names
2543
- * itself (`"Payment: Errored"`); several collapse to the i18n count phrase
2544
- * (`"2 errors"`). Returns `''` when no step errored - callers gate on
2545
- * `view.hasAnyError()` so the empty string never reaches the DOM.
2546
+ * and the classic mobile-collapse text branch. Walks the marked steps
2547
+ * ({@link CngxStepperStateView.hasErrorMarker}). A single marked step names
2548
+ * itself with the word of its kind: `"Payment: Errored"` (or the custom
2549
+ * reason) for an error, `"Payment: Not allowed"` for a refused step change;
2550
+ * several failed steps collapse to the i18n count phrase (`"2 errors"`),
2551
+ * which never counts a refusal. Returns `''`
2552
+ * when no step is marked, so the error line stays quiet.
2546
2553
  *
2547
2554
  * The optional `messageOf` resolver lets callers surface a per-step
2548
2555
  * reason (a direct `[error]` string or the first aggregator label) in the
2549
- * single-error case instead of the generic `errored` status word. When
2556
+ * single-error case instead of the generic `errored` status word. The
2557
+ * reason is still prefixed with the step label (`"Payment: Card declined"`),
2558
+ * because the summary line stays visible while another step is active and
2559
+ * a bare reason would read as belonging to the active step. When
2550
2560
  * omitted - or when it returns `undefined`/`''` - the helper produces
2551
2561
  * byte-identical output to the no-resolver form, so existing callers
2552
2562
  * (the classic mobile-collapse summary) are a guaranteed no-op.
@@ -2557,26 +2567,43 @@ function createStepperStateView(inputs) {
2557
2567
  * re-announce the line. Pass the i18n bundle as an untracked snapshot for
2558
2568
  * the same reason.
2559
2569
  *
2560
- * @category common/stepper
2561
- * @since 0.1.0
2570
+ * @since 0.3.0
2562
2571
  */
2563
2572
  function resolveStepperErrorSummary(view, stepsOnly, i18n, messageOf) {
2564
- const count = view.errorCount();
2573
+ const count = view.errorMarkerCount();
2565
2574
  if (count === 0) {
2566
2575
  return '';
2567
2576
  }
2568
2577
  if (count === 1) {
2569
- const node = stepsOnly()[view.firstErrorIndex()];
2570
- const custom = node ? messageOf?.(node) : undefined;
2571
- if (custom !== undefined && custom !== '') {
2572
- return custom;
2573
- }
2574
- const label = node ? untracked(node.label) : undefined;
2575
- return label
2576
- ? i18n.stepWithDetail(label, i18n.statusLabels.errored)
2577
- : i18n.statusLabels.errored;
2578
+ return singleStepPhrase(view, stepsOnly()[view.firstErrorMarkerIndex()], i18n, messageOf);
2579
+ }
2580
+ // A refusal is not an error: the count phrase counts failed steps only. One
2581
+ // error beside a refused step names that error; the refusal keeps its own
2582
+ // marker and announcement.
2583
+ const errors = view.errorCount();
2584
+ if (errors > 1) {
2585
+ return i18n.stepHasErrors(errors);
2586
+ }
2587
+ const index = errors === 1 ? view.firstErrorIndex() : view.firstErrorMarkerIndex();
2588
+ return singleStepPhrase(view, stepsOnly()[index], i18n, messageOf);
2589
+ }
2590
+ /** @internal `"<label>: <detail>"` for one marked step. */
2591
+ function singleStepPhrase(view, node, i18n, messageOf) {
2592
+ const detail = node ? summaryDetail(view, node, i18n, messageOf) : i18n.statusLabels.errored;
2593
+ const label = node ? untracked(node.label) : undefined;
2594
+ return label ? i18n.stepWithDetail(label, detail) : detail;
2595
+ }
2596
+ /**
2597
+ * @internal The word for one marked step: a validation error keeps its
2598
+ * reason, a refused-only step reads the refused word.
2599
+ */
2600
+ function summaryDetail(view, node, i18n, messageOf) {
2601
+ const refusedOnly = view.isRefused(node) && !view.hasErrorBadge(node);
2602
+ if (refusedOnly) {
2603
+ return i18n.statusLabels.refused;
2578
2604
  }
2579
- return i18n.stepHasErrors(count);
2605
+ const custom = messageOf?.(node);
2606
+ return custom !== undefined && custom !== '' ? custom : i18n.statusLabels.errored;
2580
2607
  }
2581
2608
 
2582
2609
  /**
@@ -2668,7 +2695,8 @@ function createStepperSlotContextBuilders(inputs) {
2668
2695
  const failedIndex = node.flatIndex;
2669
2696
  const originIdx = presenter.originIndexDuringCommit();
2670
2697
  const originLabel = originIdx !== undefined ? stepsOnly()[originIdx]?.label() : undefined;
2671
- return { failedIndex, originLabel, node };
2698
+ const reason = stateView.isRefused(node) ? 'refused' : 'failed';
2699
+ return { failedIndex, originLabel, node, reason };
2672
2700
  });
2673
2701
  const stepErrorContextFor = memoizeByNode((node) => {
2674
2702
  const aggregator = node.errorAggregator?.();
@@ -2704,6 +2732,21 @@ function createStepperSlotContextBuilders(inputs) {
2704
2732
  busy: isStepBusy(node),
2705
2733
  disabled: node.disabled(),
2706
2734
  }));
2735
+ // One pass per step-list change, so a dot reads its index in O(1)
2736
+ // instead of scanning the list on every change-detection pass.
2737
+ const stepIndexByNode = computed(() => new Map(stepsOnly().map((node, index) => [node, index])), ...(ngDevMode ? [{ debugName: "stepIndexByNode" }] : /* istanbul ignore next */ []));
2738
+ // Same fields as <cngx-dot-stepper>: index in the step-only projection,
2739
+ // completed = before the active step.
2740
+ const dotContextFor = memoizeByNode((node) => {
2741
+ const index = stepIndexByNode().get(node) ?? -1;
2742
+ return {
2743
+ $implicit: index,
2744
+ index,
2745
+ node,
2746
+ active: isActive(node),
2747
+ completed: index < presenter.activeStepIndex(),
2748
+ };
2749
+ });
2707
2750
  return {
2708
2751
  isActive,
2709
2752
  isStepBusy,
@@ -2718,6 +2761,7 @@ function createStepperSlotContextBuilders(inputs) {
2718
2761
  groupHeaderContextFor,
2719
2762
  stepLabelContextFor,
2720
2763
  stepContentContextFor,
2764
+ dotContextFor,
2721
2765
  };
2722
2766
  }
2723
2767
 
@@ -2730,10 +2774,35 @@ function createStepperSlotContextBuilders(inputs) {
2730
2774
  */
2731
2775
  function createStepperAnnouncementBuilders(inputs) {
2732
2776
  const { presenter, stepsOnly } = inputs;
2777
+ // A refusal leaves the commit status at 'idle', so no status edge can
2778
+ // voice it. The phrase arms on each new refused outcome (a new
2779
+ // sequence) and is spent by the next commit activity, a step move or a
2780
+ // cleared outcome (reset). Arm wins over spend in the same flush, so an
2781
+ // optimistic rollback that moves the step still arms.
2782
+ const refusedPhrase = createRefusedPhrase({
2783
+ outcome: () => presenter.lastOutcome(),
2784
+ status: () => presenter.commitTransition.current(),
2785
+ activeIndex: () => presenter.activeStepIndex(),
2786
+ copy: refusedCopy,
2787
+ });
2788
+ function refusedCopy() {
2789
+ const originIdx = presenter.originIndexDuringCommit();
2790
+ const origin = originIdx !== undefined ? stepsOnly()[originIdx] : undefined;
2791
+ const originLabel = origin?.label();
2792
+ const i18n = inputs.i18n();
2793
+ return originLabel ? i18n.commitRefused(originLabel) : i18n.commitRefusedGeneric;
2794
+ }
2733
2795
  // The live region reads copy untracked: a language switch must not
2734
2796
  // re-speak the last phrase. The next commit transition speaks the new
2735
2797
  // language.
2736
2798
  const liveAnnouncement = computed(() => {
2799
+ // Read the refused phrase EAGERLY: linkedSignal only observes the
2800
+ // snapshots it is read under, so a read behind the pending arm would
2801
+ // miss the status change that spends it.
2802
+ const refused = refusedPhrase();
2803
+ if (refused) {
2804
+ return refused;
2805
+ }
2737
2806
  const current = presenter.commitTransition.current();
2738
2807
  if (current === 'pending') {
2739
2808
  return untracked(() => inputs.i18n().commitInFlight);
@@ -2757,9 +2826,10 @@ function createStepperAnnouncementBuilders(inputs) {
2757
2826
  return '';
2758
2827
  }
2759
2828
  if (current === 'error') {
2760
- // Sync commit-handler errors collapse pending -> error in one signal
2761
- // flush; tracker sees `previous === 'idle'`. Guard stays loose so
2762
- // sync-rejection (`commitAction = () => false`) still announces.
2829
+ // Sync commit-handler failures collapse pending -> error in one signal
2830
+ // flush; tracker sees `previous === 'idle'`. Guard stays loose so a
2831
+ // synchronously throwing `commitAction` still announces. A `false`
2832
+ // answer never reaches this arm: it settles to 'idle' as a refusal.
2763
2833
  const failedIdx = presenter.lastFailedIndex();
2764
2834
  const originIdx = presenter.originIndexDuringCommit();
2765
2835
  if (failedIdx !== undefined && originIdx !== undefined) {
@@ -2786,9 +2856,12 @@ function createStepperAnnouncementBuilders(inputs) {
2786
2856
  if (!base) {
2787
2857
  return '';
2788
2858
  }
2789
- return node.kind === 'step' && node.flatIndex === presenter.lastFailedIndex()
2790
- ? i18n.stepRolledBack(base)
2791
- : base;
2859
+ if (node.kind !== 'step' || node.flatIndex !== presenter.lastFailedIndex()) {
2860
+ return base;
2861
+ }
2862
+ return presenter.lastOutcome()?.kind === 'refused'
2863
+ ? i18n.stepRefused(base)
2864
+ : i18n.stepRolledBack(base);
2792
2865
  };
2793
2866
  // Converged on `statusLabels` - the same phrase map the status pill
2794
2867
  // (resolveStepperStatusLabel) renders, so a group's SR description can
@@ -2885,11 +2958,9 @@ function createStepperPanelRefs(inputs) {
2885
2958
  * window apply identically to a click); the back swipe ->
2886
2959
  * `selectPrevious()`, gated on `busy()` like the strip back-arrow.
2887
2960
  *
2888
- * @category common/stepper
2889
- * @docsKind primary
2890
2961
  * @wcag AA
2891
2962
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/swipe-nav.directive.ts
2892
- * @since 0.1.0
2963
+ * @since 0.3.0
2893
2964
  */
2894
2965
  class CngxStepperSwipeNav {
2895
2966
  /**
@@ -2897,7 +2968,7 @@ class CngxStepperSwipeNav {
2897
2968
  * defers to the config cascade.
2898
2969
  */
2899
2970
  mobileSwipe = input(undefined, ...(ngDevMode ? [{ debugName: "mobileSwipe" }] : /* istanbul ignore next */ []));
2900
- host = inject(CNGX_STEPPER_HOST);
2971
+ host = injectStepperHost('cngxStepperSwipeNav', { host: false });
2901
2972
  config = injectStepperConfig();
2902
2973
  direction = injectDirection();
2903
2974
  /** Resolved enabled flag (Input -> config -> default(true)). Boolean output, no `equal` fn required. */
@@ -2936,6 +3007,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
2936
3007
  }]
2937
3008
  }], propDecorators: { mobileSwipe: [{ type: i0.Input, args: [{ isSignal: true, alias: "mobileSwipe", required: false }] }] } });
2938
3009
 
3010
+ /**
3011
+ * Dev-warning for a stepper control (`[cngxStepperNext]`,
3012
+ * `[cngxStepperPrevious]`, `[cngxStepperComplete]`, `<cngx-stepper-count>`)
3013
+ * that has neither a bound `[host]` nor an ambient stepper presenter. Such a
3014
+ * control stays disabled or empty for good, so it warns once per instance
3015
+ * after the first render, when the `[host]` binding has settled. Call it from
3016
+ * an injection context.
3017
+ *
3018
+ * @internal
3019
+ */
3020
+ function warnStepperControlUnhosted(selector, host) {
3021
+ if (!(typeof ngDevMode !== 'undefined' && ngDevMode)) {
3022
+ return;
3023
+ }
3024
+ afterNextRender(() => {
3025
+ if (host()) {
3026
+ return;
3027
+ }
3028
+ cngxDevWarn('CNGX1056', `[${selector}] has no stepper. Place it inside a stepper, or bind [host] to the ` +
3029
+ `stepper's presenter when it sits outside.`);
3030
+ });
3031
+ }
3032
+
2939
3033
  /**
2940
3034
  * Reusable progress-hint atom for any stepper organism. Renders the
2941
3035
  * resolved `CngxStepperI18n.textStepperFormat(current, total)` string
@@ -2964,11 +3058,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
2964
3058
  * the caption sits next to another live region (e.g. a stepper that
2965
3059
  * already mounts its own live announcer) to prevent double announces.
2966
3060
  *
2967
- * @category common/stepper
2968
- * @docsKind primary
2969
- * @since 0.1.0
3061
+ * @since 0.3.0
2970
3062
  * @relatedTo CngxStepperHost, CngxStepperI18n
2971
- * <example-url>http://localhost:4200/#/ui/stepper/stepper-count/multi-instance-format-overrides</example-url>
3063
+ * <example-url>/#/ui/stepper/stepper-count/multi-instance-format-overrides</example-url>
2972
3064
  */
2973
3065
  class CngxStepperCount {
2974
3066
  /**
@@ -3033,6 +3125,11 @@ class CngxStepperCount {
3033
3125
  }
3034
3126
  return untracked(() => (this.format() ?? this.i18n().textStepperFormat)(position.current, position.total));
3035
3127
  }, ...(ngDevMode ? [{ debugName: "liveLabel" }] : /* istanbul ignore next */ []));
3128
+ constructor() {
3129
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
3130
+ warnStepperControlUnhosted('cngx-stepper-count', this.resolvedHost);
3131
+ }
3132
+ }
3036
3133
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStepperCount, deps: [], target: i0.ɵɵFactoryTarget.Component });
3037
3134
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxStepperCount, isStandalone: true, selector: "cngx-stepper-count", inputs: { live: { classPropertyName: "live", publicName: "live", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, host: { classPropertyName: "host", publicName: "host", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-stepper-count" }, ngImport: i0, template: `
3038
3135
  @if (live()) {
@@ -3053,7 +3150,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3053
3150
  `, host: {
3054
3151
  class: 'cngx-stepper-count',
3055
3152
  }, styles: [".cngx-stepper-count span{unicode-bidi:var(--cngx-stepper-count-bidi, isolate);direction:var(--cngx-stepper-count-direction, inherit)}\n"] }]
3056
- }], propDecorators: { live: [{ type: i0.Input, args: [{ isSignal: true, alias: "live", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], host: [{ type: i0.Input, args: [{ isSignal: true, alias: "host", required: false }] }] } });
3153
+ }], ctorParameters: () => [], propDecorators: { live: [{ type: i0.Input, args: [{ isSignal: true, alias: "live", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], host: [{ type: i0.Input, args: [{ isSignal: true, alias: "host", required: false }] }] } });
3057
3154
 
3058
3155
  /**
3059
3156
  * Turns any clickable element into a stepper "Back" control. Resolves
@@ -3062,11 +3159,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3062
3159
  * ambient {@link CNGX_STEPPER_HOST}.
3063
3160
  *
3064
3161
  * `(click)` retreats via `selectPrevious()`. The control disables itself
3065
- * when there is no earlier step (`!canGoPrevious()`) OR while a commit is
3066
- * in flight (`busy()`): `selectPrevious()` writes `activeStepIndex`
3067
- * directly, bypassing the commit controller, so disabling it during an
3068
- * in-flight forward commit prevents a navigate-mid-commit race. The gate
3069
- * is the host's `canGoPrevious` bound - never re-derived from `stepsOnly`.
3162
+ * when there is no earlier step (`!canGoPrevious()`) OR while a commit or
3163
+ * the finish run is in flight (`busy()`): `selectPrevious()` writes
3164
+ * `activeStepIndex` directly, bypassing the commit controller, so
3165
+ * disabling it during an in-flight forward commit or finish run prevents
3166
+ * a navigate-mid-run race. The gate is the host's `canGoPrevious` bound -
3167
+ * never re-derived from `stepsOnly`.
3070
3168
  *
3071
3169
  * Reflects the disabled state via `aria-disabled` only - never native
3072
3170
  * `disabled` - so the control stays focusable and AT-reachable; the
@@ -3076,11 +3174,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3076
3174
  * <button cngxStepperPrevious>Back</button>
3077
3175
  * ```
3078
3176
  *
3079
- * @category common/stepper
3080
- * @docsKind primary
3081
3177
  * @wcag AA
3082
3178
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/controls/stepper-previous.directive.ts
3083
- * @since 0.1.0
3179
+ * @since 0.3.0
3084
3180
  * @relatedTo CngxStepperNext, CngxStepperComplete, CngxStepperHost
3085
3181
  */
3086
3182
  class CngxStepperPrevious {
@@ -3092,10 +3188,16 @@ class CngxStepperPrevious {
3092
3188
  host = input(null, ...(ngDevMode ? [{ debugName: "host" }] : /* istanbul ignore next */ []));
3093
3189
  injectedHost = inject(CNGX_STEPPER_HOST, { optional: true });
3094
3190
  resolvedHost = computed(() => this.host() ?? this.injectedHost, ...(ngDevMode ? [{ debugName: "resolvedHost" }] : /* istanbul ignore next */ []));
3095
- coPlacedAsyncClick = inject(CngxAsyncClick, { self: true, optional: true });
3191
+ coPlacedAsyncClick = inject(CNGX_ASYNC_RUN_STATE, {
3192
+ self: true,
3193
+ optional: true,
3194
+ });
3096
3195
  elementRef = inject(ElementRef);
3097
3196
  i18n = injectStepperI18n();
3098
3197
  constructor() {
3198
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
3199
+ warnStepperControlUnhosted('cngxStepperPrevious', this.resolvedHost);
3200
+ }
3099
3201
  // Fallback accessible name for icon-only hosts: while the element
3100
3202
  // renders no text and the consumer supplied no label of their own,
3101
3203
  // the i18n `previousStep` phrase fills the gap. Re-checked after every
@@ -3128,8 +3230,8 @@ class CngxStepperPrevious {
3128
3230
  el.setAttribute('aria-label', label);
3129
3231
  }
3130
3232
  });
3131
- if (isDevMode() && this.coPlacedAsyncClick) {
3132
- console.warn('CngxStepperPrevious: [cngxStepperPrevious] and [cngxAsyncClick] on the same element ' +
3233
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && this.coPlacedAsyncClick) {
3234
+ cngxDevWarn('CNGX1038', '[cngxStepperPrevious] and [cngxAsyncClick] on the same element ' +
3133
3235
  'both gate aria-disabled. Use one or the other.');
3134
3236
  }
3135
3237
  }
@@ -3169,8 +3271,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3169
3271
  *
3170
3272
  * `(click)` advances via `selectNext()`. A turnkey re-entrancy guard
3171
3273
  * disables the control when there is no enabled next step
3172
- * (`!canGoNext()`) OR while a commit is in flight (`busy()`) - an opt-in
3173
- * guard a consumer forgets is a silent double-commit (Pillar 2). The
3274
+ * (`!canGoNext()`) OR while a commit or the finish run is in flight
3275
+ * (`busy()`) - an opt-in guard a consumer forgets is a silent
3276
+ * double-commit (Pillar 2). The
3174
3277
  * gate reads the host's `canGoNext` bound, which derives from the same
3175
3278
  * `select()` predicates, so the affordance can never drift from the
3176
3279
  * navigation it triggers.
@@ -3187,11 +3290,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3187
3290
  * <button cngxStepperNext>Continue</button>
3188
3291
  * ```
3189
3292
  *
3190
- * @category common/stepper
3191
- * @docsKind primary
3192
3293
  * @wcag AA
3193
3294
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/controls/stepper-next.directive.ts
3194
- * @since 0.1.0
3295
+ * @since 0.3.0
3195
3296
  * @relatedTo CngxStepperPrevious, CngxStepperComplete, CngxAsyncStatus, CngxStepperHost
3196
3297
  */
3197
3298
  class CngxStepperNext {
@@ -3203,7 +3304,10 @@ class CngxStepperNext {
3203
3304
  host = input(null, ...(ngDevMode ? [{ debugName: "host" }] : /* istanbul ignore next */ []));
3204
3305
  injectedHost = inject(CNGX_STEPPER_HOST, { optional: true });
3205
3306
  resolvedHost = computed(() => this.host() ?? this.injectedHost, ...(ngDevMode ? [{ debugName: "resolvedHost" }] : /* istanbul ignore next */ []));
3206
- coPlacedAsyncClick = inject(CngxAsyncClick, { self: true, optional: true });
3307
+ coPlacedAsyncClick = inject(CNGX_ASYNC_RUN_STATE, {
3308
+ self: true,
3309
+ optional: true,
3310
+ });
3207
3311
  elementRef = inject(ElementRef);
3208
3312
  i18n = injectStepperI18n();
3209
3313
  /** `true` when advancing is unavailable: no enabled next step or commit busy. */
@@ -3212,6 +3316,9 @@ class CngxStepperNext {
3212
3316
  return !host || !host.canGoNext() || host.busy();
3213
3317
  }, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
3214
3318
  constructor() {
3319
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
3320
+ warnStepperControlUnhosted('cngxStepperNext', this.resolvedHost);
3321
+ }
3215
3322
  // Fallback accessible name for icon-only hosts: while the element
3216
3323
  // renders no text and the consumer supplied no label of their own,
3217
3324
  // the i18n `nextStep` phrase fills the gap. Re-checked after every
@@ -3244,8 +3351,8 @@ class CngxStepperNext {
3244
3351
  el.setAttribute('aria-label', label);
3245
3352
  }
3246
3353
  });
3247
- if (isDevMode() && this.coPlacedAsyncClick) {
3248
- console.warn('CngxStepperNext: [cngxStepperNext] and [cngxAsyncClick] on the same element ' +
3354
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && this.coPlacedAsyncClick) {
3355
+ cngxDevWarn('CNGX1038', '[cngxStepperNext] and [cngxAsyncClick] on the same element ' +
3249
3356
  'both gate aria-disabled. Use one or the other.');
3250
3357
  }
3251
3358
  }
@@ -3285,7 +3392,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3285
3392
  * falling back to the ambient {@link CNGX_STEPPER_HOST}. {@link isActive}
3286
3393
  * exposes whether the active step is the last one, so a consumer renders
3287
3394
  * the finish control only on the final step. `(completed)` emits once
3288
- * after the action resolves successfully.
3395
+ * per successful run of the action.
3289
3396
  *
3290
3397
  * ```html
3291
3398
  * @if (s.presenter.isLastStep()) {
@@ -3293,11 +3400,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3293
3400
  * }
3294
3401
  * ```
3295
3402
  *
3296
- * @category common/stepper
3297
- * @docsKind primary
3298
3403
  * @wcag AA
3299
3404
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/stepper/controls/stepper-complete.directive.ts
3300
- * @since 0.1.0
3405
+ * @since 0.3.0
3301
3406
  * @relatedTo CngxStepperNext, CngxStepperPrevious, CngxAsyncClick, CngxStepperHost
3302
3407
  */
3303
3408
  class CngxStepperComplete {
@@ -3308,28 +3413,45 @@ class CngxStepperComplete {
3308
3413
  */
3309
3414
  host = input(null, ...(ngDevMode ? [{ debugName: "host" }] : /* istanbul ignore next */ []));
3310
3415
  /**
3311
- * Emits once per `pending → success` transition of the finish action.
3312
- * Does NOT re-emit when the `feedbackDuration` window resets the runner
3313
- * back to idle - the transition tracker guards on the success edge only.
3416
+ * Emits once per successful run of the finish action, driven by the
3417
+ * runner's `(settled)` event: two runs that succeed before change
3418
+ * detection emit twice. Never on failure, cancel or after destroy, and
3419
+ * not when the `feedbackDuration` window resets the runner to idle.
3314
3420
  */
3315
3421
  completed = output();
3316
3422
  injectedHost = inject(CNGX_STEPPER_HOST, { optional: true });
3317
3423
  resolvedHost = computed(() => this.host() ?? this.injectedHost, ...(ngDevMode ? [{ debugName: "resolvedHost" }] : /* istanbul ignore next */ []));
3318
- runner = inject(CngxAsyncClick, { host: true });
3424
+ runner = inject(CNGX_ASYNC_RUN_STATE, { host: true });
3425
+ // Busy for the run and for the held busy visual after it. The runner's own
3426
+ // [busy] hint and a host-reflected busy stay out: they are not this run.
3427
+ busy = computed(() => this.runner.pending() || this.runner.busyVisible(), ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
3428
+ busyKey = nextUid('cngx-stepper-complete');
3319
3429
  /** `true` when the active step is the last one - the finish step. */
3320
3430
  isActive = computed(() => this.resolvedHost()?.isLastStep() ?? false, ...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
3321
3431
  constructor() {
3322
- const tracker = createTransitionTracker(() => this.runner.status());
3323
- effect(() => {
3324
- if (tracker.current() === 'success' && tracker.previous() !== 'success') {
3325
- // Consumer handlers run outside the tracking context so their
3326
- // ambient signal reads cannot widen this effect's dep graph.
3327
- untracked(() => this.completed.emit());
3432
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
3433
+ warnStepperControlUnhosted('cngxStepperComplete', this.resolvedHost);
3434
+ }
3435
+ // The run and its dwell hold the host busy, so Back, Next and header
3436
+ // navigation refuse while Finish runs. register() reads and writes the
3437
+ // registry's own signal, so the call stays untracked; only the host is a
3438
+ // dependency.
3439
+ effect((onCleanup) => {
3440
+ const host = this.resolvedHost();
3441
+ const release = untracked(() => host?.registerBusy?.(this.busyKey, this.busy));
3442
+ if (release) {
3443
+ onCleanup(release);
3444
+ }
3445
+ });
3446
+ // The subscription ends with the runner, which shares this element.
3447
+ this.runner.settled.subscribe((settle) => {
3448
+ if (settle.status === 'success') {
3449
+ this.completed.emit();
3328
3450
  }
3329
3451
  });
3330
3452
  }
3331
3453
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStepperComplete, deps: [], target: i0.ɵɵFactoryTarget.Directive });
3332
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxStepperComplete, isStandalone: true, selector: "[cngxStepperComplete]", inputs: { host: { classPropertyName: "host", publicName: "host", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { completed: "completed" }, exportAs: ["cngxStepperComplete"], hostDirectives: [{ directive: i1.CngxAsyncClick, inputs: ["cngxAsyncClick", "cngxStepperComplete", "feedbackDuration", "feedbackDuration", "enabled", "enabled", "succeededAnnouncement", "succeededAnnouncement", "failedAnnouncement", "failedAnnouncement"] }], ngImport: i0 });
3454
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxStepperComplete, isStandalone: true, selector: "[cngxStepperComplete]", inputs: { host: { classPropertyName: "host", publicName: "host", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { completed: "completed" }, exportAs: ["cngxStepperComplete"], hostDirectives: [{ directive: i1.CngxAsyncClick, inputs: ["cngxAsyncClick", "cngxStepperComplete", "feedbackDuration", "feedbackDuration", "enabled", "enabled", "succeededAnnouncement", "succeededAnnouncement", "failedAnnouncement", "failedAnnouncement", "showDelay", "showDelay", "minDwell", "minDwell"] }], ngImport: i0 });
3333
3455
  }
3334
3456
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStepperComplete, decorators: [{
3335
3457
  type: Directive,
@@ -3346,6 +3468,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3346
3468
  'enabled',
3347
3469
  'succeededAnnouncement',
3348
3470
  'failedAnnouncement',
3471
+ 'showDelay',
3472
+ 'minDwell',
3349
3473
  ],
3350
3474
  },
3351
3475
  ],
@@ -3353,6 +3477,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3353
3477
  }], ctorParameters: () => [], propDecorators: { host: [{ type: i0.Input, args: [{ isSignal: true, alias: "host", required: false }] }], completed: [{ type: i0.Output, args: ["completed"] }] } });
3354
3478
 
3355
3479
  const EMPTY_NODES = Object.freeze([]);
3480
+ const NO_RELEASE = () => undefined;
3356
3481
  /**
3357
3482
  * Builds a live delegating {@link CngxStepperHost} proxy over a supplier
3358
3483
  * signal. Every signal member is a `computed()` reading
@@ -3372,8 +3497,7 @@ const EMPTY_NODES = Object.freeze([]);
3372
3497
  * only). Single consumer (the footer); the surface is load-bearing, not
3373
3498
  * speculative.
3374
3499
  *
3375
- * @category common/stepper
3376
- * @since 0.1.0
3500
+ * @since 0.3.0
3377
3501
  * @relatedTo CngxStepperFooter, CngxStepperHost
3378
3502
  */
3379
3503
  function createStepperHostProxy(supplier) {
@@ -3393,6 +3517,7 @@ function createStepperHostProxy(supplier) {
3393
3517
  commitMode: computed(() => supplier()?.commitMode?.() ?? 'pessimistic'),
3394
3518
  orientation: computed(() => supplier()?.orientation() ?? 'horizontal'),
3395
3519
  intendedStepIndex: computed(() => supplier()?.intendedStepIndex()),
3520
+ lastOutcome: computed(() => supplier()?.lastOutcome()),
3396
3521
  lastFailedIndex: computed(() => supplier()?.lastFailedIndex()),
3397
3522
  originIndexDuringCommit: computed(() => supplier()?.originIndexDuringCommit()),
3398
3523
  // Bounds + labels - the safety-critical canGo* pair collapses to
@@ -3430,11 +3555,14 @@ function createStepperHostProxy(supplier) {
3430
3555
  clearLastFailed: () => supplier()?.clearLastFailed(),
3431
3556
  register: (handle, parentId) => supplier()?.register(handle, parentId),
3432
3557
  unregister: (id) => supplier()?.unregister(id),
3558
+ // Bound to the host current at the call: a later supplier swap leaves
3559
+ // the registration where it is (stepper-accepted-debt §20).
3560
+ registerBusy: (key, pending) => supplier()?.registerBusy?.(key, pending) ?? NO_RELEASE,
3433
3561
  };
3434
3562
  }
3435
3563
 
3436
3564
  /** @internal */
3437
- function partitionFeatures(features) {
3565
+ function partitionFeatures(features, caller) {
3438
3566
  const config = [];
3439
3567
  const i18n = [];
3440
3568
  for (const feat of features) {
@@ -3447,11 +3575,17 @@ function partitionFeatures(features) {
3447
3575
  continue;
3448
3576
  }
3449
3577
  // Unbranded feature - drop + dev-warn (mirrors `provideCngxTabs`).
3450
- if (isDevMode()) {
3451
- console.warn('[provideCngxStepper] Dropped feature without a `_target` ' +
3452
- 'discriminator. Brand config-side mutators with ' +
3453
- '`defineStepperConfigFeature(...)` (or use a `with*` helper) ' +
3454
- 'and i18n-side mutators with `withStepperI18nLabels(...)`.');
3578
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
3579
+ if (caller === 'provideCngxStepperAt') {
3580
+ cngxDevWarn('CNGX1041', 'provideCngxStepperAt(): dropped feature without a `_target` ' +
3581
+ 'discriminator. Pass config through the `with*` helpers of @cngx/common/stepper ' +
3582
+ 'and labels through `withStepperI18nLabels(...)`.');
3583
+ }
3584
+ else {
3585
+ cngxDevWarn('CNGX1041', 'provideCngxStepper(): dropped feature without a `_target` ' +
3586
+ 'discriminator. Pass config through the `with*` helpers of @cngx/common/stepper ' +
3587
+ 'and labels through `withStepperI18nLabels(...)`.');
3588
+ }
3455
3589
  }
3456
3590
  }
3457
3591
  return { config, i18n };
@@ -3473,17 +3607,14 @@ function partitionFeatures(features) {
3473
3607
  * provideCngxStepper(
3474
3608
  * withStepperDefaultOrientation('vertical'),
3475
3609
  * withStepperLinear(true),
3476
- * withStepperAriaLabels({ stepperRegion: 'Schrittfolge' }),
3477
- * withStepperI18nLabels({ stepperLabel: 'Schrittfolge', previousStep: 'Vorheriger' }),
3610
+ * withStepperI18nLabels({ stepperLabel: 'Bestellschritte', previousStep: 'Vorheriger' }),
3478
3611
  * ),
3479
3612
  * ],
3480
3613
  * });
3481
3614
  * ```
3482
- *
3483
- * @category common/stepper
3484
3615
  */
3485
3616
  function provideCngxStepper(...features) {
3486
- const { config, i18n } = partitionFeatures(features);
3617
+ const { config, i18n } = partitionFeatures(features, 'provideCngxStepper');
3487
3618
  // `provideStepperConfig` returns EnvironmentProviders, `provideStepperI18n`
3488
3619
  // returns Provider - `makeEnvironmentProviders` takes both.
3489
3620
  return makeEnvironmentProviders([
@@ -3501,16 +3632,14 @@ function provideCngxStepper(...features) {
3501
3632
  * viewProviders: [
3502
3633
  * ...provideCngxStepperAt(
3503
3634
  * withStepperDefaultOrientation('vertical'),
3504
- * withStepperI18nLabels({ stepperLabel: 'Schrittfolge' }),
3635
+ * withStepperI18nLabels({ stepperLabel: 'Bestellschritte' }),
3505
3636
  * ),
3506
3637
  * ],
3507
3638
  * })
3508
3639
  * ```
3509
- *
3510
- * @category common/stepper
3511
3640
  */
3512
3641
  function provideCngxStepperAt(...features) {
3513
- const { config, i18n } = partitionFeatures(features);
3642
+ const { config, i18n } = partitionFeatures(features, 'provideCngxStepperAt');
3514
3643
  return [
3515
3644
  // Gate like i18n: an i18n-only call must not plant an empty config
3516
3645
  // at this injector level and shadow an app-wide provideStepperConfig.
@@ -3520,7 +3649,7 @@ function provideCngxStepperAt(...features) {
3520
3649
  }
3521
3650
 
3522
3651
  /**
3523
- * @module @cngx/common/stepper
3652
+ * @module `@cngx/common/stepper`
3524
3653
  *
3525
3654
  * Level-2 directive-only logic for stepper / wizard flows. Ships the
3526
3655
  * presenter brain, atom directives, host tokens, router-sync, config
@@ -3533,5 +3662,5 @@ function provideCngxStepperAt(...features) {
3533
3662
  * Generated bundle index. Do not edit.
3534
3663
  */
3535
3664
 
3536
- export { CNGX_STEPPER_COMMIT_HANDLER_FACTORY, CNGX_STEPPER_CONFIG, CNGX_STEPPER_GLYPHS, CNGX_STEPPER_HOST, CNGX_STEPPER_I18N, CNGX_STEPPER_LANGUAGE_EN, CNGX_STEP_GROUP_HOST, CNGX_STEP_PANEL_HOST, CngxDotStepperDot, CngxStep, CngxStepBadge, CngxStepBusySpinner, CngxStepContent, CngxStepError, CngxStepGroup, CngxStepGroupHeader, CngxStepIndicator, CngxStepLabel, CngxStepRejection, CngxStepperComplete, CngxStepperCount, CngxStepperEmpty, CngxStepperNext, CngxStepperPresenter, CngxStepperPrevious, CngxStepperRouterSync, CngxStepperSwipeNav, STEPPER_DEFAULT_DENSITY_BREAKPOINTS, createStepperAccname, createStepperAnnouncementBuilders, createStepperCommitHandler, createStepperDisplayMode, createStepperGroupNavigation, createStepperGroupSummary, createStepperHostAttrs, createStepperHostProxy, createStepperPanelRefs, createStepperSlotContextBuilders, createStepperStateView, createStepperStripKeyboardNav, createStepperTemplateBindings, createStripDensity, flatStepsEqual, injectStepperCollapse, injectStepperConfig, injectStepperI18n, provideCngxStepper, provideCngxStepperAt, provideStepperConfig, provideStepperConfigAt, provideStepperI18n, resolveStepperErrorSummary, resolveStepperStatusLabel, withDotStepperDotTemplate, withStepBadgeTemplate, withStepBusySpinnerTemplate, withStepErrorTemplate, withStepGroupHeaderTemplate, withStepIndicatorTemplate, withStepRejectionTemplate, withStepperAriaLabels, withStepperCommitMode, withStepperConnectors, withStepperDefaultOrientation, withStepperDensity, withStepperEmptyTemplate, withStepperFallbackLabels, withStepperGroupCollapse, withStepperGroupCollapseSummary, withStepperHeaderNavigation, withStepperI18nLabels, withStepperLinear, withStepperMobileCollapse, withStepperMobileIndicatorPosition, withStepperMobileSwipe, withStepperRouterSync, withStepperSkin };
3665
+ export { CNGX_STEPPER_COMMIT_HANDLER_FACTORY, CNGX_STEPPER_CONFIG, CNGX_STEPPER_HOST, CNGX_STEPPER_I18N, CNGX_STEPPER_LANGUAGE_EN, CNGX_STEP_GROUP_HOST, CNGX_STEP_PANEL_HOST, CngxDotStepperDot, CngxStep, CngxStepBadge, CngxStepBusySpinner, CngxStepContent, CngxStepError, CngxStepGroup, CngxStepGroupHeader, CngxStepIndicator, CngxStepLabel, CngxStepRejection, CngxStepperComplete, CngxStepperCount, CngxStepperEmpty, CngxStepperNext, CngxStepperPresenter, CngxStepperPrevious, CngxStepperRouterSync, CngxStepperSwipeNav, createStepperAccname, createStepperAnnouncementBuilders, createStepperCommitHandler, createStepperDisplayMode, createStepperGroupNavigation, createStepperGroupSummary, createStepperHostAttrs, createStepperHostProxy, createStepperPanelRefs, createStepperSlotContextBuilders, createStepperStateView, createStepperStripKeyboardNav, createStepperTemplateBindings, flatStepsEqual, injectStepperCollapse, injectStepperConfig, injectStepperI18n, provideCngxStepper, provideCngxStepperAt, provideStepperConfig, provideStepperConfigAt, provideStepperI18n, resolveStepperErrorSummary, resolveStepperStatusLabel, withDotStepperDotTemplate, withStepBadgeTemplate, withStepBusySpinnerTemplate, withStepErrorTemplate, withStepGroupHeaderTemplate, withStepIndicatorTemplate, withStepRejectionTemplate, withStepperCommitMode, withStepperConnectors, withStepperDefaultOrientation, withStepperDensity, withStepperEmptyTemplate, withStepperFallbackLabels, withStepperGroupCollapse, withStepperGroupCollapseSummary, withStepperHeaderNavigation, withStepperI18nLabels, withStepperLinear, withStepperMobileCollapse, withStepperMobileIndicatorPosition, withStepperMobileSwipe, withStepperRouterSync, withStepperSkin };
3537
3666
  //# sourceMappingURL=cngx-common-stepper.mjs.map