@cngx/common 0.1.0-rc.8 → 0.1.0-rc.9

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 (52) hide show
  1. package/command/README.md +29 -0
  2. package/data/README.md +5 -2
  3. package/fesm2022/cngx-common-a11y.mjs +403 -84
  4. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  5. package/fesm2022/cngx-common-audio.mjs +16 -13
  6. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  7. package/fesm2022/cngx-common-card.mjs +4 -3
  8. package/fesm2022/cngx-common-card.mjs.map +1 -1
  9. package/fesm2022/cngx-common-chart.mjs +55 -36
  10. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  11. package/fesm2022/cngx-common-command.mjs +60 -6
  12. package/fesm2022/cngx-common-command.mjs.map +1 -1
  13. package/fesm2022/cngx-common-data.mjs +185 -37
  14. package/fesm2022/cngx-common-data.mjs.map +1 -1
  15. package/fesm2022/cngx-common-dialog.mjs +86 -48
  16. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  17. package/fesm2022/cngx-common-display.mjs +27 -23
  18. package/fesm2022/cngx-common-display.mjs.map +1 -1
  19. package/fesm2022/cngx-common-interactive.mjs +324 -122
  20. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  21. package/fesm2022/cngx-common-layout.mjs +129 -26
  22. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  23. package/fesm2022/cngx-common-popover.mjs +947 -33
  24. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  25. package/fesm2022/cngx-common-stepper.mjs +300 -166
  26. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  27. package/fesm2022/cngx-common-tabs.mjs +251 -80
  28. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  29. package/fesm2022/cngx-common-timeline.mjs +16 -10
  30. package/fesm2022/cngx-common-timeline.mjs.map +1 -1
  31. package/fesm2022/cngx-common.mjs +1 -1
  32. package/layout/README.md +16 -0
  33. package/package.json +20 -7
  34. package/popover/README.md +40 -0
  35. package/schematics/collection.json +9 -0
  36. package/schematics/ng-add/index.js +9 -0
  37. package/schematics/ng-add/schema.json +91 -0
  38. package/schematics/package.json +3 -0
  39. package/stepper/README.md +5 -4
  40. package/theming/components/cngx-popover-sheet.css +402 -0
  41. package/theming/components/cngx-popover.css +10 -6
  42. package/types/cngx-common-a11y.d.ts +167 -14
  43. package/types/cngx-common-chart.d.ts +8 -7
  44. package/types/cngx-common-command.d.ts +19 -2
  45. package/types/cngx-common-data.d.ts +164 -26
  46. package/types/cngx-common-dialog.d.ts +3 -7
  47. package/types/cngx-common-interactive.d.ts +52 -17
  48. package/types/cngx-common-layout.d.ts +37 -5
  49. package/types/cngx-common-popover.d.ts +353 -13
  50. package/types/cngx-common-stepper.d.ts +168 -129
  51. package/types/cngx-common-tabs.d.ts +149 -30
  52. package/types/cngx-common-timeline.d.ts +27 -7
