@cngx/ui 0.1.0-rc.6 → 0.1.0-rc.8

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 (102) hide show
  1. package/README.md +112 -1
  2. package/a11y/README.md +87 -0
  3. package/accordion/README.md +4 -2
  4. package/breadcrumb/README.md +262 -0
  5. package/collection/README.md +6 -0
  6. package/command-palette/README.md +224 -0
  7. package/context-menu/README.md +98 -0
  8. package/data-grid-accordion/README.md +103 -2
  9. package/feedback/README.md +42 -0
  10. package/fesm2022/cngx-ui-a11y.mjs +452 -0
  11. package/fesm2022/cngx-ui-a11y.mjs.map +1 -0
  12. package/fesm2022/cngx-ui-accordion.mjs +116 -38
  13. package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
  14. package/fesm2022/cngx-ui-action-button.mjs +115 -50
  15. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  16. package/fesm2022/cngx-ui-breadcrumb.mjs +181 -96
  17. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
  18. package/fesm2022/cngx-ui-chart-panel.mjs +586 -0
  19. package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -0
  20. package/fesm2022/cngx-ui-collection.mjs +207 -66
  21. package/fesm2022/cngx-ui-collection.mjs.map +1 -1
  22. package/fesm2022/cngx-ui-command-palette.mjs +1281 -0
  23. package/fesm2022/cngx-ui-command-palette.mjs.map +1 -0
  24. package/fesm2022/cngx-ui-context-menu.mjs +857 -0
  25. package/fesm2022/cngx-ui-context-menu.mjs.map +1 -0
  26. package/fesm2022/cngx-ui-data-grid-accordion.mjs +498 -111
  27. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
  28. package/fesm2022/cngx-ui-empty-state.mjs +16 -6
  29. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  30. package/fesm2022/cngx-ui-feedback.mjs +1095 -521
  31. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  32. package/fesm2022/cngx-ui-layout.mjs +18 -9
  33. package/fesm2022/cngx-ui-layout.mjs.map +1 -1
  34. package/fesm2022/cngx-ui-mat-accordion.mjs +84 -16
  35. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
  36. package/fesm2022/cngx-ui-mat-paginator.mjs +67 -24
  37. package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
  38. package/fesm2022/cngx-ui-mat-stepper.mjs +72 -47
  39. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
  40. package/fesm2022/cngx-ui-mat-tabs.mjs +370 -203
  41. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
  42. package/fesm2022/cngx-ui-overlay.mjs +69 -13
  43. package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
  44. package/fesm2022/cngx-ui-paginator.mjs +501 -182
  45. package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
  46. package/fesm2022/cngx-ui-sidenav.mjs +327 -106
  47. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  48. package/fesm2022/cngx-ui-skeleton.mjs +22 -21
  49. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
  50. package/fesm2022/cngx-ui-speak.mjs +107 -8
  51. package/fesm2022/cngx-ui-speak.mjs.map +1 -1
  52. package/fesm2022/cngx-ui-stat-card.mjs +718 -0
  53. package/fesm2022/cngx-ui-stat-card.mjs.map +1 -0
  54. package/fesm2022/cngx-ui-stepper.mjs +217 -76
  55. package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
  56. package/fesm2022/cngx-ui-tabs.mjs +40 -19
  57. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  58. package/fesm2022/cngx-ui-timeline.mjs +548 -0
  59. package/fesm2022/cngx-ui-timeline.mjs.map +1 -0
  60. package/fesm2022/cngx-ui-toc.mjs +748 -0
  61. package/fesm2022/cngx-ui-toc.mjs.map +1 -0
  62. package/fesm2022/cngx-ui.mjs +16 -21
  63. package/fesm2022/cngx-ui.mjs.map +1 -1
  64. package/mat-accordion/README.md +1 -1
  65. package/mat-paginator/README.md +9 -2
  66. package/mat-tabs/styles/mat-tabs.css +29 -27
  67. package/overlay/README.md +9 -4
  68. package/package.json +32 -1
  69. package/paginator/README.md +8 -4
  70. package/sidenav/README.md +33 -11
  71. package/skeleton/README.md +2 -0
  72. package/speak/README.md +3 -2
  73. package/stepper/README.md +15 -3
  74. package/timeline/README.md +350 -0
  75. package/toc/README.md +186 -0
  76. package/types/cngx-ui-a11y.d.ts +394 -0
  77. package/types/cngx-ui-accordion.d.ts +100 -30
  78. package/types/cngx-ui-action-button.d.ts +47 -3
  79. package/types/cngx-ui-breadcrumb.d.ts +159 -58
  80. package/types/cngx-ui-chart-panel.d.ts +382 -0
  81. package/types/cngx-ui-collection.d.ts +159 -58
  82. package/types/cngx-ui-command-palette.d.ts +565 -0
  83. package/types/cngx-ui-context-menu.d.ts +559 -0
  84. package/types/cngx-ui-data-grid-accordion.d.ts +344 -51
  85. package/types/cngx-ui-empty-state.d.ts +9 -2
  86. package/types/cngx-ui-feedback.d.ts +664 -73
  87. package/types/cngx-ui-layout.d.ts +8 -3
  88. package/types/cngx-ui-mat-accordion.d.ts +32 -4
  89. package/types/cngx-ui-mat-paginator.d.ts +37 -8
  90. package/types/cngx-ui-mat-stepper.d.ts +23 -11
  91. package/types/cngx-ui-mat-tabs.d.ts +218 -23
  92. package/types/cngx-ui-overlay.d.ts +56 -10
  93. package/types/cngx-ui-paginator.d.ts +416 -132
  94. package/types/cngx-ui-sidenav.d.ts +248 -74
  95. package/types/cngx-ui-skeleton.d.ts +18 -7
  96. package/types/cngx-ui-speak.d.ts +118 -5
  97. package/types/cngx-ui-stat-card.d.ts +411 -0
  98. package/types/cngx-ui-stepper.d.ts +81 -29
  99. package/types/cngx-ui-tabs.d.ts +22 -6
  100. package/types/cngx-ui-timeline.d.ts +495 -0
  101. package/types/cngx-ui-toc.d.ts +581 -0
  102. package/types/cngx-ui.d.ts +8 -5
@@ -1,14 +1,35 @@
1
1
  import * as i0 from '@angular/core';
2
- import { runInInjectionContext, effect, untracked, afterNextRender, isDevMode, computed, InjectionToken, makeEnvironmentProviders, inject, TemplateRef, Directive, signal, DestroyRef, EnvironmentInjector, contentChildren, createEnvironmentInjector, Injectable, Injector, Renderer2, ElementRef, ViewContainerRef, contentChild, input } from '@angular/core';
3
- import { MatTab, MatTabGroup, MatTabLink } from '@angular/material/tabs';
2
+ import { isDevMode, afterNextRender, runInInjectionContext, effect, untracked, computed, InjectionToken, makeEnvironmentProviders, inject, TemplateRef, Directive, signal, DestroyRef, EnvironmentInjector, contentChildren, createEnvironmentInjector, Injectable, Injector, Renderer2, ElementRef, ViewContainerRef, contentChild, input } from '@angular/core';
3
+ import { MatTabGroup, MatTab, MatTabLink } from '@angular/material/tabs';
4
4
  import { createMaterialBidirectionalSync } from '@cngx/common/data';
5
5
  import * as i1 from '@cngx/common/tabs';
6
- import { CNGX_TAB_GROUP_HOST, injectTabsI18n, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CngxTabGroupPresenter } from '@cngx/common/tabs';
6
+ import { CNGX_TAB_GROUP_HOST, injectTabsI18n, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CngxTabGroupPresenter, createTabNavAnnouncement, CNGX_TAB_NAV_HOST } from '@cngx/common/tabs';
7
7
  import { CngxTabOverflow } from '@cngx/ui/tabs';
8
- import { DOCUMENT } from '@angular/common';
8
+ import { CngxLiveAnnouncer } from '@cngx/common/a11y';
9
9
  import { nextUid } from '@cngx/core/utils';
