@cngx/common 0.1.0-rc.5 → 0.1.0-rc.7

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 (63) hide show
  1. package/chart/README.md +85 -0
  2. package/command/README.md +157 -0
  3. package/data/README.md +23 -0
  4. package/fesm2022/cngx-common-a11y.mjs +247 -85
  5. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  6. package/fesm2022/cngx-common-audio.mjs +37 -37
  7. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  8. package/fesm2022/cngx-common-card.mjs +13 -9
  9. package/fesm2022/cngx-common-card.mjs.map +1 -1
  10. package/fesm2022/cngx-common-chart.mjs +3404 -1392
  11. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  12. package/fesm2022/cngx-common-command.mjs +144 -0
  13. package/fesm2022/cngx-common-command.mjs.map +1 -0
  14. package/fesm2022/cngx-common-data.mjs +304 -213
  15. package/fesm2022/cngx-common-data.mjs.map +1 -1
  16. package/fesm2022/cngx-common-dialog.mjs +369 -100
  17. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  18. package/fesm2022/cngx-common-display.mjs +144 -30
  19. package/fesm2022/cngx-common-display.mjs.map +1 -1
  20. package/fesm2022/cngx-common-interactive.mjs +1089 -459
  21. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  22. package/fesm2022/cngx-common-layout.mjs +113 -61
  23. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  24. package/fesm2022/cngx-common-popover.mjs +430 -54
  25. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  26. package/fesm2022/cngx-common-stepper.mjs +107 -49
  27. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  28. package/fesm2022/cngx-common-tabs.mjs +1170 -752
  29. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  30. package/fesm2022/cngx-common-timeline.mjs +1086 -0
  31. package/fesm2022/cngx-common-timeline.mjs.map +1 -0
  32. package/fesm2022/cngx-common.mjs +2 -2
  33. package/fesm2022/cngx-common.mjs.map +1 -1
  34. package/package.json +11 -1
  35. package/stepper/README.md +1 -1
  36. package/theming/components/cngx-accordion.css +20 -6
  37. package/theming/components/cngx-badge.css +22 -0
  38. package/theming/components/cngx-bottom-sheet.css +14 -2
  39. package/theming/components/cngx-breadcrumb.css +9 -1
  40. package/theming/components/cngx-button-toggle.css +44 -2
  41. package/theming/components/cngx-data-grid.css +69 -4
  42. package/theming/components/cngx-dialog.css +12 -0
  43. package/theming/components/cngx-divider.css +12 -0
  44. package/theming/components/cngx-listbox.css +27 -0
  45. package/theming/components/cngx-menu.css +36 -0
  46. package/theming/components/cngx-ripple.css +1 -1
  47. package/theming/components/cngx-slider.css +1 -1
  48. package/theming/components/cngx-tooltip.css +11 -0
  49. package/types/cngx-common-a11y.d.ts +63 -17
  50. package/types/cngx-common-audio.d.ts +32 -32
  51. package/types/cngx-common-card.d.ts +10 -3
  52. package/types/cngx-common-chart.d.ts +1281 -141
  53. package/types/cngx-common-command.d.ts +167 -0
  54. package/types/cngx-common-data.d.ts +264 -98
  55. package/types/cngx-common-dialog.d.ts +214 -25
  56. package/types/cngx-common-display.d.ts +83 -13
  57. package/types/cngx-common-interactive.d.ts +708 -174
  58. package/types/cngx-common-layout.d.ts +48 -1
  59. package/types/cngx-common-popover.d.ts +120 -3
  60. package/types/cngx-common-stepper.d.ts +55 -5
  61. package/types/cngx-common-tabs.d.ts +386 -25
  62. package/types/cngx-common-timeline.d.ts +1059 -0
  63. package/types/cngx-common.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, signal, afterNextRender, computed, output, Directive, inject, TemplateRef, model, contentChild, DestroyRef, ChangeDetectionStrategy, Component, effect, untracked, InjectionToken, Injector, Injectable, makeEnvironmentProviders, ViewContainerRef, LOCALE_ID, ViewEncapsulation, ElementRef, isDevMode, isSignal, runInInjectionContext } from '@angular/core';
2
+ import { input, signal, afterNextRender, computed, output, Directive, inject, TemplateRef, model, contentChild, DestroyRef, ChangeDetectionStrategy, Component, effect, untracked, InjectionToken, Injector, Injectable, makeEnvironmentProviders, ViewContainerRef, LOCALE_ID, ViewEncapsulation, isDevMode, isSignal, ElementRef, runInInjectionContext } from '@angular/core';
3
3
  import { NgTemplateOutlet, DOCUMENT } from '@angular/common';
4
4
  import { CngxChip } from '@cngx/common/display';
5
5
  import { CngxMultiChipGroup, CngxChipInGroup, CngxSearch } from '@cngx/common/interactive';
@@ -7,7 +7,7 @@ import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
7
7
  import { Router, ActivatedRoute } from '@angular/router';
8
8
  import { DataSource } from '@angular/cdk/collections';
9
9
  import { arrayEqual } from '@cngx/utils';
10
- import { buildAsyncStateView, nextUid, createTransitionTracker } from '@cngx/core/utils';
10
+ import { buildAsyncStateView, nextUid, createAggregateAsyncState, CNGX_STATEFUL, createLatencyProbe, createVisibilityGate, createTransitionTracker } from '@cngx/core/utils';
11
11
  import { isObservable, firstValueFrom, defer, tap, filter, map, finalize } from 'rxjs';
12
12
  import { HttpContextToken, HttpContext, HttpEventType, provideHttpClient, withInterceptors } from '@angular/common/http';
13
13
 
@@ -482,6 +482,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
482
482
  * mount and unmount cleans the latest binding (per
483
483
  * `reference_signal_architecture` memory-hygiene rule).
484
484
  *