@@ -1,22 +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
5
  import { createNestedOverrideMerge, createOverrideMerge, createTransitionTracker, CNGX_STATEFUL, nextUid, coerceSignal, 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
14
  import { 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.
19
+ * one {@link CngxStepperCommitResolution}: `true` accepts, `false` refuses
20
+ * (the controller settles to `'idle'` and stores no error), a throw fails.
20
21
  *
21
22
  * @category common/stepper
22
23
  */
@@ -26,8 +27,9 @@ function createStepperCommitHandler(opts) {
26
27
  isCommitting: controller.isCommitting,
27
28
  beginTransition(fromIndex, toIndex, action, onResolve) {
28
29
  controller.begin((handlers) => runStepperAction(action, fromIndex, toIndex, handlers), toIndex, fromIndex, {
29
- onSuccess: () => onResolve(true),
30
- onError: () => onResolve(false),
30
+ onSuccess: () => onResolve('accepted'),
31
+ onError: () => onResolve('failed'),
32
+ onRefused: () => onResolve('refused'),
31
33
  });
32
34
  },
33
35
  cancel() {
@@ -47,7 +49,7 @@ function runStepperAction(action, fromIndex, toIndex, handlers) {
47
49
  handlers.onSuccess(toIndex);
48
50
  }
49
51
  else {
50
- handlers.onError(new Error('Stepper transition refused by commitAction'));
52
+ handlers.onRefused();
51
53
  }
52
54
  };
53
55
  const safeError = (err) => {
@@ -96,7 +98,9 @@ function runStepperAction(action, fromIndex, toIndex, handlers) {
96
98
  // EMPTY-style sources complete without emitting; without this arm
97
99
  // the commit stays 'pending' forever and busy() latches true.
98
100
  if (!done) {
99
- safeError(new Error('Stepper commitAction completed without emitting'));
101
+ safeError(new CngxRuntimeError('CNGX1059', typeof ngDevMode !== 'undefined' &&
102
+ ngDevMode &&
103
+ '[cngxStepper] commitAction completed without emitting true or false.'));
100
104
  }
101
105
  },
102
106
  });
@@ -156,11 +160,15 @@ const CNGX_STEPPER_LANGUAGE_EN = {
156
160
  commitInFlight: 'Saving step…',
157
161
  commitRolledBackTo: 'Reverted to step "{origin}".',
158
162
  stepRolledBack: '{base} This step was rolled back.',
163
+ commitRefused: 'Step change not allowed - stayed on step "{origin}".',
164
+ commitRefusedGeneric: 'Step change not allowed.',
165
+ stepRefused: '{base} This step change was not allowed.',
159
166
  statusLabels: {
160
167
  done: 'Done',
161
168
  inProgress: 'In progress',
162
169
  upNext: 'Up next',
163
170
  errored: 'Errored',
171
+ refused: 'Not allowed',
164
172
  },
165
173
  textStepperFormat: 'Step {current} of {count}',
166
174
  groupSummaryCount: { one: '{count} step', other: '{count} steps' },
@@ -188,6 +196,9 @@ function stepperBundleFrom(section, locale) {
188
196
  commitInFlight: section.commitInFlight,
189
197
  commitRolledBackTo: (origin) => formatMessage(section.commitRolledBackTo, { origin }, locale),
190
198
  stepRolledBack: (base) => formatMessage(section.stepRolledBack, { base }, locale),
199
+ commitRefused: (origin) => formatMessage(section.commitRefused, { origin }, locale),
200
+ commitRefusedGeneric: section.commitRefusedGeneric,
201
+ stepRefused: (base) => formatMessage(section.stepRefused, { base }, locale),
191
202
  statusLabels: section.statusLabels,
192
203
  textStepperFormat: (current, count) => formatMessage(section.textStepperFormat, { current, count }, locale),
193
204
  groupSummaryCount: (count) => formatMessage(section.groupSummaryCount, { count }, locale),
@@ -280,18 +291,6 @@ function injectStepperI18n() {
280
291
  return stepperBundle.resolve(inject(CNGX_STEPPER_I18N));
281
292
  }
282
293
 
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
294
  /** @internal */
296
295
  const STEPPER_CONFIG_DEFAULTS = {
297
296
  defaultOrientation: 'horizontal',
@@ -304,7 +303,6 @@ const STEPPER_CONFIG_DEFAULTS = {
304
303
  groupCollapse: 'off',
305
304
  groupCollapseSummary: 'progress',
306
305
  density: 'comfortable',
307
- densityBreakpoints: STEPPER_DEFAULT_DENSITY_BREAKPOINTS,
308
306
  connectors: false,
309
307
  mobileCollapse: 'text',
310
308
  mobileIndicatorPosition: 'top',
@@ -494,21 +492,17 @@ function withStepperGroupCollapseSummary(mode) {
494
492
  }
495
493
  /**
496
494
  * 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.
495
+ * `<cngx-stepper>` strip. `'auto'` sets `[data-density-auto]`, under
496
+ * which the labels shrink in flow within a cqi budget (the step furthest
497
+ * from the active one gives way first) instead of overflowing the strip;
498
+ * `'comfortable'` (library default) keeps full labels at every width.
499
+ * Orthogonal to the `mobileCollapse` axis; the Material twin ignores this
500
+ * setting.
503
501
  *
504
502
  * @category common/stepper
505
503
  */
506
- function withStepperDensity(mode, breakpoints) {
507
- return defineStepperConfigFeature((cfg) => ({
508
- ...cfg,
509
- density: mode,
510
- ...(breakpoints ? { densityBreakpoints: breakpoints } : {}),
511
- }));
504
+ function withStepperDensity(mode) {
505
+ return defineStepperConfigFeature((cfg) => ({ ...cfg, density: mode }));
512
506
  }
513
507
  /**
514
508
  * Merge ARIA labels into the cascade. Keys not provided keep their
@@ -621,10 +615,11 @@ function withStepperEmptyTemplate(template) {
621
615
  }));
622
616
  }
623
617
  /**
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).
618
+ * Override the default `*cngxDotStepperDot` template app-wide. Both dot
619
+ * hosts resolve the cascade per dot - `<cngx-dot-stepper>` and the dots
620
+ * mobile-collapse branch of `<cngx-stepper>`: per-instance directive >
621
+ * this feature > built-in empty body (the dot fill is painted by the dot
622
+ * element's CSS regardless).
628
623
  *
629
624
  * @category common/stepper
630
625
  */
@@ -707,6 +702,25 @@ function injectStepperConfig() {
707
702
  * @since 0.1.0
708
703
  */
709
704
  const CNGX_STEPPER_HOST = new InjectionToken('CngxStepperHost');
705
+ /**
706
+ * Inject the {@link CNGX_STEPPER_HOST} for a stepper add-on directive.
707
+ * Throws a `CngxRuntimeError` with code `CNGX1055` when no stepper presenter
708
+ * is found, in development and production alike. With `host: true` the
709
+ * lookup stops at the declaring template's host, so the presenter has to sit
710
+ * on the same element or an ancestor in the same template. `selector` names
711
+ * the add-on in the development message.
712
+ *
713
+ * @internal
714
+ */
715
+ function injectStepperHost(selector, options) {
716
+ const stepper = inject(CNGX_STEPPER_HOST, { host: options.host, optional: true });
717
+ if (!stepper) {
718
+ throw new CngxRuntimeError('CNGX1055', typeof ngDevMode !== 'undefined' &&
719
+ ngDevMode &&
720
+ `[${selector}] must be placed on or inside an element with [cngxStepper], such as <cngx-stepper>.`);
721
+ }
722
+ return stepper;
723
+ }
710
724
 
711
725
  /**
712
726
  * DFS-flatten a step tree. Group nodes emit before their children;
@@ -842,9 +856,16 @@ class CngxStepperPresenter {
842
856
  * `linkedSignal` is shared across all consumers.
843
857
  */
844
858
  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 */ []));
859
+ // Persistence-of-rejection surface - see CngxStepperHost.lastOutcome /
860
+ // lastFailedIndex / originIndexDuringCommit for the contract. Two
861
+ // event sources, never synced: the settle record and the sequence whose
862
+ // visual marker was cleared. lastFailedIndex derives from both, so
863
+ // clearing the marker never touches the announcement record.
864
+ lastOutcomeState = signal(undefined, ...(ngDevMode ? [{ debugName: "lastOutcomeState" }] : /* istanbul ignore next */ []));
865
+ clearedSequenceState = signal(undefined, ...(ngDevMode ? [{ debugName: "clearedSequenceState" }] : /* istanbul ignore next */ []));
866
+ // Bumped once per settled refusal or failure. Plain field - only read
867
+ // inside the resolve handler.
868
+ outcomeSequence = 0;
848
869
  // Last index a commit actually landed on (or a sync/back move settled
849
870
  // on). Rollback + origin resolution use this instead of the per-call
850
871
  // `previous`: a rapid second select() supersedes the first while
@@ -853,8 +874,13 @@ class CngxStepperPresenter {
853
874
  // read only inside handlers, never rendered.
854
875
  lastCommittedIndex;
855
876
  originIndexDuringCommitState = signal(undefined, ...(ngDevMode ? [{ debugName: "originIndexDuringCommitState" }] : /* istanbul ignore next */ []));
877
+ /** {@inheritDoc CngxStepperHost.lastOutcome} */
878
+ lastOutcome = this.lastOutcomeState.asReadonly();
856
879
  /** {@inheritDoc CngxStepperHost.lastFailedIndex} */
857
- lastFailedIndex = this.lastFailedIndexState.asReadonly();
880
+ lastFailedIndex = computed(() => {
881
+ const outcome = this.lastOutcomeState();
882
+ return outcome && outcome.sequence !== this.clearedSequenceState() ? outcome.index : undefined;
883
+ }, ...(ngDevMode ? [{ debugName: "lastFailedIndex" }] : /* istanbul ignore next */ []));
858
884
  /** {@inheritDoc CngxStepperHost.originIndexDuringCommit} */
859
885
  originIndexDuringCommit = this.originIndexDuringCommitState.asReadonly();
860
886
  treeState = signal([], { ...(ngDevMode ? { debugName: "treeState" } : /* istanbul ignore next */ {}), equal: stepTreeEqual });
@@ -995,11 +1021,11 @@ class CngxStepperPresenter {
995
1021
  /** {@inheritDoc CngxStepperHost.previousStepLabel} */
996
1022
  previousStepLabel = computed(() => this.stepsOnly()[this.previousEnabledIndex()]?.label(), ...(ngDevMode ? [{ debugName: "previousStepLabel" }] : /* istanbul ignore next */ []));
997
1023
  constructor() {
998
- if (isDevMode()) {
1024
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
999
1025
  afterNextRender(() => {
1000
1026
  const stepNodes = this.flatSteps().filter((n) => n.kind === 'step');
1001
1027
  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');
1028
+ cngxDevWarn('CNGX1039', '[cngxStepper] more than 6 steps and none inside a [cngxStepGroup]; consider wrapping logical groups of steps in [cngxStepGroup] for better UX');
1003
1029
  }
1004
1030
  });
1005
1031
  }
@@ -1073,7 +1099,7 @@ class CngxStepperPresenter {
1073
1099
  }
1074
1100
  /** {@inheritDoc CngxStepperHost.clearLastFailed} */
1075
1101
  clearLastFailed() {
1076
- this.lastFailedIndexState.set(undefined);
1102
+ this.clearedSequenceState.set(this.lastOutcomeState()?.sequence);
1077
1103
  }
1078
1104
  /**
1079
1105
  * Linear-gate predicate: `true` when linear mode forbids advancing to
@@ -1132,8 +1158,8 @@ class CngxStepperPresenter {
1132
1158
  // flag if the user re-picked a previously-failed target.
1133
1159
  this.activeStepIndex.set(target);
1134
1160
  this.lastCommittedIndex = target;
1135
- if (this.lastFailedIndexState() === target) {
1136
- this.lastFailedIndexState.set(undefined);
1161
+ if (this.lastFailedIndex() === target) {
1162
+ this.clearLastFailed();
1137
1163
  }
1138
1164
  return;
1139
1165
  }
@@ -1157,28 +1183,31 @@ class CngxStepperPresenter {
1157
1183
  if (mode === 'optimistic') {
1158
1184
  this.activeStepIndex.set(target);
1159
1185
  }
1160
- this.commitHandler.beginTransition(previous, target, action, (accept) => {
1161
- if (accept) {
1186
+ this.commitHandler.beginTransition(previous, target, action, (outcome) => {
1187
+ if (outcome === 'accepted') {
1162
1188
  // Success - origin no longer needed; clear the rejection
1163
- // flag if the user re-picked the failed target.
1189
+ // marker if the user re-picked the rejected target.
1164
1190
  this.lastCommittedIndex = target;
1165
1191
  this.originIndexDuringCommitState.set(undefined);
1166
- if (this.lastFailedIndexState() === target) {
1167
- this.lastFailedIndexState.set(undefined);
1192
+ if (this.lastFailedIndex() === target) {
1193
+ this.clearLastFailed();
1168
1194
  }
1169
1195
  if (mode === 'pessimistic') {
1170
1196
  this.activeStepIndex.set(target);
1171
1197
  }
1198
+ return;
1172
1199
  }
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
- }
1200
+ // Refused or failed - record the outcome on the target; RETAIN the
1201
+ // origin so `liveAnnouncement` can resolve the origin label for
1202
+ // the rich phrase. Both kinds roll back: optimistic returns to the
1203
+ // last truly-committed index, pessimistic never moved off it.
1204
+ this.lastOutcomeState.set({
1205
+ kind: outcome,
1206
+ index: target,
1207
+ sequence: ++this.outcomeSequence,
1208
+ });
1209
+ if (mode === 'optimistic') {
1210
+ this.activeStepIndex.set(origin);
1182
1211
  }
1183
1212
  });
1184
1213
  }
@@ -1214,7 +1243,8 @@ class CngxStepperPresenter {
1214
1243
  this.activeStepIndex.set(0);
1215
1244
  this.lastCommittedIndex = 0;
1216
1245
  this.originIndexDuringCommitState.set(undefined);
1217
- this.lastFailedIndexState.set(undefined);
1246
+ this.lastOutcomeState.set(undefined);
1247
+ this.clearedSequenceState.set(undefined);
1218
1248
  // Settle mid-commit resets to idle - the surface lives on, so a
1219
1249
  // dangling 'pending' would latch busy() forever.
1220
1250
  this.cancelAndSettleCommit();
@@ -1228,8 +1258,8 @@ class CngxStepperPresenter {
1228
1258
  */
1229
1259
  cancelAndSettleCommit() {
1230
1260
  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 ' +
1261
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && this.commitState.status() === 'pending') {
1262
+ cngxDevWarn('CNGX1040', '[cngxStepper] the commit controller ignored cancel({ settle: true }) - busy stays ' +
1233
1263
  'latched. Honor the settle option in your CNGX_COMMIT_CONTROLLER_FACTORY override.');
1234
1264
  }
1235
1265
  }
@@ -1404,8 +1434,10 @@ class CngxStep {
1404
1434
  destroyRef = inject(DestroyRef);
1405
1435
  constructor() {
1406
1436
  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].');
1437
+ throw new CngxRuntimeError('CNGX1046', typeof ngDevMode !== 'undefined' &&
1438
+ ngDevMode &&
1439
+ '[cngxStep] must be placed inside an element with [cngxStepper], such as ' +
1440
+ '<cngx-stepper>, directly or through a [cngxStepGroup] inside it.');
1409
1441
  }
1410
1442
  }
1411
1443
  ngOnInit() {
@@ -1522,8 +1554,10 @@ class CngxStepGroup {
1522
1554
  }, ...(ngDevMode ? [{ debugName: "isCollapsed" }] : /* istanbul ignore next */ []));
1523
1555
  constructor() {
1524
1556
  if (!this.stepperHost) {
1525
- throw new Error('CngxStepGroup: no enclosing CngxStepperPresenter found. ' +
1526
- 'Wrap the group inside an element carrying [cngxStepper].');
1557
+ throw new CngxRuntimeError('CNGX1047', typeof ngDevMode !== 'undefined' &&
1558
+ ngDevMode &&
1559
+ '[cngxStepGroup] must be placed inside an element with [cngxStepper], ' +
1560
+ 'such as <cngx-stepper>.');
1527
1561
  }
1528
1562
  }
1529
1563
  ngOnInit() {
@@ -1840,7 +1874,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1840
1874
  }] });
1841
1875
 
1842
1876
  /**
1843
- * Slot directive for the dot-body template on `<cngx-dot-stepper>`.
1877
+ * Slot directive for the dot-body template on `<cngx-dot-stepper>` and on
1878
+ * `<cngx-stepper>` (dots mobile-collapse branch, `mobileCollapse: 'dots'`).
1844
1879
  * Discovered via `contentChild`; cascades through
1845
1880
  * `CNGX_STEPPER_CONFIG.templates.dotStepperDot` before falling back to
1846
1881
  * the built-in empty body (the span itself paints the dot fill via CSS).
@@ -1917,6 +1952,9 @@ function createStepperTemplateBindings(opts) {
1917
1952
  empty: computed(() => opts.emptySlot()?.templateRef ??
1918
1953
  opts.config.templates?.empty ??
1919
1954
  null),
1955
+ dot: computed(() => opts.dotSlot?.()?.templateRef ??
1956
+ opts.config.templates?.dotStepperDot ??
1957
+ null),
1920
1958
  };
1921
1959
  }
1922
1960
 
@@ -1939,8 +1977,14 @@ function createStepperTemplateBindings(opts) {
1939
1977
  const CNGX_STEPPER_GLYPHS = {
1940
1978
  /** Default visual for `*cngxStepBadge` when no override is bound. */
1941
1979
  errorBadge: '!',
1942
- /** Default visual for `*cngxStepRejection` when no override is bound. */
1980
+ /** Default visual for `*cngxStepRejection` on a failed commit when no override is bound. */
1943
1981
  rejectionIcon: '!',
1982
+ /**
1983
+ * Default visual for `*cngxStepRejection` on a refused commit (the action
1984
+ * answered `false`). A distinct glyph, so a refusal never differs from a
1985
+ * failure by colour alone (WCAG 1.4.1).
1986
+ */
1987
+ refusedIcon: '\u2298',
1944
1988
  };
1945
1989
 
1946
1990
  /**
@@ -1974,7 +2018,7 @@ class CngxStepperRouterSync {
1974
2018
  paramName = computed(() => this.paramNameInput() ?? this.config.routerSyncParam ?? 'step', ...(ngDevMode ? [{ debugName: "paramName" }] : /* istanbul ignore next */ []));