10
10
  import { toSignal } from '@angular/core/rxjs-interop';
11
11
 
12
+ /**
13
+ * Default sink - gated on dev-mode. Production callers see no
14
+ * output; production telemetry lands only when a consumer overrides
15
+ * via `withHalfWiredSlotSink(fn)`.
16
+ *
17
+ * @internal - exported only for {@link CngxMatTabsConfig.halfWiredSlotSink}'s
18
+ * library default. Consumers should override via the config feature
19
+ * rather than reach for this reference directly.
20
+ */
21
+ const CNGX_DEFAULT_HALF_WIRED_SLOT_SINK = (missing) => {
22
+ if (!isDevMode()) {
23
+ return;
24
+ }
25
+ console.warn('[cngxMatTabs] aggregator-content slot half-wired - ' +
26
+ `\`${missing}\` is missing while the other half is supplied. ` +
27
+ 'The decoration projector will silently fall back to the ' +
28
+ 'imperative `textContent` path, and the consumer-projected ' +
29
+ '`*cngxMatTabAggregatorContent` template will never render. ' +
30
+ 'Wire both halves on the [cngxMatTabs] directive (or neither).');
31
+ };
32
+
12
33
  /**
13
34
  * Centralised type façade and selector constants for every Angular
14
35
  * Material internal surface cngx Material-bridge code couples to.
@@ -29,7 +50,7 @@ import { toSignal } from '@angular/core/rxjs-interop';
29
50
  * type façades and the selector constants. The TS namespace also
30
51
  * lets cross-package consumers (`@cngx/ui/mat-stepper`) read the
31
52
  * grouped name through ESLint's `@typescript-eslint` type resolver
32
- * — a flat `export * as` re-export from `public-api.ts` does not
53
+ * - a flat `export * as` re-export from `public-api.ts` does not
33
54
  * resolve nested members through the path-alias.
34
55
  *
35
56
  * @category ui/mat-tabs
@@ -38,17 +59,17 @@ import { toSignal } from '@angular/core/rxjs-interop';
38
59
  var MaterialPrivateSurfaces;
39
60
  (function (MaterialPrivateSurfaces) {
40
61
  /**
41
- * `.mat-mdc-tab` — the class Material applies to the rendered
62
+ * `.mat-mdc-tab` - the class Material applies to the rendered
42
63
  * tab `<button>` elements inside `MatTabHeader`. cngx
43
64
  * index-correlates `presenter.tabs()` registration order against
44
65
  * `host.querySelectorAll('.mat-mdc-tab')` because `MatTab` is a
45
- * portal — the rendered buttons live inside `MatTabHeader`'s
66
+ * portal - the rendered buttons live inside `MatTabHeader`'s
46
67
  * template, not on the `<mat-tab>` declaration site, and Material
47
68
  * exposes no public per-tab element accessor.
48
69
  */
49
70
  MaterialPrivateSurfaces.MAT_MDC_TAB_SELECTOR = '.mat-mdc-tab';
50
71
  /**
51
- * `.mat-mdc-tab-header` — the strip element rendered by
72
+ * `.mat-mdc-tab-header` - the strip element rendered by
52
73
  * `MatTabHeader`. `[cngxMatTabs]` walks
53
74
  * `host.querySelector('.mat-mdc-tab-header')` to locate the mount
54
75
  * anchor for the cngx overflow molecule (so the More button pins
@@ -57,7 +78,7 @@ var MaterialPrivateSurfaces;
57
78
  */
58
79
  MaterialPrivateSurfaces.MAT_MDC_TAB_HEADER_SELECTOR = '.mat-mdc-tab-header';
59
80
  /**
60
- * `.mat-mdc-tab-label-container` — Material's IO-friendly scroll
81
+ * `.mat-mdc-tab-label-container` - Material's IO-friendly scroll
61
82
  * viewport ancestor of the rendered tab buttons. The Material-
62
83
  * twin overflow adapter walks `host → header → any tab → closest
63
84
  * label-container` to attach the molecule's
@@ -70,12 +91,12 @@ var MaterialPrivateSurfaces;
70
91
  /**
71
92
  * Package-private DOM-mutation projectors for `[cngxMatTabs]`.
72
93
  *
73
- * - {@link createMatTabRejectionDecoration} — mirrors
94
+ * - {@link createMatTabRejectionDecoration} - mirrors
74
95
  * `presenter.lastFailedIndex` onto the matching `.mat-mdc-tab` as a
75
96
  * class flag plus a hidden `cngx-sr-only` descriptor span linked via
76
97
  * `aria-describedby`. `aria-invalid` is intentionally absent: ARIA
77
98
  * 1.2 scopes it to form-field vocabulary, not `role="tab"`.
78
- * - {@link createMatTabAggregatorDecoration} — projects each handle's
99
+ * - {@link createMatTabAggregatorDecoration} - projects each handle's
79
100
  * `shouldShow()` flag onto the matching button as a class +
80
101
  * descriptor span pair, same `aria-describedby` token-append pattern.
81
102
  *
@@ -83,19 +104,19 @@ var MaterialPrivateSurfaces;
83
104
  * projectors stack on the same target without collision; the shared
84
105
  * token-list append preserves consumer-supplied tokens.
85
106
  *
86
- * @internal package-private — consumers bind `[cngxMatTabError]` on
107
+ * @internal package-private - consumers bind `[cngxMatTabError]` on
87
108
  * each `<mat-tab>`; the directive owns the projection mechanics.
88
109
  */
89
110
  /**
90
111
  * Diff-restore the `aria-describedby` token list after a decoration's
91
- * descriptor span detaches — drops the decoration's own id token from
112
+ * descriptor span detaches - drops the decoration's own id token from
92
113
  * the live attribute, leaving any third-party tokens written between
93
114
  * apply and clear (tooltip refs, Material's own runtime additions)
94
115
  * intact. Treats the attribute as a token-set per the cngx ARIA-by-value
95
116
  * rule, not as a single-owner string.
96
117
  *
97
118
  * Empty-result + originally-absent attribute removes the attribute
98
- * entirely — a dangling `aria-describedby=""` would be a malformed
119
+ * entirely - a dangling `aria-describedby=""` would be a malformed
99
120
  * reference in some AT readers.
100
121
  *
101
122
  * @internal
@@ -124,9 +145,16 @@ function restoreAriaDescribedbyExceptToken(el, tokenToRemove, renderer, priorAri
124
145
  * Two effects split the work: one tracks `failedHandleId` and
125
146
  * mounts/unmounts the span; the other tracks `descriptorText` and
126
147
  * mutates `textContent` in place. The split keeps late label
127
- * resolution O(1) — no DOM rebuild when the origin label arrives
148
+ * resolution O(1) - no DOM rebuild when the origin label arrives
128
149
  * via a downstream `tabs()` re-emission.
129
150
  *
151
+ * Race recovery - when the effect fires before MatTabHeader has
152
+ * rendered the matching button (initial-render race), the failed id
153
+ * is NOT latched (a latched id would suppress every later attempt
154
+ * for the same failure) and a single `afterNextRender` retry is
155
+ * scheduled, bounded by `maxRetryAttempts` - same recovery shape as
156
+ * the aggregator projector.
157
+ *
130
158
  * @internal
131
159
  */