485
+ * **Visible caption.** The required `label` renders as a
486
+ * `.cngx-filter-chips__label` caption above the strip so a sighted user
487
+ * can tell which facet a chip row belongs to. The caption is
488
+ * `aria-hidden="true"`: the inner `<cngx-multi-chip-group>` is already
489
+ * named by the same string via `[label]`, so exposing the visible node
490
+ * to AT would announce the facet twice. Spacing between caption and
491
+ * strip is the `--cngx-filter-chips-gap` token; the caption's own
492
+ * appearance is `--cngx-filter-chips-label-color`,
493
+ * `--cngx-filter-chips-label-font-size` and
494
+ * `--cngx-filter-chips-label-font-weight`.
495
+ *
485
496
  * ```html
486
497
  * <cngx-filter-chips
487
498
  * label="Tags"
@@ -505,6 +516,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
505
516
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter-chips/filter-chips.component.ts
506
517
  * @since 0.1.0
507
518
  * @relatedTo CngxFilter, CngxFilterChip, CngxMultiChipGroup
519
+ * @slot cngxFilterChip Renders one active filter chip; gets the filter entry and a remove callback.
508
520
  *
509
521
  * <example-url>http://localhost:4200/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>
510
522
  * <example-url>http://localhost:4200/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>
@@ -600,7 +612,8 @@ class CngxFilterChips {
600
612
  });
601
613
  }
602
614
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxFilterChips, deps: [], target: i0.ɵɵFactoryTarget.Component });
603
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxFilterChips, isStandalone: true, selector: "cngx-filter-chips", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: true, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: true, transformFunction: null }, filterRef: { classPropertyName: "filterRef", publicName: "filterRef", isSignal: true, isRequired: true, transformFunction: null }, filterKey: { classPropertyName: "filterKey", publicName: "filterKey", isSignal: true, isRequired: true, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, errorMessageId: { classPropertyName: "errorMessageId", publicName: "errorMessageId", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, keyFn: { classPropertyName: "keyFn", publicName: "keyFn", isSignal: true, isRequired: false, transformFunction: null }, selectedValues: { classPropertyName: "selectedValues", publicName: "selectedValues", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", required: "requiredChange", invalid: "invalidChange", selectedValues: "selectedValuesChange" }, queries: [{ propertyName: "chipTemplate", first: true, predicate: (CngxFilterChip), descendants: true, isSignal: true }], exportAs: ["cngxFilterChips"], ngImport: i0, template: `
615
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxFilterChips, isStandalone: true, selector: "cngx-filter-chips", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: true, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: true, transformFunction: null }, filterRef: { classPropertyName: "filterRef", publicName: "filterRef", isSignal: true, isRequired: true, transformFunction: null }, filterKey: { classPropertyName: "filterKey", publicName: "filterKey", isSignal: true, isRequired: true, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, errorMessageId: { classPropertyName: "errorMessageId", publicName: "errorMessageId", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, keyFn: { classPropertyName: "keyFn", publicName: "keyFn", isSignal: true, isRequired: false, transformFunction: null }, selectedValues: { classPropertyName: "selectedValues", publicName: "selectedValues", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", required: "requiredChange", invalid: "invalidChange", selectedValues: "selectedValuesChange" }, host: { properties: { "class.cngx-filter-chips--vertical": "orientation() === \"vertical\"" }, classAttribute: "cngx-filter-chips" }, queries: [{ propertyName: "chipTemplate", first: true, predicate: (CngxFilterChip), descendants: true, isSignal: true }], exportAs: ["cngxFilterChips"], ngImport: i0, template: `
616
+ <span class="cngx-filter-chips__label" aria-hidden="true">{{ label() }}</span>
604
617
  <cngx-multi-chip-group
605
618
  [label]="label()"
606
619
  [(selectedValues)]="selectedValues"
@@ -622,17 +635,15 @@ class CngxFilterChips {
622
635
  </cngx-chip>
623
636
  }
624
637
  </cngx-multi-chip-group>
625
- `, isInline: true, dependencies: [{ kind: "component", type: CngxChip, selector: "cngx-chip", inputs: ["removable", "id", "removeAriaLabel"], outputs: ["remove"], exportAs: ["cngxChip"] }, { kind: "component", type: CngxMultiChipGroup, selector: "cngx-multi-chip-group, [cngxMultiChipGroup]", inputs: ["selectedValues", "disabled", "required", "invalid", "errorMessageId", "orientation", "label", "state", "keyFn"], outputs: ["selectedValuesChange", "disabledChange", "requiredChange", "invalidChange"], exportAs: ["cngxMultiChipGroup"] }, { kind: "directive", type: CngxChipInGroup, selector: "[cngxChipInGroup]", inputs: ["value", "disabled", "cngxDescribedBy"], exportAs: ["cngxChipInGroup"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
638
+ `, isInline: true, styles: [":host{display:flex;flex-direction:row;align-items:center;--cngx-filter-chips-gap: var(--cngx-space-sm, 8px);gap:var(--cngx-filter-chips-gap, 8px)}:host(.cngx-filter-chips--vertical){flex-direction:column;align-items:flex-start}.cngx-filter-chips__label{color:var(--cngx-filter-chips-label-color, inherit);font-size:var(--cngx-filter-chips-label-font-size, .8125rem);font-weight:var(--cngx-filter-chips-label-font-weight, 600)}\n"], dependencies: [{ kind: "component", type: CngxChip, selector: "cngx-chip", inputs: ["removable", "id", "removeAriaLabel"], outputs: ["remove"], exportAs: ["cngxChip"] }, { kind: "component", type: CngxMultiChipGroup, selector: "cngx-multi-chip-group, [cngxMultiChipGroup]", inputs: ["selectedValues", "disabled", "required", "invalid", "errorMessageId", "orientation", "label", "state", "keyFn"], outputs: ["selectedValuesChange", "disabledChange", "requiredChange", "invalidChange"], exportAs: ["cngxMultiChipGroup"] }, { kind: "directive", type: CngxChipInGroup, selector: "[cngxChipInGroup]", inputs: ["value", "disabled", "cngxDescribedBy"], exportAs: ["cngxChipInGroup"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
626
639
  }
627
640
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxFilterChips, decorators: [{
628
641
  type: Component,
629
- args: [{
630
- selector: 'cngx-filter-chips',
631
- exportAs: 'cngxFilterChips',
632
- standalone: true,
633
- changeDetection: ChangeDetectionStrategy.OnPush,
634
- imports: [CngxChip, CngxMultiChipGroup, CngxChipInGroup, NgTemplateOutlet],
635
- template: `
642
+ args: [{ selector: 'cngx-filter-chips', exportAs: 'cngxFilterChips', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [CngxChip, CngxMultiChipGroup, CngxChipInGroup, NgTemplateOutlet], host: {
643
+ class: 'cngx-filter-chips',
644
+ '[class.cngx-filter-chips--vertical]': 'orientation() === "vertical"',
645
+ }, template: `
646
+ <span class="cngx-filter-chips__label" aria-hidden="true">{{ label() }}</span>
636
647
  <cngx-multi-chip-group
637
648
  [label]="label()"
638
649
  [(selectedValues)]="selectedValues"
@@ -654,8 +665,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
654
665
  </cngx-chip>
655
666
  }
656
667
  </cngx-multi-chip-group>
657
- `,
658
- }]
668
+ `, styles: [":host{display:flex;flex-direction:row;align-items:center;--cngx-filter-chips-gap: var(--cngx-space-sm, 8px);gap:var(--cngx-filter-chips-gap, 8px)}:host(.cngx-filter-chips--vertical){flex-direction:column;align-items:flex-start}.cngx-filter-chips__label{color:var(--cngx-filter-chips-label-color, inherit);font-size:var(--cngx-filter-chips-label-font-size, .8125rem);font-weight:var(--cngx-filter-chips-label-font-weight, 600)}\n"] }]
659
669
  }], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: true }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: true }] }], filterRef: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterRef", required: true }] }], filterKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterKey", required: true }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }, { type: i0.Output, args: ["requiredChange"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }, { type: i0.Output, args: ["invalidChange"] }], errorMessageId: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessageId", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], keyFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyFn", required: false }] }], chipTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxFilterChip), { isSignal: true }] }], selectedValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedValues", required: false }] }, { type: i0.Output, args: ["selectedValuesChange"] }] } });
660
670
 
661
671
  /**
@@ -1247,6 +1257,22 @@ function isAsyncState(source) {
1247
1257
  * tree. Each directive is injected optionally - if absent, that processing
1248
1258
  * step is skipped.
1249
1259
  *
1260
+ * Injection resolves UPWARD only. Any atom hosted by a descendant component
1261
+ * - a `hostDirective` on an element below the consumer's injector - is
1262
+ * invisible to these injects, and the matching step is silently skipped:
1263
+ * the atom's own state still toggles (headers flip their arrows) while the
1264
+ * rows never move. `CngxDataGridAccordion` is the case where this is always
1265
+ * true: it hosts `CngxSort` and `CngxFilter` on the group element. Hand
1266
+ * such atoms in through the options thunks instead:
1267
+ *
1268
+ * ```typescript
1269
+ * readonly grid = viewChild(CngxDataGridAccordion);
1270
+ * readonly dataSource = injectSmartDataSource(this.rows, {
1271
+ * sort: () => this.grid()?.sort,
1272
+ * filter: () => this.grid()?.filter,
1273
+ * });
1274
+ * ```
1275
+ *
1250
1276
  * Accepts either a plain `Signal<T[]>` or a `CngxAsyncState<T[]>`.
1251
1277
  * When a `CngxAsyncState` is provided, the data source exposes the full
1252
1278
  * UX state (`isLoading`, `isRefreshing`, `error`, `isEmpty`) so the
@@ -1273,14 +1299,13 @@ function isAsyncState(source) {
1273
1299
  class CngxSmartDataSource extends DataSource {
1274
1300
  options;
1275
1301
  injector = inject(Injector);
1276
- sort = inject(CngxSort, { optional: true });
1277
- filter = inject(CngxFilter, { optional: true });
1278
- // CngxSearch typically lives on a child <input> below the component injector,
1279
- // so this inject returns null in the common case. It resolves only when CngxSearch
1280
- // is placed as a hostDirective on the same component. For child-input search,
1281
- // use injectDataSource() + manual computed() instead.
1282
- search = inject(CngxSearch, { optional: true });
1283
- paginate = inject(CngxPaginate, { optional: true });
1302
+ injectedSort = inject(CngxSort, { optional: true });
1303
+ injectedFilter = inject(CngxFilter, { optional: true });
1304
+ // Injection resolves upward only; an atom below this injector (child
1305
+ // <input> search, a hosting organism's sort/filter) arrives via the
1306
+ // matching options thunk instead.
1307
+ injectedSearch = inject(CngxSearch, { optional: true });
1308
+ injectedPaginate = inject(CngxPaginate, { optional: true });
1284
1309
  /**
1285
1310
  * Items after filter and search are applied, before sort and pagination.
1286
1311
  * Use `filteredCount()` to get the pre-pagination count for paginator `total`.
@@ -1327,8 +1352,12 @@ class CngxSmartDataSource extends DataSource {
1327
1352
  this.isFirstLoad = computed(() => s?.isFirstLoad() ?? false, ...(ngDevMode ? [{ debugName: "isFirstLoad" }] : /* istanbul ignore next */ []));
1328
1353
  this.error = computed(() => s?.error(), ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
1329
1354
  this.filtered = computed(() => {
1330
- const predicate = this.filter?.predicate();
1331
- const term = this.search?.term();
1355
+ // Resolve at read time: an options thunk pointing at a not-yet-mounted
1356
+ // viewChild returns undefined now and the instance on a later pass.
1357
+ const filter = this.options?.filter?.() ?? this.injectedFilter;
1358
+ const search = this.options?.search?.() ?? this.injectedSearch;
1359
+ const predicate = filter?.predicate();
1360
+ const term = search?.term();
1332
1361
  const searchFn = this.options?.searchFn ?? (defaultSearchFn);
1333
1362
  // Pipeline: raw → filter → search. Cast required: CngxFilter injected as unknown.
1334
1363
  return data()
@@ -1344,12 +1373,14 @@ class CngxSmartDataSource extends DataSource {
1344
1373
  return this.filteredCount() === 0;
1345
1374
  }, ...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
1346
1375
  this.processed = computed(() => {
1347
- const sorts = this.sort?.sorts() ?? [];
1376
+ const sort = this.options?.sort?.() ?? this.injectedSort;
1377
+ const sorts = sort?.sorts() ?? [];
1348
1378
  const sortFn = this.options?.sortFn ?? (defaultSortFn);
1349
1379
  const sorted = sorts.length > 0
1350
1380
  ? [...this.filtered()].sort((a, b) => sorts.reduce((cmp, { active, direction }) => cmp || sortFn(a, b, active, direction), 0))
1351
1381
  : this.filtered();
1352
- const range = this.paginate?.range();
1382
+ const paginate = this.options?.paginate?.() ?? this.injectedPaginate;
1383
+ const range = paginate?.range();
1353
1384
  return range ? sorted.slice(range[0], range[1]) : sorted;
1354
1385
  }, { ...(ngDevMode ? { debugName: "processed" } : /* istanbul ignore next */ {}), equal: arrayEqual });
1355
1386
  }
@@ -1383,10 +1414,10 @@ function injectSmartDataSource(source, options) {
1383
1414
  }
1384
1415
 
1385
1416
  /**
1386
- * Create a fully manual async state — no HTTP, no automatic loading.
1417
+ * Create a fully manual async state - no HTTP, no automatic loading.
1387
1418
  *
1388
1419
  * Use for local operations: heavy computations, Web Workers, complex local processes.
1389
- * Does **not** require an injection context — uses only `signal()` and `computed()`.
1420
+ * Does **not** require an injection context - uses only `signal()` and `computed()`.
1390
1421
  *
1391
1422
  * ```typescript
1392
1423
  * readonly processState = createManualState<ProcessResult>();
@@ -1453,7 +1484,7 @@ function createManualState() {
1453
1484
  }
1454
1485
 
1455
1486
  /**
1456
- * Create a mutation async state — for explicit user-triggered actions.
1487
+ * Create a mutation async state - for explicit user-triggered actions.
1457
1488
  *
1458
1489
  * Must be called in an injection context (field initializer or constructor)
1459
1490
  * because it uses `inject(DestroyRef)` for cleanup.
@@ -1529,6 +1560,57 @@ function createAsyncState() {
1529
1560
  };
1530
1561
  }
1531
1562
 
1563
+ /**
1564
+ * Wraps a *changing* source of async state in a stable
1565
+ * {@link CngxAsyncState} façade.
1566
+ *
1567
+ * A component that receives its state through an `Input` cannot publish that
1568
+ * object through `CNGX_STATEFUL` directly: the token is resolved once when a
1569
+ * bridge injects it, while the input can be rebound or absent. Capturing the
1570
+ * object would hand the bridge a stale state - or `undefined` before the
1571
+ * first binding.
1572
+ *
1573
+ * This returns one object whose every member is a `computed()` that reads the
1574
+ * source on each access, so bridges observe transitions of whatever is bound
1575
+ * right now. With nothing bound it reports a quiet `idle` state rather than
1576
+ * throwing, which is what lets a bridge sit inside a timeline that has not
1577
+ * been given a state yet.
1578
+ *
1579
+ * Contrast the select family, which provides `CNGX_STATEFUL` with
1580
+ * `useFactory` over a concrete `commitState` field - no forwarding needed
1581
+ * there, because the state is created by the component rather than passed in.
1582
+ * The split is not about the component, it is about where the state is born:
1583
+ * created locally, capture it; arriving through an `Input`, forward it.
1584
+ *
1585
+ * ```ts
1586
+ * readonly asyncState = createForwardedAsyncState(this.state);
1587
+ *
1588
+ * // providers:
1589
+ * { provide: CNGX_STATEFUL, useFactory: () => ({ state: inject(Host).asyncState }) }
1590
+ * ```
1591
+ *
1592
+ * @category common/data/async-state
1593
+ * @relatedTo createAsyncState, createManualState
1594
+ * @since 0.1.0
1595
+ */
1596
+ function createForwardedAsyncState(source) {
1597
+ return {
1598
+ status: computed(() => source()?.status() ?? 'idle'),
1599
+ data: computed(() => source()?.data()),
1600
+ error: computed(() => source()?.error()),
1601
+ progress: computed(() => source()?.progress()),
1602
+ isLoading: computed(() => source()?.isLoading() ?? false),
1603
+ isPending: computed(() => source()?.isPending() ?? false),
1604
+ isRefreshing: computed(() => source()?.isRefreshing() ?? false),
1605
+ isBusy: computed(() => source()?.isBusy() ?? false),
1606
+ isFirstLoad: computed(() => source()?.isFirstLoad() ?? true),
1607
+ isEmpty: computed(() => source()?.isEmpty() ?? true),
1608
+ hasData: computed(() => source()?.hasData() ?? false),
1609
+ isSettled: computed(() => source()?.isSettled() ?? false),
1610
+ lastUpdated: computed(() => source()?.lastUpdated()),
1611
+ };
1612
+ }
1613
+
1532
1614
  /** @internal Length-then-key-set equality for the operations Map signal. */
1533
1615
  function mapKeySetEqual(a, b) {
1534
1616
  if (a === b) {
@@ -1668,7 +1750,7 @@ function injectAsyncRegistry() {
1668
1750
  * Create a reactive async state that auto-loads when signal dependencies change.
1669
1751
  *
1670
1752
  * Must be called in an injection context (field initializer or constructor).
1671
- * The computation function is tracked by Angular's `effect()` — any signal
1753
+ * The computation function is tracked by Angular's `effect()` - any signal
1672
1754
  * read inside `fn` will cause a re-load when it changes.
1673
1755
  *
1674
1756
  * ```typescript
@@ -1762,7 +1844,7 @@ function injectAsyncState(fn, options) {
1762
1844
  result = fn();
1763
1845
  }
1764
1846
  catch (err) {
1765
- // sync throw (e.g. required signal not yet set) — debounce the error
1847
+ // sync throw (e.g. required signal not yet set) - debounce the error
1766
1848
  // to match the async path
1767
1849
  if (debounceTimer !== undefined) {
1768
1850
  clearTimeout(debounceTimer);
@@ -1809,7 +1891,7 @@ function injectAsyncState(fn, options) {
1809
1891
  /**
1810
1892
  * Pure function that resolves which view to show based on async state.
1811
1893
  *
1812
- * Encodes the state machine as a lookup table — no branching:
1894
+ * Encodes the state machine as a lookup table - no branching:
1813
1895
  *
1814
1896
  * | status | firstLoad | empty | view |
1815
1897
  * |-------------|-----------|-------|---------------|
@@ -1846,13 +1928,66 @@ function resolveAsyncView(status, firstLoad, empty) {
1846
1928
  return 'content';
1847
1929
  }
1848
1930
 
1931
+ /**
1932
+ * Headless boundary that aggregates N keyed `CngxAsyncState`s into one derived
1933
+ * `CngxAsyncState` and provides it as `CNGX_STATEFUL`.
1934
+ *
1935
+ * The aggregate `state` is a first-class `CngxAsyncState`, so it renders
1936
+ * through `<cngx-async-container [state]="b.state">` and every other consumer
1937
+ * unchanged, and any transition bridge (`cngxToastOn`, `cngxAlertOn`,
1938
+ * `cngxBannerOn`) nested in the host fires on the combined status with zero
1939
+ * `[state]` wiring. `failures` exposes the errored sources - keyed, so a
1940
+ * consumer's `@for` can render per-source attribution through any feedback
1941
+ * component. `state.error` stays the first error for the single-error path.
1942
+ *
1943
+ * ```html
1944
+ * <div [cngxAsyncBoundary]="sources" #b="cngxAsyncBoundary">
1945
+ * <cngx-async-container [state]="b.state"> ... </cngx-async-container>
1946
+ * <cngx-toast-on />
1947
+ * @for (f of b.failures(); track f.key) {
1948
+ * <cngx-banner>{{ f.label }} failed</cngx-banner>
1949
+ * }
1950
+ * </div>
1951
+ * ```
1952
+ *
1953
+ * @category common/data/async-state
1954
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async-state/async-boundary.directive.ts
1955
+ * @since 0.1.0
1956
+ */
1957
+ class CngxAsyncBoundary {
1958
+ /** The keyed source list to aggregate. */
1959
+ sources = input.required({ ...(ngDevMode ? { debugName: "sources" } : /* istanbul ignore next */ {}), alias: 'cngxAsyncBoundary' });
1960
+ states = computed(() => this.sources().map((s) => s.state), { ...(ngDevMode ? { debugName: "states" } : /* istanbul ignore next */ {}), equal: (a, b) => a.length === b.length && a.every((s, i) => s === b[i]) });
1961
+ /** The derived aggregate state - also exposed via `CNGX_STATEFUL`. */
1962
+ state = createAggregateAsyncState(this.states);
1963
+ /** The errored sources, keyed for per-source attribution. */
1964
+ failures = computed(() => this.sources()
1965
+ .filter((s) => s.state.status() === 'error')
1966
+ .map((s) => ({ key: s.key, label: s.label, error: s.state.error() })), { ...(ngDevMode ? { debugName: "failures" } : /* istanbul ignore next */ {}), equal: (a, b) => a.length === b.length &&
1967
+ a.every((f, i) => f.key === b[i].key && Object.is(f.error, b[i].error)) });
1968
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxAsyncBoundary, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1969
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxAsyncBoundary, isStandalone: true, selector: "[cngxAsyncBoundary]", inputs: { sources: { classPropertyName: "sources", publicName: "cngxAsyncBoundary", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "attr.aria-busy": "state.isBusy() || null" } }, providers: [{ provide: CNGX_STATEFUL, useExisting: CngxAsyncBoundary }], exportAs: ["cngxAsyncBoundary"], ngImport: i0 });
1970
+ }
1971
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxAsyncBoundary, decorators: [{
1972
+ type: Directive,
1973
+ args: [{
1974
+ selector: '[cngxAsyncBoundary]',
1975
+ standalone: true,
1976
+ exportAs: 'cngxAsyncBoundary',
1977
+ providers: [{ provide: CNGX_STATEFUL, useExisting: CngxAsyncBoundary }],
1978
+ host: {
1979
+ '[attr.aria-busy]': 'state.isBusy() || null',
1980
+ },
1981
+ }]
1982
+ }], propDecorators: { sources: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxAsyncBoundary", required: true }] }] } });
1983
+
1849
1984
  /**
1850
1985
  * Bridge that projects an Angular `Resource<T>` onto `CngxAsyncState<T>`.
1851
1986
  *
1852
1987
  * Must be called in an injection context (the `effect()` that tracks
1853
1988
  * `hadSuccess` requires one).
1854
1989
  *
1855
- * All signals are derived reactively from the resource — no manual
1990
+ * All signals are derived reactively from the resource - no manual
1856
1991
  * synchronization. The resource stays the single source of truth.
1857
1992
  *
1858
1993
  * ```typescript
@@ -1864,8 +1999,8 @@ function resolveAsyncView(status, firstLoad, empty) {
1864
1999
  * });
1865
2000
  *
1866
2001
  * readonly items = fromResource(this.res);
1867
- * // items.status(), items.data(), items.isFirstLoad() — all work
1868
- * // <cngx-async-container [state]="items"> — direct binding
2002
+ * // items.status(), items.data(), items.isFirstLoad() - all work
2003
+ * // <cngx-async-container [state]="items"> - direct binding
1869
2004
  * ```
1870
2005
  *
1871
2006
  * @category common/data/async-state
@@ -1951,7 +2086,7 @@ function fromResource(ref) {
1951
2086
  *
1952
2087
  * readonly items = fromHttpResource(this.res);
1953
2088
  * // items.progress() tracks upload/download progress
1954
- * // <cngx-progress [state]="items"> — auto-wired progress bar
2089
+ * // <cngx-progress [state]="items"> - auto-wired progress bar
1955
2090
  * ```
1956
2091
  *
1957
2092
  * @category common/data/async-state
@@ -2034,7 +2169,7 @@ function fromHttpResource(ref) {
2034
2169
  * On next: calls `setSuccess(value)`.
2035
2170
  * On error: calls `setError(err)` and **re-throws** (does not swallow).
2036
2171
  *
2037
- * The Observable passes through unchanged — `tapAsyncState` is a side-effect operator.
2172
+ * The Observable passes through unchanged - `tapAsyncState` is a side-effect operator.
2038
2173
  *
2039
2174
  * ```typescript
2040
2175
  * readonly residents = createManualState<Resident[]>();
@@ -2122,7 +2257,7 @@ function tapAsyncProgress(state) {
2122
2257
  * tapHttpAsyncState(this.upload),
2123
2258
  * takeUntilDestroyed(this.destroyRef),
2124
2259
  * ).subscribe();
2125
- * // upload.status(), upload.progress(), upload.data() — all wired
2260
+ * // upload.status(), upload.progress(), upload.data() - all wired
2126
2261
  * }
2127
2262
  * ```
2128
2263
  *
@@ -2145,6 +2280,33 @@ function tapHttpAsyncState(state, options) {
2145
2280
  });
2146
2281
  }
2147
2282
 
2283
+ /**
2284
+ * Bridges {@link CngxAsyncRegistry} into a {@link CngxLatencyProbe} measuring the
2285
+ * registry's observed busy-envelope: how long the app was "anything loading"
2286
+ * during the last in-flight window.
2287
+ *
2288
+ * An app-shell indicator compares `lastDuration()` against
2289
+ * `CNGX_LOADING_CONFIG.spinnerVsSkeletonCutoff` to pick a spinner (fast last
2290
+ * aggregate) vs a skeleton (slow last aggregate) before the next load renders.
2291
+ *
2292
+ * When the registry is absent (`provideAsyncRegistry` never called),
2293
+ * `injectAsyncRegistry()` returns `null`, so the probe's source is permanently
2294
+ * `false`: it is never busy and never throws.
2295
+ *
2296
+ * Must run in an injection context.
2297
+ *
2298
+ * @returns A probe over `CngxAsyncRegistry.isAnythingLoading`.
2299
+ *
2300
+ * @category common/data/async-registry
2301
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async-registry/inject-latency-probe.ts
2302
+ * @since 0.1.0
2303
+ * @relatedTo provideAsyncRegistry, injectAsyncRegistry, createLatencyProbe
2304
+ */
2305
+ function injectLatencyProbe() {
2306
+ const registry = injectAsyncRegistry();
2307
+ return createLatencyProbe(() => registry?.isAnythingLoading() ?? false);
2308
+ }
2309
+
2148
2310
  /**
2149
2311
  * Per-request label surfaced in `CngxAsyncRegistry.activeOperations` when the
2150
2312
  * request is tracked by `cngxAsyncInterceptor`. Display only, never a key.
@@ -2465,7 +2627,7 @@ class CngxMetric {
2465
2627
  @if (unit()) {
2466
2628
  <span class="cngx-metric__unit">{{ unit() }}</span>
2467
2629
  }
2468
- `, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-metric-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-metric-value-size{syntax: \"*\"; inherits: true; initial-value: 1.75rem;}@property --cngx-metric-value-weight{syntax: \"<number>\"; inherits: true; initial-value: 600;}@property --cngx-metric-value-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 290);}@property --cngx-metric-unit-size{syntax: \"*\"; inherits: true; initial-value: .875rem;}@property --cngx-metric-unit-weight{syntax: \"<number>\"; inherits: true; initial-value: 400;}@property --cngx-metric-unit-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-metric-value-color: oklch(.95 .01 290);--cngx-metric-unit-color: oklch(.7 .01 290)}}[data-color-scheme=dark],.dark{--cngx-metric-value-color: oklch(.95 .01 290);--cngx-metric-unit-color: oklch(.7 .01 290)}[data-color-scheme=light],.light{--cngx-metric-value-color: oklch(.2 .01 290);--cngx-metric-unit-color: oklch(.36 .02 290)}}@layer cngx.components{@scope(.cngx-metric){:scope{--cngx-metric-gap: var(--cngx-space-xs);display:inline-flex;align-items:baseline;gap:var(--cngx-metric-gap, 2px)}.cngx-metric__value{font-size:var(--cngx-metric-value-size, 1.75rem);font-weight:var(--cngx-metric-value-weight, 600);color:var(--cngx-metric-value-color, var(--cngx-color-text, oklch(.2 .01 290)));line-height:1.2}.cngx-metric__unit{font-size:var(--cngx-metric-unit-size, .875rem);font-weight:var(--cngx-metric-unit-weight, 400);color:var(--cngx-metric-unit-color, oklch(.36 .02 290))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2630
+ `, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-metric-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-metric-value-size{syntax: \"*\"; inherits: true; initial-value: 1.75rem;}@property --cngx-metric-value-weight{syntax: \"<number>\"; inherits: true; initial-value: 600;}@property --cngx-metric-value-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 290);}@property --cngx-metric-unit-size{syntax: \"*\"; inherits: true; initial-value: .875rem;}@property --cngx-metric-unit-weight{syntax: \"<number>\"; inherits: true; initial-value: 400;}@property --cngx-metric-unit-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-metric-value-color: oklch(.95 .01 290);--cngx-metric-unit-color: oklch(.7 .01 290)}}[data-color-scheme=dark],.dark{--cngx-metric-value-color: oklch(.95 .01 290);--cngx-metric-unit-color: oklch(.7 .01 290)}[data-color-scheme=light],.light{--cngx-metric-value-color: oklch(.2 .01 290);--cngx-metric-unit-color: oklch(.36 .02 290)}}@layer cngx.components{@scope(.cngx-metric){:scope{--cngx-metric-gap: var(--cngx-space-xs);display:inline-flex;align-items:baseline;gap:var(--cngx-metric-gap, 2px)}.cngx-metric__value{font-size:var(--cngx-metric-value-size, 1.75rem);font-weight:var(--cngx-metric-value-weight, 600);color:var(--cngx-metric-value-color, var(--cngx-color-text, oklch(.2 .01 290)));line-height:1.2;unicode-bidi:var(--cngx-metric-bidi, isolate)}.cngx-metric__unit{font-size:var(--cngx-metric-unit-size, .875rem);font-weight:var(--cngx-metric-unit-weight, 400);color:var(--cngx-metric-unit-color, oklch(.36 .02 290))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2469
2631
  }
2470
2632
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMetric, decorators: [{
2471
2633
  type: Component,
@@ -2482,7 +2644,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
2482
2644
  @if (unit()) {
2483
2645
  <span class="cngx-metric__unit">{{ unit() }}</span>
2484
2646
  }
2485
- `, styles: ["@layer cngx.tokens{@property --cngx-metric-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-metric-value-size{syntax: \"*\"; inherits: true; initial-value: 1.75rem;}@property --cngx-metric-value-weight{syntax: \"<number>\"; inherits: true; initial-value: 600;}@property --cngx-metric-value-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 290);}@property --cngx-metric-unit-size{syntax: \"*\"; inherits: true; initial-value: .875rem;}@property --cngx-metric-unit-weight{syntax: \"<number>\"; inherits: true; initial-value: 400;}@property --cngx-metric-unit-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-metric-value-color: oklch(.95 .01 290);--cngx-metric-unit-color: oklch(.7 .01 290)}}[data-color-scheme=dark],.dark{--cngx-metric-value-color: oklch(.95 .01 290);--cngx-metric-unit-color: oklch(.7 .01 290)}[data-color-scheme=light],.light{--cngx-metric-value-color: oklch(.2 .01 290);--cngx-metric-unit-color: oklch(.36 .02 290)}}@layer cngx.components{@scope(.cngx-metric){:scope{--cngx-metric-gap: var(--cngx-space-xs);display:inline-flex;align-items:baseline;gap:var(--cngx-metric-gap, 2px)}.cngx-metric__value{font-size:var(--cngx-metric-value-size, 1.75rem);font-weight:var(--cngx-metric-value-weight, 600);color:var(--cngx-metric-value-color, var(--cngx-color-text, oklch(.2 .01 290)));line-height:1.2}.cngx-metric__unit{font-size:var(--cngx-metric-unit-size, .875rem);font-weight:var(--cngx-metric-unit-weight, 400);color:var(--cngx-metric-unit-color, oklch(.36 .02 290))}}}\n"] }]
2647
+ `, styles: ["@layer cngx.tokens{@property --cngx-metric-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-metric-value-size{syntax: \"*\"; inherits: true; initial-value: 1.75rem;}@property --cngx-metric-value-weight{syntax: \"<number>\"; inherits: true; initial-value: 600;}@property --cngx-metric-value-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 290);}@property --cngx-metric-unit-size{syntax: \"*\"; inherits: true; initial-value: .875rem;}@property --cngx-metric-unit-weight{syntax: \"<number>\"; inherits: true; initial-value: 400;}@property --cngx-metric-unit-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-metric-value-color: oklch(.95 .01 290);--cngx-metric-unit-color: oklch(.7 .01 290)}}[data-color-scheme=dark],.dark{--cngx-metric-value-color: oklch(.95 .01 290);--cngx-metric-unit-color: oklch(.7 .01 290)}[data-color-scheme=light],.light{--cngx-metric-value-color: oklch(.2 .01 290);--cngx-metric-unit-color: oklch(.36 .02 290)}}@layer cngx.components{@scope(.cngx-metric){:scope{--cngx-metric-gap: var(--cngx-space-xs);display:inline-flex;align-items:baseline;gap:var(--cngx-metric-gap, 2px)}.cngx-metric__value{font-size:var(--cngx-metric-value-size, 1.75rem);font-weight:var(--cngx-metric-value-weight, 600);color:var(--cngx-metric-value-color, var(--cngx-color-text, oklch(.2 .01 290)));line-height:1.2;unicode-bidi:var(--cngx-metric-bidi, isolate)}.cngx-metric__unit{font-size:var(--cngx-metric-unit-size, .875rem);font-weight:var(--cngx-metric-unit-weight, 400);color:var(--cngx-metric-unit-color, oklch(.36 .02 290))}}}\n"] }]
2486
2648
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], unit: [{ type: i0.Input, args: [{ isSignal: true, alias: "unit", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }] } });
2487
2649
 
2488
2650
  /**
@@ -2597,7 +2759,7 @@ class CngxTrend {
2597
2759
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxTrend, isStandalone: true, selector: "cngx-trend", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "class.cngx-trend--up": "value() > 0", "class.cngx-trend--down": "value() < 0", "attr.aria-label": "resolvedLabel()" }, classAttribute: "cngx-trend" }, ngImport: i0, template: `
2598
2760
  <span aria-hidden="true">{{ icon() }}</span>
2599
2761
  {{ formattedValue() }}
2600
- `, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-trend-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-trend-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-trend-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-trend-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-trend-up-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-trend-down-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-trend-color: oklch(.7 .01 290);--cngx-trend-up-color: oklch(.78 .16 145);--cngx-trend-down-color: oklch(.75 .18 25)}}[data-color-scheme=dark],.dark{--cngx-trend-color: oklch(.7 .01 290);--cngx-trend-up-color: oklch(.78 .16 145);--cngx-trend-down-color: oklch(.75 .18 25)}[data-color-scheme=light],.light{--cngx-trend-color: oklch(.36 .02 290);--cngx-trend-up-color: oklch(.65 .18 145);--cngx-trend-down-color: oklch(.65 .22 25)}}@layer cngx.components{@scope(.cngx-trend){:scope{--cngx-trend-gap: var(--cngx-space-xs);display:inline-flex;align-items:center;gap:var(--cngx-trend-gap, 2px);font-size:var(--cngx-trend-size, .8125rem);font-weight:var(--cngx-trend-weight, 500);color:var(--cngx-trend-color, oklch(.36 .02 290))}:scope.cngx-trend--up{color:var(--cngx-trend-up-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-trend--down{color:var(--cngx-trend-down-color, var(--cngx-color-danger, oklch(.65 .22 25)))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2762
+ `, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-trend-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-trend-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-trend-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-trend-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-trend-up-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-trend-down-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-trend-color: oklch(.7 .01 290);--cngx-trend-up-color: oklch(.78 .16 145);--cngx-trend-down-color: oklch(.75 .18 25)}}[data-color-scheme=dark],.dark{--cngx-trend-color: oklch(.7 .01 290);--cngx-trend-up-color: oklch(.78 .16 145);--cngx-trend-down-color: oklch(.75 .18 25)}[data-color-scheme=light],.light{--cngx-trend-color: oklch(.36 .02 290);--cngx-trend-up-color: oklch(.65 .18 145);--cngx-trend-down-color: oklch(.65 .22 25)}}@layer cngx.components{@scope(.cngx-trend){:scope{--cngx-trend-gap: var(--cngx-space-xs);display:inline-flex;align-items:center;gap:var(--cngx-trend-gap, 2px);font-size:var(--cngx-trend-size, .8125rem);font-weight:var(--cngx-trend-weight, 500);color:var(--cngx-trend-color, oklch(.36 .02 290));unicode-bidi:var(--cngx-trend-bidi, isolate);direction:var(--cngx-trend-direction, ltr)}:scope.cngx-trend--up{color:var(--cngx-trend-up-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-trend--down{color:var(--cngx-trend-down-color, var(--cngx-color-danger, oklch(.65 .22 25)))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2601
2763
  }
2602
2764
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTrend, decorators: [{
2603
2765
  type: Component,
@@ -2613,7 +2775,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
2613
2775
  }, template: `
2614
2776
  <span aria-hidden="true">{{ icon() }}</span>
2615
2777
  {{ formattedValue() }}
2616
- `, styles: ["@layer cngx.tokens{@property --cngx-trend-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-trend-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-trend-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-trend-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-trend-up-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-trend-down-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-trend-color: oklch(.7 .01 290);--cngx-trend-up-color: oklch(.78 .16 145);--cngx-trend-down-color: oklch(.75 .18 25)}}[data-color-scheme=dark],.dark{--cngx-trend-color: oklch(.7 .01 290);--cngx-trend-up-color: oklch(.78 .16 145);--cngx-trend-down-color: oklch(.75 .18 25)}[data-color-scheme=light],.light{--cngx-trend-color: oklch(.36 .02 290);--cngx-trend-up-color: oklch(.65 .18 145);--cngx-trend-down-color: oklch(.65 .22 25)}}@layer cngx.components{@scope(.cngx-trend){:scope{--cngx-trend-gap: var(--cngx-space-xs);display:inline-flex;align-items:center;gap:var(--cngx-trend-gap, 2px);font-size:var(--cngx-trend-size, .8125rem);font-weight:var(--cngx-trend-weight, 500);color:var(--cngx-trend-color, oklch(.36 .02 290))}:scope.cngx-trend--up{color:var(--cngx-trend-up-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-trend--down{color:var(--cngx-trend-down-color, var(--cngx-color-danger, oklch(.65 .22 25)))}}}\n"] }]
2778
+ `, styles: ["@layer cngx.tokens{@property --cngx-trend-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-trend-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-trend-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-trend-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-trend-up-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-trend-down-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-trend-color: oklch(.7 .01 290);--cngx-trend-up-color: oklch(.78 .16 145);--cngx-trend-down-color: oklch(.75 .18 25)}}[data-color-scheme=dark],.dark{--cngx-trend-color: oklch(.7 .01 290);--cngx-trend-up-color: oklch(.78 .16 145);--cngx-trend-down-color: oklch(.75 .18 25)}[data-color-scheme=light],.light{--cngx-trend-color: oklch(.36 .02 290);--cngx-trend-up-color: oklch(.65 .18 145);--cngx-trend-down-color: oklch(.65 .22 25)}}@layer cngx.components{@scope(.cngx-trend){:scope{--cngx-trend-gap: var(--cngx-space-xs);display:inline-flex;align-items:center;gap:var(--cngx-trend-gap, 2px);font-size:var(--cngx-trend-size, .8125rem);font-weight:var(--cngx-trend-weight, 500);color:var(--cngx-trend-color, oklch(.36 .02 290));unicode-bidi:var(--cngx-trend-bidi, isolate);direction:var(--cngx-trend-direction, ltr)}:scope.cngx-trend--up{color:var(--cngx-trend-up-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-trend--down{color:var(--cngx-trend-down-color, var(--cngx-color-danger, oklch(.65 .22 25)))}}}\n"] }]
2617
2779
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }] } });
2618
2780
 
2619
2781
  const SENTIMENT_WORD = {
@@ -2694,7 +2856,7 @@ class CngxDelta {
2694
2856
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxDelta, isStandalone: true, selector: "cngx-delta", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, polarity: { classPropertyName: "polarity", publicName: "polarity", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "class.cngx-delta--positive": "sentiment() === 'positive'", "class.cngx-delta--negative": "sentiment() === 'negative'", "class.cngx-delta--neutral": "sentiment() === 'neutral'", "attr.aria-label": "resolvedLabel()" }, classAttribute: "cngx-delta" }, ngImport: i0, template: `
2695
2857
  <span aria-hidden="true">{{ glyph() }}</span>
2696
2858
  {{ formattedValue() }}
2697
- `, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-delta-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-delta-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-delta-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-delta-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-delta-positive-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-delta-negative-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-delta-neutral-color: oklch(.7 .01 290);--cngx-delta-positive-color: oklch(.78 .16 145);--cngx-delta-negative-color: oklch(.75 .18 25)}}[data-color-scheme=dark],.dark{--cngx-delta-neutral-color: oklch(.7 .01 290);--cngx-delta-positive-color: oklch(.78 .16 145);--cngx-delta-negative-color: oklch(.75 .18 25)}[data-color-scheme=light],.light{--cngx-delta-neutral-color: oklch(.36 .02 290);--cngx-delta-positive-color: oklch(.65 .18 145);--cngx-delta-negative-color: oklch(.65 .22 25)}}@layer cngx.components{@scope(.cngx-delta){:scope{--cngx-delta-gap: var(--cngx-space-xs);display:inline-flex;align-items:center;gap:var(--cngx-delta-gap, 2px);font-size:var(--cngx-delta-size, .8125rem);font-weight:var(--cngx-delta-weight, 500);color:var(--cngx-delta-neutral-color, oklch(.36 .02 290))}:scope.cngx-delta--positive{color:var(--cngx-delta-positive-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-delta--negative{color:var(--cngx-delta-negative-color, var(--cngx-color-danger, oklch(.65 .22 25)))}:scope.cngx-delta--neutral{color:var(--cngx-delta-neutral-color, oklch(.36 .02 290))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2859
+ `, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-delta-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-delta-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-delta-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-delta-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-delta-positive-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-delta-negative-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-delta-neutral-color: oklch(.7 .01 290);--cngx-delta-positive-color: oklch(.78 .16 145);--cngx-delta-negative-color: oklch(.75 .18 25)}}[data-color-scheme=dark],.dark{--cngx-delta-neutral-color: oklch(.7 .01 290);--cngx-delta-positive-color: oklch(.78 .16 145);--cngx-delta-negative-color: oklch(.75 .18 25)}[data-color-scheme=light],.light{--cngx-delta-neutral-color: oklch(.36 .02 290);--cngx-delta-positive-color: oklch(.65 .18 145);--cngx-delta-negative-color: oklch(.65 .22 25)}}@layer cngx.components{@scope(.cngx-delta){:scope{--cngx-delta-gap: var(--cngx-space-xs);display:inline-flex;align-items:center;gap:var(--cngx-delta-gap, 2px);font-size:var(--cngx-delta-size, .8125rem);font-weight:var(--cngx-delta-weight, 500);color:var(--cngx-delta-neutral-color, oklch(.36 .02 290));unicode-bidi:var(--cngx-delta-bidi, isolate);direction:var(--cngx-delta-direction, ltr)}:scope.cngx-delta--positive{color:var(--cngx-delta-positive-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-delta--negative{color:var(--cngx-delta-negative-color, var(--cngx-color-danger, oklch(.65 .22 25)))}:scope.cngx-delta--neutral{color:var(--cngx-delta-neutral-color, oklch(.36 .02 290))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2698
2860
  }
2699
2861
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDelta, decorators: [{
2700
2862
  type: Component,
@@ -2712,16 +2874,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
2712
2874
  }, template: `
2713
2875
  <span aria-hidden="true">{{ glyph() }}</span>
2714
2876
  {{ formattedValue() }}
2715
- `, styles: ["@layer cngx.tokens{@property --cngx-delta-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-delta-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-delta-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-delta-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-delta-positive-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-delta-negative-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-delta-neutral-color: oklch(.7 .01 290);--cngx-delta-positive-color: oklch(.78 .16 145);--cngx-delta-negative-color: oklch(.75 .18 25)}}[data-color-scheme=dark],.dark{--cngx-delta-neutral-color: oklch(.7 .01 290);--cngx-delta-positive-color: oklch(.78 .16 145);--cngx-delta-negative-color: oklch(.75 .18 25)}[data-color-scheme=light],.light{--cngx-delta-neutral-color: oklch(.36 .02 290);--cngx-delta-positive-color: oklch(.65 .18 145);--cngx-delta-negative-color: oklch(.65 .22 25)}}@layer cngx.components{@scope(.cngx-delta){:scope{--cngx-delta-gap: var(--cngx-space-xs);display:inline-flex;align-items:center;gap:var(--cngx-delta-gap, 2px);font-size:var(--cngx-delta-size, .8125rem);font-weight:var(--cngx-delta-weight, 500);color:var(--cngx-delta-neutral-color, oklch(.36 .02 290))}:scope.cngx-delta--positive{color:var(--cngx-delta-positive-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-delta--negative{color:var(--cngx-delta-negative-color, var(--cngx-color-danger, oklch(.65 .22 25)))}:scope.cngx-delta--neutral{color:var(--cngx-delta-neutral-color, oklch(.36 .02 290))}}}\n"] }]
2877
+ `, styles: ["@layer cngx.tokens{@property --cngx-delta-gap{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-delta-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-delta-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-delta-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.36 .02 290);}@property --cngx-delta-positive-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-delta-negative-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-delta-neutral-color: oklch(.7 .01 290);--cngx-delta-positive-color: oklch(.78 .16 145);--cngx-delta-negative-color: oklch(.75 .18 25)}}[data-color-scheme=dark],.dark{--cngx-delta-neutral-color: oklch(.7 .01 290);--cngx-delta-positive-color: oklch(.78 .16 145);--cngx-delta-negative-color: oklch(.75 .18 25)}[data-color-scheme=light],.light{--cngx-delta-neutral-color: oklch(.36 .02 290);--cngx-delta-positive-color: oklch(.65 .18 145);--cngx-delta-negative-color: oklch(.65 .22 25)}}@layer cngx.components{@scope(.cngx-delta){:scope{--cngx-delta-gap: var(--cngx-space-xs);display:inline-flex;align-items:center;gap:var(--cngx-delta-gap, 2px);font-size:var(--cngx-delta-size, .8125rem);font-weight:var(--cngx-delta-weight, 500);color:var(--cngx-delta-neutral-color, oklch(.36 .02 290));unicode-bidi:var(--cngx-delta-bidi, isolate);direction:var(--cngx-delta-direction, ltr)}:scope.cngx-delta--positive{color:var(--cngx-delta-positive-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-delta--negative{color:var(--cngx-delta-negative-color, var(--cngx-color-danger, oklch(.65 .22 25)))}:scope.cngx-delta--neutral{color:var(--cngx-delta-neutral-color, oklch(.36 .02 290))}}}\n"] }]
2716
2878
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], polarity: [{ type: i0.Input, args: [{ isSignal: true, alias: "polarity", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }] } });
2717
2879
 
2718
- /** DI token carrying the {@link CngxStatRegistry} a `CngxStat` provides. */
2719
- const CNGX_STAT = new InjectionToken('CNGX_STAT');
2720
-
2721
2880
  /** Fixed reading order for the coordinated slots. */
2722
2881
  const SLOT_ORDER = ['label', 'value', 'delta', 'caption'];
2723
2882
  /** Structural equality so an unchanged id set never cascades `labelledBy`. */
2724
2883
  const idsEqual = (a, b) => a.length === b.length && a.every((id, i) => id === b[i]);
2884
+ /** Structural equality so an unchanged slot set never cascades to a placeholder. */
2885
+ const kindsEqual = (a, b) => a.length === b.length && a.every((kind, i) => kind === b[i]);
2886
+ /**
2887
+ * The slot-id coordination brain behind {@link CNGX_STAT}. Collects the id each
2888
+ * `cngxStat*` slot registers and derives one `aria-labelledby` that reads the
2889
+ * whole stat as a single accessible name in reading order.
2890
+ *
2891
+ * Lives as a host directive rather than inside `CngxStat` because the slot
2892
+ * directives resolve `CNGX_STAT` against their **declaration** site: content
2893
+ * written inside an organism never reaches a `<cngx-stat>` that sits in that
2894
+ * organism's own template. Any component that wants to host the four slots
2895
+ * therefore applies this brain and re-points the token at it:
2896
+ *
2897
+ * ```ts
2898
+ * hostDirectives: [CngxStatCoordinator],
2899
+ * providers: [{ provide: CNGX_STAT, useExisting: CngxStatCoordinator }],
2900
+ * ```
2901
+ *
2902
+ * Same shape as `CngxPaginate` behind `CNGX_PAGINATOR_HOST`, which
2903
+ * `CngxPaginator` and `CngxIncrementalList` share the same way.
2904
+ *
2905
+ * @category common/data/metric
2906
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/stat/stat-coordinator.directive.ts
2907
+ * @since 0.1.0
2908
+ * @relatedTo CngxStat, CNGX_STAT
2909
+ */
2910
+ class CngxStatCoordinator {
2911
+ slots = signal(new Map(), ...(ngDevMode ? [{ debugName: "slots" }] : /* istanbul ignore next */ []));
2912
+ /** {@inheritDoc CngxStatRegistry.register} */
2913
+ register(kind, id) {
2914
+ this.slots.update((prev) => new Map(prev).set(kind, id));
2915
+ }
2916
+ /** {@inheritDoc CngxStatRegistry.unregister} */
2917
+ unregister(kind) {
2918
+ this.slots.update((prev) => {
2919
+ const next = new Map(prev);
2920
+ next.delete(kind);
2921
+ return next;
2922
+ });
2923
+ }
2924
+ /** Present slot ids in reading order; structurally stable. */
2925
+ orderedIds = computed(() => {
2926
+ const map = this.slots();
2927
+ return SLOT_ORDER.map((kind) => map.get(kind)).filter((id) => id !== undefined);
2928
+ }, { ...(ngDevMode ? { debugName: "orderedIds" } : /* istanbul ignore next */ {}), equal: idsEqual });
2929
+ /** Combined accessible name for the host; `null` when no slot is present. */
2930
+ labelledBy = computed(() => this.orderedIds().join(' ') || null, ...(ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []));
2931
+ /**
2932
+ * Which slots a consumer actually projected, in reading order. Registration
2933
+ * happens when the slot directive is constructed in the consumer's template,
2934
+ * so this stays accurate even while the host renders a branch that does not
2935
+ * include the `<ng-content>` outlets - which is what lets a placeholder mirror
2936
+ * the real tile instead of guessing at it.
2937
+ */
2938
+ presentKinds = computed(() => {
2939
+ const map = this.slots();
2940
+ return SLOT_ORDER.filter((kind) => map.has(kind));
2941
+ }, { ...(ngDevMode ? { debugName: "presentKinds" } : /* istanbul ignore next */ {}), equal: kindsEqual });
2942
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatCoordinator, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2943
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: CngxStatCoordinator, isStandalone: true, ngImport: i0 });
2944
+ }
2945
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatCoordinator, decorators: [{
2946
+ type: Directive,
2947
+ args: [{
2948
+ standalone: true,
2949
+ }]
2950
+ }] });
2951
+
2952
+ /** DI token carrying the {@link CngxStatRegistry} a `CngxStat` provides. */
2953
+ const CNGX_STAT = new InjectionToken('CNGX_STAT');
2954
+
2725
2955
  /**
2726
2956
  * Coordination molecule for a KPI stat. Its sole reason to exist is the
2727
2957
  * screen-reader layer (Pillar 2): hand-assembling a heading, a `<cngx-metric>`
@@ -2730,9 +2960,10 @@ const idsEqual = (a, b) => a.length === b.length && a.every((id, i) => id === b[
2730
2960
  * collects the id each slot registers, and derives one `aria-labelledby` that
2731
2961
  * reads the whole stat as a single accessible name in reading order.
2732
2962
  *
2733
- * Composition, never a config bag (Pillar 3): the molecule owns only the id
2734
- * coordination `computed()` graph; the visuals are whatever atoms the
2735
- * consumer projects into the slots.
2963
+ * Composition, never a config bag (Pillar 3): the id coordination lives in the
2964
+ * {@link CngxStatCoordinator} host directive, so another component that hosts
2965
+ * the same four slots applies the identical brain instead of reimplementing it.
2966
+ * The visuals stay whatever atoms the consumer projects into the slots.
2736
2967
  *
2737
2968
  * ```html
2738
2969
  * <cngx-stat aria-live="polite">
@@ -2748,38 +2979,20 @@ const idsEqual = (a, b) => a.length === b.length && a.every((id, i) => id === b[
2748
2979
  * @wcag AA
2749
2980
  * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/stat/stat.component.ts
2750
2981
  * @since 0.1.0
2751
- * @relatedTo CngxMetric, CngxDelta, CngxTrend
2982
+ * @relatedTo CngxMetric, CngxDelta, CngxTrend, CngxStatCoordinator
2752
2983
  *
2753
2984
  * <example-url>http://localhost:4200/#/common/data/stat/composed-kpi</example-url>
2754
2985
  */
2755
2986
  class CngxStat {
2756
- slots = signal(new Map(), ...(ngDevMode ? [{ debugName: "slots" }] : /* istanbul ignore next */ []));
2987
+ /** @internal The shared slot-id brain, applied as a host directive. */
2988
+ coordinator = inject(CngxStatCoordinator, { host: true });
2757
2989
  /**
2758
2990
  * Politeness of the live region. `off` (default) for a static stat;
2759
2991
  * `polite` / `assertive` for a KPI whose value updates in place.
2760
2992
  */
2761
2993
  live = input('off', ...(ngDevMode ? [{ debugName: "live" }] : /* istanbul ignore next */ []));
2762
- /** {@inheritDoc CngxStatRegistry.register} */
2763
- register(kind, id) {
2764
- this.slots.update((prev) => new Map(prev).set(kind, id));
2765
- }
2766
- /** {@inheritDoc CngxStatRegistry.unregister} */
2767
- unregister(kind) {
2768
- this.slots.update((prev) => {
2769
- const next = new Map(prev);
2770
- next.delete(kind);
2771
- return next;
2772
- });
2773
- }
2774
- /** @internal Present slot ids in reading order; structurally stable. */
2775
- orderedIds = computed(() => {
2776
- const map = this.slots();
2777
- return SLOT_ORDER.map((kind) => map.get(kind)).filter((id) => id !== undefined);
2778
- }, { ...(ngDevMode ? { debugName: "orderedIds" } : /* istanbul ignore next */ {}), equal: idsEqual });
2779
- /** @internal Combined accessible name; `null` when no slot is present. */
2780
- labelledBy = computed(() => this.orderedIds().join(' ') || null, ...(ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []));
2781
2994
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStat, deps: [], target: i0.ɵɵFactoryTarget.Component });
2782
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxStat, isStandalone: true, selector: "cngx-stat", inputs: { live: { classPropertyName: "live", publicName: "live", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.aria-labelledby": "labelledBy()", "attr.aria-live": "live()" }, classAttribute: "cngx-stat" }, providers: [{ provide: CNGX_STAT, useExisting: CngxStat }], ngImport: i0, template: `
2995
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxStat, isStandalone: true, selector: "cngx-stat", inputs: { live: { classPropertyName: "live", publicName: "live", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.aria-labelledby": "coordinator.labelledBy()", "attr.aria-live": "live()" }, classAttribute: "cngx-stat" }, providers: [{ provide: CNGX_STAT, useExisting: CngxStatCoordinator }], hostDirectives: [{ directive: CngxStatCoordinator }], ngImport: i0, template: `
2783
2996
  <ng-content select="[cngxStatLabel]" />
2784
2997
  <div class="cngx-stat__row">
2785
2998
  <ng-content select="[cngxStatValue]" />
@@ -2790,10 +3003,10 @@ class CngxStat {
2790
3003
  }
2791
3004
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStat, decorators: [{
2792
3005
  type: Component,
2793
- args: [{ selector: 'cngx-stat', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_STAT, useExisting: CngxStat }], host: {
3006
+ args: [{ selector: 'cngx-stat', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, hostDirectives: [CngxStatCoordinator], providers: [{ provide: CNGX_STAT, useExisting: CngxStatCoordinator }], host: {
2794
3007
  class: 'cngx-stat',
2795
3008
  role: 'group',
2796
- '[attr.aria-labelledby]': 'labelledBy()',
3009
+ '[attr.aria-labelledby]': 'coordinator.labelledBy()',
2797
3010
  '[attr.aria-live]': 'live()',
2798
3011
  }, template: `
2799
3012
  <ng-content select="[cngxStatLabel]" />
@@ -2906,95 +3119,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
2906
3119
  }]
2907
3120
  }] });
2908
3121
 
2909
- /** Tone glyph rendered inside the decorative dot - the non-colour signal. */
2910
- const TONE_GLYPH = {
2911
- success: '✓',
2912
- warning: '!',
2913
- danger: '✕',
2914
- info: 'i',
2915
- neutral: '•',
2916
- };
2917
- /**
2918
- * Semantic health indicator - a decorative tone dot paired with a visible
2919
- * label. Distinct from `CngxBadge` (count overlay), `CngxChip` (interactive)
2920
- * and `CngxTag` (labeled token): its single job is to communicate a status
2921
- * (operational / degraded / down / info).
2922
- *
2923
- * Colour is never the only signal (Pillar 2): the tone drives the dot colour
2924
- * *and* a tone glyph, so a colour-blind reader still distinguishes the states,
2925
- * and the visible `label` carries the meaning for assistive tech (the dot is
2926
- * `aria-hidden`). Set `live` for a status that changes in place.
2927
- *
2928
- * ### Basic
2929
- * ```html
2930
- * <cngx-status tone="success" label="Operational" />
2931
- * ```
2932
- *
2933
- * ### Live-updating
2934
- * ```html
2935
- * <cngx-status tone="danger" label="Outage" live="assertive" />
2936
- * ```
2937
- *
2938
- * @category common/data/metric
2939
- * @docsKind primary
2940
- * @wcag AA
2941
- * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/status/status.component.ts
2942
- * @since 0.1.0
2943
- * @relatedTo CngxBadge, CngxTag, CngxChip
2944
- *
2945
- * <example-url>http://localhost:4200/#/common/data/status/tone-matrix</example-url>
2946
- */
2947
- class CngxStatus {
2948
- elRef = inject((ElementRef));
2949
- /** Semantic health. Drives both the dot colour and the tone glyph. */
2950
- tone = input('neutral', ...(ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []));
2951
- /** Visible status text. Carries the meaning for assistive tech. */
2952
- label = input(undefined, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
2953
- /**
2954
- * Politeness of the live region. `off` (default) for a static status;
2955
- * `polite` / `assertive` for a status that changes in place.
2956
- */
2957
- live = input('off', ...(ngDevMode ? [{ debugName: "live" }] : /* istanbul ignore next */ []));
2958
- /** @internal Tone glyph bound into the decorative dot. */
2959
- glyph = computed(() => TONE_GLYPH[this.tone()], ...(ngDevMode ? [{ debugName: "glyph" }] : /* istanbul ignore next */ []));
2960
- constructor() {
2961
- if (isDevMode()) {
2962
- afterNextRender(() => {
2963
- const el = this.elRef.nativeElement;
2964
- if (!this.label() && !el.getAttribute('aria-label') && !el.getAttribute('aria-labelledby')) {
2965
- console.warn('cngx-status: no `label` and no external `aria-label`/`aria-labelledby`; ' +
2966
- 'the status has no accessible name and reads only as a coloured dot. ' +
2967
- 'Set [label] or an aria-label on the host.');
2968
- }
2969
- });
2970
- }
2971
- }
2972
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatus, deps: [], target: i0.ɵɵFactoryTarget.Component });
2973
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxStatus, isStandalone: true, selector: "cngx-status", inputs: { tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, live: { classPropertyName: "live", publicName: "live", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-status--success": "tone() === 'success'", "class.cngx-status--warning": "tone() === 'warning'", "class.cngx-status--danger": "tone() === 'danger'", "class.cngx-status--info": "tone() === 'info'", "class.cngx-status--neutral": "tone() === 'neutral'", "attr.aria-live": "live()" }, classAttribute: "cngx-status" }, ngImport: i0, template: `
2974
- <span class="cngx-status__dot" aria-hidden="true">{{ glyph() }}</span>
2975
- @if (label()) {
2976
- <span class="cngx-status__label">{{ label() }}</span>
2977
- }
2978
- `, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-status-gap{syntax: \"<length>\"; inherits: false; initial-value: 6px;}@property --cngx-status-dot-size{syntax: \"<length>\"; inherits: false; initial-value: 1rem;}@property --cngx-status-glyph-size{syntax: \"*\"; inherits: true; initial-value: .7em;}@property --cngx-status-dot-fg{syntax: \"<color>\"; inherits: true; initial-value: white;}@property --cngx-status-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-status-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-status-success-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-status-warning-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.75 .15 85);}@property --cngx-status-danger-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@property --cngx-status-info-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .14 250);}@property --cngx-status-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .02 290);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-status-success-color: oklch(.78 .16 145);--cngx-status-warning-color: oklch(.82 .13 85);--cngx-status-danger-color: oklch(.75 .18 25);--cngx-status-info-color: oklch(.72 .12 250);--cngx-status-neutral-color: oklch(.7 .02 290)}}[data-color-scheme=dark],.dark{--cngx-status-success-color: oklch(.78 .16 145);--cngx-status-warning-color: oklch(.82 .13 85);--cngx-status-danger-color: oklch(.75 .18 25);--cngx-status-info-color: oklch(.72 .12 250);--cngx-status-neutral-color: oklch(.7 .02 290)}[data-color-scheme=light],.light{--cngx-status-success-color: oklch(.65 .18 145);--cngx-status-warning-color: oklch(.75 .15 85);--cngx-status-danger-color: oklch(.65 .22 25);--cngx-status-info-color: oklch(.6 .14 250);--cngx-status-neutral-color: oklch(.6 .02 290)}}@layer cngx.components{@scope(.cngx-status){:scope{--cngx-status-gap: var(--cngx-space-sm);display:inline-flex;align-items:center;gap:var(--cngx-status-gap, 6px);font-size:var(--cngx-status-size, .8125rem);font-weight:var(--cngx-status-weight, 500)}.cngx-status__dot{display:inline-flex;align-items:center;justify-content:center;inline-size:var(--cngx-status-dot-size, 1rem);block-size:var(--cngx-status-dot-size, 1rem);border-radius:50%;font-size:var(--cngx-status-glyph-size, .7em);line-height:1;color:var(--cngx-status-dot-fg, white);background:var(--cngx-status-neutral-color, oklch(.6 .02 290))}:scope.cngx-status--success .cngx-status__dot{background:var(--cngx-status-success-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-status--warning .cngx-status__dot{background:var(--cngx-status-warning-color, oklch(.75 .15 85))}:scope.cngx-status--danger .cngx-status__dot{background:var(--cngx-status-danger-color, var(--cngx-color-danger, oklch(.65 .22 25)))}:scope.cngx-status--info .cngx-status__dot{background:var(--cngx-status-info-color, oklch(.6 .14 250))}:scope.cngx-status--neutral .cngx-status__dot{background:var(--cngx-status-neutral-color, oklch(.6 .02 290))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2979
- }
2980
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatus, decorators: [{
2981
- type: Component,
2982
- args: [{ selector: 'cngx-status', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
2983
- class: 'cngx-status',
2984
- '[class.cngx-status--success]': "tone() === 'success'",
2985
- '[class.cngx-status--warning]': "tone() === 'warning'",
2986
- '[class.cngx-status--danger]': "tone() === 'danger'",
2987
- '[class.cngx-status--info]': "tone() === 'info'",
2988
- '[class.cngx-status--neutral]': "tone() === 'neutral'",
2989
- '[attr.aria-live]': 'live()',
2990
- }, template: `
2991
- <span class="cngx-status__dot" aria-hidden="true">{{ glyph() }}</span>
2992
- @if (label()) {
2993
- <span class="cngx-status__label">{{ label() }}</span>
2994
- }
2995
- `, styles: ["@layer cngx.tokens{@property --cngx-status-gap{syntax: \"<length>\"; inherits: false; initial-value: 6px;}@property --cngx-status-dot-size{syntax: \"<length>\"; inherits: false; initial-value: 1rem;}@property --cngx-status-glyph-size{syntax: \"*\"; inherits: true; initial-value: .7em;}@property --cngx-status-dot-fg{syntax: \"<color>\"; inherits: true; initial-value: white;}@property --cngx-status-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-status-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-status-success-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-status-warning-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.75 .15 85);}@property --cngx-status-danger-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@property --cngx-status-info-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .14 250);}@property --cngx-status-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .02 290);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-status-success-color: oklch(.78 .16 145);--cngx-status-warning-color: oklch(.82 .13 85);--cngx-status-danger-color: oklch(.75 .18 25);--cngx-status-info-color: oklch(.72 .12 250);--cngx-status-neutral-color: oklch(.7 .02 290)}}[data-color-scheme=dark],.dark{--cngx-status-success-color: oklch(.78 .16 145);--cngx-status-warning-color: oklch(.82 .13 85);--cngx-status-danger-color: oklch(.75 .18 25);--cngx-status-info-color: oklch(.72 .12 250);--cngx-status-neutral-color: oklch(.7 .02 290)}[data-color-scheme=light],.light{--cngx-status-success-color: oklch(.65 .18 145);--cngx-status-warning-color: oklch(.75 .15 85);--cngx-status-danger-color: oklch(.65 .22 25);--cngx-status-info-color: oklch(.6 .14 250);--cngx-status-neutral-color: oklch(.6 .02 290)}}@layer cngx.components{@scope(.cngx-status){:scope{--cngx-status-gap: var(--cngx-space-sm);display:inline-flex;align-items:center;gap:var(--cngx-status-gap, 6px);font-size:var(--cngx-status-size, .8125rem);font-weight:var(--cngx-status-weight, 500)}.cngx-status__dot{display:inline-flex;align-items:center;justify-content:center;inline-size:var(--cngx-status-dot-size, 1rem);block-size:var(--cngx-status-dot-size, 1rem);border-radius:50%;font-size:var(--cngx-status-glyph-size, .7em);line-height:1;color:var(--cngx-status-dot-fg, white);background:var(--cngx-status-neutral-color, oklch(.6 .02 290))}:scope.cngx-status--success .cngx-status__dot{background:var(--cngx-status-success-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-status--warning .cngx-status__dot{background:var(--cngx-status-warning-color, oklch(.75 .15 85))}:scope.cngx-status--danger .cngx-status__dot{background:var(--cngx-status-danger-color, var(--cngx-color-danger, oklch(.65 .22 25)))}:scope.cngx-status--info .cngx-status__dot{background:var(--cngx-status-info-color, oklch(.6 .14 250))}:scope.cngx-status--neutral .cngx-status__dot{background:var(--cngx-status-neutral-color, oklch(.6 .02 290))}}}\n"] }]
2996
- }], ctorParameters: () => [], propDecorators: { tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], live: [{ type: i0.Input, args: [{ isSignal: true, alias: "live", required: false }] }] } });
2997
-
2998
3122
  /**
2999
3123
  * Determinate attainment bar - a continuous progress toward a target
3000
3124
  * (quota reached, budget spent, goal met). Named `CngxGoal` because
@@ -3048,7 +3172,7 @@ class CngxGoal {
3048
3172
  return fmt(this.now(), this.maxValue());
3049
3173
  }, ...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
3050
3174
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxGoal, deps: [], target: i0.ɵɵFactoryTarget.Component });
3051
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxGoal, isStandalone: true, selector: "cngx-goal", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, valueTextFormat: { classPropertyName: "valueTextFormat", publicName: "valueTextFormat", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "progressbar" }, properties: { "attr.aria-valuemin": "0", "attr.aria-valuemax": "maxValue()", "attr.aria-valuenow": "now()", "attr.aria-valuetext": "valueText()", "style.--cngx-goal-fill.%": "fillPercent()" }, classAttribute: "cngx-goal" }, ngImport: i0, template: `<span class="cngx-goal__track"><span class="cngx-goal__fill"></span></span>`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-goal-fill{syntax: \"<percentage>\"; inherits: true; initial-value: 0%;}@property --cngx-goal-height{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-goal-radius{syntax: \"<length>\"; inherits: false; initial-value: 999px;}@property --cngx-goal-track-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .01 290);}@property --cngx-goal-fill-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-goal-track-color: oklch(.3 .01 290);--cngx-goal-fill-color: oklch(.78 .16 145)}}[data-color-scheme=dark],.dark{--cngx-goal-track-color: oklch(.3 .01 290);--cngx-goal-fill-color: oklch(.78 .16 145)}[data-color-scheme=light],.light{--cngx-goal-track-color: oklch(.92 .01 290);--cngx-goal-fill-color: oklch(.65 .18 145)}}@layer cngx.components{@scope(.cngx-goal){:scope{display:block;inline-size:100%}.cngx-goal__track{display:block;inline-size:100%;block-size:var(--cngx-goal-height, 8px);border-radius:var(--cngx-goal-radius, 999px);background:var(--cngx-goal-track-color, oklch(.92 .01 290));overflow:hidden}.cngx-goal__fill{display:block;block-size:100%;inline-size:var(--cngx-goal-fill, 0%);border-radius:inherit;background:var(--cngx-goal-fill-color, var(--cngx-color-success, oklch(.65 .18 145)))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
3175
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxGoal, isStandalone: true, selector: "cngx-goal", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, valueTextFormat: { classPropertyName: "valueTextFormat", publicName: "valueTextFormat", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "progressbar" }, properties: { "attr.aria-valuemin": "0", "attr.aria-valuemax": "maxValue()", "attr.aria-valuenow": "now()", "attr.aria-valuetext": "valueText()", "style.--cngx-goal-fill.%": "fillPercent()" }, classAttribute: "cngx-goal" }, ngImport: i0, template: `<span class="cngx-goal__track"><span class="cngx-goal__fill"></span></span>`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-goal-fill{syntax: \"<percentage>\"; inherits: true; initial-value: 0%;}@property --cngx-goal-height{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-goal-radius{syntax: \"<length>\"; inherits: false; initial-value: 999px;}@property --cngx-goal-track-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .01 290);}@property --cngx-goal-fill-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-goal-track-color: oklch(.3 .01 290);--cngx-goal-fill-color: oklch(.78 .16 145)}}[data-color-scheme=dark],.dark{--cngx-goal-track-color: oklch(.3 .01 290);--cngx-goal-fill-color: oklch(.78 .16 145)}[data-color-scheme=light],.light{--cngx-goal-track-color: oklch(.92 .01 290);--cngx-goal-fill-color: oklch(.65 .18 145)}}@layer cngx.components{@scope(.cngx-goal){:scope{display:block;inline-size:100%}.cngx-goal__track{display:block;inline-size:100%;block-size:var(--cngx-goal-height, 8px);border-radius:var(--cngx-goal-radius, 999px);background:var(--cngx-goal-track-color, oklch(.92 .01 290));overflow:hidden}.cngx-goal__fill{display:block;block-size:100%;inline-size:var(--cngx-goal-fill, 0%);border-radius:inherit;background:var(--cngx-goal-fill-color, var(--cngx-color-success, oklch(.65 .18 145)))}}}@media(forced-colors:active){.cngx-goal__track{box-sizing:border-box;border:1px solid CanvasText}.cngx-goal__fill{background:Highlight}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
3052
3176
  }
3053
3177
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxGoal, decorators: [{
3054
3178
  type: Component,
@@ -3060,7 +3184,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3060
3184
  '[attr.aria-valuenow]': 'now()',
3061
3185
  '[attr.aria-valuetext]': 'valueText()',
3062
3186
  '[style.--cngx-goal-fill.%]': 'fillPercent()',
3063
- }, template: `<span class="cngx-goal__track"><span class="cngx-goal__fill"></span></span>`, styles: ["@layer cngx.tokens{@property --cngx-goal-fill{syntax: \"<percentage>\"; inherits: true; initial-value: 0%;}@property --cngx-goal-height{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-goal-radius{syntax: \"<length>\"; inherits: false; initial-value: 999px;}@property --cngx-goal-track-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .01 290);}@property --cngx-goal-fill-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-goal-track-color: oklch(.3 .01 290);--cngx-goal-fill-color: oklch(.78 .16 145)}}[data-color-scheme=dark],.dark{--cngx-goal-track-color: oklch(.3 .01 290);--cngx-goal-fill-color: oklch(.78 .16 145)}[data-color-scheme=light],.light{--cngx-goal-track-color: oklch(.92 .01 290);--cngx-goal-fill-color: oklch(.65 .18 145)}}@layer cngx.components{@scope(.cngx-goal){:scope{display:block;inline-size:100%}.cngx-goal__track{display:block;inline-size:100%;block-size:var(--cngx-goal-height, 8px);border-radius:var(--cngx-goal-radius, 999px);background:var(--cngx-goal-track-color, oklch(.92 .01 290));overflow:hidden}.cngx-goal__fill{display:block;block-size:100%;inline-size:var(--cngx-goal-fill, 0%);border-radius:inherit;background:var(--cngx-goal-fill-color, var(--cngx-color-success, oklch(.65 .18 145)))}}}\n"] }]
3187
+ }, template: `<span class="cngx-goal__track"><span class="cngx-goal__fill"></span></span>`, styles: ["@layer cngx.tokens{@property --cngx-goal-fill{syntax: \"<percentage>\"; inherits: true; initial-value: 0%;}@property --cngx-goal-height{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-goal-radius{syntax: \"<length>\"; inherits: false; initial-value: 999px;}@property --cngx-goal-track-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .01 290);}@property --cngx-goal-fill-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-goal-track-color: oklch(.3 .01 290);--cngx-goal-fill-color: oklch(.78 .16 145)}}[data-color-scheme=dark],.dark{--cngx-goal-track-color: oklch(.3 .01 290);--cngx-goal-fill-color: oklch(.78 .16 145)}[data-color-scheme=light],.light{--cngx-goal-track-color: oklch(.92 .01 290);--cngx-goal-fill-color: oklch(.65 .18 145)}}@layer cngx.components{@scope(.cngx-goal){:scope{display:block;inline-size:100%}.cngx-goal__track{display:block;inline-size:100%;block-size:var(--cngx-goal-height, 8px);border-radius:var(--cngx-goal-radius, 999px);background:var(--cngx-goal-track-color, oklch(.92 .01 290));overflow:hidden}.cngx-goal__fill{display:block;block-size:100%;inline-size:var(--cngx-goal-fill, 0%);border-radius:inherit;background:var(--cngx-goal-fill-color, var(--cngx-color-success, oklch(.65 .18 145)))}}}@media(forced-colors:active){.cngx-goal__track{box-sizing:border-box;border:1px solid CanvasText}.cngx-goal__fill{background:Highlight}}\n"] }]
3064
3188
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], valueTextFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueTextFormat", required: false }] }] } });
3065
3189
 
3066
3190
  const EMPTY_RANGE = {
@@ -3190,7 +3314,7 @@ function binarySearch(offsets, target, totalCount) {
3190
3314
  *
3191
3315
  * Element resolution happens **lazily inside the effect**, not at call time.
3192
3316
  * This is critical because `injectRecycler` is called in a field initializer
3193
- * where template DOM does not yet exist — `querySelector` would return `null`.
3317
+ * where template DOM does not yet exist - `querySelector` would return `null`.
3194
3318
  * The effect runs after the first CD cycle when the DOM is stable.
3195
3319
  *
3196
3320
  * @internal Not exported from `@cngx/common/data` public API.
@@ -3200,7 +3324,7 @@ function createScrollObserver(elementRef, destroyRef) {
3200
3324
  const scrollTopState = signal(0, ...(ngDevMode ? [{ debugName: "scrollTopState" }] : /* istanbul ignore next */ []));
3201
3325
  const clientHeightState = signal(0, ...(ngDevMode ? [{ debugName: "clientHeightState" }] : /* istanbul ignore next */ []));
3202
3326
  const elementState = signal(null, ...(ngDevMode ? [{ debugName: "elementState" }] : /* istanbul ignore next */ []));
3203
- // Retry trigger — incremented by afterNextRender to re-run the effect
3327
+ // Retry trigger - incremented by afterNextRender to re-run the effect
3204
3328
  // when the element wasn't found on the first attempt (routed components,
3205
3329
  // content projection, lazy rendering).
3206
3330
  const retryTick = signal(0, ...(ngDevMode ? [{ debugName: "retryTick" }] : /* istanbul ignore next */ []));
@@ -3217,7 +3341,7 @@ function createScrollObserver(elementRef, destroyRef) {
3217
3341
  }
3218
3342
  function attachListeners(el, onCleanup) {
3219
3343
  // A viewport resolved: the late-mount watcher has done its job. Disconnect
3220
- // it on attach so it can never outlive a resolved element — the node is
3344
+ // it on attach so it can never outlive a resolved element - the node is
3221
3345
  // already in the DOM, so the observer would otherwise never fire again and
3222
3346
  // leak until destroy.
3223
3347
  disconnectMutationObserver();
@@ -3258,7 +3382,7 @@ function createScrollObserver(elementRef, destroyRef) {
3258
3382
  attachListeners(el, onCleanup);
3259
3383
  });
3260
3384
  // If the element wasn't found on the first effect run (before DOM is ready),
3261
- // retry after the next render cycle. Fires for ALL input shapes — string
3385
+ // retry after the next render cycle. Fires for ALL input shapes - string
3262
3386
  // selectors resolve lazily via `querySelector`, but `ElementRef` from a
3263
3387
  // `viewChild` also starts out with `nativeElement == null` until Angular
3264
3388
  // resolves the query. `HTMLElement` inputs that are non-null at call time
@@ -3274,7 +3398,7 @@ function createScrollObserver(elementRef, destroyRef) {
3274
3398
  // next-render mount (routed component, content projection, lazy rendering).
3275
3399
  retryTick.update((v) => v + 1);
3276
3400
  // A string selector can still be unresolved because its viewport mounts
3277
- // arbitrarily late — an async-gated list, a skeleton->content swap. Watch
3401
+ // arbitrarily late - an async-gated list, a skeleton->content swap. Watch
3278
3402
  // the document and attach the instant it appears. Non-string refs
3279
3403
  // (HTMLElement / ElementRef) are not document-queryable, so the watcher
3280
3404
  // cannot help them; they stay on the single-retry path. Guard MutationObserver
@@ -3393,39 +3517,6 @@ const CNGX_RECYCLER_I18N = new InjectionToken('CngxRecyclerI18n', {
3393
3517
  function provideRecyclerI18n(i18n) {
3394
3518
  return { provide: CNGX_RECYCLER_I18N, useValue: i18n };
3395
3519
  }
3396
- /**
3397
- * Inline equivalent of `createVisibilityTimer` from `@cngx/ui/feedback` (Level 4, not importable).
3398
- *
3399
- * Uses `setTimeout` inside an effect - this is a timer-driven side effect, not derived state.
3400
- * Same pattern accepted in `createVisibilityTimer` for `CngxLoadingOverlay`.
3401
- * Safe in zoneless: the `setTimeout` callback only writes a signal, which schedules
3402
- * Angular's own change detection - no Zone.js dependency.
3403
- *
3404
- * @param source Boolean signal to delay. When `true`, starts the timer.
3405
- * @param delayMs Delay in milliseconds before the flag becomes `true`.
3406
- * @returns A readonly signal that becomes `true` after `delayMs` when `source` is `true`.
3407
- * @internal
3408
- */
3409
- function createDelayedFlag(source, delayMs) {
3410
- if (delayMs <= 0) {
3411
- return source;
3412
- }
3413
- const flag = signal(false, ...(ngDevMode ? [{ debugName: "flag" }] : /* istanbul ignore next */ []));
3414
- effect((onCleanup) => {
3415
- const active = source();
3416
- if (active) {
3417
- const timer = setTimeout(() => flag.set(true), delayMs);
3418
- onCleanup(() => {
3419
- clearTimeout(timer);
3420
- flag.set(false);
3421
- });
3422
- }
3423
- else {
3424
- flag.set(false);
3425
- }
3426
- });
3427
- return flag.asReadonly();
3428
- }
3429
3520
  /**
3430
3521
  * Creates a Signal-based virtualizer for DOM recycling.
3431
3522
  *
@@ -3556,7 +3647,7 @@ function injectRecycler(config) {
3556
3647
  const itemHeight = typeof config.estimateSize === 'number' ? config.estimateSize : config.estimateSize(0);
3557
3648
  return Math.ceil(ch / itemHeight);
3558
3649
  }, ...(ngDevMode ? [{ debugName: "skeletonSlots" }] : /* istanbul ignore next */ []));
3559
- const showSkeleton = createDelayedFlag(isLoading, config.skeletonDelay ?? 0);
3650
+ const showSkeleton = createVisibilityGate(isLoading, computed(() => config.skeletonDelay ?? 0), computed(() => 0));
3560
3651
  // previousTotal is a signal, not a mutable let - reactive, no stale-value risk.
3561
3652
  const announcementState = signal('', ...(ngDevMode ? [{ debugName: "announcementState" }] : /* istanbul ignore next */ []));
3562
3653
  const previousTotal = signal(config.totalCount(), ...(ngDevMode ? [{ debugName: "previousTotal" }] : /* istanbul ignore next */ []));
@@ -3944,7 +4035,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3944
4035
  * Must be called in an injection context (constructor or field initializer)
3945
4036
  * **on the component that hosts both the recycler's scroll container and the
3946
4037
  * `CngxRovingTabindex` directive**. The injected `ElementRef` is used to query
3947
- * `[data-cngx-recycle-index]` — calling from a child component would query the
4038
+ * `[data-cngx-recycle-index]` - calling from a child component would query the
3948
4039
  * wrong subtree.
3949
4040
  *
3950
4041
  * ```typescript
@@ -3968,7 +4059,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
3968
4059
  function connectRecyclerToRoving(recycler, roving) {
3969
4060
  const hostEl = inject(ElementRef).nativeElement;
3970
4061
  // Debounce scrollToIndex via rAF to avoid scroll jitter on rapid keypresses.
3971
- // Each keypress overwrites pendingFocus — only the latest target is scrolled to.
4062
+ // Each keypress overwrites pendingFocus - only the latest target is scrolled to.
3972
4063
  let scrollRafId = null;
3973
4064
  effect((onCleanup) => {
3974
4065
  const target = roving.pendingFocus();
@@ -4003,7 +4094,7 @@ function connectRecyclerToRoving(recycler, roving) {
4003
4094
  if (target == null || target < s || target >= e) {
4004
4095
  return;
4005
4096
  }
4006
- // Target is within rendered range — DOM will be updated after CD.
4097
+ // Target is within rendered range - DOM will be updated after CD.
4007
4098
  // Use rAF to wait for Angular's rendering pass to complete.
4008
4099
  focusRafId = requestAnimationFrame(() => {
4009
4100
  focusRafId = null;
@@ -4042,7 +4133,7 @@ function connectRecyclerToRoving(recycler, roving) {
4042
4133
  *
4043
4134
  * Unlike {@link /projects/common/data/src/recycler/connect-recycler-roving.ts
4044
4135
  * connectRecyclerToRoving}, we don't re-focus a DOM element after the
4045
- * scroll — AD doesn't move real focus, it only rebinds
4136
+ * scroll - AD doesn't move real focus, it only rebinds
4046
4137
  * `aria-activedescendant`. Once the target index enters the rendered
4047
4138
  * range, the `[attr.aria-activedescendant]` binding on the combobox
4048
4139
  * trigger resolves to the now-present option element for free.
@@ -4054,7 +4145,7 @@ function connectRecyclerToRoving(recycler, roving) {
4054
4145
  * ```typescript
4055
4146
  * @Component({
4056
4147
  * hostDirectives: [
4057
- * { directive: CngxActiveDescendant, inputs: ['items', 'virtualCount'] },
4148
+ * { directive: CngxActiveDescendant, inputs: ['items', 'virtualCount', 'windowStart'] },
4058
4149
  * ],
4059
4150
  * })
4060
4151
  * class MyVirtualSelect {
@@ -4101,7 +4192,7 @@ function connectRecyclerToActiveDescendant(recycler, ad) {
4101
4192
  /**
4102
4193
  * Factory for the commit controller.
4103
4194
  *
4104
- * Plain function, not a class — matches the rest of the repo
4195
+ * Plain function, not a class - matches the rest of the repo
4105
4196
  * (`createManualState`, `createAsyncState`, `createTransitionTracker`).
4106
4197
  * See `reference_api_prefix_convention.md`.
4107
4198
  *
@@ -4191,7 +4282,7 @@ const CNGX_COMMIT_CONTROLLER_FACTORY = new InjectionToken('CngxCommitControllerF
4191
4282
  * (`<mat-tab-group>`, `<mat-stepper>`, etc.).
4192
4283
  *
4193
4284
  * Lives at Level 2 in `@cngx/common/data` parallel to
4194
- * `createCommitController`. Material types never enter the signature —
4285
+ * `createCommitController`. Material types never enter the signature -
4195
4286
  * the caller maps Material-specific events and property accessors to a
4196
4287
  * host-agnostic shape at the directive boundary.
4197
4288
  *
@@ -4205,7 +4296,7 @@ const CNGX_COMMIT_CONTROLLER_FACTORY = new InjectionToken('CngxCommitControllerF
4205
4296
  * 2. A Material→presenter subscription that forwards each
4206
4297
  * `selectionChange$` emission to `onMaterialSelection`
4207
4298
  * (equality-guarded against `presenterIndex()` so a Material event
4208
- * whose value already matches the presenter is dropped — closes
4299
+ * whose value already matches the presenter is dropped - closes
4209
4300
  * the re-entrancy loop).
4210
4301
  *
4211
4302
  * Both sides clean up via `destroyRef`.
@@ -4233,7 +4324,7 @@ const CNGX_COMMIT_CONTROLLER_FACTORY = new InjectionToken('CngxCommitControllerF
4233
4324
  * load-bearing for an ASYNC commit-action: Material emits the echo a
4234
4325
  * microtask later, by which point the commit may have advanced
4235
4326
  * `presenterIndex`, so an equality-only guard (`presenterIndex() ===
4236
- * idx`) would FAIL to drop the echo — it would re-enter the subscriber
4327
+ * idx`) would FAIL to drop the echo - it would re-enter the subscriber
4237
4328
  * and ping-pong against the in-flight navigation (the demo freezes).
4238
4329
  * Matching the echo by the value we wrote drops it regardless of where
4239
4330
  * the presenter has moved.
@@ -4305,5 +4396,5 @@ function createMaterialBidirectionalSync(opts) {
4305
4396
  * Generated bundle index. Do not edit.
4306
4397
  */
4307
4398
 
4308
- export { CNGX_ASYNC_LABEL, CNGX_ASYNC_SKIP, CNGX_BUCKET_PAGINATE_HOST, CNGX_COMMIT_CONTROLLER_FACTORY, CNGX_RECYCLER_I18N, CNGX_STAT, CngxAsync, CngxAsyncRegistry, CngxBucketPaginate, CngxDataSource, CngxDelta, CngxFilter, CngxFilterChip, CngxFilterChips, CngxGoal, CngxMeasure, CngxMetric, CngxPaginate, CngxPaginateResetOn, CngxPaginateRouting, CngxRecyclerAnnouncer, CngxSmartDataSource, CngxSort, CngxSortHeader, CngxStat, CngxStatCaption, CngxStatDelta, CngxStatLabel, CngxStatValue, CngxStatus, CngxTrend, CngxVirtualItem, cngxAsyncInterceptor, connectPaginateEmit, connectPaginateResetOn, connectRecyclerToActiveDescendant, connectRecyclerToRoving, createAsyncState, createCommitController, createManualState, createMaterialBidirectionalSync, createSortHeaderState, fromHttpResource, fromResource, injectAsyncRegistry, injectAsyncState, injectDataSource, injectRecycler, injectSmartDataSource, provideAsyncHttpObservability, provideAsyncRegistry, provideRecyclerI18n, resolveAsyncView, tapAsyncProgress, tapAsyncState, tapHttpAsyncState, withAsyncLabel, withAsyncSkip };
4399
+ export { CNGX_ASYNC_LABEL, CNGX_ASYNC_SKIP, CNGX_BUCKET_PAGINATE_HOST, CNGX_COMMIT_CONTROLLER_FACTORY, CNGX_RECYCLER_I18N, CNGX_STAT, CngxAsync, CngxAsyncBoundary, CngxAsyncRegistry, CngxBucketPaginate, CngxDataSource, CngxDelta, CngxFilter, CngxFilterChip, CngxFilterChips, CngxGoal, CngxMeasure, CngxMetric, CngxPaginate, CngxPaginateResetOn, CngxPaginateRouting, CngxRecyclerAnnouncer, CngxSmartDataSource, CngxSort, CngxSortHeader, CngxStat, CngxStatCaption, CngxStatCoordinator, CngxStatDelta, CngxStatLabel, CngxStatValue, CngxTrend, CngxVirtualItem, cngxAsyncInterceptor, connectPaginateEmit, connectPaginateResetOn, connectRecyclerToActiveDescendant, connectRecyclerToRoving, createAsyncState, createCommitController, createForwardedAsyncState, createManualState, createMaterialBidirectionalSync, createSortHeaderState, fromHttpResource, fromResource, injectAsyncRegistry, injectAsyncState, injectDataSource, injectLatencyProbe, injectRecycler, injectSmartDataSource, provideAsyncHttpObservability, provideAsyncRegistry, provideRecyclerI18n, resolveAsyncView, tapAsyncProgress, tapAsyncState, tapHttpAsyncState, withAsyncLabel, withAsyncSkip };
4309
4400
  //# sourceMappingURL=cngx-common-data.mjs.map