1975
2019
  /** Emits when a `router.navigate` rejection is observed. */
1976
2020
  syncError = output();
1977
- host = inject(CNGX_STEPPER_HOST, { host: true });
2021
+ host = injectStepperHost('cngxStepperRouterSync', { host: true });
1978
2022
  router = inject(Router, { optional: true });
1979
2023
  /**
1980
2024
  * Latched once the URL seed has reached a registered step, so the
@@ -1989,11 +2033,16 @@ class CngxStepperRouterSync {
1989
2033
  */
1990
2034
  seeded = false;
1991
2035
  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
- });
2036
+ // Router is providedIn: 'root' and resolves without provideRouter(...);
2037
+ // ActivatedRoute does not, so it is the "router is set up" signal.
2038
+ const route = inject(ActivatedRoute, { optional: true });
2039
+ if (!this.router || !route) {
2040
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
2041
+ afterNextRender(() => {
2042
+ cngxDevWarn('CNGX1031', '[cngxStepperRouterSync] no Router / ActivatedRoute available - the URL sync is a no-op. ' +
2043
+ 'Provide @angular/router via provideRouter(...) to enable deep-linking.');
2044
+ });
2045
+ }
1997
2046
  return;
1998
2047
  }
1999
2048
  const router = this.router;
@@ -2196,55 +2245,6 @@ function createStepperDisplayMode(collapsed, mobileCollapse) {
2196
2245
  });