132
160
  function createMatTabRejectionDecoration(opts) {
@@ -134,16 +162,19 @@ function createMatTabRejectionDecoration(opts) {
134
162
  const className = opts.className ?? 'cngx-mat-tab--error';
135
163
  const srOnlyClassName = opts.srOnlyClassName ?? 'cngx-sr-only';
136
164
  const descriptorIdSuffix = opts.descriptorIdSuffix ?? 'rejected';
165
+ const maxRetryAttempts = opts.maxRetryAttempts ?? 5;
166
+ let pendingRetry = false;
167
+ let retryAttempts = 0;
137
168
  // Slot path needs both halves; either alone degrades to imperative
138
- // textContent. No diagnostic — single in-package consumer always
169
+ // textContent. No diagnostic - single in-package consumer always
139
170
  // passes both.
140
171
  const slotEnabled = !!opts.contentTemplate && !!opts.viewContainerRef;
141
172
  let decoratedEl = null;
142
- // Cached across the projector's lifetime — reusing the same node
173
+ // Cached across the projector's lifetime - reusing the same node
143
174
  // keeps AT-reader / observer references live across A→B→A flips.
144
175
  let cachedSpan = null;
145
176
  let priorAriaDescribedby = null;
146
- // Pillar 1 — short-circuits structurally-identical re-emissions of
177
+ // Pillar 1 - short-circuits structurally-identical re-emissions of
147
178
  // `failedHandleId` so a `tabs()` re-eval doesn't clobber the AT
148
179
  // descriptor mid-flight.
149
180
  let lastAppliedId = null;
@@ -175,7 +206,7 @@ function createMatTabRejectionDecoration(opts) {
175
206
  injector: opts.injector,
176
207
  });
177
208
  // Force CD before moving rootNodes out of the embedded view's
178
- // logical parent — zoneless + OnPush would otherwise leave the
209
+ // logical parent - zoneless + OnPush would otherwise leave the
179
210
  // first SR read stale.
180
211
  view.detectChanges();
181
212
  for (const node of view.rootNodes) {
@@ -184,7 +215,7 @@ function createMatTabRejectionDecoration(opts) {
184
215
  embeddedView = view;
185
216
  return;
186
217
  }
187
- // Imperative fallback — also covers the path where a slot was
218
+ // Imperative fallback - also covers the path where a slot was
188
219
  // previously bound and is now removed (destroy any prior view).
189
220
  destroyEmbeddedView();
190
221
  opts.renderer.setProperty(span, 'textContent', text);
@@ -197,7 +228,7 @@ function createMatTabRejectionDecoration(opts) {
197
228
  destroyEmbeddedView();
198
229
  opts.renderer.removeClass(decoratedEl, className);
199
230
  opts.renderer.removeChild(decoratedEl, cachedSpan);
200
- // `cachedSpan` deliberately retained — reused on the next apply.
231
+ // `cachedSpan` deliberately retained - reused on the next apply.
201
232
  restoreAriaDescribedbyExceptToken(decoratedEl, ownTokenId, opts.renderer, priorAriaDescribedby);
202
233
  decoratedEl = null;
203
234
  priorAriaDescribedby = null;
@@ -207,7 +238,7 @@ function createMatTabRejectionDecoration(opts) {
207
238
  const buttons = opts.hostEl.querySelectorAll(buttonSelector);
208
239
  const targetEl = buttons.item(failedIdx);
209
240
  if (!targetEl) {
210
- return;
241
+ return false;
211
242
  }
212
243
  opts.renderer.addClass(targetEl, className);
213
244
  const spanId = `${handleId}-${descriptorIdSuffix}`;
@@ -217,13 +248,13 @@ function createMatTabRejectionDecoration(opts) {
217
248
  opts.renderer.addClass(span, srOnlyClassName);
218
249
  cachedSpan = span;
219
250
  }
220
- // Always rewrite id + textContent — the cached span carries stale
251
+ // Always rewrite id + textContent - the cached span carries stale
221
252
  // values from the prior mount. The live-text effect below picks
222
253
  // up subsequent `descriptorText` changes in place.
223
254
  opts.renderer.setAttribute(span, 'id', spanId);
224
255
  opts.renderer.appendChild(targetEl, span);
225
256
  writeDescriptorContent(span, handleId, opts.descriptorText());
226
- // Renderer2 has no `getAttribute` counterpart — read off the
257
+ // Renderer2 has no `getAttribute` counterpart - read off the
227
258
  // native element. Browser-only; SSR would need a platform adapter.
228
259
  const prior = targetEl.getAttribute('aria-describedby');
229
260
  const tokens = prior ? prior.split(/\s+/).filter(Boolean) : [];
@@ -233,6 +264,44 @@ function createMatTabRejectionDecoration(opts) {
233
264
  opts.renderer.setAttribute(targetEl, 'aria-describedby', tokens.join(' '));
234
265
  decoratedEl = targetEl;
235
266
  priorAriaDescribedby = prior;
267
+ return true;
268
+ };
269
+ const applyOrScheduleRetry = (id) => {
270
+ const idx = opts.failedIndex();
271
+ if (idx === undefined) {
272
+ clearDecoration();
273
+ lastAppliedId = null;
274
+ return;
275
+ }
276
+ if (applyDecorationAt(idx, id)) {
277
+ lastAppliedId = id;
278
+ retryAttempts = 0;
279
+ return;
280
+ }
281
+ // Initial-render race - the matching button is not stamped yet.
282
+ // The id is deliberately NOT latched (a latched id would
283
+ // short-circuit every later run for the same failure); retry
284
+ // once per render, bounded like the aggregator projector.
285
+ if (pendingRetry) {
286
+ return;
287
+ }
288
+ if (retryAttempts >= maxRetryAttempts) {
289
+ retryAttempts = 0;
290
+ const sink = opts.onMaxRetriesReached ??
291
+ defaultRetryCeilingWarn(maxRetryAttempts, 'rejection');
292
+ sink();
293
+ return;
294
+ }
295
+ pendingRetry = true;
296
+ retryAttempts++;
297
+ afterNextRender(() => {
298
+ pendingRetry = false;
299
+ const current = opts.failedHandleId();
300
+ if (current === null || current === lastAppliedId) {
301
+ return;
302
+ }
303
+ applyOrScheduleRetry(current);
304
+ }, { injector: opts.injector });
236
305
  };
237
306
  runInInjectionContext(opts.injector, () => {
238
307
  effect(() => {
@@ -246,17 +315,10 @@ function createMatTabRejectionDecoration(opts) {
246
315
  lastAppliedId = null;
247
316
  return;
248
317
  }
249
- const idx = opts.failedIndex();
250
- if (idx === undefined) {
251
- clearDecoration();
252
- lastAppliedId = null;
253
- return;
254
- }
255
- applyDecorationAt(idx, id);
256
- lastAppliedId = id;
318
+ applyOrScheduleRetry(id);
257
319
  });
258
320
  });
259
- // Live-text effect — tracks `descriptorText` plus the slot
321
+ // Live-text effect - tracks `descriptorText` plus the slot
260
322
  // template (when wired) so a late-mounted template re-renders
261
323
  // into the existing span. Mount-state checks live in untracked.
262
324
  effect(() => {
@@ -284,7 +346,7 @@ function createMatTabRejectionDecoration(opts) {
284
346
  * descriptor span + `aria-describedby` token follow `errorTabs`
285
347
  * reactively; pruned on entry drop and on directive destroy.
286
348
  *
287
- * Race recovery — when the effect fires before MatTabHeader has
349
+ * Race recovery - when the effect fires before MatTabHeader has
288
350
  * rendered the matching buttons (initial-render race), schedules a
289
351
  * single `afterNextRender` retry, bounded by `maxRetryAttempts`.
290
352
  *
@@ -299,11 +361,11 @@ function createMatTabAggregatorDecoration(opts) {
299
361
  // textContent. Re-evaluated per fire so a lazy-mounted template
300
362
  // (`*ngIf` / `@defer`) picks up on first materialisation.
301
363
  const isFullyWired = () => !!opts.contentTemplate && !!opts.viewContainerRef;
302
- // Half-wired diagnostic — graceful degradation hides the mistake
364
+ // Half-wired diagnostic - graceful degradation hides the mistake
303
365
  // at runtime, so the signal has to come from a deliberate sink.
304
366
  if (!isFullyWired() && (opts.contentTemplate || opts.viewContainerRef)) {
305
367
  const missing = opts.contentTemplate ? 'viewContainerRef' : 'contentTemplate';
306
- const sink = opts.onHalfWiredSlot ?? defaultHalfWiredSlotWarn;
368
+ const sink = opts.onHalfWiredSlot ?? CNGX_DEFAULT_HALF_WIRED_SLOT_SINK;
307
369
  sink(missing);
308
370
  }
309
371
  const decorated = new Map();
@@ -340,7 +402,7 @@ function createMatTabAggregatorDecoration(opts) {
340
402
  entry.embeddedView = view;
341
403
  return;
342
404
  }
343
- // Imperative fallback — also covers the path where a slot was
405
+ // Imperative fallback - also covers the path where a slot was
344
406
  // previously bound and is now removed (destroy any prior view).
345
407
  destroyEmbeddedView(entry);
346
408
  opts.renderer.setProperty(entry.descriptorSpan, 'textContent', announcement);
@@ -364,7 +426,7 @@ function createMatTabAggregatorDecoration(opts) {
364
426
  opts.renderer.addClass(descriptorSpan, srOnlyClassName);
365
427
  opts.renderer.setAttribute(descriptorSpan, 'id', spanId);
366
428
  opts.renderer.appendChild(targetEl, descriptorSpan);
367
- // See the read-via-nativeElement note in `applyDecorationAt` above —
429
+ // See the read-via-nativeElement note in `applyDecorationAt` above -
368
430
  // Renderer2 has no `getAttribute` counterpart, so attribute reads
369
431
  // go through the native element directly.
370
432
  const priorAriaDescribedby = targetEl.getAttribute('aria-describedby');
@@ -427,7 +489,7 @@ function createMatTabAggregatorDecoration(opts) {
427
489
  }
428
490
  if (retryAttempts >= maxRetryAttempts) {
429
491
  retryAttempts = 0;
430
- const sink = opts.onMaxRetriesReached ?? defaultRetryCeilingWarn(maxRetryAttempts);
492
+ const sink = opts.onMaxRetriesReached ?? defaultRetryCeilingWarn(maxRetryAttempts, 'aggregator');
431
493
  sink();
432
494
  return;
433
495
  }
@@ -456,28 +518,17 @@ function createMatTabAggregatorDecoration(opts) {
456
518
  }
457
519
  });
458
520
  }
459
- function defaultHalfWiredSlotWarn(missing) {
460
- if (!isDevMode()) {
461
- return;
462
- }
463
- console.warn('[cngxMatTabs] aggregator-content slot half-wired — ' +
464
- `\`${missing}\` is missing while the other half is supplied. ` +
465
- 'The decoration projector will silently fall back to the ' +
466
- 'imperative `textContent` path, and the consumer-projected ' +
467
- '`*cngxMatTabAggregatorContent` template will never render. ' +
468
- 'Wire both halves on the [cngxMatTabs] directive (or neither).');
469
- }
470
- function defaultRetryCeilingWarn(max) {
521
+ function defaultRetryCeilingWarn(max, decoration) {
471
522
  return () => {
472
523
  if (!isDevMode()) {
473
524
  return;
474
525
  }
475
- console.warn('[cngxMatTabs] aggregator decoration retry ceiling reached ' +
476
- `(${max} attempts) — MatTabHeader did not render ` +
526
+ console.warn(`[cngxMatTabs] ${decoration} decoration retry ceiling reached ` +
527
+ `(${max} attempts) - MatTabHeader did not render ` +
477
528
  '`.mat-mdc-tab` buttons within the expected window. Likely ' +
478
529
  'cause: Material upgrade broke the `.mat-mdc-tab` selector ' +
479
530
  'contract or a consumer-side render stall. ' +
480
- 'Bound aggregators may remain visually undecorated ' +
531
+ 'The decoration may remain visually missing ' +
481
532
  'until the next state change.');
482
533
  };
483
534
  }
@@ -531,27 +582,6 @@ function createAggregatedErrorTabs(presenter) {
531
582
  });
532
583
  }
533
584
 
534
- /**
535
- * Default sink — gated on dev-mode. Production callers see no
536
- * output; production telemetry lands only when a consumer overrides
537
- * via `withHalfWiredSlotSink(fn)`.
538
- *
539
- * @internal — exported only for {@link CngxMatTabsConfig.halfWiredSlotSink}'s
540
- * library default. Consumers should override via the config feature
541
- * rather than reach for this reference directly.
542
- */
543
- const CNGX_DEFAULT_HALF_WIRED_SLOT_SINK = (missing) => {
544
- if (!isDevMode()) {
545
- return;
546
- }
547
- console.warn('[cngxMatTabs] aggregator-content slot half-wired — ' +
548
- `\`${missing}\` is missing while the other half is supplied. ` +
549
- 'The decoration projector will silently fall back to the ' +
550
- 'imperative `textContent` path, and the consumer-projected ' +
551
- '`*cngxMatTabAggregatorContent` template will never render. ' +
552
- 'Wire both halves on the [cngxMatTabs] directive (or neither).');
553
- };
554
-
555
585
  /**
556
586
  * Library defaults for `[cngxMatTabs]`. Source of truth for every
557
587
  * key on {@link CngxMatTabsConfig}. Consumed by
@@ -562,6 +592,7 @@ const CNGX_DEFAULT_HALF_WIRED_SLOT_SINK = (missing) => {
562
592
  const CNGX_MAT_TABS_CONFIG_DEFAULTS = {
563
593
  anchorMaxAttempts: 5,
564
594
  halfWiredSlotSink: CNGX_DEFAULT_HALF_WIRED_SLOT_SINK,
595
+ templates: {},
565
596
  };
566
597
  /**
567
598
  * DI token holding a partial {@link CngxMatTabsConfig}. Set via
@@ -596,10 +627,27 @@ function withAnchorRetryAttempts(n) {
596
627
  function withHalfWiredSlotSink(sink) {
597
628
  return feature({ halfWiredSlotSink: sink });
598
629
  }
630
+ /**
631
+ * App-wide override for the rejection SR-descriptor content. Middle
632
+ * tier; per-instance `*cngxMatTabRejectionContent` still wins.
633
+ * Sibling of {@link withTabRejectionIconTemplate} in the cngx-native
634
+ * family.
635
+ *
636
+ * @category ui/mat-tabs
637
+ */
638
+ function withMatTabRejectionTemplate(template) {
639
+ return feature({ templates: { rejection: template } });
640
+ }
599
641
  function mergeFeatures(features) {
600
642
  const merged = {};
601
643
  for (const f of features) {
602
- Object.assign(merged, f.config);
644
+ const { templates, ...rest } = f.config;
645
+ Object.assign(merged, rest);
646
+ if (templates) {
647
+ // Nested-merge so several template features compose instead of the
648
+ // last one overwriting the whole templates object.
649
+ merged.templates = { ...merged.templates, ...templates };
650
+ }
603
651
  }
604
652
  return merged;
605
653
  }
@@ -632,6 +680,11 @@ function provideMatTabsConfig(...features) {
632
680
  * `providers` or `viewProviders` (which cannot accept opaque
633
681
  * environment providers).
634
682
  *
683
+ * Merges over the outer config (via `skipSelf`), so a component-scope
684
+ * call refines the root {@link provideMatTabsConfig} instead of
685
+ * reverting its untouched keys to library defaults - only the keys
686
+ * the local features set are overridden for the subtree.
687
+ *
635
688
  * ```ts
636
689
  * @Component({
637
690
  * selector: 'app-tabs-page',
@@ -645,7 +698,22 @@ function provideMatTabsConfig(...features) {
645
698
  * @category ui/mat-tabs
646
699
  */
647
700
  function provideMatTabsConfigAt(...features) {
648
- return [{ provide: CNGX_MAT_TABS_CONFIG, useValue: mergeFeatures(features) }];
701
+ return [
702
+ {
703
+ provide: CNGX_MAT_TABS_CONFIG,
704
+ useFactory: () => {
705
+ const outer = inject(CNGX_MAT_TABS_CONFIG, { optional: true, skipSelf: true }) ?? {};
706
+ const local = mergeFeatures(features);
707
+ return {
708
+ ...outer,
709
+ ...local,
710
+ // Nested-merge so a local template feature refines the outer
711
+ // template set instead of replacing it wholesale.
712
+ templates: { ...outer.templates, ...local.templates },
713
+ };
714
+ },
715
+ },
716
+ ];
649
717
  }
650
718
  /**
651
719
  * Resolve the effective `[cngxMatTabs]` configuration for the current
@@ -664,6 +732,7 @@ function injectMatTabsConfig() {
664
732
  return {
665
733
  anchorMaxAttempts: user.anchorMaxAttempts ?? CNGX_MAT_TABS_CONFIG_DEFAULTS.anchorMaxAttempts,
666
734
  halfWiredSlotSink: user.halfWiredSlotSink ?? CNGX_MAT_TABS_CONFIG_DEFAULTS.halfWiredSlotSink,
735
+ templates: { ...CNGX_MAT_TABS_CONFIG_DEFAULTS.templates, ...user.templates },
667
736
  };
668
737
  }
669
738
 
@@ -731,7 +800,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
731
800
  * Cascade resolution:
732
801
  * 1. Per-instance `*cngxMatTabRejectionContent` template wins
733
802
  * via `contentChild(CngxMatTabRejectionContent)`.
734
- * 2. Library default - imperative `Renderer2.createElement('span')`
803
+ * 2. `CNGX_MAT_TABS_CONFIG.templates.rejection` (app-wide middle
804
+ * tier, set via `withMatTabRejectionTemplate`).
805
+ * 3. Library default - imperative `Renderer2.createElement('span')`
735
806
  * with `textContent = fallbackText` (the resolved
736
807
  * `commitRolledBackTo(originLabel)` / `commitFailedRetry`
737
808
  * phrase from `injectTabsI18n()`).
@@ -775,59 +846,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
775
846
  }] });
776
847
 
777
848
  /**
778
- * Mount a polite ARIA live region under `document.body` and keep
779
- * its `textContent` in sync with the supplied `announcement`
780
- * signal. Empty string between transitions so AT readers stay quiet
781
- * on no-op CD ticks.
782
- *
783
- * The span lives at body scope (matching the CDK `LiveAnnouncer`
784
- * placement convention) so Material's MDC tolerance for unexpected
785
- * children at the `<mat-tab-group>` host root is irrelevant — the
786
- * live-region never lands inside Material's component DOM. The
787
- * element's host bindings replicate {@link CngxLiveRegion}
788
- * imperatively (this attribute directive owns no template, so the
789
- * declarative `cngxLiveRegion` selector is unreachable).
790
- * Cleaned up via the supplied `DestroyRef`.
791
- *
792
- * @internal — package-private helper for `[cngxMatTabs]`. Not
793
- * exported from `public-api.ts`.
849
+ * Keep the shared {@link CngxLiveAnnouncer} in sync with the supplied
850
+ * `announcement` signal: an `effect` reads the reactive text and
851
+ * forwards every non-empty value to the root announcer at the
852
+ * configured politeness (default `'polite'`). An empty string between
853
+ * transitions keeps the region quiet on no-op CD ticks.
854
+ *
855
+ * Delegates to {@link CngxLiveAnnouncer} instead of mounting its own
856
+ * body span, so the announcer owns the persistent polite/assertive
857
+ * region pair, the clear-then-set re-announce, and teardown. The
858
+ * delegated region carries `aria-live` + `aria-atomic="true"` and no
859
+ * explicit `role`; `aria-atomic` re-reads full content and `aria-live`
860
+ * carries the politeness, so a tab-change status utterance still reads.
861
+ *
862
+ * The `effect` is created in `opts.injector`'s context, so it is torn
863
+ * down with the host directive; the service call is wrapped in
864
+ * `untracked` - the announcer owns its own clear-then-set timer, so it
865
+ * stays out of the effect's dependency graph.
866
+ *
867
+ * @internal - helper shared by the Material bridge directives
868
+ * (`[cngxMatTabs]`, `[cngxMatTabNav]`, `[cngxMatStepper]`). Exported
869
+ * `@internal` from the mat-tabs barrel for cross-entry consumption
870
+ * (the `MaterialPrivateSurfaces` pattern) - ng-packagr rejects
871
+ * relative-import file sharing between entry points.
794
872
  */
795
873
  function mountLiveRegionAnnouncer(opts) {
796
- const srOnlyClassName = opts.srOnlyClassName ?? 'cngx-sr-only';
797
874
  const politeness = opts.politeness ?? 'polite';
798
- const role = politeness === 'assertive' ? 'alert' : 'status';
799
- const doc = runInInjectionContext(opts.injector, () => inject(DOCUMENT));
800
- const liveRegionEl = opts.renderer.createElement('span');
801
- opts.renderer.addClass(liveRegionEl, srOnlyClassName);
802
- opts.renderer.setAttribute(liveRegionEl, 'aria-live', politeness);
803
- opts.renderer.setAttribute(liveRegionEl, 'aria-atomic', 'true');
804
- opts.renderer.setAttribute(liveRegionEl, 'aria-relevant', 'additions text');
805
- opts.renderer.setAttribute(liveRegionEl, 'role', role);
806
- opts.renderer.appendChild(doc.body, liveRegionEl);
807
875
  runInInjectionContext(opts.injector, () => {
876
+ const announcer = inject(CngxLiveAnnouncer);
808
877
  effect(() => {
809
878
  const text = opts.announcement();
810
- untracked(() => {
811
- opts.renderer.setProperty(liveRegionEl, 'textContent', text);
812
- });
879
+ if (!text) {
880
+ return;
881
+ }
882
+ untracked(() => announcer.announce(text, politeness));
813
883
  });
814
884
  });
815
- opts.destroyRef.onDestroy(() => {
816
- opts.renderer.removeChild(doc.body, liveRegionEl);
817
- });
818
885
  }
819
886
 
820
887
  /**
821
888
  * Build the {@link CngxMatTabRejectionState} bundle for a given
822
- * presenter + i18n pair. Two computeds share one source-walk
823
- * (`lastFailedIndex` → `originIndexDuringCommit` → `tabs[idx].label()`)
824
- * via Angular's signal memoisation — the second computed re-uses
825
- * the first's cached `originLabel` value, so the `tabs()` traversal
826
- * happens at most once per state change.
889
+ * presenter + i18n pair. `descriptorText` re-uses the cached
890
+ * `originLabel` walk (`lastFailedIndex` → `originIndexDuringCommit` →
891
+ * `tabs[idx].label()`). The live announcement walks the indices itself so
892
+ * they stay tracked while the label, which a consumer may translate, is
893
+ * read untracked.
827
894
  *
828
895
  * @internal
829
896
  */
830
897
  function createRejectionState(presenter, i18n) {
898
+ const failedHandleId = computed(() => {
899
+ const idx = presenter.lastFailedIndex();
900
+ if (idx === undefined) {
901
+ return null;
902
+ }
903
+ return presenter.tabs()[idx]?.id ?? null;
904
+ }, ...(ngDevMode ? [{ debugName: "failedHandleId" }] : /* istanbul ignore next */ []));
831
905
  const originLabel = computed(() => {
832
906
  const failedIdx = presenter.lastFailedIndex();
833
907
  if (failedIdx === undefined) {
@@ -844,20 +918,97 @@ function createRejectionState(presenter, i18n) {
844
918
  return '';
845
919
  }
846
920
  const label = originLabel();
847
- return label ? i18n.commitRolledBackTo(label) : i18n.commitFailedRetry;
921
+ const copy = i18n();
922
+ return label ? copy.commitRolledBackTo(label) : copy.commitFailedRetry;
848
923
  }, ...(ngDevMode ? [{ debugName: "descriptorText" }] : /* istanbul ignore next */ []));
924
+ // Feeds the live announcer: copy and the origin tab label (which a
925
+ // consumer may translate) are read untracked so a language switch does
926
+ // not re-announce; the next transition speaks the new language.
849
927
  const liveAnnouncement = computed(() => {
850
928
  const current = presenter.commitTransition.current();
851
929
  if (current === 'pending') {
852
- return i18n.commitInFlight;
930
+ return untracked(() => i18n().commitInFlight);
853
931
  }
854
932
  if (current === 'error') {
855
- const label = originLabel();
856
- return label ? i18n.commitRolledBackTo(label) : i18n.commitFailedRetry;
933
+ const failedIdx = presenter.lastFailedIndex();
934
+ const originIdx = presenter.originIndexDuringCommit();
935
+ const hasOrigin = failedIdx !== undefined && originIdx !== undefined;
936
+ const origin = hasOrigin ? presenter.tabs()[originIdx] : undefined;
937
+ return untracked(() => {
938
+ const label = origin?.label();
939
+ return label ? i18n().commitRolledBackTo(label) : i18n().commitFailedRetry;
940
+ });
857
941
  }
858
942
  return '';
859
943
  }, ...(ngDevMode ? [{ debugName: "liveAnnouncement" }] : /* istanbul ignore next */ []));
860
- return { originLabel, descriptorText, liveAnnouncement };
944
+ return { failedHandleId, originLabel, descriptorText, liveAnnouncement };
945
+ }
946
+
947
+ /**
948
+ * Create the order-aware registration seam. See the module JSDoc for
949
+ * the contract.
950
+ *
951
+ * @internal
952
+ */
953
+ function createOrderedRegistrationSeam(options) {
954
+ const entries = new Map();
955
+ // Presenter-side registration order - the seam issued every
956
+ // register() call, so this array IS the presenter's order.
957
+ let registeredOrder = [];
958
+ const sync = (items) => {
959
+ const live = new Set(items);
960
+ // Drop stale entries first so the order diff below only compares
961
+ // survivors. Snapshot before iterating - deletes inside the body
962
+ // must not collide with iterator state.
963
+ for (const [item, entry] of Array.from(entries.entries())) {
964
+ if (live.has(item)) {
965
+ continue;
966
+ }
967
+ options.unregister(entry);
968
+ options.dispose(entry);
969
+ entries.delete(item);
970
+ }
971
+ registeredOrder = registeredOrder.filter((item) => entries.has(item));
972
+ // Longest shared prefix stays registered as-is; everything after
973
+ // it re-registers in query order. Append-only emissions keep
974
+ // prefix === registeredOrder.length and cause zero churn.
975
+ let prefix = 0;
976
+ while (prefix < registeredOrder.length &&
977
+ prefix < items.length &&
978
+ registeredOrder[prefix] === items[prefix]) {
979
+ prefix += 1;
980
+ }
981
+ for (let i = registeredOrder.length - 1; i >= prefix; i -= 1) {
982
+ const entry = entries.get(registeredOrder[i]);
983
+ if (entry !== undefined) {
984
+ options.unregister(entry);
985
+ }
986
+ }
987
+ registeredOrder.length = prefix;
988
+ for (let i = prefix; i < items.length; i += 1) {
989
+ const item = items[i];
990
+ let entry = entries.get(item);
991
+ if (entry === undefined) {
992
+ entry = options.create(item);
993
+ entries.set(item, entry);
994
+ }
995
+ options.register(entry);
996
+ registeredOrder.push(item);
997
+ }
998
+ };
999
+ const clear = () => {
1000
+ for (const entry of entries.values()) {
1001
+ options.unregister(entry);
1002
+ options.dispose(entry);
1003
+ }
1004
+ entries.clear();
1005
+ registeredOrder = [];
1006
+ };
1007
+ return {
1008
+ sync,
1009
+ get: (item) => entries.get(item),
1010
+ clear,
1011
+ };
861
1012
  }
862
1013
 
863
1014
  /**
@@ -1001,11 +1152,20 @@ const CNGX_MAT_TABS_REGISTRY_HOST = new InjectionToken('CngxMatTabsRegistryHost'
1001
1152
  * LOC guard and lets per-tab decoration directives reach the
1002
1153
  * registry through a typed token.
1003
1154
  *
1004
- * Owns: `contentChildren(MatTab)` query, the `setupsByTab` map
1005
- * (per-tab cngx setup paired with a child `EnvironmentInjector`
1006
- * scoping the `_stateChanges` bridge), an `effect()` that diffs the
1007
- * MatTab list and (un)registers handles with `CNGX_TAB_GROUP_HOST`,
1008
- * and a `DestroyRef` cleanup that destroys every child injector.
1155
+ * Owns: `contentChildren(MatTab)` query, the order-aware
1156
+ * registration seam (per-tab cngx setup paired with a child
1157
+ * `EnvironmentInjector` scoping the `_stateChanges` bridge), an
1158
+ * `effect()` that mirrors the MatTab query order into
1159
+ * `CNGX_TAB_GROUP_HOST` on every emission, and a `DestroyRef`
1160
+ * cleanup that unregisters and destroys every entry.
1161
+ *
1162
+ * Order matters: the presenter registry appends new registrations,
1163
+ * but Material renders tabs at their DOM position - a mid-list
1164
+ * `<mat-tab>` insert must land at its query index, not at the tail,
1165
+ * or index-based selection, announcements and decorations target the
1166
+ * wrong tab. The shared seam re-registers the diverging suffix in
1167
+ * query order while keeping surviving handle instances (and their
1168
+ * child injectors) alive.
1009
1169
  *
1010
1170
  * Composition: `[cngxMatTabs]` declares this in `hostDirectives`;
1011
1171
  * both share the parent's `CngxTabGroupPresenter` and the same
@@ -1023,53 +1183,38 @@ class CngxMatTabsRegistry {
1023
1183
  destroyRef = inject(DestroyRef);
1024
1184
  envInjector = inject(EnvironmentInjector);
1025
1185
  createHandle = inject(CNGX_MAT_TAB_HANDLE_FACTORY);
1186
+ matTabGroup = inject(MatTabGroup, { self: true });
1026
1187
  matTabs = contentChildren(MatTab, { ...(ngDevMode ? { debugName: "matTabs" } : /* istanbul ignore next */ {}), descendants: true });
1027
- // Map (not WeakMap) so the diff loop in `syncHandles` can iterate
1028
- // to find removed tabs without a parallel `Set<MatTab>`. Entries
1029
- // are explicitly deleted when the matching MatTab leaves the
1030
- // children set, AND the map goes away on directive destroy.
1031
- setupsByTab = new Map();
1032
- constructor() {
1033
- effect(() => {
1034
- const tabs = this.matTabs();
1035
- untracked(() => this.syncHandles(tabs));
1036
- });
1037
- this.destroyRef.onDestroy(() => {
1038
- for (const entry of this.setupsByTab.values()) {
1039
- // Disposes the per-tab `toSignal(_stateChanges)` bridge.
1040
- entry.childInjector.destroy();
1041
- }
1042
- this.setupsByTab.clear();
1043
- });
1044
- }
1045
- getHandleSetup(matTab) {
1046
- return this.setupsByTab.get(matTab)?.setup;
1047
- }
1048
- syncHandles(tabs) {
1049
- const liveTabs = new Set(tabs);
1050
- for (const tab of tabs) {
1051
- if (this.setupsByTab.has(tab)) {
1052
- continue;
1053
- }
1188
+ seam = createOrderedRegistrationSeam({
1189
+ create: (tab) => {
1054
1190
  // Per-tab child injector scopes the `toSignal(_stateChanges)`
1055
1191
  // bridge inside createMatTabHandle - destroying it on tab
1056
1192
  // removal fires `takeUntilDestroyed`.
1057
1193
  const childInjector = createEnvironmentInjector([], this.envInjector);
1058
1194
  const idSeed = () => nextUid('cngx-mat-tab-');
1059
1195
  const setup = this.createHandle(tab, idSeed, childInjector);
1060
- this.setupsByTab.set(tab, { setup, childInjector });
1061
- this.presenter.register(setup.handle);
1062
- }
1063
- // Snapshot entries before the loop so multi-key deletes inside
1064
- // the body never collide with iterator state.
1065
- for (const [tab, entry] of Array.from(this.setupsByTab.entries())) {
1066
- if (liveTabs.has(tab)) {
1067
- continue;
1068
- }
1069
- entry.childInjector.destroy();
1070
- this.setupsByTab.delete(tab);
1071
- this.presenter.unregister(entry.setup.handle.id);
1072
- }
1196
+ return { setup, childInjector };
1197
+ },
1198
+ register: (entry) => this.presenter.register(entry.setup.handle),
1199
+ unregister: (entry) => this.presenter.unregister(entry.setup.handle.id, entry.setup.handle),
1200
+ dispose: (entry) => entry.childInjector.destroy(),
1201
+ });
1202
+ constructor() {
1203
+ effect(() => {
1204
+ // Ownership filter: `descendants: true` also surfaces MatTabs of
1205
+ // a tab-group nested inside one of OUR tabs' content. Each MatTab
1206
+ // carries its owning `_closestTabGroup` (see
1207
+ // MaterialPrivateSurfaces.ClosestTabGroupSource), so foreign tabs
1208
+ // are dropped before they can register with this presenter -
1209
+ // mirrors the mat-stepper/mat-accordion sibling filters.
1210
+ const tabs = this.matTabs().filter((tab) => tab._closestTabGroup ===
1211
+ this.matTabGroup);
1212
+ untracked(() => this.seam.sync(tabs));
1213
+ });
1214
+ this.destroyRef.onDestroy(() => this.seam.clear());
1215
+ }
1216
+ getHandleSetup(matTab) {
1217
+ return this.seam.get(matTab)?.setup;
1073
1218
  }
1074
1219
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabsRegistry, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1075
1220
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.4", type: CngxMatTabsRegistry, isStandalone: true, selector: "[cngxMatTabsRegistry]", providers: [
@@ -1099,7 +1244,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1099
1244
  *
1100
1245
  * `resolveStripRoot` walks from host up to `<mat-tab-header>` and
1101
1246
  * locates `.mat-mdc-tab-label-container` via any rendered
1102
- * `.mat-mdc-tab` descendant — Material's IO-friendly scroll
1247
+ * `.mat-mdc-tab` descendant - Material's IO-friendly scroll
1103
1248
  * container.
1104
1249
  *
1105
1250
  * `resolveTabButton` indexes positionally; Material owns the DOM
@@ -1124,7 +1269,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1124
1269
  function createCngxMatTabOverflowDomAdapter() {
1125
1270
  return {
1126
1271
  resolveStripRoot(_panelHost, host) {
1127
- // Returning null is a retry signal — the rAF loop polls again
1272
+ // Returning null is a retry signal - the rAF loop polls again
1128
1273
  // on the next frame, succeeds once MatTabHeader has committed.
1129
1274
  const header = host.closest(MaterialPrivateSurfaces.MAT_MDC_TAB_HEADER_SELECTOR);
1130
1275
  const anyTab = header?.querySelector(MaterialPrivateSurfaces.MAT_MDC_TAB_SELECTOR);
@@ -1189,6 +1334,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1189
1334
  * `./decorations/`; this directive supplies their reactive triggers
1190
1335
  * and the delegators consumer templates call.
1191
1336
  *
1337
+ * **Inert on this bridge: `loop` and `orientation`.** Both are
1338
+ * forwarded so templates stay portable between `<cngx-tab-group>` and
1339
+ * the instrumented `<mat-tab-group>`, but Material owns the keyboard
1340
+ * interaction and the strip layout here - `loop` never changes
1341
+ * Material's Home/End/arrow behaviour, and `orientation` never
1342
+ * rotates the Material strip (use `<mat-tab-group headerPosition>` /
1343
+ * Material's own APIs for that). `orientation` still reaches the
1344
+ * cngx side through the overflow panel-host adapter; `loop` feeds
1345
+ * nothing Material does not already own. Deliberately kept in the
1346
+ * forwarded input set for template portability - removing them would
1347
+ * break `<cngx-tab-group>`-authored templates on paste.
1348
+ *
1192
1349
  * @playground Form error aggregation ./examples/form-errors/form-errors.component.ts
1193
1350
  *
1194
1351
  * @category ui/mat-tabs
@@ -1197,6 +1354,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1197
1354
  * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-tabs/mat-tabs.directive.ts
1198
1355
  * @since 0.1.0
1199
1356
  * @relatedTo CngxMatTabsRegistry, CngxMatTabError, CngxMatStepper
1357
+ * @slot cngxMatTabAggregatorContent Replaces the aggregated error summary projected into a Material tab.
1358
+ * @slot cngxMatTabRejectionContent Replaces the rejection notice on a rolled-back Material tab.
1200
1359
  */
1201
1360
  class CngxMatTabs {
1202
1361
  matTabGroup = inject(MatTabGroup, { self: true });
@@ -1223,42 +1382,34 @@ class CngxMatTabs {
1223
1382
  });
1224
1383
  aggregatorContentSlot = contentChild(CngxMatTabAggregatorContent, ...(ngDevMode ? [{ debugName: "aggregatorContentSlot" }] : /* istanbul ignore next */ []));
1225
1384
  aggregatorContentTemplate = computed(() => this.aggregatorContentSlot()?.templateRef ?? null, ...(ngDevMode ? [{ debugName: "aggregatorContentTemplate" }] : /* istanbul ignore next */ []));
1385
+ matTabsConfig = injectMatTabsConfig();
1226
1386
  rejectionContentSlot = contentChild(CngxMatTabRejectionContent, ...(ngDevMode ? [{ debugName: "rejectionContentSlot" }] : /* istanbul ignore next */ []));
1227
- rejectionContentTemplate = computed(() => this.rejectionContentSlot()?.templateRef ?? null, ...(ngDevMode ? [{ debugName: "rejectionContentTemplate" }] : /* istanbul ignore next */ []));
1387
+ rejectionContentTemplate = computed(() => this.rejectionContentSlot()?.templateRef ??
1388
+ this.matTabsConfig.templates.rejection ??
1389
+ null, ...(ngDevMode ? [{ debugName: "rejectionContentTemplate" }] : /* istanbul ignore next */ []));
1228
1390
  i18n = injectTabsI18n();
1229
- // Identity equal on `string | null` - collapses `tabs()` re-emits
1230
- // that don't change the failed-target id.
1231
- failedHandleId = computed(() => {
1232
- const idx = this.presenter.lastFailedIndex();
1233
- if (idx === undefined) {
1234
- return null;
1235
- }
1236
- return this.presenter.tabs()[idx]?.id ?? null;
1237
- }, ...(ngDevMode ? [{ debugName: "failedHandleId" }] : /* istanbul ignore next */ []));
1238
- // Bundle shares one source-walk across descriptorText / originLabel
1239
- // / liveAnnouncement - pillar-2 phrasing parity with cngx-native.
1391
+ // Bundle shares one source-walk across failedHandleId /
1392
+ // descriptorText / originLabel / liveAnnouncement - pillar-2
1393
+ // phrasing parity with cngx-native.
1240
1394
  rejectionState = createRejectionState(this.presenter, this.i18n);
1241
1395
  // Shared with `[cngxMatTabNav]` - one body, two hosts (Pillar 3).
1242
1396
  // Structural equal lives in the factory so the projector doesn't
1243
1397
  // churn on no-op aggregator re-emissions.
1244
1398
  aggregatedErrorTabs = createAggregatedErrorTabs(this.presenter);
1245
1399
  constructor() {
1246
- const matTabsConfig = injectMatTabsConfig();
1400
+ const matTabsConfig = this.matTabsConfig;
1247
1401
  // Polite live region - attribute directive owns no template, so
1248
- // the helper attaches the span at document.body (CDK
1249
- // LiveAnnouncer convention) and mirrors `CngxLiveRegion`'s host
1250
- // bindings imperatively.
1402
+ // the helper forwards every non-empty announcement to the shared
1403
+ // root CngxLiveAnnouncer, which owns the persistent region pair.
1251
1404
  mountLiveRegionAnnouncer({
1252
1405
  announcement: this.rejectionState.liveAnnouncement,
1253
- renderer: this.renderer,
1254
1406
  injector: this.injector,
1255
- destroyRef: this.destroyRef,
1256
1407
  });
1257
1408
  // Decoration projectors own DOM-mutation state plus `effect()`
1258
1409
  // registration; the directive only supplies reactive triggers.
1259
1410
  createMatTabRejectionDecoration({
1260
1411
  hostEl: this.hostEl,
1261
- failedHandleId: this.failedHandleId,
1412
+ failedHandleId: this.rejectionState.failedHandleId,
1262
1413
  failedIndex: this.presenter.lastFailedIndex,
1263
1414
  descriptorText: this.rejectionState.descriptorText,
1264
1415
  renderer: this.renderer,
@@ -1430,7 +1581,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1430
1581
  * reflects `NavigationEnd` onto `activeIndex` (its commit-action stays
1431
1582
  * dormant because link clicks navigate natively, never through
1432
1583
  * `presenter.select`). Ableitung statt Verwaltung - the route-active
1433
- * link is the single source of the active index.
1584
+ * link is the single source of the active index. `activeIndex` /
1585
+ * `activeIndexChange` are forwarded from the presenter hostDirective,
1586
+ * so a consumer without route-sync can two-way bind the active link
1587
+ * the same way `[cngxMatTabs]` consumers do.
1588
+ *
1589
+ * Active-link changes speak: the shared nav announcement bundle
1590
+ * ({@link createTabNavAnnouncement}) feeds the landing link's label to
1591
+ * the shared live announcer - silent through the mount window, so a
1592
+ * deep link's initial active state is not announced as a change.
1434
1593
  *
1435
1594
  * Composes {@link CngxTabGroupPresenter} via `hostDirectives` so the
1436
1595
  * `CNGX_STATEFUL` producer, the `lastFailedIndex` rejection slot, and
@@ -1458,29 +1617,28 @@ class CngxMatTabNav {
1458
1617
  renderer = inject(Renderer2);
1459
1618
  hostEl = inject(ElementRef).nativeElement;
1460
1619
  i18n = injectTabsI18n();
1461
- // Stable id of the rejected link, or null. Identity equal collapses
1462
- // tabs() re-emits that don't change the failed-target id.
1463
- failedHandleId = computed(() => {
1464
- const idx = this.presenter.lastFailedIndex();
1465
- if (idx === undefined) {
1466
- return null;
1467
- }
1468
- return this.presenter.tabs()[idx]?.id ?? null;
1469
- }, ...(ngDevMode ? [{ debugName: "failedHandleId" }] : /* istanbul ignore next */ []));
1470
1620
  rejectionState = createRejectionState(this.presenter, this.i18n);
1471
1621
  aggregatedErrorTabs = createAggregatedErrorTabs(this.presenter);
1472
1622
  constructor() {
1473
1623
  mountLiveRegionAnnouncer({
1474
1624
  announcement: this.rejectionState.liveAnnouncement,
1475
- renderer: this.renderer,
1476
1625
  injector: this.injector,
1477
- destroyRef: this.destroyRef,
1626
+ });
1627
+ // Active-link landing announcement - same bundle as the cngx-native
1628
+ // <cngx-tab-nav>; the shared announcer coalesces both feeds into
1629
+ // one polite region.
1630
+ mountLiveRegionAnnouncer({
1631
+ announcement: createTabNavAnnouncement({
1632
+ presenter: this.presenter,
1633
+ injector: this.injector,
1634
+ }).liveAnnouncement,
1635
+ injector: this.injector,
1478
1636
  });
1479
1637
  // Same projector bodies as `[cngxMatTabs]`; only the per-tab element
1480
1638
  // selector differs (`.mat-mdc-tab-link` vs `.mat-mdc-tab`).
1481
1639
  createMatTabRejectionDecoration({
1482
1640
  hostEl: this.hostEl,
1483
- failedHandleId: this.failedHandleId,
1641
+ failedHandleId: this.rejectionState.failedHandleId,
1484
1642
  failedIndex: this.presenter.lastFailedIndex,
1485
1643
  descriptorText: this.rejectionState.descriptorText,
1486
1644
  renderer: this.renderer,
@@ -1507,7 +1665,7 @@ class CngxMatTabNav {
1507
1665
  this.presenter.clearLastFailed();
1508
1666
  }
1509
1667
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabNav, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1510
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxMatTabNav, isStandalone: true, selector: "[cngxMatTabNav]", exportAs: ["cngxMatTabNav"], hostDirectives: [{ directive: i1.CngxTabGroupPresenter }], ngImport: i0 });
1668
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxMatTabNav, isStandalone: true, selector: "[cngxMatTabNav]", providers: [{ provide: CNGX_TAB_NAV_HOST, useValue: true }], exportAs: ["cngxMatTabNav"], hostDirectives: [{ directive: i1.CngxTabGroupPresenter, inputs: ["activeIndex", "activeIndex"], outputs: ["activeIndexChange", "activeIndexChange"] }], ngImport: i0 });
1511
1669
  }
1512
1670
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabNav, decorators: [{
1513
1671
  type: Directive,
@@ -1515,7 +1673,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1515
1673
  selector: '[cngxMatTabNav]',
1516
1674
  exportAs: 'cngxMatTabNav',
1517
1675
  standalone: true,
1518
- hostDirectives: [CngxTabGroupPresenter],
1676
+ // Presence-only marker: it tells a stacked [cngxTabsRouteSync] that its
1677
+ // links own subtrees, so the URL match is prefix rather than suffix.
1678
+ providers: [{ provide: CNGX_TAB_NAV_HOST, useValue: true }],
1679
+ hostDirectives: [
1680
+ {
1681
+ directive: CngxTabGroupPresenter,
1682
+ inputs: ['activeIndex'],
1683
+ outputs: ['activeIndexChange'],
1684
+ },
1685
+ ],
1519
1686
  }]
1520
1687
  }], ctorParameters: () => [] });
1521
1688
 
@@ -1593,7 +1760,7 @@ class CngxMatTabLink {
1593
1760
  closable: signal(undefined),
1594
1761
  };
1595
1762
  this.host.register(handle);
1596
- this.destroyRef.onDestroy(() => this.host.unregister(handle.id));
1763
+ this.destroyRef.onDestroy(() => this.host.unregister(handle.id, handle));
1597
1764
  }
1598
1765
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMatTabLink, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1599
1766
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxMatTabLink, isStandalone: true, selector: "[cngxMatTabLink]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, errorAggregator: { classPropertyName: "errorAggregator", publicName: "errorAggregator", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["cngxMatTabLink"], ngImport: i0 });
@@ -1755,5 +1922,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
1755
1922
  * Generated bundle index. Do not edit.
1756
1923
  */
1757
1924
 
1758
- export { CNGX_MAT_TABS_CONFIG, CNGX_MAT_TABS_REGISTRY_HOST, CNGX_MAT_TAB_HANDLE_FACTORY, CngxMatTabAggregatorContent, CngxMatTabError, CngxMatTabErrorFlag, CngxMatTabLink, CngxMatTabNav, CngxMatTabRejectionContent, CngxMatTabs, CngxMatTabsRegistry, MaterialPrivateSurfaces, createCngxMatTabOverflowDomAdapter, createMatTabHandle, injectMatTabsConfig, provideMatTabsConfig, provideMatTabsConfigAt, withAnchorRetryAttempts, withHalfWiredSlotSink };
1925
+ export { CNGX_MAT_TABS_CONFIG, CNGX_MAT_TABS_CONFIG_DEFAULTS, CNGX_MAT_TABS_REGISTRY_HOST, CNGX_MAT_TAB_HANDLE_FACTORY, CngxMatTabAggregatorContent, CngxMatTabError, CngxMatTabErrorFlag, CngxMatTabLink, CngxMatTabNav, CngxMatTabRejectionContent, CngxMatTabs, CngxMatTabsRegistry, MaterialPrivateSurfaces, createCngxMatTabOverflowDomAdapter, createMatTabHandle, createOrderedRegistrationSeam, injectMatTabsConfig, mountLiveRegionAnnouncer, provideMatTabsConfig, provideMatTabsConfigAt, withAnchorRetryAttempts, withHalfWiredSlotSink, withMatTabRejectionTemplate };
1759
1926
  //# sourceMappingURL=cngx-ui-mat-tabs.mjs.map