2197
2246
  }
2198
2247
 
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
2248
  /** Terminal-step totals for a group's subtree; reads each step `state()`. */
2249
2249
  function subtreeStats(node) {
2250
2250
  let total = 0;
@@ -2521,32 +2521,58 @@ function createStepperStateView(inputs) {
2521
2521
  }
2522
2522
  return !!node.errorAggregator?.()?.shouldShow?.();
2523
2523
  };
2524
- const hasError = (node) => hasErrorBadge(node) || isRejected(node);
2525
- const erroredSteps = computed(() => stepsOnly().filter((node) => hasError(node)), ...(ngDevMode ? [{ debugName: "erroredSteps" }] : /* istanbul ignore next */ []));
2524
+ const isRefused = (node) => isRejected(node) && presenter.lastOutcome()?.kind === 'refused';
2525
+ const rejectionReason = (node) => {
2526
+ if (!isRejected(node)) {
2527
+ return null;
2528
+ }
2529
+ return isRefused(node) ? 'refused' : 'failed';
2530
+ };
2531
+ const hasErrorMarker = (node) => hasErrorBadge(node) || isRejected(node);
2532
+ const hasError = (node) => hasErrorBadge(node) || (isRejected(node) && !isRefused(node));
2533
+ const erroredSteps = computed(() => stepsOnly().filter((node) => hasError(node)), { ...(ngDevMode ? { debugName: "erroredSteps" } : /* istanbul ignore next */ {}), equal: arrayEqual });
2526
2534
  const errorCount = computed(() => erroredSteps().length, ...(ngDevMode ? [{ debugName: "errorCount" }] : /* istanbul ignore next */ []));
2527
2535
  const firstErrorIndex = computed(() => erroredSteps()[0]?.flatIndex ?? -1, ...(ngDevMode ? [{ debugName: "firstErrorIndex" }] : /* istanbul ignore next */ []));
2528
2536
  const hasAnyError = computed(() => errorCount() > 0, ...(ngDevMode ? [{ debugName: "hasAnyError" }] : /* istanbul ignore next */ []));
2537
+ const markedSteps = computed(() => stepsOnly().filter((node) => hasErrorMarker(node)), { ...(ngDevMode ? { debugName: "markedSteps" } : /* istanbul ignore next */ {}), equal: arrayEqual });
2538
+ const errorMarkerCount = computed(() => markedSteps().length, ...(ngDevMode ? [{ debugName: "errorMarkerCount" }] : /* istanbul ignore next */ []));
2539
+ const firstErrorMarkerIndex = computed(() => markedSteps()[0]?.flatIndex ?? -1, ...(ngDevMode ? [{ debugName: "firstErrorMarkerIndex" }] : /* istanbul ignore next */ []));
2540
+ const hasAnyErrorMarker = computed(() => errorMarkerCount() > 0, ...(ngDevMode ? [{ debugName: "hasAnyErrorMarker" }] : /* istanbul ignore next */ []));
2541
+ const refusalOnly = computed(() => hasAnyErrorMarker() && !hasAnyError(), ...(ngDevMode ? [{ debugName: "refusalOnly" }] : /* istanbul ignore next */ []));
2529
2542
  return {
2530
2543
  statusOf,
2531
2544
  isBusy,
2532
2545
  isRejected,
2546
+ isRefused,
2547
+ rejectionReason,
2533
2548
  hasErrorBadge,
2549
+ hasErrorMarker,
2534
2550
  hasError,
2535
2551
  errorCount,
2536
2552
  firstErrorIndex,
2537
2553
  hasAnyError,
2554
+ errorMarkerCount,
2555
+ firstErrorMarkerIndex,
2556
+ hasAnyErrorMarker,
2557
+ refusalOnly,
2538
2558
  };
2539
2559
  }
2540
2560
  /**
2541
2561
  * 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.
2562
+ * and the classic mobile-collapse text branch. Walks the marked steps
2563
+ * ({@link CngxStepperStateView.hasErrorMarker}). A single marked step names
2564
+ * itself with the word of its kind: `"Payment: Errored"` (or the custom
2565
+ * reason) for an error, `"Payment: Not allowed"` for a refused step change;
2566
+ * several failed steps collapse to the i18n count phrase (`"2 errors"`),
2567
+ * which never counts a refusal. Returns `''`
2568
+ * when no step is marked, so the error line stays quiet.
2546
2569
  *
2547
2570
  * The optional `messageOf` resolver lets callers surface a per-step
2548
2571
  * reason (a direct `[error]` string or the first aggregator label) in the
2549
- * single-error case instead of the generic `errored` status word. When
2572
+ * single-error case instead of the generic `errored` status word. The
2573
+ * reason is still prefixed with the step label (`"Payment: Card declined"`),
2574
+ * because the summary line stays visible while another step is active and
2575
+ * a bare reason would read as belonging to the active step. When
2550
2576
  * omitted - or when it returns `undefined`/`''` - the helper produces
2551
2577
  * byte-identical output to the no-resolver form, so existing callers
2552
2578
  * (the classic mobile-collapse summary) are a guaranteed no-op.
@@ -2561,22 +2587,40 @@ function createStepperStateView(inputs) {
2561
2587
  * @since 0.1.0
2562
2588
  */
2563
2589
  function resolveStepperErrorSummary(view, stepsOnly, i18n, messageOf) {
2564
- const count = view.errorCount();
2590
+ const count = view.errorMarkerCount();
2565
2591
  if (count === 0) {
2566
2592
  return '';
2567
2593
  }
2568
2594
  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;
2595
+ return singleStepPhrase(view, stepsOnly()[view.firstErrorMarkerIndex()], i18n, messageOf);
2596
+ }
2597
+ // A refusal is not an error: the count phrase counts failed steps only. One
2598
+ // error beside a refused step names that error; the refusal keeps its own
2599
+ // marker and announcement.
2600
+ const errors = view.errorCount();
2601
+ if (errors > 1) {
2602
+ return i18n.stepHasErrors(errors);
2603
+ }
2604
+ const index = errors === 1 ? view.firstErrorIndex() : view.firstErrorMarkerIndex();
2605
+ return singleStepPhrase(view, stepsOnly()[index], i18n, messageOf);
2606
+ }
2607
+ /** @internal `"<label>: <detail>"` for one marked step. */
2608
+ function singleStepPhrase(view, node, i18n, messageOf) {
2609
+ const detail = node ? summaryDetail(view, node, i18n, messageOf) : i18n.statusLabels.errored;
2610
+ const label = node ? untracked(node.label) : undefined;
2611
+ return label ? i18n.stepWithDetail(label, detail) : detail;
2612
+ }
2613
+ /**
2614
+ * @internal The word for one marked step: a validation error keeps its
2615
+ * reason, a refused-only step reads the refused word.
2616
+ */
2617
+ function summaryDetail(view, node, i18n, messageOf) {
2618
+ const refusedOnly = view.isRefused(node) && !view.hasErrorBadge(node);
2619
+ if (refusedOnly) {
2620
+ return i18n.statusLabels.refused;
2578
2621
  }
2579
- return i18n.stepHasErrors(count);
2622
+ const custom = messageOf?.(node);
2623
+ return custom !== undefined && custom !== '' ? custom : i18n.statusLabels.errored;
2580
2624
  }
2581
2625
 
2582
2626
  /**
@@ -2668,7 +2712,8 @@ function createStepperSlotContextBuilders(inputs) {
2668
2712
  const failedIndex = node.flatIndex;
2669
2713
  const originIdx = presenter.originIndexDuringCommit();
2670
2714
  const originLabel = originIdx !== undefined ? stepsOnly()[originIdx]?.label() : undefined;
2671
- return { failedIndex, originLabel, node };
2715
+ const reason = stateView.isRefused(node) ? 'refused' : 'failed';
2716
+ return { failedIndex, originLabel, node, reason };
2672
2717
  });
2673
2718
  const stepErrorContextFor = memoizeByNode((node) => {
2674
2719
  const aggregator = node.errorAggregator?.();
@@ -2704,6 +2749,21 @@ function createStepperSlotContextBuilders(inputs) {
2704
2749
  busy: isStepBusy(node),
2705
2750
  disabled: node.disabled(),
2706
2751
  }));
2752
+ // One pass per step-list change, so a dot reads its index in O(1)
2753
+ // instead of scanning the list on every change-detection pass.
2754
+ const stepIndexByNode = computed(() => new Map(stepsOnly().map((node, index) => [node, index])), ...(ngDevMode ? [{ debugName: "stepIndexByNode" }] : /* istanbul ignore next */ []));
2755
+ // Same fields as <cngx-dot-stepper>: index in the step-only projection,
2756
+ // completed = before the active step.
2757
+ const dotContextFor = memoizeByNode((node) => {
2758
+ const index = stepIndexByNode().get(node) ?? -1;
2759
+ return {
2760
+ $implicit: index,
2761
+ index,
2762
+ node,
2763
+ active: isActive(node),
2764
+ completed: index < presenter.activeStepIndex(),
2765
+ };
2766
+ });
2707
2767
  return {
2708
2768
  isActive,
2709
2769
  isStepBusy,
@@ -2718,6 +2778,7 @@ function createStepperSlotContextBuilders(inputs) {
2718
2778
  groupHeaderContextFor,
2719
2779
  stepLabelContextFor,
2720
2780
  stepContentContextFor,
2781
+ dotContextFor,
2721
2782
  };
2722
2783
  }
2723
2784
 
@@ -2730,10 +2791,35 @@ function createStepperSlotContextBuilders(inputs) {
2730
2791
  */
2731
2792
  function createStepperAnnouncementBuilders(inputs) {
2732
2793
  const { presenter, stepsOnly } = inputs;
2794
+ // A refusal leaves the commit status at 'idle', so no status edge can
2795
+ // voice it. The phrase arms on each new refused outcome (a new
2796
+ // sequence) and is spent by the next commit activity, a step move or a
2797
+ // cleared outcome (reset). Arm wins over spend in the same flush, so an
2798
+ // optimistic rollback that moves the step still arms.
2799
+ const refusedPhrase = createRefusedPhrase({
2800
+ outcome: () => presenter.lastOutcome(),
2801
+ status: () => presenter.commitTransition.current(),
2802
+ activeIndex: () => presenter.activeStepIndex(),
2803
+ copy: refusedCopy,
2804
+ });
2805
+ function refusedCopy() {
2806
+ const originIdx = presenter.originIndexDuringCommit();
2807
+ const origin = originIdx !== undefined ? stepsOnly()[originIdx] : undefined;
2808
+ const originLabel = origin?.label();
2809
+ const i18n = inputs.i18n();
2810
+ return originLabel ? i18n.commitRefused(originLabel) : i18n.commitRefusedGeneric;
2811
+ }
2733
2812
  // The live region reads copy untracked: a language switch must not
2734
2813
  // re-speak the last phrase. The next commit transition speaks the new
2735
2814
  // language.
2736
2815
  const liveAnnouncement = computed(() => {
2816
+ // Read the refused phrase EAGERLY: linkedSignal only observes the
2817
+ // snapshots it is read under, so a read behind the pending arm would
2818
+ // miss the status change that spends it.
2819
+ const refused = refusedPhrase();
2820
+ if (refused) {
2821
+ return refused;
2822
+ }
2737
2823
  const current = presenter.commitTransition.current();
2738
2824
  if (current === 'pending') {
2739
2825
  return untracked(() => inputs.i18n().commitInFlight);
@@ -2757,9 +2843,10 @@ function createStepperAnnouncementBuilders(inputs) {
2757
2843
  return '';
2758
2844
  }
2759
2845
  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.
2846
+ // Sync commit-handler failures collapse pending -> error in one signal
2847
+ // flush; tracker sees `previous === 'idle'`. Guard stays loose so a
2848
+ // synchronously throwing `commitAction` still announces. A `false`
2849
+ // answer never reaches this arm: it settles to 'idle' as a refusal.
2763
2850
  const failedIdx = presenter.lastFailedIndex();
2764
2851
  const originIdx = presenter.originIndexDuringCommit();
2765
2852
  if (failedIdx !== undefined && originIdx !== undefined) {
@@ -2786,9 +2873,12 @@ function createStepperAnnouncementBuilders(inputs) {
2786
2873
  if (!base) {
2787
2874
  return '';
2788
2875
  }
2789
- return node.kind === 'step' && node.flatIndex === presenter.lastFailedIndex()
2790
- ? i18n.stepRolledBack(base)
2791
- : base;
2876
+ if (node.kind !== 'step' || node.flatIndex !== presenter.lastFailedIndex()) {
2877
+ return base;
2878
+ }
2879
+ return presenter.lastOutcome()?.kind === 'refused'
2880
+ ? i18n.stepRefused(base)
2881
+ : i18n.stepRolledBack(base);
2792
2882
  };
2793
2883
  // Converged on `statusLabels` - the same phrase map the status pill
2794
2884
  // (resolveStepperStatusLabel) renders, so a group's SR description can
@@ -2897,7 +2987,7 @@ class CngxStepperSwipeNav {
2897
2987
  * defers to the config cascade.
2898
2988
  */
2899
2989
  mobileSwipe = input(undefined, ...(ngDevMode ? [{ debugName: "mobileSwipe" }] : /* istanbul ignore next */ []));
2900
- host = inject(CNGX_STEPPER_HOST);
2990
+ host = injectStepperHost('cngxStepperSwipeNav', { host: false });
2901
2991
  config = injectStepperConfig();
2902
2992
  direction = injectDirection();
2903
2993
  /** Resolved enabled flag (Input -> config -> default(true)). Boolean output, no `equal` fn required. */
@@ -2936,6 +3026,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
2936
3026
  }]
2937
3027
  }], propDecorators: { mobileSwipe: [{ type: i0.Input, args: [{ isSignal: true, alias: "mobileSwipe", required: false }] }] } });
2938
3028
 
3029
+ /**
3030
+ * Dev-warning for a stepper control (`[cngxStepperNext]`,
3031
+ * `[cngxStepperPrevious]`, `[cngxStepperComplete]`, `<cngx-stepper-count>`)
3032
+ * that has neither a bound `[host]` nor an ambient stepper presenter. Such a
3033
+ * control stays disabled or empty for good, so it warns once per instance
3034
+ * after the first render, when the `[host]` binding has settled. Call it from
3035
+ * an injection context.
3036
+ *
3037
+ * @internal
3038
+ */
3039
+ function warnStepperControlUnhosted(selector, host) {
3040
+ if (!(typeof ngDevMode !== 'undefined' && ngDevMode)) {
3041
+ return;
3042
+ }
3043
+ afterNextRender(() => {
3044
+ if (host()) {
3045
+ return;
3046
+ }
3047
+ cngxDevWarn('CNGX1056', `[${selector}] has no stepper. Place it inside a stepper, or bind [host] to the ` +
3048
+ `stepper's presenter when it sits outside.`);
3049
+ });
3050
+ }
3051
+
2939
3052
  /**
2940
3053
  * Reusable progress-hint atom for any stepper organism. Renders the
2941
3054
  * resolved `CngxStepperI18n.textStepperFormat(current, total)` string
@@ -3033,6 +3146,11 @@ class CngxStepperCount {
3033
3146
  }
3034
3147
  return untracked(() => (this.format() ?? this.i18n().textStepperFormat)(position.current, position.total));
3035
3148
  }, ...(ngDevMode ? [{ debugName: "liveLabel" }] : /* istanbul ignore next */ []));
3149
+ constructor() {
3150
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
3151
+ warnStepperControlUnhosted('cngx-stepper-count', this.resolvedHost);
3152
+ }
3153
+ }
3036
3154
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStepperCount, deps: [], target: i0.ɵɵFactoryTarget.Component });
3037
3155
  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
3156
  @if (live()) {
@@ -3053,7 +3171,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3053
3171
  `, host: {
3054
3172
  class: 'cngx-stepper-count',
3055
3173
  }, 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 }] }] } });
3174
+ }], 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
3175
 
3058
3176
  /**
3059
3177
  * Turns any clickable element into a stepper "Back" control. Resolves
@@ -3096,6 +3214,9 @@ class CngxStepperPrevious {
3096
3214
  elementRef = inject(ElementRef);
3097
3215
  i18n = injectStepperI18n();
3098
3216
  constructor() {
3217
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
3218
+ warnStepperControlUnhosted('cngxStepperPrevious', this.resolvedHost);
3219
+ }
3099
3220
  // Fallback accessible name for icon-only hosts: while the element
3100
3221
  // renders no text and the consumer supplied no label of their own,
3101
3222
  // the i18n `previousStep` phrase fills the gap. Re-checked after every
@@ -3128,8 +3249,8 @@ class CngxStepperPrevious {
3128
3249
  el.setAttribute('aria-label', label);
3129
3250
  }
3130
3251
  });
3131
- if (isDevMode() && this.coPlacedAsyncClick) {
3132
- console.warn('CngxStepperPrevious: [cngxStepperPrevious] and [cngxAsyncClick] on the same element ' +
3252
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && this.coPlacedAsyncClick) {
3253
+ cngxDevWarn('CNGX1038', '[cngxStepperPrevious] and [cngxAsyncClick] on the same element ' +
3133
3254
  'both gate aria-disabled. Use one or the other.');
3134
3255
  }
3135
3256
  }
@@ -3212,6 +3333,9 @@ class CngxStepperNext {
3212
3333
  return !host || !host.canGoNext() || host.busy();
3213
3334
  }, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
3214
3335
  constructor() {
3336
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
3337
+ warnStepperControlUnhosted('cngxStepperNext', this.resolvedHost);
3338
+ }
3215
3339
  // Fallback accessible name for icon-only hosts: while the element
3216
3340
  // renders no text and the consumer supplied no label of their own,
3217
3341
  // the i18n `nextStep` phrase fills the gap. Re-checked after every
@@ -3244,8 +3368,8 @@ class CngxStepperNext {
3244
3368
  el.setAttribute('aria-label', label);
3245
3369
  }
3246
3370
  });
3247
- if (isDevMode() && this.coPlacedAsyncClick) {
3248
- console.warn('CngxStepperNext: [cngxStepperNext] and [cngxAsyncClick] on the same element ' +
3371
+ if (typeof ngDevMode !== 'undefined' && ngDevMode && this.coPlacedAsyncClick) {
3372
+ cngxDevWarn('CNGX1038', '[cngxStepperNext] and [cngxAsyncClick] on the same element ' +
3249
3373
  'both gate aria-disabled. Use one or the other.');
3250
3374
  }
3251
3375
  }
@@ -3319,6 +3443,9 @@ class CngxStepperComplete {
3319
3443
  /** `true` when the active step is the last one - the finish step. */
3320
3444
  isActive = computed(() => this.resolvedHost()?.isLastStep() ?? false, ...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
3321
3445
  constructor() {
3446
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
3447
+ warnStepperControlUnhosted('cngxStepperComplete', this.resolvedHost);
3448
+ }
3322
3449
  const tracker = createTransitionTracker(() => this.runner.status());
3323
3450
  effect(() => {
3324
3451
  if (tracker.current() === 'success' && tracker.previous() !== 'success') {
@@ -3393,6 +3520,7 @@ function createStepperHostProxy(supplier) {
3393
3520
  commitMode: computed(() => supplier()?.commitMode?.() ?? 'pessimistic'),
3394
3521
  orientation: computed(() => supplier()?.orientation() ?? 'horizontal'),
3395
3522
  intendedStepIndex: computed(() => supplier()?.intendedStepIndex()),
3523
+ lastOutcome: computed(() => supplier()?.lastOutcome()),
3396
3524
  lastFailedIndex: computed(() => supplier()?.lastFailedIndex()),
3397
3525
  originIndexDuringCommit: computed(() => supplier()?.originIndexDuringCommit()),
3398
3526
  // Bounds + labels - the safety-critical canGo* pair collapses to
@@ -3434,7 +3562,7 @@ function createStepperHostProxy(supplier) {
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 };
@@ -3483,7 +3617,7 @@ function partitionFeatures(features) {
3483
3617
  * @category common/stepper
3484
3618
  */
3485
3619
  function provideCngxStepper(...features) {
3486
- const { config, i18n } = partitionFeatures(features);
3620
+ const { config, i18n } = partitionFeatures(features, 'provideCngxStepper');
3487
3621
  // `provideStepperConfig` returns EnvironmentProviders, `provideStepperI18n`
3488
3622
  // returns Provider - `makeEnvironmentProviders` takes both.
3489
3623
  return makeEnvironmentProviders([
@@ -3510,7 +3644,7 @@ function provideCngxStepper(...features) {
3510
3644
  * @category common/stepper
3511
3645
  */
3512
3646
  function provideCngxStepperAt(...features) {
3513
- const { config, i18n } = partitionFeatures(features);
3647
+ const { config, i18n } = partitionFeatures(features, 'provideCngxStepperAt');
3514
3648
  return [
3515
3649
  // Gate like i18n: an i18n-only call must not plant an empty config
3516
3650
  // at this injector level and shadow an app-wide provideStepperConfig.
@@ -3533,5 +3667,5 @@ function provideCngxStepperAt(...features) {
3533
3667
  * Generated bundle index. Do not edit.
3534
3668
  */
3535
3669
 
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 };
3670
+ 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, 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, withStepperAriaLabels, withStepperCommitMode, withStepperConnectors, withStepperDefaultOrientation, withStepperDensity, withStepperEmptyTemplate, withStepperFallbackLabels, withStepperGroupCollapse, withStepperGroupCollapseSummary, withStepperHeaderNavigation, withStepperI18nLabels, withStepperLinear, withStepperMobileCollapse, withStepperMobileIndicatorPosition, withStepperMobileSwipe, withStepperRouterSync, withStepperSkin };
3537
3671
  //# sourceMappingURL=cngx-common-stepper.mjs.map