@cngx/common 0.1.0-rc.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/README.md +15 -2
- package/button/README.md +258 -0
- package/command/README.md +42 -2
- package/data/README.md +15 -12
- package/fesm2022/cngx-common-a11y.mjs +1076 -319
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +99 -77
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-button.mjs +1084 -0
- package/fesm2022/cngx-common-button.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +138 -78
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +799 -327
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +101 -25
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +861 -423
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +198 -160
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +693 -329
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7303 -2774
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2174 -442
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-menu-button.mjs +557 -0
- package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +2109 -557
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +548 -419
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +442 -331
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +44 -71
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +10 -10
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +30 -19
- package/layout/README.md +17 -1
- package/menu-button/README.md +234 -0
- package/package.json +31 -8
- package/popover/README.md +81 -4
- package/popover/tooltip-indicator.scss +52 -0
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +96 -0
- package/schematics/package.json +3 -0
- package/stepper/README.md +5 -5
- package/theming/components/cngx-accordion.css +36 -7
- package/theming/components/cngx-async.css +185 -37
- package/theming/components/cngx-backdrop.css +3 -1
- package/theming/components/cngx-badge.css +20 -5
- package/theming/components/cngx-bottom-sheet.css +2 -0
- package/theming/components/cngx-breadcrumb.css +3 -1
- package/theming/components/cngx-button-group.css +325 -0
- package/theming/components/cngx-button-toggle.css +55 -23
- package/theming/components/cngx-button.css +975 -0
- package/theming/components/cngx-data-grid.css +2 -0
- package/theming/components/cngx-dialog.css +3 -1
- package/theming/components/cngx-divider.css +24 -9
- package/theming/components/cngx-drawer.css +153 -0
- package/theming/components/cngx-icon-glyph.css +76 -0
- package/theming/components/cngx-listbox.css +79 -25
- package/theming/components/cngx-menu.css +112 -52
- package/theming/components/cngx-nav.css +1220 -0
- package/theming/components/cngx-popover-sheet.css +434 -0
- package/theming/components/cngx-popover.css +37 -9
- package/theming/components/cngx-recycler-placeholder.css +2 -0
- package/theming/components/cngx-ripple.css +74 -16
- package/theming/components/cngx-sidebar.css +71 -0
- package/theming/components/cngx-slider.css +3 -1
- package/theming/components/cngx-tooltip.css +2 -0
- package/timeline/README.md +2 -2
- package/types/cngx-common-a11y.d.ts +488 -112
- package/types/cngx-common-audio.d.ts +60 -88
- package/types/cngx-common-button.d.ts +698 -0
- package/types/cngx-common-card.d.ts +104 -78
- package/types/cngx-common-chart.d.ts +677 -389
- package/types/cngx-common-command.d.ts +55 -41
- package/types/cngx-common-data.d.ts +506 -360
- package/types/cngx-common-dialog.d.ts +94 -127
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4383 -1721
- package/types/cngx-common-layout.d.ts +1399 -288
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +990 -268
- package/types/cngx-common-stepper.d.ts +374 -465
- package/types/cngx-common-tabs.d.ts +309 -403
- package/types/cngx-common-timeline.d.ts +50 -109
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cngx-common-data.mjs","sources":["../../../projects/common/data/sort/sort.directive.ts","../../../projects/common/data/sort/sort-header-state.ts","../../../projects/common/data/sort/sort-header.directive.ts","../../../projects/common/data/filter/filter.directive.ts","../../../projects/common/data/filter-chips/filter-chips.component.ts","../../../projects/common/data/paginate/paginate.directive.ts","../../../projects/common/data/paginate/paginate-reset.directive.ts","../../../projects/common/data/paginate/paginate-emit.ts","../../../projects/common/data/paginate/paginate-routing.directive.ts","../../../projects/common/data/paginate/bucket-paginate-host.token.ts","../../../projects/common/data/paginate/bucket-paginate.directive.ts","../../../projects/common/data/data-source/data-source.ts","../../../projects/common/data/data-source/smart-data-source.ts","../../../projects/common/data/async-state/create-manual-state.ts","../../../projects/common/data/async-registry/async-registry.ts","../../../projects/common/data/async-registry/provide-async-registry.ts","../../../projects/common/data/async-state/create-async-state.ts","../../../projects/common/data/async-state/forwarded-async-state.ts","../../../projects/common/data/async-state/inject-async-state.ts","../../../projects/common/data/async-state/resolve-view.ts","../../../projects/common/data/async-state/async-boundary.directive.ts","../../../projects/common/data/async-state/resource-bridge.ts","../../../projects/common/data/async-state/from-resource.ts","../../../projects/common/data/async-state/from-http-resource.ts","../../../projects/common/data/async-state/operators.ts","../../../projects/common/data/async-registry/inject-latency-probe.ts","../../../projects/common/data/async-registry/http-context.ts","../../../projects/common/data/async-registry/http-interceptor.ts","../../../projects/common/data/async/async.directive.ts","../../../projects/common/data/i18n/kpi-language-section.ts","../../../projects/common/data/display/shared/kpi-i18n.ts","../../../projects/common/data/display/metric/metric.component.ts","../../../projects/common/data/display/shared/delta-format.ts","../../../projects/common/data/display/trend/trend.component.ts","../../../projects/common/data/display/delta/delta.component.ts","../../../projects/common/data/display/stat/stat-coordinator.directive.ts","../../../projects/common/data/display/stat/stat.token.ts","../../../projects/common/data/display/stat/stat.component.ts","../../../projects/common/data/display/stat/stat-slots.ts","../../../projects/common/data/display/goal/goal.component.ts","../../../projects/common/data/i18n/recycler-language-section.ts","../../../projects/common/data/recycler/range-computer.ts","../../../projects/common/data/recycler/scroll-observer.ts","../../../projects/common/data/recycler/size-cache.ts","../../../projects/common/data/recycler/recycler.ts","../../../projects/common/data/recycler/measure.directive.ts","../../../projects/common/data/recycler/virtual-item.directive.ts","../../../projects/common/data/recycler/recycler-placeholder.directive.ts","../../../projects/common/data/recycler/recycler-row.directive.ts","../../../projects/common/data/recycler/recycler-announcer.component.ts","../../../projects/common/data/recycler/connect-recycler-roving.ts","../../../projects/common/data/recycler/connect-recycler-active-descendant.ts","../../../projects/common/data/commit/commit-controller.ts","../../../projects/common/data/commit/commit-controller.token.ts","../../../projects/common/data/material-bridge/bidirectional-sync.ts","../../../projects/common/data/public-api.ts","../../../projects/common/data/cngx-common-data.ts"],"sourcesContent":["import { afterNextRender, computed, Directive, input, output, signal } from '@angular/core';\n\n/**\n * A single sort entry: the active field key and its direction.\n *\n * @category common/data/sort\n */\nexport interface SortEntry {\n active: string;\n direction: 'asc' | 'desc';\n}\n\nfunction entryEqual(a: SortEntry | null | undefined, b: SortEntry | null | undefined): boolean {\n return a === b || (!!a && !!b && a.active === b.active && a.direction === b.direction);\n}\n\nfunction entriesEqual(a: SortEntry[], b: SortEntry[]): boolean {\n return a === b || (a.length === b.length && a.every((entry, i) => entryEqual(entry, b[i])));\n}\n\n/**\n * Atom directive that tracks sort state (active field + direction).\n *\n * Supports both **uncontrolled** (internal state) and **controlled** modes.\n * In controlled mode the `cngxSortActive` / `cngxSortDirection` inputs take\n * precedence over the internal state - pair with `sortChange` to keep them\n * in sync.\n *\n * An uncontrolled sort may declare a **starting** column + direction via\n * `[cngxSortInitial]`: it seeds the internal state exactly once on init, then\n * user clicks take over. Distinct from the controlled `cngxSortActive` /\n * `cngxSortDirection` pins - the seed is skipped when a controlled pin is bound.\n *\n * When `multiSort` is `true`, holding **Shift** while clicking a sort header\n * adds it as a secondary (tertiary, …) sort key instead of replacing the\n * primary one. Shift-clicking an active column cycles it asc → desc → removed.\n * Multi-sort state is always uncontrolled; use `sortsChange` to read it.\n * While a controlled pin is bound, additive clicks degrade to the\n * single-sort cycle.\n *\n * Consumer connects this to a table or list via a `computed()` - nothing is\n * injected automatically.\n *\n * @category common/data/sort\n * @docsKind primary\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/sort/sort.directive.ts\n * @since 0.1.0\n * @relatedTo CngxSortHeader, CngxFilter, CngxPaginate, CngxSmartDataSource\n *\n * <example-url>http://localhost:4200/#/common/data/sort/basic</example-url>\n * <example-url>http://localhost:4200/#/common/data/sort/multi-sort</example-url>\n * <example-url>http://localhost:4200/#/common/data/sort/controlled</example-url>\n * <example-url>http://localhost:4200/#/common/data/sort/aria-and-keyboard</example-url>\n */\n@Directive({\n selector: '[cngxSort]',\n exportAs: 'cngxSort',\n standalone: true,\n})\nexport class CngxSort {\n /** Controlled active column. When bound, takes precedence over internal state (single-sort only). */\n readonly activeInput = input<string | undefined>(undefined, { alias: 'cngxSortActive' });\n /** Controlled direction. When bound, takes precedence over internal state (single-sort only). */\n readonly directionInput = input<'asc' | 'desc' | undefined>(undefined, {\n alias: 'cngxSortDirection',\n });\n /**\n * When `true`, Shift+click on a sort header adds it to the sort stack instead of\n * replacing the current sort.\n */\n readonly multiSort = input<boolean>(false);\n /**\n * Uncontrolled starting sort. Seeds the internal state once on init if no sort\n * is set yet and no controlled `cngxSortActive` pin is bound; user clicks own\n * it thereafter. Ignored in controlled mode.\n */\n readonly initialSort = input<SortEntry | undefined>(undefined, { alias: 'cngxSortInitial' });\n\n private readonly sortsState = signal<SortEntry[]>([]);\n\n constructor() {\n // One-shot uncontrolled seed: not a reactive derivation, so afterNextRender\n // (single-shot, outside the signal graph) rather than an effect. The empty +\n // no-controlled-pin guards keep it from clobbering an early click or writing\n // an invisible state that would surface when a controlled pin unbinds.\n afterNextRender(() => {\n const seed = this.initialSort();\n if (seed && this.sortsState().length === 0 && this.activeInput() === undefined) {\n this.sortsState.set([seed]);\n }\n });\n }\n\n /** The active sort column of the primary entry (controlled takes precedence in single-sort mode). */\n readonly active = computed(() => this.activeInput() ?? this.sorts()[0]?.active);\n /** The active sort direction of the primary entry (controlled takes precedence in single-sort mode). */\n readonly direction = computed(() => this.directionInput() ?? this.sorts()[0]?.direction);\n\n /**\n * The primary sort state, or `null` when no sort is active.\n * In multi-sort mode this is the first entry in `sorts`.\n */\n readonly sort = computed(\n () => (this.active() ? { active: this.active(), direction: this.direction() ?? 'asc' } : null),\n { equal: entryEqual },\n );\n\n /**\n * All active sort entries in priority order.\n * Contains at most one entry when additive mode has not been used.\n * In controlled mode the entry is derived from `cngxSortActive` /\n * `cngxSortDirection` (a falsy active key means no sort); headers and\n * data sources read this signal, so the controlled pin drives them too.\n */\n readonly sorts = computed<SortEntry[]>(\n () => {\n const controlledActive = this.activeInput();\n if (controlledActive !== undefined) {\n if (!controlledActive) {\n return [];\n }\n return [{ active: controlledActive, direction: this.directionInput() ?? 'asc' }];\n }\n return this.sortsState();\n },\n // Structural equal: the controlled branch builds a fresh entry literal on\n // every recompute; identity churn here would cascade into header state and\n // a full re-sort in CngxSmartDataSource.processed.\n { equal: entriesEqual },\n );\n\n /** `true` when at least one sort is active. */\n readonly isActive = computed(() => this.sorts().length > 0);\n\n /** Emitted when the primary sort state changes. Emits `undefined` on clear. */\n readonly sortChange = output<SortEntry | undefined>();\n /**\n * Emitted whenever the sort stack changes (including removals and full clears).\n * Always reflects the full `sorts` array at the time of emission.\n */\n readonly sortsChange = output<SortEntry[]>();\n\n /**\n * Sets or toggles the sort for `field`.\n *\n * **`additive = false`** (default, plain click):\n * - Same field → cycle `asc` → `desc` → cleared (a third click removes the sort)\n * - Different field → replace stack with `{ field, asc }`\n *\n * **`additive = true`** (Shift+click when `multiSort` is enabled on the header):\n * - Field not in stack → append as asc\n * - Field in stack as asc → change to desc\n * - Field in stack as desc → remove from stack\n *\n * With a controlled `cngxSortActive` pin bound, the sort is event-only: the\n * cycle is computed off the effective entry and emitted, the internal state\n * stays untouched (nothing stale surfaces if the pin unbinds later). Since\n * multi-sort is always uncontrolled, an additive call degrades to the\n * non-additive controlled cycle while a pin is bound.\n */\n setSort(field: string, additive = false): void {\n if (additive && this.activeInput() === undefined) {\n const current = this.sortsState();\n const idx = current.findIndex((s) => s.active === field);\n let next: SortEntry[];\n if (idx === -1) {\n next = [...current, { active: field, direction: 'asc' }];\n } else if (current[idx].direction === 'asc') {\n next = current.map((s, i) => (i === idx ? { ...s, direction: 'desc' as const } : s));\n } else {\n next = current.filter((_, i) => i !== idx);\n }\n this.sortsState.set(next);\n this.sortsChange.emit(next);\n this.sortChange.emit(next[0]);\n } else {\n // Cycle off the effective state: with a controlled pin bound, the first\n // click on the pinned column must continue the cycle (asc -> desc), not\n // restart it from the empty internal state. In that case the write is\n // skipped too - the consumer owns the state, and a shadow copy would\n // surface as stale sort once the pin unbinds.\n const controlled = this.activeInput() !== undefined;\n const current = this.sorts();\n if (field === current[0]?.active && current[0].direction === 'desc') {\n // Third click on the active column: cycle desc -> cleared.\n if (!controlled) {\n this.sortsState.set([]);\n }\n this.sortChange.emit(undefined);\n this.sortsChange.emit([]);\n } else {\n const dir: 'asc' | 'desc' = field === current[0]?.active ? 'desc' : 'asc';\n const entry: SortEntry = { active: field, direction: dir };\n if (!controlled) {\n this.sortsState.set([entry]);\n }\n this.sortChange.emit(entry);\n this.sortsChange.emit([entry]);\n }\n }\n }\n\n /** Clears all active sorts. Emits both `sortChange(undefined)` and `sortsChange([])`. */\n clear(): void {\n this.sortsState.set([]);\n this.sortChange.emit(undefined);\n this.sortsChange.emit([]);\n }\n}\n","import { computed, type Signal } from '@angular/core';\n\nimport { type CngxSort, type SortEntry } from './sort.directive';\n\n/**\n * The derived sort-header state a header directive exposes for one column.\n *\n * Pure derivation over a single {@link CngxSort} source plus an imperative\n * `toggle`. No async state, no signal writes outside `toggle`.\n *\n * @category common/data/sort\n */\nexport interface SortHeaderState {\n /** The active sort entry for this column, or `undefined` when the column is not sorted. */\n readonly entry: Signal<SortEntry | undefined>;\n /** `true` when this column is part of the active sort (primary or secondary). */\n readonly isActive: Signal<boolean>;\n /** `true` when this column is active and sorted ascending. */\n readonly isAsc: Signal<boolean>;\n /** `true` when this column is active and sorted descending. */\n readonly isDesc: Signal<boolean>;\n /**\n * 1-based position of this column in the sort stack, or `0` when it is not active.\n * Only meaningful when `multiSort` is enabled on the owning `CngxSort`.\n */\n readonly priority: Signal<number>;\n /**\n * Toggles this column's sort through `CngxSort.setSort`. Pass the header's own\n * Shift-key read as `additive`; the `multiSort` gate is applied here so the\n * column only joins the stack additively when the owning sort allows it.\n */\n toggle(additive?: boolean): void;\n}\n\n/**\n * Derives the shared sort-header state for one column from a {@link CngxSort} getter.\n *\n * Both {@link CngxSortHeader} (table context, `aria-sort`) and `CngxDgaSortHeader`\n * (disclosure context, `role=\"button\"` + `aria-describedby`) compose this factory\n * and keep only their own a11y presentation. The factory is a11y-agnostic - it\n * returns the plain derived signals each header maps to its own DOM/ARIA surface.\n *\n * @param sort Getter for the owning `CngxSort` engine (`() => sortRef`, `() => grid.sort`).\n * @param field Getter for the column's field key.\n * @returns The derived `{ entry, isActive, isAsc, isDesc, priority, toggle }` bundle.\n *\n * @category common/data/sort\n * @since 0.1.0\n * @relatedTo CngxSort, CngxSortHeader\n */\nexport function createSortHeaderState(sort: () => CngxSort, field: () => string): SortHeaderState {\n const entry = computed(() => sort().sorts().find((s) => s.active === field()));\n\n const isActive = computed(() => entry() !== undefined);\n const isAsc = computed(() => entry()?.direction === 'asc');\n const isDesc = computed(() => entry()?.direction === 'desc');\n\n const priority = computed(() => {\n const idx = sort().sorts().findIndex((s) => s.active === field());\n return idx === -1 ? 0 : idx + 1;\n });\n\n return {\n entry,\n isActive,\n isAsc,\n isDesc,\n priority,\n toggle(additive = false): void {\n sort().setSort(field(), additive && sort().multiSort());\n },\n };\n}\n","import { computed, Directive, input } from '@angular/core';\nimport { createSortHeaderState } from './sort-header-state';\nimport { type CngxSort } from './sort.directive';\n\n/**\n * Molecule directive for sort-header elements.\n *\n * Apply to any clickable header element. Consumer provides an explicit\n * `[cngxSortRef]` binding - no ancestor injection, no hidden wiring.\n *\n * In multi-sort mode, Shift+click adds this column to the sort stack.\n * The `priority()` signal returns the 1-based position in the stack\n * (0 when not active), useful for showing sort-order badges.\n *\n * ```html\n * <div cngxSort [multiSort]=\"true\" #sort=\"cngxSort\">\n * <button cngxSortHeader=\"name\" [cngxSortRef]=\"sort\" #h=\"cngxSortHeader\">\n * Name\n * @if (h.isActive()) {\n * {{ h.isAsc() ? '↑' : '↓' }}\n * @if (sort.multiSort()) { <span>{{ h.priority() }}</span> }\n * }\n * </button>\n * </div>\n * ```\n *\n * @category common/data/sort\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/sort/sort-header.directive.ts\n * @since 0.1.0\n * @relatedTo CngxSort, CngxFilter, CngxPaginate\n *\n * <example-url>http://localhost:4200/#/common/data/sort/basic</example-url>\n * <example-url>http://localhost:4200/#/common/data/sort/multi-sort</example-url>\n * <example-url>http://localhost:4200/#/common/data/sort/controlled</example-url>\n * <example-url>http://localhost:4200/#/common/data/sort/aria-and-keyboard</example-url>\n */\n@Directive({\n selector: '[cngxSortHeader]',\n exportAs: 'cngxSortHeader',\n standalone: true,\n host: {\n '(click)': 'handleSort($event)',\n '[attr.aria-sort]': 'ariaSort()',\n '[class.cngx-sort-header--active]': 'isActive()',\n '[class.cngx-sort-header--asc]': 'isAsc()',\n '[class.cngx-sort-header--desc]': 'isDesc()',\n },\n})\nexport class CngxSortHeader {\n /** The field key this header cell represents. */\n readonly field = input.required<string>({ alias: 'cngxSortHeader' });\n /** Explicit reference to the owning `CngxSort`. */\n readonly cngxSortRef = input.required<CngxSort>();\n\n private readonly state = createSortHeaderState(this.cngxSortRef, this.field);\n\n /** `true` when this column is part of the active sort (primary or secondary). */\n readonly isActive = this.state.isActive;\n /** `true` when this column is active and sorted ascending. */\n readonly isAsc = this.state.isAsc;\n /** `true` when this column is active and sorted descending. */\n readonly isDesc = this.state.isDesc;\n\n /**\n * 1-based position of this column in the sort stack.\n * Returns `0` when the column is not part of the active sort.\n * Only meaningful when `multiSort` is enabled on the owning `CngxSort`.\n */\n readonly priority = this.state.priority;\n\n /** The `aria-sort` attribute value for the host element. */\n readonly ariaSort = computed((): 'ascending' | 'descending' | null => {\n if (!this.state.isActive()) {\n return null;\n }\n return this.state.isAsc() ? 'ascending' : 'descending';\n });\n\n protected handleSort(event?: MouseEvent): void {\n this.state.toggle(event?.shiftKey ?? false);\n }\n}\n","import { computed, Directive, input, output, signal } from '@angular/core';\n\n/**\n * Atom directive that holds one or more named filter predicates.\n *\n * Supports both **uncontrolled** (internal state) and **controlled** modes.\n * In controlled mode the `cngxFilter` input takes precedence over the internal\n * `'default'` predicate - pair with `filterChange` to keep it in sync.\n *\n * **Multi-filter** - use `addPredicate(key, fn)` / `removePredicate(key)` to\n * maintain a named stack of predicates. All active predicates are **AND-combined**\n * across keys: an item must pass every registered predicate to appear in results.\n *\n * AND vs OR - the directive enforces AND across dimensions (keys). OR logic\n * within a single dimension stays inside the predicate function itself:\n *\n * ```typescript\n * // AND across dimensions: location AND role must both match\n * filter.addPredicate('location', p => selectedLocations.has(p.location));\n * filter.addPredicate('role', p => selectedRoles.has(p.role));\n *\n * // OR within a dimension: London OR Rome - just put a Set inside one predicate\n * filter.addPredicate('location', p => selectedLocations.has(p.location));\n * ```\n *\n * `setPredicate` / `clear` operate on the `'default'` key and remain fully\n * backward-compatible with single-predicate usage.\n *\n * Consumer connects this to a list via a `computed()` - nothing is injected\n * automatically.\n *\n * @typeParam T - The item type the predicate operates on.\n *\n * @category common/data/filter\n * @docsKind primary\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter/filter.directive.ts\n * @since 0.1.0\n * @relatedTo CngxFilterChips, CngxSort, CngxPaginate, CngxSmartDataSource\n *\n * <example-url>http://localhost:4200/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>\n * <example-url>http://localhost:4200/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>\n * <example-url>http://localhost:4200/#/common/data/smart-data-source/auto-wired</example-url>\n * <example-url>http://localhost:4200/#/common/data/smart-data-source/how-it-works-hostdirectives-inject</example-url>\n * <example-url>http://localhost:4200/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>\n */\n@Directive({\n selector: '[cngxFilter]',\n exportAs: 'cngxFilter',\n standalone: true,\n})\nexport class CngxFilter<T = unknown> {\n /** Controlled predicate. When bound, takes precedence over the `'default'` internal predicate. */\n readonly predicateInput = input<((value: T) => boolean) | null>(null, { alias: 'cngxFilter' });\n\n private readonly predicatesState = signal<Map<string, (value: T) => boolean>>(new Map());\n\n /**\n * All active named predicates.\n * Use `addPredicate` / `removePredicate` to manage this map.\n */\n readonly predicates = this.predicatesState.asReadonly();\n\n /** Number of active named predicates (controlled input not counted). */\n readonly activeCount = computed(() => this.predicatesState().size);\n\n /**\n * The combined predicate - AND of all active named predicates plus the\n * controlled input (when bound). Returns `null` when nothing is active.\n */\n readonly predicate = computed((): ((value: T) => boolean) | null => {\n const controlled = this.predicateInput();\n const map = this.predicatesState();\n\n const fns = [...(controlled ? [controlled] : []), ...map.values()];\n\n if (fns.length === 0) {\n return null;\n }\n if (fns.length === 1) {\n return fns[0];\n }\n return (value: T) => fns.every((fn) => fn(value));\n });\n\n /** `true` when at least one predicate is active. */\n readonly isActive = computed(() => this.predicate() !== null);\n\n /** Emitted whenever the `'default'` predicate changes (backward-compat single-filter output). */\n readonly filterChange = output<((value: T) => boolean) | null>();\n\n /** Emitted whenever any named predicate is added or removed. */\n readonly predicatesChange = output<Map<string, (value: T) => boolean>>();\n\n /**\n * Adds or replaces the named predicate `key`.\n * Emits `predicatesChange` with the updated map.\n */\n addPredicate(key: string, fn: (value: T) => boolean): void {\n const next = new Map(this.predicatesState());\n next.set(key, fn);\n this.predicatesState.set(next);\n this.predicatesChange.emit(next);\n }\n\n /**\n * Removes the named predicate `key` (no-op if not present).\n * Emits `predicatesChange` with the updated map.\n */\n removePredicate(key: string): void {\n const current = this.predicatesState();\n if (!current.has(key)) {\n return;\n }\n const next = new Map(current);\n next.delete(key);\n this.predicatesState.set(next);\n this.predicatesChange.emit(next);\n }\n\n /**\n * Sets the `'default'` predicate and emits `filterChange`.\n * Pass `null` to clear it (same as `clear()`).\n */\n setPredicate(fn: ((value: T) => boolean) | null): void {\n if (fn === null) {\n this.removePredicate('default');\n } else {\n this.addPredicate('default', fn);\n }\n this.filterChange.emit(fn);\n }\n\n /** Removes all named predicates and emits `filterChange` with `null`. */\n clear(): void {\n this.predicatesState.set(new Map());\n this.predicatesChange.emit(new Map());\n this.filterChange.emit(null);\n }\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n Directive,\n TemplateRef,\n contentChild,\n effect,\n inject,\n input,\n model,\n untracked,\n type Signal,\n} from '@angular/core';\nimport { CngxChip } from '@cngx/common/display';\nimport { CngxChipInGroup, CngxMultiChipGroup } from '@cngx/common/interactive';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\nimport type { CngxFilter } from '../filter/filter.directive';\n\n/**\n * Per-chip override slot context. Consumers project an\n * `<ng-template cngxFilterChip let-option let-value=\"value\" let-label=\"label\">`\n * to customize chip body decoration - icons, count badges, colour\n * swatches, anything beyond the default text label.\n *\n * **Decoration-only semantics.** The bridge ALWAYS wraps each option\n * in `<cngx-chip cngxChipInGroup [value]>` itself; the slot only\n * customizes what renders INSIDE that wrapper. Consumers do NOT\n * redeclare selection wiring - it is handled by the bridge so the\n * projected content survives Angular's `*ngTemplateOutlet`\n * lexical-injector semantics (the projected template injects against\n * the consumer's component, NOT the bridge's inner\n * `<cngx-multi-chip-group>`, so a consumer-supplied\n * `cngxChipInGroup` would fail to resolve `CNGX_CHIP_GROUP_HOST`).\n *\n * @category common/data/filter\n */\nexport interface CngxFilterChipContext<TItem = unknown, TValue = unknown> {\n readonly $implicit: TItem;\n readonly option: TItem;\n readonly value: TValue;\n readonly label: string;\n}\n\n/**\n * Template-slot directive overriding the default chip body inside\n * `<cngx-filter-chips>`. Consumers attach\n * `<ng-template cngxFilterChip>` to project decoration; the bridge\n * wraps that decoration in `cngxChipInGroup`-bound chip wrappers\n * automatically. Absence falls back to the default text-only label.\n *\n * @category common/data/filter\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter-chips/filter-chips.component.ts\n * @since 0.1.0\n * @relatedTo CngxFilterChips, CngxFilter\n *\n * <example-url>http://localhost:4200/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>\n * <example-url>http://localhost:4200/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxFilterChip]',\n standalone: true,\n})\nexport class CngxFilterChip<TItem = unknown, TValue = unknown> {\n readonly template: TemplateRef<CngxFilterChipContext<TItem, TValue>> =\n inject<TemplateRef<CngxFilterChipContext<TItem, TValue>>>(TemplateRef);\n\n static ngTemplateContextGuard<TItem, TValue>(\n _dir: CngxFilterChip<TItem, TValue>,\n _ctx: unknown,\n ): _ctx is CngxFilterChipContext<TItem, TValue> {\n return true;\n }\n}\n\n/**\n * Bridge that connects a multi-select chip strip to a `CngxFilter`\n * predicate via Pillar-1 derivation - no `effect()` write-back, no\n * manual sync. The bridge composes `<cngx-multi-chip-group>` for\n * the visible chip strip and registers a single closure-style\n * predicate on the parent `[filterRef]`. Chip toggles update\n * `selectedValues`; the registered closure reads `selectedValues()`\n * lazily on every invocation so downstream filtered consumers\n * recompute without the bridge ever re-registering.\n *\n * Filter chips are inherently multi-select per\n * `feedback_select_family_split`; a single-mode filter-chip pattern\n * is intentionally out of scope. Consumers needing a single-select\n * filter wire `<cngx-chip-group>` to a custom predicate themselves.\n *\n * **Sync contract - derivation, not effect.** `predicateFn` is a\n * closure that reads `this.selectedValues()` and\n * `this.optionValue()` on every invocation. Because\n * `CngxFilter.predicate` is itself a `computed()` consumed by\n * downstream filtered lists, each item-evaluation flows through\n * `selectedValues()` in the consumer's reactive context - chip\n * toggles propagate without any `effect()` writing back into the\n * filter. Registration itself is reactive: a binding effect tracks\n * `filterRef`/`filterKey` (a rebind moves the registration), and an\n * eviction watcher re-registers the key after `filter.clear()` wiped\n * the stack, so visible chip selection and predicate stack cannot\n * diverge. Selections whose option vanished from `[options]` are\n * pruned - a removed option never keeps filtering invisibly.\n *\n * **Empty-selection semantics.** When `selectedValues()` is `[]`,\n * the closure returns `true` for every item - equivalent to \"no\n * filter applied\". The bridge deliberately does NOT call\n * `removePredicate` on empty selection: leaving the predicate\n * registered with a constant-`true` short-circuit is cheaper than\n * re-registering on every empty/non-empty boundary, and keeps the\n * predicate-stack stable (no `predicatesChange` emission churn).\n *\n * **Teardown.** The binding effect's cleanup removes the key only\n * while it still maps to this strip's own `predicateFn` (identity\n * guard) - destroying one of two strips that share a key never\n * detaches the live sibling's registration.\n *\n * **Visible caption.** The required `label` renders as a\n * `.cngx-filter-chips__label` caption above the strip so a sighted user\n * can tell which facet a chip row belongs to. The caption is\n * `aria-hidden=\"true\"`: the inner `<cngx-multi-chip-group>` is already\n * named by the same string via `[label]`, so exposing the visible node\n * to AT would announce the facet twice. Spacing between caption and\n * strip is the `--cngx-filter-chips-gap` token; the caption's own\n * appearance is `--cngx-filter-chips-label-color`,\n * `--cngx-filter-chips-label-font-size` and\n * `--cngx-filter-chips-label-font-weight`.\n *\n * ```html\n * <cngx-filter-chips\n * label=\"Tags\"\n * [options]=\"tagOptions\"\n * optionLabel=\"label\"\n * optionValue=\"id\"\n * [filterRef]=\"employees\"\n * filterKey=\"tags\"\n * />\n *\n * <ng-container cngxFilter #employees=\"cngxFilter\">\n * @for (emp of filteredEmployees(); track emp.id) {\n * ...\n * }\n * </ng-container>\n * ```\n *\n * @category common/data/filter\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter-chips/filter-chips.component.ts\n * @since 0.1.0\n * @relatedTo CngxFilter, CngxFilterChip, CngxMultiChipGroup\n * @slot cngxFilterChip Renders one active filter chip; gets the filter entry and a remove callback.\n *\n * <example-url>http://localhost:4200/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>\n * <example-url>http://localhost:4200/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>\n */\n@Component({\n selector: 'cngx-filter-chips',\n exportAs: 'cngxFilterChips',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CngxChip, CngxMultiChipGroup, CngxChipInGroup, NgTemplateOutlet],\n host: {\n class: 'cngx-filter-chips',\n '[class.cngx-filter-chips--vertical]': 'orientation() === \"vertical\"',\n },\n styleUrl: './filter-chips.component.css',\n template: `\n <span class=\"cngx-filter-chips__label\" aria-hidden=\"true\">{{ label() }}</span>\n <cngx-multi-chip-group\n [label]=\"label()\"\n [(selectedValues)]=\"selectedValues\"\n [state]=\"state()\"\n [keyFn]=\"keyFn()\"\n [(disabled)]=\"disabled\"\n [(required)]=\"required\"\n [(invalid)]=\"invalid\"\n [errorMessageId]=\"errorMessageId()\"\n [orientation]=\"orientation()\"\n >\n @for (option of options(); track keyFn()(optionValue()(option))) {\n <cngx-chip cngxChipInGroup [value]=\"optionValue()(option)\">\n @if (chipTemplate()?.template; as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: chipContext(option)\" />\n } @else {\n {{ optionLabel()(option) }}\n }\n </cngx-chip>\n }\n </cngx-multi-chip-group>\n `,\n})\nexport class CngxFilterChips<TItem = unknown, TValue = unknown> {\n readonly label = input.required<string>();\n readonly options = input.required<readonly TItem[]>();\n readonly optionLabel = input.required<(item: TItem) => string>();\n readonly optionValue = input.required<(item: TItem) => TValue>();\n readonly filterRef = input.required<CngxFilter<TItem>>();\n readonly filterKey = input.required<string>();\n readonly state = input<CngxAsyncState<unknown> | undefined>(undefined);\n\n /**\n * Form-state surface forwarded transparently to the inner\n * `<cngx-multi-chip-group>`. Each is a `model<boolean>` matching the\n * inner shape so consumers can two-way bind with their own forms\n * state without reaching past the bridge. Mirrors `CngxCheckboxGroup`\n * / `CngxButtonToggleGroup` precedent.\n */\n readonly disabled = model<boolean>(false);\n readonly required = model<boolean>(false);\n readonly invalid = model<boolean>(false);\n readonly errorMessageId = input<string | null>(null);\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n\n /**\n * Membership key extractor for object-valued chip values. When\n * `TValue` is an object (e.g. `{ id, label }` rather than a\n * primitive id), this fn extracts a stable identity key so chip\n * membership survives re-emissions with fresh references. Forwarded\n * to the inner `<cngx-multi-chip-group>` AND used inside the\n * predicate's `Object.is` comparison. Defaults to identity - works\n * for primitive values.\n */\n readonly keyFn = input<(value: TValue) => unknown>((v) => v);\n\n /**\n * Resolved consumer-supplied chip template. The query uses an\n * instantiation expression (`CngxFilterChip<TItem, TValue>`) so the\n * bridge's class generics propagate into the slot directive type;\n * absent that propagation, `contentChild(CngxFilterChip)` returns\n * `Signal<CngxFilterChip<unknown, unknown> | undefined>` and the\n * `chipContext()` helper would have to widen on every call.\n */\n protected readonly chipTemplate: Signal<CngxFilterChip<TItem, TValue> | undefined> = contentChild(\n CngxFilterChip<TItem, TValue>,\n );\n\n /**\n * Build the slot context for a given chip option. `optionValue` is\n * invoked here per option for the chip rendering pass; the predicate\n * closure invokes it again per LIST item for membership filtering.\n * Both invocations are necessary because option items (the chip\n * pool) and filtered list items (the consumer's filtered data) are\n * separate data paths - they happen to share a shape under the\n * Phase-5 single-shape limitation, but the bridge cannot memoise\n * across the two paths without conflating them. Consumers should\n * keep `optionValue` cheap (typically a property lookup); a future\n * `[itemValue]` input will separate the two extractors.\n */\n protected readonly chipContext = (option: TItem): CngxFilterChipContext<TItem, TValue> => {\n const value = this.optionValue()(option);\n return {\n $implicit: option,\n option,\n value,\n label: this.optionLabel()(option),\n };\n };\n\n /**\n * Internal multi-select state driven by chip toggles. Exposed as\n * a `model` so consumers may seed initial selection via\n * `[(selectedValues)]` if they need to; usually the consumer leaves\n * this internal and reads results via the parent\n * `CngxFilter.predicate`.\n */\n readonly selectedValues = model<TValue[]>([]);\n\n constructor() {\n const predicateFn = (item: TItem): boolean => {\n const values = this.selectedValues();\n if (values.length === 0) {\n return true;\n }\n const extract = this.keyFn();\n const key = extract(this.optionValue()(item));\n return values.some((v) => Object.is(extract(v), key));\n };\n\n // Binding effect: tracks only filterRef/filterKey, so a rebind moves the\n // registration. Cleanup is identity-guarded - it removes the key only\n // while it still maps to THIS strip's predicate, so tearing down one of\n // two strips sharing a key never detaches the live sibling.\n effect((onCleanup) => {\n const filter = this.filterRef();\n const key = this.filterKey();\n untracked(() => filter.addPredicate(key, predicateFn));\n onCleanup(() => {\n if (untracked(filter.predicates).get(key) === predicateFn) {\n untracked(() => filter.removePredicate(key));\n }\n });\n });\n\n // Eviction watcher: filter.clear() wipes the whole predicate map while\n // the chips stay visually selected. Re-register when our key is missing\n // so UI and predicate stack cannot diverge. A foreign same-key\n // registration is present, not missing - it is left alone (no fighting,\n // no loop).\n effect(() => {\n const filter = this.filterRef();\n const key = this.filterKey();\n if (!filter.predicates().has(key)) {\n untracked(() => filter.addPredicate(key, predicateFn));\n }\n });\n\n // Prune selections whose option vanished from [options]: without this a\n // removed option keeps filtering invisibly (no chip renders for it).\n effect(() => {\n const extract = this.keyFn();\n const valid = new Set(this.options().map((o) => extract(this.optionValue()(o))));\n const current = untracked(this.selectedValues);\n const pruned = current.filter((v) => valid.has(extract(v)));\n if (pruned.length !== current.length) {\n untracked(() => this.selectedValues.set(pruned));\n }\n });\n }\n}\n","import { computed, Directive, input, output, signal } from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\n/**\n * Atom directive that tracks pagination state (current page index and page size).\n *\n * Supports both **uncontrolled** (internal state) and **controlled** modes. \\\n * In controlled mode the `cngxPageIndex` / `cngxPageSize` inputs take precedence\n * over internal state - pair with \\\n * `pageChange` / `pageSizeChange` to keep them\n * in sync.\n *\n * Consumer connects this to a list or table via `range()` - nothing is injected\n * automatically.\n *\n * ```\n * // Headless: read range() from a template ref\n * <div cngxPaginate #pg=\"cngxPaginate\" [total]=\"items.length\">\n * @for (item of items.slice(pg.range()[0], pg.range()[1]); track item.id) { ... }\n * </div>\n *\n * // Drive any UI off the brain - e.g. a Material paginator wired by hand:\n * <mat-paginator\n * [length]=\"pg.total()\" [pageIndex]=\"pg.pageIndex()\" [pageSize]=\"pg.pageSize()\"\n * (page)=\"pg.setPageSize($event.pageSize, false); pg.setPage($event.pageIndex)\" />\n * ```\n * @category common/data/paginate\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate.directive.ts\n * @since 0.1.0\n * @relatedTo CngxSort, CngxFilter, CngxSmartDataSource\n *\n * <example-url>http://localhost:4200/#/common/data/data-source/datasource-cngxpaginate-manual-pipeline</example-url>\n * <example-url>http://localhost:4200/#/common/data/paginate-list/paginated-list-cngxpaginate-cngxmatpaginator</example-url>\n * <example-url>http://localhost:4200/#/common/data/paginate-list/uncontrolled-mode-zero-class-boilerplate</example-url>\n * <example-url>http://localhost:4200/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>\n */\n@Directive({\n selector: '[cngxPaginate]',\n exportAs: 'cngxPaginate',\n standalone: true,\n})\nexport class CngxPaginate {\n /** Controlled page index. When bound, takes precedence over internal state. */\n readonly pageIndexInput = input<number | undefined>(undefined, { alias: 'cngxPageIndex' });\n /** Controlled page size. When bound, takes precedence over internal state. */\n readonly pageSizeInput = input<number | undefined>(undefined, { alias: 'cngxPageSize' });\n /**\n * Total number of items (before pagination). Consumer binds this from the\n * filtered/sorted count so that `totalPages` stays accurate.\n */\n readonly total = input<number>(0);\n\n /**\n * Bind an async state - disables navigation while the data source is busy.\n * When set, `isBusy` derives from `state.isBusy()`. Navigation methods\n * (`setPage`, `next`, `previous`, etc.) are no-ops while busy.\n */\n readonly state = input<CngxAsyncState<unknown> | undefined>(undefined);\n\n /** `true` when the bound async state is busy (loading/refreshing). */\n readonly isBusy = computed(() => this.state()?.isBusy() ?? false);\n\n private readonly pageIndexState = signal(0);\n private readonly pageSizeState = signal(10);\n\n /** Current page index (0-based). Controlled input takes precedence. Auto-clamped to totalPages. */\n readonly pageIndex = computed(() => {\n const raw = this.pageIndexInput() ?? this.pageIndexState();\n const max = this.totalPages() - 1;\n return Math.min(raw, max);\n });\n /** Current page size. Controlled input takes precedence. */\n readonly pageSize = computed(() => this.pageSizeInput() ?? this.pageSizeState());\n\n /** Total number of pages (minimum 1). */\n readonly totalPages = computed(() => Math.max(1, Math.ceil(this.total() / this.pageSize())));\n\n /** `true` when on the first page. */\n readonly isFirst = computed(() => this.pageIndex() === 0);\n /** `true` when on the last page. */\n readonly isLast = computed(() => this.pageIndex() >= this.totalPages() - 1);\n\n /**\n * `[start, end]` indices for `Array.slice()` - always in-bounds.\n * Consumer: `items.slice(range()[0], range()[1])`.\n */\n readonly range = computed<[number, number]>(\n () => {\n const start = this.pageIndex() * this.pageSize();\n return [start, start + this.pageSize()];\n },\n { equal: (a, b) => a[0] === b[0] && a[1] === b[1] },\n );\n\n /**\n * `[0, end]` cumulative slice indices for append-don't-replace (load-more)\n * consumers: every page already stepped through, sliced from the top. `end`\n * is `(pageIndex + 1) * pageSize` - the count revealed so far, uncapped (a\n * partial final page is clamped by the consumer against `total`).\n * Pure derivation of `pageIndex` / `pageSize`; the explicit tuple `equal`\n * stops a fresh-array identity from cascading downstream.\n */\n readonly cumulativeRange = computed<[number, number]>(\n () => [0, (this.pageIndex() + 1) * this.pageSize()],\n { equal: (a, b) => a[0] === b[0] && a[1] === b[1] },\n );\n\n /**\n * `range()` with both bounds capped at `total` - the honest in-bounds window\n * for readouts and announcements. `range()`'s upper bound is\n * `start + pageSize`, so a partial final page overshoots `total`; this caps\n * it (and yields `[0, 0]` while the list is empty). The capped end doubles as\n * the cumulative reveal count for load-more consumers: `range()[1]` and\n * `cumulativeRange()[1]` are the same number (`(pageIndex + 1) * pageSize`),\n * so `clampedRange()[1]` is \"items shown so far\" in both replace and append\n * modes. The explicit tuple `equal` stops a fresh-array identity from\n * cascading downstream.\n */\n readonly clampedRange = computed<[number, number]>(\n () => {\n const total = this.total();\n const [start, end] = this.range();\n return [Math.min(start, total), Math.min(end, total)];\n },\n { equal: (a, b) => a[0] === b[0] && a[1] === b[1] },\n );\n\n /** Emitted when the page index changes. */\n readonly pageChange = output<number>();\n /** Emitted when the page size changes. */\n readonly pageSizeChange = output<number>();\n\n /**\n * Navigate to `index`, clamping to `[0, totalPages - 1]`.\n * Emits `pageChange`.\n */\n setPage(index: number): void {\n if (this.isBusy()) {\n return;\n }\n const clamped = Math.max(0, Math.min(index, this.totalPages() - 1));\n this.pageIndexState.set(clamped);\n this.pageChange.emit(clamped);\n }\n\n /**\n * Change page size and optionally reset to page 0.\n * Emits `pageSizeChange` and, when `resetPage` is `true`, `pageChange`.\n */\n setPageSize(size: number, resetPage = true): void {\n if (this.isBusy()) {\n return;\n }\n this.pageSizeState.set(size);\n this.pageSizeChange.emit(size);\n if (resetPage) {\n this.pageIndexState.set(0);\n this.pageChange.emit(0);\n }\n }\n\n /** Navigate to the next page (no-op on the last page). */\n next(): void {\n this.setPage(this.pageIndex() + 1);\n }\n\n /** Navigate to the previous page (no-op on the first page). */\n previous(): void {\n this.setPage(this.pageIndex() - 1);\n }\n\n /** Navigate to the first page. */\n first(): void {\n this.setPage(0);\n }\n\n /** Navigate to the last page. */\n last(): void {\n this.setPage(this.totalPages() - 1);\n }\n}\n","import { Directive, effect, inject, input, untracked } from '@angular/core';\n\nimport { CngxPaginate } from './paginate.directive';\n\n/**\n * Wires the reset-on-change behaviour onto a {@link CngxPaginate} brain: when\n * `key()` changes (after the initial run) the paginator jumps to the first\n * page. The first run captures the mounting value without resetting, and an\n * already-first paginator emits nothing.\n *\n * Shared by `[cngxPaginateResetOn]`, the `CngxPaginator` shell's `resetOn`\n * input, and the `CngxMatPaginator` bridge's `resetOn` input, so the behaviour\n * is byte-identical across all three. Call inside an injection context\n * (constructor or field initialiser).\n *\n * @category common/data/paginate\n * @since 0.1.0\n */\nexport function connectPaginateResetOn(paginate: CngxPaginate, key: () => unknown): void {\n let seen = false;\n effect(() => {\n key();\n if (!seen) {\n seen = true;\n return;\n }\n untracked(() => {\n if (paginate.pageIndex() !== 0) {\n paginate.setPage(0);\n }\n });\n });\n}\n\n/**\n * Resets a `cngxPaginate` host to the first page whenever the bound key\n * changes - the composable form of {@link connectPaginateResetOn}. \\\n * Drop it on the same element as `cngxPaginate` (or a `CngxPaginator` / `CngxMatPaginator`,\n * which provide the brain), and bind the sort / filter / search value a result\n * set depends on, so a narrowed result never strands the user on a now-empty\n * page.\n *\n * Bind a primitive or a `computed` - an inline array / object literal recomputes\n * every change-detection pass and would reset on each.\n *\n * ```html\n * <table cngxPaginate [cngxPaginateResetOn]=\"filter()\"><!-- ... --></table>\n * ```\n * <example-url>http://localhost:4200/#/ui/paginator/paginator-behaviors/reset-on-filter</example-url>\n *\n * @category common/data/paginate\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate-reset.directive.ts\n * @since 0.1.0\n * @relatedTo CngxPaginate, CngxPaginator, CngxMatPaginator\n */\n@Directive({\n selector: '[cngxPaginateResetOn]',\n exportAs: 'cngxPaginateResetOn',\n standalone: true,\n})\nexport class CngxPaginateResetOn {\n private readonly paginate = inject(CngxPaginate);\n\n /** The reset key. A change (after mount) jumps the paginator to page 0. */\n readonly key = input<unknown>(undefined, { alias: 'cngxPaginateResetOn' });\n\n constructor() {\n connectPaginateResetOn(this.paginate, this.key);\n }\n}\n","import { DestroyRef, effect, inject, untracked } from '@angular/core';\n\nimport type { CngxPaginate } from './paginate.directive';\n\n/**\n * Handlers the two-way emit bridge forwards page changes to - typically a\n * host component's `pageIndexChange` / `pageSizeChange` output emitters.\n *\n * @category common/data/paginate\n * @since 0.1.0\n */\nexport interface CngxPaginateEmitHandlers {\n /** Called once per effective page-index change. */\n readonly onIndex: (index: number) => void;\n /** Called once per effective page-size change. */\n readonly onSize: (size: number) => void;\n}\n\n/**\n * Wires the {@link CngxPaginate} brain's page / page-size changes onto a host's\n * two-way outputs with exactly-once emit semantics. Two paths feed each handler,\n * sharing a last-emitted guard:\n * - a subscription forwards the brain's nav-only `pageChange` / `pageSizeChange`\n * - the only signal that captures a controlled-mode `setPage`, because the\n * brain's `pageIndex()` stays pinned to the input until the consumer feeds it\n * back;\n * - an `effect()` reads the effective `pageIndex()` / `pageSize()` and covers a\n * `total`-shrink clamp the nav-only output misses. The index half of the\n * clamp path is suppressed while the brain is busy or `total` is 0, so a\n * transient total drop during a refetch never persists a page-0 clamp into a\n * controlled consumer; a clamp that survives the settle emits then.\n *\n * The shared guard makes a value one path already emitted a no-op on the other,\n * so each change emits exactly once. Seeded with the current effective values,\n * so wiring emits no initial change.\n *\n * Shared verbatim by the `CngxPaginator` shell and the `CngxIncrementalList`\n * organism, so the two-way emit behaviour is byte-identical. Call inside an\n * injection context (constructor or field initialiser) - it reads `DestroyRef`\n * and creates effects.\n *\n * @category common/data/paginate\n * @since 0.1.0\n */\nexport function connectPaginateEmit(\n paginate: CngxPaginate,\n handlers: CngxPaginateEmitHandlers,\n): void {\n const destroyRef = inject(DestroyRef);\n\n // Shared last-emitted guards across the nav (subscription) and clamp (effect)\n // paths. Plain locals, so the effects carry no signal write. Seeded with the\n // current effective values so wiring emits no initial change.\n let lastIndex = paginate.pageIndex();\n let lastSize = paginate.pageSize();\n\n // Nav path. Forwards the brain's nav-only outputs: in controlled mode a\n // setPage leaves the effective pageIndex() pinned to the input, so this event\n // is the only thing that reports the navigation.\n const indexSub = paginate.pageChange.subscribe((index) => {\n if (index !== lastIndex) {\n lastIndex = index;\n handlers.onIndex(index);\n }\n });\n const sizeSub = paginate.pageSizeChange.subscribe((size) => {\n if (size !== lastSize) {\n lastSize = size;\n handlers.onSize(size);\n }\n });\n destroyRef.onDestroy(() => {\n indexSub.unsubscribe();\n sizeSub.unsubscribe();\n });\n\n // Clamp path. The effective pageIndex moved without a nav (a total-shrink\n // clamp the nav-only pageChange misses). The shared guard means a value the\n // nav path already emitted is a no-op here, so each change emits once.\n effect(() => {\n const index = paginate.pageIndex();\n // A transient total drop (a refetch clearing [total] to 0) clamps the\n // effective index to 0; forwarding that would persist the clamp into a\n // controlled consumer's two-way state and pin page 0 after the data\n // returns, where the brain's read-time clamp alone would recover. Both\n // gates are tracked reads, so a clamp that survives the settle (a real\n // total shrink) emits when busy flips off / total refills.\n if (paginate.isBusy() || paginate.total() === 0) {\n return;\n }\n if (index !== lastIndex) {\n lastIndex = index;\n // Consumer handlers run synchronously - keep their signal reads/writes\n // out of this effect's dependency graph.\n untracked(() => handlers.onIndex(index));\n }\n });\n effect(() => {\n const size = paginate.pageSize();\n if (size !== lastSize) {\n lastSize = size;\n untracked(() => handlers.onSize(size));\n }\n });\n}\n","import {\n DestroyRef,\n Directive,\n effect,\n inject,\n input,\n type OnInit,\n signal,\n untracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, Router } from '@angular/router';\n\nimport { CngxPaginate } from './paginate.directive';\n\n/**\n * Persists a `cngxPaginate` host's page / size in the URL query string, so a\n * paginated view is deep-linkable and survives reload / back / forward.\n *\n * Drop it on the same element as `cngxPaginate` (or a `CngxPaginator` /\n * `CngxMatPaginator`, which provide the brain). The page is written 1-based\n * (`?page=2`) for human-readable URLs; the brain stays 0-based.\n *\n * ```html\n * <cngx-paginator cngxPaginateRouting [total]=\"items().length\"></cngx-paginator>\n * ```\n *\n * Two paginators on one route must take distinct param names via\n * `[cngxPaginatePageParam]` / `[cngxPaginateSizeParam]` to avoid a collision. \\\n * Requires `@angular/router` (`provideRouter`); without it the directive is an\n * inert no-op (a dev-mode warning is logged). Framework-agnostic of any UI - it\n * needs only the brain and the router.\n *\n * @category common/data/paginate\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate-routing.directive.ts\n * @since 0.1.0\n * @relatedTo CngxPaginate, CngxPaginator, CngxMatPaginator\n * <example-url>http://localhost:4200/#/ui/paginator/paginator-behaviors/url-synced-paging</example-url>\n */\n@Directive({\n selector: '[cngxPaginateRouting]',\n exportAs: 'cngxPaginateRouting',\n standalone: true,\n})\nexport class CngxPaginateRouting implements OnInit {\n private readonly paginate = inject(CngxPaginate);\n private readonly router = inject(Router, { optional: true });\n private readonly route = inject(ActivatedRoute, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n\n /** Query-param name for the 1-based page. */\n readonly pageParam = input('page', { alias: 'cngxPaginatePageParam' });\n /** Query-param name for the page size. */\n readonly sizeParam = input('pageSize', { alias: 'cngxPaginateSizeParam' });\n\n // Set synchronously around brain writes driven by the URL, so the\n // pageChange subscription below can tell a URL-driven change from a user\n // navigation (setPage/setPageSize emit synchronously).\n private applyingFromUrl = false;\n\n // A deep-linked page index the brain could not represent yet: setPage\n // clamps against totalPages (1 while the default total=0 is still in\n // effect) and no-ops entirely while the bound async state is busy. The raw\n // index is parked here and re-applied once total/busy settle; while it is\n // parked, the brain -> URL effect leaves the URL alone so the deep link\n // survives until the data lands. `size` is null once the size half has\n // been applied.\n private readonly pendingUrl = signal<{ index: number; size: number | null } | null>(null, {\n equal: (a, b) => a?.index === b?.index && a?.size === b?.size,\n });\n\n constructor() {\n const router = this.router;\n const route = this.route;\n if (!router || !route) {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n console.warn(\n '[cngxPaginateRouting]: no Router available - directive is a no-op. ' +\n 'Provide @angular/router via provideRouter(...) to enable URL-synced pagination.',\n );\n }\n return;\n }\n\n // A user navigation supersedes a still-parked deep link. The brain is\n // resolved through the element injector and may live on an ancestor, so\n // the subscription is torn down explicitly instead of relying on shared\n // lifecycles.\n const pageChangeSub = this.paginate.pageChange.subscribe(() => {\n if (!this.applyingFromUrl) {\n this.pendingUrl.set(null);\n }\n });\n this.destroyRef.onDestroy(() => pageChangeSub.unsubscribe());\n\n // brain -> URL. Tracks the effective page / size; merges into the existing\n // query string and replaces history so paging does not stack back entries.\n // The param-name inputs are read lazily inside untracked, so a late-bound\n // alias is already set by the time the first navigation fires. Skipped\n // while a deep link is parked and when the URL already carries the values\n // (the echo after a URL -> brain apply must not renavigate).\n effect(() => {\n const page = this.paginate.pageIndex() + 1;\n const size = this.paginate.pageSize();\n if (this.pendingUrl() !== null) {\n return;\n }\n untracked(() => {\n // Snapshot read while router.navigate is async: a still-pending\n // navigation can slip past this check and renavigate - benign under\n // replaceUrl + merge (same params, no history entry).\n const params = route.snapshot.queryParamMap;\n const samePage = Number(params.get(this.pageParam())) === page;\n const sameSize = Number(params.get(this.sizeParam())) === size;\n if (samePage && sameSize) {\n return;\n }\n void router.navigate([], {\n relativeTo: route,\n queryParams: { [this.pageParam()]: page, [this.sizeParam()]: size },\n queryParamsHandling: 'merge',\n replaceUrl: true,\n });\n });\n });\n\n // Re-apply a parked deep link whenever the clamp inputs move (total\n // landed, busy released). Only those two triggers are tracked; the parked\n // value is read untracked, so the re-park write inside applyFromUrl can\n // never feed back into this effect's own dependency graph.\n effect(() => {\n this.paginate.totalPages();\n this.paginate.isBusy();\n untracked(() => {\n const pending = this.pendingUrl();\n if (pending !== null) {\n this.applyFromUrl(pending.index, pending.size);\n }\n });\n });\n }\n\n ngOnInit(): void {\n const route = this.route;\n if (!route) {\n return;\n }\n // URL -> brain, wired in ngOnInit so the param-name inputs are resolved\n // before queryParamMap replays the current params on subscribe (a\n // deep-linked page / size therefore lands before first paint). The\n // subscription stays live for back / forward navigation.\n route.queryParamMap.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params) => {\n const rawSize = Number(params.get(this.sizeParam()));\n const rawPage = Number(params.get(this.pageParam()));\n const size = Number.isFinite(rawSize) && rawSize > 0 ? rawSize : null;\n const index = (Number.isFinite(rawPage) && rawPage > 0 ? rawPage : 1) - 1;\n this.applyFromUrl(index, size);\n });\n }\n\n private applyFromUrl(index: number, size: number | null): void {\n const paginate = this.paginate;\n if (paginate.isBusy()) {\n // Both setters no-op while busy - park the whole request and retry.\n this.pendingUrl.set({ index, size });\n return;\n }\n this.applyingFromUrl = true;\n try {\n if (size !== null && size !== paginate.pageSize()) {\n paginate.setPageSize(size, false);\n }\n if (index !== paginate.pageIndex()) {\n paginate.setPage(index);\n }\n } finally {\n this.applyingFromUrl = false;\n }\n if (paginate.pageIndex() === index || paginate.total() > 0) {\n // Landed, or clamped against a real total - the deep link is resolved.\n this.pendingUrl.set(null);\n } else {\n // Clamped against the default total=0: the real total has not arrived\n // yet, so keep the raw index parked (size, if any, is applied already).\n this.pendingUrl.set({ index, size: null });\n }\n }\n}\n","import { InjectionToken, type Signal } from '@angular/core';\n\n/**\n * A single bucket as the chips segment reads it - the label only. The match\n * predicate that decides membership stays internal to `CngxBucketPaginate`; a\n * presentation segment never needs it, only the label to render and the\n * derived empty/active state to reflect.\n *\n * @category common/data/paginate\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts\n * @since 0.1.0\n */\nexport interface CngxBucketPaginateView {\n /** Human-readable bucket label, e.g. `'A-C'`. Rendered as the chip text. */\n readonly label: string;\n}\n\n/**\n * Read-and-write contract a category/range chip strip (`cngx-pgn-alpha`)\n * injects instead of the concrete `CngxBucketPaginate` directive. \\\n * The directive provides it via `useExisting`, so a chip strip stays\n * decompose-ready - it talks to the token, never to the model class (DI\n * abstraction).\n *\n * The signals are the single derivation source for every chip's pressed and\n * disabled state; `select` / `clear` are the only write paths, each routing\n * through the directive's `active` model so the toggle invariant (re-selecting\n * the active bucket clears it) holds in one place.\n *\n * @category common/data/paginate\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts\n * @since 0.1.0\n */\nexport interface CngxBucketPaginateHost {\n /** The buckets to render, in declaration order. One chip per entry. */\n readonly buckets: Signal<readonly CngxBucketPaginateView[]>;\n /** Label of the active bucket, or `null` when no bucket is selected. */\n readonly active: Signal<string | null>;\n /**\n * `true` when no bound item matches the bucket's predicate. Derived from the\n * `items` / `buckets` inputs (never a synced flag); a chip binds its disabled\n * state to this so an empty bucket is a dead control with a stated reason.\n */\n isEmpty(label: string): boolean;\n /**\n * Select the bucket. Re-selecting the already-active bucket clears the\n * selection (toggle). No-op for an empty bucket.\n */\n select(label: string): void;\n /** Clear the active bucket (show the unfiltered collection). */\n clear(): void;\n}\n\n/**\n * DI token the `CngxBucketPaginate` range model provides via `useExisting`.\n * The category chips segment (`cngx-pgn-alpha`) injects this rather than the\n * concrete directive class, keeping the strip decompose-ready and the model\n * swappable.\n *\n * @category common/data/paginate\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts\n * @since 0.1.0\n */\nexport const CNGX_BUCKET_PAGINATE_HOST = new InjectionToken<CngxBucketPaginateHost>(\n 'CngxBucketPaginateHost',\n);\n","import { computed, Directive, input, model } from '@angular/core';\n\nimport {\n CNGX_BUCKET_PAGINATE_HOST,\n type CngxBucketPaginateHost,\n} from './bucket-paginate-host.token';\n\n/**\n * A category bucket: a label plus a predicate that decides which items fall\n * into it. The predicate keeps the model content-agnostic - the same directive\n * buckets by letter range, date band, price tier, or any other partition the\n * consumer expresses, without the brain knowing what it is bucketing.\n *\n * @category common/data/paginate\n */\nexport interface CngxBucket<T> {\n /** Human-readable bucket label, e.g. `'A-C'`. Rendered as the chip text. */\n readonly label: string;\n /** Returns `true` when `item` belongs to this bucket. */\n readonly match: (item: T) => boolean;\n}\n\n/** Two `ReadonlySet`s are equal when they hold the same members. */\nfunction setEquals(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\n if (a.size !== b.size) {\n return false;\n }\n for (const value of a) {\n if (!b.has(value)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Range/category pagination model - a sibling to {@link CngxPaginate}, NOT a\n * mode flag on it. Where `CngxPaginate` steps a page index over a slice window,\n * this directive partitions a collection into labelled buckets (letter ranges,\n * date bands, price tiers) and tracks which one is active. The page-index brain\n * stays single-responsibility; a consumer composes whichever model the data\n * calls for (Komposition statt Konfiguration).\n *\n * The empty/disabled state of every bucket is **derived**, never managed: a\n * bucket is empty when no bound item matches its predicate, computed from the\n * `items` / `buckets` inputs. There is no synced flag and no effect.\n *\n * `active` is the two-way primary value (a `model<string | null>()`):\n * `null` shows the unfiltered collection; a label filters to that bucket.\n * `select(label)` toggles - re-selecting the active bucket clears it.\n *\n * ```html\n * <div\n * cngxBucketPaginate\n * #bp=\"cngxBucketPaginate\"\n * [buckets]=\"letterBuckets\"\n * [items]=\"people\"\n * [(active)]=\"activeBucket\"\n * >\n * @for (p of bp.active() ? people.filter(byActiveBucket) : people; track p.id) { ... }\n * </div>\n * ```\n *\n * @category common/data/paginate\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate.directive.ts\n * @since 0.1.0\n * @relatedTo CngxPaginate, CngxFilter\n * <example-url>http://localhost:4200/#/ui/paginator/paginator-modes/alphabetical</example-url>\n */\n@Directive({\n selector: '[cngxBucketPaginate]',\n exportAs: 'cngxBucketPaginate',\n standalone: true,\n providers: [{ provide: CNGX_BUCKET_PAGINATE_HOST, useExisting: CngxBucketPaginate }],\n})\nexport class CngxBucketPaginate<T = unknown> implements CngxBucketPaginateHost {\n /** The buckets to partition into, in render order. One chip per entry. */\n readonly buckets = input<readonly CngxBucket<T>[]>([]);\n /** The collection the buckets test against. Drives the derived empty state. */\n readonly items = input<readonly T[]>([]);\n\n /**\n * Active bucket label, or `null` for the unfiltered collection. The two-way\n * primary value (`[(active)]`); a `model()` because it is the directive's\n * bindable state, not a derived read.\n */\n readonly active = model<string | null>(null);\n\n /**\n * Labels of every bucket whose predicate matches no bound item. A pure\n * `computed()` over `items` / `buckets` - the disabled chips read this, so\n * the empty state is derived, never synced. The explicit set `equal` stops a\n * fresh-`Set` identity from cascading downstream on every unrelated recompute.\n */\n private readonly emptyLabels = computed<ReadonlySet<string>>(\n () => {\n const items = this.items();\n const empties = new Set<string>();\n for (const bucket of this.buckets()) {\n if (!items.some((item) => bucket.match(item))) {\n empties.add(bucket.label);\n }\n }\n return empties;\n },\n { equal: setEquals },\n );\n\n /** `true` when no bound item falls into the bucket. */\n isEmpty(label: string): boolean {\n return this.emptyLabels().has(label);\n }\n\n /**\n * Select the bucket, or clear the selection when it is already active\n * (toggle). An empty bucket is a no-op - it never becomes the active filter.\n */\n select(label: string): void {\n if (this.isEmpty(label)) {\n return;\n }\n this.active.update((current) => (current === label ? null : label));\n }\n\n /** Clear the active bucket - show the unfiltered collection. */\n clear(): void {\n this.active.set(null);\n }\n}\n","import { DataSource } from '@angular/cdk/collections';\nimport { inject, Injector, type Signal } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport type { Observable } from 'rxjs';\n\n/**\n * Minimal CDK `DataSource` that bridges a Signal to the CDK table's\n * Observable-based data contract.\n *\n * No sort, filter, or search logic is included - the consumer builds a\n * `computed()` with any transformations and passes the result here.\n *\n * ```typescript\n * readonly processed = computed(() => {\n * let items = this.raw();\n * if (this.sort().sort()) { items = sortTree(items, ...); }\n * return items;\n * });\n * readonly dataSource = injectDataSource(this.processed);\n * ```\n *\n * @typeParam T - The row item type.\n *\n * @category common/data/data-source\n * @docsKind primary\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/data-source/data-source.ts\n * @since 0.1.0\n * @relatedTo CngxSmartDataSource, CngxSort, CngxFilter, CngxPaginate\n */\nexport class CngxDataSource<T> extends DataSource<T> {\n private readonly injector = inject(Injector);\n\n constructor(private readonly data: Signal<T[]>) {\n super();\n }\n\n override connect(): Observable<T[]> {\n return toObservable(this.data, { injector: this.injector });\n }\n\n override disconnect(): void {\n // Signal cleanup is handled by Angular's DestroyRef - no manual teardown needed.\n }\n}\n\n/**\n * Factory function for {@link CngxDataSource}.\n *\n * Must be called within an injection context (constructor or field initializer).\n *\n * ```typescript\n * readonly dataSource = injectDataSource(this.items);\n * ```\n *\n * @category common/data/data-source\n */\nexport function injectDataSource<T>(data: Signal<T[]>): CngxDataSource<T> {\n return new CngxDataSource(data);\n}\n","import { DataSource } from '@angular/cdk/collections';\nimport { computed, inject, Injector, type Signal } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { foldForMatching, injectLocale, memoize, type CngxAsyncState } from '@cngx/core/utils';\nimport { arrayEqual } from '@cngx/utils';\nimport type { Observable } from 'rxjs';\nimport { CngxPaginate } from '../paginate/paginate.directive';\nimport { CngxFilter } from '../filter/filter.directive';\nimport { CngxSort } from '../sort/sort.directive';\nimport { CngxSearch } from '@cngx/common/interactive';\n\ninterface FoldedFields {\n readonly locale: string;\n readonly raw: readonly string[];\n readonly folded: readonly string[];\n}\n\n/**\n * @internal Folded field values per row object. Keyed by the row, so it\n * cannot thrash and is collected with the rows; the raw strings are compared\n * on every read, so a row mutated in place is folded again.\n */\nconst FOLDED_FIELDS = new WeakMap<object, FoldedFields>();\n\nfunction rawFieldsOf(item: object): string[] {\n const raw: string[] = [];\n for (const v of Object.values(item)) {\n if (v !== null && v !== undefined && typeof v !== 'object') {\n raw.push(String(v as string | number | boolean | bigint));\n }\n }\n return raw;\n}\n\nfunction foldedFieldsOf(item: object, locale: string): readonly string[] {\n const raw = rawFieldsOf(item);\n const cached = FOLDED_FIELDS.get(item);\n if (cached?.locale === locale && arrayEqual(cached.raw, raw)) {\n return cached.folded;\n }\n const folded = raw.map((value) => foldForMatching(value, locale));\n FOLDED_FIELDS.set(item, { locale, raw, folded });\n return folded;\n}\n\n/**\n * @internal The default search: primitive field values, case and accents\n * ignored in `locale`. The term is folded once per term, each row's field\n * values once per row and locale, not on every keystroke.\n */\nconst defaultSearchFnFor = memoize(\n (locale: string): ((item: unknown, term: string) => boolean) => {\n let lastTerm = '';\n let lastFolded = '';\n return (item, term) => {\n if (term !== lastTerm) {\n lastTerm = term;\n lastFolded = foldForMatching(term, locale);\n }\n if (typeof item !== 'object' || item === null) {\n return foldForMatching(String(item), locale).includes(lastFolded);\n }\n return foldedFieldsOf(item, locale).some((value) => value.includes(lastFolded));\n };\n },\n { cacheLimit: 8 },\n);\n\nconst collatorFor = memoize(\n (locale: string) => new Intl.Collator(locale, { numeric: true, sensitivity: 'base' }),\n { cacheLimit: 32 },\n);\n\n/** @internal The default comparator: field values as text, collated in `locale`. */\nfunction defaultSortFnFor<T>(\n locale: string,\n): (a: T, b: T, field: string, dir: 'asc' | 'desc') => number {\n const collator = collatorFor(locale);\n const toStr = (v: unknown): string =>\n v === null || v === undefined || typeof v === 'object'\n ? ''\n : String(v as string | number | boolean | bigint);\n return (a, b, field, dir) => {\n const cmp = collator.compare(\n toStr((a as Record<string, unknown>)[field]),\n toStr((b as Record<string, unknown>)[field]),\n );\n return dir === 'asc' ? cmp : -cmp;\n };\n}\n\n/**\n * Optional customization for {@link CngxSmartDataSource}.\n *\n * @category common/data/data-source\n */\nexport interface CngxSmartDataSourceOptions<T> {\n /**\n * Custom full-text search function. Receives an item and the current search\n * term; return `true` to keep the item. Defaults to a substring match across\n * all primitive-valued properties that ignores case and accents in the app\n * locale.\n */\n searchFn?: (item: T, term: string) => boolean;\n /**\n * Custom sort comparator. Receives two items, the active field key, and\n * direction. Defaults to a string comparison collated in the app locale\n * (`CNGX_LOCALE`), numeric-aware and case- and accent-insensitive.\n */\n sortFn?: (a: T, b: T, field: string, direction: 'asc' | 'desc') => number;\n /**\n * Resolve the `CngxSort` atom explicitly instead of relying on injection.\n * A thunk, not an instance, so a `viewChild` that is `undefined` on the\n * first pass resolves on a later read. A thunk result takes precedence over\n * an injected instance whenever it yields one; on `undefined` / `null` the\n * source falls back to the injected atom - so with both present, the\n * injected atom drives the frames before the thunk's target mounts, and the\n * thunk cannot express \"use none\".\n * Use for atoms hosted below this source's injector, e.g.\n * `{ sort: () => this.grid()?.sort }` against a `CngxDataGridAccordion`.\n */\n sort?: () => CngxSort | null | undefined;\n /** Same as `sort`, for the `CngxFilter` atom. */\n filter?: () => CngxFilter<T> | null | undefined;\n /** Same as `sort`, for the `CngxSearch` atom. */\n search?: () => CngxSearch | null | undefined;\n /** Same as `sort`, for the `CngxPaginate` atom. */\n paginate?: () => CngxPaginate | null | undefined;\n}\n\nfunction isAsyncState<T>(source: Signal<T[]> | CngxAsyncState<T[]>): source is CngxAsyncState<T[]> {\n return 'status' in source && 'data' in source && 'isFirstLoad' in source;\n}\n\n/**\n * A CDK `DataSource` that optionally integrates with `CngxSort`,\n * `CngxFilter`, `CngxSearch`, and `CngxPaginate` present in the injection\n * tree. Each directive is injected optionally - if absent, that processing\n * step is skipped.\n *\n * Injection resolves UPWARD only. Any atom hosted by a descendant component\n * - a `hostDirective` on an element below the consumer's injector - is\n * invisible to these injects, and the matching step is silently skipped:\n * the atom's own state still toggles (headers flip their arrows) while the\n * rows never move. `CngxDataGridAccordion` is the case where this is always\n * true: it hosts `CngxSort` and `CngxFilter` on the group element. Hand\n * such atoms in through the options thunks instead:\n *\n * ```typescript\n * readonly grid = viewChild(CngxDataGridAccordion);\n * readonly dataSource = injectSmartDataSource(this.rows, {\n * sort: () => this.grid()?.sort,\n * filter: () => this.grid()?.filter,\n * });\n * ```\n *\n * Accepts either a plain `Signal<T[]>` or a `CngxAsyncState<T[]>`.\n * When a `CngxAsyncState` is provided, the data source exposes the full\n * UX state (`isLoading`, `isRefreshing`, `error`, `isEmpty`) so the\n * table can show skeleton rows, error states, and loading indicators.\n *\n * ```typescript\n * // Plain signal\n * readonly dataSource = injectSmartDataSource(this.items);\n *\n * // With async state - full UX lifecycle\n * readonly residents = injectAsyncState(() => this.api.getAll(this.filter()));\n * readonly dataSource = injectSmartDataSource(this.residents);\n * // dataSource.isLoading(), dataSource.error(), dataSource.isRefreshing()\n * ```\n *\n * @typeParam T - The row item type.\n *\n * @category common/data/data-source\n * @docsKind primary\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/data-source/smart-data-source.ts\n * @since 0.1.0\n * @relatedTo CngxDataSource, CngxSort, CngxFilter, CngxPaginate\n */\nexport class CngxSmartDataSource<T> extends DataSource<T> {\n private readonly injector = inject(Injector);\n private readonly injectedSort = inject(CngxSort, { optional: true });\n private readonly injectedFilter = inject(CngxFilter, { optional: true });\n // Injection resolves upward only; an atom below this injector (child\n // <input> search, a hosting organism's sort/filter) arrives via the\n // matching options thunk instead.\n private readonly injectedSearch = inject(CngxSearch, { optional: true });\n private readonly injectedPaginate = inject(CngxPaginate, { optional: true });\n private readonly locale = injectLocale();\n\n /**\n * Items after filter and search are applied, before sort and pagination.\n * Use `filteredCount()` to get the pre-pagination count for paginator `total`.\n */\n private readonly filtered: Signal<T[]>;\n\n /** Number of items after filtering/searching, before pagination. */\n readonly filteredCount: Signal<number>;\n\n private readonly processed: Signal<T[]>;\n\n /**\n * The async state source, or `undefined` if constructed from a plain\n * signal. Internal-only - consumers read the derived projections\n * (`isLoading`, `isRefreshing`, `isBusy`, `isFirstLoad`, `error`,\n * `isEmpty`, `filteredCount`) instead of the raw source identity.\n */\n private readonly asyncState: CngxAsyncState<T[]> | undefined;\n\n /** `true` during initial data load (skeleton phase). */\n readonly isLoading: Signal<boolean>;\n\n /** `true` during refresh (data stays visible, loading bar). */\n readonly isRefreshing: Signal<boolean>;\n\n /** `true` when any operation is running. Maps to `aria-busy`. */\n readonly isBusy: Signal<boolean>;\n\n /** `true` if no successful load has completed yet. */\n readonly isFirstLoad: Signal<boolean>;\n\n /** Error from the async state, or `undefined`. */\n readonly error: Signal<unknown>;\n\n /** `true` when data is empty AND no operation is running. */\n readonly isEmpty: Signal<boolean>;\n\n constructor(\n source: Signal<T[]> | CngxAsyncState<T[]>,\n private readonly options?: CngxSmartDataSourceOptions<T>,\n ) {\n super();\n\n let data: Signal<T[]>;\n if (isAsyncState(source)) {\n this.asyncState = source;\n data = computed(() => source.data() ?? []);\n } else {\n this.asyncState = undefined;\n data = source;\n }\n\n const s = this.asyncState;\n this.isLoading = computed(() => s?.isLoading() ?? false);\n this.isRefreshing = computed(() => s?.isRefreshing() ?? false);\n this.isBusy = computed(() => s?.isBusy() ?? false);\n this.isFirstLoad = computed(() => s?.isFirstLoad() ?? false);\n this.error = computed(() => s?.error());\n\n this.filtered = computed(\n () => {\n // Resolve at read time: an options thunk pointing at a not-yet-mounted\n // viewChild returns undefined now and the instance on a later pass.\n const filter = this.options?.filter?.() ?? this.injectedFilter;\n const search = this.options?.search?.() ?? this.injectedSearch;\n const predicate = filter?.predicate();\n const term = search?.term();\n const searchFn = this.options?.searchFn ?? defaultSearchFnFor(this.locale());\n\n // Pipeline: raw → filter → search. Cast required: CngxFilter injected as unknown.\n return data()\n .filter((v) => !predicate || (predicate as (v: T) => boolean)(v))\n .filter((item) => !term || searchFn(item, term));\n },\n { equal: arrayEqual },\n );\n\n this.filteredCount = computed(() => this.filtered().length);\n\n this.isEmpty = computed(() => {\n // During loading, not \"empty\" yet - show skeleton instead\n if (this.isBusy()) {\n return false;\n }\n return this.filteredCount() === 0;\n });\n\n this.processed = computed(\n () => {\n const sort = this.options?.sort?.() ?? this.injectedSort;\n const sorts = sort?.sorts() ?? [];\n const sortFn = this.options?.sortFn ?? defaultSortFnFor<T>(this.locale());\n\n const sorted =\n sorts.length > 0\n ? [...this.filtered()].sort((a, b) =>\n sorts.reduce(\n (cmp, { active, direction }) => cmp || sortFn(a, b, active, direction),\n 0,\n ),\n )\n : this.filtered();\n\n const paginate = this.options?.paginate?.() ?? this.injectedPaginate;\n const range = paginate?.range();\n return range ? sorted.slice(range[0], range[1]) : sorted;\n },\n { equal: arrayEqual },\n );\n }\n\n override connect(): Observable<T[]> {\n return toObservable(this.processed, { injector: this.injector });\n }\n\n override disconnect(): void {\n // Signal cleanup is handled by Angular's DestroyRef - no manual teardown needed.\n }\n}\n\n/**\n * Factory function for {@link CngxSmartDataSource}.\n *\n * Must be called within an injection context (constructor or field initializer).\n * Accepts either a plain `Signal<T[]>` or a `CngxAsyncState<T[]>` for\n * full UX state integration (loading, error, refresh, empty).\n *\n * ```typescript\n * // Plain signal\n * readonly dataSource = injectSmartDataSource(this.items);\n *\n * // With async state - table shows skeleton, error, loading bar\n * readonly residents = injectAsyncState(() => this.api.getAll());\n * readonly dataSource = injectSmartDataSource(this.residents);\n * ```\n *\n * @category common/data/data-source\n */\nexport function injectSmartDataSource<T>(\n source: Signal<T[]> | CngxAsyncState<T[]>,\n options?: CngxSmartDataSourceOptions<T>,\n): CngxSmartDataSource<T> {\n return new CngxSmartDataSource(source, options);\n}\n","import { computed, signal } from '@angular/core';\nimport { buildAsyncStateView, type AsyncStatus, type CngxAsyncState } from '@cngx/core/utils';\n\n/**\n * Writable extension of `CngxAsyncState` for manual control.\n *\n * Returned by `createManualState()` - provides imperative setters\n * while the read-side stays the standard `CngxAsyncState` interface.\n *\n * @category common/data/async-state\n */\nexport interface ManualAsyncState<T> extends CngxAsyncState<T> {\n /** Set the status directly. */\n set(status: AsyncStatus): void;\n\n /** Transition to `success` with data. */\n setSuccess(data: T): void;\n\n /** Transition to `error`. */\n setError(error: unknown): void;\n\n /** Set progress (0–100). */\n setProgress(value: number | undefined): void;\n\n /** Reset to `idle`, clear data, error, and progress. */\n reset(): void;\n}\n\n/**\n * Create a fully manual async state - no HTTP, no automatic loading.\n *\n * Use for local operations: heavy computations, Web Workers, complex local processes.\n * Does **not** require an injection context - uses only `signal()` and `computed()`.\n *\n * ```typescript\n * readonly processState = createManualState<ProcessResult>();\n *\n * async handleProcess(): Promise<void> {\n * this.processState.set('loading');\n * this.processState.setProgress(0);\n * const result = await heavyComputation((p) => this.processState.setProgress(p));\n * this.processState.setSuccess(result);\n * }\n * ```\n *\n * @category common/data/async-state\n */\nexport function createManualState<T>(): ManualAsyncState<T> {\n const statusState = signal<AsyncStatus>('idle');\n const dataState = signal<T | undefined>(undefined);\n const errorState = signal<unknown>(undefined);\n const progressState = signal<number | undefined>(undefined);\n const lastUpdatedState = signal<Date | undefined>(undefined);\n const hadSuccess = signal(false);\n\n const view = buildAsyncStateView<T>({\n status: statusState.asReadonly(),\n data: dataState.asReadonly(),\n error: errorState.asReadonly(),\n progress: progressState.asReadonly(),\n isFirstLoad: computed(() => !hadSuccess()),\n lastUpdated: lastUpdatedState.asReadonly(),\n });\n\n return {\n ...view,\n\n set(newStatus: AsyncStatus): void {\n statusState.set(newStatus);\n if (newStatus === 'success') {\n // Parity with setSuccess: a success transition must not leave stale\n // error/progress residue behind.\n errorState.set(undefined);\n progressState.set(undefined);\n hadSuccess.set(true);\n lastUpdatedState.set(new Date());\n }\n },\n\n setSuccess(value: T): void {\n dataState.set(value);\n errorState.set(undefined);\n progressState.set(undefined);\n hadSuccess.set(true);\n lastUpdatedState.set(new Date());\n statusState.set('success');\n },\n\n setError(err: unknown): void {\n errorState.set(err);\n progressState.set(undefined);\n statusState.set('error');\n },\n\n setProgress(value: number | undefined): void {\n progressState.set(value);\n },\n\n reset(): void {\n statusState.set('idle');\n dataState.set(undefined);\n errorState.set(undefined);\n progressState.set(undefined);\n lastUpdatedState.set(undefined);\n hadSuccess.set(false);\n },\n };\n}\n","import { computed, Injectable, signal, type Signal } from '@angular/core';\nimport { nextUid, type AsyncStatus, type CngxAsyncState } from '@cngx/core/utils';\n\n/** @internal One registered async operation: its display label and its state. */\ninterface AsyncOperationEntry {\n readonly label?: string;\n readonly state: CngxAsyncState<unknown>;\n}\n\n/**\n * Read-only snapshot of one registered async operation.\n *\n * @category common/data/async-registry\n */\nexport interface CngxAsyncOperation {\n /** Per-operation uid minted at registration (`register`'s return value). */\n readonly id: string;\n /** Human-readable label, if one was supplied. Display only, never a key. */\n readonly label?: string;\n /** The operation's current status. */\n readonly status: AsyncStatus;\n}\n\n/** @internal Length-then-key-set equality for the operations Map signal. */\nfunction mapKeySetEqual<K, V>(a: ReadonlyMap<K, V>, b: ReadonlyMap<K, V>): boolean {\n if (a === b) {\n return true;\n }\n if (a.size !== b.size) {\n return false;\n }\n for (const key of a.keys()) {\n if (!b.has(key)) {\n return false;\n }\n }\n return true;\n}\n\n/** @internal Element-wise equality on (id, label, status) for the view array. */\nfunction operationsEqual(\n a: readonly CngxAsyncOperation[],\n b: readonly CngxAsyncOperation[],\n): boolean {\n if (a === b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n const x = a[i];\n const y = b[i];\n if (x.id !== y.id || x.label !== y.label || x.status !== y.status) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Opt-in aggregation registry for in-flight async operations.\n *\n * A single derived source for \"is anything loading?\" across a whole app: the\n * shell binds one `isAnythingLoading()` instead of N hand-maintained flags.\n * Producers register their `CngxAsyncState` (via `injectAsyncState({ register:\n * true })`, the HTTP interceptor, or directly) and unregister on teardown.\n *\n * Not `providedIn: 'root'` - consumers opt in with {@link provideAsyncRegistry}.\n * When the registry is absent, producers skip registration entirely.\n *\n * **Keyed by a per-operation uid, not the human label.** Async operations are\n * transient and collide on label; uid identity keeps N concurrent same-label\n * (or unlabeled) operations independent, so one `unregister` evicts exactly\n * its own entry. This is the one deliberate divergence from `CngxErrorRegistry`\n * (which keys by a stable scope name).\n *\n * Both views are `computed()` only - no `effect`, no service calls. Inner\n * status reactivity flows through each entry's `CngxAsyncState` signals; the\n * Map signal's `mapKeySetEqual` short-circuits register/unregister churn\n * without hiding status changes.\n *\n * @category common/data/async-registry\n */\n@Injectable()\nexport class CngxAsyncRegistry {\n private readonly entriesState = signal<ReadonlyMap<string, AsyncOperationEntry>>(new Map(), {\n equal: mapKeySetEqual,\n });\n\n /**\n * `true` when at least one registered operation reports `isLoading()`\n * (`loading`, `pending`, or `refreshing`).\n */\n readonly isAnythingLoading: Signal<boolean> = computed(() => {\n for (const entry of this.entriesState().values()) {\n if (entry.state.isLoading()) {\n return true;\n }\n }\n return false;\n });\n\n /** Every registered operation with its current status, in registration order. */\n readonly activeOperations: Signal<readonly CngxAsyncOperation[]> = computed(\n () =>\n Array.from(this.entriesState(), ([id, entry]) => ({\n id,\n label: entry.label,\n status: entry.state.status(),\n })),\n { equal: operationsEqual },\n );\n\n /**\n * Registers an async state under a fresh per-operation uid and returns it.\n * The optional `label` is display metadata only - never the map key, so\n * concurrent same-label (or unlabeled) operations stay independent.\n */\n register(state: CngxAsyncState<unknown>, label?: string): string {\n const id = nextUid('cngx-async-op');\n const next = new Map(this.entriesState());\n next.set(id, { label, state });\n this.entriesState.set(next);\n return id;\n }\n\n /** Removes the operation with the given uid. No-op if absent. */\n unregister(id: string): void {\n const current = this.entriesState();\n if (!current.has(id)) {\n return;\n }\n const next = new Map(current);\n next.delete(id);\n this.entriesState.set(next);\n }\n}\n","import { type EnvironmentProviders, inject, makeEnvironmentProviders } from '@angular/core';\nimport { CngxAsyncRegistry } from './async-registry';\n\n/**\n * Provides {@link CngxAsyncRegistry} in the host environment.\n *\n * Opt-in - not `providedIn: 'root'`. Add it to `bootstrapApplication`\n * providers to enable app-wide async observability; producers that opt in\n * (`injectAsyncState({ register: true })`, `provideAsyncHttpObservability()`)\n * then surface in `isAnythingLoading()` / `activeOperations()`.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [provideAsyncRegistry()],\n * });\n * ```\n *\n * @category common/data/async-registry\n */\nexport function provideAsyncRegistry(): EnvironmentProviders {\n return makeEnvironmentProviders([CngxAsyncRegistry]);\n}\n\n/**\n * Returns the ambient {@link CngxAsyncRegistry}, or `null` when the consumer\n * did not opt in via {@link provideAsyncRegistry}. Must run in an injection\n * context.\n *\n * @category common/data/async-registry\n */\nexport function injectAsyncRegistry(): CngxAsyncRegistry | null {\n return inject(CngxAsyncRegistry, { optional: true });\n}\n","import { DestroyRef, inject } from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\nimport { firstValueFrom, isObservable, type Observable } from 'rxjs';\n\nimport { createManualState, type ManualAsyncState } from './create-manual-state';\nimport { injectAsyncRegistry } from '../async-registry/provide-async-registry';\n\n/**\n * Configuration options for `createAsyncState`.\n *\n * @category common/data/async-state\n */\nexport interface CreateAsyncStateOptions {\n /**\n * Human-readable label surfaced in `CngxAsyncRegistry.activeOperations`.\n * Display only - never the registry key. Ignored unless `register` is set.\n */\n label?: string;\n\n /**\n * When `true`, register this state in the ambient `CngxAsyncRegistry` (if\n * one is provided via `provideAsyncRegistry()`) for the injector's lifetime,\n * and unregister automatically on destroy. Defaults to `false` - a no-op for\n * existing callers, and a no-op when no registry is provided.\n */\n register?: boolean;\n}\n\n/**\n * Writable async state for mutations (POST/PUT/DELETE).\n *\n * Extends the read-only `CngxAsyncState` with an `execute()` method\n * that runs an async action and manages the full lifecycle.\n *\n * @category common/data/async-state\n */\nexport interface MutableAsyncState<T> extends CngxAsyncState<T> {\n /**\n * Execute an async action.\n *\n * Sets status to `pending`, then `success` or `error` on completion.\n * Supersedes any in-flight execution - the previous result is discarded\n * but the underlying network request is not aborted.\n */\n execute(fn: () => Promise<T> | Observable<T>): Promise<void>;\n\n /** Report progress (0–100) during execution. */\n reportProgress(value: number): void;\n\n /** Reset to `idle`, clear data, error, and progress. */\n reset(): void;\n}\n\n/**\n * Create a mutation async state - for explicit user-triggered actions.\n *\n * Must be called in an injection context (field initializer or constructor)\n * because it uses `inject(DestroyRef)` for cleanup.\n *\n * ```typescript\n * readonly saveResident = createAsyncState<Resident>();\n *\n * async handleSave(): Promise<void> {\n * await this.saveResident.execute(\n * () => this.api.save(this.form().value())\n * );\n * }\n * ```\n *\n * @category common/data/async-state\n */\nexport function createAsyncState<T>(options?: CreateAsyncStateOptions): MutableAsyncState<T> {\n const destroyRef = inject(DestroyRef);\n const state: ManualAsyncState<T> = createManualState<T>();\n\n let abortController: AbortController | undefined;\n\n destroyRef.onDestroy(() => {\n abortController?.abort();\n abortController = undefined;\n });\n\n // Same opt-in observability injectAsyncState offers: without it, mutations\n // built here are invisible to CngxAsyncRegistry.isAnythingLoading.\n if (options?.register) {\n const registry = injectAsyncRegistry();\n if (registry) {\n const operationId = registry.register(state, options.label);\n destroyRef.onDestroy(() => registry.unregister(operationId));\n }\n }\n\n return {\n status: state.status,\n data: state.data,\n error: state.error,\n progress: state.progress,\n isLoading: state.isLoading,\n isPending: state.isPending,\n isRefreshing: state.isRefreshing,\n isBusy: state.isBusy,\n isFirstLoad: state.isFirstLoad,\n isEmpty: state.isEmpty,\n hasData: state.hasData,\n isSettled: state.isSettled,\n lastUpdated: state.lastUpdated,\n\n async execute(fn: () => Promise<T> | Observable<T>): Promise<void> {\n abortController?.abort();\n const controller = new AbortController();\n abortController = controller;\n\n state.set('pending');\n state.setProgress(undefined);\n\n try {\n const result$ = fn();\n const result = isObservable(result$) ? await firstValueFrom(result$) : await result$;\n\n if (controller.signal.aborted) {\n return;\n }\n\n state.setSuccess(result);\n } catch (err: unknown) {\n if (controller.signal.aborted) {\n return;\n }\n state.setError(err);\n } finally {\n if (abortController === controller) {\n abortController = undefined;\n }\n }\n },\n\n reportProgress(value: number): void {\n state.setProgress(value);\n },\n\n reset(): void {\n abortController?.abort();\n abortController = undefined;\n state.reset();\n },\n };\n}\n","import { computed } from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\n/**\n * Wraps a *changing* source of async state in a stable\n * {@link CngxAsyncState} façade.\n *\n * A component that receives its state through an `Input` cannot publish that\n * object through `CNGX_STATEFUL` directly: the token is resolved once when a\n * bridge injects it, while the input can be rebound or absent. Capturing the\n * object would hand the bridge a stale state - or `undefined` before the\n * first binding.\n *\n * This returns one object whose every member is a `computed()` that reads the\n * source on each access, so bridges observe transitions of whatever is bound\n * right now. With nothing bound it reports a quiet `idle` state rather than\n * throwing, which is what lets a bridge sit inside a timeline that has not\n * been given a state yet.\n *\n * Contrast the select family, which provides `CNGX_STATEFUL` with\n * `useFactory` over a concrete `commitState` field - no forwarding needed\n * there, because the state is created by the component rather than passed in.\n * The split is not about the component, it is about where the state is born:\n * created locally, capture it; arriving through an `Input`, forward it.\n *\n * ```ts\n * readonly asyncState = createForwardedAsyncState(this.state);\n *\n * // providers:\n * { provide: CNGX_STATEFUL, useFactory: () => ({ state: inject(Host).asyncState }) }\n * ```\n *\n * @category common/data/async-state\n * @relatedTo createAsyncState, createManualState\n * @since 0.1.0\n */\nexport function createForwardedAsyncState<T>(\n source: () => CngxAsyncState<T> | undefined,\n): CngxAsyncState<T> {\n return {\n status: computed(() => source()?.status() ?? 'idle'),\n data: computed(() => source()?.data()),\n error: computed(() => source()?.error()),\n progress: computed(() => source()?.progress()),\n isLoading: computed(() => source()?.isLoading() ?? false),\n isPending: computed(() => source()?.isPending() ?? false),\n isRefreshing: computed(() => source()?.isRefreshing() ?? false),\n isBusy: computed(() => source()?.isBusy() ?? false),\n isFirstLoad: computed(() => source()?.isFirstLoad() ?? true),\n isEmpty: computed(() => source()?.isEmpty() ?? true),\n hasData: computed(() => source()?.hasData() ?? false),\n isSettled: computed(() => source()?.isSettled() ?? false),\n lastUpdated: computed(() => source()?.lastUpdated()),\n };\n}\n","import { DestroyRef, effect, inject, untracked } from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\nimport { isObservable, type Observable, type Subscription } from 'rxjs';\n\nimport { createManualState, type ManualAsyncState } from './create-manual-state';\nimport { injectAsyncRegistry } from '../async-registry/provide-async-registry';\n\n/**\n * Configuration options for `injectAsyncState`.\n *\n * @category common/data/async-state\n */\nexport interface InjectAsyncStateOptions {\n /**\n * Debounce time in ms for signal dependency changes.\n * Coalesces rapid changes into one state transition and one consumed\n * result. Note: a promise-returning `fn` still runs once per change -\n * the invocation is what tracks its signals - but only the freshest\n * capture is consumed; superseded captures are observed and discarded.\n * Cold Observables cost nothing until subscribed, so for them the\n * debounce fully prevents request storms.\n * @default 50\n */\n debounce?: number;\n\n /**\n * Human-readable label surfaced in `CngxAsyncRegistry.activeOperations`.\n * Display only - never the registry key. Ignored unless `register` is set.\n */\n label?: string;\n\n /**\n * When `true`, register this state in the ambient `CngxAsyncRegistry` (if\n * one is provided via `provideAsyncRegistry()`) for the injector's lifetime,\n * and unregister automatically on destroy. Defaults to `false` - a no-op for\n * existing callers, and a no-op when no registry is provided.\n */\n register?: boolean;\n}\n\n/**\n * Reactive async state returned by `injectAsyncState`.\n *\n * Extends the read-only `CngxAsyncState` with a `refresh()` method\n * to explicitly re-trigger the query.\n *\n * @category common/data/async-state\n */\nexport interface ReactiveAsyncState<T> extends CngxAsyncState<T> {\n /** Explicitly re-trigger the query. */\n refresh(): void;\n}\n\n/**\n * Create a reactive async state that auto-loads when signal dependencies change.\n *\n * Must be called in an injection context (field initializer or constructor).\n * The computation function is tracked by Angular's `effect()` - any signal\n * read inside `fn` will cause a re-load when it changes.\n *\n * ```typescript\n * readonly residents = injectAsyncState(\n * () => this.api.getResidents(this.filter())\n * );\n * // Loads automatically when filter() changes.\n * // Caches last result during refresh (refreshing state).\n * // Deduplicates parallel requests.\n * ```\n *\n * @category common/data/async-state\n */\nexport function injectAsyncState<T>(\n fn: () => Promise<T> | Observable<T>,\n options?: InjectAsyncStateOptions,\n): ReactiveAsyncState<T> {\n const destroyRef = inject(DestroyRef);\n const state: ManualAsyncState<T> = createManualState<T>();\n const debounceMs = options?.debounce ?? 50;\n\n let activeSubscription: Subscription | undefined;\n let abortController: AbortController | undefined;\n let debounceTimer: ReturnType<typeof setTimeout> | undefined;\n\n function cancelInFlight(): void {\n activeSubscription?.unsubscribe();\n activeSubscription = undefined;\n abortController?.abort();\n abortController = undefined;\n }\n\n destroyRef.onDestroy(() => {\n cancelInFlight();\n if (debounceTimer !== undefined) {\n clearTimeout(debounceTimer);\n debounceTimer = undefined;\n }\n });\n\n // Opt-in observability: register with the ambient CngxAsyncRegistry (if any)\n // under a fresh per-operation uid, and unregister on destroy. No-op when the\n // caller did not opt in, or when no registry is provided.\n if (options?.register) {\n const registry = injectAsyncRegistry();\n if (registry) {\n const operationId = registry.register(state, options.label);\n destroyRef.onDestroy(() => registry.unregister(operationId));\n }\n }\n\n function executeQuery(computation: () => Promise<T> | Observable<T>): void {\n cancelInFlight();\n\n // first load -> loading, subsequent -> refreshing\n const status = untracked(state.isFirstLoad) ? 'loading' : 'refreshing';\n state.set(status);\n\n const result$ = computation();\n\n if (isObservable(result$)) {\n let hasEmitted = false;\n activeSubscription = result$.subscribe({\n next: (value) => {\n hasEmitted = true;\n state.setSuccess(value);\n },\n error: (err: unknown) => state.setError(err),\n complete: () => {\n if (!hasEmitted) {\n // completed without emitting -> empty success\n state.setSuccess(undefined as T);\n }\n },\n });\n } else {\n const controller = new AbortController();\n abortController = controller;\n\n result$\n .then(\n (value) => {\n if (!controller.signal.aborted) {\n state.setSuccess(value);\n }\n },\n (err: unknown) => {\n if (!controller.signal.aborted) {\n state.setError(err);\n }\n },\n )\n .finally(() => {\n if (abortController === controller) {\n abortController = undefined;\n }\n });\n }\n }\n\n // fn() runs once per cycle; signals read inside it track via effect.\n // Result is captured and run after debounce.\n effect(() => {\n let result: Promise<T> | Observable<T>;\n try {\n result = fn();\n } catch (err: unknown) {\n // sync throw (e.g. required signal not yet set) - debounce the error\n // to match the async path\n if (debounceTimer !== undefined) {\n clearTimeout(debounceTimer);\n }\n debounceTimer = setTimeout(() => {\n debounceTimer = undefined;\n state.setError(err);\n }, debounceMs);\n return;\n }\n\n if (debounceTimer !== undefined) {\n clearTimeout(debounceTimer);\n }\n\n const captured = result;\n if (!isObservable(captured)) {\n // The promise's work is already running (the invocation is the\n // tracking probe). A rapid follow-up change supersedes this capture\n // before the timer consumes it - observe the rejection here so a\n // superseded failure never surfaces as an unhandled rejection.\n captured.then(undefined, () => undefined);\n }\n debounceTimer = setTimeout(() => {\n debounceTimer = undefined;\n void executeQuery(() => captured);\n }, debounceMs);\n });\n\n return {\n status: state.status,\n data: state.data,\n error: state.error,\n progress: state.progress,\n isLoading: state.isLoading,\n isPending: state.isPending,\n isRefreshing: state.isRefreshing,\n isBusy: state.isBusy,\n isFirstLoad: state.isFirstLoad,\n isEmpty: state.isEmpty,\n hasData: state.hasData,\n isSettled: state.isSettled,\n lastUpdated: state.lastUpdated,\n\n refresh(): void {\n if (debounceTimer !== undefined) {\n clearTimeout(debounceTimer);\n debounceTimer = undefined;\n }\n void executeQuery(fn);\n },\n };\n}\n","import type { AsyncStatus } from '@cngx/core/utils';\n\n/**\n * Possible view states for async content rendering.\n *\n * @category common/data/async-state\n */\nexport type AsyncView = 'none' | 'skeleton' | 'content' | 'empty' | 'error' | 'content+error';\n\n/**\n * Pure function that resolves which view to show based on async state.\n *\n * Encodes the state machine as a lookup table - no branching:\n *\n * | status | firstLoad | empty | view |\n * |-------------|-----------|-------|---------------|\n * | idle | true | * | none |\n * | loading | true | * | skeleton |\n * | refreshing | true | * | skeleton |\n * | pending | true | * | skeleton |\n * | error | true | * | error |\n * | success | * | true | empty |\n * | error | false | * | content+error |\n * | (all other) | * | * | content |\n *\n * @category common/data/async-state\n */\nexport function resolveAsyncView(\n status: AsyncStatus,\n firstLoad: boolean,\n empty: boolean,\n): AsyncView {\n if (firstLoad) {\n switch (status) {\n case 'idle':\n return 'none';\n case 'loading':\n case 'refreshing':\n case 'pending':\n return 'skeleton';\n case 'error':\n return 'error';\n }\n }\n\n if (status === 'success' && empty) {\n return 'empty';\n }\n\n if (status === 'error') {\n return 'content+error';\n }\n\n return 'content';\n}\n","import { computed, Directive, input } from '@angular/core';\nimport {\n CNGX_STATEFUL,\n createAggregateAsyncState,\n type CngxAsyncState,\n type CngxStateful,\n} from '@cngx/core/utils';\n\n/**\n * One keyed upstream source feeding a {@link CngxAsyncBoundary}.\n *\n * The `key` (and optional `label`) travel with the state so per-source\n * attribution never relies on a parallel index array (Pillar 1).\n *\n * @category common/data/async-state\n * @since 0.1.0\n */\nexport interface AggregateSource<T = unknown> {\n /** Stable identity for this source, used to key attribution and `@for`. */\n readonly key: string;\n /** Human-readable label for the source, surfaced in the failures list. */\n readonly label?: string;\n /** The upstream state this source contributes to the aggregate. */\n readonly state: CngxAsyncState<T>;\n}\n\n/**\n * One errored source, surfaced by {@link CngxAsyncBoundary.failures}.\n *\n * @category common/data/async-state\n * @since 0.1.0\n */\nexport interface AggregateFailure {\n /** The failing source's key. */\n readonly key: string;\n /** The failing source's label, if it declared one. */\n readonly label?: string;\n /** The raw error from that source. */\n readonly error: unknown;\n}\n\n/**\n * Headless boundary that aggregates N keyed `CngxAsyncState`s into one derived\n * `CngxAsyncState` and provides it as `CNGX_STATEFUL`.\n *\n * The aggregate `state` is a first-class `CngxAsyncState`, so it renders\n * through `<cngx-async-container [state]=\"b.state\">` and every other consumer\n * unchanged, and any transition bridge (`cngxToastOn`, `cngxAlertOn`,\n * `cngxBannerOn`) nested in the host fires on the combined status with zero\n * `[state]` wiring. `failures` exposes the errored sources - keyed, so a\n * consumer's `@for` can render per-source attribution through any feedback\n * component. `state.error` stays the first error for the single-error path.\n *\n * ```html\n * <div [cngxAsyncBoundary]=\"sources\" #b=\"cngxAsyncBoundary\">\n * <cngx-async-container [state]=\"b.state\"> ... </cngx-async-container>\n * <cngx-toast-on />\n * @for (f of b.failures(); track f.key) {\n * <cngx-banner>{{ f.label }} failed</cngx-banner>\n * }\n * </div>\n * ```\n *\n * @category common/data/async-state\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async-state/async-boundary.directive.ts\n * @since 0.1.0\n */\n@Directive({\n selector: '[cngxAsyncBoundary]',\n standalone: true,\n exportAs: 'cngxAsyncBoundary',\n providers: [{ provide: CNGX_STATEFUL, useExisting: CngxAsyncBoundary }],\n host: {\n '[attr.aria-busy]': 'state.isBusy() || null',\n },\n})\nexport class CngxAsyncBoundary implements CngxStateful<readonly unknown[]> {\n /** The keyed source list to aggregate. */\n readonly sources = input.required<readonly AggregateSource[]>({ alias: 'cngxAsyncBoundary' });\n\n private readonly states = computed(() => this.sources().map((s) => s.state), {\n equal: (a, b) => a.length === b.length && a.every((s, i) => s === b[i]),\n });\n\n /** The derived aggregate state - also exposed via `CNGX_STATEFUL`. */\n readonly state = createAggregateAsyncState(this.states);\n\n /** The errored sources, keyed for per-source attribution. */\n readonly failures = computed<readonly AggregateFailure[]>(\n () =>\n this.sources()\n .filter((s) => s.state.status() === 'error')\n .map((s) => ({ key: s.key, label: s.label, error: s.state.error() })),\n {\n equal: (a, b) =>\n a.length === b.length &&\n a.every((f, i) => f.key === b[i].key && Object.is(f.error, b[i].error)),\n },\n );\n}\n","import { computed, effect, type Resource, signal, type Signal } from '@angular/core';\nimport { type AsyncStatus, buildAsyncStateView, type CngxAsyncState } from '@cngx/core/utils';\n\n/**\n * Shared projection core for the two resource bridges (`fromResource`,\n * `fromHttpResource`). Derives every flag through `buildAsyncStateView`, so\n * the family semantics (`isLoading` includes pending/refreshing,\n * `isBusy === isLoading`) cannot drift between the bridges and the factories.\n *\n * Must be called in an injection context (the tracking `effect()` requires one).\n *\n * @internal\n */\nexport function buildResourceBridge<T>(\n ref: Resource<T>,\n progress?: Signal<number | undefined>,\n): CngxAsyncState<T> {\n // ResourceStatus has no \"first load\" concept, so a successful load is\n // latched here together with its timestamp.\n const hadSuccess = signal(false);\n const lastUpdated = signal<Date | undefined>(undefined);\n\n effect(() => {\n const s = ref.status();\n if (s === 'resolved' || s === 'local') {\n hadSuccess.set(true);\n lastUpdated.set(new Date());\n }\n });\n\n const status = computed((): AsyncStatus => {\n switch (ref.status()) {\n case 'idle':\n return 'idle';\n case 'loading':\n return 'loading';\n case 'reloading':\n return 'refreshing';\n case 'resolved':\n case 'local':\n return 'success';\n case 'error':\n return 'error';\n }\n });\n\n return buildAsyncStateView<T>({\n status,\n data: computed(() => (ref.hasValue() ? ref.value() : undefined)),\n error: computed(() => ref.error()),\n progress,\n // Idle counts as \"before the first load\": a not-yet-triggered resource\n // still shows the skeleton, not the empty state.\n isFirstLoad: computed(() => !hadSuccess() && (ref.isLoading() || status() === 'idle')),\n lastUpdated: lastUpdated.asReadonly(),\n });\n}\n","import { type Resource } from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\nimport { buildResourceBridge } from './resource-bridge';\n\n/**\n * Bridge that projects an Angular `Resource<T>` onto `CngxAsyncState<T>`.\n *\n * Must be called in an injection context (the `effect()` that tracks\n * `hadSuccess` requires one).\n *\n * All signals are derived reactively from the resource - no manual\n * synchronization. The resource stays the single source of truth.\n *\n * ```typescript\n * private readonly res = resource({\n * request: () => ({ filter: this.filter() }),\n * loader: ({ request, abortSignal }) =>\n * fetch(`/api/items?q=${request.filter}`, { signal: abortSignal })\n * .then(r => r.json()),\n * });\n *\n * readonly items = fromResource(this.res);\n * // items.status(), items.data(), items.isFirstLoad() - all work\n * // <cngx-async-container [state]=\"items\"> - direct binding\n * ```\n *\n * @category common/data/async-state\n */\nexport function fromResource<T>(ref: Resource<T>): CngxAsyncState<T> {\n return buildResourceBridge(ref);\n}\n","import { computed, type Resource } from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\nimport { buildResourceBridge } from './resource-bridge';\n\n/**\n * Shape of an `HttpResourceRef` - only the signals we need.\n *\n * Declared here to avoid a hard dependency on `@angular/common/http`.\n * The consumer passes the actual `httpResource()` return value which\n * satisfies this interface at runtime.\n */\ninterface HttpResourceLike<T> extends Resource<T> {\n progress: () => number | undefined;\n}\n\n/**\n * Bridge that projects an Angular `httpResource()` ref onto `CngxAsyncState<T>`.\n *\n * Identical to `fromResource` but additionally maps the HTTP progress\n * signal to `CngxAsyncState.progress` (0–100 scale).\n *\n * Must be called in an injection context.\n *\n * ```typescript\n * private readonly res = httpResource<Item[]>(() => ({\n * url: '/api/items',\n * params: { q: this.filter() },\n * }));\n *\n * readonly items = fromHttpResource(this.res);\n * // items.progress() tracks upload/download progress\n * // <cngx-progress [state]=\"items\"> - auto-wired progress bar\n * ```\n *\n * @category common/data/async-state\n */\nexport function fromHttpResource<T>(ref: HttpResourceLike<T>): CngxAsyncState<T> {\n // Map HTTP progress (0-1 float) to 0-100 integer, clamped.\n const progress = computed(() => {\n const p = ref.progress();\n if (p == null) {\n return undefined;\n }\n return Math.round(Math.min(p, 1) * 100);\n });\n\n return buildResourceBridge(ref, progress);\n}\n","import {\n type MonoTypeOperatorFunction,\n type Observable,\n type OperatorFunction,\n defer,\n filter,\n finalize,\n map,\n tap,\n} from 'rxjs';\n\n/**\n * Minimal write interface for async state operators.\n *\n * Any `ManualAsyncState<T>` satisfies this - operators only need the write side.\n */\ninterface AsyncStateSink<T> {\n set(status: 'idle' | 'loading' | 'refreshing' | 'pending'): void;\n setSuccess(data: T): void;\n setError(error: unknown): void;\n setProgress(value: number | undefined): void;\n /**\n * Optional read side: when present, `tapAsyncState` picks `refreshing`\n * over `loading` for a re-subscribe after data has already landed.\n * Any `ManualAsyncState<T>` provides it.\n */\n isFirstLoad?: () => boolean;\n}\n\n/**\n * RxJS operator that wires an Observable's lifecycle to a `ManualAsyncState`.\n *\n * On subscribe: sets `loading` (or `refreshing` if data was already loaded,\n * read via the sink's `isFirstLoad`; an explicit `options.status` wins).\n * On next: calls `setSuccess(value)`.\n * On error: calls `setError(err)` and **re-throws** (does not swallow).\n * On teardown without a value (unsubscribe mid-flight, empty complete):\n * resets the sink to `idle` so a cancelled request never leaves it busy.\n *\n * The Observable passes through unchanged - `tapAsyncState` is a side-effect operator.\n *\n * ```typescript\n * readonly residents = createManualState<Resident[]>();\n *\n * load(): void {\n * this.http.get<Resident[]>('/api/residents').pipe(\n * tapAsyncState(this.residents),\n * takeUntilDestroyed(this.destroyRef),\n * ).subscribe();\n * }\n * ```\n *\n * @category common/data/async-state\n */\nexport function tapAsyncState<T>(\n state: AsyncStateSink<T>,\n options?: { status?: 'loading' | 'refreshing' | 'pending' },\n): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) =>\n defer(() => {\n state.set(options?.status ?? (state.isFirstLoad?.() === false ? 'refreshing' : 'loading'));\n let settled = false;\n return source.pipe(\n tap({\n next: (value) => {\n settled = true;\n state.setSuccess(value);\n },\n error: (err: unknown) => {\n settled = true;\n state.setError(err);\n },\n }),\n finalize(() => {\n // Torn down without ever settling (cancelled mid-flight or an\n // empty complete) - do not leave the sink busy forever.\n if (!settled) {\n state.set('idle');\n }\n }),\n );\n });\n}\n\n/**\n * Shape of an Angular `HttpProgressEvent` - declared structurally to\n * avoid a hard import on `@angular/common/http` from this entry point.\n */\ninterface HttpProgressLike {\n type: number; // HttpEventType.UploadProgress = 1, DownloadProgress = 3\n loaded: number;\n total?: number;\n}\n\n/**\n * Shape of an Angular `HttpResponse` - declared structurally.\n */\ninterface HttpResponseLike<T> {\n type: number; // HttpEventType.Response = 4\n body: T | null;\n}\n\n// HttpEventType values (from @angular/common/http)\nconst UPLOAD_PROGRESS = 1;\nconst DOWNLOAD_PROGRESS = 3;\nconst RESPONSE = 4;\n\n/**\n * RxJS operator that extracts upload/download progress from an\n * `HttpEvent` stream and reports it to a `ManualAsyncState`.\n *\n * Filters progress events, calculates percentage, calls `setProgress()`.\n * Non-progress events pass through unchanged.\n *\n * Use with `{ observe: 'events', reportProgress: true }` on HttpClient.\n *\n * ```typescript\n * readonly upload = createManualState<UploadResult>();\n *\n * handleUpload(file: File): void {\n * this.http.post('/api/upload', file, {\n * reportProgress: true,\n * observe: 'events',\n * }).pipe(\n * tapAsyncProgress(this.upload),\n * takeUntilDestroyed(this.destroyRef),\n * ).subscribe();\n * }\n * ```\n *\n * @category common/data/async-state\n */\nexport function tapAsyncProgress<E>(\n state: Pick<AsyncStateSink<unknown>, 'setProgress'>,\n): MonoTypeOperatorFunction<E> {\n return tap((event) => {\n const e = event as unknown as HttpProgressLike;\n if (\n (e.type === UPLOAD_PROGRESS || e.type === DOWNLOAD_PROGRESS) &&\n e.total != null &&\n e.total > 0\n ) {\n state.setProgress(Math.round((100 * e.loaded) / e.total));\n }\n });\n}\n\n/**\n * RxJS operator that combines `tapAsyncState` + `tapAsyncProgress` for HTTP event streams.\n *\n * Pipe this onto an `HttpClient` call with `{ observe: 'events', reportProgress: true }`.\n * It will:\n * 1. Set `loading` on subscribe\n * 2. Report upload/download progress via `setProgress()`\n * 3. Extract the response body on `HttpEventType.Response`\n * 4. Call `setSuccess(body)` with the extracted body\n * 5. Call `setError(err)` on error\n *\n * The output Observable emits the **response body** (not HttpEvents).\n * Throws if the response body is `null`.\n *\n * ```typescript\n * readonly upload = createManualState<UploadResult>();\n *\n * handleUpload(file: File): void {\n * this.http.post('/api/upload', file, {\n * reportProgress: true,\n * observe: 'events',\n * }).pipe(\n * tapHttpAsyncState(this.upload),\n * takeUntilDestroyed(this.destroyRef),\n * ).subscribe();\n * // upload.status(), upload.progress(), upload.data() - all wired\n * }\n * ```\n *\n * @category common/data/async-state\n */\nexport function tapHttpAsyncState<T>(\n state: AsyncStateSink<T>,\n options?: { status?: 'loading' | 'refreshing' | 'pending' },\n): OperatorFunction<unknown, T> {\n return (source: Observable<unknown>) =>\n defer(() => {\n state.set(options?.status ?? 'loading');\n let settled = false;\n return source.pipe(\n tapAsyncProgress<unknown>(state),\n filter((event): event is HttpResponseLike<T> => {\n return (event as HttpResponseLike<T>).type === RESPONSE;\n }),\n map((response) => {\n if (response.body == null) {\n throw new Error('tapHttpAsyncState: response body is null');\n }\n return response.body;\n }),\n tap({\n next: (value) => {\n settled = true;\n state.setSuccess(value);\n },\n error: (err: unknown) => {\n settled = true;\n state.setError(err);\n },\n }),\n finalize(() => {\n if (!settled) {\n state.set('idle');\n }\n }),\n );\n });\n}\n","import { createLatencyProbe, type CngxLatencyProbe } from '@cngx/core/utils';\nimport { injectAsyncRegistry } from './provide-async-registry';\n\n/**\n * Bridges {@link CngxAsyncRegistry} into a {@link CngxLatencyProbe} measuring the\n * registry's observed busy-envelope: how long the app was \"anything loading\"\n * during the last in-flight window.\n *\n * An app-shell indicator compares `lastDuration()` against\n * `CNGX_LOADING_CONFIG.spinnerVsSkeletonCutoff` to pick a spinner (fast last\n * aggregate) vs a skeleton (slow last aggregate) before the next load renders.\n *\n * When the registry is absent (`provideAsyncRegistry` never called),\n * `injectAsyncRegistry()` returns `null`, so the probe's source is permanently\n * `false`: it is never busy and never throws.\n *\n * Must run in an injection context.\n *\n * @returns A probe over `CngxAsyncRegistry.isAnythingLoading`.\n *\n * @category common/data/async-registry\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async-registry/inject-latency-probe.ts\n * @since 0.1.0\n * @relatedTo provideAsyncRegistry, injectAsyncRegistry, createLatencyProbe\n */\nexport function injectLatencyProbe(): CngxLatencyProbe {\n const registry = injectAsyncRegistry();\n return createLatencyProbe(() => registry?.isAnythingLoading() ?? false);\n}\n","import { HttpContext, HttpContextToken } from '@angular/common/http';\n\n/**\n * Per-request label surfaced in `CngxAsyncRegistry.activeOperations` when the\n * request is tracked by `cngxAsyncInterceptor`. Display only, never a key.\n *\n * @category common/data/async-registry\n */\nexport const CNGX_ASYNC_LABEL = new HttpContextToken<string | undefined>(() => undefined);\n\n/**\n * Per-request opt-out. When `true`, `cngxAsyncInterceptor` passes the request\n * through without registering it - keeps polling / telemetry pings out of the\n * aggregate without a global allow-list.\n *\n * @category common/data/async-registry\n */\nexport const CNGX_ASYNC_SKIP = new HttpContextToken<boolean>(() => false);\n\n/**\n * Returns an `HttpContext` that labels the request for async observability.\n * Pass an existing context to chain with other tokens.\n *\n * ```typescript\n * this.http.get('/api/users', { context: withAsyncLabel('users') });\n * ```\n *\n * @category common/data/async-registry\n */\nexport function withAsyncLabel(label: string, context: HttpContext = new HttpContext()): HttpContext {\n return context.set(CNGX_ASYNC_LABEL, label);\n}\n\n/**\n * Returns an `HttpContext` that opts the request out of async observability.\n * Pass an existing context to chain with other tokens.\n *\n * ```typescript\n * this.http.get('/api/ping', { context: withAsyncSkip() });\n * ```\n *\n * @category common/data/async-registry\n */\nexport function withAsyncSkip(context: HttpContext = new HttpContext()): HttpContext {\n return context.set(CNGX_ASYNC_SKIP, true);\n}\n","import { type EnvironmentProviders, inject, makeEnvironmentProviders } from '@angular/core';\nimport {\n HttpEventType,\n type HttpInterceptorFn,\n provideHttpClient,\n withInterceptors,\n} from '@angular/common/http';\nimport { finalize, tap } from 'rxjs';\nimport { createManualState } from '../async-state/create-manual-state';\nimport { CngxAsyncRegistry } from './async-registry';\nimport { CNGX_ASYNC_LABEL, CNGX_ASYNC_SKIP } from './http-context';\n\n/**\n * Functional HTTP interceptor that surfaces every in-flight `HttpRequest` in\n * the ambient {@link CngxAsyncRegistry}, so `isAnythingLoading()` aggregates\n * raw HTTP traffic alongside explicit component states.\n *\n * Fully opt-in and self-contained:\n * - Resolves `inject(CngxAsyncRegistry, { optional: true })` and passes the\n * request straight through when no registry is provided - zero behaviour\n * change for consumers who do not opt in.\n * - Passes through without registering when `CNGX_ASYNC_SKIP` is set.\n * - Otherwise registers a fresh `createManualState` (set `loading`) under a\n * per-request uid, maps the final response / error onto it, and\n * `unregister`s in a `finalize` that fires on success **and** error (and on\n * unsubscribe), so a request can never pin the global loading state.\n *\n * Per-request uid identity (from `CngxAsyncRegistry`) means concurrent requests\n * sharing a label never evict one another - completing one leaves the other\n * tracked. The interceptor does not swallow errors: `setError` records the\n * failure, then the error propagates to the caller unchanged.\n *\n * @category common/data/async-registry\n */\nexport const cngxAsyncInterceptor: HttpInterceptorFn = (req, next) => {\n const registry = inject(CngxAsyncRegistry, { optional: true });\n if (!registry || req.context.get(CNGX_ASYNC_SKIP)) {\n return next(req);\n }\n\n const state = createManualState<unknown>();\n state.set('loading');\n const operationId = registry.register(state, req.context.get(CNGX_ASYNC_LABEL));\n\n return next(req).pipe(\n tap({\n next: (event) => {\n if (event.type === HttpEventType.Response) {\n state.setSuccess(event.body);\n }\n },\n error: (err: unknown) => state.setError(err),\n }),\n finalize(() => registry.unregister(operationId)),\n );\n};\n\n/**\n * Sets up `HttpClient` with {@link cngxAsyncInterceptor} so every request\n * surfaces in {@link CngxAsyncRegistry}. Opt-in - add it to\n * `bootstrapApplication` providers alongside `provideAsyncRegistry()`.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideAsyncRegistry(),\n * provideAsyncHttpObservability(),\n * ],\n * });\n * ```\n *\n * **Use this only when cngx owns the `HttpClient` setup.** It calls\n * `provideHttpClient(withInterceptors([cngxAsyncInterceptor]))` internally, so\n * an app that already calls `provideHttpClient` (especially with `withFetch()`\n * or other features) would get a second, feature-less `HttpClient`\n * configuration - last-provider-wins on `HttpBackend` can silently revert\n * `withFetch()` to the XHR backend. In that case do not call this; add the\n * exported {@link cngxAsyncInterceptor} to your own `withInterceptors` instead:\n *\n * ```ts\n * provideHttpClient(withFetch(), withInterceptors([authInterceptor, cngxAsyncInterceptor]))\n * ```\n *\n * @category common/data/async-registry\n */\nexport function provideAsyncHttpObservability(): EnvironmentProviders {\n return makeEnvironmentProviders([provideHttpClient(withInterceptors([cngxAsyncInterceptor]))]);\n}\n","import {\n computed,\n Directive,\n effect,\n type EmbeddedViewRef,\n inject,\n input,\n TemplateRef,\n ViewContainerRef,\n} from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\nimport { resolveAsyncView, type AsyncView } from '../async-state/resolve-view';\n\n/**\n * Template context for the `*cngxAsync` content template.\n * `$implicit` provides the data value, typed via `ngTemplateContextGuard`.\n *\n * @category common/data/async-state\n */\nexport interface CngxAsyncContext<T> {\n /** The data value - bound via `let data` in microsyntax. */\n $implicit: T;\n /** Alias for `$implicit`. */\n cngxAsync: T;\n}\n\n/**\n * Structural directive for async state-driven content rendering.\n *\n * Renders different views based on the current `CngxAsyncState` status:\n * - **loading (first load)** → skeleton template (or nothing)\n * - **success + has data** → content template with typed data\n * - **success + empty** → empty template (or nothing)\n * - **error (first load)** → error template (or nothing)\n * - **refreshing / loading (with data)** → content template (old data stays visible)\n * - **error (with data)** → content template (old data stays visible) -\n * `resolveAsyncView` reports this as `content+error`, but a structural\n * directive renders exactly one template, so the error half is flattened\n * away here; surface it separately (toast, alert) when it must be visible\n *\n * ### Minimal - just content\n * ```html\n * <ul *cngxAsync=\"residents; let data\">\n * @for (r of data; track r.id) { <li>{{ r.name }}</li> }\n * </ul>\n * ```\n *\n * ### With custom templates\n * ```html\n * <ul *cngxAsync=\"residents; let data; skeleton: skelTpl; empty: emptyTpl; error: errTpl\">\n * @for (r of data; track r.id) { <li>{{ r.name }}</li> }\n * </ul>\n *\n * <ng-template #skelTpl>\n * @for (i of [1,2,3]; track i) { <li class=\"skeleton-line\"></li> }\n * </ng-template>\n *\n * <ng-template #emptyTpl>\n * <li>No residents found.</li>\n * </ng-template>\n *\n * <ng-template #errTpl let-err>\n * <li>Error: {{ err }}</li>\n * </ng-template>\n * ```\n *\n * @category common/data/async-state\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async/async.directive.ts\n * @since 0.1.0\n * @relatedTo injectAsyncState, createAsyncState, createManualState\n *\n * <example-url>http://localhost:4200/#/ui/feedback/async-container/cngx-async-container-full-control-toast</example-url>\n * <example-url>http://localhost:4200/#/ui/feedback/async-container/cngxasync-one-line</example-url>\n * <example-url>http://localhost:4200/#/ui/feedback/async-container/cngxasync-with-custom-templates</example-url>\n * <example-url>http://localhost:4200/#/ui/feedback/async-container/composition-overlay-container-toast</example-url>\n * <example-url>http://localhost:4200/#/ui/feedback/async-container/createasyncstate-mutation</example-url>\n * <example-url>http://localhost:4200/#/ui/feedback/async-container/injectasyncstate-reactive-query</example-url>\n */\n@Directive({\n selector: '[cngxAsync]',\n standalone: true,\n})\nexport class CngxAsync<T> {\n private readonly vcr = inject(ViewContainerRef);\n private readonly contentTpl = inject<TemplateRef<CngxAsyncContext<T>>>(TemplateRef);\n\n /** The async state to render. */\n readonly cngxAsync = input.required<CngxAsyncState<T>>();\n\n /** Optional skeleton template shown during first load. */\n readonly cngxAsyncSkeleton = input<TemplateRef<unknown> | undefined>(undefined);\n\n /** Optional empty template shown when data is empty after success. */\n readonly cngxAsyncEmpty = input<TemplateRef<unknown> | undefined>(undefined);\n\n /** Optional error template shown on error during first load. Context: `{ $implicit: error }`. */\n readonly cngxAsyncError = input<TemplateRef<{ $implicit: unknown }> | undefined>(undefined);\n\n private readonly view = computed(() => {\n const s = this.cngxAsync();\n return resolveAsyncView(s.status(), s.isFirstLoad(), s.isEmpty());\n });\n\n // Plain field, not a signal: it is only ever read and written inside the\n // render effect - as a signal it fed the effect's own dependency graph and\n // caused one spurious re-run per view switch.\n private currentView: AsyncView = 'none';\n private contentViewRef: EmbeddedViewRef<CngxAsyncContext<T>> | null = null;\n\n constructor() {\n effect(() => {\n const view = this.view();\n const s = this.cngxAsync();\n // content+error → show content (structural directive has no dual-render)\n const effective = view === 'content+error' ? 'content' : view;\n\n if (effective === this.currentView) {\n this.updateContentContext(s);\n return;\n }\n\n this.vcr.clear();\n this.contentViewRef = null;\n this.currentView = effective;\n\n this.renderView(effective, s);\n });\n }\n\n private updateContentContext(s: CngxAsyncState<T>): void {\n if (!this.contentViewRef) {\n return;\n }\n const data = s.data();\n if (data === undefined) {\n return;\n }\n this.contentViewRef.context.$implicit = data;\n this.contentViewRef.context.cngxAsync = data;\n this.contentViewRef.markForCheck();\n }\n\n private renderView(view: AsyncView, s: CngxAsyncState<T>): void {\n switch (view) {\n case 'skeleton':\n this.renderTemplate(this.cngxAsyncSkeleton());\n break;\n case 'content':\n case 'content+error': {\n const data = s.data();\n this.contentViewRef = this.vcr.createEmbeddedView(this.contentTpl, {\n $implicit: data as T,\n cngxAsync: data as T,\n });\n break;\n }\n case 'empty':\n this.renderTemplate(this.cngxAsyncEmpty());\n break;\n case 'error':\n this.renderTemplate(this.cngxAsyncError(), { $implicit: s.error() });\n break;\n }\n }\n\n private renderTemplate(\n tpl: TemplateRef<unknown> | undefined,\n context?: Record<string, unknown>,\n ): void {\n if (tpl) {\n this.vcr.createEmbeddedView(tpl, context);\n }\n }\n\n /** Type guard for template type inference. */\n static ngTemplateContextGuard<T>(_dir: CngxAsync<T>, _ctx: unknown): _ctx is CngxAsyncContext<T> {\n return true;\n }\n}\n","import type { CngxMessage } from '@cngx/core/i18n';\n\n/**\n * The kpi section of a {@link CngxLanguagePack}: the copy of the KPI atoms\n * `CngxMetric`, `CngxDelta`, `CngxTrend` and `CngxGoal`. Magnitudes reach the\n * messages already formatted for the app locale.\n *\n * @category common/data/i18n\n * @since 0.1.0\n * @relatedTo CNGX_KPI_I18N\n */\nexport interface CngxKpiLanguageSection {\n /** `{value}`, `{sentiment}`: the accessible name of a delta. */\n readonly deltaLabel: CngxMessage;\n readonly deltaImproved: string;\n readonly deltaDeclined: string;\n readonly deltaUnchanged: string;\n /** `{value}`, `{direction}`: the accessible name of a trend. */\n readonly trendLabel: CngxMessage;\n readonly trendUp: string;\n readonly trendDown: string;\n readonly trendFlat: string;\n /** `{now}`, `{max}`: a goal's `aria-valuetext`. */\n readonly goalValueText: CngxMessage;\n /** `{value}`, `{unit}`: a metric's value and unit, in reading order. */\n readonly metricValueWithUnit: string;\n /** Shown in place of a metric without a value. */\n readonly metricPlaceholder: string;\n /** Accessible name of a metric without a value. */\n readonly metricNoValue: string;\n}\n\n/**\n * The English kpi section: the single source of the KPI atoms' English copy.\n * `CNGX_KPI_I18N` defaults to it.\n *\n * @category common/data/i18n\n * @since 0.1.0\n * @relatedTo CNGX_KPI_I18N\n */\nexport const CNGX_KPI_LANGUAGE_EN: CngxKpiLanguageSection = {\n deltaLabel: '{value} {sentiment}',\n deltaImproved: 'improved',\n deltaDeclined: 'declined',\n deltaUnchanged: 'unchanged',\n trendLabel: '{value} {direction}',\n trendUp: 'up',\n trendDown: 'down',\n trendFlat: 'unchanged',\n goalValueText: '{now} of {max}',\n metricValueWithUnit: '{value} {unit}',\n metricPlaceholder: '\\u2013',\n metricNoValue: 'No value',\n};\n\ndeclare module '@cngx/core/i18n' {\n interface CngxLanguagePack {\n readonly kpi: CngxKpiLanguageSection;\n }\n}\n","import { inject, InjectionToken, type Provider, type Signal } from '@angular/core';\nimport { createLanguageSection, createSectionBundle, formatMessage } from '@cngx/core/i18n';\nimport { createOverrideMerge, numberFormatterFor } from '@cngx/core/utils';\n\nimport { CNGX_KPI_LANGUAGE_EN, type CngxKpiLanguageSection } from '../../i18n/kpi-language-section';\nimport type { DeltaDirection, DeltaSentiment } from './delta-format';\n\n/**\n * KPI atom i18n surface. Library defaults are English; consumers override\n * via {@link provideKpiI18n}. Reactive from birth: the token carries a\n * `Signal`, and {@link withKpiI18nLabels} accepts a `Signal` of a partial\n * bundle, so a runtime language switch re-derives every label.\n *\n * Every key is a formatter, so word order and plural rules belong to the\n * translator. The magnitude arrives already formatted in the app locale\n * (`CNGX_LOCALE`); the per-instance `label` / `valueTextFormat` inputs still\n * win over the bundle.\n *\n * @category common/data/i18n\n * @since 0.1.0\n */\nexport interface CngxKpiI18n {\n /** `CngxDelta` accessible name: formatted magnitude plus the sentiment word. */\n readonly deltaLabel: (formatted: string, sentiment: DeltaSentiment) => string;\n /** `CngxTrend` accessible name: formatted magnitude plus the direction word. */\n readonly trendLabel: (formatted: string, direction: DeltaDirection) => string;\n /** `CngxGoal` `aria-valuetext`: clamped value and target. */\n readonly goalValueText: (now: number, max: number) => string;\n /**\n * `CngxMetric` order of value and unit: `{value}` and `{unit}` in reading\n * order, a plain template the metric renders as two elements. English\n * `'{value} {unit}'`.\n */\n readonly metricValueWithUnit: string;\n /** Shown in place of a `CngxMetric` without a value. English: the U+2014 glyph. */\n readonly metricPlaceholder: string;\n /** Accessible name of a `CngxMetric` without a value. English `No value`. */\n readonly metricNoValue: string;\n}\n\nconst GOAL_NUMBER: Intl.NumberFormatOptions = {};\n\n/** @internal Turns a kpi section into the token's keys for a locale. */\nfunction kpiBundleFrom(section: CngxKpiLanguageSection, locale: string): CngxKpiI18n {\n const sentiment: Record<DeltaSentiment, string> = {\n positive: section.deltaImproved,\n negative: section.deltaDeclined,\n neutral: section.deltaUnchanged,\n };\n const direction: Record<DeltaDirection, string> = {\n up: section.trendUp,\n down: section.trendDown,\n flat: section.trendFlat,\n };\n const goalNumber = numberFormatterFor(locale, GOAL_NUMBER);\n return {\n deltaLabel: (value, s) =>\n formatMessage(section.deltaLabel, { value, sentiment: sentiment[s] }, locale),\n trendLabel: (value, d) =>\n formatMessage(section.trendLabel, { value, direction: direction[d] }, locale),\n goalValueText: (now, max) =>\n formatMessage(\n section.goalValueText,\n { now: goalNumber.format(now), max: goalNumber.format(max) },\n locale,\n ),\n metricValueWithUnit: section.metricValueWithUnit,\n metricPlaceholder: section.metricPlaceholder,\n metricNoValue: section.metricNoValue,\n };\n}\n\n/** @internal The kpi section of the active pack over English. */\nconst injectKpiSection = createLanguageSection('kpi', CNGX_KPI_LANGUAGE_EN);\n\n/** @internal Builds and reads the token, formatted for the reading locale. */\nconst kpiBundle = createSectionBundle<CngxKpiLanguageSection, CngxKpiI18n>({\n section: injectKpiSection,\n toBundle: kpiBundleFrom,\n});\n\n/**\n * DI token for the KPI i18n bundle. `providedIn: 'root'`: the kpi section\n * of the active language pack over the English defaults, formatted for the\n * app locale; the value is a `Signal`, shared by every reader under one\n * injector.\n *\n * @category common/data/i18n\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/shared/kpi-i18n.ts\n * @since 0.1.0\n * @relatedTo CngxDelta, CngxTrend, CngxGoal\n */\nexport const CNGX_KPI_I18N = new InjectionToken<Signal<CngxKpiI18n>>('CngxKpiI18n', {\n providedIn: 'root',\n factory: () => kpiBundle.build(),\n});\n\n/**\n * Branded feature-fn for {@link provideKpiI18n}.\n *\n * @category common/data/i18n\n * @since 0.1.0\n */\nexport type CngxKpiI18nFeature = ((bundle: Signal<CngxKpiI18n>) => Signal<CngxKpiI18n>) & {\n readonly _target: 'i18n';\n};\n\n/** @internal */\nfunction defineKpiI18nFeature(\n fn: (bundle: Signal<CngxKpiI18n>) => Signal<CngxKpiI18n>,\n): CngxKpiI18nFeature {\n return Object.assign(fn, { _target: 'i18n' as const });\n}\n\n/**\n * Override KPI labels via a partial bundle - unset keys keep the language\n * pack's copy, or the English default. Pass a `Signal` of a partial bundle to switch languages at\n * runtime.\n *\n * @category common/data/i18n\n * @since 0.1.0\n */\nexport function withKpiI18nLabels(\n overrides: Partial<CngxKpiI18n> | Signal<Partial<CngxKpiI18n>>,\n): CngxKpiI18nFeature {\n return defineKpiI18nFeature((bundle) => createOverrideMerge(bundle, overrides));\n}\n\n/**\n * Provider for the KPI i18n bundle. Returns a plain `Provider`, so it also\n * scopes a subtree through `viewProviders`. The features apply on top of the\n * active language pack.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideKpiI18n(\n * withKpiI18nLabels({\n * goalValueText: (now, max) => `${now} von ${max}`,\n * }),\n * ),\n * ],\n * });\n * ```\n *\n * @category common/data/i18n\n * @since 0.1.0\n */\nexport function provideKpiI18n(...features: readonly CngxKpiI18nFeature[]): Provider {\n return {\n provide: CNGX_KPI_I18N,\n useFactory: () => kpiBundle.build(features),\n };\n}\n\n/**\n * Inject the resolved KPI i18n bundle signal. Read it inside a `computed()`\n * or template so a runtime override flip re-derives.\n *\n * @category common/data/i18n\n * @since 0.1.0\n */\nexport function injectKpiI18n(): Signal<CngxKpiI18n> {\n return kpiBundle.resolve(inject(CNGX_KPI_I18N));\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { formatMessage } from '@cngx/core/i18n';\nimport { injectLocale, numberFormatterFor } from '@cngx/core/utils';\n\nimport { injectKpiI18n } from '../shared/kpi-i18n';\n\nconst UNIT_PLACEHOLDER = /\\{(value|unit)\\}/;\n\n/** @internal `true` when the language reads the unit before the value. */\nfunction readsUnitFirst(message: string): boolean {\n const [, first] = UNIT_PLACEHOLDER.exec(message) ?? [];\n return first === 'unit';\n}\n\n/**\n * Displays a formatted numeric value with optional unit.\n *\n * Uses `Intl.NumberFormat` with the app locale (`CNGX_LOCALE`, falling back to\n * the nearest `LOCALE_ID`) for locale-aware formatting; a locale flip\n * re-formats. A `null` value renders the placeholder glyph without its unit.\n *\n * Composable - works inside any card variant, header, body, or standalone.\n *\n * ### Basic\n * ```html\n * <cngx-metric [value]=\"1234\" unit=\"bpm\" />\n * ```\n *\n * ### With format options\n * ```html\n * <cngx-metric [value]=\"99.6\" unit=\"%\" [format]=\"{ maximumFractionDigits: 1 }\" />\n * ```\n *\n * ### Inside a card\n * ```html\n * <cngx-card>\n * <header cngxCardHeader>Puls</header>\n * <cngx-metric cngxCardBody [value]=\"75\" unit=\"bpm\" />\n * </cngx-card>\n * ```\n *\n * @category common/data/metric\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/metric/metric.component.ts\n * @since 0.1.0\n * @relatedTo CngxTrend, CngxCard\n *\n * <example-url>http://localhost:4200/#/common/data/metric/inside-a-card</example-url>\n * <example-url>http://localhost:4200/#/common/data/metric/standalone-metrics</example-url>\n */\n@Component({\n selector: 'cngx-metric',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'cngx-metric',\n // role=img makes the host a single labelled graphic so AT announces the\n // curated `aria-label` (value + unit) instead of the raw text on an\n // otherwise role=generic custom element, where aria-label is unreliably\n // exposed. Mirrors CngxDelta / CngxTrend.\n role: 'img',\n '[attr.aria-label]': 'accessibleValue()',\n },\n template: `\n @if (shownUnit() && unitFirst()) {\n <span class=\"cngx-metric__unit\">{{ shownUnit() }}</span>\n }\n <span class=\"cngx-metric__value\">{{ formattedValue() }}</span>\n @if (shownUnit() && !unitFirst()) {\n <span class=\"cngx-metric__unit\">{{ shownUnit() }}</span>\n }\n `,\n styleUrls: ['./metric.component.css'],\n})\nexport class CngxMetric {\n private readonly locale = injectLocale();\n private readonly i18n = injectKpiI18n();\n\n /**\n * Numeric or string value. `null` renders the `metricPlaceholder` glyph of\n * the kpi language section and is announced as its `metricNoValue` text.\n */\n readonly value = input.required<number | string | null>();\n\n /** Unit suffix (e.g. \"bpm\", \"h\", \"%\", \"kg\"). */\n readonly unit = input<string | undefined>(undefined);\n\n /** `Intl.NumberFormatOptions` for the primary value. */\n readonly format = input<Intl.NumberFormatOptions | undefined>(undefined);\n\n /** @internal */\n readonly formattedValue = computed(() => {\n const v = this.value();\n if (v === null) {\n return this.i18n().metricPlaceholder;\n }\n if (typeof v === 'string') {\n return v;\n }\n return numberFormatterFor(this.locale(), this.format() ?? {}).format(v);\n });\n\n /**\n * @internal The unit to render, `undefined` while there is no value: a\n * missing reading has no unit, so \"No value km\" is never shown or spoken.\n */\n protected readonly shownUnit = computed(() => {\n const unit = this.unit();\n return this.value() === null || unit === '' ? undefined : unit;\n });\n\n /** @internal Unit before value, per the `metricValueWithUnit` message. */\n protected readonly unitFirst = computed(() => readsUnitFirst(this.i18n().metricValueWithUnit));\n\n /** @internal Full accessible description including unit. */\n readonly accessibleValue = computed(() => {\n const i18n = this.i18n();\n if (this.value() === null) {\n return i18n.metricNoValue;\n }\n const value = this.formattedValue();\n const unit = this.shownUnit();\n return unit ? formatMessage(i18n.metricValueWithUnit, { value, unit }, this.locale()) : value;\n });\n}\n","/**\n * Pure, framework-agnostic helpers that turn a signed delta value into the\n * three orthogonal signals a KPI atom renders: **direction** (which way the\n * arrow points), **sentiment** (whether the change is good or bad, which\n * drives colour and the SR word), and the formatted magnitude.\n *\n * Direction and sentiment are deliberately separate. `CngxTrend` colours by\n * direction (up = green); `CngxDelta` colours by sentiment, so a value that\n * dropped can still read as an improvement (churn down, latency down). Both\n * consume these helpers so the direction / glyph / format logic has a single\n * source of truth (Pillar 1) with no Angular dependency.\n */\nimport { numberFormatterFor } from '@cngx/core/utils';\n\n/** Which way the delta moved. `flat` is exactly zero. */\nexport type DeltaDirection = 'up' | 'down' | 'flat';\n\n/**\n * How to read the sign of a delta. `neutral` disables sentiment entirely\n * (direction still renders, colour stays neutral).\n */\nexport type DeltaPolarity = 'higher-is-better' | 'lower-is-better' | 'neutral';\n\n/** Good / bad / indifferent, derived from `direction × polarity`. */\nexport type DeltaSentiment = 'positive' | 'negative' | 'neutral';\n\n/** Percent (default, one fraction digit + `%`) or a locale-formatted absolute number. */\nexport type DeltaMode = 'percent' | 'absolute';\n\n/** `> 0 → up`, `< 0 → down`, `0 → flat`. */\nexport function deltaDirection(value: number): DeltaDirection {\n return value > 0 ? 'up' : value < 0 ? 'down' : 'flat';\n}\n\n/**\n * Combine movement with the caller's polarity. `flat` or `neutral` polarity\n * collapse to `neutral`; otherwise up is positive under `higher-is-better`\n * and negative under `lower-is-better` (and the reverse for down).\n */\nexport function deltaSentiment(\n direction: DeltaDirection,\n polarity: DeltaPolarity,\n): DeltaSentiment {\n if (direction === 'flat' || polarity === 'neutral') {\n return 'neutral';\n }\n const upIsGood = polarity === 'higher-is-better';\n const isGood = direction === 'up' ? upIsGood : !upIsGood;\n return isGood ? 'positive' : 'negative';\n}\n\n/** Arrow glyph for the direction: `↑` / `↓` / `→`. */\nexport function directionGlyph(direction: DeltaDirection): string {\n return direction === 'up' ? '↑' : direction === 'down' ? '↓' : '→';\n}\n\n/**\n * Format the magnitude. The sign is carried by the arrow and colour, not the\n * digits: a positive value gains a leading `+`, everything else prints its\n * absolute value unsigned. Percent mode formats with `Intl` `style: 'percent'`\n * (so the locale places the `%` sign) and defaults to one fraction digit;\n * absolute mode uses the locale grouping.\n * A supplied `Intl.NumberFormatOptions` overrides the default digit handling\n * in both modes.\n */\nexport function formatDelta(\n value: number,\n mode: DeltaMode,\n locale: string,\n format?: Intl.NumberFormatOptions,\n): string {\n const abs = Math.abs(value);\n // The locale places and draws the plus sign; a negative prints unsigned.\n const signDisplay = value > 0 ? 'exceptZero' : 'never';\n if (mode === 'percent') {\n // The input is already in percent units; Intl's percent style multiplies\n // by 100, so scale down first.\n return numberFormatterFor(locale, {\n ...(format ?? { minimumFractionDigits: 1, maximumFractionDigits: 1 }),\n style: 'percent',\n signDisplay,\n }).format(abs / 100);\n }\n return numberFormatterFor(locale, { ...format, signDisplay }).format(abs);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { injectLocale } from '@cngx/core/utils';\n\nimport { deltaDirection, directionGlyph, formatDelta } from '../shared/delta-format';\nimport { injectKpiI18n } from '../shared/kpi-i18n';\n\n/**\n * Displays a trend indicator with directional arrow and formatted percentage.\n *\n * Positive values show an up arrow, negative a down arrow, zero a right arrow.\n * The consumer can override the SR label for full context\n * (e.g. \"vs. last month\" instead of the generic default).\n *\n * ### Basic\n * ```html\n * <cngx-trend [value]=\"5.3\" />\n * ```\n *\n * ### With custom label\n * ```html\n * <cngx-trend [value]=\"-2.1\" label=\"-2.1% vs. last quarter\" />\n * ```\n *\n * ### Inside a card header\n * ```html\n * <cngx-card>\n * <header cngxCardHeader>\n * <span>Revenue</span>\n * <cngx-trend [value]=\"revenue().trend\" />\n * </header>\n * </cngx-card>\n * ```\n *\n * @category common/data/metric\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/trend/trend.component.ts\n * @since 0.1.0\n * @relatedTo CngxMetric, CngxCard\n *\n * <example-url>http://localhost:4200/#/common/data/trend/composed-with-metric-in-a-card</example-url>\n * <example-url>http://localhost:4200/#/common/data/trend/trend-directions</example-url>\n */\n@Component({\n selector: 'cngx-trend',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'cngx-trend',\n // role=img makes the host a single labelled graphic so AT announces the\n // curated `aria-label` instead of the raw glyph text on an otherwise\n // role=generic custom element, where aria-label is unreliably exposed.\n role: 'img',\n '[class.cngx-trend--up]': 'value() > 0',\n '[class.cngx-trend--down]': 'value() < 0',\n '[attr.aria-label]': 'resolvedLabel()',\n },\n template: `\n <span aria-hidden=\"true\">{{ icon() }}</span>\n {{ formattedValue() }}\n `,\n styleUrls: ['./trend.component.css'],\n})\nexport class CngxTrend {\n private readonly locale = injectLocale();\n private readonly i18n = injectKpiI18n();\n\n /** Trend percentage. Positive = up, negative = down, zero = flat. */\n readonly value = input.required<number>();\n\n /** Consumer-provided SR label override. When set, replaces the generated default. */\n readonly label = input<string | undefined>(undefined);\n\n /** @internal */\n protected readonly icon = computed(() => directionGlyph(deltaDirection(this.value())));\n\n /** @internal */\n protected readonly formattedValue = computed(() => formatDelta(this.value(), 'percent', this.locale()));\n\n /** @internal */\n protected readonly resolvedLabel = computed(\n () =>\n this.label() ??\n this.i18n().trendLabel(this.formattedValue(), deltaDirection(this.value())),\n );\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { injectLocale } from '@cngx/core/utils';\n\nimport {\n deltaDirection,\n deltaSentiment,\n directionGlyph,\n formatDelta,\n type DeltaMode,\n type DeltaPolarity,\n} from '../shared/delta-format';\nimport { injectKpiI18n } from '../shared/kpi-i18n';\n\n/**\n * Sentiment-aware delta indicator. Where `CngxTrend` colours strictly by\n * direction (up = green), `CngxDelta` colours by **sentiment**: a `polarity`\n * of `lower-is-better` makes a drop read as an improvement (churn, latency,\n * error rate). The arrow glyph always tracks the raw direction, so colour is\n * never the only signal - a green value can carry a down arrow, and the SR\n * label speaks the sentiment word.\n *\n * Sentiment, direction, glyph and the formatted magnitude are each a\n * `computed()` off the single `value`/`polarity` input pair (Pillar 1); the\n * colour class and the arrow are bound from independent signals so they can\n * diverge (Pillar 2).\n *\n * ### Basic (higher-is-better default)\n * ```html\n * <cngx-delta [value]=\"5.3\" />\n * ```\n *\n * ### Lower-is-better (a drop is good)\n * ```html\n * <cngx-delta [value]=\"-2.1\" polarity=\"lower-is-better\" />\n * ```\n *\n * ### Absolute magnitude\n * ```html\n * <cngx-delta [value]=\"1240\" mode=\"absolute\" [format]=\"{ maximumFractionDigits: 0 }\" />\n * ```\n *\n * @category common/data/metric\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/delta/delta.component.ts\n * @since 0.1.0\n * @relatedTo CngxTrend, CngxMetric, CngxStat\n *\n * <example-url>http://localhost:4200/#/common/data/delta/sentiment-polarity</example-url>\n */\n@Component({\n selector: 'cngx-delta',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'cngx-delta',\n // role=img makes the host a single labelled graphic so AT announces the\n // curated `aria-label` (the sentiment word) instead of the raw glyph text\n // on an otherwise role=generic custom element, where aria-label is\n // unreliably exposed.\n role: 'img',\n '[class.cngx-delta--positive]': \"sentiment() === 'positive'\",\n '[class.cngx-delta--negative]': \"sentiment() === 'negative'\",\n '[class.cngx-delta--neutral]': \"sentiment() === 'neutral'\",\n '[attr.aria-label]': 'resolvedLabel()',\n },\n template: `\n <span aria-hidden=\"true\">{{ glyph() }}</span>\n {{ formattedValue() }}\n `,\n styleUrls: ['./delta.component.css'],\n})\nexport class CngxDelta {\n private readonly locale = injectLocale();\n private readonly i18n = injectKpiI18n();\n\n /** Signed delta. Positive = up, negative = down, zero = flat. */\n readonly value = input.required<number>();\n\n /**\n * How to read the sign. `higher-is-better` (default) treats a rise as\n * positive; `lower-is-better` inverts it; `neutral` disables sentiment\n * (direction still renders, colour stays neutral).\n */\n readonly polarity = input<DeltaPolarity>('higher-is-better');\n\n /** `percent` (default, one fraction digit + `%`) or `absolute`. */\n readonly mode = input<DeltaMode>('percent');\n\n /** `Intl.NumberFormatOptions` applied to the magnitude in either mode. */\n readonly format = input<Intl.NumberFormatOptions | undefined>(undefined);\n\n /** Consumer-provided SR label override. Replaces the generated default. */\n readonly label = input<string | undefined>(undefined);\n\n /** @internal Raw movement, independent of polarity. Drives the glyph. */\n protected readonly direction = computed(() => deltaDirection(this.value()));\n\n /** @internal Good / bad / indifferent. Drives colour and the SR word. */\n protected readonly sentiment = computed(() => deltaSentiment(this.direction(), this.polarity()));\n\n /** @internal Arrow glyph bound from direction only. */\n protected readonly glyph = computed(() => directionGlyph(this.direction()));\n\n /** @internal Formatted magnitude. */\n protected readonly formattedValue = computed(() =>\n formatDelta(this.value(), this.mode(), this.locale(), this.format()),\n );\n\n /**\n * @internal Full SR label: magnitude plus the sentiment word, composed by\n * `CNGX_KPI_I18N.deltaLabel` unless `[label]` is bound.\n */\n protected readonly resolvedLabel = computed(\n () => this.label() ?? this.i18n().deltaLabel(this.formattedValue(), this.sentiment()),\n );\n}\n","import { computed, Directive, signal } from '@angular/core';\n\nimport type { CngxStatRegistry, CngxStatSlotKind } from './stat.token';\n\n/** Fixed reading order for the coordinated slots. */\nconst SLOT_ORDER: readonly CngxStatSlotKind[] = ['label', 'value', 'delta', 'caption'];\n\n/** Structural equality so an unchanged id set never cascades `labelledBy`. */\nconst idsEqual = (a: readonly string[], b: readonly string[]): boolean =>\n a.length === b.length && a.every((id, i) => id === b[i]);\n\n/** Structural equality so an unchanged slot set never cascades to a placeholder. */\nconst kindsEqual = (a: readonly CngxStatSlotKind[], b: readonly CngxStatSlotKind[]): boolean =>\n a.length === b.length && a.every((kind, i) => kind === b[i]);\n\n/**\n * The slot-id coordination brain behind {@link CNGX_STAT}. Collects the id each\n * `cngxStat*` slot registers and derives one `aria-labelledby` that reads the\n * whole stat as a single accessible name in reading order.\n *\n * Lives as a host directive rather than inside `CngxStat` because the slot\n * directives resolve `CNGX_STAT` against their **declaration** site: content\n * written inside an organism never reaches a `<cngx-stat>` that sits in that\n * organism's own template. Any component that wants to host the four slots\n * therefore applies this brain and re-points the token at it:\n *\n * ```ts\n * hostDirectives: [CngxStatCoordinator],\n * providers: [{ provide: CNGX_STAT, useExisting: CngxStatCoordinator }],\n * ```\n *\n * Same shape as `CngxPaginate` behind `CNGX_PAGINATOR_HOST`, which\n * `CngxPaginator` and `CngxIncrementalList` share the same way.\n *\n * @category common/data/metric\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/stat/stat-coordinator.directive.ts\n * @since 0.1.0\n * @relatedTo CngxStat, CNGX_STAT\n */\n@Directive({\n standalone: true,\n})\nexport class CngxStatCoordinator implements CngxStatRegistry {\n private readonly slots = signal<ReadonlyMap<CngxStatSlotKind, string>>(new Map());\n\n /** {@inheritDoc CngxStatRegistry.register} */\n register(kind: CngxStatSlotKind, id: string): void {\n this.slots.update((prev) => new Map(prev).set(kind, id));\n }\n\n /** {@inheritDoc CngxStatRegistry.unregister} */\n unregister(kind: CngxStatSlotKind, id?: string): void {\n this.slots.update((prev) => {\n if (id !== undefined && prev.get(kind) !== id) {\n // Register-before-destroy replacement: the outgoing slot must not\n // evict the live slot's id from aria-labelledby.\n return prev;\n }\n const next = new Map(prev);\n next.delete(kind);\n return next;\n });\n }\n\n /** Present slot ids in reading order; structurally stable. */\n readonly orderedIds = computed(\n () => {\n const map = this.slots();\n return SLOT_ORDER.map((kind) => map.get(kind)).filter((id): id is string => id !== undefined);\n },\n { equal: idsEqual },\n );\n\n /** Combined accessible name for the host; `null` when no slot is present. */\n readonly labelledBy = computed(() => this.orderedIds().join(' ') || null);\n\n /**\n * Which slots a consumer actually projected, in reading order. Registration\n * happens when the slot directive is constructed in the consumer's template,\n * so this stays accurate even while the host renders a branch that does not\n * include the `<ng-content>` outlets - which is what lets a placeholder mirror\n * the real tile instead of guessing at it.\n */\n readonly presentKinds = computed(\n () => {\n const map = this.slots();\n return SLOT_ORDER.filter((kind) => map.has(kind));\n },\n { equal: kindsEqual },\n );\n}\n","import { InjectionToken } from '@angular/core';\n\n/** The four coordinated slots of a {@link CngxStat}, in reading order. */\nexport type CngxStatSlotKind = 'label' | 'value' | 'delta' | 'caption';\n\n/**\n * Slot-registration contract a `CngxStat` exposes to its projected slot\n * directives. Each slot registers its generated id on init and withdraws it\n * on destroy; the molecule derives the combined `aria-labelledby` from the\n * live registration set. Fronted by a DI token (not the concrete `CngxStat`\n * class) so the slots stay decompose-safe - the ejected skin talks to the\n * same token the library defines.\n */\nexport interface CngxStatRegistry {\n /** Register (or replace) the id contributed by `kind`. */\n register(kind: CngxStatSlotKind, id: string): void;\n /**\n * Withdraw the id contributed by `kind`. When `id` is given, the\n * withdrawal applies only while that id is still the registered one -\n * a register-before-destroy replacement is left alone.\n */\n unregister(kind: CngxStatSlotKind, id?: string): void;\n}\n\n/** DI token carrying the {@link CngxStatRegistry} a `CngxStat` provides. */\nexport const CNGX_STAT = new InjectionToken<CngxStatRegistry>('CNGX_STAT');\n","import {\n ChangeDetectionStrategy,\n Component,\n inject,\n input,\n ViewEncapsulation,\n} from '@angular/core';\n\nimport { CngxStatCoordinator } from './stat-coordinator.directive';\nimport { CNGX_STAT } from './stat.token';\n\n/**\n * Coordination molecule for a KPI stat. Its sole reason to exist is the\n * screen-reader layer (Pillar 2): hand-assembling a heading, a `<cngx-metric>`\n * and a `<cngx-delta>` makes a screen reader announce three disconnected\n * fragments. `CngxStat` projects the label / value / delta / caption slots,\n * collects the id each slot registers, and derives one `aria-labelledby` that\n * reads the whole stat as a single accessible name in reading order.\n *\n * Composition, never a config bag (Pillar 3): the id coordination lives in the\n * {@link CngxStatCoordinator} host directive, so another component that hosts\n * the same four slots applies the identical brain instead of reimplementing it.\n * The visuals stay whatever atoms the consumer projects into the slots.\n *\n * ```html\n * <cngx-stat aria-live=\"polite\">\n * <span cngxStatLabel>Revenue</span>\n * <cngx-metric cngxStatValue [value]=\"1.2\" unit=\"M EUR\" />\n * <cngx-delta cngxStatDelta [value]=\"5.3\" />\n * <span cngxStatCaption>vs. last quarter</span>\n * </cngx-stat>\n * ```\n *\n * @category common/data/metric\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/stat/stat.component.ts\n * @since 0.1.0\n * @relatedTo CngxMetric, CngxDelta, CngxTrend, CngxStatCoordinator\n *\n * <example-url>http://localhost:4200/#/common/data/stat/composed-kpi</example-url>\n */\n@Component({\n selector: 'cngx-stat',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n hostDirectives: [CngxStatCoordinator],\n providers: [{ provide: CNGX_STAT, useExisting: CngxStatCoordinator }],\n host: {\n class: 'cngx-stat',\n role: 'group',\n '[attr.aria-labelledby]': 'coordinator.labelledBy()',\n '[attr.aria-live]': 'live()',\n },\n template: `\n <ng-content select=\"[cngxStatLabel]\" />\n <div class=\"cngx-stat__row\">\n <ng-content select=\"[cngxStatValue]\" />\n <ng-content select=\"[cngxStatDelta]\" />\n </div>\n <ng-content select=\"[cngxStatCaption]\" />\n `,\n styleUrls: ['./stat.component.css'],\n})\nexport class CngxStat {\n /** @internal The shared slot-id brain, applied as a host directive. */\n protected readonly coordinator = inject(CngxStatCoordinator, { host: true });\n\n /**\n * Politeness of the live region. `off` (default) for a static stat;\n * `polite` / `assertive` for a KPI whose value updates in place.\n */\n readonly live = input<'off' | 'polite' | 'assertive'>('off');\n}\n","import { DestroyRef, Directive, inject } from '@angular/core';\nimport { nextUid } from '@cngx/core/utils';\n\nimport { CNGX_STAT, type CngxStatSlotKind } from './stat.token';\n\n/**\n * Generate a stable id, register it with the enclosing `CngxStat` (if any),\n * and withdraw it on destroy. Shared by the four slot directives via plain\n * composition - no base class, no inheritance (Pillar 3).\n */\nfunction useStatSlot(kind: CngxStatSlotKind): string {\n const registry = inject(CNGX_STAT, { optional: true });\n const id = nextUid(`cngx-stat-${kind}`);\n registry?.register(kind, id);\n inject(DestroyRef).onDestroy(() => registry?.unregister(kind, id));\n return id;\n}\n\n/**\n * Marks the label element of a {@link CngxStat}. Its generated id leads the\n * molecule's `aria-labelledby`.\n *\n * @category common/data/metric\n * @since 0.1.0\n * @relatedTo CngxStat\n */\n@Directive({\n selector: '[cngxStatLabel]',\n standalone: true,\n host: { '[id]': 'id' },\n})\nexport class CngxStatLabel {\n /** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */\n readonly id = useStatSlot('label');\n}\n\n/**\n * Marks the primary value element of a {@link CngxStat} (typically a\n * `<cngx-metric>`).\n *\n * @category common/data/metric\n * @since 0.1.0\n * @relatedTo CngxStat\n */\n@Directive({\n selector: '[cngxStatValue]',\n standalone: true,\n host: { '[id]': 'id' },\n})\nexport class CngxStatValue {\n /** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */\n readonly id = useStatSlot('value');\n}\n\n/**\n * Marks the delta element of a {@link CngxStat} (typically a `<cngx-delta>`\n * or `<cngx-trend>`).\n *\n * @category common/data/metric\n * @since 0.1.0\n * @relatedTo CngxStat\n */\n@Directive({\n selector: '[cngxStatDelta]',\n standalone: true,\n host: { '[id]': 'id' },\n})\nexport class CngxStatDelta {\n /** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */\n readonly id = useStatSlot('delta');\n}\n\n/**\n * Marks the caption element of a {@link CngxStat} - the trailing context\n * line (e.g. \"vs. last quarter\").\n *\n * @category common/data/metric\n * @since 0.1.0\n * @relatedTo CngxStat\n */\n@Directive({\n selector: '[cngxStatCaption]',\n standalone: true,\n host: { '[id]': 'id' },\n})\nexport class CngxStatCaption {\n /** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */\n readonly id = useStatSlot('caption');\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n type Signal,\n ViewEncapsulation,\n} from '@angular/core';\n\nimport { injectKpiI18n } from '../shared/kpi-i18n';\n\n/**\n * Determinate attainment bar - a continuous progress toward a target\n * (quota reached, budget spent, goal met). Named `CngxGoal` because\n * `cngx-progress` is the indeterminate async loading bar; this is the\n * finished-fraction indicator, distinct from that and from the discrete\n * `CngxSegmentedProgress`.\n *\n * Mirrors the `CngxSegmentedProgress` a11y shape: `role=\"progressbar\"` with\n * the whole `aria-value*` set plus `aria-valuetext` living in the `computed()`\n * graph (Pillar 2). The value is clamped to `[0, max]`; the fill width is a\n * derived percent bound as a CSS custom property.\n *\n * ```html\n * <cngx-goal [value]=\"73\" [max]=\"100\" label=\"Quota attainment\" />\n * <cngx-goal [value]=\"q()\" [max]=\"target()\" [valueTextFormat]=\"quotaText\" />\n * ```\n *\n * @category common/data/metric\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/goal/goal.component.ts\n * @since 0.1.0\n * @relatedTo CngxSegmentedProgress, CngxMetric\n *\n * <example-url>http://localhost:4200/#/common/data/goal/quota-attainment</example-url>\n */\n@Component({\n selector: 'cngx-goal',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'cngx-goal',\n role: 'progressbar',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuemax]': 'maxValue()',\n '[attr.aria-valuenow]': 'now()',\n '[attr.aria-valuetext]': 'valueText()',\n '[attr.aria-label]': 'label() ?? null',\n '[style.--cngx-goal-fill.%]': 'fillPercent()',\n },\n template: `<span class=\"cngx-goal__track\"><span class=\"cngx-goal__fill\"></span></span>`,\n styleUrls: ['./goal.component.css'],\n})\nexport class CngxGoal {\n private readonly i18n = injectKpiI18n();\n\n /** Current attainment. Clamped to `[0, max]`. */\n readonly value = input.required<number>();\n\n /** Target the value works toward. Defaults to `100`. */\n readonly max = input<number>(100);\n\n /**\n * Accessible name for the progressbar (what the attainment measures, e.g.\n * \"Quarterly quota\"). Mirrors the `label` input of the sibling KPI atoms;\n * omit it only when an external `aria-labelledby` (e.g. a `cngxStatLabel`)\n * names the bar instead.\n */\n readonly label = input<string | undefined>(undefined);\n\n /**\n * Override the `aria-valuetext` string. Receives `(now, max)` - the clamped\n * value and the target. Wins over the app-wide `CNGX_KPI_I18N.goalValueText`\n * (English default `(now, max) => \\`${now} of ${max}\\``). Supply a closure\n * for richer per-instance text (e.g.\n * `(n, m) => \\`${n} of ${m}, ${Math.round((n / m) * 100)}% of quota\\``).\n */\n readonly valueTextFormat = input<((now: number, max: number) => string) | undefined>(undefined);\n\n /** `aria-valuemax` - the target, floored at 0. */\n protected readonly maxValue: Signal<number> = computed(() => Math.max(0, this.max()));\n\n /** `aria-valuenow` - value clamped into `[0, max]`. */\n protected readonly now: Signal<number> = computed(() =>\n Math.max(0, Math.min(this.value(), this.maxValue())),\n );\n\n /** Fill width as a percent of the target; `0` when the target is `0`. */\n protected readonly fillPercent: Signal<number> = computed(() => {\n const max = this.maxValue();\n return max === 0 ? 0 : (this.now() / max) * 100;\n });\n\n /** `aria-valuetext` - human-readable attainment via the resolved closure. */\n protected readonly valueText: Signal<string> = computed(() => {\n const fmt = this.valueTextFormat() ?? this.i18n().goalValueText;\n return fmt(this.now(), this.maxValue());\n });\n}\n","import type { CngxMessage } from '@cngx/core/i18n';\n\n/**\n * The recycler section of a {@link CngxLanguagePack}: the screen-reader\n * announcements of a virtualised list.\n *\n * @category common/data/i18n\n * @since 0.1.0\n * @relatedTo CNGX_RECYCLER_I18N\n */\nexport interface CngxRecyclerLanguageSection {\n /** Plural on `{count}` (new items), with `{total}`: announced after a load. */\n readonly loaded: CngxMessage;\n /** Plural on `{count}`: announced when filter or search results change. */\n readonly filtered: CngxMessage;\n /** Announced when the list becomes empty. */\n readonly empty: string;\n /** Announced when loading fails. */\n readonly error: string;\n}\n\n/**\n * The English recycler section: the single source of the recycler's English\n * copy. `CNGX_RECYCLER_I18N` defaults to it.\n *\n * @category common/data/i18n\n * @since 0.1.0\n * @relatedTo CNGX_RECYCLER_I18N\n */\nexport const CNGX_RECYCLER_LANGUAGE_EN: CngxRecyclerLanguageSection = {\n loaded: {\n one: '{count} more item loaded. {total} total.',\n other: '{count} more items loaded. {total} total.',\n },\n filtered: { one: '{count} result found.', other: '{count} results found.' },\n empty: 'No results',\n error: 'Error loading data',\n};\n\ndeclare module '@cngx/core/i18n' {\n interface CngxLanguagePack {\n readonly recycler: CngxRecyclerLanguageSection;\n }\n}\n","/**\n * Result of a range computation for virtual scrolling.\n *\n * `start`/`end` are item indices. `offsetBefore`/`offsetAfter`/`totalSize` are pixels.\n * In grid mode, offsets are row-based (rows = ceil(totalCount / columns)).\n *\n * @internal\n */\nexport interface RangeResult {\n /** Start index (inclusive) of the visible range. */\n readonly start: number;\n /** End index (exclusive) of the visible range. */\n readonly end: number;\n /** Height of the spacer before visible items (px). */\n readonly offsetBefore: number;\n /** Height of the spacer after visible items (px). */\n readonly offsetAfter: number;\n /** Total height of all items (px). */\n readonly totalSize: number;\n}\n\nconst EMPTY_RANGE: RangeResult = {\n start: 0,\n end: 0,\n offsetBefore: 0,\n offsetAfter: 0,\n totalSize: 0,\n};\n\n/**\n * Computes the visible range of items given scroll position, viewport size,\n * total item count, and item size estimation.\n *\n * Pure function - no DOM access, no Angular dependency. Fully testable.\n *\n * @param scrollTop Current scroll offset in px.\n * @param clientHeight Viewport height in px.\n * @param totalCount Total number of items.\n * @param estimateSize Fixed item height in px, or a function returning height per index.\n * @param overscanBefore Extra items to render above the viewport (leading edge\n * when scrolling up).\n * @param columns Column count for grid mode (default 1). When > 1, range is row-aligned.\n * Variable `estimateSize` ignores columns (grid + variable heights not supported).\n * @param overscanAfter Extra items to render below the viewport (leading edge when\n * scrolling down). Defaults to `overscanBefore` for a symmetric range. Callers pass\n * an asymmetric pair to pre-render into the scroll direction.\n * @returns The computed range with spacer offsets.\n * @internal\n */\nexport function computeRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n estimateSize: number | ((index: number) => number),\n overscanBefore: number,\n columns = 1,\n overscanAfter = overscanBefore,\n): RangeResult {\n if (totalCount <= 0) {\n return EMPTY_RANGE;\n }\n\n if (clientHeight <= 0) {\n // Degenerate viewport (0px). A content-driven scrollport gets its height\n // FROM the spacers this result sizes, so reporting `totalSize: 0` here\n // deadlocks: no spacer, no height, no spacer. Report the full totalSize\n // with an empty window instead - the after-spacer gives the viewport its\n // height, the ResizeObserver-fed `clientHeight` turns non-zero, and the\n // next computation renders the real range.\n const totalSize = estimateTotalSize(totalCount, estimateSize, columns);\n return { start: 0, end: 0, offsetBefore: 0, offsetAfter: totalSize, totalSize };\n }\n\n if (typeof estimateSize === 'number') {\n return computeFixedRange(\n scrollTop,\n clientHeight,\n totalCount,\n estimateSize,\n overscanBefore,\n overscanAfter,\n columns,\n );\n }\n\n // variable heights: grid mode unsupported, columns ignored\n return computeVariableRange(\n scrollTop,\n clientHeight,\n totalCount,\n estimateSize,\n overscanBefore,\n overscanAfter,\n );\n}\n\nfunction estimateTotalSize(\n totalCount: number,\n estimateSize: number | ((index: number) => number),\n columns: number,\n): number {\n if (typeof estimateSize === 'number') {\n const rows = columns > 1 ? Math.ceil(totalCount / columns) : totalCount;\n return rows * estimateSize;\n }\n // variable heights: grid mode unsupported, columns ignored (same contract\n // as computeVariableRange)\n let totalSize = 0;\n for (let i = 0; i < totalCount; i++) {\n totalSize += estimateSize(i);\n }\n return totalSize;\n}\n\nfunction computeFixedRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n itemSize: number,\n overscanBefore: number,\n overscanAfter: number,\n columns: number,\n): RangeResult {\n if (columns > 1) {\n return computeGridRange(\n scrollTop,\n clientHeight,\n totalCount,\n itemSize,\n overscanBefore,\n overscanAfter,\n columns,\n );\n }\n\n const totalSize = totalCount * itemSize;\n\n const rawStart = Math.floor(scrollTop / itemSize);\n const rawEnd = Math.ceil((scrollTop + clientHeight) / itemSize);\n\n const start = Math.max(0, rawStart - overscanBefore);\n const end = Math.min(totalCount, rawEnd + overscanAfter);\n\n return {\n start,\n end,\n offsetBefore: start * itemSize,\n offsetAfter: Math.max(0, (totalCount - end) * itemSize),\n totalSize,\n };\n}\n\n/**\n * Grid-mode range computation. Row-aligned before overscan.\n *\n * Order: raw visible rows → overscan rows → clamp → convert to item indices.\n * This ensures full rows are always rendered.\n *\n * @internal\n */\nfunction computeGridRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n rowHeight: number,\n overscanBefore: number,\n overscanAfter: number,\n columns: number,\n): RangeResult {\n const totalRows = Math.ceil(totalCount / columns);\n const totalSize = totalRows * rowHeight;\n\n // raw rows (inherently row-aligned)\n const rawStartRow = Math.floor(scrollTop / rowHeight);\n const rawEndRow = Math.ceil((scrollTop + clientHeight) / rowHeight);\n\n // overscan applied in rows so full rows always render\n const overscanRowsBefore = Math.ceil(overscanBefore / columns);\n const overscanRowsAfter = Math.ceil(overscanAfter / columns);\n const startRow = Math.max(0, rawStartRow - overscanRowsBefore);\n const endRow = Math.min(totalRows, rawEndRow + overscanRowsAfter);\n\n const start = startRow * columns;\n const end = Math.min(endRow * columns, totalCount);\n\n return {\n start,\n end,\n offsetBefore: startRow * rowHeight,\n offsetAfter: Math.max(0, (totalRows - endRow) * rowHeight),\n totalSize,\n };\n}\n\nfunction computeVariableRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n estimateSize: (index: number) => number,\n overscanBefore: number,\n overscanAfter: number,\n): RangeResult {\n let totalSize = 0;\n const offsets = new Array<number>(totalCount + 1);\n offsets[0] = 0;\n\n for (let i = 0; i < totalCount; i++) {\n totalSize += estimateSize(i);\n offsets[i + 1] = totalSize;\n }\n\n // binary search: first item whose bottom edge is past scrollTop\n const rawStart = binarySearch(offsets, scrollTop, totalCount);\n const rawEnd = binarySearch(offsets, scrollTop + clientHeight, totalCount);\n\n const start = Math.max(0, rawStart - overscanBefore);\n const end = Math.min(totalCount, rawEnd + 1 + overscanAfter);\n\n return {\n start,\n end,\n offsetBefore: offsets[start],\n offsetAfter: Math.max(0, totalSize - offsets[end]),\n totalSize,\n };\n}\n\n/**\n * Finds the index of the first item whose cumulative offset exceeds `target`.\n *\n * @internal\n */\nfunction binarySearch(offsets: number[], target: number, totalCount: number): number {\n let low = 0;\n let high = totalCount - 1;\n\n while (low <= high) {\n const mid = (low + high) >>> 1;\n if (offsets[mid + 1] <= target) {\n low = mid + 1;\n } else if (offsets[mid] > target) {\n high = mid - 1;\n } else {\n return mid;\n }\n }\n\n return Math.min(low, totalCount - 1);\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n afterNextRender,\n type DestroyRef,\n type ElementRef,\n type Signal,\n effect,\n inject,\n isDevMode,\n signal,\n untracked,\n} from '@angular/core';\nimport { observeResize } from '@cngx/common/layout';\n\n/**\n * Reactive scroll state of a container element.\n * `scrollTop` is read synchronously on each scroll event so the rendered\n * range tracks scroll without an extra frame of latency; Angular's signal\n * scheduler coalesces a burst of events into one recompute per frame.\n * `clientHeight` updates from a ResizeObserver, not on scroll.\n */\nexport interface ScrollState {\n readonly scrollTop: Signal<number>;\n readonly clientHeight: Signal<number>;\n /** The resolved scroll container element, or `null` if not yet resolved. */\n readonly element: Signal<HTMLElement | null>;\n}\n\n/**\n * Creates a reactive scroll observer for a container element.\n *\n * Element resolution happens **lazily inside the effect**, not at call time.\n * This is critical because `injectRecycler` is called in a field initializer\n * where template DOM does not yet exist - `querySelector` would return `null`.\n * The effect runs after the first CD cycle when the DOM is stable.\n *\n * @internal Not exported from `@cngx/common/data` public API.\n */\nexport function createScrollObserver(\n elementRef: ElementRef | HTMLElement | string,\n destroyRef: DestroyRef,\n): ScrollState {\n const doc = inject(DOCUMENT);\n const scrollTopState = signal(0);\n const clientHeightState = signal(0);\n const elementState = signal<HTMLElement | null>(null);\n\n // Retry trigger - incremented by afterNextRender to re-run the effect\n // when the element wasn't found on the first attempt (routed components,\n // content projection, lazy rendering).\n const retryTick = signal(0);\n\n // Late-mount watcher for the string-selector path. A viewport gated behind\n // async data (or a skeleton->content swap) can mount many renders after the\n // one-shot afterNextRender retry fires, so a single retry misses it. This\n // observer bumps retryTick the instant the selector matches, then\n // disconnects. Created only in the unresolved-string case; stays null on\n // every faster path.\n let mutationObserver: MutationObserver | null = null;\n\n function disconnectMutationObserver(): void {\n mutationObserver?.disconnect();\n mutationObserver = null;\n }\n\n function attachListeners(el: HTMLElement, onCleanup: (fn: () => void) => void): void {\n // A viewport resolved: the late-mount watcher has done its job. Disconnect\n // it on attach so it can never outlive a resolved element - the node is\n // already in the DOM, so the observer would otherwise never fire again and\n // leak until destroy.\n disconnectMutationObserver();\n elementState.set(el);\n scrollTopState.set(el.scrollTop);\n clientHeightState.set(el.clientHeight);\n\n // Read scrollTop synchronously on the scroll event rather than deferring to\n // a requestAnimationFrame. The rAF hop delayed the range by a frame, so a\n // fast scroll outran the rendered window and flashed a blank strip. Scroll\n // events already fire at most once per frame, and the signal scheduler\n // coalesces bursts, so the synchronous read carries no extra recompute cost.\n const handleScroll = () => {\n scrollTopState.set(el.scrollTop);\n };\n\n el.addEventListener('scroll', handleScroll, { passive: true });\n\n const stopResize = observeResize(doc.defaultView, el, 'content-box', () => {\n clientHeightState.set(el.clientHeight);\n });\n\n onCleanup(() => {\n el.removeEventListener('scroll', handleScroll);\n stopResize();\n elementState.set(null);\n });\n }\n\n effect((onCleanup) => {\n retryTick(); // tracked: re-runs the effect after the retry tick bumps\n const el = resolveElement(elementRef, doc);\n if (!el) {\n return;\n }\n attachListeners(el, onCleanup);\n });\n\n // If the element wasn't found on the first effect run (before DOM is ready),\n // retry after the next render cycle. Fires for ALL input shapes - string\n // selectors resolve lazily via `querySelector`, but `ElementRef` from a\n // `viewChild` also starts out with `nativeElement == null` until Angular\n // resolves the query. `HTMLElement` inputs that are non-null at call time\n // short-circuit on the first effect run so the retry is a no-op.\n afterNextRender(() => {\n // untracked: afterNextRender may run in the same microtask as the effect.\n // Reading elementState() without untracked could create an unintended dependency\n // in whatever reactive context is active.\n if (untracked(() => elementState()) != null) {\n return;\n }\n // Element missing after the first render. Bump once for the common\n // next-render mount (routed component, content projection, lazy rendering).\n retryTick.update((v) => v + 1);\n\n // A string selector can still be unresolved because its viewport mounts\n // arbitrarily late - an async-gated list, a skeleton->content swap. Watch\n // the document and attach the instant it appears. Non-string refs\n // (HTMLElement / ElementRef) are not document-queryable, so the watcher\n // cannot help them; they stay on the single-retry path. Guard MutationObserver\n // for SSR.\n if (typeof elementRef !== 'string' || typeof MutationObserver === 'undefined') {\n return;\n }\n if (isDevMode()) {\n console.warn(\n `recycler scrollElement '${elementRef}' not found on first render; ` +\n 'it will attach automatically once it mounts. If it never does, check the selector.',\n );\n }\n mutationObserver = new MutationObserver(() => {\n if (resolveElement(elementRef, doc) == null) {\n return;\n }\n // Found it. Disconnect before the retry bump so the resolving effect run\n // never observes a live-but-spent watcher, then let the effect attach.\n disconnectMutationObserver();\n retryTick.update((v) => v + 1);\n });\n mutationObserver.observe(doc.documentElement, { childList: true, subtree: true });\n });\n\n destroyRef.onDestroy(() => {\n disconnectMutationObserver();\n elementState.set(null);\n });\n\n return {\n scrollTop: scrollTopState.asReadonly(),\n clientHeight: clientHeightState.asReadonly(),\n element: elementState.asReadonly(),\n };\n}\n\nfunction resolveElement(ref: ElementRef | HTMLElement | string, doc: Document): HTMLElement | null {\n if (typeof ref === 'string') {\n return doc.querySelector<HTMLElement>(ref);\n }\n if (ref instanceof HTMLElement) {\n return ref;\n }\n // ElementRef\n return (ref?.nativeElement as HTMLElement | null) ?? null;\n}\n","import { type Signal, signal } from '@angular/core';\n\n/**\n * Signal-based cache mapping item index to measured height.\n *\n * The `version` signal increments on every `set()`, allowing any `computed()`\n * that reads `version()` to re-evaluate when measurements change.\n *\n * @internal Not exported from `@cngx/common/data` public API.\n */\nexport interface SizeCache {\n /** Get measured size for an index, or `undefined` if not yet measured. */\n get(index: number): number | undefined;\n /** Set measured size. Increments `version` to trigger recomputation. */\n set(index: number, size: number): void;\n /** Signal that increments on every `set()` - use as a dependency in `computed()`. */\n readonly version: Signal<number>;\n /** Get size for an index, falling back to `estimateSize` if not measured. */\n resolve(index: number, estimateSize: number | ((i: number) => number)): number;\n /** Number of measured entries. */\n readonly count: number;\n /** Clear all measurements. */\n clear(): void;\n}\n\n/**\n * Creates a signal-based size cache for measured item heights.\n *\n * @internal\n */\nexport function createSizeCache(): SizeCache {\n const cache = new Map<number, number>();\n const versionState = signal(0);\n\n return {\n get(index: number): number | undefined {\n return cache.get(index);\n },\n\n set(index: number, size: number): void {\n const current = cache.get(index);\n if (current === size) {\n return;\n }\n cache.set(index, size);\n versionState.update((v) => v + 1);\n },\n\n version: versionState.asReadonly(),\n\n resolve(index: number, estimateSize: number | ((i: number) => number)): number {\n const measured = cache.get(index);\n if (measured != null) {\n return measured;\n }\n return typeof estimateSize === 'number' ? estimateSize : estimateSize(index);\n },\n\n get count(): number {\n return cache.size;\n },\n\n clear(): void {\n if (cache.size === 0) {\n return;\n }\n cache.clear();\n versionState.update((v) => v + 1);\n },\n };\n}\n","import {\n DestroyRef,\n type ElementRef,\n InjectionToken,\n type Provider,\n type Signal,\n computed,\n effect,\n inject,\n isDevMode,\n isSignal,\n signal,\n untracked,\n} from '@angular/core';\nimport { clamp } from '@cngx/utils';\nimport type { CngxAsyncState } from '@cngx/core/utils';\nimport { createLanguageSection, createSectionBundle, formatMessage } from '@cngx/core/i18n';\nimport {\n createOverrideMerge,\n createTransitionTracker,\n createVisibilityGate,\n} from '@cngx/core/utils';\n\nimport {\n CNGX_RECYCLER_LANGUAGE_EN,\n type CngxRecyclerLanguageSection,\n} from '../i18n/recycler-language-section';\nimport { computeRange } from './range-computer';\nimport { createScrollObserver } from './scroll-observer';\nimport { createSizeCache } from './size-cache';\n\n/**\n * I18n interface for recycler SR announcements.\n * All methods return the announcement text. No hardcoded strings.\n *\n * @category common/data/recycler\n */\nexport interface RecyclerI18n {\n /** Announced when new items are loaded (infinite scroll). */\n loaded(newCount: number, total: number): string;\n /** Announced when filter/search results change. */\n filtered(count: number): string;\n /** Announced when the list becomes empty. */\n empty(): string;\n /** Announced when loading fails. */\n error(): string;\n}\n\n/** @internal Turns a recycler section into the token's keys for a locale. */\nfunction recyclerBundleFrom(section: CngxRecyclerLanguageSection, locale: string): RecyclerI18n {\n return {\n loaded: (count, total) => formatMessage(section.loaded, { count, total }, locale),\n filtered: (count) => formatMessage(section.filtered, { count }, locale),\n empty: () => section.empty,\n error: () => section.error,\n };\n}\n\n/** @internal The recycler section of the active pack over English. */\nconst injectRecyclerSection = createLanguageSection('recycler', CNGX_RECYCLER_LANGUAGE_EN);\n\n/** @internal Builds and reads the token, formatted for the reading locale. */\nconst recyclerBundle = createSectionBundle<CngxRecyclerLanguageSection, RecyclerI18n>({\n section: injectRecyclerSection,\n toBundle: recyclerBundleFrom,\n});\n\n/**\n * Injection token for recycler SR announcement texts, a `Signal` so the\n * texts follow a runtime language switch. Defaults to the recycler section\n * of the active language pack over English, counts formatted for the app\n * locale. Override with `provideRecyclerI18n()`.\n *\n * @category common/data/recycler\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler.ts\n * @since 0.1.0\n */\nexport const CNGX_RECYCLER_I18N = new InjectionToken<Signal<RecyclerI18n>>('CngxRecyclerI18n', {\n factory: () => recyclerBundle.build(),\n});\n\n/**\n * Branded feature-fn for {@link provideRecyclerI18n}.\n *\n * @category common/data/recycler\n */\nexport type CngxRecyclerI18nFeature = ((bundle: Signal<RecyclerI18n>) => Signal<RecyclerI18n>) & {\n readonly _target: 'i18n';\n};\n\n/** @internal */\nfunction defineRecyclerI18nFeature(\n fn: (bundle: Signal<RecyclerI18n>) => Signal<RecyclerI18n>,\n): CngxRecyclerI18nFeature {\n return Object.assign(fn, { _target: 'i18n' as const });\n}\n\n/**\n * Override recycler announcements via a partial bundle - keys you leave out\n * keep the language pack's text, or the English default. Pass a `Signal` to\n * switch the language at runtime.\n *\n * @category common/data/recycler\n */\nexport function withRecyclerI18nLabels(\n overrides: Partial<RecyclerI18n> | Signal<Partial<RecyclerI18n>>,\n): CngxRecyclerI18nFeature {\n return defineRecyclerI18nFeature((bundle) => createOverrideMerge(bundle, overrides));\n}\n\n/**\n * Provider for the recycler announcement texts. The features apply on top of\n * the active language pack.\n *\n * ```typescript\n * providers: [\n * provideRecyclerI18n(\n * withRecyclerI18nLabels({\n * empty: () => 'Keine Ergebnisse.',\n * error: () => 'Fehler beim Laden.',\n * }),\n * ),\n * ]\n * ```\n *\n * @category common/data/recycler\n */\nexport function provideRecyclerI18n(...features: readonly CngxRecyclerI18nFeature[]): Provider {\n return {\n provide: CNGX_RECYCLER_I18N,\n useFactory: () => recyclerBundle.build(features),\n };\n}\n\n/**\n * Configuration for {@link injectRecycler}.\n *\n * @category common/data/recycler\n */\nexport interface RecyclerConfig {\n /** Scroll container. CSS selector, native element, or `ElementRef`. */\n scrollElement: ElementRef | HTMLElement | string;\n\n /**\n * Total number of items. Reactive - changes on infinite scroll.\n *\n * **Important:** For infinite scroll, this is the number of *loaded* items,\n * not the server-side total. Otherwise the sentinel becomes unreachable.\n */\n totalCount: () => number;\n\n /**\n * Estimated height per item (px). A fixed `number`, a `Signal<number>` for a\n * reactive uniform estimate (e.g. an `input()` bound after construction), or a\n * `(index) => number` for genuine per-index variable heights. Only the last\n * form carries per-frame cost; a signal resolves to one uniform value.\n */\n estimateSize: number | Signal<number> | ((index: number) => number);\n\n /** Extra items to render above/below the viewport. Default: 5. */\n overscan?: number;\n\n /**\n * Layout mode. `'list'` (default) uses padding spacers.\n * `'grid'` is Phase 3 - passing it logs a dev-mode warning and falls back to `'list'`.\n */\n layout?: 'list' | 'grid';\n\n /** Column count for grid mode. Phase 3 - ignored in Phase 1. */\n columns?: number | (() => number);\n\n /** Debounce for scroll events in ms. Default: 16 (~1 frame). */\n scrollDebounce?: number;\n\n /**\n * Delay before skeletons are shown (ms). Default: 0.\n * E.g. 300 means `showSkeleton` only becomes `true` after 300ms -\n * fast loads (< 300ms) never show a skeleton.\n */\n skeletonDelay?: number;\n\n /**\n * Async state source. When set, the recycler derives skeleton rendering,\n * refresh state, and empty state from it - same convention as\n * `CngxCardGrid`, `CngxTreetable`, `CngxPopoverPanel`, and `CngxDialog`.\n */\n state?: CngxAsyncState<unknown>;\n\n /**\n * Server-side total for A11y (`aria-setsize`) and \"Showing X of Y\" display.\n * When not set, `totalCount` is used.\n */\n serverTotal?: () => number;\n}\n\n/**\n * Signal-based virtualizer returned by {@link injectRecycler}.\n * All derived values are `computed()` - the system cannot become inconsistent.\n *\n * @category common/data/recycler\n */\nexport interface CngxRecycler {\n /** Start index (inclusive) of the rendered range, including overscan. */\n readonly start: Signal<number>;\n /** End index (exclusive) of the rendered range, including overscan. */\n readonly end: Signal<number>;\n\n /** Spacer height before rendered items (px). Always 0 in grid mode. */\n readonly offsetBefore: Signal<number>;\n /** Spacer height after rendered items (px). Always 0 in grid mode. */\n readonly offsetAfter: Signal<number>;\n /** Total scrollable height of all items (px). */\n readonly totalSize: Signal<number>;\n\n /**\n * Representative row height (px) for a placeholder layer's repeat rhythm.\n * A numeric or `Signal<number>` `estimateSize` is already uniform, so it is\n * used verbatim; a per-index variable estimate has no single height, so the\n * average (`totalSize / totalCount`) stands in. Consumed by\n * {@link CngxRecyclerPlaceholder} to key its repeating skeleton interval off\n * the same rhythm the range uses. `0` on an empty list.\n */\n readonly rowSizeHint: Signal<number>;\n\n /** Placeholder count before rendered items. Only non-zero in grid mode. */\n readonly placeholdersBefore: Signal<number>;\n /** Placeholder count after rendered items. Only non-zero in grid mode. */\n readonly placeholdersAfter: Signal<number>;\n\n /** `true` during first load (`state.isFirstLoad()`). `false` without `state`. */\n readonly isLoading: Signal<boolean>;\n /** `true` during refresh (`state.isRefreshing()`). Data remains visible. */\n readonly isRefreshing: Signal<boolean>;\n /** `true` when `totalCount === 0` and not busy. */\n readonly isEmpty: Signal<boolean>;\n /** How many skeleton items fit in the viewport: `ceil(clientHeight / estimateSize)`. */\n readonly skeletonSlots: Signal<number>;\n /** `isLoading` AND `skeletonDelay` elapsed. Prevents skeleton flicker on fast loads. */\n readonly showSkeleton: Signal<boolean>;\n\n /** First actually visible index (without overscan). For UI display. */\n readonly firstVisible: Signal<number>;\n /** Last actually visible index (without overscan). For UI display. */\n readonly lastVisible: Signal<number>;\n /** Count of actually visible items (without overscan). */\n readonly visibleCount: Signal<number>;\n\n /**\n * Locks scroll position relative to an item. When items are inserted above\n * the anchored item, `scrollTop` is corrected to maintain visual position.\n */\n anchorTo(index: number): void;\n /** Releases the scroll anchor set by {@link anchorTo}. */\n releaseAnchor(): void;\n\n /**\n * Reports the index of the item that had focus when it left the rendered range.\n * `null` when no focus was lost. Consumer can use this to restore focus.\n */\n readonly lostFocus: Signal<{ index: number } | null>;\n\n /** SR announcement text for state transitions (load, filter, empty, error). */\n readonly announcement: Signal<string>;\n\n /** `serverTotal` when set, otherwise `totalCount`. Bind to `aria-setsize`. */\n readonly ariaSetSize: Signal<number>;\n\n /**\n * The range of item indices that must be available for rendering.\n * Use in an effect to trigger page loads for windowed/sparse data sources.\n *\n * Unlike `firstVisible`/`lastVisible` (which exclude overscan), this includes\n * overscan items - all indices in this range may be rendered.\n *\n * ```typescript\n * effect(() => {\n * const { start, end } = recycler.neededRange();\n * const startPage = Math.floor(start / PAGE_SIZE);\n * const endPage = Math.floor(end / PAGE_SIZE);\n * for (let p = startPage; p <= endPage; p++) {\n * if (!pageCache.has(p)) { loadPage(p); }\n * }\n * });\n * ```\n */\n readonly neededRange: Signal<{ start: number; end: number }>;\n\n /**\n * Target index that `scrollToIndex()` is waiting for.\n * Non-null when the target index exceeds `totalCount` - consumer\n * can show a \"Scrolling to item...\" indicator or trigger page loads.\n * Clears automatically when `totalCount` grows past the target.\n */\n readonly pendingTarget: Signal<number | null>;\n\n /**\n * Creates a `computed()` slicing items to the visible range.\n * **Call once in a field initializer** - each call creates a new computed node.\n * Do NOT call in templates or methods.\n */\n sliced<T>(items: Signal<T[]>): Signal<T[]>;\n\n /**\n * Reports a measured item height to the internal SizeCache.\n * No-op in grid mode (uniform row height assumed).\n * Prefer {@link CngxMeasure} directive over calling this directly.\n */\n measure(index: number, element: HTMLElement): void;\n\n /**\n * Scrolls to a specific item index. When `index >= totalCount`, stores\n * the target in {@link pendingTarget} for resolution when data arrives.\n */\n scrollToIndex(index: number, behavior?: ScrollBehavior): void;\n\n /** Scrolls to top. Convenience for sort/filter changes. */\n reset(): void;\n}\n\n/**\n * Creates a Signal-based virtualizer for DOM recycling.\n *\n * Must be called in an injection context (field initializer or constructor).\n * Internally injects `DestroyRef` and `DOCUMENT` for cleanup and selector resolution.\n *\n * ### Basic list\n * ```typescript\n * readonly recycler = injectRecycler({\n * scrollElement: '.scroll-container',\n * totalCount: () => this.items().length,\n * estimateSize: 48,\n * });\n * readonly visibleItems = this.recycler.sliced(this.items);\n * ```\n *\n * ### With async state\n * ```typescript\n * readonly state = injectAsyncState(() => this.api.getAll());\n * readonly recycler = injectRecycler({\n * scrollElement: '.scroll-container',\n * totalCount: () => (this.state.data() ?? []).length,\n * estimateSize: 64,\n * state: this.state,\n * });\n * ```\n *\n * @category common/data/recycler\n */\nexport function injectRecycler(config: RecyclerConfig): CngxRecycler {\n const destroyRef = inject(DestroyRef);\n const i18n = recyclerBundle.resolve(inject(CNGX_RECYCLER_I18N));\n const overscan = config.overscan ?? 5;\n const isGrid = (config.layout ?? 'list') === 'grid';\n\n if (isGrid && config.columns == null && isDevMode()) {\n console.error(\n '[CngxRecycler] layout: \"grid\" requires explicit `columns`. Falling back to columns=1.',\n );\n }\n\n // Reactive columns - reactive only if the function reads a Signal internally\n const columns = computed(() => {\n if (!isGrid || config.columns == null) {\n return 1;\n }\n return typeof config.columns === 'function' ? config.columns() : config.columns;\n });\n\n // A Signal is a zero-arg function but resolves to a uniform height, not a\n // per-index measurement - it carries no O(n) per-frame cost, so exclude it\n // from the variable-height warning (a reactive scalar estimate is a\n // sanctioned pattern; see the resolveSize note below).\n if (typeof config.estimateSize === 'function' && !isSignal(config.estimateSize) && isDevMode()) {\n const count = config.totalCount();\n if (count > 10_000) {\n console.warn(\n `[CngxRecycler] estimateSize as a function with ${count} items has O(n) ` +\n `per-frame cost. Consider using a fixed estimateSize for large datasets.`,\n );\n }\n }\n\n const scrollState = createScrollObserver(config.scrollElement, destroyRef);\n\n const sizeCache = createSizeCache();\n\n // Resolve size for an index: measured value from cache, or estimateSize fallback.\n // Reading sizeCache.version() creates a reactive dependency so that range\n // recomputes when measurements change.\n const resolveSize = (index: number): number => {\n sizeCache.version(); // track dependency\n return sizeCache.resolve(index, config.estimateSize);\n };\n\n // Signed scroll delta between consecutive scrollTop updates. A fast flick\n // produces large per-event deltas, so this doubles as a velocity proxy\n // regardless of whether scrollTop is sampled per-frame or per-event.\n const scrollVelocity = signal(0);\n let lastScrollTop = 0;\n effect(() => {\n const st = scrollState.scrollTop();\n untracked(() => {\n scrollVelocity.set(st - lastScrollTop);\n lastScrollTop = st;\n });\n });\n\n // Grid mode uses raw estimateSize (uniform row height, no SizeCache).\n // List mode uses resolveSize (SizeCache-backed).\n const range = computed(() => {\n const cols = columns();\n const size = isGrid ? config.estimateSize : resolveSize;\n const scrollTop = scrollState.scrollTop();\n const clientHeight = scrollState.clientHeight();\n const total = config.totalCount();\n\n // Directional overscan: the rendered range trails scroll by up to a frame,\n // so pre-render extra items into the scroll direction to keep the leading\n // edge populated (otherwise a fast scroll flashes a blank strip). Scale the\n // lead with velocity, capped at one viewport of items so a teleport jump\n // never expands the window unbounded. Trailing edge keeps the base overscan.\n const estimate = config.estimateSize;\n const refPx =\n typeof estimate === 'number' && estimate > 0 ? estimate : Math.max(1, clientHeight / 8);\n const itemsPerViewport = Math.max(1, Math.ceil(clientHeight / refPx));\n const velocity = scrollVelocity();\n const leadItems = Math.min(Math.ceil(Math.abs(velocity) / refPx), itemsPerViewport);\n const scrollingDown = velocity >= 0;\n const overscanBefore = overscan + (scrollingDown ? 0 : leadItems);\n const overscanAfter = overscan + (scrollingDown ? leadItems : 0);\n\n return computeRange(scrollTop, clientHeight, total, size, overscanBefore, cols, overscanAfter);\n });\n\n const start = computed(() => range().start);\n const end = computed(() => range().end);\n\n // Grid mode: pixel spacers are 0 (placeholders used instead)\n const offsetBefore = computed(() => (isGrid ? 0 : range().offsetBefore));\n const offsetAfter = computed(() => (isGrid ? 0 : range().offsetAfter));\n const totalSize = computed(() => range().totalSize);\n\n // Representative row height for a placeholder layer's repeat interval. Derived,\n // never stored: a uniform estimate (number or signal) is the rhythm directly;\n // a per-index estimate has no single height, so the running average stands in.\n const rowSizeHint = computed(() => {\n const estimate = config.estimateSize;\n if (typeof estimate === 'number') {\n return estimate;\n }\n if (isSignal(estimate)) {\n return estimate();\n }\n const total = config.totalCount();\n if (total <= 0) {\n return 0;\n }\n return totalSize() / total;\n });\n\n const placeholdersBefore = computed(() => (isGrid ? start() : 0));\n const placeholdersAfter = computed(() => (isGrid ? Math.max(0, config.totalCount() - end()) : 0));\n\n // start/end include overscan. firstVisible/lastVisible strip it back\n // to reflect the items actually in the viewport.\n // In grid mode, overscan is in rows (ceil(overscan/columns) * columns items).\n const effectiveOverscan = computed(() => {\n const cols = columns();\n if (cols <= 1) {\n return overscan;\n }\n return Math.ceil(overscan / cols) * cols;\n });\n\n const firstVisible = computed(() => {\n const total = config.totalCount();\n if (total === 0) {\n return 0;\n }\n return Math.min(start() + effectiveOverscan(), total - 1);\n });\n\n const lastVisible = computed(() => {\n const total = config.totalCount();\n if (total === 0) {\n return 0;\n }\n return clamp(end() - effectiveOverscan() - 1, 0, total - 1);\n });\n\n const visibleCount = computed(() => {\n const total = config.totalCount();\n if (total === 0) {\n return 0;\n }\n return Math.max(0, lastVisible() - firstVisible() + 1);\n });\n\n const state = config.state;\n const isLoading = computed(() => state?.isFirstLoad() ?? false);\n const isRefreshing = computed(() => state?.isRefreshing() ?? false);\n\n const isEmpty = computed(() => {\n if (state?.isBusy()) {\n return false;\n }\n return config.totalCount() === 0;\n });\n\n const skeletonSlots = computed(() => {\n const ch = scrollState.clientHeight();\n if (ch <= 0) {\n return 0;\n }\n // Resolve estimateSize reactively - function variant may read signals internally\n const itemHeight =\n typeof config.estimateSize === 'number' ? config.estimateSize : config.estimateSize(0);\n return Math.ceil(ch / itemHeight);\n });\n\n const showSkeleton = createVisibilityGate(\n isLoading,\n computed(() => config.skeletonDelay ?? 0),\n computed(() => 0),\n );\n\n // previousTotal is a signal, not a mutable let - reactive, no stale-value risk.\n const announcementState = signal('');\n const previousTotal = signal(config.totalCount());\n\n if (state) {\n const tracker = createTransitionTracker(() => state.status());\n\n effect(() => {\n const current = tracker.current();\n const previous = tracker.previous();\n const total = config.totalCount();\n // untracked: previousTotal is bookkeeping, not a dependency -\n // the effect should fire on status/totalCount changes, not on its own writes.\n const prevTotal = untracked(() => previousTotal());\n\n // Transition-only - never announce on initial idle\n if (previous === current) {\n return;\n }\n\n // Copy is read untracked: a language switch must not re-run the\n // effect and re-voice the region; the next transition speaks it.\n untracked(() => {\n const copy = i18n();\n // Route by result first: a load that settles with zero items is the\n // empty phrase, no matter which busy status preceded it - \"0 results\n // found\" is the filtered phrase, not the empty one.\n if (current === 'success' && total === 0) {\n announcementState.set(copy.empty());\n } else if (current === 'success' && (previous === 'loading' || previous === 'refreshing')) {\n const diff = total - prevTotal;\n announcementState.set(diff > 0 ? copy.loaded(diff, total) : copy.filtered(total));\n } else if (current === 'error') {\n announcementState.set(copy.error());\n }\n });\n\n untracked(() => previousTotal.set(total));\n });\n } else {\n // Without async state, track totalCount changes for infinite scroll announcements\n effect(() => {\n const total = config.totalCount();\n // untracked: previousTotal is bookkeeping, not a dependency\n const prevTotal = untracked(() => previousTotal());\n const diff = total - prevTotal;\n\n untracked(() => {\n const copy = i18n();\n if (prevTotal > 0 && diff > 0) {\n announcementState.set(copy.loaded(diff, total));\n } else if (prevTotal > 0 && total === 0) {\n announcementState.set(copy.empty());\n }\n });\n\n untracked(() => previousTotal.set(total));\n });\n }\n\n const ariaSetSize = computed(() => config.serverTotal?.() ?? config.totalCount());\n\n const anchorState = signal<{ index: number; offsetFromTop: number } | null>(null);\n\n function computeItemTop(targetIndex: number, cols?: number): number {\n // Grid mode: row-based offset (uniform row height)\n if (isGrid && typeof config.estimateSize === 'number') {\n const c = cols ?? columns();\n return Math.floor(targetIndex / c) * config.estimateSize;\n }\n let top = 0;\n for (let i = 0; i < targetIndex; i++) {\n top += sizeCache.resolve(i, config.estimateSize);\n }\n return top;\n }\n\n // Anchor correction effect: when items shift above the anchored item,\n // correct scrollTop to keep it at the same visual position.\n effect(() => {\n const anchor = anchorState();\n if (!anchor) {\n return;\n }\n sizeCache.version(); // re-run when sizes change\n config.totalCount(); // re-run when items change\n const cols = columns(); // re-run when columns change (responsive grid)\n const el = scrollState.element();\n if (!el) {\n return;\n }\n const currentItemTop = computeItemTop(anchor.index, cols);\n const targetScrollTop = currentItemTop - anchor.offsetFromTop;\n if (Math.abs(el.scrollTop - targetScrollTop) > 1) {\n el.scrollTop = targetScrollTop;\n }\n });\n\n // Tracks which item has focus inside the scroll container.\n // Uses `data-cngx-recycle-index` attribute on items (set by CngxMeasure or consumer).\n // When a focused item leaves the visible range, `lostFocus` reports its index.\n const focusedIndex = signal<number | null>(null);\n\n effect((onCleanup) => {\n const el = scrollState.element();\n if (!el) {\n return;\n }\n const handleFocusIn = (e: FocusEvent): void => {\n const target = (e.target as HTMLElement).closest('[data-cngx-recycle-index]');\n if (target) {\n focusedIndex.set(Number(target.getAttribute('data-cngx-recycle-index')));\n }\n };\n const handleFocusOut = (): void => {\n focusedIndex.set(null);\n };\n el.addEventListener('focusin', handleFocusIn);\n el.addEventListener('focusout', handleFocusOut);\n onCleanup(() => {\n el.removeEventListener('focusin', handleFocusIn);\n el.removeEventListener('focusout', handleFocusOut);\n });\n });\n\n const lostFocus = computed(() => {\n const fi = focusedIndex();\n if (fi == null) {\n return null;\n }\n const s = start();\n const e = end();\n if (fi < s || fi >= e) {\n return { index: fi };\n }\n return null;\n });\n\n const neededRange = computed(() => ({ start: start(), end: end() }));\n\n const pendingScrollTarget = signal<{ index: number; behavior: ScrollBehavior } | null>(null);\n const pendingTarget = computed(() => pendingScrollTarget()?.index ?? null);\n\n // Watch totalCount - when it grows past the pending target, execute the scroll.\n // Uses untracked() for pendingScrollTarget reads/writes to avoid write-inside-read loops.\n // Only totalCount is a tracked dependency.\n effect(() => {\n const total = config.totalCount(); // tracked dependency\n const target = untracked(() => pendingScrollTarget()); // NOT tracked\n if (!target || target.index >= total) {\n return;\n }\n untracked(() => {\n pendingScrollTarget.set(null);\n const el = scrollState.element();\n if (el) {\n const top = computeItemTop(target.index);\n el.scrollTo({ top, behavior: target.behavior });\n }\n });\n });\n\n return {\n start,\n end,\n offsetBefore,\n offsetAfter,\n totalSize,\n rowSizeHint,\n\n placeholdersBefore,\n placeholdersAfter,\n\n isLoading,\n isRefreshing,\n isEmpty,\n skeletonSlots,\n showSkeleton,\n\n firstVisible,\n lastVisible,\n visibleCount,\n\n anchorTo(index: number): void {\n const el = scrollState.element();\n if (!el) {\n return;\n }\n const itemTop = computeItemTop(index);\n anchorState.set({ index, offsetFromTop: itemTop - el.scrollTop });\n },\n\n releaseAnchor(): void {\n anchorState.set(null);\n },\n\n lostFocus,\n\n pendingTarget,\n neededRange,\n\n announcement: announcementState.asReadonly(),\n\n ariaSetSize,\n\n sliced<T>(items: Signal<T[]>): Signal<T[]> {\n return computed(() => items().slice(start(), end()));\n },\n\n measure(index: number, element: HTMLElement): void {\n // Grid mode assumes uniform row height - SizeCache writes would break row-based range.\n if (isGrid) {\n return;\n }\n const height = element.getBoundingClientRect().height;\n if (height > 0) {\n sizeCache.set(index, height);\n }\n },\n\n scrollToIndex(index: number, behavior: ScrollBehavior = 'auto'): void {\n const total = config.totalCount();\n if (index >= total) {\n // Deep-link: target not loaded yet - store for later resolution\n pendingScrollTarget.set({ index, behavior });\n return;\n }\n pendingScrollTarget.set(null);\n const el = scrollState.element();\n if (el) {\n el.scrollTo({ top: computeItemTop(index), behavior });\n }\n },\n\n reset(): void {\n const el = scrollState.element();\n if (el) {\n el.scrollTop = 0;\n }\n },\n };\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Directive, ElementRef, effect, inject, input } from '@angular/core';\nimport { observeResize } from '@cngx/common/layout';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Atom directive that measures the host element's height and reports it\n * to the recycler via `recycler.measure(index, element)`.\n *\n * Uses `ResizeObserver` to detect height changes (e.g. content expansion,\n * font loading). Cleanup is automatic via `DestroyRef`.\n *\n * Also sets `data-cngx-recycle-index` on the host element for focus tracking.\n *\n * ```html\n * @for (item of visibleItems(); track item.id; let i = $index) {\n * <div [cngxMeasure]=\"recycler\" [cngxMeasureIndex]=\"recycler.start() + i\">\n * {{ item.content }}\n * </div>\n * }\n * ```\n *\n * @category common/data/recycler\n * @docsKind primary\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/measure.directive.ts\n * @since 0.1.0\n * @relatedTo CngxVirtualItem, CngxRecyclerAnnouncer, injectRecycler\n *\n * <example-url>http://localhost:4200/#/common/data/recycler/basic-list-fixed-item-height</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/content-visibility-css-only</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/infinite-scroll-recycler</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/scrolltoindex-deep-link</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/variable-heights-cngxmeasure</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>\n */\n@Directive({\n selector: '[cngxMeasure]',\n standalone: true,\n host: {\n '[attr.data-cngx-recycle-index]': 'cngxMeasureIndex()',\n },\n})\nexport class CngxMeasure {\n /** The recycler instance to report measurements to. */\n readonly cngxMeasure = input.required<CngxRecycler>();\n\n /** The absolute index of this item in the full dataset. */\n readonly cngxMeasureIndex = input.required<number>();\n\n private readonly el = inject(ElementRef<HTMLElement>);\n private readonly win = inject(DOCUMENT).defaultView;\n\n constructor() {\n effect((onCleanup) => {\n const recycler = this.cngxMeasure();\n const index = this.cngxMeasureIndex();\n const element = this.el.nativeElement as HTMLElement;\n\n recycler.measure(index, element);\n\n // The observed element follows the inputs, so the subscription is\n // re-wired per effect run - the low-level kernel form, not the\n // DestroyRef-scoped one.\n onCleanup(\n observeResize(this.win, element, 'content-box', () => {\n recycler.measure(index, element);\n }),\n );\n });\n }\n}\n","import { Directive, computed, input } from '@angular/core';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * A11y atom that sets `aria-setsize`, `aria-posinset`, and `data-cngx-recycle-index`\n * on each rendered virtual item. Replaces manual ARIA boilerplate.\n *\n * Also provides `data-cngx-recycle-index` for focus tracking - consumers who\n * don't use `CngxMeasure` (grid mode, uniform heights) get focus tracking for free.\n *\n * Does NOT set `role` - the consumer decides (`listitem`, `option`, `treeitem`, `tab`).\n *\n * ```html\n * @for (item of visibleItems(); track item.id; let i = $index) {\n * <div role=\"listitem\"\n * [cngxVirtualItem]=\"recycler\"\n * [cngxVirtualItemIndex]=\"recycler.start() + i\">\n * {{ item.name }}\n * </div>\n * }\n * ```\n *\n * @category common/data/recycler\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/virtual-item.directive.ts\n * @since 0.1.0\n * @relatedTo CngxMeasure, CngxRecyclerAnnouncer, injectRecycler\n *\n * <example-url>http://localhost:4200/#/common/data/recycler/basic-list-fixed-item-height</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/content-visibility-css-only</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/infinite-scroll-recycler</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/scrolltoindex-deep-link</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/variable-heights-cngxmeasure</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>\n */\n@Directive({\n selector: '[cngxVirtualItem]',\n standalone: true,\n host: {\n '[attr.aria-setsize]': 'ariaSetSize()',\n '[attr.aria-posinset]': 'ariaPosinset()',\n '[attr.data-cngx-recycle-index]': 'cngxVirtualItemIndex()',\n },\n})\nexport class CngxVirtualItem {\n /** The recycler instance providing `ariaSetSize`. */\n readonly cngxVirtualItem = input.required<CngxRecycler>();\n\n /** The absolute 0-based index of this item in the full dataset. */\n readonly cngxVirtualItemIndex = input.required<number>();\n\n /** Total item count for `aria-setsize`. */\n protected readonly ariaSetSize = computed(() => this.cngxVirtualItem().ariaSetSize());\n\n /** 1-based position for `aria-posinset`. */\n protected readonly ariaPosinset = computed(() => this.cngxVirtualItemIndex() + 1);\n}\n","import { DOCUMENT } from '@angular/common';\nimport { computed, DestroyRef, Directive, inject, input, type Signal } from '@angular/core';\nimport { createMediaQuerySignal } from '@cngx/core/utils';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Paints a row-aligned skeleton background under a virtualized scroll region so\n * a fast fling or teleport jump reveals placeholder bars instead of the bare\n * panel/page surface for the single frame the rendered rows lag `scrollTop`.\n *\n * The mechanism is a static CSS layer, not a reactive template: by the time a\n * `@for` over \"uncovered indices\" could render, change detection has already\n * produced the real rows, so the lag frame is never painted reactively. A\n * `background` on the offset element always paints and also covers teleport\n * jumps no reactive window can, at zero per-frame cost.\n *\n * Host it on the **offset spacer element(s)** - the empty divs (or presentation\n * `<li>`s) whose height reserves `offsetBefore` / `offsetAfter` - one directive\n * instance per spacer. Do NOT host it on a `padding-block`ed content element\n * that also contains the rows: a background paints across the whole padding box,\n * so it would show through *behind* every rendered row, not just in the gap.\n * The spacers carry no rows, so the layer is only ever visible where the window\n * has not caught up.\n *\n * The repeat interval keys off a single representative row height: bind the\n * recycler to read its `rowSizeHint`, or pass an explicit `[rowHeight]`\n * fallback so the directive is usable standalone. Visuals are driven by\n * `--cngx-recycler-placeholder-*` CSS custom properties (see\n * `@cngx/common/theming/components/cngx-recycler-placeholder.css`); the shimmer\n * drops under `prefers-reduced-motion` via a spec-observable host class.\n *\n * ### One instance per offset spacer, keyed off the recycler's rhythm\n * ```html\n * <ul>\n * @if (recycler.offsetBefore(); as before) {\n * <li role=\"presentation\" aria-hidden=\"true\"\n * [cngxRecyclerPlaceholder]=\"recycler\" [style.height.px]=\"before\"></li>\n * }\n * @for (item of visibleItems(); track item.id) { <li>...</li> }\n * @if (recycler.offsetAfter(); as after) {\n * <li role=\"presentation\" aria-hidden=\"true\"\n * [cngxRecyclerPlaceholder]=\"recycler\" [style.height.px]=\"after\"></li>\n * }\n * </ul>\n * ```\n *\n * ### Standalone with an explicit row height\n * ```html\n * <div cngxRecyclerPlaceholder [rowHeight]=\"48\"\n * [style.height.px]=\"recycler.offsetBefore()\"></div>\n * ```\n *\n * @category common/data/recycler\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-placeholder.directive.ts\n * @since 0.1.0\n * @relatedTo injectRecycler, CngxRecyclerRow, CngxVirtualItem, CngxMeasure\n * <example-url>http://localhost:4200/#/common/data/recycler/fast-fling-placeholders</example-url>\n */\n@Directive({\n selector: '[cngxRecyclerPlaceholder]',\n standalone: true,\n host: {\n class: 'cngx-recycler-placeholder',\n // The layer is a decorative background on an offset spacer. Hide it from the\n // a11y tree at the host so it stays out regardless of the call site, not only\n // when a consumer remembers to add aria-hidden.\n 'aria-hidden': 'true',\n '[class.cngx-recycler-placeholder--shimmer]': 'showShimmer()',\n '[style.--cngx-recycler-placeholder-row-height]': 'rowHeightVar()',\n },\n})\nexport class CngxRecyclerPlaceholder {\n /**\n * The recycler whose `rowSizeHint` sets the placeholder repeat rhythm.\n * Optional: the directive also works from an explicit `[rowHeight]`, so this\n * follows the bridge-input shape (optional + empty-string transform) rather\n * than `input.required` - a bare `cngxRecyclerPlaceholder` attribute paired\n * with `[rowHeight]` is a valid, unbound usage.\n */\n readonly recycler = input<CngxRecycler | undefined, CngxRecycler | '' | undefined>(undefined, {\n alias: 'cngxRecyclerPlaceholder',\n transform: (value) => (typeof value === 'string' ? undefined : value),\n });\n\n /** Explicit row height (px) used when no recycler is bound, or as a fallback. */\n readonly rowHeight = input<number | undefined>(undefined);\n\n private readonly prefersReducedMotion: Signal<boolean>;\n\n constructor() {\n this.prefersReducedMotion = createMediaQuerySignal(\n '(prefers-reduced-motion: reduce)',\n inject(DestroyRef),\n inject(DOCUMENT).defaultView,\n );\n }\n\n /**\n * Representative row height (px) for the repeat interval. The recycler's\n * `rowSizeHint` wins when it resolves to a positive value; otherwise the\n * explicit `[rowHeight]` fallback applies.\n */\n protected readonly resolvedRowHeight = computed(() => {\n const fromRecycler = this.recycler()?.rowSizeHint() ?? 0;\n if (fromRecycler > 0) {\n return fromRecycler;\n }\n return this.rowHeight() ?? 0;\n });\n\n /**\n * The `--cngx-recycler-placeholder-row-height` style value. `null` when no\n * row height resolves, so the registered `@property` default (or an inherited\n * token from an ancestor mapping) applies instead of a broken `0px` interval.\n */\n protected readonly rowHeightVar = computed(() => {\n const height = this.resolvedRowHeight();\n return height > 0 ? `${height}px` : null;\n });\n\n /** Whether the shimmer host class is applied (dropped under reduced-motion). */\n protected readonly showShimmer = computed(() => !this.prefersReducedMotion());\n}\n","import {\n DestroyRef,\n Directive,\n effect,\n type EmbeddedViewRef,\n inject,\n InjectionToken,\n input,\n type Provider,\n Renderer2,\n TemplateRef,\n untracked,\n ViewContainerRef,\n} from '@angular/core';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Context for the placeholder branch of `*cngxRecyclerRow` - the window slot\n * whose item has not loaded yet (`undefined`). A custom `placeholder:` template\n * reads this to keep the list count honest for assistive technology:\n * `aria-posinset = index + 1`, `aria-setsize = setSize`.\n *\n * The real-row branch (item defined) binds `$implicit` to the item value\n * instead; that context is internal and narrowed by `ngTemplateContextGuard`.\n *\n * @category common/data/recycler\n */\nexport interface CngxRecyclerRowContext {\n /** The absolute dataset index of this slot. Alias of `index`. */\n $implicit: number;\n /** The absolute dataset index of this slot. */\n index: number;\n /** Pixel offset of the slot from the top of the scroll content. */\n top: number;\n /** Total set size (`recycler.ariaSetSize()`) for `aria-setsize`. */\n setSize: number;\n}\n\n/** Internal real-row context: the loaded item at this window position. */\ninterface CngxRecyclerRowRealContext<T> {\n $implicit: T;\n cngxRecyclerRow: T;\n}\n\n/**\n * App-wide default placeholder template for `*cngxRecyclerRow`. Middle rung of\n * the cascade: microsyntax `placeholder:` template wins over this, and this wins\n * over the built-in imperative `<li>` default. Defaults to `null` (imperative\n * default applies).\n *\n * @category common/data/recycler\n */\nexport const CNGX_RECYCLER_PLACEHOLDER_ROW = new InjectionToken<\n TemplateRef<CngxRecyclerRowContext> | null\n>('CNGX_RECYCLER_PLACEHOLDER_ROW', { providedIn: 'root', factory: () => null });\n\n/**\n * Provides an app-wide default placeholder template for every `*cngxRecyclerRow`\n * that supplies no `placeholder:` template of its own.\n *\n * @category common/data/recycler\n */\nexport function provideRecyclerPlaceholderRow(\n template: TemplateRef<CngxRecyclerRowContext>,\n): Provider {\n return { provide: CNGX_RECYCLER_PLACEHOLDER_ROW, useValue: template };\n}\n\n/**\n * Per-window-position render switch for a sparse/windowed recycler: renders the\n * consumer's real-row template when the sliced item is defined, and a\n * placeholder branch when the item is still `undefined` (loaded window, data\n * not yet resolved).\n *\n * Mirrors the `*cngxAsync` structural-directive shape (own `TemplateRef` +\n * microsyntax alternate template + `ngTemplateContextGuard`). The switch axis is\n * data availability, not async status, so the two are siblings, not the same\n * class. Unlike `*cngxAsync` (which clears on every switch) the real-row view is\n * cached and re-attached across a placeholder detour, so a\n * defined -> undefined -> defined flip never remounts the expensive real row.\n *\n * The placeholder branch resolves through a 3-stage cascade: the microsyntax\n * `placeholder:` template, then {@link CNGX_RECYCLER_PLACEHOLDER_ROW}, then a\n * built-in imperative `<li>` default. The default assumes a `<ul>`/`<li>` list;\n * a non-`<li>` container (`<div role=\"list\">`) supplies a `placeholder:`\n * template or the config token instead.\n *\n * The two placeholder layers are orthogonal and non-overlapping by\n * construction: {@link CngxRecyclerPlaceholder} paints a decorative background\n * on the offset spacers (indices outside the rendered window), while this\n * directive fills holes inside the window whose item is still `undefined`.\n *\n * ### Windowed list with the built-in placeholder row\n * ```html\n * <ul>\n * @for (item of visibleItems(); track item?.id ?? ('ph:' + (recycler.start() + $index)); let i = $index) {\n * <li *cngxRecyclerRow=\"item; index: recycler.start() + i; recycler: recycler; let row\">\n * {{ row?.name }}\n * </li>\n * }\n * </ul>\n * ```\n *\n * ### Custom placeholder template\n * ```html\n * <ul>\n * @for (item of visibleItems(); track item?.id ?? ('ph:' + (recycler.start() + $index)); let i = $index) {\n * <li *cngxRecyclerRow=\"item; index: recycler.start() + i; recycler: recycler; placeholder: ph; let row\">\n * {{ row?.name }}\n * </li>\n * }\n * <ng-template #ph let-index let-setSize=\"setSize\">\n * <li role=\"listitem\" aria-busy=\"true\" [attr.aria-posinset]=\"index + 1\" [attr.aria-setsize]=\"setSize\">\n * Loading row {{ index + 1 }}\n * </li>\n * </ng-template>\n * </ul>\n * ```\n *\n * @category common/data/recycler\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-row.directive.ts\n * @since 0.1.0\n * @relatedTo injectRecycler, CngxRecyclerPlaceholder, CngxVirtualItem, CngxMeasure\n * <example-url>http://localhost:4200/#/common/data/recycler/windowed-data-availability</example-url>\n */\n@Directive({\n selector: '[cngxRecyclerRow]',\n standalone: true,\n})\nexport class CngxRecyclerRow<T> {\n private readonly vcr = inject(ViewContainerRef);\n private readonly rowTpl = inject<TemplateRef<CngxRecyclerRowRealContext<T>>>(TemplateRef);\n private readonly renderer = inject(Renderer2);\n private readonly configTpl = inject(CNGX_RECYCLER_PLACEHOLDER_ROW);\n\n /** The sliced item at this window position. `undefined` selects the placeholder branch. */\n readonly cngxRecyclerRow = input<T | undefined>(undefined);\n\n /** Absolute dataset index of this slot (`recycler.start() + $index`). */\n readonly cngxRecyclerRowIndex = input.required<number>();\n\n /** The recycler driving the window, read for `rowSizeHint` (-> `top`) and `ariaSetSize`. */\n readonly cngxRecyclerRowRecycler = input.required<CngxRecycler>();\n\n /** Optional placeholder template for the `undefined` branch. Context: {@link CngxRecyclerRowContext}. */\n readonly cngxRecyclerRowPlaceholder = input<TemplateRef<CngxRecyclerRowContext> | undefined>(\n undefined,\n );\n\n // Plain fields, not signals: read and written only inside the render effect.\n // As signals they would feed the effect's own dependency graph and double-fire\n // per branch switch (the trap documented in async.directive.ts).\n private currentBranch: 'row' | 'placeholder' | 'none' = 'none';\n private rowViewRef: EmbeddedViewRef<CngxRecyclerRowRealContext<T>> | null = null;\n private placeholderViewRef: EmbeddedViewRef<CngxRecyclerRowContext> | null = null;\n private defaultEl: HTMLElement | null = null;\n\n constructor() {\n effect(() => {\n const item = this.cngxRecyclerRow();\n if (item === undefined) {\n // Placeholder branch tracks index + ariaSetSize (via buildPlaceholderContext)\n // so the announced position/size stay live while the slot remains unloaded\n // across a window shift or an infinite-scroll setSize growth - Pillar 2\n // keeps a11y in the reactive graph, never a one-time write. The row branch\n // tracks only the item value; the placeholder template ref is read untracked.\n this.showPlaceholder(this.buildPlaceholderContext());\n } else {\n this.showRow(item);\n }\n });\n\n inject(DestroyRef).onDestroy(() => {\n // The cached row view may be detached (not owned by the VCR), so the VCR\n // will not tear it down; destroy both views explicitly, guarding the\n // already-destroyed case when the VCR got there first.\n if (this.rowViewRef && !this.rowViewRef.destroyed) {\n this.rowViewRef.destroy();\n }\n this.teardownPlaceholder();\n });\n }\n\n private showRow(item: T): void {\n if (this.currentBranch === 'row') {\n this.setRowContext(item);\n this.rowViewRef?.markForCheck();\n return;\n }\n this.teardownPlaceholder();\n if (this.rowViewRef) {\n this.setRowContext(item);\n this.vcr.insert(this.rowViewRef);\n this.rowViewRef.markForCheck();\n } else {\n this.rowViewRef = this.vcr.createEmbeddedView(this.rowTpl, {\n $implicit: item,\n cngxRecyclerRow: item,\n });\n }\n this.currentBranch = 'row';\n }\n\n private showPlaceholder(ctx: CngxRecyclerRowContext): void {\n if (this.currentBranch === 'placeholder') {\n this.refreshPlaceholder(ctx);\n return;\n }\n this.detachRow();\n this.renderPlaceholder(ctx);\n this.currentBranch = 'placeholder';\n }\n\n private setRowContext(item: T): void {\n if (this.rowViewRef) {\n this.rowViewRef.context.$implicit = item;\n this.rowViewRef.context.cngxRecyclerRow = item;\n }\n }\n\n // Remove the cached row view from the container WITHOUT destroying it, so the\n // next 'row' branch re-attaches the same EmbeddedViewRef (no remount).\n private detachRow(): void {\n if (!this.rowViewRef) {\n return;\n }\n const at = this.vcr.indexOf(this.rowViewRef);\n if (at !== -1) {\n this.vcr.detach(at);\n }\n }\n\n private teardownPlaceholder(): void {\n if (this.placeholderViewRef) {\n this.placeholderViewRef.destroy();\n this.placeholderViewRef = null;\n }\n this.removeDefault();\n }\n\n private renderPlaceholder(ctx: CngxRecyclerRowContext): void {\n const tpl = untracked(() => this.cngxRecyclerRowPlaceholder()) ?? this.configTpl ?? null;\n if (tpl) {\n this.placeholderViewRef = this.vcr.createEmbeddedView(tpl, ctx);\n } else {\n this.stampDefault(ctx);\n }\n }\n\n // Slot stayed unloaded but its index/setSize moved: refresh the live a11y\n // position/size in place - custom template context or default element attrs -\n // without remounting the placeholder.\n private refreshPlaceholder(ctx: CngxRecyclerRowContext): void {\n if (this.placeholderViewRef) {\n const context = this.placeholderViewRef.context;\n context.$implicit = ctx.$implicit;\n context.index = ctx.index;\n context.top = ctx.top;\n context.setSize = ctx.setSize;\n this.placeholderViewRef.markForCheck();\n } else if (this.defaultEl) {\n this.applyDefaultAttrs(this.defaultEl, ctx);\n }\n }\n\n // Terminal fallback: a module-level TemplateRef cannot exist, so the built-in\n // default is one imperative <li> reusing the shipped `cngx-recycler-placeholder`\n // ghost-row CSS. It holds a real dataset position, so it stays in the a11y tree\n // (aria-busy / role=listitem / posinset / setsize) - never aria-hidden.\n private stampDefault(ctx: CngxRecyclerRowContext): void {\n const anchor = this.vcr.element.nativeElement as Node;\n const parent = this.renderer.parentNode(anchor) as Node | null;\n if (!parent) {\n return;\n }\n const li = this.renderer.createElement('li') as HTMLElement;\n this.renderer.addClass(li, 'cngx-recycler-placeholder');\n this.renderer.setAttribute(li, 'role', 'listitem');\n this.renderer.setAttribute(li, 'aria-busy', 'true');\n this.applyDefaultAttrs(li, ctx);\n this.renderer.insertBefore(parent, li, anchor);\n this.defaultEl = li;\n }\n\n private applyDefaultAttrs(li: HTMLElement, ctx: CngxRecyclerRowContext): void {\n const height = untracked(() => this.cngxRecyclerRowRecycler().rowSizeHint());\n this.renderer.setAttribute(li, 'aria-posinset', String(ctx.index + 1));\n this.renderer.setAttribute(li, 'aria-setsize', String(ctx.setSize));\n this.renderer.setStyle(li, 'height', `${height}px`);\n this.renderer.setStyle(li, '--cngx-recycler-placeholder-row-height', `${height}px`);\n }\n\n private removeDefault(): void {\n if (!this.defaultEl) {\n return;\n }\n const parent = this.renderer.parentNode(this.defaultEl) as Node | null;\n if (parent) {\n this.renderer.removeChild(parent, this.defaultEl);\n }\n this.defaultEl = null;\n }\n\n // Called only from the placeholder branch of the render effect: reading index\n // + ariaSetSize here (tracked) is what keeps the announced position/size\n // reactive. rowSizeHint is a stable layout hint, read untracked for `top`.\n private buildPlaceholderContext(): CngxRecyclerRowContext {\n const index = this.cngxRecyclerRowIndex();\n const recycler = this.cngxRecyclerRowRecycler();\n const setSize = recycler.ariaSetSize();\n const top = untracked(() => recycler.rowSizeHint()) * index;\n return { $implicit: index, index, top, setSize };\n }\n\n /** Narrows the directive's own template context to the loaded item type. */\n static ngTemplateContextGuard<T>(\n _dir: CngxRecyclerRow<T>,\n _ctx: unknown,\n ): _ctx is CngxRecyclerRowRealContext<T> {\n return true;\n }\n}\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Convenience component that renders the `aria-live=\"polite\"` region\n * for recycler SR announcements. Eliminates manual boilerplate.\n *\n * Uses `display: contents` - no layout impact.\n *\n * ```html\n * <cngx-recycler-announcer [cngxRecyclerAnnouncer]=\"recycler\" />\n * ```\n *\n * @category common/data/recycler\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-announcer.component.ts\n * @since 0.1.0\n * @relatedTo CngxMeasure, CngxVirtualItem, injectRecycler, CNGX_RECYCLER_I18N\n *\n * <example-url>http://localhost:4200/#/common/data/recycler/basic-list-fixed-item-height</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/content-visibility-css-only</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/infinite-scroll-recycler</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/scrolltoindex-deep-link</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/variable-heights-cngxmeasure</example-url>\n * <example-url>http://localhost:4200/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>\n */\n@Component({\n selector: 'cngx-recycler-announcer',\n standalone: true,\n template: `<span aria-live=\"polite\" aria-atomic=\"true\" class=\"cngx-sr-only\">{{\n recycler().announcement()\n }}</span>`,\n host: { style: 'display: contents' },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CngxRecyclerAnnouncer {\n /** The recycler instance providing `announcement()`. */\n readonly recycler = input.required<CngxRecycler>({ alias: 'cngxRecyclerAnnouncer' });\n}\n","import { ElementRef, effect, inject, untracked } from '@angular/core';\n// type-only: instance is passed in by the consumer via inject(..., { host: true })\nimport type { CngxRovingTabindex } from '@cngx/common/a11y';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Wires a `CngxRecycler` to a `CngxRovingTabindex` in virtual mode.\n *\n * When the roving tabindex navigates to an item that is not in the DOM\n * (out of rendered range), this function scrolls the recycler to that item\n * and focuses it after rendering.\n *\n * Must be called in an injection context (constructor or field initializer)\n * **on the component that hosts both the recycler's scroll container and the\n * `CngxRovingTabindex` directive**. The injected `ElementRef` is used to query\n * `[data-cngx-recycle-index]` - calling from a child component would query the\n * wrong subtree.\n *\n * ```typescript\n * @Component({\n * hostDirectives: [\n * { directive: CngxRovingTabindex, inputs: ['orientation', 'activeIndex', 'virtualCount'] },\n * ],\n * })\n * class MyVirtualList {\n * private readonly roving = inject(CngxRovingTabindex, { host: true });\n * readonly recycler = injectRecycler({ ... });\n *\n * constructor() {\n * connectRecyclerToRoving(this.recycler, this.roving);\n * }\n * }\n * ```\n *\n * @category common/data/recycler\n */\nexport function connectRecyclerToRoving(recycler: CngxRecycler, roving: CngxRovingTabindex): void {\n const hostEl = inject(ElementRef).nativeElement as HTMLElement;\n\n // Debounce scrollToIndex via rAF to avoid scroll jitter on rapid keypresses.\n // Each keypress overwrites pendingFocus - only the latest target is scrolled to.\n let scrollRafId: number | null = null;\n\n effect((onCleanup) => {\n const target = roving.pendingFocus();\n if (target == null) {\n return;\n }\n if (scrollRafId != null) {\n cancelAnimationFrame(scrollRafId);\n }\n scrollRafId = requestAnimationFrame(() => {\n scrollRafId = null;\n // Re-read to get the latest target (rapid keypresses may have updated it).\n const latest = roving.pendingFocus();\n if (latest != null) {\n recycler.scrollToIndex(latest);\n }\n });\n onCleanup(() => {\n if (scrollRafId != null) {\n cancelAnimationFrame(scrollRafId);\n scrollRafId = null;\n }\n });\n });\n\n // When the recycler's range changes and the pending target is within range,\n // wait for the DOM to update (rAF), then query and focus the element.\n let focusRafId: number | null = null;\n\n effect((onCleanup) => {\n const s = recycler.start();\n const e = recycler.end();\n const target = untracked(() => roving.pendingFocus());\n if (target == null || target < s || target >= e) {\n return;\n }\n\n // Target is within rendered range - DOM will be updated after CD.\n // Use rAF to wait for Angular's rendering pass to complete.\n focusRafId = requestAnimationFrame(() => {\n focusRafId = null;\n // Re-read pendingFocus in case it changed during the frame (rapid keypresses).\n const currentTarget = roving.pendingFocus();\n if (currentTarget == null) {\n return;\n }\n const el = hostEl.querySelector(`[data-cngx-recycle-index=\"${currentTarget}\"]`);\n if (el instanceof HTMLElement) {\n el.focus();\n roving.clearPendingFocus();\n }\n });\n\n onCleanup(() => {\n if (focusRafId != null) {\n cancelAnimationFrame(focusRafId);\n focusRafId = null;\n }\n });\n });\n}\n","import { effect, untracked } from '@angular/core';\n\n// type-only: passed in by the consumer at runtime, so @cngx/common/data\n// avoids a value-level dep on a11y\nimport type { CngxActiveDescendant } from '@cngx/common/a11y';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Wires a {@link CngxRecycler} to a {@link CngxActiveDescendant} in\n * virtual mode.\n *\n * When the AD directive navigates to an item whose index is not in the\n * recycler's rendered range, it sets `pendingHighlight` (via the\n * `virtualCount` path). This helper watches that signal and scrolls\n * the recycler to the target index; AD's own effect observes the\n * resulting DOM update and clears the pending state automatically\n * (see the `pendingHighlightState.set(null)` branch in\n * `CngxActiveDescendant` after a re-render brings the target into the\n * rendered range).\n *\n * Unlike {@link /projects/common/data/src/recycler/connect-recycler-roving.ts\n * connectRecyclerToRoving}, we don't re-focus a DOM element after the\n * scroll - AD doesn't move real focus, it only rebinds\n * `aria-activedescendant`. Once the target index enters the rendered\n * range, the `[attr.aria-activedescendant]` binding on the combobox\n * trigger resolves to the now-present option element for free.\n *\n * Must be called in an injection context (typically a component\n * constructor) on the same component that owns both the recycler\n * and the AD directive.\n *\n * ```typescript\n * @Component({\n * hostDirectives: [\n * { directive: CngxActiveDescendant, inputs: ['items', 'virtualCount', 'windowStart'] },\n * ],\n * })\n * class MyVirtualSelect {\n * private readonly ad = inject(CngxActiveDescendant, { host: true });\n * readonly recycler = injectRecycler({ ... });\n *\n * constructor() {\n * connectRecyclerToActiveDescendant(this.recycler, this.ad);\n * }\n * }\n * ```\n *\n * @category common/data/recycler\n */\nexport function connectRecyclerToActiveDescendant(\n recycler: CngxRecycler,\n ad: CngxActiveDescendant,\n): void {\n // rAF-debounced: held ArrowDown otherwise enqueues one scroll per keystroke.\n // Each new pending target overwrites the previous rAF, only the latest lands.\n let scrollRafId: number | null = null;\n\n effect((onCleanup) => {\n const target = ad.pendingHighlight();\n if (target == null) {\n return;\n }\n if (scrollRafId != null) {\n cancelAnimationFrame(scrollRafId);\n }\n scrollRafId = requestAnimationFrame(() => {\n scrollRafId = null;\n // re-read inside the frame so the latest target wins if the user kept typing\n const latest = untracked(() => ad.pendingHighlight());\n if (latest != null) {\n recycler.scrollToIndex(latest);\n }\n });\n onCleanup(() => {\n if (scrollRafId != null) {\n cancelAnimationFrame(scrollRafId);\n scrollRafId = null;\n }\n });\n });\n}\n","import { computed, signal, type Signal } from '@angular/core';\n\nimport { createManualState, type ManualAsyncState } from '../async-state';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\n/**\n * Cancel handle returned by a {@link CngxCommitRunner}. The controller\n * stores it on every `begin(...)` and calls `cancel()` synchronously\n * when a newer commit supersedes it. Action runtimes (RxJS subscription\n * teardown, AbortController abort, plain flag) implement the handle\n * however they need.\n *\n * @category common/data/commit\n */\nexport interface CngxCommitHandle {\n readonly cancel: () => void;\n}\n\n/**\n * Action runner contract. Receives the controller's success/error\n * routes and returns a cancel handle. The runner is opaque to the\n * controller - it can wrap any async source (Observable, Promise,\n * sync value) and any cancellation primitive.\n *\n * Variants supply their own runner adapter (e.g. select's\n * `runCommitAction` invokes a `CngxSelectCommitAction<T>`; stepper's\n * runner adapts a `CngxStepperCommitAction`); the controller has no\n * knowledge of the variant-specific action shape.\n *\n * @category common/data/commit\n */\nexport type CngxCommitRunner<T> = (handlers: {\n readonly onSuccess: (committed: T | undefined) => void;\n readonly onError: (err: unknown) => void;\n}) => CngxCommitHandle;\n\n/**\n * Outcome handlers passed to `controller.begin(...)`. The controller\n * invokes exactly one of `onSuccess` / `onError` per commit lifecycle\n * (unless the commit is superseded, in which case neither fires).\n *\n * @category common/data/commit\n */\nexport interface CngxCommitBeginHandlers<T> {\n readonly onSuccess: (committed: T | undefined) => void;\n readonly onError: (err: unknown, previous: T | undefined) => void;\n}\n\n/**\n * Encapsulated state machine for the async-commit lifecycle shared by\n * every cngx feature that has a \"perform-an-async-write-then-update-\n * the-source-signal\" flow (select family, stepper, future wizards).\n *\n * Owns:\n * - the `CngxAsyncState<T | undefined>` slot consumed by `CNGX_STATEFUL`\n * bridges, commit-error templates, and the pending-row spinner;\n * - begin / cancel orchestration with monotonic supersede semantics;\n * - the \"intended value\" signal that drives the pending-spinner on\n * the specific row / step the user just clicked.\n *\n * The controller is intentionally **not** an Angular service or\n * provider. It's a plain factory so it works in any injection context\n * (including outside Angular, for headless tests).\n *\n * @category common/data/commit\n */\nexport interface CngxCommitController<T> {\n /** Read-only async-state view of the commit lifecycle. */\n readonly state: CngxAsyncState<T | undefined>;\n\n /** `true` while a commit is in flight. */\n readonly isCommitting: Signal<boolean>;\n\n /**\n * The most recent intended value - what the user was trying to\n * commit. Used by the option-row spinner and the commit-error\n * template context to identify *which* option the failure belongs\n * to.\n */\n readonly intendedValue: Signal<T | undefined>;\n\n /**\n * Start a new commit. Supersedes any in-flight commit: the\n * previous runner's cancel handle fires synchronously, and the\n * previous outcome callbacks become no-ops if they fire late.\n *\n * @param runner variant-specific action runner (closes over the\n * action and the intended value)\n * @param intended the value the user clicked\n * @param previous the value to roll back to on error\n * @param handlers success/error routes - the controller only\n * updates its own state and calls these; it does\n * NOT touch external value signals, panel open\n * state, or component outputs.\n */\n begin(\n runner: CngxCommitRunner<T>,\n intended: T | undefined,\n previous: T | undefined,\n handlers: CngxCommitBeginHandlers<T>,\n ): void;\n\n /**\n * Abort the currently in-flight commit without firing callbacks.\n * Use when the host component is destroyed or the commit-action\n * input changes mid-flight.\n *\n * By default the state slot keeps its current status (a destroyed\n * host never reads it again). Pass `settle: true` when the surface\n * lives on - an explicit back-navigation or reset that supersedes a\n * pending commit must return `state` to `'idle'`, or `busy` latches\n * true forever.\n */\n cancel(options?: { readonly settle?: boolean }): void;\n}\n\n/**\n * Factory for the commit controller.\n *\n * Plain function, not a class - matches the rest of the repo\n * (`createManualState`, `createAsyncState`, `createTransitionTracker`).\n * See `reference_api_prefix_convention.md`.\n *\n * @category common/data/commit\n */\nexport function createCommitController<T>(): CngxCommitController<T> {\n // read-only `state` view; consumers can't flip status directly\n const slot: ManualAsyncState<T | undefined> =\n createManualState<T | undefined>();\n\n // monotonic supersede id; stale callbacks compare captured id against this\n let commitId = 0;\n\n let active: CngxCommitHandle | null = null;\n\n // drives the pending spinner on the specific row the user clicked\n const intendedState = signal<T | undefined>(undefined);\n\n return {\n state: slot,\n isCommitting: computed(() => slot.isPending()),\n intendedValue: intendedState.asReadonly(),\n\n begin(runner, intended, previous, handlers) {\n // bump commitId BEFORE tearing down the previous runner: a runner that\n // cancels synchronously would otherwise still pass the supersede check\n // and fire its callbacks after all\n const id = ++commitId;\n active?.cancel();\n intendedState.set(intended);\n slot.set('pending');\n\n // A runner may settle synchronously, i.e. before its handle is even\n // returned. The settled flag keeps such a finished handle out of\n // `active`, so a later begin()/cancel() never calls cancel() on a\n // completed runner (CngxCommitHandle does not require idempotence).\n let settled = false;\n const handle = runner({\n onSuccess: (committed) => {\n if (id !== commitId) {\n return;\n }\n settled = true;\n slot.setSuccess(committed);\n active = null;\n handlers.onSuccess(committed);\n },\n onError: (err) => {\n if (id !== commitId) {\n return;\n }\n settled = true;\n slot.setError(err);\n active = null;\n handlers.onError(err, previous);\n },\n });\n active = settled ? null : handle;\n },\n\n cancel(options?: { readonly settle?: boolean }) {\n // bump first: callbacks of a synchronously-cancelling runner must\n // already see themselves superseded\n commitId++;\n active?.cancel();\n active = null;\n if (options?.settle) {\n // Full settle: idle status plus cleared data/error, so a stale\n // rejection cannot resurface on the next commit window.\n slot.reset();\n intendedState.set(undefined);\n }\n },\n };\n}\n","import { InjectionToken } from '@angular/core';\n\nimport { createCommitController, type CngxCommitController } from './commit-controller';\n\n/**\n * Factory signature for producing {@link CngxCommitController}\n * instances. Consumers override the DI token\n * {@link CNGX_COMMIT_CONTROLLER_FACTORY} with a custom factory to\n * inject retry-with-backoff, offline queues, telemetry, or any\n * other enterprise-specific commit lifecycle - without forking the\n * features that consume it (select family, stepper, future wizards).\n *\n * @category common/data/commit\n */\nexport type CngxCommitControllerFactory = <T>() => CngxCommitController<T>;\n\n/**\n * DI token carrying the factory that every cngx feature uses to\n * allocate its commit controller. Default `providedIn: 'root'`\n * factory returns {@link createCommitController}. Override globally\n * via app providers or per-component via `viewProviders`.\n *\n * Symmetrical to `CNGX_SELECT_COMMIT_CONTROLLER_FACTORY`\n * (`@cngx/forms/select`); the select-side token's default factory\n * delegates to this one, so a single override here cascades into\n * every select variant transparently.\n *\n * ```ts\n * bootstrapApplication(App, {\n * providers: [\n * {\n * provide: CNGX_COMMIT_CONTROLLER_FACTORY,\n * useValue: <T>() => createRetryingCommitController<T>({ attempts: 3 }),\n * },\n * ],\n * });\n * ```\n *\n * @category common/data/commit\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/commit/commit-controller.token.ts\n * @since 0.1.0\n */\nexport const CNGX_COMMIT_CONTROLLER_FACTORY = new InjectionToken<CngxCommitControllerFactory>(\n 'CngxCommitControllerFactory',\n {\n providedIn: 'root',\n factory: () => createCommitController,\n },\n);\n","import {\n type DestroyRef,\n effect,\n type Injector,\n runInInjectionContext,\n type Signal,\n untracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport type { Observable } from 'rxjs';\n\n/**\n * Options for {@link createMaterialBidirectionalSync}.\n *\n * Material types never enter this surface. The caller maps Material's\n * own event/property shape to a host-agnostic `Signal<number>` /\n * `Observable<number>` / getter / setter at the directive boundary. \\\n * That keeps `@cngx/common/data` independent of `@angular/material`.\n *\n * @category common/data/material-bridge\n */\nexport interface CngxMaterialBidirectionalSyncOptions {\n /**\n * Reactive source for the presenter's current index. The factory's\n * `effect()` tracks this signal - when it changes, Material is\n * written (subject to the equality guard against the Material\n * read-side).\n */\n readonly presenterIndex: Signal<number>;\n\n /**\n * Pulls the Material instance's current `selectedIndex` (or\n * equivalent). Called inside `untracked()` so the effect does not\n * subscribe to any signals the getter might read internally.\n */\n readonly readSelectedIndex: () => number;\n\n /**\n * Writes the Material instance's `selectedIndex` (or equivalent).\n * Called inside `untracked()` per\n * `reference_signal_architecture` rule 2.\n */\n readonly writeSelectedIndex: (idx: number) => void;\n\n /**\n * Stream of Material-driven selection changes, already mapped to a\n * plain index by the caller (`MatTabGroup.selectedIndexChange`\n * forwards directly; `MatStepper.selectionChange` needs\n * `.pipe(map(e => e.selectedIndex))`).\n */\n readonly selectionChange$: Observable<number>;\n\n /**\n * Routes a Material→presenter selection event into the presenter's\n * `select(idx)` method. Subject to an equality guard against\n * `presenterIndex()` so re-entrant events (the presenter's own\n * write firing back through Material) drop without re-routing.\n */\n readonly onMaterialSelection: (idx: number) => void;\n\n /** Injector used to install the effect inside an injection context. */\n readonly injector: Injector;\n\n /** DestroyRef used to clean up the effect and the subscription. */\n readonly destroyRef: DestroyRef;\n}\n\n/**\n * Handle returned by {@link createMaterialBidirectionalSync}.\n *\n * @category common/data/material-bridge\n */\nexport interface CngxMaterialBidirectionalSyncHandle {\n /**\n * Force Material's selected index to the presenter's current index,\n * routed through the factory's self-echo suppression so it never\n * re-enters the Material→presenter path. Hosts call this from their\n * commit lifecycle when a pessimistic commit settles WITHOUT advancing\n * the presenter (a rejected switch), which leaves Material eager-\n * advanced on the refused tab. A no-op when already in sync.\n */\n readonly reconcile: () => void;\n}\n\n/**\n * Single shared bidirectional-sync factory for cngx organisms /\n * directives that bridge a cngx presenter against a Material parent\n * (`<mat-tab-group>`, `<mat-stepper>`, etc.).\n *\n * Lives at Level 2 in `@cngx/common/data` parallel to\n * `createCommitController`. Material types never enter the signature -\n * the caller maps Material-specific events and property accessors to a\n * host-agnostic shape at the directive boundary.\n *\n * Installs:\n *\n * 1. A presenter→Material `effect()` that tracks `presenterIndex` and\n * writes through `writeSelectedIndex`, equality-guarded against\n * `readSelectedIndex()` to suppress redundant writes. The Material\n * read+write pair runs inside `untracked()` per\n * `reference_signal_architecture` rule 2.\n * 2. A Material→presenter subscription that forwards each\n * `selectionChange$` emission to `onMaterialSelection`\n * (equality-guarded against `presenterIndex()` so a Material event\n * whose value already matches the presenter is dropped - closes\n * the re-entrancy loop).\n *\n * Both sides clean up via `destroyRef`.\n *\n * **Material-eager-advance reconciliation.** Material's MDC click\n * handler advances `selectedIndex` *before* the Material→presenter\n * subscription forwards the click. When the presenter HOLDS its index\n * (pessimistic mode + bound `commitAction`), the subscriber does NOT\n * write Material back: on a SUCCESSFUL commit the presenter later\n * advances to the clicked target and Material is already there, so the\n * mirror effect is a no-op (no flash); on a REJECTED commit the presenter\n * never moves, leaving Material eager-advanced on the refused tab. The\n * host detects the rejection through its own commit lifecycle and calls\n * {@link CngxMaterialBidirectionalSyncHandle.reconcile} to snap Material\n * back. Writing from inside the subscriber instead is unsafe: Material's\n * `selectedIndex` read-back lags a programmatic write, so the mirror\n * effect's equality guard reads a stale value and skips the corrective\n * write, sticking the visual on the wrong tab.\n *\n * **Self-echo suppression (loop-safety).** Every programmatic\n * `selectedIndex` write makes Material re-emit `selectionChange`. The\n * factory records each value it writes and drops the matching echo\n * (`indexOf` + splice, which also prunes earlier writes whose echo\n * Material coalesced away) before any other processing. This is\n * load-bearing for an ASYNC commit-action: Material emits the echo a\n * microtask later, by which point the commit may have advanced\n * `presenterIndex`, so an equality-only guard (`presenterIndex() ===\n * idx`) would FAIL to drop the echo - it would re-enter the subscriber\n * and ping-pong against the in-flight navigation (the demo freezes).\n * Matching the echo by the value we wrote drops it regardless of where\n * the presenter has moved.\n *\n * @category common/data/material-bridge\n */\nexport function createMaterialBidirectionalSync(\n opts: CngxMaterialBidirectionalSyncOptions,\n): CngxMaterialBidirectionalSyncHandle {\n const {\n presenterIndex,\n readSelectedIndex,\n writeSelectedIndex,\n selectionChange$,\n onMaterialSelection,\n injector,\n destroyRef,\n } = opts;\n\n // Indices WE wrote into Material, awaiting their echo. Material\n // re-emits `selectionChange` for every programmatic `selectedIndex`\n // write, so each of our writes produces an echo that must NOT be\n // treated as a user selection. Equality against `presenterIndex()`\n // alone is insufficient: with an async commit-action the presenter may\n // have advanced by the time the echo arrives, so the echo no longer\n // equality-drops and would re-enter the subscriber. `indexOf` + splice\n // drops the echo by the value we wrote (and prunes any earlier write\n // whose echo Material coalesced away), regardless of where the\n // presenter has since moved - the loop can never form.\n const selfEchoes: number[] = [];\n const writeMaterial = (idx: number): void => {\n selfEchoes.push(idx);\n writeSelectedIndex(idx);\n };\n\n runInInjectionContext(injector, () => {\n effect(() => {\n const desired = presenterIndex();\n untracked(() => {\n if (readSelectedIndex() === desired) {\n return;\n }\n writeMaterial(desired);\n });\n });\n });\n\n selectionChange$.pipe(takeUntilDestroyed(destroyRef)).subscribe((idx) => {\n // Drop our own write-echo (and any coalesced-away earlier write).\n const echoAt = selfEchoes.indexOf(idx);\n if (echoAt !== -1) {\n selfEchoes.splice(0, echoAt + 1);\n return;\n }\n if (presenterIndex() === idx) {\n return;\n }\n onMaterialSelection(idx);\n // No write-back here. Material eager-advanced to the clicked tab; in\n // pessimistic mode the presenter HOLDS at origin, so on SUCCESS the\n // presenter later advances to this target and Material is already\n // there (no flash, no fight with Material's async `selectedIndex`).\n // On REJECTION the presenter never moves, leaving Material diverged -\n // the host detects that and calls `reconcile()` from its commit\n // lifecycle. Writing here while the commit is in flight is unsafe:\n // Material's `selectedIndex` read-back lags a programmatic write, so\n // the mirror effect's equality guard reads a stale value and skips\n // the corrective write (the visual sticks on the wrong tab).\n });\n\n return {\n reconcile: () => {\n writeMaterial(presenterIndex());\n },\n };\n}\n","/**\n * @module @cngx/common/data\n */\nexport { CngxSort, type SortEntry } from './sort/sort.directive';\nexport { CngxSortHeader } from './sort/sort-header.directive';\nexport { createSortHeaderState, type SortHeaderState } from './sort/sort-header-state';\nexport { CngxFilter } from './filter/filter.directive';\nexport {\n CngxFilterChips,\n CngxFilterChip,\n type CngxFilterChipContext,\n} from './filter-chips/filter-chips.component';\nexport { CngxPaginate } from './paginate/paginate.directive';\nexport { CngxPaginateResetOn, connectPaginateResetOn } from './paginate/paginate-reset.directive';\nexport { connectPaginateEmit, type CngxPaginateEmitHandlers } from './paginate/paginate-emit';\nexport { CngxPaginateRouting } from './paginate/paginate-routing.directive';\nexport { CngxBucketPaginate, type CngxBucket } from './paginate/bucket-paginate.directive';\nexport {\n CNGX_BUCKET_PAGINATE_HOST,\n type CngxBucketPaginateHost,\n type CngxBucketPaginateView,\n} from './paginate/bucket-paginate-host.token';\nexport { CngxDataSource, injectDataSource } from './data-source/data-source';\nexport {\n CngxSmartDataSource,\n injectSmartDataSource,\n type CngxSmartDataSourceOptions,\n} from './data-source/smart-data-source';\n\n// Re-export the curated async-state sub-barrel wholesale so additions there\n// (e.g. fromResource / fromHttpResource / tapAsyncState) cannot silently drop\n// out of `@cngx/common/data`.\nexport * from './async-state';\n\nexport { CngxAsyncRegistry, type CngxAsyncOperation } from './async-registry/async-registry';\nexport { provideAsyncRegistry, injectAsyncRegistry } from './async-registry/provide-async-registry';\nexport { injectLatencyProbe } from './async-registry/inject-latency-probe';\nexport { type CngxLatencyProbe } from '@cngx/core/utils';\nexport {\n CNGX_ASYNC_LABEL,\n CNGX_ASYNC_SKIP,\n withAsyncLabel,\n withAsyncSkip,\n} from './async-registry/http-context';\nexport {\n cngxAsyncInterceptor,\n provideAsyncHttpObservability,\n} from './async-registry/http-interceptor';\n\nexport { CngxAsync, type CngxAsyncContext } from './async/async.directive';\n\nexport { CngxMetric } from './display/metric/metric.component';\nexport { CngxTrend } from './display/trend/trend.component';\nexport { CngxDelta } from './display/delta/delta.component';\nexport {\n type DeltaPolarity,\n type DeltaMode,\n type DeltaDirection,\n type DeltaSentiment,\n} from './display/shared/delta-format';\nexport {\n CNGX_KPI_I18N,\n injectKpiI18n,\n provideKpiI18n,\n withKpiI18nLabels,\n type CngxKpiI18n,\n type CngxKpiI18nFeature,\n} from './display/shared/kpi-i18n';\nexport { CngxStat } from './display/stat/stat.component';\nexport { CngxStatCoordinator } from './display/stat/stat-coordinator.directive';\nexport {\n CngxStatLabel,\n CngxStatValue,\n CngxStatDelta,\n CngxStatCaption,\n} from './display/stat/stat-slots';\nexport { CNGX_STAT, type CngxStatRegistry, type CngxStatSlotKind } from './display/stat/stat.token';\nexport { CngxGoal } from './display/goal/goal.component';\n\nexport {\n injectRecycler,\n provideRecyclerI18n,\n withRecyclerI18nLabels,\n CNGX_RECYCLER_I18N,\n type CngxRecyclerI18nFeature,\n type RecyclerConfig,\n type CngxRecycler,\n type RecyclerI18n,\n} from './recycler/recycler';\nexport { CngxMeasure } from './recycler/measure.directive';\nexport { CngxVirtualItem } from './recycler/virtual-item.directive';\nexport { CngxRecyclerPlaceholder } from './recycler/recycler-placeholder.directive';\nexport {\n CngxRecyclerRow,\n CNGX_RECYCLER_PLACEHOLDER_ROW,\n provideRecyclerPlaceholderRow,\n type CngxRecyclerRowContext,\n} from './recycler/recycler-row.directive';\nexport { CngxRecyclerAnnouncer } from './recycler/recycler-announcer.component';\nexport { connectRecyclerToRoving } from './recycler/connect-recycler-roving';\nexport { connectRecyclerToActiveDescendant } from './recycler/connect-recycler-active-descendant';\n\n// Commit controller - generic async-commit state machine shared by\n// the select family and the stepper / wizard family.\nexport {\n createCommitController,\n type CngxCommitController,\n type CngxCommitBeginHandlers,\n type CngxCommitHandle,\n type CngxCommitRunner,\n CNGX_COMMIT_CONTROLLER_FACTORY,\n type CngxCommitControllerFactory,\n} from './commit';\n\n// Material bidirectional sync - shared factory consumed by cngx\n// organisms / directives that bridge a cngx presenter against a\n// Material parent (`<mat-tab-group>`, `<mat-stepper>`, etc.).\n// Material types never enter the signature; the caller maps at the\n// directive boundary so `@cngx/common/data` stays Sheriff-Level-2\n// compliant (no `@angular/material` import).\nexport {\n createMaterialBidirectionalSync,\n type CngxMaterialBidirectionalSyncOptions,\n type CngxMaterialBidirectionalSyncHandle,\n} from './material-bridge/bidirectional-sync';\nexport { CNGX_KPI_LANGUAGE_EN, type CngxKpiLanguageSection } from './i18n/kpi-language-section';\nexport {\n CNGX_RECYCLER_LANGUAGE_EN,\n type CngxRecyclerLanguageSection,\n} from './i18n/recycler-language-section';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.CngxStatCoordinator"],"mappings":";;;;;;;;;;;;;;;AAYA,SAAS,UAAU,CAAC,CAA+B,EAAE,CAA+B,EAAA;AAClF,IAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS,CAAC;AACxF;AAEA,SAAS,YAAY,CAAC,CAAc,EAAE,CAAc,EAAA;AAClD,IAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7F;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;MAMU,QAAQ,CAAA;;IAEV,WAAW,GAAG,KAAK,CAAqB,SAAS,mFAAI,KAAK,EAAE,gBAAgB,EAAA,CAAG;;IAE/E,cAAc,GAAG,KAAK,CAA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,MAAM,OAAO,GAAG,cAAc,EAAE;YAChC,SAAS,CAAC,MAAK;AACb,gBAAA,IAAI,iBAAiB,EAAE,KAAK,OAAO,EAAE;oBACnC;gBACF;gBACA,aAAa,CAAC,OAAO,CAAC;AACxB,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC,CAAC;AAEF,IAAA,gBAAgB,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,KAAI;;QAEtE,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC;AACtC,QAAA,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE;YACjB,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;YAChC;QACF;AACA,QAAA,IAAI,cAAc,EAAE,KAAK,GAAG,EAAE;YAC5B;QACF;QACA,mBAAmB,CAAC,GAAG,CAAC;;;;;;;;;;;AAW1B,IAAA,CAAC,CAAC;IAEF,OAAO;QACL,SAAS,EAAE,MAAK;AACd,YAAA,aAAa,CAAC,cAAc,EAAE,CAAC;QACjC,CAAC;KACF;AACH;;AChNA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cngx-common-data.mjs","sources":["../../../projects/common/data/sort/sort.directive.ts","../../../projects/common/data/sort/sort-header-state.ts","../../../projects/common/data/sort/sort-header.directive.ts","../../../projects/common/data/filter/filter.directive.ts","../../../projects/common/data/filter-chips/filter-chips.component.ts","../../../projects/common/data/paginate/paginate.directive.ts","../../../projects/common/data/paginate/inject-paginate.ts","../../../projects/common/data/paginate/paginate-reset.directive.ts","../../../projects/common/data/paginate/paginate-emit.ts","../../../projects/common/data/paginate/paginate-routing.directive.ts","../../../projects/common/data/paginate/bucket-paginate-host.token.ts","../../../projects/common/data/paginate/bucket-paginate.directive.ts","../../../projects/common/data/data-source/data-source.ts","../../../projects/common/data/data-source/smart-data-source.ts","../../../projects/common/data/async-state/create-manual-state.ts","../../../projects/common/data/async-registry/async-registry.ts","../../../projects/common/data/async-registry/provide-async-registry.ts","../../../projects/common/data/async-state/create-async-state.ts","../../../projects/common/data/async-state/forwarded-async-state.ts","../../../projects/common/data/async-state/inject-async-state.ts","../../../projects/common/data/async-state/resolve-view.ts","../../../projects/common/data/async-state/async-boundary.directive.ts","../../../projects/common/data/async-state/resource-latch.ts","../../../projects/common/data/async-state/resource-bridge.ts","../../../projects/common/data/async-state/from-resource.ts","../../../projects/common/data/async-state/progress-percent.ts","../../../projects/common/data/async-state/from-http-resource.ts","../../../projects/common/data/async-state/operators.ts","../../../projects/common/data/async-registry/inject-latency-probe.ts","../../../projects/common/data/async-registry/http-context.ts","../../../projects/common/data/async-registry/http-interceptor.ts","../../../projects/common/data/async/async.directive.ts","../../../projects/common/data/i18n/kpi-language-section.ts","../../../projects/common/data/display/shared/kpi-i18n.ts","../../../projects/common/data/display/metric/metric.component.ts","../../../projects/common/data/display/shared/delta-format.ts","../../../projects/common/data/display/trend/trend.component.ts","../../../projects/common/data/display/delta/delta.component.ts","../../../projects/common/data/display/stat/stat-coordinator.directive.ts","../../../projects/common/data/display/stat/stat.token.ts","../../../projects/common/data/display/stat/stat.component.ts","../../../projects/common/data/display/stat/stat-slots.ts","../../../projects/common/data/display/goal/goal.component.ts","../../../projects/common/data/i18n/recycler-language-section.ts","../../../projects/common/data/recycler/range-computer.ts","../../../projects/common/data/recycler/scroll-observer.ts","../../../projects/common/data/recycler/size-cache.ts","../../../projects/common/data/recycler/recycler.ts","../../../projects/common/data/recycler/measure.directive.ts","../../../projects/common/data/recycler/virtual-item.directive.ts","../../../projects/common/data/recycler/recycler-placeholder.directive.ts","../../../projects/common/data/recycler/recycler-row.directive.ts","../../../projects/common/data/recycler/recycler-announcer.component.ts","../../../projects/common/data/recycler/connect-recycler-roving.ts","../../../projects/common/data/recycler/connect-recycler-active-descendant.ts","../../../projects/common/data/commit/commit-controller.ts","../../../projects/common/data/commit/refused-phrase.ts","../../../projects/common/data/commit/commit-controller.token.ts","../../../projects/common/data/material-bridge/bidirectional-sync.ts","../../../projects/common/data/public-api.ts","../../../projects/common/data/cngx-common-data.ts"],"sourcesContent":["import { afterNextRender, computed, Directive, input, output, signal } from '@angular/core';\n\n/**\n * A single sort entry: the active field key and its direction.\n */\nexport interface SortEntry {\n active: string;\n direction: 'asc' | 'desc';\n}\n\nfunction entryEqual(a: SortEntry | null | undefined, b: SortEntry | null | undefined): boolean {\n return a === b || (!!a && !!b && a.active === b.active && a.direction === b.direction);\n}\n\nfunction entriesEqual(a: SortEntry[], b: SortEntry[]): boolean {\n return a === b || (a.length === b.length && a.every((entry, i) => entryEqual(entry, b[i])));\n}\n\n/**\n * Atom directive that tracks sort state (active field + direction).\n *\n * Supports both **uncontrolled** (internal state) and **controlled** modes.\n * In controlled mode the `cngxSortActive` / `cngxSortDirection` inputs take\n * precedence over the internal state - pair with `sortChange` to keep them\n * in sync.\n *\n * An uncontrolled sort may declare a **starting** column + direction via\n * `[cngxSortInitial]`: it seeds the internal state exactly once on init, then\n * user clicks take over. Distinct from the controlled `cngxSortActive` /\n * `cngxSortDirection` pins - the seed is skipped when a controlled pin is bound.\n *\n * When `multiSort` is `true`, holding **Shift** while clicking a sort header\n * adds it as a secondary (tertiary, …) sort key instead of replacing the\n * primary one. Shift-clicking an active column cycles it asc → desc → removed.\n * Multi-sort state is always uncontrolled; use `sortsChange` to read it.\n * While a controlled pin is bound, additive clicks degrade to the\n * single-sort cycle.\n *\n * Consumer connects this to a table or list via a `computed()` - nothing is\n * injected automatically.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/sort/sort.directive.ts\n * @since 0.3.0\n * @relatedTo CngxSortHeader, CngxFilter, CngxPaginate, CngxSmartDataSource\n *\n * <example-url>/#/common/data/sort/basic</example-url>\n * <example-url>/#/common/data/sort/multi-sort</example-url>\n * <example-url>/#/common/data/sort/controlled</example-url>\n * <example-url>/#/common/data/sort/aria-and-keyboard</example-url>\n * @axis level atom\n */\n@Directive({\n selector: '[cngxSort]',\n exportAs: 'cngxSort',\n standalone: true,\n})\nexport class CngxSort {\n /** Controlled active column. When bound, takes precedence over internal state (single-sort only). */\n readonly activeInput = input<string | undefined>(undefined, { alias: 'cngxSortActive' });\n /** Controlled direction. When bound, takes precedence over internal state (single-sort only). */\n readonly directionInput = input<'asc' | 'desc' | undefined>(undefined, {\n alias: 'cngxSortDirection',\n });\n /**\n * When `true`, Shift+click on a sort header adds it to the sort stack instead of\n * replacing the current sort.\n */\n readonly multiSort = input<boolean>(false);\n /**\n * Uncontrolled starting sort. Seeds the internal state once on init if no sort\n * is set yet and no controlled `cngxSortActive` pin is bound; user clicks own\n * it thereafter. Ignored in controlled mode.\n */\n readonly initialSort = input<SortEntry | undefined>(undefined, { alias: 'cngxSortInitial' });\n\n private readonly sortsState = signal<SortEntry[]>([]);\n\n constructor() {\n // One-shot uncontrolled seed: not a reactive derivation, so afterNextRender\n // (single-shot, outside the signal graph) rather than an effect. The empty +\n // no-controlled-pin guards keep it from clobbering an early click or writing\n // an invisible state that would surface when a controlled pin unbinds.\n afterNextRender(() => {\n const seed = this.initialSort();\n if (seed && this.sortsState().length === 0 && this.activeInput() === undefined) {\n this.sortsState.set([seed]);\n }\n });\n }\n\n /** The active sort column of the primary entry (controlled takes precedence in single-sort mode). */\n readonly active = computed(() => this.activeInput() ?? this.sorts()[0]?.active);\n /** The active sort direction of the primary entry (controlled takes precedence in single-sort mode). */\n readonly direction = computed(() => this.directionInput() ?? this.sorts()[0]?.direction);\n\n /**\n * The primary sort state, or `null` when no sort is active.\n * In multi-sort mode this is the first entry in `sorts`.\n */\n readonly sort = computed(\n () => (this.active() ? { active: this.active(), direction: this.direction() ?? 'asc' } : null),\n { equal: entryEqual },\n );\n\n /**\n * All active sort entries in priority order.\n * Contains at most one entry when additive mode has not been used.\n * In controlled mode the entry is derived from `cngxSortActive` /\n * `cngxSortDirection` (a falsy active key means no sort); headers and\n * data sources read this signal, so the controlled pin drives them too.\n */\n readonly sorts = computed<SortEntry[]>(\n () => {\n const controlledActive = this.activeInput();\n if (controlledActive !== undefined) {\n if (!controlledActive) {\n return [];\n }\n return [{ active: controlledActive, direction: this.directionInput() ?? 'asc' }];\n }\n return this.sortsState();\n },\n // Structural equal: the controlled branch builds a fresh entry literal on\n // every recompute; identity churn here would cascade into header state and\n // a full re-sort in CngxSmartDataSource.processed.\n { equal: entriesEqual },\n );\n\n /** `true` when at least one sort is active. */\n readonly isActive = computed(() => this.sorts().length > 0);\n\n /** Emitted when the primary sort state changes. Emits `undefined` on clear. */\n readonly sortChange = output<SortEntry | undefined>();\n /**\n * Emitted whenever the sort stack changes (including removals and full clears).\n * Always reflects the full `sorts` array at the time of emission.\n */\n readonly sortsChange = output<SortEntry[]>();\n\n /**\n * Sets or toggles the sort for `field`.\n *\n * **`additive = false`** (default, plain click):\n * - Same field → cycle `asc` → `desc` → cleared (a third click removes the sort)\n * - Different field → replace stack with `{ field, asc }`\n *\n * **`additive = true`** (Shift+click when `multiSort` is enabled on the header):\n * - Field not in stack → append as asc\n * - Field in stack as asc → change to desc\n * - Field in stack as desc → remove from stack\n *\n * With a controlled `cngxSortActive` pin bound, the sort is event-only: the\n * cycle is computed off the effective entry and emitted, the internal state\n * stays untouched (nothing stale surfaces if the pin unbinds later). Since\n * multi-sort is always uncontrolled, an additive call degrades to the\n * non-additive controlled cycle while a pin is bound.\n */\n setSort(field: string, additive = false): void {\n if (additive && this.activeInput() === undefined) {\n const current = this.sortsState();\n const idx = current.findIndex((s) => s.active === field);\n let next: SortEntry[];\n if (idx === -1) {\n next = [...current, { active: field, direction: 'asc' }];\n } else if (current[idx].direction === 'asc') {\n next = current.map((s, i) => (i === idx ? { ...s, direction: 'desc' as const } : s));\n } else {\n next = current.filter((_, i) => i !== idx);\n }\n this.sortsState.set(next);\n this.sortsChange.emit(next);\n this.sortChange.emit(next[0]);\n } else {\n // Cycle off the effective state: with a controlled pin bound, the first\n // click on the pinned column must continue the cycle (asc -> desc), not\n // restart it from the empty internal state. In that case the write is\n // skipped too - the consumer owns the state, and a shadow copy would\n // surface as stale sort once the pin unbinds.\n const controlled = this.activeInput() !== undefined;\n const current = this.sorts();\n if (field === current[0]?.active && current[0].direction === 'desc') {\n // Third click on the active column: cycle desc -> cleared.\n if (!controlled) {\n this.sortsState.set([]);\n }\n this.sortChange.emit(undefined);\n this.sortsChange.emit([]);\n } else {\n const dir: 'asc' | 'desc' = field === current[0]?.active ? 'desc' : 'asc';\n const entry: SortEntry = { active: field, direction: dir };\n if (!controlled) {\n this.sortsState.set([entry]);\n }\n this.sortChange.emit(entry);\n this.sortsChange.emit([entry]);\n }\n }\n }\n\n /** Clears all active sorts. Emits both `sortChange(undefined)` and `sortsChange([])`. */\n clear(): void {\n this.sortsState.set([]);\n this.sortChange.emit(undefined);\n this.sortsChange.emit([]);\n }\n}\n","import { computed, type Signal } from '@angular/core';\n\nimport { type CngxSort, type SortEntry } from './sort.directive';\n\n/**\n * The derived sort-header state a header directive exposes for one column.\n *\n * Pure derivation over a single {@link CngxSort} source plus an imperative\n * `toggle`. No async state, no signal writes outside `toggle`.\n */\nexport interface SortHeaderState {\n /** The active sort entry for this column, or `undefined` when the column is not sorted. */\n readonly entry: Signal<SortEntry | undefined>;\n /** `true` when this column is part of the active sort (primary or secondary). */\n readonly isActive: Signal<boolean>;\n /** `true` when this column is active and sorted ascending. */\n readonly isAsc: Signal<boolean>;\n /** `true` when this column is active and sorted descending. */\n readonly isDesc: Signal<boolean>;\n /**\n * 1-based position of this column in the sort stack, or `0` when it is not active.\n * Only meaningful when `multiSort` is enabled on the owning `CngxSort`.\n */\n readonly priority: Signal<number>;\n /**\n * Toggles this column's sort through `CngxSort.setSort`. Pass the header's own\n * Shift-key read as `additive`; the `multiSort` gate is applied here so the\n * column only joins the stack additively when the owning sort allows it.\n */\n toggle(additive?: boolean): void;\n}\n\n/**\n * Derives the shared sort-header state for one column from a {@link CngxSort} getter.\n *\n * Both {@link CngxSortHeader} (table context, `aria-sort`) and `CngxDgaSortHeader`\n * (disclosure context, `role=\"button\"` + `aria-describedby`) compose this factory\n * and keep only their own a11y presentation. The factory is a11y-agnostic - it\n * returns the plain derived signals each header maps to its own DOM/ARIA surface.\n *\n * @param sort Getter for the owning `CngxSort` engine (`() => sortRef`, `() => grid.sort`).\n * @param field Getter for the column's field key.\n * @returns The derived `{ entry, isActive, isAsc, isDesc, priority, toggle }` bundle.\n *\n * @since 0.3.0\n * @relatedTo CngxSort, CngxSortHeader\n */\nexport function createSortHeaderState(sort: () => CngxSort, field: () => string): SortHeaderState {\n const entry = computed(() => sort().sorts().find((s) => s.active === field()));\n\n const isActive = computed(() => entry() !== undefined);\n const isAsc = computed(() => entry()?.direction === 'asc');\n const isDesc = computed(() => entry()?.direction === 'desc');\n\n const priority = computed(() => {\n const idx = sort().sorts().findIndex((s) => s.active === field());\n return idx === -1 ? 0 : idx + 1;\n });\n\n return {\n entry,\n isActive,\n isAsc,\n isDesc,\n priority,\n toggle(additive = false): void {\n sort().setSort(field(), additive && sort().multiSort());\n },\n };\n}\n","import { computed, Directive, input } from '@angular/core';\nimport { createSortHeaderState } from './sort-header-state';\nimport { type CngxSort } from './sort.directive';\n\n/**\n * Molecule directive for sort-header elements.\n *\n * Apply to any clickable header element. Consumer provides an explicit\n * `[cngxSortRef]` binding - no ancestor injection, no hidden wiring.\n *\n * In multi-sort mode, Shift+click adds this column to the sort stack.\n * The `priority()` signal returns the 1-based position in the stack\n * (0 when not active), useful for showing sort-order badges.\n *\n * ```html\n * <div cngxSort [multiSort]=\"true\" #sort=\"cngxSort\">\n * <button cngxSortHeader=\"name\" [cngxSortRef]=\"sort\" #h=\"cngxSortHeader\">\n * Name\n * @if (h.isActive()) {\n * {{ h.isAsc() ? '↑' : '↓' }}\n * @if (sort.multiSort()) { <span>{{ h.priority() }}</span> }\n * }\n * </button>\n * </div>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/sort/sort-header.directive.ts\n * @since 0.3.0\n * @relatedTo CngxSort, CngxFilter, CngxPaginate\n *\n * <example-url>/#/common/data/sort/basic</example-url>\n * <example-url>/#/common/data/sort/multi-sort</example-url>\n * <example-url>/#/common/data/sort/controlled</example-url>\n * <example-url>/#/common/data/sort/aria-and-keyboard</example-url>\n */\n@Directive({\n selector: '[cngxSortHeader]',\n exportAs: 'cngxSortHeader',\n standalone: true,\n host: {\n '(click)': 'handleSort($event)',\n '[attr.aria-sort]': 'ariaSort()',\n '[class.cngx-sort-header--active]': 'isActive()',\n '[class.cngx-sort-header--asc]': 'isAsc()',\n '[class.cngx-sort-header--desc]': 'isDesc()',\n },\n})\nexport class CngxSortHeader {\n /** The field key this header cell represents. */\n readonly field = input.required<string>({ alias: 'cngxSortHeader' });\n /** Explicit reference to the owning `CngxSort`. */\n readonly cngxSortRef = input.required<CngxSort>();\n\n private readonly state = createSortHeaderState(this.cngxSortRef, this.field);\n\n /** `true` when this column is part of the active sort (primary or secondary). */\n readonly isActive = this.state.isActive;\n /** `true` when this column is active and sorted ascending. */\n readonly isAsc = this.state.isAsc;\n /** `true` when this column is active and sorted descending. */\n readonly isDesc = this.state.isDesc;\n\n /**\n * 1-based position of this column in the sort stack.\n * Returns `0` when the column is not part of the active sort.\n * Only meaningful when `multiSort` is enabled on the owning `CngxSort`.\n */\n readonly priority = this.state.priority;\n\n /** The `aria-sort` attribute value for the host element. */\n readonly ariaSort = computed((): 'ascending' | 'descending' | null => {\n if (!this.state.isActive()) {\n return null;\n }\n return this.state.isAsc() ? 'ascending' : 'descending';\n });\n\n protected handleSort(event?: MouseEvent): void {\n this.state.toggle(event?.shiftKey ?? false);\n }\n}\n","import { computed, Directive, input, output, signal } from '@angular/core';\n\n/**\n * Atom directive that holds one or more named filter predicates.\n *\n * Supports both **uncontrolled** (internal state) and **controlled** modes.\n * In controlled mode the `cngxFilter` input takes precedence over the internal\n * `'default'` predicate - pair with `filterChange` to keep it in sync.\n *\n * **Multi-filter** - use `addPredicate(key, fn)` / `removePredicate(key)` to\n * maintain a named stack of predicates. All active predicates are **AND-combined**\n * across keys: an item must pass every registered predicate to appear in results.\n *\n * AND vs OR - the directive enforces AND across dimensions (keys). OR logic\n * within a single dimension stays inside the predicate function itself:\n *\n * ```typescript\n * // AND across dimensions: location AND role must both match\n * filter.addPredicate('location', p => selectedLocations.has(p.location));\n * filter.addPredicate('role', p => selectedRoles.has(p.role));\n *\n * // OR within a dimension: London OR Rome - just put a Set inside one predicate\n * filter.addPredicate('location', p => selectedLocations.has(p.location));\n * ```\n *\n * `setPredicate` / `clear` operate on the `'default'` key and remain fully\n * backward-compatible with single-predicate usage.\n *\n * Consumer connects this to a list via a `computed()` - nothing is injected\n * automatically.\n *\n * @typeParam T - The item type the predicate operates on.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter/filter.directive.ts\n * @since 0.3.0\n * @relatedTo CngxFilterChips, CngxSort, CngxPaginate, CngxSmartDataSource\n *\n * <example-url>/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>\n * <example-url>/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>\n * <example-url>/#/common/data/smart-data-source/auto-wired</example-url>\n * <example-url>/#/common/data/smart-data-source/how-it-works-hostdirectives-inject</example-url>\n * <example-url>/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>\n */\n@Directive({\n selector: '[cngxFilter]',\n exportAs: 'cngxFilter',\n standalone: true,\n})\nexport class CngxFilter<T = unknown> {\n /** Controlled predicate. When bound, takes precedence over the `'default'` internal predicate. */\n readonly predicateInput = input<((value: T) => boolean) | null>(null, { alias: 'cngxFilter' });\n\n private readonly predicatesState = signal<Map<string, (value: T) => boolean>>(new Map());\n\n /**\n * All active named predicates.\n * Use `addPredicate` / `removePredicate` to manage this map.\n */\n readonly predicates = this.predicatesState.asReadonly();\n\n /** Number of active named predicates (controlled input not counted). */\n readonly activeCount = computed(() => this.predicatesState().size);\n\n /**\n * The combined predicate - AND of all active named predicates plus the\n * controlled input (when bound). Returns `null` when nothing is active.\n */\n readonly predicate = computed((): ((value: T) => boolean) | null => {\n const controlled = this.predicateInput();\n const map = this.predicatesState();\n\n const fns = [...(controlled ? [controlled] : []), ...map.values()];\n\n if (fns.length === 0) {\n return null;\n }\n if (fns.length === 1) {\n return fns[0];\n }\n return (value: T) => fns.every((fn) => fn(value));\n });\n\n /** `true` when at least one predicate is active. */\n readonly isActive = computed(() => this.predicate() !== null);\n\n /** Emitted whenever the `'default'` predicate changes (backward-compat single-filter output). */\n readonly filterChange = output<((value: T) => boolean) | null>();\n\n /** Emitted whenever any named predicate is added or removed. */\n readonly predicatesChange = output<Map<string, (value: T) => boolean>>();\n\n /**\n * Adds or replaces the named predicate `key`.\n * Emits `predicatesChange` with the updated map.\n */\n addPredicate(key: string, fn: (value: T) => boolean): void {\n const next = new Map(this.predicatesState());\n next.set(key, fn);\n this.predicatesState.set(next);\n this.predicatesChange.emit(next);\n }\n\n /**\n * Removes the named predicate `key` (no-op if not present).\n * Emits `predicatesChange` with the updated map.\n */\n removePredicate(key: string): void {\n const current = this.predicatesState();\n if (!current.has(key)) {\n return;\n }\n const next = new Map(current);\n next.delete(key);\n this.predicatesState.set(next);\n this.predicatesChange.emit(next);\n }\n\n /**\n * Sets the `'default'` predicate and emits `filterChange`.\n * Pass `null` to clear it (same as `clear()`).\n */\n setPredicate(fn: ((value: T) => boolean) | null): void {\n if (fn === null) {\n this.removePredicate('default');\n } else {\n this.addPredicate('default', fn);\n }\n this.filterChange.emit(fn);\n }\n\n /** Removes all named predicates and emits `filterChange` with `null`. */\n clear(): void {\n this.predicatesState.set(new Map());\n this.predicatesChange.emit(new Map());\n this.filterChange.emit(null);\n }\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n Directive,\n TemplateRef,\n contentChild,\n effect,\n inject,\n input,\n model,\n untracked,\n type Signal,\n} from '@angular/core';\nimport { CngxChip } from '@cngx/common/display';\nimport { CngxChipInGroup, CngxMultiChipGroup } from '@cngx/common/interactive';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\nimport type { CngxFilter } from '../filter/filter.directive';\n\n/**\n * Per-chip override slot context. Consumers project an\n * `<ng-template cngxFilterChip let-option let-value=\"value\" let-label=\"label\">`\n * to customize chip body decoration - icons, count badges, colour\n * swatches, anything beyond the default text label.\n *\n * **Decoration-only semantics.** The bridge ALWAYS wraps each option\n * in `<cngx-chip cngxChipInGroup [value]>` itself; the slot only\n * customizes what renders INSIDE that wrapper. Consumers do NOT\n * redeclare selection wiring - it is handled by the bridge so the\n * projected content survives Angular's `*ngTemplateOutlet`\n * lexical-injector semantics (the projected template injects against\n * the consumer's component, NOT the bridge's inner\n * `<cngx-multi-chip-group>`, so a consumer-supplied\n * `cngxChipInGroup` would fail to resolve `CNGX_CHIP_GROUP_HOST`).\n */\nexport interface CngxFilterChipContext<TItem = unknown, TValue = unknown> {\n readonly $implicit: TItem;\n readonly option: TItem;\n readonly value: TValue;\n readonly label: string;\n}\n\n/**\n * Template-slot directive overriding the default chip body inside\n * `<cngx-filter-chips>`. Consumers attach\n * `<ng-template cngxFilterChip>` to project decoration; the bridge\n * wraps that decoration in `cngxChipInGroup`-bound chip wrappers\n * automatically. Absence falls back to the default text-only label.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter-chips/filter-chips.component.ts\n * @since 0.3.0\n * @relatedTo CngxFilterChips, CngxFilter\n *\n * <example-url>/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>\n * <example-url>/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>\n */\n@Directive({\n selector: 'ng-template[cngxFilterChip]',\n standalone: true,\n})\nexport class CngxFilterChip<TItem = unknown, TValue = unknown> {\n readonly template: TemplateRef<CngxFilterChipContext<TItem, TValue>> =\n inject<TemplateRef<CngxFilterChipContext<TItem, TValue>>>(TemplateRef);\n\n static ngTemplateContextGuard<TItem, TValue>(\n _dir: CngxFilterChip<TItem, TValue>,\n _ctx: unknown,\n ): _ctx is CngxFilterChipContext<TItem, TValue> {\n return true;\n }\n}\n\n/**\n * Bridge that connects a multi-select chip strip to a `CngxFilter`\n * predicate via Pillar-1 derivation - no `effect()` write-back, no\n * manual sync. The bridge composes `<cngx-multi-chip-group>` for\n * the visible chip strip and registers a single closure-style\n * predicate on the parent `[filterRef]`. Chip toggles update\n * `selectedValues`; the registered closure reads `selectedValues()`\n * lazily on every invocation so downstream filtered consumers\n * recompute without the bridge ever re-registering.\n *\n * Filter chips are inherently multi-select per\n * `feedback_select_family_split`; a single-mode filter-chip pattern\n * is intentionally out of scope. Consumers needing a single-select\n * filter wire `<cngx-chip-group>` to a custom predicate themselves.\n *\n * **Sync contract - derivation, not effect.** `predicateFn` is a\n * closure that reads `this.selectedValues()` and\n * `this.optionValue()` on every invocation. Because\n * `CngxFilter.predicate` is itself a `computed()` consumed by\n * downstream filtered lists, each item-evaluation flows through\n * `selectedValues()` in the consumer's reactive context - chip\n * toggles propagate without any `effect()` writing back into the\n * filter. Registration itself is reactive: a binding effect tracks\n * `filterRef`/`filterKey` (a rebind moves the registration), and an\n * eviction watcher re-registers the key after `filter.clear()` wiped\n * the stack, so visible chip selection and predicate stack cannot\n * diverge. Selections whose option vanished from `[options]` are\n * pruned - a removed option never keeps filtering invisibly.\n *\n * **Empty-selection semantics.** When `selectedValues()` is `[]`,\n * the closure returns `true` for every item - equivalent to \"no\n * filter applied\". The bridge deliberately does NOT call\n * `removePredicate` on empty selection: leaving the predicate\n * registered with a constant-`true` short-circuit is cheaper than\n * re-registering on every empty/non-empty boundary, and keeps the\n * predicate-stack stable (no `predicatesChange` emission churn).\n *\n * **Teardown.** The binding effect's cleanup removes the key only\n * while it still maps to this strip's own `predicateFn` (identity\n * guard) - destroying one of two strips that share a key never\n * detaches the live sibling's registration.\n *\n * **Visible caption.** The required `label` renders as a\n * `.cngx-filter-chips__label` caption above the strip so a sighted user\n * can tell which facet a chip row belongs to. The caption is\n * `aria-hidden=\"true\"`: the inner `<cngx-multi-chip-group>` is already\n * named by the same string via `[label]`, so exposing the visible node\n * to AT would announce the facet twice. Spacing between caption and\n * strip is the `--cngx-filter-chips-gap` token; the caption's own\n * appearance is `--cngx-filter-chips-label-color`,\n * `--cngx-filter-chips-label-font-size` and\n * `--cngx-filter-chips-label-font-weight`.\n *\n * ```html\n * <cngx-filter-chips\n * label=\"Tags\"\n * [options]=\"tagOptions\"\n * optionLabel=\"label\"\n * optionValue=\"id\"\n * [filterRef]=\"employees\"\n * filterKey=\"tags\"\n * />\n *\n * <ng-container cngxFilter #employees=\"cngxFilter\">\n * @for (emp of filteredEmployees(); track emp.id) {\n * ...\n * }\n * </ng-container>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/filter-chips/filter-chips.component.ts\n * @since 0.3.0\n * @relatedTo CngxFilter, CngxFilterChip, CngxMultiChipGroup\n * @slot cngxFilterChip Renders one active filter chip; gets the filter entry and a remove callback.\n *\n * <example-url>/#/common/data/filter-chips/custom-chip-decoration-via-cngxfilterchip</example-url>\n * <example-url>/#/common/data/filter-chips/multi-role-filter-wired-to-a-list</example-url>\n * @axis level molecule\n */\n@Component({\n selector: 'cngx-filter-chips',\n exportAs: 'cngxFilterChips',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CngxChip, CngxMultiChipGroup, CngxChipInGroup, NgTemplateOutlet],\n host: {\n class: 'cngx-filter-chips',\n '[class.cngx-filter-chips--vertical]': 'orientation() === \"vertical\"',\n },\n styleUrl: './filter-chips.component.css',\n template: `\n <span class=\"cngx-filter-chips__label\" aria-hidden=\"true\">{{ label() }}</span>\n <cngx-multi-chip-group\n [label]=\"label()\"\n [(selectedValues)]=\"selectedValues\"\n [state]=\"state()\"\n [keyFn]=\"keyFn()\"\n [(disabled)]=\"disabled\"\n [(required)]=\"required\"\n [(invalid)]=\"invalid\"\n [errorMessageId]=\"errorMessageId()\"\n [orientation]=\"orientation()\"\n >\n @for (option of options(); track keyFn()(optionValue()(option))) {\n <cngx-chip cngxChipInGroup [value]=\"optionValue()(option)\">\n @if (chipTemplate()?.template; as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: chipContext(option)\" />\n } @else {\n {{ optionLabel()(option) }}\n }\n </cngx-chip>\n }\n </cngx-multi-chip-group>\n `,\n})\nexport class CngxFilterChips<TItem = unknown, TValue = unknown, TListItem = TItem> {\n /**\n * Name of the facet this strip filters. Renders as the visible, `aria-hidden`\n * `.cngx-filter-chips__label` caption and is passed to the inner chip group\n * as its accessible name.\n */\n readonly label = input.required<string>();\n /**\n * Chip pool: one chip is rendered per item, in array order. A selected value\n * whose option is no longer in the array is dropped from `selectedValues`.\n */\n readonly options = input.required<readonly TItem[]>();\n /**\n * Maps an option to its chip text. It is the default chip body and the\n * `label` field of the `cngxFilterChip` template context, which replaces the\n * default body when projected.\n */\n readonly optionLabel = input.required<(item: TItem) => string>();\n /**\n * Maps an option to the value that chip toggles into `selectedValues`. While\n * `itemValue` is unbound it is also applied to the filtered list items to\n * read the value the predicate compares against.\n */\n readonly optionValue = input.required<(item: TItem) => TValue>();\n /**\n * The `CngxFilter` this strip registers its predicate on, under `filterKey`.\n * Rebinding moves the registration to the new filter.\n */\n readonly filterRef = input.required<CngxFilter<TListItem>>();\n\n /**\n * Extracts the comparable value from a filtered list item, when the list\n * is shaped unlike the chip options: role options `{ id, label }` filtering\n * an employee list by `employee.roleId`. Return an array for an item that\n * carries several values (`employee.tags`); it matches when any of them is\n * selected. Unbound, the predicate applies `optionValue` to the list items,\n * which fits a list shaped like the options.\n */\n readonly itemValue = input<((item: TListItem) => TValue | readonly TValue[]) | undefined>(\n undefined,\n );\n /**\n * Key the predicate is registered under on `filterRef`. Rebinding moves the\n * registration; teardown removes the key only while it still maps to this\n * strip's own predicate.\n */\n readonly filterKey = input.required<string>();\n /**\n * Async state forwarded to the inner chip group, which reflects `loading` as\n * `aria-busy`. When unset, the group falls back to an ancestor\n * `CNGX_STATEFUL` provider.\n */\n readonly state = input<CngxAsyncState<unknown> | undefined>(undefined);\n\n /**\n * Form-state surface forwarded transparently to the inner\n * `<cngx-multi-chip-group>`. Each is a `model<boolean>` matching the\n * inner shape so consumers can two-way bind with their own forms\n * state without reaching past the bridge. Mirrors `CngxCheckboxGroup`\n * / `CngxButtonToggleGroup` precedent.\n */\n readonly disabled = model<boolean>(false);\n /**\n * Two-way flag forwarded to the inner chip group, which sets\n * `aria-required=\"true\"` while it is true. Default `false`.\n */\n readonly required = model<boolean>(false);\n /**\n * Two-way flag forwarded to the inner chip group, which sets\n * `aria-invalid=\"true\"` while it is true or the group's own error state is\n * active. Default `false`.\n */\n readonly invalid = model<boolean>(false);\n /**\n * Id of an external error element, forwarded to the inner chip group as\n * `aria-errormessage`. The consumer renders the element. Default `null`\n * omits the attribute.\n */\n readonly errorMessageId = input<string | null>(null);\n /**\n * Layout and arrow-key axis of the strip. `'vertical'` stacks the chips and\n * adds the `cngx-filter-chips--vertical` host class; the value is forwarded\n * to the inner chip group's roving tabindex. Default `'horizontal'`.\n */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n\n /**\n * Membership key extractor for object-valued chip values. When\n * `TValue` is an object (e.g. `{ id, label }` rather than a\n * primitive id), this fn extracts a stable identity key so chip\n * membership survives re-emissions with fresh references. Forwarded\n * to the inner `<cngx-multi-chip-group>` AND used inside the\n * predicate's `Object.is` comparison. Defaults to identity - works\n * for primitive values.\n */\n readonly keyFn = input<(value: TValue) => unknown>((v) => v);\n\n /**\n * Resolved consumer-supplied chip template. The query uses an\n * instantiation expression (`CngxFilterChip<TItem, TValue>`) so the\n * bridge's class generics propagate into the slot directive type;\n * absent that propagation, `contentChild(CngxFilterChip)` returns\n * `Signal<CngxFilterChip<unknown, unknown> | undefined>` and the\n * `chipContext()` helper would have to widen on every call.\n */\n protected readonly chipTemplate: Signal<CngxFilterChip<TItem, TValue> | undefined> = contentChild(\n CngxFilterChip<TItem, TValue>,\n );\n\n /**\n * Build the slot context for a given chip option. `optionValue` is\n * invoked here per option for the chip rendering pass; the predicate\n * closure invokes it again per LIST item for membership filtering\n * while `[itemValue]` is unbound. Both invocations are necessary\n * because option items (the chip pool) and filtered list items (the\n * consumer's filtered data) are separate data paths - they share a\n * shape only when `[itemValue]` is unbound, and the bridge cannot\n * memoise across the two paths without conflating them. Consumers\n * should keep `optionValue` cheap (typically a property lookup); bind\n * `[itemValue]` when the list is shaped unlike the options.\n */\n protected readonly chipContext = (option: TItem): CngxFilterChipContext<TItem, TValue> => {\n const value = this.optionValue()(option);\n return {\n $implicit: option,\n option,\n value,\n label: this.optionLabel()(option),\n };\n };\n\n /**\n * Internal multi-select state driven by chip toggles. Exposed as\n * a `model` so consumers may seed initial selection via\n * `[(selectedValues)]` if they need to; usually the consumer leaves\n * this internal and reads results via the parent\n * `CngxFilter.predicate`.\n */\n readonly selectedValues = model<TValue[]>([]);\n\n constructor() {\n const predicateFn = (item: TListItem): boolean => {\n const values = this.selectedValues();\n if (values.length === 0) {\n return true;\n }\n const extract = this.keyFn();\n const keys = this.itemKeys(item, extract);\n return values.some((v) => {\n const selected = extract(v);\n return keys.some((key) => Object.is(selected, key));\n });\n };\n\n // Binding effect: tracks only filterRef/filterKey, so a rebind moves the\n // registration. Cleanup is identity-guarded - it removes the key only\n // while it still maps to THIS strip's predicate, so tearing down one of\n // two strips sharing a key never detaches the live sibling.\n effect((onCleanup) => {\n const filter = this.filterRef();\n const key = this.filterKey();\n untracked(() => filter.addPredicate(key, predicateFn));\n onCleanup(() => {\n if (untracked(filter.predicates).get(key) === predicateFn) {\n untracked(() => filter.removePredicate(key));\n }\n });\n });\n\n // Eviction watcher: filter.clear() wipes the whole predicate map while\n // the chips stay visually selected. Re-register when our key is missing\n // so UI and predicate stack cannot diverge. A foreign same-key\n // registration is present, not missing - it is left alone (no fighting,\n // no loop).\n effect(() => {\n const filter = this.filterRef();\n const key = this.filterKey();\n if (!filter.predicates().has(key)) {\n untracked(() => filter.addPredicate(key, predicateFn));\n }\n });\n\n // Prune selections whose option vanished from [options]: without this a\n // removed option keeps filtering invisibly (no chip renders for it).\n effect(() => {\n const extract = this.keyFn();\n const valid = new Set(this.options().map((o) => extract(this.optionValue()(o))));\n const current = untracked(this.selectedValues);\n const pruned = current.filter((v) => valid.has(extract(v)));\n if (pruned.length !== current.length) {\n untracked(() => this.selectedValues.set(pruned));\n }\n });\n }\n\n private itemKeys(item: TListItem, extract: (value: TValue) => unknown): readonly unknown[] {\n const itemValue = this.itemValue();\n if (!itemValue) {\n // Without [itemValue] the list is shaped like the options (the\n // `TListItem = TItem` default), and an array-valued option stays one value.\n const optionValue = this.optionValue() as unknown as (item: TListItem) => TValue;\n return [extract(optionValue(item))];\n }\n const values = itemValue(item);\n return Array.isArray(values)\n ? (values as readonly TValue[]).map(extract)\n : [extract(values as TValue)];\n }\n}\n","import { computed, Directive, input, output, signal } from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\n/**\n * Atom directive that tracks pagination state (current page index and page size).\n *\n * Supports both **uncontrolled** (internal state) and **controlled** modes. \\\n * In controlled mode the `cngxPageIndex` / `cngxPageSize` inputs take precedence\n * over internal state - pair with \\\n * `pageChange` / `pageSizeChange` to keep them\n * in sync.\n *\n * Consumer connects this to a list or table via `range()` - nothing is injected\n * automatically.\n *\n * ```\n * // Headless: read range() from a template ref\n * <div cngxPaginate #pg=\"cngxPaginate\" [total]=\"items.length\">\n * @for (item of items.slice(pg.range()[0], pg.range()[1]); track item.id) { ... }\n * </div>\n *\n * // Drive any UI off the brain - e.g. a Material paginator wired by hand:\n * <mat-paginator\n * [length]=\"pg.total()\" [pageIndex]=\"pg.pageIndex()\" [pageSize]=\"pg.pageSize()\"\n * (page)=\"pg.setPageSize($event.pageSize, false); pg.setPage($event.pageIndex)\" />\n * ```\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate.directive.ts\n * @since 0.3.0\n * @relatedTo CngxSort, CngxFilter, CngxSmartDataSource\n *\n * <example-url>/#/common/data/data-source/datasource-cngxpaginate-manual-pipeline</example-url>\n * <example-url>/#/common/data/paginate-list/paginated-list-cngxpaginate</example-url>\n * <example-url>/#/common/data/paginate-list/uncontrolled-mode-zero-class-boilerplate</example-url>\n * <example-url>/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>\n * @axis level atom\n */\n@Directive({\n selector: '[cngxPaginate]',\n exportAs: 'cngxPaginate',\n standalone: true,\n})\nexport class CngxPaginate {\n /** Controlled page index. When bound, takes precedence over internal state. */\n readonly pageIndexInput = input<number | undefined>(undefined, { alias: 'cngxPageIndex' });\n /** Controlled page size. When bound, takes precedence over internal state. */\n readonly pageSizeInput = input<number | undefined>(undefined, { alias: 'cngxPageSize' });\n /**\n * Total number of items (before pagination). Consumer binds this from the\n * filtered/sorted count so that `totalPages` stays accurate.\n */\n readonly total = input<number>(0);\n\n /**\n * Bind an async state - disables navigation while the data source is busy.\n * When set, `isBusy` derives from `state.isBusy()`. Navigation methods\n * (`setPage`, `next`, `previous`, etc.) are no-ops while busy.\n */\n readonly state = input<CngxAsyncState<unknown> | undefined>(undefined);\n\n /** `true` when the bound async state is busy (loading/refreshing). */\n readonly isBusy = computed(() => this.state()?.isBusy() ?? false);\n\n private readonly pageIndexState = signal(0);\n private readonly pageSizeState = signal(10);\n\n /** Current page index (0-based). Controlled input takes precedence. Auto-clamped to totalPages. */\n readonly pageIndex = computed(() => {\n const raw = this.pageIndexInput() ?? this.pageIndexState();\n const max = this.totalPages() - 1;\n return Math.min(raw, max);\n });\n /** Current page size. Controlled input takes precedence. */\n readonly pageSize = computed(() => this.pageSizeInput() ?? this.pageSizeState());\n\n /** Total number of pages (minimum 1). */\n readonly totalPages = computed(() => Math.max(1, Math.ceil(this.total() / this.pageSize())));\n\n /** `true` when on the first page. */\n readonly isFirst = computed(() => this.pageIndex() === 0);\n /** `true` when on the last page. */\n readonly isLast = computed(() => this.pageIndex() >= this.totalPages() - 1);\n\n /**\n * `[start, end]` indices for `Array.slice()` - always in-bounds.\n * Consumer: `items.slice(range()[0], range()[1])`.\n */\n readonly range = computed<[number, number]>(\n () => {\n const start = this.pageIndex() * this.pageSize();\n return [start, start + this.pageSize()];\n },\n { equal: (a, b) => a[0] === b[0] && a[1] === b[1] },\n );\n\n /**\n * `[0, end]` cumulative slice indices for append-don't-replace (load-more)\n * consumers: every page already stepped through, sliced from the top. `end`\n * is `(pageIndex + 1) * pageSize` - the count revealed so far, uncapped (a\n * partial final page is clamped by the consumer against `total`).\n * Pure derivation of `pageIndex` / `pageSize`; the explicit tuple `equal`\n * stops a fresh-array identity from cascading downstream.\n */\n readonly cumulativeRange = computed<[number, number]>(\n () => [0, (this.pageIndex() + 1) * this.pageSize()],\n { equal: (a, b) => a[0] === b[0] && a[1] === b[1] },\n );\n\n /**\n * `range()` with both bounds capped at `total` - the honest in-bounds window\n * for readouts and announcements. `range()`'s upper bound is\n * `start + pageSize`, so a partial final page overshoots `total`; this caps\n * it (and yields `[0, 0]` while the list is empty). The capped end doubles as\n * the cumulative reveal count for load-more consumers: `range()[1]` and\n * `cumulativeRange()[1]` are the same number (`(pageIndex + 1) * pageSize`),\n * so `clampedRange()[1]` is \"items shown so far\" in both replace and append\n * modes. The explicit tuple `equal` stops a fresh-array identity from\n * cascading downstream.\n */\n readonly clampedRange = computed<[number, number]>(\n () => {\n const total = this.total();\n const [start, end] = this.range();\n return [Math.min(start, total), Math.min(end, total)];\n },\n { equal: (a, b) => a[0] === b[0] && a[1] === b[1] },\n );\n\n /** Emitted when the page index changes. */\n readonly pageChange = output<number>();\n /** Emitted when the page size changes. */\n readonly pageSizeChange = output<number>();\n\n /**\n * Navigate to `index`, clamping to `[0, totalPages - 1]`.\n * Emits `pageChange`.\n */\n setPage(index: number): void {\n if (this.isBusy()) {\n return;\n }\n const clamped = Math.max(0, Math.min(index, this.totalPages() - 1));\n this.pageIndexState.set(clamped);\n this.pageChange.emit(clamped);\n }\n\n /**\n * Change page size and optionally reset to page 0.\n * Emits `pageSizeChange` and, when `resetPage` is `true`, `pageChange`.\n */\n setPageSize(size: number, resetPage = true): void {\n if (this.isBusy()) {\n return;\n }\n this.pageSizeState.set(size);\n this.pageSizeChange.emit(size);\n if (resetPage) {\n this.pageIndexState.set(0);\n this.pageChange.emit(0);\n }\n }\n\n /** Navigate to the next page (no-op on the last page). */\n next(): void {\n this.setPage(this.pageIndex() + 1);\n }\n\n /** Navigate to the previous page (no-op on the first page). */\n previous(): void {\n this.setPage(this.pageIndex() - 1);\n }\n\n /** Navigate to the first page. */\n first(): void {\n this.setPage(0);\n }\n\n /** Navigate to the last page. */\n last(): void {\n this.setPage(this.totalPages() - 1);\n }\n}\n","import { inject } from '@angular/core';\nimport { CngxRuntimeError } from '@cngx/utils';\n\nimport { CngxPaginate } from './paginate.directive';\n\n/**\n * Inject the surrounding {@link CngxPaginate} from a paginate add-on\n * directive. Throws a `CngxRuntimeError` with code `CNGX1063` when no\n * `[cngxPaginate]` is on the element or above it, in development and\n * production alike. `selector` names the add-on in the development message.\n *\n * @internal\n */\nexport function injectPaginate(selector: string): CngxPaginate {\n const paginate = inject(CngxPaginate, { optional: true });\n if (!paginate) {\n throw new CngxRuntimeError(\n 'CNGX1063',\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n `[${selector}] must be placed on or inside an element with [cngxPaginate], such as <cngx-paginator>.`,\n );\n }\n return paginate;\n}\n","import { Directive, effect, input, untracked } from '@angular/core';\n\nimport { injectPaginate } from './inject-paginate';\nimport type { CngxPaginate } from './paginate.directive';\n\n/**\n * Wires the reset-on-change behaviour onto a {@link CngxPaginate} brain: when\n * `key()` changes (after the initial run) the paginator jumps to the first\n * page. The first run captures the mounting value without resetting, and an\n * already-first paginator emits nothing.\n *\n * Shared by `[cngxPaginateResetOn]`, the `CngxPaginator` shell's `resetOn`\n * input, and the `CngxMatPaginator` bridge's `resetOn` input, so the behaviour\n * is byte-identical across all three. Call inside an injection context\n * (constructor or field initialiser).\n *\n * @since 0.3.0\n */\nexport function connectPaginateResetOn(paginate: CngxPaginate, key: () => unknown): void {\n let seen = false;\n effect(() => {\n key();\n if (!seen) {\n seen = true;\n return;\n }\n untracked(() => {\n if (paginate.pageIndex() !== 0) {\n paginate.setPage(0);\n }\n });\n });\n}\n\n/**\n * Resets a `cngxPaginate` host to the first page whenever the bound key\n * changes - the composable form of {@link connectPaginateResetOn}. \\\n * Drop it on the same element as `cngxPaginate` (or a `CngxPaginator` / `CngxMatPaginator`,\n * which provide the brain), and bind the sort / filter / search value a result\n * set depends on, so a narrowed result never strands the user on a now-empty\n * page.\n *\n * Bind a primitive or a `computed` - an inline array / object literal recomputes\n * every change-detection pass and would reset on each.\n *\n * ```html\n * <table cngxPaginate [cngxPaginateResetOn]=\"filter()\"><!-- ... --></table>\n * ```\n * <example-url>/#/ui/paginator/paginator-behaviors/reset-on-filter</example-url>\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate-reset.directive.ts\n * @since 0.3.0\n * @relatedTo CngxPaginate, CngxPaginator, CngxMatPaginator\n */\n@Directive({\n selector: '[cngxPaginateResetOn]',\n exportAs: 'cngxPaginateResetOn',\n standalone: true,\n})\nexport class CngxPaginateResetOn {\n private readonly paginate = injectPaginate('cngxPaginateResetOn');\n\n /** The reset key. A change (after mount) jumps the paginator to page 0. */\n readonly key = input<unknown>(undefined, { alias: 'cngxPaginateResetOn' });\n\n constructor() {\n connectPaginateResetOn(this.paginate, this.key);\n }\n}\n","import { DestroyRef, effect, inject, untracked } from '@angular/core';\n\nimport type { CngxPaginate } from './paginate.directive';\n\n/**\n * Handlers the two-way emit bridge forwards page changes to - typically a\n * host component's `pageIndexChange` / `pageSizeChange` output emitters.\n *\n * @since 0.3.0\n */\nexport interface CngxPaginateEmitHandlers {\n /** Called once per effective page-index change. */\n readonly onIndex: (index: number) => void;\n /** Called once per effective page-size change. */\n readonly onSize: (size: number) => void;\n}\n\n/**\n * Wires the {@link CngxPaginate} brain's page / page-size changes onto a host's\n * two-way outputs with exactly-once emit semantics. Two paths feed each handler,\n * sharing a last-emitted guard:\n * - a subscription forwards the brain's nav-only `pageChange` / `pageSizeChange`\n * - the only signal that captures a controlled-mode `setPage`, because the\n * brain's `pageIndex()` stays pinned to the input until the consumer feeds it\n * back;\n * - an `effect()` reads the effective `pageIndex()` / `pageSize()` and covers a\n * `total`-shrink clamp the nav-only output misses. The index half of the\n * clamp path is suppressed while the brain is busy or `total` is 0, so a\n * transient total drop during a refetch never persists a page-0 clamp into a\n * controlled consumer; a clamp that survives the settle emits then.\n *\n * The shared guard makes a value one path already emitted a no-op on the other,\n * so each change emits exactly once. Seeded with the current effective values,\n * so wiring emits no initial change.\n *\n * Shared verbatim by the `CngxPaginator` shell and the `CngxIncrementalList`\n * organism, so the two-way emit behaviour is byte-identical. Call inside an\n * injection context (constructor or field initialiser) - it reads `DestroyRef`\n * and creates effects.\n *\n * @since 0.3.0\n */\nexport function connectPaginateEmit(\n paginate: CngxPaginate,\n handlers: CngxPaginateEmitHandlers,\n): void {\n const destroyRef = inject(DestroyRef);\n\n // Shared last-emitted guards across the nav (subscription) and clamp (effect)\n // paths. Plain locals, so the effects carry no signal write. Seeded with the\n // current effective values so wiring emits no initial change.\n let lastIndex = paginate.pageIndex();\n let lastSize = paginate.pageSize();\n\n // Nav path. Forwards the brain's nav-only outputs: in controlled mode a\n // setPage leaves the effective pageIndex() pinned to the input, so this event\n // is the only thing that reports the navigation.\n const indexSub = paginate.pageChange.subscribe((index) => {\n if (index !== lastIndex) {\n lastIndex = index;\n handlers.onIndex(index);\n }\n });\n const sizeSub = paginate.pageSizeChange.subscribe((size) => {\n if (size !== lastSize) {\n lastSize = size;\n handlers.onSize(size);\n }\n });\n destroyRef.onDestroy(() => {\n indexSub.unsubscribe();\n sizeSub.unsubscribe();\n });\n\n // Clamp path. The effective pageIndex moved without a nav (a total-shrink\n // clamp the nav-only pageChange misses). The shared guard means a value the\n // nav path already emitted is a no-op here, so each change emits once.\n effect(() => {\n const index = paginate.pageIndex();\n // A transient total drop (a refetch clearing [total] to 0) clamps the\n // effective index to 0; forwarding that would persist the clamp into a\n // controlled consumer's two-way state and pin page 0 after the data\n // returns, where the brain's read-time clamp alone would recover. Both\n // gates are tracked reads, so a clamp that survives the settle (a real\n // total shrink) emits when busy flips off / total refills.\n if (paginate.isBusy() || paginate.total() === 0) {\n return;\n }\n if (index !== lastIndex) {\n lastIndex = index;\n // Consumer handlers run synchronously - keep their signal reads/writes\n // out of this effect's dependency graph.\n untracked(() => handlers.onIndex(index));\n }\n });\n effect(() => {\n const size = paginate.pageSize();\n if (size !== lastSize) {\n lastSize = size;\n untracked(() => handlers.onSize(size));\n }\n });\n}\n","import {\n DestroyRef,\n Directive,\n effect,\n inject,\n input,\n type OnInit,\n signal,\n untracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { cngxDevWarn } from '@cngx/utils';\n\nimport { injectPaginate } from './inject-paginate';\n\n/**\n * Persists a `cngxPaginate` host's page / size in the URL query string, so a\n * paginated view is deep-linkable and survives reload / back / forward.\n *\n * Drop it on the same element as `cngxPaginate` (or a `CngxPaginator` /\n * `CngxMatPaginator`, which provide the brain). The page is written 1-based\n * (`?page=2`) for human-readable URLs; the brain stays 0-based.\n *\n * ```html\n * <cngx-paginator cngxPaginateRouting [total]=\"items().length\"></cngx-paginator>\n * ```\n *\n * Two paginators on one route must take distinct param names via\n * `[cngxPaginatePageParam]` / `[cngxPaginateSizeParam]` to avoid a collision. \\\n * Requires `@angular/router` (`provideRouter`); without it the directive is an\n * inert no-op (a dev-mode warning is logged). Framework-agnostic of any UI - it\n * needs only the brain and the router.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/paginate-routing.directive.ts\n * @since 0.3.0\n * @relatedTo CngxPaginate, CngxPaginator, CngxMatPaginator\n * <example-url>/#/ui/paginator/paginator-behaviors/url-synced-paging</example-url>\n * @axis level organism\n */\n@Directive({\n selector: '[cngxPaginateRouting]',\n exportAs: 'cngxPaginateRouting',\n standalone: true,\n})\nexport class CngxPaginateRouting implements OnInit {\n private readonly paginate = injectPaginate('cngxPaginateRouting');\n private readonly router = inject(Router, { optional: true });\n private readonly route = inject(ActivatedRoute, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n\n /** Query-param name for the 1-based page. */\n readonly pageParam = input('page', { alias: 'cngxPaginatePageParam' });\n /** Query-param name for the page size. */\n readonly sizeParam = input('pageSize', { alias: 'cngxPaginateSizeParam' });\n\n // Set synchronously around brain writes driven by the URL, so the\n // pageChange subscription below can tell a URL-driven change from a user\n // navigation (setPage/setPageSize emit synchronously).\n private applyingFromUrl = false;\n\n // A deep-linked page index the brain could not represent yet: setPage\n // clamps against totalPages (1 while the default total=0 is still in\n // effect) and no-ops entirely while the bound async state is busy. The raw\n // index is parked here and re-applied once total/busy settle; while it is\n // parked, the brain -> URL effect leaves the URL alone so the deep link\n // survives until the data lands. `size` is null once the size half has\n // been applied.\n private readonly pendingUrl = signal<{ index: number; size: number | null } | null>(null, {\n equal: (a, b) => a?.index === b?.index && a?.size === b?.size,\n });\n\n constructor() {\n const router = this.router;\n const route = this.route;\n if (!router || !route) {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n cngxDevWarn(\n 'CNGX1031',\n '[cngxPaginateRouting] no Router / ActivatedRoute available - the URL sync is a no-op. ' +\n 'Provide @angular/router via provideRouter(...) to enable URL-synced pagination.',\n );\n }\n return;\n }\n\n // A user navigation supersedes a still-parked deep link. The brain is\n // resolved through the element injector and may live on an ancestor, so\n // the subscription is torn down explicitly instead of relying on shared\n // lifecycles.\n const pageChangeSub = this.paginate.pageChange.subscribe(() => {\n if (!this.applyingFromUrl) {\n this.pendingUrl.set(null);\n }\n });\n this.destroyRef.onDestroy(() => pageChangeSub.unsubscribe());\n\n // brain -> URL. Tracks the effective page / size; merges into the existing\n // query string and replaces history so paging does not stack back entries.\n // The param-name inputs are read lazily inside untracked, so a late-bound\n // alias is already set by the time the first navigation fires. Skipped\n // while a deep link is parked and when the URL already carries the values\n // (the echo after a URL -> brain apply must not renavigate).\n effect(() => {\n const page = this.paginate.pageIndex() + 1;\n const size = this.paginate.pageSize();\n if (this.pendingUrl() !== null) {\n return;\n }\n untracked(() => {\n // Snapshot read while router.navigate is async: a still-pending\n // navigation can slip past this check and renavigate - benign under\n // replaceUrl + merge (same params, no history entry).\n const params = route.snapshot.queryParamMap;\n const samePage = Number(params.get(this.pageParam())) === page;\n const sameSize = Number(params.get(this.sizeParam())) === size;\n if (samePage && sameSize) {\n return;\n }\n void router.navigate([], {\n relativeTo: route,\n queryParams: { [this.pageParam()]: page, [this.sizeParam()]: size },\n queryParamsHandling: 'merge',\n replaceUrl: true,\n });\n });\n });\n\n // Re-apply a parked deep link whenever the clamp inputs move (total\n // landed, busy released). Only those two triggers are tracked; the parked\n // value is read untracked, so the re-park write inside applyFromUrl can\n // never feed back into this effect's own dependency graph.\n effect(() => {\n this.paginate.totalPages();\n this.paginate.isBusy();\n untracked(() => {\n const pending = this.pendingUrl();\n if (pending !== null) {\n this.applyFromUrl(pending.index, pending.size);\n }\n });\n });\n }\n\n ngOnInit(): void {\n const route = this.route;\n if (!route) {\n return;\n }\n // URL -> brain, wired in ngOnInit so the param-name inputs are resolved\n // before queryParamMap replays the current params on subscribe (a\n // deep-linked page / size therefore lands before first paint). The\n // subscription stays live for back / forward navigation.\n route.queryParamMap.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params) => {\n const rawSize = Number(params.get(this.sizeParam()));\n const rawPage = Number(params.get(this.pageParam()));\n const size = Number.isFinite(rawSize) && rawSize > 0 ? rawSize : null;\n const index = (Number.isFinite(rawPage) && rawPage > 0 ? rawPage : 1) - 1;\n this.applyFromUrl(index, size);\n });\n }\n\n private applyFromUrl(index: number, size: number | null): void {\n const paginate = this.paginate;\n if (paginate.isBusy()) {\n // Both setters no-op while busy - park the whole request and retry.\n this.pendingUrl.set({ index, size });\n return;\n }\n this.applyingFromUrl = true;\n try {\n if (size !== null && size !== paginate.pageSize()) {\n paginate.setPageSize(size, false);\n }\n if (index !== paginate.pageIndex()) {\n paginate.setPage(index);\n }\n } finally {\n this.applyingFromUrl = false;\n }\n if (paginate.pageIndex() === index || paginate.total() > 0) {\n // Landed, or clamped against a real total - the deep link is resolved.\n this.pendingUrl.set(null);\n } else {\n // Clamped against the default total=0: the real total has not arrived\n // yet, so keep the raw index parked (size, if any, is applied already).\n this.pendingUrl.set({ index, size: null });\n }\n }\n}\n","import { InjectionToken, type Signal } from '@angular/core';\n\n/**\n * A single bucket as the chips segment reads it - the label only. The match\n * predicate that decides membership stays internal to `CngxBucketPaginate`; a\n * presentation segment never needs it, only the label to render and the\n * derived empty/active state to reflect.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts\n * @since 0.3.0\n */\nexport interface CngxBucketPaginateView {\n /** Human-readable bucket label, e.g. `'A-C'`. Rendered as the chip text. */\n readonly label: string;\n}\n\n/**\n * Read-and-write contract a category/range chip strip (`cngx-pgn-alpha`)\n * injects instead of the concrete `CngxBucketPaginate` directive. \\\n * The directive provides it via `useExisting`, so a chip strip stays\n * decompose-ready - it talks to the token, never to the model class (DI\n * abstraction).\n *\n * The signals are the single derivation source for every chip's pressed and\n * disabled state; `select` / `clear` are the only write paths, each routing\n * through the directive's `active` model so the toggle invariant (re-selecting\n * the active bucket clears it) holds in one place.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts\n * @since 0.3.0\n */\nexport interface CngxBucketPaginateHost {\n /** The buckets to render, in declaration order. One chip per entry. */\n readonly buckets: Signal<readonly CngxBucketPaginateView[]>;\n /** Label of the active bucket, or `null` when no bucket is selected. */\n readonly active: Signal<string | null>;\n /**\n * `true` when no bound item matches the bucket's predicate. Derived from the\n * `items` / `buckets` inputs (never a synced flag); a chip binds its disabled\n * state to this so an empty bucket is a dead control with a stated reason.\n */\n isEmpty(label: string): boolean;\n /**\n * Select the bucket. Re-selecting the already-active bucket clears the\n * selection (toggle). No-op for an empty bucket.\n */\n select(label: string): void;\n /** Clear the active bucket (show the unfiltered collection). */\n clear(): void;\n}\n\n/**\n * DI token the `CngxBucketPaginate` range model provides via `useExisting`.\n * The category chips segment (`cngx-pgn-alpha`) injects this rather than the\n * concrete directive class, keeping the strip decompose-ready and the model\n * swappable.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate-host.token.ts\n * @since 0.3.0\n */\nexport const CNGX_BUCKET_PAGINATE_HOST = new InjectionToken<CngxBucketPaginateHost>(\n 'CngxBucketPaginateHost',\n);\n","import { computed, Directive, input, model } from '@angular/core';\n\nimport {\n CNGX_BUCKET_PAGINATE_HOST,\n type CngxBucketPaginateHost,\n} from './bucket-paginate-host.token';\n\n/**\n * A category bucket: a label plus a predicate that decides which items fall\n * into it. The predicate keeps the model content-agnostic - the same directive\n * buckets by letter range, date band, price tier, or any other partition the\n * consumer expresses, without the brain knowing what it is bucketing.\n */\nexport interface CngxBucket<T> {\n /** Human-readable bucket label, e.g. `'A-C'`. Rendered as the chip text. */\n readonly label: string;\n /** Returns `true` when `item` belongs to this bucket. */\n readonly match: (item: T) => boolean;\n}\n\n/** Two `ReadonlySet`s are equal when they hold the same members. */\nfunction setEquals(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\n if (a.size !== b.size) {\n return false;\n }\n for (const value of a) {\n if (!b.has(value)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Range/category pagination model - a sibling to {@link CngxPaginate}, NOT a\n * mode flag on it. Where `CngxPaginate` steps a page index over a slice window,\n * this directive partitions a collection into labelled buckets (letter ranges,\n * date bands, price tiers) and tracks which one is active. The page-index brain\n * stays single-responsibility; a consumer composes whichever model the data\n * calls for (Komposition statt Konfiguration).\n *\n * The empty/disabled state of every bucket is **derived**, never managed: a\n * bucket is empty when no bound item matches its predicate, computed from the\n * `items` / `buckets` inputs. There is no synced flag and no effect.\n *\n * `active` is the two-way primary value (a `model<string | null>()`):\n * `null` shows the unfiltered collection; a label filters to that bucket.\n * `select(label)` toggles - re-selecting the active bucket clears it.\n *\n * ```html\n * <div\n * cngxBucketPaginate\n * #bp=\"cngxBucketPaginate\"\n * [buckets]=\"letterBuckets\"\n * [items]=\"people\"\n * [(active)]=\"activeBucket\"\n * >\n * @for (p of bp.active() ? people.filter(byActiveBucket) : people; track p.id) { ... }\n * </div>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/paginate/bucket-paginate.directive.ts\n * @since 0.3.0\n * @relatedTo CngxPaginate, CngxFilter\n * <example-url>/#/ui/paginator/paginator-modes/alphabetical</example-url>\n * @axis level organism\n */\n@Directive({\n selector: '[cngxBucketPaginate]',\n exportAs: 'cngxBucketPaginate',\n standalone: true,\n providers: [{ provide: CNGX_BUCKET_PAGINATE_HOST, useExisting: CngxBucketPaginate }],\n})\nexport class CngxBucketPaginate<T = unknown> implements CngxBucketPaginateHost {\n /** The buckets to partition into, in render order. One chip per entry. */\n readonly buckets = input<readonly CngxBucket<T>[]>([]);\n /** The collection the buckets test against. Drives the derived empty state. */\n readonly items = input<readonly T[]>([]);\n\n /**\n * Active bucket label, or `null` for the unfiltered collection. The two-way\n * primary value (`[(active)]`); a `model()` because it is the directive's\n * bindable state, not a derived read.\n */\n readonly active = model<string | null>(null);\n\n /**\n * Labels of every bucket whose predicate matches no bound item. A pure\n * `computed()` over `items` / `buckets` - the disabled chips read this, so\n * the empty state is derived, never synced. The explicit set `equal` stops a\n * fresh-`Set` identity from cascading downstream on every unrelated recompute.\n */\n private readonly emptyLabels = computed<ReadonlySet<string>>(\n () => {\n const items = this.items();\n const empties = new Set<string>();\n for (const bucket of this.buckets()) {\n if (!items.some((item) => bucket.match(item))) {\n empties.add(bucket.label);\n }\n }\n return empties;\n },\n { equal: setEquals },\n );\n\n /** `true` when no bound item falls into the bucket. */\n isEmpty(label: string): boolean {\n return this.emptyLabels().has(label);\n }\n\n /**\n * Select the bucket, or clear the selection when it is already active\n * (toggle). An empty bucket is a no-op - it never becomes the active filter.\n */\n select(label: string): void {\n if (this.isEmpty(label)) {\n return;\n }\n this.active.update((current) => (current === label ? null : label));\n }\n\n /** Clear the active bucket - show the unfiltered collection. */\n clear(): void {\n this.active.set(null);\n }\n}\n","import { DataSource } from '@angular/cdk/collections';\nimport { inject, Injector, type Signal } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport type { Observable } from 'rxjs';\n\n/**\n * Minimal CDK `DataSource` that bridges a Signal to the CDK table's\n * Observable-based data contract.\n *\n * No sort, filter, or search logic is included - the consumer builds a\n * `computed()` with any transformations and passes the result here.\n *\n * ```typescript\n * readonly processed = computed(() => {\n * let items = this.raw();\n * if (this.sort().sort()) { items = sortTree(items, ...); }\n * return items;\n * });\n * readonly dataSource = injectDataSource(this.processed);\n * ```\n *\n * @typeParam T - The row item type.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/data-source/data-source.ts\n * @since 0.3.0\n * @relatedTo CngxSmartDataSource, CngxSort, CngxFilter, CngxPaginate\n */\nexport class CngxDataSource<T> extends DataSource<T> {\n private readonly injector = inject(Injector);\n\n constructor(private readonly data: Signal<T[]>) {\n super();\n }\n\n /**\n * CDK `DataSource` contract, called by the CDK table when it attaches. Returns\n * an observable of the source signal that emits the array each time the\n * signal changes.\n */\n override connect(): Observable<T[]> {\n return toObservable(this.data, { injector: this.injector });\n }\n\n /**\n * CDK `DataSource` contract, called by the CDK table when it detaches. No-op;\n * the `toObservable` subscription ends with the injector's `DestroyRef`.\n */\n override disconnect(): void {\n // Signal cleanup is handled by Angular's DestroyRef - no manual teardown needed.\n }\n}\n\n/**\n * Factory function for {@link CngxDataSource}.\n *\n * Must be called within an injection context (constructor or field initializer).\n *\n * ```typescript\n * readonly dataSource = injectDataSource(this.items);\n * ```\n */\nexport function injectDataSource<T>(data: Signal<T[]>): CngxDataSource<T> {\n return new CngxDataSource(data);\n}\n","import { DataSource } from '@angular/cdk/collections';\nimport { computed, inject, Injector, type Signal } from '@angular/core';\nimport { toObservable } from '@angular/core/rxjs-interop';\nimport { foldForMatching, injectLocale, memoize, type CngxAsyncState } from '@cngx/core/utils';\nimport { arrayEqual } from '@cngx/utils';\nimport type { Observable } from 'rxjs';\nimport { CngxPaginate } from '../paginate/paginate.directive';\nimport { CngxFilter } from '../filter/filter.directive';\nimport { CngxSort } from '../sort/sort.directive';\nimport { CngxSearch } from '@cngx/common/interactive';\n\ninterface FoldedFields {\n readonly locale: string;\n readonly raw: readonly string[];\n readonly folded: readonly string[];\n}\n\n/**\n * @internal Folded field values per row object. Keyed by the row, so it\n * cannot thrash and is collected with the rows; the raw strings are compared\n * on every read, so a row mutated in place is folded again.\n */\nconst FOLDED_FIELDS = new WeakMap<object, FoldedFields>();\n\nfunction rawFieldsOf(item: object): string[] {\n const raw: string[] = [];\n for (const v of Object.values(item)) {\n if (v !== null && v !== undefined && typeof v !== 'object') {\n raw.push(String(v as string | number | boolean | bigint));\n }\n }\n return raw;\n}\n\nfunction foldedFieldsOf(item: object, locale: string): readonly string[] {\n const raw = rawFieldsOf(item);\n const cached = FOLDED_FIELDS.get(item);\n if (cached?.locale === locale && arrayEqual(cached.raw, raw)) {\n return cached.folded;\n }\n const folded = raw.map((value) => foldForMatching(value, locale));\n FOLDED_FIELDS.set(item, { locale, raw, folded });\n return folded;\n}\n\n/**\n * @internal The default search: primitive field values, case and accents\n * ignored in `locale`. The term is folded once per term, each row's field\n * values once per row and locale, not on every keystroke.\n */\nconst defaultSearchFnFor = memoize(\n (locale: string): ((item: unknown, term: string) => boolean) => {\n let lastTerm = '';\n let lastFolded = '';\n return (item, term) => {\n if (term !== lastTerm) {\n lastTerm = term;\n lastFolded = foldForMatching(term, locale);\n }\n if (typeof item !== 'object' || item === null) {\n return foldForMatching(String(item), locale).includes(lastFolded);\n }\n return foldedFieldsOf(item, locale).some((value) => value.includes(lastFolded));\n };\n },\n { cacheLimit: 8 },\n);\n\nconst collatorFor = memoize(\n (locale: string) => new Intl.Collator(locale, { numeric: true, sensitivity: 'base' }),\n { cacheLimit: 32 },\n);\n\n/** @internal The default comparator: field values as text, collated in `locale`. */\nfunction defaultSortFnFor<T>(\n locale: string,\n): (a: T, b: T, field: string, dir: 'asc' | 'desc') => number {\n const collator = collatorFor(locale);\n const toStr = (v: unknown): string =>\n v === null || v === undefined || typeof v === 'object'\n ? ''\n : String(v as string | number | boolean | bigint);\n return (a, b, field, dir) => {\n const cmp = collator.compare(\n toStr((a as Record<string, unknown>)[field]),\n toStr((b as Record<string, unknown>)[field]),\n );\n return dir === 'asc' ? cmp : -cmp;\n };\n}\n\n/**\n * Optional customization for {@link CngxSmartDataSource}.\n */\nexport interface CngxSmartDataSourceOptions<T> {\n /**\n * Custom full-text search function. Receives an item and the current search\n * term; return `true` to keep the item. Defaults to a substring match across\n * all primitive-valued properties that ignores case and accents in the app\n * locale.\n */\n searchFn?: (item: T, term: string) => boolean;\n /**\n * Custom sort comparator. Receives two items, the active field key, and\n * direction. Defaults to a string comparison collated in the app locale\n * (`CNGX_LOCALE`), numeric-aware and case- and accent-insensitive.\n */\n sortFn?: (a: T, b: T, field: string, direction: 'asc' | 'desc') => number;\n /**\n * Resolve the `CngxSort` atom explicitly instead of relying on injection.\n * A thunk, not an instance, so a `viewChild` that is `undefined` on the\n * first pass resolves on a later read. A thunk result takes precedence over\n * an injected instance whenever it yields one; on `undefined` / `null` the\n * source falls back to the injected atom - so with both present, the\n * injected atom drives the frames before the thunk's target mounts, and the\n * thunk cannot express \"use none\".\n * Use for atoms hosted below this source's injector, e.g.\n * `{ sort: () => this.grid()?.sort }` against a `CngxDataGridAccordion`.\n */\n sort?: () => CngxSort | null | undefined;\n /** Same as `sort`, for the `CngxFilter` atom. */\n filter?: () => CngxFilter<T> | null | undefined;\n /** Same as `sort`, for the `CngxSearch` atom. */\n search?: () => CngxSearch | null | undefined;\n /** Same as `sort`, for the `CngxPaginate` atom. */\n paginate?: () => CngxPaginate | null | undefined;\n}\n\nfunction isAsyncState<T>(source: Signal<T[]> | CngxAsyncState<T[]>): source is CngxAsyncState<T[]> {\n return 'status' in source && 'data' in source && 'isFirstLoad' in source;\n}\n\n/**\n * A CDK `DataSource` that optionally integrates with `CngxSort`,\n * `CngxFilter`, `CngxSearch`, and `CngxPaginate` present in the injection\n * tree. Each directive is injected optionally - if absent, that processing\n * step is skipped.\n *\n * Injection resolves UPWARD only. Any atom hosted by a descendant component\n * - a `hostDirective` on an element below the consumer's injector - is\n * invisible to these injects, and the matching step is silently skipped:\n * the atom's own state still toggles (headers flip their arrows) while the\n * rows never move. `CngxDataGridAccordion` is the case where this is always\n * true: it hosts `CngxSort` and `CngxFilter` on the group element. Hand\n * such atoms in through the options thunks instead:\n *\n * ```typescript\n * readonly grid = viewChild(CngxDataGridAccordion);\n * readonly dataSource = injectSmartDataSource(this.rows, {\n * sort: () => this.grid()?.sort,\n * filter: () => this.grid()?.filter,\n * });\n * ```\n *\n * Accepts either a plain `Signal<T[]>` or a `CngxAsyncState<T[]>`.\n * When a `CngxAsyncState` is provided, the data source exposes the full\n * UX state (`isLoading`, `isRefreshing`, `error`, `isEmpty`) so the\n * table can show skeleton rows, error states, and loading indicators.\n *\n * ```typescript\n * // Plain signal\n * readonly dataSource = injectSmartDataSource(this.items);\n *\n * // With async state - full UX lifecycle\n * readonly residents = injectAsyncState(() => this.api.getAll(this.filter()));\n * readonly dataSource = injectSmartDataSource(this.residents);\n * // dataSource.isLoading(), dataSource.error(), dataSource.isRefreshing()\n * ```\n *\n * @typeParam T - The row item type.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/data-source/smart-data-source.ts\n * @since 0.3.0\n * @relatedTo CngxDataSource, CngxSort, CngxFilter, CngxPaginate\n * <example-url>/#/common/data/smart-data-source/auto-wired</example-url>\n * <example-url>/#/common/data/smart-data-source/how-it-works-hostdirectives-inject</example-url>\n * <example-url>/#/common/data/smart-data-source/smartdatasource-cngxpaginate-hostdirective</example-url>\n * <example-url>/#/ui/data-grid-accordion/smart-data-source-options-sort</example-url>\n */\nexport class CngxSmartDataSource<T> extends DataSource<T> {\n private readonly injector = inject(Injector);\n private readonly injectedSort = inject(CngxSort, { optional: true });\n private readonly injectedFilter = inject(CngxFilter, { optional: true });\n // Injection resolves upward only; an atom below this injector (child\n // <input> search, a hosting organism's sort/filter) arrives via the\n // matching options thunk instead.\n private readonly injectedSearch = inject(CngxSearch, { optional: true });\n private readonly injectedPaginate = inject(CngxPaginate, { optional: true });\n private readonly locale = injectLocale();\n\n /**\n * Items after filter and search are applied, before sort and pagination.\n * Use `filteredCount()` to get the pre-pagination count for paginator `total`.\n */\n private readonly filtered: Signal<T[]>;\n\n /** Number of items after filtering/searching, before pagination. */\n readonly filteredCount: Signal<number>;\n\n private readonly processed: Signal<T[]>;\n\n /**\n * The async state source, or `undefined` if constructed from a plain\n * signal. Internal-only - consumers read the derived projections\n * (`isLoading`, `isRefreshing`, `isBusy`, `isFirstLoad`, `error`,\n * `isEmpty`, `filteredCount`) instead of the raw source identity.\n */\n private readonly asyncState: CngxAsyncState<T[]> | undefined;\n\n /** `true` during initial data load (skeleton phase). */\n readonly isLoading: Signal<boolean>;\n\n /** `true` during refresh (data stays visible, loading bar). */\n readonly isRefreshing: Signal<boolean>;\n\n /** `true` when any operation is running. Maps to `aria-busy`. */\n readonly isBusy: Signal<boolean>;\n\n /** `true` if no successful load has completed yet. */\n readonly isFirstLoad: Signal<boolean>;\n\n /** Error from the async state, or `undefined`. */\n readonly error: Signal<unknown>;\n\n /** `true` when data is empty AND no operation is running. */\n readonly isEmpty: Signal<boolean>;\n\n constructor(\n source: Signal<T[]> | CngxAsyncState<T[]>,\n private readonly options?: CngxSmartDataSourceOptions<T>,\n ) {\n super();\n\n let data: Signal<T[]>;\n if (isAsyncState(source)) {\n this.asyncState = source;\n data = computed(() => source.data() ?? []);\n } else {\n this.asyncState = undefined;\n data = source;\n }\n\n const s = this.asyncState;\n this.isLoading = computed(() => s?.isLoading() ?? false);\n this.isRefreshing = computed(() => s?.isRefreshing() ?? false);\n this.isBusy = computed(() => s?.isBusy() ?? false);\n this.isFirstLoad = computed(() => s?.isFirstLoad() ?? false);\n this.error = computed(() => s?.error());\n\n this.filtered = computed(\n () => {\n // Resolve at read time: an options thunk pointing at a not-yet-mounted\n // viewChild returns undefined now and the instance on a later pass.\n const filter = this.options?.filter?.() ?? this.injectedFilter;\n const search = this.options?.search?.() ?? this.injectedSearch;\n const predicate = filter?.predicate();\n const term = search?.term();\n const searchFn = this.options?.searchFn ?? defaultSearchFnFor(this.locale());\n\n // Pipeline: raw → filter → search. Cast required: CngxFilter injected as unknown.\n return data()\n .filter((v) => !predicate || (predicate as (v: T) => boolean)(v))\n .filter((item) => !term || searchFn(item, term));\n },\n { equal: arrayEqual },\n );\n\n this.filteredCount = computed(() => this.filtered().length);\n\n this.isEmpty = computed(() => {\n // During loading, not \"empty\" yet - show skeleton instead\n if (this.isBusy()) {\n return false;\n }\n return this.filteredCount() === 0;\n });\n\n this.processed = computed(\n () => {\n const sort = this.options?.sort?.() ?? this.injectedSort;\n const sorts = sort?.sorts() ?? [];\n const sortFn = this.options?.sortFn ?? defaultSortFnFor<T>(this.locale());\n\n const sorted =\n sorts.length > 0\n ? [...this.filtered()].sort((a, b) =>\n sorts.reduce(\n (cmp, { active, direction }) => cmp || sortFn(a, b, active, direction),\n 0,\n ),\n )\n : this.filtered();\n\n const paginate = this.options?.paginate?.() ?? this.injectedPaginate;\n const range = paginate?.range();\n return range ? sorted.slice(range[0], range[1]) : sorted;\n },\n { equal: arrayEqual },\n );\n }\n\n /**\n * CDK `DataSource` contract, called by the CDK table when it attaches. Returns\n * an observable of `processed` (filtered, searched, sorted and paginated rows)\n * that emits each time it changes.\n */\n override connect(): Observable<T[]> {\n return toObservable(this.processed, { injector: this.injector });\n }\n\n /**\n * CDK `DataSource` contract, called by the CDK table when it detaches. No-op;\n * the `toObservable` subscription ends with the injector's `DestroyRef`.\n */\n override disconnect(): void {\n // Signal cleanup is handled by Angular's DestroyRef - no manual teardown needed.\n }\n}\n\n/**\n * Factory function for {@link CngxSmartDataSource}.\n *\n * Must be called within an injection context (constructor or field initializer).\n * Accepts either a plain `Signal<T[]>` or a `CngxAsyncState<T[]>` for\n * full UX state integration (loading, error, refresh, empty).\n *\n * ```typescript\n * // Plain signal\n * readonly dataSource = injectSmartDataSource(this.items);\n *\n * // With async state - table shows skeleton, error, loading bar\n * readonly residents = injectAsyncState(() => this.api.getAll());\n * readonly dataSource = injectSmartDataSource(this.residents);\n * ```\n * <example-url>/#/ui/data-grid-accordion/smart-data-source-options-sort</example-url>\n */\nexport function injectSmartDataSource<T>(\n source: Signal<T[]> | CngxAsyncState<T[]>,\n options?: CngxSmartDataSourceOptions<T>,\n): CngxSmartDataSource<T> {\n return new CngxSmartDataSource(source, options);\n}\n","import { computed, signal } from '@angular/core';\nimport {\n buildAsyncStateView,\n CNGX_DEV_DESCRIPTORS,\n type AsyncStatus,\n type CngxAsyncState,\n} from '@cngx/core/utils';\n\n/**\n * Writable extension of `CngxAsyncState` for manual control.\n *\n * Returned by `createManualState()` - provides imperative setters\n * while the read-side stays the standard `CngxAsyncState` interface.\n */\nexport interface ManualAsyncState<T> extends CngxAsyncState<T> {\n /** Set the status directly. */\n set(status: AsyncStatus): void;\n\n /** Transition to `success` with data. */\n setSuccess(data: T): void;\n\n /** Transition to `error`. */\n setError(error: unknown): void;\n\n /**\n * Transition to `idle` without dropping what the state already holds.\n *\n * Clears `error` and `progress`; keeps `data`, `lastUpdated` and the\n * first-load flag. Use it when an operation ends without changing\n * anything (a commit the action refused): nothing was replaced, so\n * nothing is dropped, and no `success` edge is published that a\n * feedback bridge would report. `reset()` is the full wipe.\n */\n setIdle(): void;\n\n /** Set progress (0–100). */\n setProgress(value: number | undefined): void;\n\n /**\n * Reset to `idle` and clear data, error, progress and `lastUpdated`.\n * `isFirstLoad()` reads `true` again.\n */\n reset(): void;\n}\n\n/**\n * Create a fully manual async state - no HTTP, no automatic loading.\n *\n * Use for local operations: heavy computations, Web Workers, complex local processes.\n * Does **not** require an injection context - uses only `signal()` and `computed()`.\n *\n * ```typescript\n * readonly processState = createManualState<ProcessResult>();\n *\n * async handleProcess(): Promise<void> {\n * this.processState.set('loading');\n * this.processState.setProgress(0);\n * const result = await heavyComputation((p) => this.processState.setProgress(p));\n * this.processState.setSuccess(result);\n * }\n * ```\n */\nexport function createManualState<T>(): ManualAsyncState<T> {\n const statusState = signal<AsyncStatus>('idle');\n const dataState = signal<T | undefined>(undefined);\n const errorState = signal<unknown>(undefined);\n const progressState = signal<number | undefined>(undefined);\n const lastUpdatedState = signal<Date | undefined>(undefined);\n const hadSuccess = signal(false);\n\n const view = buildAsyncStateView<T>({\n status: statusState.asReadonly(),\n data: dataState.asReadonly(),\n error: errorState.asReadonly(),\n progress: progressState.asReadonly(),\n isFirstLoad: computed(\n () => !hadSuccess(),\n typeof ngDevMode !== 'undefined' && ngDevMode\n ? { debugName: 'manualState.isFirstLoad' }\n : undefined,\n ),\n lastUpdated: lastUpdatedState.asReadonly(),\n });\n\n const state: ManualAsyncState<T> = {\n ...view,\n\n set(newStatus: AsyncStatus): void {\n statusState.set(newStatus);\n if (newStatus === 'success') {\n // Parity with setSuccess: a success transition must not leave stale\n // error/progress residue behind.\n errorState.set(undefined);\n progressState.set(undefined);\n hadSuccess.set(true);\n lastUpdatedState.set(new Date());\n }\n },\n\n setSuccess(value: T): void {\n dataState.set(value);\n errorState.set(undefined);\n progressState.set(undefined);\n hadSuccess.set(true);\n lastUpdatedState.set(new Date());\n statusState.set('success');\n },\n\n setError(err: unknown): void {\n errorState.set(err);\n progressState.set(undefined);\n statusState.set('error');\n },\n\n setIdle(): void {\n errorState.set(undefined);\n progressState.set(undefined);\n statusState.set('idle');\n },\n\n setProgress(value: number | undefined): void {\n progressState.set(value);\n },\n\n reset(): void {\n statusState.set('idle');\n dataState.set(undefined);\n errorState.set(undefined);\n progressState.set(undefined);\n lastUpdatedState.set(undefined);\n hadSuccess.set(false);\n },\n };\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n CNGX_DEV_DESCRIPTORS.tag(state, {\n kind: 'cngx-dev:factory',\n factory: 'createManualState',\n inputs: {},\n });\n }\n return state;\n}\n","import { computed, Injectable, signal, type Signal, untracked } from '@angular/core';\nimport { nextUid, type AsyncStatus, type CngxAsyncState } from '@cngx/core/utils';\n\n/** @internal One registered async operation: its display label and its state. */\ninterface AsyncOperationEntry {\n readonly label?: string;\n readonly state: CngxAsyncState<unknown>;\n}\n\n/**\n * Read-only snapshot of one registered async operation.\n */\nexport interface CngxAsyncOperation {\n /** Per-operation uid minted at registration (`register`'s return value). */\n readonly id: string;\n /** Human-readable label, if one was supplied. Display only, never a key. */\n readonly label?: string;\n /** The operation's current status. */\n readonly status: AsyncStatus;\n}\n\n/** @internal Length-then-key-set equality for the operations Map signal. */\nfunction mapKeySetEqual<K, V>(a: ReadonlyMap<K, V>, b: ReadonlyMap<K, V>): boolean {\n if (a === b) {\n return true;\n }\n if (a.size !== b.size) {\n return false;\n }\n for (const key of a.keys()) {\n if (!b.has(key)) {\n return false;\n }\n }\n return true;\n}\n\n/** @internal Element-wise equality on (id, label, status) for the view array. */\nfunction operationsEqual(\n a: readonly CngxAsyncOperation[],\n b: readonly CngxAsyncOperation[],\n): boolean {\n if (a === b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n const x = a[i];\n const y = b[i];\n if (x.id !== y.id || x.label !== y.label || x.status !== y.status) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Opt-in aggregation registry for in-flight async operations.\n *\n * A single derived source for \"is anything loading?\" across a whole app: the\n * shell binds one `isAnythingLoading()` instead of N hand-maintained flags.\n * Producers register their `CngxAsyncState` (via `injectAsyncState({ register:\n * true })`, the HTTP interceptor, or directly) and unregister on teardown.\n *\n * Not `providedIn: 'root'` - consumers opt in with {@link provideAsyncRegistry}.\n * When the registry is absent, producers skip registration entirely.\n *\n * **Keyed by a per-operation uid, not the human label.** Async operations are\n * transient and collide on label; uid identity keeps N concurrent same-label\n * (or unlabeled) operations independent, so one `unregister` evicts exactly\n * its own entry. This is the one deliberate divergence from `CngxErrorRegistry`\n * (which keys by a stable scope name).\n *\n * Both views are `computed()` only - no `effect`, no service calls. Inner\n * status reactivity flows through each entry's `CngxAsyncState` signals; the\n * Map signal's `mapKeySetEqual` short-circuits register/unregister churn\n * without hiding status changes.\n */\n@Injectable()\nexport class CngxAsyncRegistry {\n private readonly entriesState = signal<ReadonlyMap<string, AsyncOperationEntry>>(new Map(), {\n equal: mapKeySetEqual,\n });\n\n /**\n * `true` when at least one registered operation reports `isLoading()`\n * (`loading`, `pending`, or `refreshing`).\n */\n readonly isAnythingLoading: Signal<boolean> = computed(() => {\n for (const entry of this.entriesState().values()) {\n if (entry.state.isLoading()) {\n return true;\n }\n }\n return false;\n });\n\n /** Every registered operation with its current status, in registration order. */\n readonly activeOperations: Signal<readonly CngxAsyncOperation[]> = computed(\n () =>\n Array.from(this.entriesState(), ([id, entry]) => ({\n id,\n label: entry.label,\n status: entry.state.status(),\n })),\n { equal: operationsEqual },\n );\n\n /**\n * Registers an async state under a fresh per-operation uid and returns it.\n * The optional `label` is display metadata only - never the map key, so\n * concurrent same-label (or unlabeled) operations stay independent.\n */\n register(state: CngxAsyncState<unknown>, label?: string): string {\n const id = nextUid('cngx-async-op');\n // Untracked: a register() inside an effect must not subscribe it to the map it writes.\n const next = new Map(untracked(this.entriesState));\n next.set(id, { label, state });\n this.entriesState.set(next);\n return id;\n }\n\n /** Removes the operation with the given uid. No-op if absent. */\n unregister(id: string): void {\n const current = untracked(this.entriesState);\n if (!current.has(id)) {\n return;\n }\n const next = new Map(current);\n next.delete(id);\n this.entriesState.set(next);\n }\n}\n","import { type EnvironmentProviders, inject, makeEnvironmentProviders } from '@angular/core';\nimport { CngxAsyncRegistry } from './async-registry';\n\n/**\n * Provides {@link CngxAsyncRegistry} in the host environment.\n *\n * Opt-in - not `providedIn: 'root'`. Add it to `bootstrapApplication`\n * providers to enable app-wide async observability; producers that opt in\n * (`injectAsyncState({ register: true })`, `provideAsyncHttpObservability()`)\n * then surface in `isAnythingLoading()` / `activeOperations()`.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [provideAsyncRegistry()],\n * });\n * ```\n * <example-url>/#/common/data/async-registry/http-requests-in-the-registry</example-url>\n */\nexport function provideAsyncRegistry(): EnvironmentProviders {\n return makeEnvironmentProviders([CngxAsyncRegistry]);\n}\n\n/**\n * Returns the ambient {@link CngxAsyncRegistry}, or `null` when the consumer\n * did not opt in via {@link provideAsyncRegistry}. Must run in an injection\n * context.\n */\nexport function injectAsyncRegistry(): CngxAsyncRegistry | null {\n return inject(CngxAsyncRegistry, { optional: true });\n}\n","import { DestroyRef, inject } from '@angular/core';\nimport { CNGX_DEV_DESCRIPTORS, type CngxAsyncState } from '@cngx/core/utils';\nimport type { Observable } from 'rxjs';\nimport { settleAction, type SettleActionHandle } from '@cngx/utils/rxjs-interop';\n\nimport { createManualState, type ManualAsyncState } from './create-manual-state';\nimport { injectAsyncRegistry } from '../async-registry/provide-async-registry';\n\n/**\n * Configuration options for `createAsyncState`.\n */\nexport interface CreateAsyncStateOptions {\n /**\n * Human-readable label surfaced in `CngxAsyncRegistry.activeOperations`.\n * Display only - never the registry key. Ignored unless `register` is set.\n */\n label?: string;\n\n /**\n * When `true`, register this state in the ambient `CngxAsyncRegistry` (if\n * one is provided via `provideAsyncRegistry()`) for the injector's lifetime,\n * and unregister automatically on destroy. Defaults to `false` - a no-op for\n * existing callers, and a no-op when no registry is provided.\n */\n register?: boolean;\n}\n\n/**\n * Writable async state for mutations (POST/PUT/DELETE).\n *\n * Extends the read-only `CngxAsyncState` with an `execute()` method\n * that runs an async action and manages the full lifecycle.\n */\nexport interface MutableAsyncState<T> extends CngxAsyncState<T> {\n /**\n * Execute an async action.\n *\n * Sets status to `pending`, then `success` or `error` on completion. An\n * Observable that completes without a value settles `success` with\n * `undefined` data. Supersedes any in-flight execution. An Observable action is unsubscribed\n * on supersede, `reset()` and destroy, so an `HttpClient` request is\n * cancelled; a Promise action keeps running and its result is dropped. The\n * returned promise resolves when the run settles or is cancelled. After the\n * owner is destroyed, `execute()` resolves at once without calling `fn`.\n */\n execute(fn: () => Promise<T> | Observable<T>): Promise<void>;\n\n /** Report progress (0–100) during execution. */\n reportProgress(value: number): void;\n\n /** Reset to `idle`, clear data, error, and progress. */\n reset(): void;\n}\n\n/** The in-flight run of `execute()`: its settle handle and the resolver of its promise. */\ninterface ActiveRun {\n handle?: SettleActionHandle;\n readonly finish: () => void;\n}\n\n/**\n * Create a mutation async state - for explicit user-triggered actions.\n *\n * Must be called in an injection context (field initializer or constructor)\n * because it uses `inject(DestroyRef)` for cleanup.\n *\n * ```typescript\n * readonly saveResident = createAsyncState<Resident>();\n *\n * async handleSave(): Promise<void> {\n * await this.saveResident.execute(\n * () => this.api.save(this.form().value())\n * );\n * }\n * ```\n */\nexport function createAsyncState<T>(options?: CreateAsyncStateOptions): MutableAsyncState<T> {\n const destroyRef = inject(DestroyRef);\n const state: ManualAsyncState<T> = createManualState<T>();\n\n let active: ActiveRun | undefined;\n let destroyed = false;\n\n const cancelActive = (): void => {\n const run = active;\n active = undefined;\n run?.handle?.cancel();\n run?.finish();\n };\n\n destroyRef.onDestroy(() => {\n destroyed = true;\n cancelActive();\n });\n\n // Same opt-in observability injectAsyncState offers: without it, mutations\n // built here are invisible to CngxAsyncRegistry.isAnythingLoading.\n if (options?.register) {\n const registry = injectAsyncRegistry();\n if (registry) {\n const operationId = registry.register(state, options.label);\n destroyRef.onDestroy(() => registry.unregister(operationId));\n }\n }\n\n const mutation: MutableAsyncState<T> = {\n status: state.status,\n data: state.data,\n error: state.error,\n progress: state.progress,\n isLoading: state.isLoading,\n isPending: state.isPending,\n isRefreshing: state.isRefreshing,\n isBusy: state.isBusy,\n isFirstLoad: state.isFirstLoad,\n isEmpty: state.isEmpty,\n hasData: state.hasData,\n isSettled: state.isSettled,\n lastUpdated: state.lastUpdated,\n\n execute(fn: () => Promise<T> | Observable<T>): Promise<void> {\n if (destroyed) {\n return Promise.resolve();\n }\n cancelActive();\n\n state.set('pending');\n state.setProgress(undefined);\n\n return new Promise<void>((resolve) => {\n const run: ActiveRun = { finish: resolve };\n active = run;\n // A superseded, reset or destroyed run is no longer `active`; its\n // handle is cancelled, so these writes only reach the current run.\n const settle = (write: () => void): void => {\n if (active !== run) {\n return;\n }\n active = undefined;\n write();\n resolve();\n };\n run.handle = settleAction(fn, {\n onValue: (value) => settle(() => state.setSuccess(value)),\n onEmpty: () => settle(() => state.setSuccess(undefined as T)),\n onError: (err) => settle(() => state.setError(err)),\n });\n });\n },\n\n reportProgress(value: number): void {\n state.setProgress(value);\n },\n\n reset(): void {\n cancelActive();\n state.reset();\n },\n };\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n CNGX_DEV_DESCRIPTORS.tag(mutation, {\n kind: 'cngx-dev:factory',\n factory: 'createAsyncState',\n // The inner manual state carries its own tag; listing it here is the\n // only way an inspector reaches it, since the mutation exposes its\n // signals, not the state object.\n inputs: { options, state },\n });\n }\n return mutation;\n}\n","import { computed } from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\n/**\n * Wraps a *changing* source of async state in a stable\n * {@link CngxAsyncState} façade.\n *\n * A component that receives its state through an `Input` cannot publish that\n * object through `CNGX_STATEFUL` directly: the token is resolved once when a\n * bridge injects it, while the input can be rebound or absent. Capturing the\n * object would hand the bridge a stale state - or `undefined` before the\n * first binding.\n *\n * This returns one object whose every member is a `computed()` that reads the\n * source on each access, so bridges observe transitions of whatever is bound\n * right now. With nothing bound it reports a quiet `idle` state rather than\n * throwing, which is what lets a bridge sit inside a timeline that has not\n * been given a state yet: `status()` is `idle`, `isFirstLoad()` and\n * `isEmpty()` are true, which `resolveAsyncView` maps to `none`. Note the\n * difference to `buildAsyncStateView`, which defaults `isFirstLoad` to false\n * when a producer passes none.\n *\n * Contrast the select family, which provides `CNGX_STATEFUL` with\n * `useFactory` over a concrete `commitState` field - no forwarding needed\n * there, because the state is created by the component rather than passed in.\n * The split is not about the component, it is about where the state is born:\n * created locally, capture it; arriving through an `Input`, forward it.\n *\n * ```ts\n * readonly asyncState = createForwardedAsyncState(this.state);\n *\n * // providers:\n * { provide: CNGX_STATEFUL, useFactory: () => ({ state: inject(Host).asyncState }) }\n * ```\n *\n * @relatedTo createAsyncState, createManualState\n * @since 0.3.0\n * <example-url>/#/common/data/async-state/forwarded-state-through-an-input</example-url>\n */\nexport function createForwardedAsyncState<T>(\n source: () => CngxAsyncState<T> | undefined,\n): CngxAsyncState<T> {\n return {\n status: computed(() => source()?.status() ?? 'idle'),\n data: computed(() => source()?.data()),\n error: computed(() => source()?.error()),\n progress: computed(() => source()?.progress()),\n isLoading: computed(() => source()?.isLoading() ?? false),\n isPending: computed(() => source()?.isPending() ?? false),\n isRefreshing: computed(() => source()?.isRefreshing() ?? false),\n isBusy: computed(() => source()?.isBusy() ?? false),\n isFirstLoad: computed(() => source()?.isFirstLoad() ?? true),\n isEmpty: computed(() => source()?.isEmpty() ?? true),\n hasData: computed(() => source()?.hasData() ?? false),\n isSettled: computed(() => source()?.isSettled() ?? false),\n lastUpdated: computed(() => source()?.lastUpdated()),\n };\n}\n","import { DestroyRef, effect, inject, untracked } from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\nimport { isObservable, type Observable, type Subscription } from 'rxjs';\n\nimport { createManualState, type ManualAsyncState } from './create-manual-state';\nimport { injectAsyncRegistry } from '../async-registry/provide-async-registry';\n\n/**\n * Configuration options for `injectAsyncState`.\n */\nexport interface InjectAsyncStateOptions {\n /**\n * Debounce time in ms for signal dependency changes.\n * Coalesces rapid changes into one state transition and one consumed\n * result. Note: a promise-returning `fn` still runs once per change -\n * the invocation is what tracks its signals - but only the freshest\n * capture is consumed; superseded captures are observed and discarded.\n * Cold Observables cost nothing until subscribed, so for them the\n * debounce fully prevents request storms.\n * @default 50\n */\n debounce?: number;\n\n /**\n * Human-readable label surfaced in `CngxAsyncRegistry.activeOperations`.\n * Display only - never the registry key. Ignored unless `register` is set.\n */\n label?: string;\n\n /**\n * When `true`, register this state in the ambient `CngxAsyncRegistry` (if\n * one is provided via `provideAsyncRegistry()`) for the injector's lifetime,\n * and unregister automatically on destroy. Defaults to `false` - a no-op for\n * existing callers, and a no-op when no registry is provided.\n */\n register?: boolean;\n}\n\n/**\n * Reactive async state returned by `injectAsyncState`.\n *\n * Extends the read-only `CngxAsyncState` with a `refresh()` method\n * to explicitly re-trigger the query.\n */\nexport interface ReactiveAsyncState<T> extends CngxAsyncState<T> {\n /** Explicitly re-trigger the query. Does nothing after the owner is destroyed. */\n refresh(): void;\n}\n\n/**\n * Create a reactive async state that auto-loads when signal dependencies change.\n *\n * Must be called in an injection context (field initializer or constructor).\n * The computation function is tracked by Angular's `effect()` - any signal\n * read inside `fn` will cause a re-load when it changes.\n *\n * ```typescript\n * readonly residents = injectAsyncState(\n * () => this.api.getResidents(this.filter())\n * );\n * // Loads automatically when filter() changes.\n * // Caches last result during refresh (refreshing state).\n * // A newer run cancels the one in flight (an Observable is unsubscribed,\n * // a Promise result is dropped). Of several changes inside the debounce\n * // window (50 ms by default) only the last result is consumed.\n * ```\n */\nexport function injectAsyncState<T>(\n fn: () => Promise<T> | Observable<T>,\n options?: InjectAsyncStateOptions,\n): ReactiveAsyncState<T> {\n const destroyRef = inject(DestroyRef);\n const state: ManualAsyncState<T> = createManualState<T>();\n const debounceMs = options?.debounce ?? 50;\n\n let activeSubscription: Subscription | undefined;\n let abortController: AbortController | undefined;\n let debounceTimer: ReturnType<typeof setTimeout> | undefined;\n let destroyed = false;\n\n function cancelInFlight(): void {\n activeSubscription?.unsubscribe();\n activeSubscription = undefined;\n abortController?.abort();\n abortController = undefined;\n }\n\n destroyRef.onDestroy(() => {\n destroyed = true;\n cancelInFlight();\n if (debounceTimer !== undefined) {\n clearTimeout(debounceTimer);\n debounceTimer = undefined;\n }\n });\n\n // Opt-in observability: register with the ambient CngxAsyncRegistry (if any)\n // under a fresh per-operation uid, and unregister on destroy. No-op when the\n // caller did not opt in, or when no registry is provided.\n if (options?.register) {\n const registry = injectAsyncRegistry();\n if (registry) {\n const operationId = registry.register(state, options.label);\n destroyRef.onDestroy(() => registry.unregister(operationId));\n }\n }\n\n function executeQuery(computation: () => Promise<T> | Observable<T>): void {\n cancelInFlight();\n\n // first load -> loading, subsequent -> refreshing\n const status = untracked(state.isFirstLoad) ? 'loading' : 'refreshing';\n state.set(status);\n\n let result$: Promise<T> | Observable<T>;\n try {\n result$ = computation();\n } catch (err: unknown) {\n // Same outcome as a synchronous throw on the effect path.\n state.setError(err);\n return;\n }\n\n if (isObservable(result$)) {\n let hasEmitted = false;\n activeSubscription = result$.subscribe({\n next: (value) => {\n hasEmitted = true;\n state.setSuccess(value);\n },\n error: (err: unknown) => state.setError(err),\n complete: () => {\n if (!hasEmitted) {\n // completed without emitting -> empty success\n state.setSuccess(undefined as T);\n }\n },\n });\n } else {\n const controller = new AbortController();\n abortController = controller;\n\n result$\n .then(\n (value) => {\n if (!controller.signal.aborted) {\n state.setSuccess(value);\n }\n },\n (err: unknown) => {\n if (!controller.signal.aborted) {\n state.setError(err);\n }\n },\n )\n .finally(() => {\n if (abortController === controller) {\n abortController = undefined;\n }\n });\n }\n }\n\n // fn() runs once per cycle; signals read inside it track via effect.\n // Result is captured and run after debounce.\n effect(() => {\n let result: Promise<T> | Observable<T>;\n try {\n result = fn();\n } catch (err: unknown) {\n // sync throw (e.g. required signal not yet set) - debounce the error\n // to match the async path\n if (debounceTimer !== undefined) {\n clearTimeout(debounceTimer);\n }\n debounceTimer = setTimeout(() => {\n debounceTimer = undefined;\n state.setError(err);\n }, debounceMs);\n return;\n }\n\n if (debounceTimer !== undefined) {\n clearTimeout(debounceTimer);\n }\n\n const captured = result;\n if (!isObservable(captured)) {\n // The promise's work is already running (the invocation is the\n // tracking probe). A rapid follow-up change supersedes this capture\n // before the timer consumes it - observe the rejection here so a\n // superseded failure never surfaces as an unhandled rejection.\n captured.then(undefined, () => undefined);\n }\n debounceTimer = setTimeout(() => {\n debounceTimer = undefined;\n void executeQuery(() => captured);\n }, debounceMs);\n });\n\n return {\n status: state.status,\n data: state.data,\n error: state.error,\n progress: state.progress,\n isLoading: state.isLoading,\n isPending: state.isPending,\n isRefreshing: state.isRefreshing,\n isBusy: state.isBusy,\n isFirstLoad: state.isFirstLoad,\n isEmpty: state.isEmpty,\n hasData: state.hasData,\n isSettled: state.isSettled,\n lastUpdated: state.lastUpdated,\n\n refresh(): void {\n if (destroyed) {\n return;\n }\n if (debounceTimer !== undefined) {\n clearTimeout(debounceTimer);\n debounceTimer = undefined;\n }\n void executeQuery(fn);\n },\n };\n}\n","import type { AsyncStatus } from '@cngx/core/utils';\n\n/**\n * Possible view states for async content rendering.\n */\nexport type AsyncView = 'none' | 'skeleton' | 'content' | 'empty' | 'error' | 'content+error';\n\n/**\n * Pure function that resolves which view to show based on async state.\n *\n * Encodes the state machine as a lookup table - no branching:\n *\n * | status | firstLoad | empty | view |\n * |-------------|-----------|-------|---------------|\n * | idle | true | * | none |\n * | loading | true | * | skeleton |\n * | refreshing | true | * | skeleton |\n * | pending | true | * | skeleton |\n * | error | true | * | error |\n * | success | * | true | empty |\n * | error | false | * | content+error |\n * | (all other) | * | * | content |\n */\nexport function resolveAsyncView(\n status: AsyncStatus,\n firstLoad: boolean,\n empty: boolean,\n): AsyncView {\n if (firstLoad) {\n switch (status) {\n case 'idle':\n return 'none';\n case 'loading':\n case 'refreshing':\n case 'pending':\n return 'skeleton';\n case 'error':\n return 'error';\n }\n }\n\n if (status === 'success' && empty) {\n return 'empty';\n }\n\n if (status === 'error') {\n return 'content+error';\n }\n\n return 'content';\n}\n","import { computed, Directive, input } from '@angular/core';\nimport {\n CNGX_STATEFUL,\n createAggregateAsyncState,\n type CngxAsyncState,\n type CngxStateful,\n} from '@cngx/core/utils';\n\n/**\n * One keyed upstream source feeding a {@link CngxAsyncBoundary}.\n *\n * The `key` (and optional `label`) travel with the state so per-source\n * attribution never relies on a parallel index array (Pillar 1).\n *\n * @since 0.3.0\n */\nexport interface AggregateSource<T = unknown> {\n /** Stable identity for this source, used to key attribution and `@for`. */\n readonly key: string;\n /** Human-readable label for the source, surfaced in the failures list. */\n readonly label?: string;\n /** The upstream state this source contributes to the aggregate. */\n readonly state: CngxAsyncState<T>;\n}\n\n/**\n * One errored source, surfaced by {@link CngxAsyncBoundary.failures}.\n *\n * @since 0.3.0\n */\nexport interface AggregateFailure {\n /** The failing source's key. */\n readonly key: string;\n /** The failing source's label, if it declared one. */\n readonly label?: string;\n /** The raw error from that source. */\n readonly error: unknown;\n}\n\n/**\n * Headless boundary that aggregates N keyed `CngxAsyncState`s into one derived\n * `CngxAsyncState` and provides it as `CNGX_STATEFUL`.\n *\n * The aggregate `state` is a first-class `CngxAsyncState`, so it renders\n * through `<cngx-async-container [state]=\"b.state\">` and every other consumer\n * unchanged, and any transition bridge (`cngxToastOn`, `cngxAlertOn`,\n * `cngxBannerOn`) nested in the host fires on the combined status with zero\n * `[state]` wiring. `failures` exposes the errored sources - keyed, so a\n * consumer's `@for` can render per-source attribution through any feedback\n * component. `state.error` stays the first error for the single-error path.\n * The errors are `unknown`; `messageOf` below is a component helper that\n * reads a `message` property, so an `HttpErrorResponse` does not print as\n * `[object Object]`.\n *\n * ```html\n * <div [cngxAsyncBoundary]=\"sources\" #b=\"cngxAsyncBoundary\"\n * cngxToastOn [toastError]=\"'Loading failed'\">\n * <cngx-async-container [state]=\"b.state\"> ... </cngx-async-container>\n * @for (f of b.failures(); track f.key) {\n * <cngx-alert severity=\"error\" [title]=\"f.label ?? f.key\">{{ messageOf(f.error) }}</cngx-alert>\n * }\n * </div>\n * ```\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async-state/async-boundary.directive.ts\n * @since 0.3.0\n * <example-url>/#/ui/feedback/async-container/async-boundary-bridges-aggregate-vs-per-source</example-url>\n * <example-url>/#/ui/feedback/async-container/async-boundary-per-source-errors-surface</example-url>\n * <example-url>/#/common/data/async-boundary/all-settled-renders-content</example-url>\n * <example-url>/#/common/data/async-boundary/any-loading-shows-skeleton</example-url>\n * @axis level molecule\n */\n@Directive({\n selector: '[cngxAsyncBoundary]',\n standalone: true,\n exportAs: 'cngxAsyncBoundary',\n providers: [{ provide: CNGX_STATEFUL, useExisting: CngxAsyncBoundary }],\n host: {\n '[attr.aria-busy]': 'state.isBusy() || null',\n },\n})\nexport class CngxAsyncBoundary implements CngxStateful<readonly unknown[]> {\n /** The keyed source list to aggregate. */\n readonly sources = input.required<readonly AggregateSource[]>({ alias: 'cngxAsyncBoundary' });\n\n private readonly states = computed(() => this.sources().map((s) => s.state), {\n equal: (a, b) => a.length === b.length && a.every((s, i) => s === b[i]),\n });\n\n /** The derived aggregate state - also exposed via `CNGX_STATEFUL`. */\n readonly state = createAggregateAsyncState(this.states);\n\n /** The errored sources, keyed for per-source attribution. */\n readonly failures = computed<readonly AggregateFailure[]>(\n () =>\n this.sources()\n .filter((s) => s.state.status() === 'error')\n .map((s) => ({ key: s.key, label: s.label, error: s.state.error() })),\n {\n equal: (a, b) =>\n a.length === b.length &&\n a.every(\n (f, i) => f.key === b[i].key && f.label === b[i].label && Object.is(f.error, b[i].error),\n ),\n },\n );\n}\n","import type { ResourceStatus } from '@angular/core';\n\n/**\n * One observed reading of a `Resource`, the input of `nextResourceLatch`.\n *\n * @internal\n */\nexport interface ResourceLatchSource<T> {\n readonly status: ResourceStatus;\n readonly hasValue: boolean;\n readonly value: T | undefined;\n readonly error: unknown;\n}\n\n/**\n * The last good value of the current request chain. `has` is false before the\n * first load of a request; `at` is the time of the last successful load of the\n * bridge and survives a cleared latch.\n *\n * @internal\n */\nexport interface ResourceLatch<T> {\n readonly has: boolean;\n readonly value: T | undefined;\n readonly at: Date | undefined;\n}\n\n/** @internal */\nexport interface ResourceLatchPrevious<T> {\n readonly source: ResourceLatchSource<T>;\n readonly value: ResourceLatch<T>;\n}\n\n/**\n * Pure latch reducer behind `buildResourceBridge`. `previous` is the last\n * reading somebody observed, not the last state that existed (the latch lives\n * in a lazy `linkedSignal`), so the latch is carried into `error` or a\n * value-less `reloading` only along a chain that proves the same request; every\n * ambiguous step clears it, which degrades to the error view, never to stale\n * data.\n *\n * @internal\n */\nexport function nextResourceLatch<T>(\n source: ResourceLatchSource<T>,\n previous: ResourceLatchPrevious<T> | undefined,\n now: Date,\n): ResourceLatch<T> {\n const at = previous?.value.at;\n const cleared: ResourceLatch<T> = { has: false, value: undefined, at };\n\n switch (source.status) {\n case 'resolved':\n case 'local':\n return { has: true, value: source.value, at: now };\n case 'idle':\n case 'loading':\n return cleared;\n case 'reloading': {\n if (source.hasValue) {\n return { has: true, value: source.value, at: at ?? now };\n }\n // Angular keeps the failed stream through a reload of the same request,\n // so an unchanged error object proves the chain.\n const sameFailedRequest =\n previous?.source.status === 'error' && previous.source.error === source.error;\n return sameFailedRequest ? previous.value : cleared;\n }\n case 'error':\n return previous?.source.status === 'reloading' ? previous.value : cleared;\n }\n}\n\n/** @internal */\nexport function resourceLatchEqual<T>(a: ResourceLatch<T>, b: ResourceLatch<T>): boolean {\n return a.has === b.has && Object.is(a.value, b.value) && a.at?.getTime() === b.at?.getTime();\n}\n\n/** @internal */\nexport function resourceLatchSourceEqual<T>(\n a: ResourceLatchSource<T>,\n b: ResourceLatchSource<T>,\n): boolean {\n return (\n a.status === b.status &&\n a.hasValue === b.hasValue &&\n Object.is(a.value, b.value) &&\n Object.is(a.error, b.error)\n );\n}\n","import { computed, effect, linkedSignal, type Resource, type Signal } from '@angular/core';\nimport { type AsyncStatus, buildAsyncStateView, type CngxAsyncState } from '@cngx/core/utils';\n\nimport {\n nextResourceLatch,\n resourceLatchEqual,\n resourceLatchSourceEqual,\n type ResourceLatch,\n type ResourceLatchSource,\n} from './resource-latch';\n\n/**\n * Shared projection core for the two resource bridges (`fromResource`,\n * `fromHttpResource`). Derives every flag through `buildAsyncStateView`, so\n * the family semantics (`isLoading` includes pending/refreshing,\n * `isBusy === isLoading`) cannot drift between the bridges and the factories.\n *\n * \"First load\" is per request identity: a failed reload of the same request\n * keeps the last good value, a params change or `idle` starts over. The latch\n * is a `linkedSignal` over the pure `nextResourceLatch` reducer.\n *\n * A read-only effect keeps the latch observed while no view reads the state\n * (a hidden template), so a params change that fails there is not mistaken for\n * a failed reload of the old request. Probed in jsdom only; not probed: real\n * browser schedulers and a loader that synchronously returns a resolved value.\n *\n * @internal\n */\nexport function buildResourceBridge<T>(\n ref: Resource<T>,\n progress?: Signal<number | undefined>,\n): CngxAsyncState<T> {\n // Angular throws from value() in error, so the value is read only behind hasValue().\n const source = computed(\n (): ResourceLatchSource<T> => {\n const hasValue = ref.hasValue();\n return {\n status: ref.status(),\n hasValue,\n value: hasValue ? ref.value() : undefined,\n error: ref.error(),\n };\n },\n { equal: resourceLatchSourceEqual },\n );\n\n // ResourceStatus has no \"first load\" concept; the latch holds the last good\n // value of the current request chain with its timestamp.\n const latch = linkedSignal<ResourceLatchSource<T>, ResourceLatch<T>>({\n source,\n computation: (current, previous) => nextResourceLatch(current, previous, new Date()),\n equal: resourceLatchEqual,\n });\n\n // Read-only keep-alive: reads the latch, never writes a signal.\n effect(() => {\n latch();\n });\n\n // Every signal the bridge hands out reads the latch first, so a consumer of\n // any of them (status, isLoading, error, data, ...) keeps the request chain\n // observed; a template that gates on status alone would otherwise skip the\n // steps the reducer needs to tell a reload from a params change.\n const status = computed((): AsyncStatus => {\n latch();\n switch (ref.status()) {\n case 'idle':\n return 'idle';\n case 'loading':\n return 'loading';\n case 'reloading':\n return 'refreshing';\n case 'resolved':\n case 'local':\n return 'success';\n case 'error':\n return 'error';\n }\n });\n\n return buildAsyncStateView<T>({\n status,\n data: computed(() => {\n const last = latch();\n return ref.hasValue() ? ref.value() : last.value;\n }),\n error: computed(() => {\n latch();\n return ref.error();\n }),\n progress: progress\n ? computed(() => {\n latch();\n return progress();\n })\n : undefined,\n // Idle and a new request count as \"before the first load\", never as empty.\n isFirstLoad: computed(() => !latch().has),\n // Stamped inside the lazy latch computation: the time of the first read\n // after a successful load, not of the load itself.\n lastUpdated: computed(() => latch().at, {\n equal: (a, b) => a?.getTime() === b?.getTime(),\n }),\n });\n}\n","import { type Resource } from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\nimport { buildResourceBridge } from './resource-bridge';\n\n/**\n * Bridge that projects an Angular `Resource<T>` onto `CngxAsyncState<T>`.\n *\n * Must be called in an injection context.\n *\n * All signals are derived reactively from the resource - no manual\n * synchronization. The resource stays the single source of truth.\n *\n * \"First load\" is per request: a failed reload keeps the last good value, a\n * params change or `idle` starts over with no data and `isFirstLoad()` true.\n *\n * ```typescript\n * private readonly res = resource({\n * params: () => ({ filter: this.filter() }),\n * loader: ({ params, abortSignal }) =>\n * fetch(`/api/items?q=${params.filter}`, { signal: abortSignal })\n * .then(r => r.json()),\n * });\n *\n * readonly items = fromResource(this.res);\n * // items.status(), items.data(), items.isFirstLoad() - all work\n * // <cngx-async-container [state]=\"items\"> - direct binding\n * ```\n */\nexport function fromResource<T>(ref: Resource<T>): CngxAsyncState<T> {\n return buildResourceBridge(ref);\n}\n","import { clamp } from '@cngx/utils';\n\n/**\n * Loaded and total bytes as an integer percent from 0 to 100, or `undefined`\n * without a positive total (indeterminate progress).\n *\n * @internal\n */\nexport function progressPercent(loaded: number, total: number | null | undefined): number | undefined {\n if (total == null || total <= 0) {\n return undefined;\n }\n return clamp(Math.round((100 * loaded) / total), 0, 100);\n}\n","import { computed, type Resource } from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\nimport { progressPercent } from './progress-percent';\nimport { buildResourceBridge } from './resource-bridge';\n\n/**\n * Structural subset of Angular's `HttpProgressEvent` - the byte counts the\n * bridge reads. `total` is absent when the server sends no length.\n */\ninterface HttpProgressLike {\n readonly loaded: number;\n readonly total?: number;\n}\n\n/**\n * Shape of an `HttpResourceRef` - only the signals we need.\n *\n * Declared here to avoid a hard dependency on `@angular/common/http`.\n * The consumer passes the actual `httpResource()` return value, whose\n * `progress` signal carries the latest `HttpProgressEvent`.\n */\ninterface HttpResourceLike<T> extends Resource<T> {\n progress: () => HttpProgressLike | undefined;\n}\n\n/**\n * Bridge that projects an Angular `httpResource()` ref onto `CngxAsyncState<T>`.\n *\n * Identical to `fromResource` but additionally maps the HTTP progress\n * signal to `CngxAsyncState.progress` (0-100 scale): `loaded / total`,\n * rounded and clamped. With an unknown or zero `total` the progress is\n * `undefined` (indeterminate). Angular only emits progress events when the\n * request sets `reportProgress: true`.\n *\n * Must be called in an injection context.\n *\n * ```typescript\n * private readonly res = httpResource<Item[]>(() => ({\n * url: '/api/items',\n * params: { q: this.filter() },\n * reportProgress: true,\n * }));\n *\n * readonly items = fromHttpResource(this.res);\n * // items.progress() tracks download progress 0-100\n * // <cngx-progress [state]=\"items\"> - auto-wired progress bar\n * ```\n */\nexport function fromHttpResource<T>(ref: HttpResourceLike<T>): CngxAsyncState<T> {\n // No event or no total = indeterminate.\n const progress = computed(() => {\n const event = ref.progress();\n return event ? progressPercent(event.loaded, event.total) : undefined;\n });\n\n return buildResourceBridge(ref, progress);\n}\n","import {\n type MonoTypeOperatorFunction,\n type Observable,\n type OperatorFunction,\n defer,\n filter,\n finalize,\n map,\n tap,\n} from 'rxjs';\n\nimport { CngxRuntimeError } from '@cngx/utils';\n\nimport { progressPercent } from './progress-percent';\n\n/**\n * Minimal write interface for async state operators.\n *\n * Any `ManualAsyncState<T>` satisfies this - operators only need the write side.\n */\ninterface AsyncStateSink<T> {\n set(status: 'idle' | 'loading' | 'refreshing' | 'pending'): void;\n setSuccess(data: T): void;\n setError(error: unknown): void;\n setProgress(value: number | undefined): void;\n /**\n * Optional read side: when present, `tapAsyncState` picks `refreshing`\n * over `loading` for a re-subscribe after data has already landed.\n * Any `ManualAsyncState<T>` provides it.\n */\n isFirstLoad?: () => boolean;\n}\n\n/**\n * RxJS operator that wires an Observable's lifecycle to a `ManualAsyncState`.\n *\n * On subscribe: sets `loading` (or `refreshing` if data was already loaded,\n * read via the sink's `isFirstLoad`; an explicit `options.status` wins).\n * On next: calls `setSuccess(value)`.\n * On error: calls `setError(err)` and **re-throws** (does not swallow).\n * On complete without a value: calls `setSuccess(undefined)`.\n * On unsubscribe before any value: resets the sink to `idle` so a cancelled\n * request never leaves it busy.\n *\n * The Observable passes through unchanged - `tapAsyncState` is a side-effect operator.\n *\n * ```typescript\n * readonly residents = createManualState<Resident[]>();\n *\n * load(): void {\n * this.http.get<Resident[]>('/api/residents').pipe(\n * tapAsyncState(this.residents),\n * takeUntilDestroyed(this.destroyRef),\n * ).subscribe();\n * }\n * ```\n */\nexport function tapAsyncState<T>(\n state: AsyncStateSink<T>,\n options?: { status?: 'loading' | 'refreshing' | 'pending' },\n): MonoTypeOperatorFunction<T> {\n return (source: Observable<T>) =>\n defer(() => {\n state.set(options?.status ?? (state.isFirstLoad?.() === false ? 'refreshing' : 'loading'));\n let settled = false;\n return source.pipe(\n tap({\n next: (value) => {\n settled = true;\n state.setSuccess(value);\n },\n error: (err: unknown) => {\n settled = true;\n state.setError(err);\n },\n complete: () => {\n if (!settled) {\n settled = true;\n state.setSuccess(undefined as T);\n }\n },\n }),\n finalize(() => {\n // Torn down without ever settling (cancelled mid-flight) - do not\n // leave the sink busy forever.\n if (!settled) {\n state.set('idle');\n }\n }),\n );\n });\n}\n\n/**\n * Shape of an Angular `HttpProgressEvent` - declared structurally to\n * avoid a hard import on `@angular/common/http` from this entry point.\n */\ninterface HttpProgressLike {\n type: number; // HttpEventType.UploadProgress = 1, DownloadProgress = 3\n loaded: number;\n total?: number;\n}\n\n/**\n * Shape of an Angular `HttpResponse` - declared structurally.\n */\ninterface HttpResponseLike<T> {\n type: number; // HttpEventType.Response = 4\n body: T | null;\n}\n\n// HttpEventType values (from @angular/common/http)\nconst UPLOAD_PROGRESS = 1;\nconst DOWNLOAD_PROGRESS = 3;\nconst RESPONSE = 4;\n\n/**\n * RxJS operator that extracts upload/download progress from an\n * `HttpEvent` stream and reports it to a `ManualAsyncState`.\n *\n * Filters progress events, calculates an integer percentage clamped to\n * 0-100, calls `setProgress()`.\n * Non-progress events pass through unchanged.\n *\n * Use with `{ observe: 'events', reportProgress: true }` on HttpClient.\n *\n * ```typescript\n * readonly upload = createManualState<UploadResult>();\n *\n * handleUpload(file: File): void {\n * this.http.post('/api/upload', file, {\n * reportProgress: true,\n * observe: 'events',\n * }).pipe(\n * tapAsyncProgress(this.upload),\n * takeUntilDestroyed(this.destroyRef),\n * ).subscribe();\n * }\n * ```\n * <example-url>/#/common/data/async-operators/tap-async-progress</example-url>\n */\nexport function tapAsyncProgress<E>(\n state: Pick<AsyncStateSink<unknown>, 'setProgress'>,\n): MonoTypeOperatorFunction<E> {\n return tap((event) => {\n const e = event as unknown as HttpProgressLike;\n if (e.type !== UPLOAD_PROGRESS && e.type !== DOWNLOAD_PROGRESS) {\n return;\n }\n const percent = progressPercent(e.loaded, e.total);\n if (percent !== undefined) {\n state.setProgress(percent);\n }\n });\n}\n\n/**\n * RxJS operator that combines `tapAsyncState` + `tapAsyncProgress` for HTTP event streams.\n *\n * Pipe this onto an `HttpClient` call with `{ observe: 'events', reportProgress: true }`.\n * It will:\n * 1. Set `loading` on subscribe\n * 2. Report upload/download progress via `setProgress()`\n * 3. Extract the response body on `HttpEventType.Response`\n * 4. Call `setSuccess(body)` with the extracted body\n * 5. Call `setError(err)` on error\n *\n * The output Observable emits the **response body** (not HttpEvents).\n * Throws a `CngxRuntimeError` with code [`CNGX1054`](/error-codes/cngx1054.md) if the response body is\n * `null`; the sink receives it through `setError(err)`.\n *\n * ```typescript\n * readonly upload = createManualState<UploadResult>();\n *\n * handleUpload(file: File): void {\n * this.http.post('/api/upload', file, {\n * reportProgress: true,\n * observe: 'events',\n * }).pipe(\n * tapHttpAsyncState(this.upload),\n * takeUntilDestroyed(this.destroyRef),\n * ).subscribe();\n * // upload.status(), upload.progress(), upload.data() - all wired\n * }\n * ```\n * <example-url>/#/common/data/async-operators/tap-http-async-state</example-url>\n */\nexport function tapHttpAsyncState<T>(\n state: AsyncStateSink<T>,\n options?: { status?: 'loading' | 'refreshing' | 'pending' },\n): OperatorFunction<unknown, T> {\n return (source: Observable<unknown>) =>\n defer(() => {\n state.set(options?.status ?? 'loading');\n let settled = false;\n return source.pipe(\n tapAsyncProgress<unknown>(state),\n filter((event): event is HttpResponseLike<T> => {\n return (event as HttpResponseLike<T>).type === RESPONSE;\n }),\n map((response) => {\n if (response.body == null) {\n throw new CngxRuntimeError(\n 'CNGX1054',\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n 'tapHttpAsyncState(): response body is null',\n );\n }\n return response.body;\n }),\n tap({\n next: (value) => {\n settled = true;\n state.setSuccess(value);\n },\n error: (err: unknown) => {\n settled = true;\n state.setError(err);\n },\n }),\n finalize(() => {\n if (!settled) {\n state.set('idle');\n }\n }),\n );\n });\n}\n","import { createLatencyProbe, type CngxLatencyProbe } from '@cngx/core/utils';\nimport { injectAsyncRegistry } from './provide-async-registry';\n\n/**\n * Bridges {@link CngxAsyncRegistry} into a {@link CngxLatencyProbe} measuring the\n * registry's observed busy-envelope: how long the app was \"anything loading\"\n * during the last in-flight window.\n *\n * An app-shell indicator compares `lastDuration()` against\n * `CNGX_LOADING_CONFIG.spinnerVsSkeletonCutoff` to pick a spinner (fast last\n * aggregate) vs a skeleton (slow last aggregate) before the next load renders.\n *\n * When the registry is absent (`provideAsyncRegistry` never called),\n * `injectAsyncRegistry()` returns `null`, so the probe's source is permanently\n * `false`: it is never busy and never throws.\n *\n * Must run in an injection context.\n *\n * @returns A probe over `CngxAsyncRegistry.isAnythingLoading`.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async-registry/inject-latency-probe.ts\n * @since 0.3.0\n * @relatedTo provideAsyncRegistry, injectAsyncRegistry, createLatencyProbe\n */\nexport function injectLatencyProbe(): CngxLatencyProbe {\n const registry = injectAsyncRegistry();\n return createLatencyProbe(() => registry?.isAnythingLoading() ?? false);\n}\n","import { HttpContext, HttpContextToken } from '@angular/common/http';\n\n/**\n * Per-request label surfaced in `CngxAsyncRegistry.activeOperations` when the\n * request is tracked by `cngxAsyncInterceptor`. Display only, never a key.\n */\nexport const CNGX_ASYNC_LABEL = new HttpContextToken<string | undefined>(() => undefined);\n\n/**\n * Per-request opt-out. When `true`, `cngxAsyncInterceptor` passes the request\n * through without registering it - keeps polling / telemetry pings out of the\n * aggregate without a global allow-list.\n */\nexport const CNGX_ASYNC_SKIP = new HttpContextToken<boolean>(() => false);\n\n/**\n * Returns an `HttpContext` that labels the request for async observability.\n * Pass an existing context to chain with other tokens.\n *\n * ```typescript\n * this.http.get('/api/users', { context: withAsyncLabel('users') });\n * ```\n * <example-url>/#/common/data/async-registry/label-and-skip-requests</example-url>\n */\nexport function withAsyncLabel(label: string, context: HttpContext = new HttpContext()): HttpContext {\n return context.set(CNGX_ASYNC_LABEL, label);\n}\n\n/**\n * Returns an `HttpContext` that opts the request out of async observability.\n * Pass an existing context to chain with other tokens.\n *\n * ```typescript\n * this.http.get('/api/ping', { context: withAsyncSkip() });\n * ```\n * <example-url>/#/common/data/async-registry/label-and-skip-requests</example-url>\n */\nexport function withAsyncSkip(context: HttpContext = new HttpContext()): HttpContext {\n return context.set(CNGX_ASYNC_SKIP, true);\n}\n","import { type EnvironmentProviders, inject, makeEnvironmentProviders } from '@angular/core';\nimport {\n HttpEventType,\n type HttpInterceptorFn,\n provideHttpClient,\n withInterceptors,\n} from '@angular/common/http';\nimport { defer, finalize, tap } from 'rxjs';\nimport { createManualState } from '../async-state/create-manual-state';\nimport { CngxAsyncRegistry } from './async-registry';\nimport { CNGX_ASYNC_LABEL, CNGX_ASYNC_SKIP } from './http-context';\n\n/**\n * Functional HTTP interceptor that surfaces every in-flight `HttpRequest` in\n * the ambient {@link CngxAsyncRegistry}, so `isAnythingLoading()` aggregates\n * raw HTTP traffic alongside explicit component states.\n *\n * Fully opt-in and self-contained:\n * - Resolves `inject(CngxAsyncRegistry, { optional: true })` and passes the\n * request straight through when no registry is provided - zero behaviour\n * change for consumers who do not opt in.\n * - Passes through without registering when `CNGX_ASYNC_SKIP` is set.\n * - Otherwise registers a fresh `createManualState` (set `loading`) per\n * subscription, under its own uid, maps the final response / error onto it,\n * and `unregister`s in a `finalize` that fires on success **and** error (and\n * on unsubscribe). Every retry attempt is tracked for exactly its own\n * lifetime, and a request nobody subscribes to is never registered.\n *\n * Per-request uid identity (from `CngxAsyncRegistry`) means concurrent requests\n * sharing a label never evict one another - completing one leaves the other\n * tracked. The interceptor does not swallow errors: `setError` records the\n * failure, then the error propagates to the caller unchanged.\n * <example-url>/#/common/data/async-registry/http-requests-in-the-registry</example-url>\n */\nexport const cngxAsyncInterceptor: HttpInterceptorFn = (req, next) => {\n const registry = inject(CngxAsyncRegistry, { optional: true });\n if (!registry || req.context.get(CNGX_ASYNC_SKIP)) {\n return next(req);\n }\n\n return defer(() => {\n const state = createManualState<unknown>();\n state.set('loading');\n const operationId = registry.register(state, req.context.get(CNGX_ASYNC_LABEL));\n\n return next(req).pipe(\n tap({\n next: (event) => {\n if (event.type === HttpEventType.Response) {\n state.setSuccess(event.body);\n }\n },\n error: (err: unknown) => state.setError(err),\n }),\n finalize(() => registry.unregister(operationId)),\n );\n });\n};\n\n/**\n * Sets up `HttpClient` with {@link cngxAsyncInterceptor} so every request\n * surfaces in {@link CngxAsyncRegistry}. Opt-in - add it to\n * `bootstrapApplication` providers alongside `provideAsyncRegistry()`.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideAsyncRegistry(),\n * provideAsyncHttpObservability(),\n * ],\n * });\n * ```\n *\n * **Use this only when cngx owns the `HttpClient` setup.** It calls\n * `provideHttpClient(withInterceptors([cngxAsyncInterceptor]))` internally, so\n * an app that already calls `provideHttpClient` (especially with `withFetch()`\n * or other features) would get a second, feature-less `HttpClient`\n * configuration - last-provider-wins on `HttpBackend` can silently revert\n * `withFetch()` to the XHR backend. In that case do not call this; add the\n * exported {@link cngxAsyncInterceptor} to your own `withInterceptors` instead:\n *\n * ```ts\n * provideHttpClient(withFetch(), withInterceptors([authInterceptor, cngxAsyncInterceptor]))\n * ```\n */\nexport function provideAsyncHttpObservability(): EnvironmentProviders {\n return makeEnvironmentProviders([provideHttpClient(withInterceptors([cngxAsyncInterceptor]))]);\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n afterNextRender,\n computed,\n Directive,\n effect,\n type EmbeddedViewRef,\n inject,\n Injector,\n input,\n TemplateRef,\n untracked,\n ViewContainerRef,\n} from '@angular/core';\nimport { CNGX_FOCUSABLE_SELECTOR } from '@cngx/common/a11y';\nimport type { CngxAsyncState } from '@cngx/core/utils';\n\nimport { resolveAsyncView, type AsyncView } from '../async-state/resolve-view';\n\n/**\n * Template context for the `*cngxAsync` content template.\n * `$implicit` provides the data value, typed via `ngTemplateContextGuard`.\n *\n * Typed as `T` for template ergonomics, but the content view receives the\n * state's `data()` as is: a producer whose data goes `undefined` while it stays\n * in the content view (e.g. `refreshing` after a cleared value) passes\n * `undefined` through. Guard with `@if` / `?.` when the producer can do that.\n */\nexport interface CngxAsyncContext<T> {\n /** The data value - bound via `let data` in microsyntax. */\n $implicit: T;\n /** Alias for `$implicit`. */\n cngxAsync: T;\n}\n\n/**\n * Structural directive for async state-driven content rendering.\n *\n * Renders different views based on the current `CngxAsyncState` status:\n * - **loading (first load)** → skeleton template (or nothing)\n * - **success + has data** → content template with typed data\n * - **success + empty** → empty template (or nothing)\n * - **error (first load)** → error template (or nothing)\n * - **refreshing / loading (with data)** → content template (old data stays visible)\n * - **error (with data)** → content template (old data stays visible) -\n * `resolveAsyncView` reports this as `content+error`, but a structural\n * directive renders exactly one template, so the error half is flattened\n * away here; surface it separately (toast, alert) when it must be visible\n *\n * ### Focus across a view switch\n * When a switch destroys the view that holds focus, focus moves to the first\n * focusable element (outside any `inert` subtree) of the next rendered view, so\n * a focused Retry button does not drop keyboard users onto `<body>`. One view\n * without a focusable element (a skeleton) is bridged; after that the hand-off\n * lapses. Focus that sits outside the directive, or that the user moved\n * elsewhere in the meantime, is never touched.\n *\n * ### Minimal - just content\n * ```html\n * <ul *cngxAsync=\"residents; let data\">\n * @for (r of data; track r.id) { <li>{{ r.name }}</li> }\n * </ul>\n * ```\n *\n * ### With custom templates\n * ```html\n * <ul *cngxAsync=\"residents; let data; skeleton: skelTpl; empty: emptyTpl; error: errTpl\">\n * @for (r of data; track r.id) { <li>{{ r.name }}</li> }\n * </ul>\n *\n * <ng-template #skelTpl>\n * @for (i of [1,2,3]; track i) { <li class=\"skeleton-line\"></li> }\n * </ng-template>\n *\n * <ng-template #emptyTpl>\n * <li>No residents found.</li>\n * </ng-template>\n *\n * <ng-template #errTpl let-err>\n * <li>Error: {{ err }}</li>\n * </ng-template>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/async/async.directive.ts\n * @since 0.3.0\n * @relatedTo injectAsyncState, createAsyncState, createManualState\n *\n * <example-url>/#/ui/feedback/async-container/cngx-async-container-full-control-toast</example-url>\n * <example-url>/#/ui/feedback/async-container/cngxasync-one-line</example-url>\n * <example-url>/#/ui/feedback/async-container/cngxasync-with-custom-templates</example-url>\n * <example-url>/#/ui/feedback/async-container/composition-overlay-container-toast</example-url>\n * <example-url>/#/ui/feedback/async-container/createasyncstate-mutation</example-url>\n * <example-url>/#/ui/feedback/async-container/injectasyncstate-reactive-query</example-url>\n * @axis level molecule\n */\n@Directive({\n selector: '[cngxAsync]',\n standalone: true,\n})\nexport class CngxAsync<T> {\n private readonly vcr = inject(ViewContainerRef);\n private readonly contentTpl = inject<TemplateRef<CngxAsyncContext<T>>>(TemplateRef);\n private readonly doc = inject(DOCUMENT);\n private readonly injector = inject(Injector);\n\n /** The async state to render. */\n readonly cngxAsync = input.required<CngxAsyncState<T>>();\n\n /** Optional skeleton template shown during first load. */\n readonly cngxAsyncSkeleton = input<TemplateRef<unknown> | undefined>(undefined);\n\n /** Optional empty template shown when data is empty after success. */\n readonly cngxAsyncEmpty = input<TemplateRef<unknown> | undefined>(undefined);\n\n /** Optional error template shown on error during first load. Context: `{ $implicit: error }`. */\n readonly cngxAsyncError = input<TemplateRef<{ $implicit: unknown }> | undefined>(undefined);\n\n // content+error → content (structural directive has no dual-render)\n private readonly view = computed((): AsyncView => {\n const s = this.cngxAsync();\n const resolved = resolveAsyncView(s.status(), s.isFirstLoad(), s.isEmpty());\n return resolved === 'content+error' ? 'content' : resolved;\n });\n\n // The slot template of the current view; the content template is fixed.\n private readonly slotTemplate = computed((): TemplateRef<unknown> | undefined => {\n switch (this.view()) {\n case 'skeleton':\n return this.cngxAsyncSkeleton();\n case 'empty':\n return this.cngxAsyncEmpty();\n case 'error':\n return this.cngxAsyncError();\n default:\n return undefined;\n }\n });\n\n // Plain fields, not signals: they are only ever read and written inside the\n // render effect - as signals they fed the effect's own dependency graph and\n // caused one spurious re-run per view switch.\n private currentView: AsyncView = 'none';\n private currentTemplate: TemplateRef<unknown> | undefined = undefined;\n private contentViewRef: EmbeddedViewRef<CngxAsyncContext<T>> | null = null;\n // View switches left in which focus lost by a destroyed view may be handed\n // on: the switch that lost it plus one more, so a short skeleton in between\n // is bridged but a much later refresh never pulls focus back.\n private focusSwitchesLeft = 0;\n\n constructor() {\n effect(() => {\n const view = this.view();\n const tpl = this.slotTemplate();\n const s = this.cngxAsync();\n\n if (view === this.currentView && tpl === this.currentTemplate) {\n this.updateContentContext(s);\n return;\n }\n\n if (this.renderedViewHoldsFocus()) {\n this.focusSwitchesLeft = 2;\n }\n this.vcr.clear();\n this.contentViewRef = null;\n this.currentView = view;\n this.currentTemplate = tpl;\n\n this.renderView(view, tpl, s);\n if (this.focusSwitchesLeft > 0) {\n this.focusSwitchesLeft--;\n untracked(() => afterNextRender(() => this.restoreFocus(), { injector: this.injector }));\n }\n });\n }\n\n private renderedRoots(): Node[] {\n const roots: Node[] = [];\n for (let i = 0; i < this.vcr.length; i++) {\n const ref = this.vcr.get(i) as EmbeddedViewRef<unknown> | null;\n roots.push(...((ref?.rootNodes ?? []) as Node[]));\n }\n return roots;\n }\n\n private renderedViewHoldsFocus(): boolean {\n const active = this.doc.activeElement;\n if (!active || active === this.doc.body) {\n return false;\n }\n return this.renderedRoots().some((node) => node.contains(active));\n }\n\n // Restores focus only when it was lost to the body; a view without a\n // focusable element leaves the remaining switch budget to the next one.\n private restoreFocus(): void {\n const active = this.doc.activeElement;\n if (active && active !== this.doc.body) {\n this.focusSwitchesLeft = 0;\n return;\n }\n const target = this.firstFocusable();\n if (target) {\n this.focusSwitchesLeft = 0;\n target.focus();\n }\n }\n\n private firstFocusable(): HTMLElement | null {\n for (const node of this.renderedRoots()) {\n if (!(node instanceof HTMLElement)) {\n continue;\n }\n if (node.matches(CNGX_FOCUSABLE_SELECTOR) && !node.closest('[inert]')) {\n return node;\n }\n const inner = Array.from(node.querySelectorAll<HTMLElement>(CNGX_FOCUSABLE_SELECTOR)).find(\n (el) => !el.closest('[inert]'),\n );\n if (inner) {\n return inner;\n }\n }\n return null;\n }\n\n private updateContentContext(s: CngxAsyncState<T>): void {\n if (!this.contentViewRef) {\n return;\n }\n const data = s.data() as T;\n this.contentViewRef.context.$implicit = data;\n this.contentViewRef.context.cngxAsync = data;\n this.contentViewRef.markForCheck();\n }\n\n private renderView(\n view: AsyncView,\n tpl: TemplateRef<unknown> | undefined,\n s: CngxAsyncState<T>,\n ): void {\n switch (view) {\n case 'skeleton':\n case 'empty':\n this.renderTemplate(tpl);\n break;\n case 'content':\n case 'content+error': {\n const data = s.data();\n this.contentViewRef = this.vcr.createEmbeddedView(this.contentTpl, {\n $implicit: data as T,\n cngxAsync: data as T,\n });\n break;\n }\n case 'error':\n this.renderTemplate(tpl, { $implicit: s.error() });\n break;\n }\n }\n\n private renderTemplate(\n tpl: TemplateRef<unknown> | undefined,\n context?: Record<string, unknown>,\n ): void {\n if (tpl) {\n this.vcr.createEmbeddedView(tpl, context);\n }\n }\n\n /** Type guard for template type inference. */\n static ngTemplateContextGuard<T>(_dir: CngxAsync<T>, _ctx: unknown): _ctx is CngxAsyncContext<T> {\n return true;\n }\n}\n","import type { CngxMessage } from '@cngx/core/i18n';\n\n/**\n * The kpi section of a {@link CngxLanguagePack}: the copy of the KPI atoms\n * `CngxMetric`, `CngxDelta`, `CngxTrend` and `CngxGoal`. Magnitudes reach the\n * messages already formatted for the app locale.\n *\n * @since 0.3.0\n * @relatedTo CNGX_KPI_I18N\n */\nexport interface CngxKpiLanguageSection {\n /** `{value}`, `{sentiment}`: the accessible name of a delta. */\n readonly deltaLabel: CngxMessage;\n readonly deltaImproved: string;\n readonly deltaDeclined: string;\n readonly deltaUnchanged: string;\n /** `{value}`, `{direction}`: the accessible name of a trend. */\n readonly trendLabel: CngxMessage;\n readonly trendUp: string;\n readonly trendDown: string;\n readonly trendFlat: string;\n /** `{now}`, `{max}`: a goal's `aria-valuetext`. */\n readonly goalValueText: CngxMessage;\n /** `{value}`, `{unit}`: a metric's value and unit, in reading order. */\n readonly metricValueWithUnit: string;\n /** Shown in place of a metric without a value. */\n readonly metricPlaceholder: string;\n /** Accessible name of a metric without a value. */\n readonly metricNoValue: string;\n}\n\n/**\n * The English kpi section: the single source of the KPI atoms' English copy.\n * `CNGX_KPI_I18N` defaults to it.\n *\n * @since 0.3.0\n * @relatedTo CNGX_KPI_I18N\n */\nexport const CNGX_KPI_LANGUAGE_EN: CngxKpiLanguageSection = {\n deltaLabel: '{value} {sentiment}',\n deltaImproved: 'improved',\n deltaDeclined: 'declined',\n deltaUnchanged: 'unchanged',\n trendLabel: '{value} {direction}',\n trendUp: 'up',\n trendDown: 'down',\n trendFlat: 'unchanged',\n goalValueText: '{now} of {max}',\n metricValueWithUnit: '{value} {unit}',\n metricPlaceholder: '\\u2013',\n metricNoValue: 'No value',\n};\n\ndeclare module '@cngx/core/i18n' {\n interface CngxLanguagePack {\n readonly kpi: CngxKpiLanguageSection;\n }\n}\n","import { inject, InjectionToken, type Provider, type Signal } from '@angular/core';\nimport { createLanguageSection, createSectionBundle, formatMessage } from '@cngx/core/i18n';\nimport { createOverrideMerge, numberFormatterFor } from '@cngx/core/utils';\n\nimport { CNGX_KPI_LANGUAGE_EN, type CngxKpiLanguageSection } from '../../i18n/kpi-language-section';\nimport type { DeltaDirection, DeltaSentiment } from './delta-format';\n\n/**\n * KPI atom i18n surface. Library defaults are English; consumers override\n * via {@link provideKpiI18n}. Reactive from birth: the token carries a\n * `Signal`, and {@link withKpiI18nLabels} accepts a `Signal` of a partial\n * bundle, so a runtime language switch re-derives every label.\n *\n * Every key is a formatter, so word order and plural rules belong to the\n * translator. The magnitude arrives already formatted in the app locale\n * (`CNGX_LOCALE`); the per-instance `label` / `valueTextFormat` inputs still\n * win over the bundle.\n *\n * @since 0.3.0\n */\nexport interface CngxKpiI18n {\n /** `CngxDelta` accessible name: formatted magnitude plus the sentiment word. */\n readonly deltaLabel: (formatted: string, sentiment: DeltaSentiment) => string;\n /** `CngxTrend` accessible name: formatted magnitude plus the direction word. */\n readonly trendLabel: (formatted: string, direction: DeltaDirection) => string;\n /** `CngxGoal` `aria-valuetext`: clamped value and target. */\n readonly goalValueText: (now: number, max: number) => string;\n /**\n * `CngxMetric` order of value and unit: `{value}` and `{unit}` in reading\n * order, a plain template the metric renders as two elements. English\n * `'{value} {unit}'`.\n */\n readonly metricValueWithUnit: string;\n /** Shown in place of a `CngxMetric` without a value. English: the U+2014 glyph. */\n readonly metricPlaceholder: string;\n /** Accessible name of a `CngxMetric` without a value. English `No value`. */\n readonly metricNoValue: string;\n}\n\nconst GOAL_NUMBER: Intl.NumberFormatOptions = {};\n\n/** @internal Turns a kpi section into the token's keys for a locale. */\nfunction kpiBundleFrom(section: CngxKpiLanguageSection, locale: string): CngxKpiI18n {\n const sentiment: Record<DeltaSentiment, string> = {\n positive: section.deltaImproved,\n negative: section.deltaDeclined,\n neutral: section.deltaUnchanged,\n };\n const direction: Record<DeltaDirection, string> = {\n up: section.trendUp,\n down: section.trendDown,\n flat: section.trendFlat,\n };\n const goalNumber = numberFormatterFor(locale, GOAL_NUMBER);\n return {\n deltaLabel: (value, s) =>\n formatMessage(section.deltaLabel, { value, sentiment: sentiment[s] }, locale),\n trendLabel: (value, d) =>\n formatMessage(section.trendLabel, { value, direction: direction[d] }, locale),\n goalValueText: (now, max) =>\n formatMessage(\n section.goalValueText,\n { now: goalNumber.format(now), max: goalNumber.format(max) },\n locale,\n ),\n metricValueWithUnit: section.metricValueWithUnit,\n metricPlaceholder: section.metricPlaceholder,\n metricNoValue: section.metricNoValue,\n };\n}\n\n/** @internal The kpi section of the active pack over English. */\nconst injectKpiSection = createLanguageSection('kpi', CNGX_KPI_LANGUAGE_EN);\n\n/** @internal Builds and reads the token, formatted for the reading locale. */\nconst kpiBundle = createSectionBundle<CngxKpiLanguageSection, CngxKpiI18n>({\n section: injectKpiSection,\n toBundle: kpiBundleFrom,\n});\n\n/**\n * DI token for the KPI i18n bundle. `providedIn: 'root'`: the kpi section\n * of the active language pack over the English defaults, formatted for the\n * app locale; the value is a `Signal`, shared by every reader under one\n * injector.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/shared/kpi-i18n.ts\n * @since 0.3.0\n * @relatedTo CngxDelta, CngxTrend, CngxGoal\n */\nexport const CNGX_KPI_I18N = new InjectionToken<Signal<CngxKpiI18n>>('CngxKpiI18n', {\n providedIn: 'root',\n factory: () => kpiBundle.build(),\n});\n\n/**\n * A label override feature of `provideKpiI18n`.\n *\n * @since 0.3.0\n * @relatedTo CNGX_KPI_I18N, withKpiI18nLabels\n */\nexport type CngxKpiI18nFeature = (bundle: Signal<CngxKpiI18n>) => Signal<CngxKpiI18n>;\n\n/**\n * Override KPI labels via a partial bundle - unset keys keep the language\n * pack's copy, or the English default. Pass a `Signal` of a partial bundle to switch languages at\n * runtime.\n *\n * @since 0.3.0\n */\nexport function withKpiI18nLabels(\n overrides: Partial<CngxKpiI18n> | Signal<Partial<CngxKpiI18n>>,\n): CngxKpiI18nFeature {\n return (bundle) => createOverrideMerge(bundle, overrides);\n}\n\n/**\n * Provider for the KPI i18n bundle. Returns a plain `Provider`, so it also\n * scopes a subtree through `viewProviders`. The features apply on top of the\n * active language pack.\n *\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideKpiI18n(\n * withKpiI18nLabels({\n * goalValueText: (now, max) => `${now} von ${max}`,\n * }),\n * ),\n * ],\n * });\n * ```\n *\n * @since 0.3.0\n */\nexport function provideKpiI18n(...features: readonly CngxKpiI18nFeature[]): Provider {\n return {\n provide: CNGX_KPI_I18N,\n useFactory: () => kpiBundle.build(features),\n };\n}\n\n/**\n * Inject the resolved KPI i18n bundle signal. Read it inside a `computed()`\n * or template so a runtime override flip re-derives.\n *\n * @since 0.3.0\n */\nexport function injectKpiI18n(): Signal<CngxKpiI18n> {\n return kpiBundle.resolve(inject(CNGX_KPI_I18N));\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { formatMessage } from '@cngx/core/i18n';\nimport { injectLocale, numberFormatterFor } from '@cngx/core/utils';\n\nimport { injectKpiI18n } from '../shared/kpi-i18n';\n\nconst UNIT_PLACEHOLDER = /\\{(value|unit)\\}/;\n\n/** @internal `true` when the language reads the unit before the value. */\nfunction readsUnitFirst(message: string): boolean {\n const [, first] = UNIT_PLACEHOLDER.exec(message) ?? [];\n return first === 'unit';\n}\n\n/**\n * Displays a formatted numeric value with optional unit.\n *\n * Uses `Intl.NumberFormat` with the app locale (`CNGX_LOCALE`, falling back to\n * the nearest `LOCALE_ID`) for locale-aware formatting; a locale flip\n * re-formats. A `null` value renders the placeholder glyph without its unit.\n *\n * Composable - works inside any card variant, header, body, or standalone.\n *\n * ### Basic\n * ```html\n * <cngx-metric [value]=\"1234\" unit=\"bpm\" />\n * ```\n *\n * ### With format options\n * ```html\n * <cngx-metric [value]=\"99.6\" unit=\"%\" [format]=\"{ maximumFractionDigits: 1 }\" />\n * ```\n *\n * ### Inside a card\n * ```html\n * <cngx-card>\n * <header cngxCardHeader>Puls</header>\n * <cngx-metric cngxCardBody [value]=\"75\" unit=\"bpm\" />\n * </cngx-card>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/metric/metric.component.ts\n * @since 0.3.0\n * @relatedTo CngxTrend, CngxCard\n *\n * <example-url>/#/common/data/metric/inside-a-card</example-url>\n * <example-url>/#/common/data/metric/standalone-metrics</example-url>\n * @axis level atom\n */\n@Component({\n selector: 'cngx-metric',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'cngx-metric',\n // role=img makes the host a single labelled graphic so AT announces the\n // curated `aria-label` (value + unit) instead of the raw text on an\n // otherwise role=generic custom element, where aria-label is unreliably\n // exposed. Mirrors CngxDelta / CngxTrend.\n role: 'img',\n '[attr.aria-label]': 'accessibleValue()',\n },\n template: `\n @if (shownUnit() && unitFirst()) {\n <span class=\"cngx-metric__unit\">{{ shownUnit() }}</span>\n }\n <span class=\"cngx-metric__value\">{{ formattedValue() }}</span>\n @if (shownUnit() && !unitFirst()) {\n <span class=\"cngx-metric__unit\">{{ shownUnit() }}</span>\n }\n `,\n styleUrls: ['./metric.component.css'],\n})\nexport class CngxMetric {\n private readonly locale = injectLocale();\n private readonly i18n = injectKpiI18n();\n\n /**\n * Numeric or string value. `null` renders the `metricPlaceholder` glyph of\n * the kpi language section and is announced as its `metricNoValue` text.\n */\n readonly value = input.required<number | string | null>();\n\n /** Unit suffix (e.g. \"bpm\", \"h\", \"%\", \"kg\"). */\n readonly unit = input<string | undefined>(undefined);\n\n /** `Intl.NumberFormatOptions` for the primary value. */\n readonly format = input<Intl.NumberFormatOptions | undefined>(undefined);\n\n /** @internal */\n readonly formattedValue = computed(() => {\n const v = this.value();\n if (v === null) {\n return this.i18n().metricPlaceholder;\n }\n if (typeof v === 'string') {\n return v;\n }\n return numberFormatterFor(this.locale(), this.format() ?? {}).format(v);\n });\n\n /**\n * @internal The unit to render, `undefined` while there is no value: a\n * missing reading has no unit, so \"No value km\" is never shown or spoken.\n */\n protected readonly shownUnit = computed(() => {\n const unit = this.unit();\n return this.value() === null || unit === '' ? undefined : unit;\n });\n\n /** @internal Unit before value, per the `metricValueWithUnit` message. */\n protected readonly unitFirst = computed(() => readsUnitFirst(this.i18n().metricValueWithUnit));\n\n /** @internal Full accessible description including unit. */\n readonly accessibleValue = computed(() => {\n const i18n = this.i18n();\n if (this.value() === null) {\n return i18n.metricNoValue;\n }\n const value = this.formattedValue();\n const unit = this.shownUnit();\n return unit ? formatMessage(i18n.metricValueWithUnit, { value, unit }, this.locale()) : value;\n });\n}\n","/**\n * Pure, framework-agnostic helpers that turn a signed delta value into the\n * three orthogonal signals a KPI atom renders: **direction** (which way the\n * arrow points), **sentiment** (whether the change is good or bad, which\n * drives colour and the SR word), and the formatted magnitude.\n *\n * Direction and sentiment are deliberately separate. `CngxTrend` colours by\n * direction (up = green); `CngxDelta` colours by sentiment, so a value that\n * dropped can still read as an improvement (churn down, latency down). Both\n * consume these helpers so the direction / glyph / format logic has a single\n * source of truth (Pillar 1) with no Angular dependency.\n */\nimport { numberFormatterFor } from '@cngx/core/utils';\n\n/** Which way the delta moved. `flat` is exactly zero. */\nexport type DeltaDirection = 'up' | 'down' | 'flat';\n\n/**\n * How to read the sign of a delta. `neutral` disables sentiment entirely\n * (direction still renders, colour stays neutral).\n */\nexport type DeltaPolarity = 'higher-is-better' | 'lower-is-better' | 'neutral';\n\n/** Good / bad / indifferent, derived from `direction × polarity`. */\nexport type DeltaSentiment = 'positive' | 'negative' | 'neutral';\n\n/** Percent (default, one fraction digit + `%`) or a locale-formatted absolute number. */\nexport type DeltaMode = 'percent' | 'absolute';\n\n/**\n * `> 0 → up`, `< 0 → down`, `0 → flat`.\n * @internal\n */\nexport function deltaDirection(value: number): DeltaDirection {\n return value > 0 ? 'up' : value < 0 ? 'down' : 'flat';\n}\n\n/**\n * Combine movement with the caller's polarity. `flat` or `neutral` polarity\n * collapse to `neutral`; otherwise up is positive under `higher-is-better`\n * and negative under `lower-is-better` (and the reverse for down).\n * @internal\n */\nexport function deltaSentiment(\n direction: DeltaDirection,\n polarity: DeltaPolarity,\n): DeltaSentiment {\n if (direction === 'flat' || polarity === 'neutral') {\n return 'neutral';\n }\n const upIsGood = polarity === 'higher-is-better';\n const isGood = direction === 'up' ? upIsGood : !upIsGood;\n return isGood ? 'positive' : 'negative';\n}\n\n/**\n * Arrow glyph for the direction: `↑` / `↓` / `→`.\n * @internal\n */\nexport function directionGlyph(direction: DeltaDirection): string {\n return direction === 'up' ? '↑' : direction === 'down' ? '↓' : '→';\n}\n\n/**\n * Format the magnitude. The sign is carried by the arrow and colour, not the\n * digits: a positive value gains a leading `+`, everything else prints its\n * absolute value unsigned. Percent mode formats with `Intl` `style: 'percent'`\n * (so the locale places the `%` sign) and defaults to one fraction digit;\n * absolute mode uses the locale grouping.\n * A supplied `Intl.NumberFormatOptions` overrides the default digit handling\n * in both modes.\n * @internal\n */\nexport function formatDelta(\n value: number,\n mode: DeltaMode,\n locale: string,\n format?: Intl.NumberFormatOptions,\n): string {\n const abs = Math.abs(value);\n // The locale places and draws the plus sign; a negative prints unsigned.\n const signDisplay = value > 0 ? 'exceptZero' : 'never';\n if (mode === 'percent') {\n // The input is already in percent units; Intl's percent style multiplies\n // by 100, so scale down first.\n return numberFormatterFor(locale, {\n ...(format ?? { minimumFractionDigits: 1, maximumFractionDigits: 1 }),\n style: 'percent',\n signDisplay,\n }).format(abs / 100);\n }\n return numberFormatterFor(locale, { ...format, signDisplay }).format(abs);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { injectLocale } from '@cngx/core/utils';\n\nimport { deltaDirection, directionGlyph, formatDelta } from '../shared/delta-format';\nimport { injectKpiI18n } from '../shared/kpi-i18n';\n\n/**\n * Displays a trend indicator with directional arrow and formatted percentage.\n *\n * Positive values show an up arrow, negative a down arrow, zero a right arrow.\n * The consumer can override the SR label for full context\n * (e.g. \"vs. last month\" instead of the generic default).\n *\n * ### Basic\n * ```html\n * <cngx-trend [value]=\"5.3\" />\n * ```\n *\n * ### With custom label\n * ```html\n * <cngx-trend [value]=\"-2.1\" label=\"-2.1% vs. last quarter\" />\n * ```\n *\n * ### Inside a card header\n * ```html\n * <cngx-card>\n * <header cngxCardHeader>\n * <span>Revenue</span>\n * <cngx-trend [value]=\"revenue().trend\" />\n * </header>\n * </cngx-card>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/trend/trend.component.ts\n * @since 0.3.0\n * @relatedTo CngxMetric, CngxCard\n *\n * <example-url>/#/common/data/trend/composed-with-metric-in-a-card</example-url>\n * <example-url>/#/common/data/trend/trend-directions</example-url>\n * @axis level atom\n */\n@Component({\n selector: 'cngx-trend',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'cngx-trend',\n // role=img makes the host a single labelled graphic so AT announces the\n // curated `aria-label` instead of the raw glyph text on an otherwise\n // role=generic custom element, where aria-label is unreliably exposed.\n role: 'img',\n '[class.cngx-trend--up]': 'value() > 0',\n '[class.cngx-trend--down]': 'value() < 0',\n '[attr.aria-label]': 'resolvedLabel()',\n },\n template: `\n <span aria-hidden=\"true\">{{ icon() }}</span>\n {{ formattedValue() }}\n `,\n styleUrls: ['./trend.component.css'],\n})\nexport class CngxTrend {\n private readonly locale = injectLocale();\n private readonly i18n = injectKpiI18n();\n\n /** Trend percentage. Positive = up, negative = down, zero = flat. */\n readonly value = input.required<number>();\n\n /** Consumer-provided SR label override. When set, replaces the generated default. */\n readonly label = input<string | undefined>(undefined);\n\n /** @internal */\n protected readonly icon = computed(() => directionGlyph(deltaDirection(this.value())));\n\n /** @internal */\n protected readonly formattedValue = computed(() => formatDelta(this.value(), 'percent', this.locale()));\n\n /** @internal */\n protected readonly resolvedLabel = computed(\n () =>\n this.label() ??\n this.i18n().trendLabel(this.formattedValue(), deltaDirection(this.value())),\n );\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport { injectLocale } from '@cngx/core/utils';\n\nimport {\n deltaDirection,\n deltaSentiment,\n directionGlyph,\n formatDelta,\n type DeltaMode,\n type DeltaPolarity,\n} from '../shared/delta-format';\nimport { injectKpiI18n } from '../shared/kpi-i18n';\n\n/**\n * Sentiment-aware delta indicator. Where `CngxTrend` colours strictly by\n * direction (up = green), `CngxDelta` colours by **sentiment**: a `polarity`\n * of `lower-is-better` makes a drop read as an improvement (churn, latency,\n * error rate). The arrow glyph always tracks the raw direction, so colour is\n * never the only signal - a green value can carry a down arrow, and the SR\n * label speaks the sentiment word.\n *\n * Sentiment, direction, glyph and the formatted magnitude are each a\n * `computed()` off the single `value`/`polarity` input pair (Pillar 1); the\n * colour class and the arrow are bound from independent signals so they can\n * diverge (Pillar 2).\n *\n * ### Basic (higher-is-better default)\n * ```html\n * <cngx-delta [value]=\"5.3\" />\n * ```\n *\n * ### Lower-is-better (a drop is good)\n * ```html\n * <cngx-delta [value]=\"-2.1\" polarity=\"lower-is-better\" />\n * ```\n *\n * ### Absolute magnitude\n * ```html\n * <cngx-delta [value]=\"1240\" mode=\"absolute\" [format]=\"{ maximumFractionDigits: 0 }\" />\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/delta/delta.component.ts\n * @since 0.3.0\n * @relatedTo CngxTrend, CngxMetric, CngxStat\n *\n * <example-url>/#/common/data/delta/sentiment-polarity</example-url>\n * @axis level atom\n */\n@Component({\n selector: 'cngx-delta',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'cngx-delta',\n // role=img makes the host a single labelled graphic so AT announces the\n // curated `aria-label` (the sentiment word) instead of the raw glyph text\n // on an otherwise role=generic custom element, where aria-label is\n // unreliably exposed.\n role: 'img',\n '[class.cngx-delta--positive]': \"sentiment() === 'positive'\",\n '[class.cngx-delta--negative]': \"sentiment() === 'negative'\",\n '[class.cngx-delta--neutral]': \"sentiment() === 'neutral'\",\n '[attr.aria-label]': 'resolvedLabel()',\n },\n template: `\n <span aria-hidden=\"true\">{{ glyph() }}</span>\n {{ formattedValue() }}\n `,\n styleUrls: ['./delta.component.css'],\n})\nexport class CngxDelta {\n private readonly locale = injectLocale();\n private readonly i18n = injectKpiI18n();\n\n /** Signed delta. Positive = up, negative = down, zero = flat. */\n readonly value = input.required<number>();\n\n /**\n * How to read the sign. `higher-is-better` (default) treats a rise as\n * positive; `lower-is-better` inverts it; `neutral` disables sentiment\n * (direction still renders, colour stays neutral).\n */\n readonly polarity = input<DeltaPolarity>('higher-is-better');\n\n /** `percent` (default, one fraction digit + `%`) or `absolute`. */\n readonly mode = input<DeltaMode>('percent');\n\n /** `Intl.NumberFormatOptions` applied to the magnitude in either mode. */\n readonly format = input<Intl.NumberFormatOptions | undefined>(undefined);\n\n /** Consumer-provided SR label override. Replaces the generated default. */\n readonly label = input<string | undefined>(undefined);\n\n /** @internal Raw movement, independent of polarity. Drives the glyph. */\n protected readonly direction = computed(() => deltaDirection(this.value()));\n\n /** @internal Good / bad / indifferent. Drives colour and the SR word. */\n protected readonly sentiment = computed(() => deltaSentiment(this.direction(), this.polarity()));\n\n /** @internal Arrow glyph bound from direction only. */\n protected readonly glyph = computed(() => directionGlyph(this.direction()));\n\n /** @internal Formatted magnitude. */\n protected readonly formattedValue = computed(() =>\n formatDelta(this.value(), this.mode(), this.locale(), this.format()),\n );\n\n /**\n * @internal Full SR label: magnitude plus the sentiment word, composed by\n * `CNGX_KPI_I18N.deltaLabel` unless `[label]` is bound.\n */\n protected readonly resolvedLabel = computed(\n () => this.label() ?? this.i18n().deltaLabel(this.formattedValue(), this.sentiment()),\n );\n}\n","import { computed, Directive, signal } from '@angular/core';\n\nimport type { CngxStatRegistry, CngxStatSlotKind } from './stat.token';\n\n/** Fixed reading order for the coordinated slots. */\nconst SLOT_ORDER: readonly CngxStatSlotKind[] = ['label', 'value', 'delta', 'caption'];\n\n/** Structural equality so an unchanged id set never cascades `labelledBy`. */\nconst idsEqual = (a: readonly string[], b: readonly string[]): boolean =>\n a.length === b.length && a.every((id, i) => id === b[i]);\n\n/** Structural equality so an unchanged slot set never cascades to a placeholder. */\nconst kindsEqual = (a: readonly CngxStatSlotKind[], b: readonly CngxStatSlotKind[]): boolean =>\n a.length === b.length && a.every((kind, i) => kind === b[i]);\n\n/**\n * The slot-id coordination brain behind {@link CNGX_STAT}. Collects the id each\n * `cngxStat*` slot registers and derives one `aria-labelledby` that reads the\n * whole stat as a single accessible name in reading order.\n *\n * Lives as a host directive rather than inside `CngxStat` because the slot\n * directives resolve `CNGX_STAT` against their **declaration** site: content\n * written inside an organism never reaches a `<cngx-stat>` that sits in that\n * organism's own template. Any component that wants to host the four slots\n * therefore applies this brain and re-points the token at it:\n *\n * ```ts\n * hostDirectives: [CngxStatCoordinator],\n * providers: [{ provide: CNGX_STAT, useExisting: CngxStatCoordinator }],\n * ```\n *\n * Same shape as `CngxPaginate` behind `CNGX_PAGINATOR_HOST`, which\n * `CngxPaginator` and `CngxIncrementalList` share the same way.\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/stat/stat-coordinator.directive.ts\n * @since 0.3.0\n * @relatedTo CngxStat, CNGX_STAT\n */\n@Directive({\n standalone: true,\n})\nexport class CngxStatCoordinator implements CngxStatRegistry {\n private readonly slots = signal<ReadonlyMap<CngxStatSlotKind, string>>(new Map());\n\n /** {@inheritDoc CngxStatRegistry.register} */\n register(kind: CngxStatSlotKind, id: string): void {\n this.slots.update((prev) => new Map(prev).set(kind, id));\n }\n\n /** {@inheritDoc CngxStatRegistry.unregister} */\n unregister(kind: CngxStatSlotKind, id?: string): void {\n this.slots.update((prev) => {\n if (id !== undefined && prev.get(kind) !== id) {\n // Register-before-destroy replacement: the outgoing slot must not\n // evict the live slot's id from aria-labelledby.\n return prev;\n }\n const next = new Map(prev);\n next.delete(kind);\n return next;\n });\n }\n\n /** Present slot ids in reading order; structurally stable. */\n readonly orderedIds = computed(\n () => {\n const map = this.slots();\n return SLOT_ORDER.map((kind) => map.get(kind)).filter((id): id is string => id !== undefined);\n },\n { equal: idsEqual },\n );\n\n /** Combined accessible name for the host; `null` when no slot is present. */\n readonly labelledBy = computed(() => this.orderedIds().join(' ') || null);\n\n /**\n * Which slots a consumer actually projected, in reading order. Registration\n * happens when the slot directive is constructed in the consumer's template,\n * so this stays accurate even while the host renders a branch that does not\n * include the `<ng-content>` outlets - which is what lets a placeholder mirror\n * the real tile instead of guessing at it.\n */\n readonly presentKinds = computed(\n () => {\n const map = this.slots();\n return SLOT_ORDER.filter((kind) => map.has(kind));\n },\n { equal: kindsEqual },\n );\n}\n","import { InjectionToken } from '@angular/core';\n\n/** The four coordinated slots of a {@link CngxStat}, in reading order. */\nexport type CngxStatSlotKind = 'label' | 'value' | 'delta' | 'caption';\n\n/**\n * Slot-registration contract a `CngxStat` exposes to its projected slot\n * directives. Each slot registers its generated id on init and withdraws it\n * on destroy; the molecule derives the combined `aria-labelledby` from the\n * live registration set. Fronted by a DI token (not the concrete `CngxStat`\n * class) so the slots stay decompose-safe - the ejected skin talks to the\n * same token the library defines.\n */\nexport interface CngxStatRegistry {\n /** Register (or replace) the id contributed by `kind`. */\n register(kind: CngxStatSlotKind, id: string): void;\n /**\n * Withdraw the id contributed by `kind`. When `id` is given, the\n * withdrawal applies only while that id is still the registered one -\n * a register-before-destroy replacement is left alone.\n */\n unregister(kind: CngxStatSlotKind, id?: string): void;\n}\n\n/** DI token carrying the {@link CngxStatRegistry} a `CngxStat` provides. */\nexport const CNGX_STAT = new InjectionToken<CngxStatRegistry>('CNGX_STAT');\n","import {\n ChangeDetectionStrategy,\n Component,\n inject,\n input,\n ViewEncapsulation,\n} from '@angular/core';\n\nimport { CngxStatCoordinator } from './stat-coordinator.directive';\nimport { CNGX_STAT } from './stat.token';\n\n/**\n * Coordination molecule for a KPI stat. Its sole reason to exist is the\n * screen-reader layer (Pillar 2): hand-assembling a heading, a `<cngx-metric>`\n * and a `<cngx-delta>` makes a screen reader announce three disconnected\n * fragments. `CngxStat` projects the label / value / delta / caption slots,\n * collects the id each slot registers, and derives one `aria-labelledby` that\n * reads the whole stat as a single accessible name in reading order.\n *\n * Composition, never a config bag (Pillar 3): the id coordination lives in the\n * {@link CngxStatCoordinator} host directive, so another component that hosts\n * the same four slots applies the identical brain instead of reimplementing it.\n * The visuals stay whatever atoms the consumer projects into the slots.\n *\n * ```html\n * <cngx-stat aria-live=\"polite\">\n * <span cngxStatLabel>Revenue</span>\n * <cngx-metric cngxStatValue [value]=\"1.2\" unit=\"M EUR\" />\n * <cngx-delta cngxStatDelta [value]=\"5.3\" />\n * <span cngxStatCaption>vs. last quarter</span>\n * </cngx-stat>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/stat/stat.component.ts\n * @since 0.3.0\n * @relatedTo CngxMetric, CngxDelta, CngxTrend, CngxStatCoordinator\n *\n * <example-url>/#/common/data/stat/composed-kpi</example-url>\n * @axis level molecule\n */\n@Component({\n selector: 'cngx-stat',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n hostDirectives: [CngxStatCoordinator],\n providers: [{ provide: CNGX_STAT, useExisting: CngxStatCoordinator }],\n host: {\n class: 'cngx-stat',\n role: 'group',\n '[attr.aria-labelledby]': 'coordinator.labelledBy()',\n '[attr.aria-live]': 'live()',\n },\n template: `\n <ng-content select=\"[cngxStatLabel]\" />\n <div class=\"cngx-stat__row\">\n <ng-content select=\"[cngxStatValue]\" />\n <ng-content select=\"[cngxStatDelta]\" />\n </div>\n <ng-content select=\"[cngxStatCaption]\" />\n `,\n styleUrls: ['./stat.component.css'],\n})\nexport class CngxStat {\n /** @internal The shared slot-id brain, applied as a host directive. */\n protected readonly coordinator = inject(CngxStatCoordinator, { host: true });\n\n /**\n * Politeness of the live region. `off` (default) for a static stat;\n * `polite` / `assertive` for a KPI whose value updates in place.\n */\n readonly live = input<'off' | 'polite' | 'assertive'>('off');\n}\n","import { DestroyRef, Directive, inject } from '@angular/core';\nimport { nextUid } from '@cngx/core/utils';\n\nimport { CNGX_STAT, type CngxStatSlotKind } from './stat.token';\n\n/**\n * Generate a stable id, register it with the enclosing `CngxStat` (if any),\n * and withdraw it on destroy. Shared by the four slot directives via plain\n * composition - no base class, no inheritance (Pillar 3).\n */\nfunction useStatSlot(kind: CngxStatSlotKind): string {\n const registry = inject(CNGX_STAT, { optional: true });\n const id = nextUid(`cngx-stat-${kind}`);\n registry?.register(kind, id);\n inject(DestroyRef).onDestroy(() => registry?.unregister(kind, id));\n return id;\n}\n\n/**\n * Marks the label element of a {@link CngxStat}. Its generated id leads the\n * molecule's `aria-labelledby`.\n *\n * @since 0.3.0\n * @relatedTo CngxStat\n */\n@Directive({\n selector: '[cngxStatLabel]',\n standalone: true,\n host: { '[id]': 'id' },\n})\nexport class CngxStatLabel {\n /** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */\n readonly id = useStatSlot('label');\n}\n\n/**\n * Marks the primary value element of a {@link CngxStat} (typically a\n * `<cngx-metric>`).\n *\n * @since 0.3.0\n * @relatedTo CngxStat\n */\n@Directive({\n selector: '[cngxStatValue]',\n standalone: true,\n host: { '[id]': 'id' },\n})\nexport class CngxStatValue {\n /** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */\n readonly id = useStatSlot('value');\n}\n\n/**\n * Marks the delta element of a {@link CngxStat} (typically a `<cngx-delta>`\n * or `<cngx-trend>`).\n *\n * @since 0.3.0\n * @relatedTo CngxStat\n */\n@Directive({\n selector: '[cngxStatDelta]',\n standalone: true,\n host: { '[id]': 'id' },\n})\nexport class CngxStatDelta {\n /** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */\n readonly id = useStatSlot('delta');\n}\n\n/**\n * Marks the caption element of a {@link CngxStat} - the trailing context\n * line (e.g. \"vs. last quarter\").\n *\n * @since 0.3.0\n * @relatedTo CngxStat\n */\n@Directive({\n selector: '[cngxStatCaption]',\n standalone: true,\n host: { '[id]': 'id' },\n})\nexport class CngxStatCaption {\n /** Auto-generated id bound to the host `[id]`; consumed by `CngxStat`. */\n readonly id = useStatSlot('caption');\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n type Signal,\n ViewEncapsulation,\n} from '@angular/core';\n\nimport { injectKpiI18n } from '../shared/kpi-i18n';\n\n/**\n * Determinate attainment bar - a continuous progress toward a target\n * (quota reached, budget spent, goal met). Named `CngxGoal` because\n * `cngx-progress` is the indeterminate async loading bar; this is the\n * finished-fraction indicator, distinct from that and from the discrete\n * `CngxSegmentedProgress`.\n *\n * Mirrors the `CngxSegmentedProgress` a11y shape: `role=\"progressbar\"` with\n * the whole `aria-value*` set plus `aria-valuetext` living in the `computed()`\n * graph (Pillar 2). The value is clamped to `[0, max]`; the fill width is a\n * derived percent bound as a CSS custom property.\n *\n * ```html\n * <cngx-goal [value]=\"73\" [max]=\"100\" label=\"Quota attainment\" />\n * <cngx-goal [value]=\"q()\" [max]=\"target()\" [valueTextFormat]=\"quotaText\" />\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/display/goal/goal.component.ts\n * @since 0.3.0\n * @relatedTo CngxSegmentedProgress, CngxMetric\n *\n * <example-url>/#/common/data/goal/quota-attainment</example-url>\n * @axis level atom\n */\n@Component({\n selector: 'cngx-goal',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'cngx-goal',\n role: 'progressbar',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuemax]': 'maxValue()',\n '[attr.aria-valuenow]': 'now()',\n '[attr.aria-valuetext]': 'valueText()',\n '[attr.aria-label]': 'label() ?? null',\n '[style.--cngx-goal-fill.%]': 'fillPercent()',\n },\n template: `<span class=\"cngx-goal__track\"><span class=\"cngx-goal__fill\"></span></span>`,\n styleUrls: ['./goal.component.css'],\n})\nexport class CngxGoal {\n private readonly i18n = injectKpiI18n();\n\n /** Current attainment. Clamped to `[0, max]`. */\n readonly value = input.required<number>();\n\n /** Target the value works toward. Defaults to `100`. */\n readonly max = input<number>(100);\n\n /**\n * Accessible name for the progressbar (what the attainment measures, e.g.\n * \"Quarterly quota\"). Mirrors the `label` input of the sibling KPI atoms;\n * omit it only when an external `aria-labelledby` (e.g. a `cngxStatLabel`)\n * names the bar instead.\n */\n readonly label = input<string | undefined>(undefined);\n\n /**\n * Override the `aria-valuetext` string. Receives `(now, max)` - the clamped\n * value and the target. Wins over the app-wide `CNGX_KPI_I18N.goalValueText`\n * (English default `(now, max) => \\`${now} of ${max}\\``). Supply a closure\n * for richer per-instance text (e.g.\n * `(n, m) => \\`${n} of ${m}, ${Math.round((n / m) * 100)}% of quota\\``).\n */\n readonly valueTextFormat = input<((now: number, max: number) => string) | undefined>(undefined);\n\n /** `aria-valuemax` - the target, floored at 0. */\n protected readonly maxValue: Signal<number> = computed(() => Math.max(0, this.max()));\n\n /** `aria-valuenow` - value clamped into `[0, max]`. */\n protected readonly now: Signal<number> = computed(() =>\n Math.max(0, Math.min(this.value(), this.maxValue())),\n );\n\n /** Fill width as a percent of the target; `0` when the target is `0`. */\n protected readonly fillPercent: Signal<number> = computed(() => {\n const max = this.maxValue();\n return max === 0 ? 0 : (this.now() / max) * 100;\n });\n\n /** `aria-valuetext` - human-readable attainment via the resolved closure. */\n protected readonly valueText: Signal<string> = computed(() => {\n const fmt = this.valueTextFormat() ?? this.i18n().goalValueText;\n return fmt(this.now(), this.maxValue());\n });\n}\n","import type { CngxMessage } from '@cngx/core/i18n';\n\n/**\n * The recycler section of a {@link CngxLanguagePack}: the screen-reader\n * announcements of a virtualised list.\n *\n * @since 0.3.0\n * @relatedTo CNGX_RECYCLER_I18N\n */\nexport interface CngxRecyclerLanguageSection {\n /** Plural on `{count}` (new items), with `{total}`: announced after a load. */\n readonly loaded: CngxMessage;\n /** Plural on `{count}`: announced when filter or search results change. */\n readonly filtered: CngxMessage;\n /** Announced when the list becomes empty. */\n readonly empty: string;\n /** Announced when loading fails. */\n readonly error: string;\n}\n\n/**\n * The English recycler section: the single source of the recycler's English\n * copy. `CNGX_RECYCLER_I18N` defaults to it.\n *\n * @since 0.3.0\n * @relatedTo CNGX_RECYCLER_I18N\n */\nexport const CNGX_RECYCLER_LANGUAGE_EN: CngxRecyclerLanguageSection = {\n loaded: {\n one: '{count} more item loaded. {total} total.',\n other: '{count} more items loaded. {total} total.',\n },\n filtered: { one: '{count} result found.', other: '{count} results found.' },\n empty: 'No results',\n error: 'Error loading data',\n};\n\ndeclare module '@cngx/core/i18n' {\n interface CngxLanguagePack {\n readonly recycler: CngxRecyclerLanguageSection;\n }\n}\n","/**\n * Result of a range computation for virtual scrolling.\n *\n * `start`/`end` are item indices. `offsetBefore`/`offsetAfter`/`totalSize` are pixels.\n * In grid mode, offsets are row-based (rows = ceil(totalCount / columns)).\n *\n * @internal\n */\nexport interface RangeResult {\n /** Start index (inclusive) of the visible range. */\n readonly start: number;\n /** End index (exclusive) of the visible range. */\n readonly end: number;\n /** Height of the spacer before visible items (px). */\n readonly offsetBefore: number;\n /** Height of the spacer after visible items (px). */\n readonly offsetAfter: number;\n /** Total height of all items (px). */\n readonly totalSize: number;\n}\n\nconst EMPTY_RANGE: RangeResult = {\n start: 0,\n end: 0,\n offsetBefore: 0,\n offsetAfter: 0,\n totalSize: 0,\n};\n\n/**\n * Computes the visible range of items given scroll position, viewport size,\n * total item count, and item size estimation.\n *\n * Pure function - no DOM access, no Angular dependency. Fully testable.\n *\n * @param scrollTop Current scroll offset in px.\n * @param clientHeight Viewport height in px.\n * @param totalCount Total number of items.\n * @param estimateSize Fixed item height in px, or a function returning height per index.\n * @param overscanBefore Extra items to render above the viewport (leading edge\n * when scrolling up).\n * @param columns Column count for grid mode (default 1). When > 1, range is row-aligned.\n * Variable `estimateSize` ignores columns (grid + variable heights not supported).\n * @param overscanAfter Extra items to render below the viewport (leading edge when\n * scrolling down). Defaults to `overscanBefore` for a symmetric range. Callers pass\n * an asymmetric pair to pre-render into the scroll direction.\n * @param maxLead Largest lead the caller ever adds to one overscan side. When set,\n * a list-mode window that reaches the last item holds the largest window the list\n * renders anywhere, so the scroll extent never shrinks on the way to the end.\n * Without it the window loses its trailing rows there, and WebKit pulls `scrollTop`\n * back by the height they took, on every step, so the last row stays out of reach.\n * @returns The computed range with spacer offsets.\n * @internal\n */\nexport function computeRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n estimateSize: number | ((index: number) => number),\n overscanBefore: number,\n columns = 1,\n overscanAfter = overscanBefore,\n maxLead?: number,\n): RangeResult {\n if (totalCount <= 0) {\n return EMPTY_RANGE;\n }\n\n if (clientHeight <= 0) {\n // Degenerate viewport (0px). A content-driven scrollport gets its height\n // FROM the spacers this result sizes, so reporting `totalSize: 0` here\n // deadlocks: no spacer, no height, no spacer. Report the full totalSize\n // with an empty window instead - the after-spacer gives the viewport its\n // height, the ResizeObserver-fed `clientHeight` turns non-zero, and the\n // next computation renders the real range.\n const totalSize = estimateTotalSize(totalCount, estimateSize, columns);\n return { start: 0, end: 0, offsetBefore: 0, offsetAfter: totalSize, totalSize };\n }\n\n if (typeof estimateSize === 'number') {\n return computeFixedRange(\n scrollTop,\n clientHeight,\n totalCount,\n estimateSize,\n overscanBefore,\n overscanAfter,\n columns,\n );\n }\n\n // variable heights: grid mode unsupported, columns ignored\n return computeVariableRange(\n scrollTop,\n clientHeight,\n totalCount,\n estimateSize,\n overscanBefore,\n overscanAfter,\n maxLead,\n );\n}\n\nfunction estimateTotalSize(\n totalCount: number,\n estimateSize: number | ((index: number) => number),\n columns: number,\n): number {\n if (typeof estimateSize === 'number') {\n const rows = columns > 1 ? Math.ceil(totalCount / columns) : totalCount;\n return rows * estimateSize;\n }\n // variable heights: grid mode unsupported, columns ignored (same contract\n // as computeVariableRange)\n let totalSize = 0;\n for (let i = 0; i < totalCount; i++) {\n totalSize += estimateSize(i);\n }\n return totalSize;\n}\n\nfunction computeFixedRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n itemSize: number,\n overscanBefore: number,\n overscanAfter: number,\n columns: number,\n): RangeResult {\n if (columns > 1) {\n return computeGridRange(\n scrollTop,\n clientHeight,\n totalCount,\n itemSize,\n overscanBefore,\n overscanAfter,\n columns,\n );\n }\n\n const totalSize = totalCount * itemSize;\n\n const rawStart = Math.floor(scrollTop / itemSize);\n const rawEnd = Math.ceil((scrollTop + clientHeight) / itemSize);\n\n const start = Math.max(0, rawStart - overscanBefore);\n const end = Math.min(totalCount, rawEnd + overscanAfter);\n\n return {\n start,\n end,\n offsetBefore: start * itemSize,\n offsetAfter: Math.max(0, (totalCount - end) * itemSize),\n totalSize,\n };\n}\n\n/**\n * Grid-mode range computation. Row-aligned before overscan.\n *\n * Order: raw visible rows → overscan rows → clamp → convert to item indices.\n * This ensures full rows are always rendered.\n *\n * @internal\n */\nfunction computeGridRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n rowHeight: number,\n overscanBefore: number,\n overscanAfter: number,\n columns: number,\n): RangeResult {\n const totalRows = Math.ceil(totalCount / columns);\n const totalSize = totalRows * rowHeight;\n\n // raw rows (inherently row-aligned)\n const rawStartRow = Math.floor(scrollTop / rowHeight);\n const rawEndRow = Math.ceil((scrollTop + clientHeight) / rowHeight);\n\n // overscan applied in rows so full rows always render\n const overscanRowsBefore = Math.ceil(overscanBefore / columns);\n const overscanRowsAfter = Math.ceil(overscanAfter / columns);\n const startRow = Math.max(0, rawStartRow - overscanRowsBefore);\n const endRow = Math.min(totalRows, rawEndRow + overscanRowsAfter);\n\n const start = startRow * columns;\n const end = Math.min(endRow * columns, totalCount);\n\n return {\n start,\n end,\n offsetBefore: startRow * rowHeight,\n offsetAfter: Math.max(0, (totalRows - endRow) * rowHeight),\n totalSize,\n };\n}\n\nfunction computeVariableRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n estimateSize: (index: number) => number,\n overscanBefore: number,\n overscanAfter: number,\n maxLead: number | undefined,\n): RangeResult {\n let totalSize = 0;\n const offsets = new Array<number>(totalCount + 1);\n offsets[0] = 0;\n\n for (let i = 0; i < totalCount; i++) {\n totalSize += estimateSize(i);\n offsets[i + 1] = totalSize;\n }\n\n // binary search: first item whose bottom edge is past scrollTop\n const rawStart = binarySearch(offsets, scrollTop, totalCount);\n const rawEnd = binarySearch(offsets, scrollTop + clientHeight, totalCount);\n\n const end = Math.min(totalCount, rawEnd + 1 + overscanAfter);\n const leadingStart = rawStart - overscanBefore;\n const endWindowStart = () => {\n const rowsInView = totalCount - binarySearch(offsets, totalSize - clientHeight, totalCount);\n const overscan = 2 * Math.min(overscanBefore, overscanAfter);\n return totalCount - (rowsInView + 1 + overscan + (maxLead ?? 0));\n };\n const holdsEndWindow = maxLead !== undefined && end === totalCount;\n const start = Math.max(0, holdsEndWindow ? Math.min(leadingStart, endWindowStart()) : leadingStart);\n\n return {\n start,\n end,\n offsetBefore: offsets[start],\n offsetAfter: Math.max(0, totalSize - offsets[end]),\n totalSize,\n };\n}\n\n/**\n * Finds the index of the first item whose cumulative offset exceeds `target`.\n *\n * @internal\n */\nfunction binarySearch(offsets: number[], target: number, totalCount: number): number {\n let low = 0;\n let high = totalCount - 1;\n\n while (low <= high) {\n const mid = (low + high) >>> 1;\n if (offsets[mid + 1] <= target) {\n low = mid + 1;\n } else if (offsets[mid] > target) {\n high = mid - 1;\n } else {\n return mid;\n }\n }\n\n return Math.min(low, totalCount - 1);\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n afterNextRender,\n type DestroyRef,\n type ElementRef,\n type Signal,\n effect,\n inject,\n signal,\n untracked,\n} from '@angular/core';\nimport { observeResize } from '@cngx/common/layout';\nimport { cngxDevWarn } from '@cngx/utils';\n\n/**\n * Reactive scroll state of a container element.\n * `scrollTop` is read synchronously on each scroll event so the rendered\n * range tracks scroll without an extra frame of latency; Angular's signal\n * scheduler coalesces a burst of events into one recompute per frame.\n * `clientHeight` updates from a ResizeObserver, not on scroll.\n * @internal\n */\nexport interface ScrollState {\n readonly scrollTop: Signal<number>;\n readonly clientHeight: Signal<number>;\n /** The resolved scroll container element, or `null` if not yet resolved. */\n readonly element: Signal<HTMLElement | null>;\n}\n\n/**\n * Creates a reactive scroll observer for a container element.\n *\n * Element resolution happens **lazily inside the effect**, not at call time.\n * This is critical because `injectRecycler` is called in a field initializer\n * where template DOM does not yet exist - `querySelector` would return `null`.\n * The effect runs after the first CD cycle when the DOM is stable.\n *\n * @internal Not exported from `@cngx/common/data` public API.\n */\nexport function createScrollObserver(\n elementRef: ElementRef | HTMLElement | string,\n destroyRef: DestroyRef,\n): ScrollState {\n const doc = inject(DOCUMENT);\n const scrollTopState = signal(0);\n const clientHeightState = signal(0);\n const elementState = signal<HTMLElement | null>(null);\n\n // Retry trigger - incremented by afterNextRender to re-run the effect\n // when the element wasn't found on the first attempt (routed components,\n // content projection, lazy rendering).\n const retryTick = signal(0);\n\n // Late-mount watcher for the string-selector path. A viewport gated behind\n // async data (or a skeleton->content swap) can mount many renders after the\n // one-shot afterNextRender retry fires, so a single retry misses it. This\n // observer bumps retryTick the instant the selector matches, then\n // disconnects. Created only in the unresolved-string case; stays null on\n // every faster path.\n let mutationObserver: MutationObserver | null = null;\n\n function disconnectMutationObserver(): void {\n mutationObserver?.disconnect();\n mutationObserver = null;\n }\n\n function attachListeners(el: HTMLElement, onCleanup: (fn: () => void) => void): void {\n // A viewport resolved: the late-mount watcher has done its job. Disconnect\n // it on attach so it can never outlive a resolved element - the node is\n // already in the DOM, so the observer would otherwise never fire again and\n // leak until destroy.\n disconnectMutationObserver();\n elementState.set(el);\n scrollTopState.set(el.scrollTop);\n clientHeightState.set(el.clientHeight);\n\n // Read scrollTop synchronously on the scroll event rather than deferring to\n // a requestAnimationFrame. The rAF hop delayed the range by a frame, so a\n // fast scroll outran the rendered window and flashed a blank strip. Scroll\n // events already fire at most once per frame, and the signal scheduler\n // coalesces bursts, so the synchronous read carries no extra recompute cost.\n const handleScroll = () => {\n scrollTopState.set(el.scrollTop);\n };\n\n el.addEventListener('scroll', handleScroll, { passive: true });\n\n const stopResize = observeResize(doc.defaultView, el, 'content-box', () => {\n clientHeightState.set(el.clientHeight);\n });\n\n onCleanup(() => {\n el.removeEventListener('scroll', handleScroll);\n stopResize();\n elementState.set(null);\n });\n }\n\n effect((onCleanup) => {\n retryTick(); // tracked: re-runs the effect after the retry tick bumps\n const el = resolveElement(elementRef, doc);\n if (!el) {\n return;\n }\n attachListeners(el, onCleanup);\n });\n\n // If the element wasn't found on the first effect run (before DOM is ready),\n // retry after the next render cycle. Fires for ALL input shapes - string\n // selectors resolve lazily via `querySelector`, but `ElementRef` from a\n // `viewChild` also starts out with `nativeElement == null` until Angular\n // resolves the query. `HTMLElement` inputs that are non-null at call time\n // short-circuit on the first effect run so the retry is a no-op.\n afterNextRender(() => {\n // untracked: afterNextRender may run in the same microtask as the effect.\n // Reading elementState() without untracked could create an unintended dependency\n // in whatever reactive context is active.\n if (untracked(() => elementState()) != null) {\n return;\n }\n // Element missing after the first render. Bump once for the common\n // next-render mount (routed component, content projection, lazy rendering).\n retryTick.update((v) => v + 1);\n\n // A string selector can still be unresolved because its viewport mounts\n // arbitrarily late - an async-gated list, a skeleton->content swap. Watch\n // the document and attach the instant it appears. Non-string refs\n // (HTMLElement / ElementRef) are not document-queryable, so the watcher\n // cannot help them; they stay on the single-retry path. Guard MutationObserver\n // for SSR.\n if (typeof elementRef !== 'string' || typeof MutationObserver === 'undefined') {\n return;\n }\n // Mounted between the first effect run and now: the bump above attaches it.\n if (resolveElement(elementRef, doc) != null) {\n return;\n }\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n cngxDevWarn(\n 'CNGX1013',\n `injectRecycler(): scrollElement '${elementRef}' not found on first render; ` +\n 'it will attach automatically once it mounts. If it never does, check the selector.',\n );\n }\n mutationObserver = new MutationObserver(() => {\n if (resolveElement(elementRef, doc) == null) {\n return;\n }\n // Found it. Disconnect before the retry bump so the resolving effect run\n // never observes a live-but-spent watcher, then let the effect attach.\n disconnectMutationObserver();\n retryTick.update((v) => v + 1);\n });\n mutationObserver.observe(doc.documentElement, { childList: true, subtree: true });\n });\n\n destroyRef.onDestroy(() => {\n disconnectMutationObserver();\n elementState.set(null);\n });\n\n return {\n scrollTop: scrollTopState.asReadonly(),\n clientHeight: clientHeightState.asReadonly(),\n element: elementState.asReadonly(),\n };\n}\n\nfunction resolveElement(ref: ElementRef | HTMLElement | string, doc: Document): HTMLElement | null {\n if (typeof ref === 'string') {\n return doc.querySelector<HTMLElement>(ref);\n }\n if (ref instanceof HTMLElement) {\n return ref;\n }\n // ElementRef\n return (ref?.nativeElement as HTMLElement | null) ?? null;\n}\n","import { type Signal, signal } from '@angular/core';\n\n/**\n * Signal-based cache mapping item index to measured height.\n *\n * The `version` signal increments on every `set()`, allowing any `computed()`\n * that reads `version()` to re-evaluate when measurements change.\n *\n * @internal Not exported from `@cngx/common/data` public API.\n */\nexport interface SizeCache {\n /** Get measured size for an index, or `undefined` if not yet measured. */\n get(index: number): number | undefined;\n /** Set measured size. Increments `version` to trigger recomputation. */\n set(index: number, size: number): void;\n /** Signal that increments on every `set()` - use as a dependency in `computed()`. */\n readonly version: Signal<number>;\n /** Get size for an index, falling back to `estimateSize` if not measured. */\n resolve(index: number, estimateSize: number | ((i: number) => number)): number;\n /** Number of measured entries. */\n readonly count: number;\n /** Clear all measurements. */\n clear(): void;\n}\n\n/**\n * Creates a signal-based size cache for measured item heights.\n *\n * @internal\n */\nexport function createSizeCache(): SizeCache {\n const cache = new Map<number, number>();\n const versionState = signal(0);\n\n return {\n get(index: number): number | undefined {\n return cache.get(index);\n },\n\n set(index: number, size: number): void {\n const current = cache.get(index);\n if (current === size) {\n return;\n }\n cache.set(index, size);\n versionState.update((v) => v + 1);\n },\n\n version: versionState.asReadonly(),\n\n resolve(index: number, estimateSize: number | ((i: number) => number)): number {\n const measured = cache.get(index);\n if (measured != null) {\n return measured;\n }\n return typeof estimateSize === 'number' ? estimateSize : estimateSize(index);\n },\n\n get count(): number {\n return cache.size;\n },\n\n clear(): void {\n if (cache.size === 0) {\n return;\n }\n cache.clear();\n versionState.update((v) => v + 1);\n },\n };\n}\n","import {\n DestroyRef,\n type ElementRef,\n InjectionToken,\n type Provider,\n type Signal,\n computed,\n effect,\n inject,\n isSignal,\n signal,\n untracked,\n} from '@angular/core';\nimport { clamp, cngxDevError, cngxDevWarn } from '@cngx/utils';\nimport type { CngxAsyncState } from '@cngx/core/utils';\nimport { createLanguageSection, createSectionBundle, formatMessage } from '@cngx/core/i18n';\nimport {\n createOverrideMerge,\n createTransitionTracker,\n createVisibilityGate,\n injectLoadingConfig,\n} from '@cngx/core/utils';\n\nimport {\n CNGX_RECYCLER_LANGUAGE_EN,\n type CngxRecyclerLanguageSection,\n} from '../i18n/recycler-language-section';\nimport { computeRange } from './range-computer';\nimport { createScrollObserver } from './scroll-observer';\nimport { createSizeCache } from './size-cache';\n\n/**\n * I18n interface for recycler SR announcements.\n * All methods return the announcement text. No hardcoded strings.\n */\nexport interface RecyclerI18n {\n /** Announced when new items are loaded (infinite scroll). */\n loaded(newCount: number, total: number): string;\n /** Announced when filter/search results change. */\n filtered(count: number): string;\n /** Announced when the list becomes empty. */\n empty(): string;\n /** Announced when loading fails. */\n error(): string;\n}\n\n/** @internal Turns a recycler section into the token's keys for a locale. */\nfunction recyclerBundleFrom(section: CngxRecyclerLanguageSection, locale: string): RecyclerI18n {\n return {\n loaded: (count, total) => formatMessage(section.loaded, { count, total }, locale),\n filtered: (count) => formatMessage(section.filtered, { count }, locale),\n empty: () => section.empty,\n error: () => section.error,\n };\n}\n\n/** @internal The recycler section of the active pack over English. */\nconst injectRecyclerSection = createLanguageSection('recycler', CNGX_RECYCLER_LANGUAGE_EN);\n\n/** @internal Builds and reads the token, formatted for the reading locale. */\nconst recyclerBundle = createSectionBundle<CngxRecyclerLanguageSection, RecyclerI18n>({\n section: injectRecyclerSection,\n toBundle: recyclerBundleFrom,\n});\n\n/**\n * Injection token for recycler SR announcement texts, a `Signal` so the\n * texts follow a runtime language switch. Defaults to the recycler section\n * of the active language pack over English, counts formatted for the app\n * locale. Override with `provideRecyclerI18n()`.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler.ts\n * @since 0.3.0\n */\nexport const CNGX_RECYCLER_I18N = new InjectionToken<Signal<RecyclerI18n>>('CngxRecyclerI18n', {\n factory: () => recyclerBundle.build(),\n});\n\n/**\n * A label override feature of `provideRecyclerI18n`.\n *\n * @since 0.3.0\n * @relatedTo CNGX_RECYCLER_I18N, withRecyclerI18nLabels\n */\nexport type CngxRecyclerI18nFeature = (bundle: Signal<RecyclerI18n>) => Signal<RecyclerI18n>;\n\n/**\n * Override recycler announcements via a partial bundle - keys you leave out\n * keep the language pack's text, or the English default. Pass a `Signal` to\n * switch the language at runtime.\n */\nexport function withRecyclerI18nLabels(\n overrides: Partial<RecyclerI18n> | Signal<Partial<RecyclerI18n>>,\n): CngxRecyclerI18nFeature {\n return (bundle) => createOverrideMerge(bundle, overrides);\n}\n\n/**\n * Provider for the recycler announcement texts. The features apply on top of\n * the active language pack.\n *\n * ```typescript\n * providers: [\n * provideRecyclerI18n(\n * withRecyclerI18nLabels({\n * empty: () => 'Keine Ergebnisse.',\n * error: () => 'Fehler beim Laden.',\n * }),\n * ),\n * ]\n * ```\n */\nexport function provideRecyclerI18n(...features: readonly CngxRecyclerI18nFeature[]): Provider {\n return {\n provide: CNGX_RECYCLER_I18N,\n useFactory: () => recyclerBundle.build(features),\n };\n}\n\n/**\n * Configuration for {@link injectRecycler}.\n */\nexport interface RecyclerConfig {\n /** Scroll container. CSS selector, native element, or `ElementRef`. */\n scrollElement: ElementRef | HTMLElement | string;\n\n /**\n * Total number of items. Reactive - changes on infinite scroll.\n *\n * **Important:** For infinite scroll, this is the number of *loaded* items,\n * not the server-side total. Otherwise the sentinel becomes unreachable.\n */\n totalCount: () => number;\n\n /**\n * Estimated height per item (px). A fixed `number`, a `Signal<number>` for a\n * reactive uniform estimate (e.g. an `input()` bound after construction), or a\n * `(index) => number` for genuine per-index variable heights. Only the last\n * form carries per-frame cost; a signal resolves to one uniform value.\n */\n estimateSize: number | Signal<number> | ((index: number) => number);\n\n /** Extra items to render above/below the viewport. Default: 5. */\n overscan?: number;\n\n /**\n * Layout mode. `'list'` (default) uses padding spacers.\n * `'grid'` is Phase 3 - passing it logs a dev-mode warning and falls back to `'list'`.\n */\n layout?: 'list' | 'grid';\n\n /** Column count for grid mode. Phase 3 - ignored in Phase 1. */\n columns?: number | (() => number);\n\n /** Debounce for scroll events in ms. Default: 16 (~1 frame). */\n scrollDebounce?: number;\n\n /**\n * Delay before skeletons are shown (ms). Overrides `CNGX_LOADING_CONFIG.showDelay`;\n * default is the config value. E.g. 300 means `showSkeleton` only becomes `true`\n * after 300ms - fast loads (< 300ms) never show a skeleton.\n */\n skeletonDelay?: number;\n\n /**\n * Minimum time (ms) a shown skeleton stays. Overrides\n * `CNGX_LOADING_CONFIG.minDwell`; default is the config value. `0` swaps the\n * skeleton for the rows as soon as the first load ends.\n */\n skeletonMinDwell?: number;\n\n /**\n * Async state source. When set, the recycler derives skeleton rendering,\n * refresh state, and empty state from it - same convention as\n * `CngxCardGrid`, `CngxTreetable`, `CngxPopoverPanel`, and `CngxDialog`.\n */\n state?: CngxAsyncState<unknown>;\n\n /**\n * Server-side total for A11y (`aria-setsize`) and \"Showing X of Y\" display.\n * When not set, `totalCount` is used.\n */\n serverTotal?: () => number;\n}\n\n/**\n * Signal-based virtualizer returned by {@link injectRecycler}.\n * All derived values are `computed()` - the system cannot become inconsistent.\n */\nexport interface CngxRecycler {\n /** Start index (inclusive) of the rendered range, including overscan. */\n readonly start: Signal<number>;\n /** End index (exclusive) of the rendered range, including overscan. */\n readonly end: Signal<number>;\n\n /** Spacer height before rendered items (px). Always 0 in grid mode. */\n readonly offsetBefore: Signal<number>;\n /** Spacer height after rendered items (px). Always 0 in grid mode. */\n readonly offsetAfter: Signal<number>;\n /** Total scrollable height of all items (px). */\n readonly totalSize: Signal<number>;\n\n /**\n * Representative row height (px) for a placeholder layer's repeat rhythm.\n * A numeric or `Signal<number>` `estimateSize` is already uniform, so it is\n * used verbatim; a per-index variable estimate has no single height, so the\n * average (`totalSize / totalCount`) stands in. Consumed by\n * {@link CngxRecyclerPlaceholder} to key its repeating skeleton interval off\n * the same rhythm the range uses. `0` on an empty list.\n */\n readonly rowSizeHint: Signal<number>;\n\n /** Placeholder count before rendered items. Only non-zero in grid mode. */\n readonly placeholdersBefore: Signal<number>;\n /** Placeholder count after rendered items. Only non-zero in grid mode. */\n readonly placeholdersAfter: Signal<number>;\n\n /** `true` during first load (`state.isFirstLoad()`). `false` without `state`. */\n readonly isLoading: Signal<boolean>;\n /** `true` during refresh (`state.isRefreshing()`). Data remains visible. */\n readonly isRefreshing: Signal<boolean>;\n /**\n * `true` when `totalCount === 0` and not busy. Stays `false` while the\n * first-load skeleton is held (`showSkeleton`), so an empty first load shows\n * the skeleton to its dwell, never an empty-then-skeleton flicker.\n */\n readonly isEmpty: Signal<boolean>;\n /** How many skeleton items fit in the viewport: `ceil(clientHeight / estimateSize)`. */\n readonly skeletonSlots: Signal<number>;\n /**\n * `isLoading` after the show delay, held for at least `minDwell`. Prevents\n * skeleton flicker on fast loads and a jarring disappearance on slow ones.\n */\n readonly showSkeleton: Signal<boolean>;\n\n /** First actually visible index (without overscan). For UI display. */\n readonly firstVisible: Signal<number>;\n /** Last actually visible index (without overscan). For UI display. */\n readonly lastVisible: Signal<number>;\n /** Count of actually visible items (without overscan). */\n readonly visibleCount: Signal<number>;\n\n /**\n * Locks scroll position relative to an item. When items are inserted above\n * the anchored item, `scrollTop` is corrected to maintain visual position.\n */\n anchorTo(index: number): void;\n /** Releases the scroll anchor set by {@link anchorTo}. */\n releaseAnchor(): void;\n\n /**\n * Reports the index of the item that had focus when it left the rendered range.\n * `null` when no focus was lost. Consumer can use this to restore focus.\n */\n readonly lostFocus: Signal<{ index: number } | null>;\n\n /** SR announcement text for state transitions (load, filter, empty, error). */\n readonly announcement: Signal<string>;\n\n /** `serverTotal` when set, otherwise `totalCount`. Bind to `aria-setsize`. */\n readonly ariaSetSize: Signal<number>;\n\n /**\n * The range of item indices that must be available for rendering.\n * Use in an effect to trigger page loads for windowed/sparse data sources.\n *\n * Unlike `firstVisible`/`lastVisible` (which exclude overscan), this includes\n * overscan items - all indices in this range may be rendered.\n *\n * ```typescript\n * effect(() => {\n * const { start, end } = recycler.neededRange();\n * const startPage = Math.floor(start / PAGE_SIZE);\n * const endPage = Math.floor(end / PAGE_SIZE);\n * for (let p = startPage; p <= endPage; p++) {\n * if (!pageCache.has(p)) { loadPage(p); }\n * }\n * });\n * ```\n */\n readonly neededRange: Signal<{ start: number; end: number }>;\n\n /**\n * Target index that `scrollToIndex()` is waiting for.\n * Non-null when the target index exceeds `totalCount` - consumer\n * can show a \"Scrolling to item...\" indicator or trigger page loads.\n * Clears automatically when `totalCount` grows past the target.\n */\n readonly pendingTarget: Signal<number | null>;\n\n /**\n * Creates a `computed()` slicing items to the visible range.\n * **Call once in a field initializer** - each call creates a new computed node.\n * Do NOT call in templates or methods.\n */\n sliced<T>(items: Signal<T[]>): Signal<T[]>;\n\n /**\n * Reports a measured item height to the internal SizeCache.\n * No-op in grid mode (uniform row height assumed).\n * Prefer {@link CngxMeasure} directive over calling this directly.\n */\n measure(index: number, element: HTMLElement): void;\n\n /**\n * Scrolls to a specific item index. When `index >= totalCount`, stores\n * the target in {@link pendingTarget} for resolution when data arrives.\n */\n scrollToIndex(index: number, behavior?: ScrollBehavior): void;\n\n /** Scrolls to top. Convenience for sort/filter changes. */\n reset(): void;\n}\n\n/**\n * Creates a Signal-based virtualizer for DOM recycling.\n *\n * Must be called in an injection context (field initializer or constructor).\n * Internally injects `DestroyRef` and `DOCUMENT` for cleanup and selector resolution.\n *\n * ### Basic list\n * ```typescript\n * readonly recycler = injectRecycler({\n * scrollElement: '.scroll-container',\n * totalCount: () => this.items().length,\n * estimateSize: 48,\n * });\n * readonly visibleItems = this.recycler.sliced(this.items);\n * ```\n *\n * ### With async state\n * ```typescript\n * readonly state = injectAsyncState(() => this.api.getAll());\n * readonly recycler = injectRecycler({\n * scrollElement: '.scroll-container',\n * totalCount: () => (this.state.data() ?? []).length,\n * estimateSize: 64,\n * state: this.state,\n * });\n * ```\n */\nexport function injectRecycler(config: RecyclerConfig): CngxRecycler {\n const destroyRef = inject(DestroyRef);\n const i18n = recyclerBundle.resolve(inject(CNGX_RECYCLER_I18N));\n const overscan = config.overscan ?? 5;\n const isGrid = (config.layout ?? 'list') === 'grid';\n\n if (typeof ngDevMode !== 'undefined' && ngDevMode && isGrid && config.columns == null) {\n cngxDevError(\n 'CNGX1011',\n 'injectRecycler(): layout: \"grid\" requires explicit `columns`. Falling back to columns=1.',\n );\n }\n\n // Reactive columns - reactive only if the function reads a Signal internally\n const columns = computed(() => {\n if (!isGrid || config.columns == null) {\n return 1;\n }\n return typeof config.columns === 'function' ? config.columns() : config.columns;\n });\n\n // A Signal is a zero-arg function but resolves to a uniform height, not a\n // per-index measurement - it carries no O(n) per-frame cost, so exclude it\n // from the variable-height warning (a reactive scalar estimate is a\n // sanctioned pattern; see the resolveSize note below).\n if (\n typeof ngDevMode !== 'undefined' &&\n ngDevMode &&\n typeof config.estimateSize === 'function' &&\n !isSignal(config.estimateSize)\n ) {\n const count = config.totalCount();\n if (count > 10_000) {\n cngxDevWarn(\n 'CNGX1012',\n `injectRecycler(): estimateSize as a function with ${count} items has O(n) ` +\n `per-frame cost. Consider using a fixed estimateSize for large datasets.`,\n );\n }\n }\n\n const scrollState = createScrollObserver(config.scrollElement, destroyRef);\n\n const sizeCache = createSizeCache();\n\n // Resolve size for an index: measured value from cache, or estimateSize fallback.\n // Reading sizeCache.version() creates a reactive dependency so that range\n // recomputes when measurements change.\n const resolveSize = (index: number): number => {\n sizeCache.version(); // track dependency\n return sizeCache.resolve(index, config.estimateSize);\n };\n\n // Signed scroll delta between consecutive scrollTop updates. A fast flick\n // produces large per-event deltas, so this doubles as a velocity proxy\n // regardless of whether scrollTop is sampled per-frame or per-event.\n const scrollVelocity = signal(0);\n let lastScrollTop = 0;\n effect(() => {\n const st = scrollState.scrollTop();\n untracked(() => {\n scrollVelocity.set(st - lastScrollTop);\n lastScrollTop = st;\n });\n });\n\n // Grid mode uses raw estimateSize (uniform row height, no SizeCache).\n // List mode uses resolveSize (SizeCache-backed).\n const range = computed(() => {\n const cols = columns();\n const size = isGrid ? config.estimateSize : resolveSize;\n const scrollTop = scrollState.scrollTop();\n const clientHeight = scrollState.clientHeight();\n const total = config.totalCount();\n\n // Directional overscan: the rendered range trails scroll by up to a frame,\n // so pre-render extra items into the scroll direction to keep the leading\n // edge populated (otherwise a fast scroll flashes a blank strip). Scale the\n // lead with velocity, capped at one viewport of items so a teleport jump\n // never expands the window unbounded. Trailing edge keeps the base overscan.\n const estimate = config.estimateSize;\n const uniform = isSignal(estimate) ? estimate() : estimate;\n const refPx =\n typeof uniform === 'number' && uniform > 0 ? uniform : Math.max(1, clientHeight / 8);\n const itemsPerViewport = Math.max(1, Math.ceil(clientHeight / refPx));\n const velocity = scrollVelocity();\n const leadItems = Math.min(Math.ceil(Math.abs(velocity) / refPx), itemsPerViewport);\n const scrollingDown = velocity >= 0;\n const overscanBefore = overscan + (scrollingDown ? 0 : leadItems);\n const overscanAfter = overscan + (scrollingDown ? leadItems : 0);\n\n return computeRange(\n scrollTop,\n clientHeight,\n total,\n size,\n overscanBefore,\n cols,\n overscanAfter,\n itemsPerViewport,\n );\n });\n\n const start = computed(() => range().start);\n const end = computed(() => range().end);\n\n // Grid mode: pixel spacers are 0 (placeholders used instead)\n const offsetBefore = computed(() => (isGrid ? 0 : range().offsetBefore));\n const offsetAfter = computed(() => (isGrid ? 0 : range().offsetAfter));\n const totalSize = computed(() => range().totalSize);\n\n // Representative row height for a placeholder layer's repeat interval. Derived,\n // never stored: a uniform estimate (number or signal) is the rhythm directly;\n // a per-index estimate has no single height, so the running average stands in.\n const rowSizeHint = computed(() => {\n const estimate = config.estimateSize;\n if (typeof estimate === 'number') {\n return estimate;\n }\n if (isSignal(estimate)) {\n return estimate();\n }\n const total = config.totalCount();\n if (total <= 0) {\n return 0;\n }\n return totalSize() / total;\n });\n\n const placeholdersBefore = computed(() => (isGrid ? start() : 0));\n const placeholdersAfter = computed(() => (isGrid ? Math.max(0, config.totalCount() - end()) : 0));\n\n // start/end include overscan. firstVisible/lastVisible strip it back\n // to reflect the items actually in the viewport.\n // In grid mode, overscan is in rows (ceil(overscan/columns) * columns items).\n const effectiveOverscan = computed(() => {\n const cols = columns();\n if (cols <= 1) {\n return overscan;\n }\n return Math.ceil(overscan / cols) * cols;\n });\n\n const firstVisible = computed(() => {\n const total = config.totalCount();\n if (total === 0) {\n return 0;\n }\n return Math.min(start() + effectiveOverscan(), total - 1);\n });\n\n const lastVisible = computed(() => {\n const total = config.totalCount();\n if (total === 0) {\n return 0;\n }\n return clamp(end() - effectiveOverscan() - 1, 0, total - 1);\n });\n\n const visibleCount = computed(() => {\n const total = config.totalCount();\n if (total === 0) {\n return 0;\n }\n return Math.max(0, lastVisible() - firstVisible() + 1);\n });\n\n const state = config.state;\n const isLoading = computed(() => state?.isFirstLoad() ?? false);\n const isRefreshing = computed(() => state?.isRefreshing() ?? false);\n\n const loading = injectLoadingConfig();\n // Declared before isEmpty so the empty state can wait on the held skeleton:\n // one truth for the template, no empty-then-skeleton flicker on first load.\n const showSkeleton = createVisibilityGate(\n isLoading,\n computed(() => config.skeletonDelay ?? loading.showDelay),\n computed(() => config.skeletonMinDwell ?? loading.minDwell),\n );\n\n const isEmpty = computed(() => {\n if (state?.isBusy() || showSkeleton()) {\n return false;\n }\n return config.totalCount() === 0;\n });\n\n const skeletonSlots = computed(() => {\n const ch = scrollState.clientHeight();\n if (ch <= 0) {\n return 0;\n }\n // Resolve estimateSize reactively - function variant may read signals internally\n const itemHeight =\n typeof config.estimateSize === 'number' ? config.estimateSize : config.estimateSize(0);\n return Math.ceil(ch / itemHeight);\n });\n\n // previousTotal is a signal, not a mutable let - reactive, no stale-value risk.\n const announcementState = signal('');\n const previousTotal = signal(config.totalCount());\n\n if (state) {\n const tracker = createTransitionTracker(() => state.status());\n\n effect(() => {\n const current = tracker.current();\n const previous = tracker.previous();\n const total = config.totalCount();\n // untracked: previousTotal is bookkeeping, not a dependency -\n // the effect should fire on status/totalCount changes, not on its own writes.\n const prevTotal = untracked(() => previousTotal());\n\n // Transition-only - never announce on initial idle\n if (previous === current) {\n return;\n }\n\n // Copy is read untracked: a language switch must not re-run the\n // effect and re-voice the region; the next transition speaks it.\n untracked(() => {\n const copy = i18n();\n // Route by result first: a load that settles with zero items is the\n // empty phrase, no matter which busy status preceded it - \"0 results\n // found\" is the filtered phrase, not the empty one.\n if (current === 'success' && total === 0) {\n announcementState.set(copy.empty());\n } else if (current === 'success' && (previous === 'loading' || previous === 'refreshing')) {\n const diff = total - prevTotal;\n announcementState.set(diff > 0 ? copy.loaded(diff, total) : copy.filtered(total));\n } else if (current === 'error') {\n announcementState.set(copy.error());\n }\n });\n\n untracked(() => previousTotal.set(total));\n });\n } else {\n // Without async state, track totalCount changes for infinite scroll announcements\n effect(() => {\n const total = config.totalCount();\n // untracked: previousTotal is bookkeeping, not a dependency\n const prevTotal = untracked(() => previousTotal());\n const diff = total - prevTotal;\n\n untracked(() => {\n const copy = i18n();\n if (prevTotal > 0 && diff > 0) {\n announcementState.set(copy.loaded(diff, total));\n } else if (prevTotal > 0 && total === 0) {\n announcementState.set(copy.empty());\n }\n });\n\n untracked(() => previousTotal.set(total));\n });\n }\n\n const ariaSetSize = computed(() => config.serverTotal?.() ?? config.totalCount());\n\n const anchorState = signal<{ index: number; offsetFromTop: number } | null>(null);\n\n function computeItemTop(targetIndex: number, cols?: number): number {\n // Grid mode: row-based offset (uniform row height)\n if (isGrid && typeof config.estimateSize === 'number') {\n const c = cols ?? columns();\n return Math.floor(targetIndex / c) * config.estimateSize;\n }\n let top = 0;\n for (let i = 0; i < targetIndex; i++) {\n top += sizeCache.resolve(i, config.estimateSize);\n }\n return top;\n }\n\n // Anchor correction effect: when items shift above the anchored item,\n // correct scrollTop to keep it at the same visual position.\n effect(() => {\n const anchor = anchorState();\n if (!anchor) {\n return;\n }\n sizeCache.version(); // re-run when sizes change\n config.totalCount(); // re-run when items change\n const cols = columns(); // re-run when columns change (responsive grid)\n const el = scrollState.element();\n if (!el) {\n return;\n }\n const currentItemTop = computeItemTop(anchor.index, cols);\n const targetScrollTop = currentItemTop - anchor.offsetFromTop;\n if (Math.abs(el.scrollTop - targetScrollTop) > 1) {\n el.scrollTop = targetScrollTop;\n }\n });\n\n // Tracks which item has focus inside the scroll container.\n // Uses `data-cngx-recycle-index` attribute on items (set by CngxMeasure or consumer).\n // When a focused item leaves the visible range, `lostFocus` reports its index.\n const focusedIndex = signal<number | null>(null);\n\n effect((onCleanup) => {\n const el = scrollState.element();\n if (!el) {\n return;\n }\n // Raw listeners do not get the null reactive consumer Angular gives its own\n // `(event)` bindings. Focus dropping inside a render pass (a select sheet\n // removing the listbox tabindex on rotation) runs them synchronously under\n // that template's consumer, where a bare signal write throws NG0600.\n const handleFocusIn = (e: FocusEvent): void => {\n const target = (e.target as HTMLElement).closest('[data-cngx-recycle-index]');\n if (target) {\n untracked(() => focusedIndex.set(Number(target.getAttribute('data-cngx-recycle-index'))));\n }\n };\n const handleFocusOut = (): void => {\n untracked(() => focusedIndex.set(null));\n };\n el.addEventListener('focusin', handleFocusIn);\n el.addEventListener('focusout', handleFocusOut);\n onCleanup(() => {\n el.removeEventListener('focusin', handleFocusIn);\n el.removeEventListener('focusout', handleFocusOut);\n });\n });\n\n const lostFocus = computed(() => {\n const fi = focusedIndex();\n if (fi == null) {\n return null;\n }\n const s = start();\n const e = end();\n if (fi < s || fi >= e) {\n return { index: fi };\n }\n return null;\n });\n\n const neededRange = computed(() => ({ start: start(), end: end() }));\n\n const pendingScrollTarget = signal<{ index: number; behavior: ScrollBehavior } | null>(null);\n const pendingTarget = computed(() => pendingScrollTarget()?.index ?? null);\n\n // Watch totalCount - when it grows past the pending target, execute the scroll.\n // Uses untracked() for pendingScrollTarget reads/writes to avoid write-inside-read loops.\n // Only totalCount is a tracked dependency.\n effect(() => {\n const total = config.totalCount(); // tracked dependency\n const target = untracked(() => pendingScrollTarget()); // NOT tracked\n if (!target || target.index >= total) {\n return;\n }\n untracked(() => {\n pendingScrollTarget.set(null);\n const el = scrollState.element();\n if (el) {\n const top = computeItemTop(target.index);\n el.scrollTo({ top, behavior: target.behavior });\n }\n });\n });\n\n return {\n start,\n end,\n offsetBefore,\n offsetAfter,\n totalSize,\n rowSizeHint,\n\n placeholdersBefore,\n placeholdersAfter,\n\n isLoading,\n isRefreshing,\n isEmpty,\n skeletonSlots,\n showSkeleton,\n\n firstVisible,\n lastVisible,\n visibleCount,\n\n anchorTo(index: number): void {\n const el = scrollState.element();\n if (!el) {\n return;\n }\n const itemTop = computeItemTop(index);\n anchorState.set({ index, offsetFromTop: itemTop - el.scrollTop });\n },\n\n releaseAnchor(): void {\n anchorState.set(null);\n },\n\n lostFocus,\n\n pendingTarget,\n neededRange,\n\n announcement: announcementState.asReadonly(),\n\n ariaSetSize,\n\n sliced<T>(items: Signal<T[]>): Signal<T[]> {\n return computed(() => items().slice(start(), end()));\n },\n\n measure(index: number, element: HTMLElement): void {\n // Grid mode assumes uniform row height - SizeCache writes would break row-based range.\n if (isGrid) {\n return;\n }\n const height = element.getBoundingClientRect().height;\n if (height > 0) {\n sizeCache.set(index, height);\n }\n },\n\n scrollToIndex(index: number, behavior: ScrollBehavior = 'auto'): void {\n const total = config.totalCount();\n if (index >= total) {\n // Deep-link: target not loaded yet - store for later resolution\n pendingScrollTarget.set({ index, behavior });\n return;\n }\n pendingScrollTarget.set(null);\n const el = scrollState.element();\n if (el) {\n el.scrollTo({ top: computeItemTop(index), behavior });\n }\n },\n\n reset(): void {\n const el = scrollState.element();\n if (el) {\n el.scrollTop = 0;\n }\n },\n };\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Directive, ElementRef, effect, inject, input } from '@angular/core';\nimport { observeResize } from '@cngx/common/layout';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Atom directive that measures the host element's height and reports it\n * to the recycler via `recycler.measure(index, element)`.\n *\n * Uses `ResizeObserver` to detect height changes (e.g. content expansion,\n * font loading). Cleanup is automatic via `DestroyRef`.\n *\n * Also sets `data-cngx-recycle-index` on the host element for focus tracking.\n *\n * ```html\n * @for (item of visibleItems(); track item.id; let i = $index) {\n * <div [cngxMeasure]=\"recycler\" [cngxMeasureIndex]=\"recycler.start() + i\">\n * {{ item.content }}\n * </div>\n * }\n * ```\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/measure.directive.ts\n * @since 0.3.0\n * @relatedTo CngxVirtualItem, CngxRecyclerAnnouncer, injectRecycler\n *\n * <example-url>/#/common/data/recycler/basic-list-fixed-item-height</example-url>\n * <example-url>/#/common/data/recycler/content-visibility-css-only</example-url>\n * <example-url>/#/common/data/recycler/infinite-scroll-recycler</example-url>\n * <example-url>/#/common/data/recycler/scrolltoindex-deep-link</example-url>\n * <example-url>/#/common/data/recycler/variable-heights-cngxmeasure</example-url>\n * <example-url>/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>\n */\n@Directive({\n selector: '[cngxMeasure]',\n standalone: true,\n host: {\n '[attr.data-cngx-recycle-index]': 'cngxMeasureIndex()',\n },\n})\nexport class CngxMeasure {\n /** The recycler instance to report measurements to. */\n readonly cngxMeasure = input.required<CngxRecycler>();\n\n /** The absolute index of this item in the full dataset. */\n readonly cngxMeasureIndex = input.required<number>();\n\n private readonly el = inject(ElementRef<HTMLElement>);\n private readonly win = inject(DOCUMENT).defaultView;\n\n constructor() {\n effect((onCleanup) => {\n const recycler = this.cngxMeasure();\n const index = this.cngxMeasureIndex();\n const element = this.el.nativeElement as HTMLElement;\n\n recycler.measure(index, element);\n\n // The observed element follows the inputs, so the subscription is\n // re-wired per effect run - the low-level kernel form, not the\n // DestroyRef-scoped one.\n onCleanup(\n observeResize(this.win, element, 'content-box', () => {\n recycler.measure(index, element);\n }),\n );\n });\n }\n}\n","import { Directive, computed, input } from '@angular/core';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * A11y atom that sets `aria-setsize`, `aria-posinset`, and `data-cngx-recycle-index`\n * on each rendered virtual item. Replaces manual ARIA boilerplate.\n *\n * Also provides `data-cngx-recycle-index` for focus tracking - consumers who\n * don't use `CngxMeasure` (grid mode, uniform heights) get focus tracking for free.\n *\n * Does NOT set `role` - the consumer decides (`listitem`, `option`, `treeitem`, `tab`).\n *\n * ```html\n * @for (item of visibleItems(); track item.id; let i = $index) {\n * <div role=\"listitem\"\n * [cngxVirtualItem]=\"recycler\"\n * [cngxVirtualItemIndex]=\"recycler.start() + i\">\n * {{ item.name }}\n * </div>\n * }\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/virtual-item.directive.ts\n * @since 0.3.0\n * @relatedTo CngxMeasure, CngxRecyclerAnnouncer, injectRecycler\n *\n * <example-url>/#/common/data/recycler/basic-list-fixed-item-height</example-url>\n * <example-url>/#/common/data/recycler/content-visibility-css-only</example-url>\n * <example-url>/#/common/data/recycler/infinite-scroll-recycler</example-url>\n * <example-url>/#/common/data/recycler/scrolltoindex-deep-link</example-url>\n * <example-url>/#/common/data/recycler/variable-heights-cngxmeasure</example-url>\n * <example-url>/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>\n */\n@Directive({\n selector: '[cngxVirtualItem]',\n standalone: true,\n host: {\n '[attr.aria-setsize]': 'ariaSetSize()',\n '[attr.aria-posinset]': 'ariaPosinset()',\n '[attr.data-cngx-recycle-index]': 'cngxVirtualItemIndex()',\n },\n})\nexport class CngxVirtualItem {\n /** The recycler instance providing `ariaSetSize`. */\n readonly cngxVirtualItem = input.required<CngxRecycler>();\n\n /** The absolute 0-based index of this item in the full dataset. */\n readonly cngxVirtualItemIndex = input.required<number>();\n\n /** Total item count for `aria-setsize`. */\n protected readonly ariaSetSize = computed(() => this.cngxVirtualItem().ariaSetSize());\n\n /** 1-based position for `aria-posinset`. */\n protected readonly ariaPosinset = computed(() => this.cngxVirtualItemIndex() + 1);\n}\n","import { DOCUMENT } from '@angular/common';\nimport { computed, DestroyRef, Directive, inject, input, type Signal } from '@angular/core';\nimport { createMediaQuerySignal } from '@cngx/core/utils';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Paints a row-aligned skeleton background under a virtualized scroll region so\n * a fast fling or teleport jump reveals placeholder bars instead of the bare\n * panel/page surface for the single frame the rendered rows lag `scrollTop`.\n *\n * The mechanism is a static CSS layer, not a reactive template: by the time a\n * `@for` over \"uncovered indices\" could render, change detection has already\n * produced the real rows, so the lag frame is never painted reactively. A\n * `background` on the offset element always paints and also covers teleport\n * jumps no reactive window can, at zero per-frame cost.\n *\n * Host it on the **offset spacer element(s)** - the empty divs (or presentation\n * `<li>`s) whose height reserves `offsetBefore` / `offsetAfter` - one directive\n * instance per spacer. Do NOT host it on a `padding-block`ed content element\n * that also contains the rows: a background paints across the whole padding box,\n * so it would show through *behind* every rendered row, not just in the gap.\n * The spacers carry no rows, so the layer is only ever visible where the window\n * has not caught up.\n *\n * The repeat interval keys off a single representative row height: bind the\n * recycler to read its `rowSizeHint`, or pass an explicit `[rowHeight]`\n * fallback so the directive is usable standalone. Visuals are driven by\n * `--cngx-recycler-placeholder-*` CSS custom properties (see\n * `@cngx/common/theming/components/cngx-recycler-placeholder.css`); the shimmer\n * drops under `prefers-reduced-motion` via a spec-observable host class.\n *\n * ### One instance per offset spacer, keyed off the recycler's rhythm\n * ```html\n * <ul>\n * @if (recycler.offsetBefore(); as before) {\n * <li role=\"presentation\" aria-hidden=\"true\"\n * [cngxRecyclerPlaceholder]=\"recycler\" [style.height.px]=\"before\"></li>\n * }\n * @for (item of visibleItems(); track item.id) { <li>...</li> }\n * @if (recycler.offsetAfter(); as after) {\n * <li role=\"presentation\" aria-hidden=\"true\"\n * [cngxRecyclerPlaceholder]=\"recycler\" [style.height.px]=\"after\"></li>\n * }\n * </ul>\n * ```\n *\n * ### Standalone with an explicit row height\n * ```html\n * <div cngxRecyclerPlaceholder [rowHeight]=\"48\"\n * [style.height.px]=\"recycler.offsetBefore()\"></div>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-placeholder.directive.ts\n * @since 0.3.0\n * @relatedTo injectRecycler, CngxRecyclerRow, CngxVirtualItem, CngxMeasure\n * <example-url>/#/common/data/recycler/fast-fling-placeholders</example-url>\n * @axis level molecule\n */\n@Directive({\n selector: '[cngxRecyclerPlaceholder]',\n standalone: true,\n host: {\n class: 'cngx-recycler-placeholder',\n // The layer is a decorative background on an offset spacer. Hide it from the\n // a11y tree at the host so it stays out regardless of the call site, not only\n // when a consumer remembers to add aria-hidden.\n 'aria-hidden': 'true',\n '[class.cngx-recycler-placeholder--shimmer]': 'showShimmer()',\n '[style.--cngx-recycler-placeholder-row-height]': 'rowHeightVar()',\n },\n})\nexport class CngxRecyclerPlaceholder {\n /**\n * The recycler whose `rowSizeHint` sets the placeholder repeat rhythm.\n * Optional: the directive also works from an explicit `[rowHeight]`, so this\n * follows the bridge-input shape (optional + empty-string transform) rather\n * than `input.required` - a bare `cngxRecyclerPlaceholder` attribute paired\n * with `[rowHeight]` is a valid, unbound usage.\n */\n readonly recycler = input<CngxRecycler | undefined, CngxRecycler | '' | undefined>(undefined, {\n alias: 'cngxRecyclerPlaceholder',\n transform: (value) => (typeof value === 'string' ? undefined : value),\n });\n\n /** Explicit row height (px) used when no recycler is bound, or as a fallback. */\n readonly rowHeight = input<number | undefined>(undefined);\n\n private readonly prefersReducedMotion: Signal<boolean>;\n\n constructor() {\n this.prefersReducedMotion = createMediaQuerySignal(\n '(prefers-reduced-motion: reduce)',\n inject(DestroyRef),\n inject(DOCUMENT).defaultView,\n );\n }\n\n /**\n * Representative row height (px) for the repeat interval. The recycler's\n * `rowSizeHint` wins when it resolves to a positive value; otherwise the\n * explicit `[rowHeight]` fallback applies.\n */\n protected readonly resolvedRowHeight = computed(() => {\n const fromRecycler = this.recycler()?.rowSizeHint() ?? 0;\n if (fromRecycler > 0) {\n return fromRecycler;\n }\n return this.rowHeight() ?? 0;\n });\n\n /**\n * The `--cngx-recycler-placeholder-row-height` style value. `null` when no\n * row height resolves, so the registered `@property` default (or an inherited\n * token from an ancestor mapping) applies instead of a broken `0px` interval.\n */\n protected readonly rowHeightVar = computed(() => {\n const height = this.resolvedRowHeight();\n return height > 0 ? `${height}px` : null;\n });\n\n /** Whether the shimmer host class is applied (dropped under reduced-motion). */\n protected readonly showShimmer = computed(() => !this.prefersReducedMotion());\n}\n","import {\n DestroyRef,\n Directive,\n effect,\n type EmbeddedViewRef,\n inject,\n InjectionToken,\n input,\n type Provider,\n Renderer2,\n TemplateRef,\n untracked,\n ViewContainerRef,\n} from '@angular/core';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Context for the placeholder branch of `*cngxRecyclerRow` - the window slot\n * whose item has not loaded yet (`undefined`). A custom `placeholder:` template\n * reads this to keep the list count honest for assistive technology:\n * `aria-posinset = index + 1`, `aria-setsize = setSize`.\n *\n * The real-row branch (item defined) binds `$implicit` to the item value\n * instead; that context is internal and narrowed by `ngTemplateContextGuard`.\n */\nexport interface CngxRecyclerRowContext {\n /** The absolute dataset index of this slot. Alias of `index`. */\n $implicit: number;\n /** The absolute dataset index of this slot. */\n index: number;\n /** Pixel offset of the slot from the top of the scroll content. */\n top: number;\n /** Total set size (`recycler.ariaSetSize()`) for `aria-setsize`. */\n setSize: number;\n}\n\n/** Internal real-row context: the loaded item at this window position. */\ninterface CngxRecyclerRowRealContext<T> {\n $implicit: T;\n cngxRecyclerRow: T;\n}\n\n/**\n * App-wide default placeholder template for `*cngxRecyclerRow`. Middle rung of\n * the cascade: microsyntax `placeholder:` template wins over this, and this wins\n * over the built-in imperative `<li>` default. Defaults to `null` (imperative\n * default applies).\n */\nexport const CNGX_RECYCLER_PLACEHOLDER_ROW = new InjectionToken<\n TemplateRef<CngxRecyclerRowContext> | null\n>('CNGX_RECYCLER_PLACEHOLDER_ROW', { providedIn: 'root', factory: () => null });\n\n/**\n * Provides an app-wide default placeholder template for every `*cngxRecyclerRow`\n * that supplies no `placeholder:` template of its own.\n */\nexport function provideRecyclerPlaceholderRow(\n template: TemplateRef<CngxRecyclerRowContext>,\n): Provider {\n return { provide: CNGX_RECYCLER_PLACEHOLDER_ROW, useValue: template };\n}\n\n/**\n * Per-window-position render switch for a sparse/windowed recycler: renders the\n * consumer's real-row template when the sliced item is defined, and a\n * placeholder branch when the item is still `undefined` (loaded window, data\n * not yet resolved).\n *\n * Mirrors the `*cngxAsync` structural-directive shape (own `TemplateRef` +\n * microsyntax alternate template + `ngTemplateContextGuard`). The switch axis is\n * data availability, not async status, so the two are siblings, not the same\n * class. Unlike `*cngxAsync` (which clears on every switch) the real-row view is\n * cached and re-attached across a placeholder detour, so a\n * defined -> undefined -> defined flip never remounts the expensive real row.\n *\n * The placeholder branch resolves through a 3-stage cascade: the microsyntax\n * `placeholder:` template, then {@link CNGX_RECYCLER_PLACEHOLDER_ROW}, then a\n * built-in imperative `<li>` default. The default assumes a `<ul>`/`<li>` list;\n * a non-`<li>` container (`<div role=\"list\">`) supplies a `placeholder:`\n * template or the config token instead.\n *\n * The two placeholder layers are orthogonal and non-overlapping by\n * construction: {@link CngxRecyclerPlaceholder} paints a decorative background\n * on the offset spacers (indices outside the rendered window), while this\n * directive fills holes inside the window whose item is still `undefined`.\n *\n * ### Windowed list with the built-in placeholder row\n * ```html\n * <ul>\n * @for (item of visibleItems(); track item?.id ?? ('ph:' + (recycler.start() + $index)); let i = $index) {\n * <li *cngxRecyclerRow=\"item; index: recycler.start() + i; recycler: recycler; let row\">\n * {{ row?.name }}\n * </li>\n * }\n * </ul>\n * ```\n *\n * ### Custom placeholder template\n * ```html\n * <ul>\n * @for (item of visibleItems(); track item?.id ?? ('ph:' + (recycler.start() + $index)); let i = $index) {\n * <li *cngxRecyclerRow=\"item; index: recycler.start() + i; recycler: recycler; placeholder: ph; let row\">\n * {{ row?.name }}\n * </li>\n * }\n * <ng-template #ph let-index let-setSize=\"setSize\">\n * <li role=\"listitem\" aria-busy=\"true\" [attr.aria-posinset]=\"index + 1\" [attr.aria-setsize]=\"setSize\">\n * Loading row {{ index + 1 }}\n * </li>\n * </ng-template>\n * </ul>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-row.directive.ts\n * @since 0.3.0\n * @relatedTo injectRecycler, CngxRecyclerPlaceholder, CngxVirtualItem, CngxMeasure\n * <example-url>/#/common/data/recycler/windowed-data-availability</example-url>\n * @axis level molecule\n */\n@Directive({\n selector: '[cngxRecyclerRow]',\n standalone: true,\n})\nexport class CngxRecyclerRow<T> {\n private readonly vcr = inject(ViewContainerRef);\n private readonly rowTpl = inject<TemplateRef<CngxRecyclerRowRealContext<T>>>(TemplateRef);\n private readonly renderer = inject(Renderer2);\n private readonly configTpl = inject(CNGX_RECYCLER_PLACEHOLDER_ROW);\n\n /** The sliced item at this window position. `undefined` selects the placeholder branch. */\n readonly cngxRecyclerRow = input<T | undefined>(undefined);\n\n /** Absolute dataset index of this slot (`recycler.start() + $index`). */\n readonly cngxRecyclerRowIndex = input.required<number>();\n\n /** The recycler driving the window, read for `rowSizeHint` (-> `top`) and `ariaSetSize`. */\n readonly cngxRecyclerRowRecycler = input.required<CngxRecycler>();\n\n /** Optional placeholder template for the `undefined` branch. Context: {@link CngxRecyclerRowContext}. */\n readonly cngxRecyclerRowPlaceholder = input<TemplateRef<CngxRecyclerRowContext> | undefined>(\n undefined,\n );\n\n // Plain fields, not signals: read and written only inside the render effect.\n // As signals they would feed the effect's own dependency graph and double-fire\n // per branch switch (the trap documented in async.directive.ts).\n private currentBranch: 'row' | 'placeholder' | 'none' = 'none';\n private rowViewRef: EmbeddedViewRef<CngxRecyclerRowRealContext<T>> | null = null;\n private placeholderViewRef: EmbeddedViewRef<CngxRecyclerRowContext> | null = null;\n private defaultEl: HTMLElement | null = null;\n\n constructor() {\n effect(() => {\n const item = this.cngxRecyclerRow();\n if (item === undefined) {\n // Placeholder branch tracks index + ariaSetSize (via buildPlaceholderContext)\n // so the announced position/size stay live while the slot remains unloaded\n // across a window shift or an infinite-scroll setSize growth - Pillar 2\n // keeps a11y in the reactive graph, never a one-time write. The row branch\n // tracks only the item value; the placeholder template ref is read untracked.\n this.showPlaceholder(this.buildPlaceholderContext());\n } else {\n this.showRow(item);\n }\n });\n\n inject(DestroyRef).onDestroy(() => {\n // The cached row view may be detached (not owned by the VCR), so the VCR\n // will not tear it down; destroy both views explicitly, guarding the\n // already-destroyed case when the VCR got there first.\n if (this.rowViewRef && !this.rowViewRef.destroyed) {\n this.rowViewRef.destroy();\n }\n this.teardownPlaceholder();\n });\n }\n\n private showRow(item: T): void {\n if (this.currentBranch === 'row') {\n this.setRowContext(item);\n this.rowViewRef?.markForCheck();\n return;\n }\n this.teardownPlaceholder();\n if (this.rowViewRef) {\n this.setRowContext(item);\n this.vcr.insert(this.rowViewRef);\n this.rowViewRef.markForCheck();\n } else {\n this.rowViewRef = this.vcr.createEmbeddedView(this.rowTpl, {\n $implicit: item,\n cngxRecyclerRow: item,\n });\n }\n this.currentBranch = 'row';\n }\n\n private showPlaceholder(ctx: CngxRecyclerRowContext): void {\n if (this.currentBranch === 'placeholder') {\n this.refreshPlaceholder(ctx);\n return;\n }\n this.detachRow();\n this.renderPlaceholder(ctx);\n this.currentBranch = 'placeholder';\n }\n\n private setRowContext(item: T): void {\n if (this.rowViewRef) {\n this.rowViewRef.context.$implicit = item;\n this.rowViewRef.context.cngxRecyclerRow = item;\n }\n }\n\n // Remove the cached row view from the container WITHOUT destroying it, so the\n // next 'row' branch re-attaches the same EmbeddedViewRef (no remount).\n private detachRow(): void {\n if (!this.rowViewRef) {\n return;\n }\n const at = this.vcr.indexOf(this.rowViewRef);\n if (at !== -1) {\n this.vcr.detach(at);\n }\n }\n\n private teardownPlaceholder(): void {\n if (this.placeholderViewRef) {\n this.placeholderViewRef.destroy();\n this.placeholderViewRef = null;\n }\n this.removeDefault();\n }\n\n private renderPlaceholder(ctx: CngxRecyclerRowContext): void {\n const tpl = untracked(() => this.cngxRecyclerRowPlaceholder()) ?? this.configTpl ?? null;\n if (tpl) {\n this.placeholderViewRef = this.vcr.createEmbeddedView(tpl, ctx);\n } else {\n this.stampDefault(ctx);\n }\n }\n\n // Slot stayed unloaded but its index/setSize moved: refresh the live a11y\n // position/size in place - custom template context or default element attrs -\n // without remounting the placeholder.\n private refreshPlaceholder(ctx: CngxRecyclerRowContext): void {\n if (this.placeholderViewRef) {\n const context = this.placeholderViewRef.context;\n context.$implicit = ctx.$implicit;\n context.index = ctx.index;\n context.top = ctx.top;\n context.setSize = ctx.setSize;\n this.placeholderViewRef.markForCheck();\n } else if (this.defaultEl) {\n this.applyDefaultAttrs(this.defaultEl, ctx);\n }\n }\n\n // Terminal fallback: a module-level TemplateRef cannot exist, so the built-in\n // default is one imperative <li> reusing the shipped `cngx-recycler-placeholder`\n // ghost-row CSS. It holds a real dataset position, so it stays in the a11y tree\n // (aria-busy / role=listitem / posinset / setsize) - never aria-hidden.\n private stampDefault(ctx: CngxRecyclerRowContext): void {\n const anchor = this.vcr.element.nativeElement as Node;\n const parent = this.renderer.parentNode(anchor) as Node | null;\n if (!parent) {\n return;\n }\n const li = this.renderer.createElement('li') as HTMLElement;\n this.renderer.addClass(li, 'cngx-recycler-placeholder');\n this.renderer.setAttribute(li, 'role', 'listitem');\n this.renderer.setAttribute(li, 'aria-busy', 'true');\n this.applyDefaultAttrs(li, ctx);\n this.renderer.insertBefore(parent, li, anchor);\n this.defaultEl = li;\n }\n\n private applyDefaultAttrs(li: HTMLElement, ctx: CngxRecyclerRowContext): void {\n const height = untracked(() => this.cngxRecyclerRowRecycler().rowSizeHint());\n this.renderer.setAttribute(li, 'aria-posinset', String(ctx.index + 1));\n this.renderer.setAttribute(li, 'aria-setsize', String(ctx.setSize));\n this.renderer.setStyle(li, 'height', `${height}px`);\n this.renderer.setStyle(li, '--cngx-recycler-placeholder-row-height', `${height}px`);\n }\n\n private removeDefault(): void {\n if (!this.defaultEl) {\n return;\n }\n const parent = this.renderer.parentNode(this.defaultEl) as Node | null;\n if (parent) {\n this.renderer.removeChild(parent, this.defaultEl);\n }\n this.defaultEl = null;\n }\n\n // Called only from the placeholder branch of the render effect: reading index\n // + ariaSetSize here (tracked) is what keeps the announced position/size\n // reactive. rowSizeHint is a stable layout hint, read untracked for `top`.\n private buildPlaceholderContext(): CngxRecyclerRowContext {\n const index = this.cngxRecyclerRowIndex();\n const recycler = this.cngxRecyclerRowRecycler();\n const setSize = recycler.ariaSetSize();\n const top = untracked(() => recycler.rowSizeHint()) * index;\n return { $implicit: index, index, top, setSize };\n }\n\n /** Narrows the directive's own template context to the loaded item type. */\n static ngTemplateContextGuard<T>(\n _dir: CngxRecyclerRow<T>,\n _ctx: unknown,\n ): _ctx is CngxRecyclerRowRealContext<T> {\n return true;\n }\n}\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Convenience component that renders the `aria-live=\"polite\"` region\n * for recycler SR announcements. Eliminates manual boilerplate.\n *\n * Uses `display: contents` - no layout impact.\n *\n * ```html\n * <cngx-recycler-announcer [cngxRecyclerAnnouncer]=\"recycler\" />\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/recycler/recycler-announcer.component.ts\n * @since 0.3.0\n * @relatedTo CngxMeasure, CngxVirtualItem, injectRecycler, CNGX_RECYCLER_I18N\n *\n * <example-url>/#/common/data/recycler/basic-list-fixed-item-height</example-url>\n * <example-url>/#/common/data/recycler/content-visibility-css-only</example-url>\n * <example-url>/#/common/data/recycler/infinite-scroll-recycler</example-url>\n * <example-url>/#/common/data/recycler/scrolltoindex-deep-link</example-url>\n * <example-url>/#/common/data/recycler/variable-heights-cngxmeasure</example-url>\n * <example-url>/#/common/data/recycler/with-cngxasyncstate-skeleton-first-load</example-url>\n */\n@Component({\n selector: 'cngx-recycler-announcer',\n standalone: true,\n template: `<span aria-live=\"polite\" aria-atomic=\"true\" class=\"cngx-sr-only\">{{\n recycler().announcement()\n }}</span>`,\n host: { style: 'display: contents' },\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CngxRecyclerAnnouncer {\n /** The recycler instance providing `announcement()`. */\n readonly recycler = input.required<CngxRecycler>({ alias: 'cngxRecyclerAnnouncer' });\n}\n","import { ElementRef, effect, inject, untracked } from '@angular/core';\n// type-only: instance is passed in by the consumer via inject(..., { host: true })\nimport type { CngxRovingTabindex } from '@cngx/common/a11y';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Wires a `CngxRecycler` to a `CngxRovingTabindex` in virtual mode.\n *\n * When the roving tabindex navigates to an item that is not in the DOM\n * (out of rendered range), this function scrolls the recycler to that item\n * and focuses it after rendering.\n *\n * Must be called in an injection context (constructor or field initializer)\n * **on the component that hosts both the recycler's scroll container and the\n * `CngxRovingTabindex` directive**. The injected `ElementRef` is used to query\n * `[data-cngx-recycle-index]` - calling from a child component would query the\n * wrong subtree.\n *\n * ```typescript\n * @Component({\n * hostDirectives: [\n * { directive: CngxRovingTabindex, inputs: ['orientation', 'activeIndex', 'virtualCount'] },\n * ],\n * })\n * class MyVirtualList {\n * private readonly roving = inject(CngxRovingTabindex, { host: true });\n * readonly recycler = injectRecycler({ ... });\n *\n * constructor() {\n * connectRecyclerToRoving(this.recycler, this.roving);\n * }\n * }\n * ```\n */\nexport function connectRecyclerToRoving(recycler: CngxRecycler, roving: CngxRovingTabindex): void {\n const hostEl = inject(ElementRef).nativeElement as HTMLElement;\n\n // Debounce scrollToIndex via rAF to avoid scroll jitter on rapid keypresses.\n // Each keypress overwrites pendingFocus - only the latest target is scrolled to.\n let scrollRafId: number | null = null;\n\n effect((onCleanup) => {\n const target = roving.pendingFocus();\n if (target == null) {\n return;\n }\n if (scrollRafId != null) {\n cancelAnimationFrame(scrollRafId);\n }\n scrollRafId = requestAnimationFrame(() => {\n scrollRafId = null;\n // Re-read to get the latest target (rapid keypresses may have updated it).\n const latest = roving.pendingFocus();\n if (latest != null) {\n recycler.scrollToIndex(latest);\n }\n });\n onCleanup(() => {\n if (scrollRafId != null) {\n cancelAnimationFrame(scrollRafId);\n scrollRafId = null;\n }\n });\n });\n\n // When the recycler's range changes and the pending target is within range,\n // wait for the DOM to update (rAF), then query and focus the element.\n let focusRafId: number | null = null;\n\n effect((onCleanup) => {\n const s = recycler.start();\n const e = recycler.end();\n const target = untracked(() => roving.pendingFocus());\n if (target == null || target < s || target >= e) {\n return;\n }\n\n // Target is within rendered range - DOM will be updated after CD.\n // Use rAF to wait for Angular's rendering pass to complete.\n focusRafId = requestAnimationFrame(() => {\n focusRafId = null;\n // Re-read pendingFocus in case it changed during the frame (rapid keypresses).\n const currentTarget = roving.pendingFocus();\n if (currentTarget == null) {\n return;\n }\n const el = hostEl.querySelector(`[data-cngx-recycle-index=\"${currentTarget}\"]`);\n if (el instanceof HTMLElement) {\n el.focus();\n roving.clearPendingFocus();\n }\n });\n\n onCleanup(() => {\n if (focusRafId != null) {\n cancelAnimationFrame(focusRafId);\n focusRafId = null;\n }\n });\n });\n}\n","import { effect, untracked } from '@angular/core';\n\n// type-only: passed in by the consumer at runtime, so @cngx/common/data\n// avoids a value-level dep on a11y\nimport type { CngxActiveDescendant } from '@cngx/common/a11y';\n\nimport type { CngxRecycler } from './recycler';\n\n/**\n * Wires a {@link CngxRecycler} to a {@link CngxActiveDescendant} in\n * virtual mode.\n *\n * When the AD directive navigates to an item whose index is not in the\n * recycler's rendered range, it sets `pendingHighlight` (via the\n * `virtualCount` path). This helper watches that signal and scrolls\n * the recycler to the target index; AD clears the pending state on its\n * own once a re-render brings the target into the rendered range, and\n * does not raise it again when the window later moves away from an\n * unchanged highlight, so a scroll by the user is never pulled back.\n *\n * Unlike {@link /projects/common/data/src/recycler/connect-recycler-roving.ts\n * connectRecyclerToRoving}, we don't re-focus a DOM element after the\n * scroll - AD doesn't move real focus, it only rebinds\n * `aria-activedescendant`. Once the target index enters the rendered\n * range, the `[attr.aria-activedescendant]` binding on the combobox\n * trigger resolves to the now-present option element for free.\n *\n * Must be called in an injection context (typically a component\n * constructor) on the same component that owns both the recycler\n * and the AD directive.\n *\n * ```typescript\n * @Component({\n * hostDirectives: [\n * { directive: CngxActiveDescendant, inputs: ['items', 'virtualCount', 'windowStart'] },\n * ],\n * })\n * class MyVirtualSelect {\n * private readonly ad = inject(CngxActiveDescendant, { host: true });\n * readonly recycler = injectRecycler({ ... });\n *\n * constructor() {\n * connectRecyclerToActiveDescendant(this.recycler, this.ad);\n * }\n * }\n * ```\n */\nexport function connectRecyclerToActiveDescendant(\n recycler: CngxRecycler,\n ad: CngxActiveDescendant,\n): void {\n // rAF-debounced: held ArrowDown otherwise enqueues one scroll per keystroke.\n // Each new pending target overwrites the previous rAF, only the latest lands.\n let scrollRafId: number | null = null;\n\n effect((onCleanup) => {\n const target = ad.pendingHighlight();\n if (target == null) {\n return;\n }\n if (scrollRafId != null) {\n cancelAnimationFrame(scrollRafId);\n }\n scrollRafId = requestAnimationFrame(() => {\n scrollRafId = null;\n // re-read inside the frame so the latest target wins if the user kept typing\n const latest = untracked(() => ad.pendingHighlight());\n if (latest != null) {\n recycler.scrollToIndex(latest);\n }\n });\n onCleanup(() => {\n if (scrollRafId != null) {\n cancelAnimationFrame(scrollRafId);\n scrollRafId = null;\n }\n });\n });\n}\n","import { computed, signal, type Signal } from '@angular/core';\n\nimport { createManualState, type ManualAsyncState } from '../async-state';\nimport { CNGX_DEV_DESCRIPTORS, type CngxAsyncState } from '@cngx/core/utils';\n\n/**\n * Cancel handle returned by a {@link CngxCommitRunner}. The controller\n * stores it on every `begin(...)` and calls `cancel()` synchronously\n * when a newer commit supersedes it. Action runtimes (RxJS subscription\n * teardown, AbortController abort, plain flag) implement the handle\n * however they need.\n */\nexport interface CngxCommitHandle {\n readonly cancel: () => void;\n}\n\n/**\n * Action runner contract. Receives the controller's success / error /\n * refused routes and returns a cancel handle. The runner is opaque to the\n * controller - it can wrap any async source (Observable, Promise,\n * sync value) and any cancellation primitive.\n *\n * Variants supply their own runner adapter (e.g. select's\n * `runCommitAction` invokes a `CngxSelectCommitAction<T>`; stepper's\n * runner adapts a `CngxStepperCommitAction`); the controller has no\n * knowledge of the variant-specific action shape.\n *\n * `onRefused` is for an action that declined on purpose (a `false`\n * answer): nothing changed, so the controller stores no error. A runner\n * whose action shape has no refusal (the select family) never calls it.\n */\nexport type CngxCommitRunner<T> = (handlers: {\n readonly onSuccess: (committed: T | undefined) => void;\n readonly onError: (err: unknown) => void;\n readonly onRefused: () => void;\n}) => CngxCommitHandle;\n\n/**\n * Outcome handlers passed to `controller.begin(...)`. The controller\n * invokes exactly one of `onSuccess` / `onError` / `onRefused` per\n * commit lifecycle (unless the commit is superseded, in which case none\n * fires). `onRefused` is optional because only families whose action can\n * refuse (the stepper) route it; when it is omitted a refusal still\n * settles the state slot.\n */\nexport interface CngxCommitBeginHandlers<T> {\n readonly onSuccess: (committed: T | undefined) => void;\n readonly onError: (err: unknown, previous: T | undefined) => void;\n readonly onRefused?: (previous: T | undefined) => void;\n}\n\n/**\n * Encapsulated state machine for the async-commit lifecycle shared by\n * every cngx feature that has a \"perform-an-async-write-then-update-\n * the-source-signal\" flow (select family, stepper, future wizards).\n *\n * Owns:\n * - the `CngxAsyncState<T | undefined>` slot consumed by `CNGX_STATEFUL`\n * bridges, commit-error templates, and the pending-row spinner;\n * - begin / cancel orchestration with monotonic supersede semantics;\n * - the \"intended value\" signal that drives the pending-spinner on\n * the specific row / step the user just clicked.\n *\n * Three outcomes settle a commit. Success stores the committed value.\n * Failure stores the error (`'error'`). A refusal - the action answered\n * `false` - goes back to `'idle'` through `setIdle()`: the error and the\n * intended value are cleared, while `data`, `lastUpdated` and\n * `isFirstLoad()` keep what the last success left, because a refusal\n * changed nothing. A custom controller (`CNGX_COMMIT_CONTROLLER_FACTORY`)\n * must hand the runner an `onRefused` route and forward it to\n * `handlers.onRefused`.\n *\n * The controller is intentionally **not** an Angular service or\n * provider. It's a plain factory so it works in any injection context\n * (including outside Angular, for headless tests).\n */\nexport interface CngxCommitController<T> {\n /** Read-only async-state view of the commit lifecycle. */\n readonly state: CngxAsyncState<T | undefined>;\n\n /** `true` while a commit is in flight. */\n readonly isCommitting: Signal<boolean>;\n\n /**\n * The most recent intended value - what the user was trying to\n * commit. Used by the option-row spinner and the commit-error\n * template context to identify *which* option the failure belongs\n * to.\n */\n readonly intendedValue: Signal<T | undefined>;\n\n /**\n * Start a new commit. Supersedes any in-flight commit: the\n * previous runner's cancel handle fires synchronously, and the\n * previous outcome callbacks become no-ops if they fire late.\n *\n * At most one outcome fires per call: after the runner's first\n * `onSuccess` / `onError` / `onRefused` (or its synchronous throw),\n * every further route call of that runner is ignored.\n *\n * A runner that throws synchronously before any outcome settles the\n * commit as `'error'` with the thrown value and calls\n * `handlers.onError`; `begin()` does not throw. A throw after the\n * runner already settled is rethrown unchanged.\n *\n * @param runner variant-specific action runner (closes over the\n * action and the intended value)\n * @param intended the value the user clicked\n * @param previous the value to roll back to on error or refusal\n * @param handlers success/error/refused routes - the controller only\n * updates its own state and calls these; it does\n * NOT touch external value signals, panel open\n * state, or component outputs.\n */\n begin(\n runner: CngxCommitRunner<T>,\n intended: T | undefined,\n previous: T | undefined,\n handlers: CngxCommitBeginHandlers<T>,\n ): void;\n\n /**\n * Abort the currently in-flight commit without firing callbacks.\n * Use when the host component is destroyed or the commit-action\n * input changes mid-flight.\n *\n * By default the state slot keeps its current status (a destroyed\n * host never reads it again). Pass `settle: true` when the surface\n * lives on - an explicit back-navigation or reset that supersedes a\n * pending commit must not leave `busy` latched true forever. It\n * resets the slot: `'idle'` with data, error, progress and\n * `lastUpdated` cleared and `isFirstLoad()` true again, and it\n * clears `intendedValue`.\n */\n cancel(options?: { readonly settle?: boolean }): void;\n}\n\n/**\n * Factory for the commit controller.\n *\n * Plain function, not a class - matches the rest of the repo\n * (`createManualState`, `createAsyncState`, `createTransitionTracker`).\n * <example-url>/#/common/data/commit-controller/begin-supersede-cancel</example-url>\n */\nexport function createCommitController<T>(): CngxCommitController<T> {\n const slot: ManualAsyncState<T | undefined> = createManualState<T | undefined>();\n\n // Read-only `state` view: the slot's signals without its write methods, so\n // consumers can't flip status directly.\n const state: CngxAsyncState<T | undefined> = {\n status: slot.status,\n data: slot.data,\n error: slot.error,\n progress: slot.progress,\n isLoading: slot.isLoading,\n isPending: slot.isPending,\n isRefreshing: slot.isRefreshing,\n isBusy: slot.isBusy,\n isFirstLoad: slot.isFirstLoad,\n isEmpty: slot.isEmpty,\n hasData: slot.hasData,\n isSettled: slot.isSettled,\n lastUpdated: slot.lastUpdated,\n };\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n // The view hides the slot; listing it here is how an inspector reaches\n // the slot's own descriptor.\n CNGX_DEV_DESCRIPTORS.tag(state, {\n kind: 'cngx-dev:factory',\n factory: 'createCommitController',\n inputs: { state: slot },\n });\n }\n\n // monotonic supersede id; stale callbacks compare captured id against this\n let commitId = 0;\n\n let active: CngxCommitHandle | null = null;\n\n // drives the pending spinner on the specific row the user clicked\n const intendedState = signal<T | undefined>(undefined);\n\n return {\n state,\n isCommitting: computed(\n () => slot.isPending(),\n typeof ngDevMode !== 'undefined' && ngDevMode\n ? { debugName: 'commitController.isCommitting' }\n : undefined,\n ),\n intendedValue: intendedState.asReadonly(),\n\n begin(runner, intended, previous, handlers) {\n // bump commitId BEFORE tearing down the previous runner: a runner that\n // cancels synchronously would otherwise still pass the supersede check\n // and fire its callbacks after all\n const id = ++commitId;\n active?.cancel();\n active = null;\n intendedState.set(intended);\n slot.set('pending');\n\n // A runner may settle synchronously, i.e. before its handle is even\n // returned. The settled flag keeps such a finished handle out of\n // `active`, so a later begin()/cancel() never calls cancel() on a\n // completed runner (CngxCommitHandle does not require idempotence).\n // It is also the once-guard: after the first outcome every further\n // route call of this runner is ignored.\n let settled = false;\n let handle: CngxCommitHandle;\n try {\n handle = runner({\n onSuccess: (committed) => {\n if (id !== commitId || settled) {\n return;\n }\n settled = true;\n slot.setSuccess(committed);\n active = null;\n handlers.onSuccess(committed);\n },\n onError: (err) => {\n if (id !== commitId || settled) {\n return;\n }\n settled = true;\n slot.setError(err);\n active = null;\n handlers.onError(err, previous);\n },\n onRefused: () => {\n if (id !== commitId || settled) {\n return;\n }\n settled = true;\n slot.setIdle();\n intendedState.set(undefined);\n active = null;\n handlers.onRefused?.(previous);\n },\n });\n } catch (err: unknown) {\n // A throw after the runner already settled is the runner's own bug:\n // rethrow it unchanged. A throw before any outcome is the outcome.\n if (settled) {\n throw err;\n }\n if (id === commitId) {\n settled = true;\n slot.setError(err);\n handlers.onError(err, previous);\n }\n return;\n }\n if (settled) {\n // Settled during the call: `active` is already cleared, or holds the\n // handle of a begin() that an outcome handler started.\n return;\n }\n if (id !== commitId) {\n // Superseded during its own call, before its handle existed for the\n // newer begin()/cancel() to tear down.\n handle.cancel();\n return;\n }\n active = handle;\n },\n\n cancel(options?: { readonly settle?: boolean }) {\n // bump first: callbacks of a synchronously-cancelling runner must\n // already see themselves superseded\n commitId++;\n active?.cancel();\n active = null;\n if (options?.settle) {\n // Full settle: idle status plus cleared data/error, so a stale\n // rejection cannot resurface on the next commit window.\n slot.reset();\n intendedState.set(undefined);\n }\n },\n };\n}\n","import { untracked, type Signal } from '@angular/core';\nimport { createAnnouncementPhrase } from '@cngx/core/utils';\n\nimport type { CngxTransitionOutcome } from './transition-outcome';\n\n/**\n * Options for {@link createRefusedPhrase}. Every field is a plain\n * reactive read, so the factory stays independent of any host type.\n *\n * @since 0.3.0\n */\nexport interface CngxRefusedPhraseOptions {\n /** The host's last refused or failed outcome, `undefined` once cleared. */\n readonly outcome: () => CngxTransitionOutcome | undefined;\n /** Commit status of the host; any change spends an armed phrase. */\n readonly status: () => unknown;\n /** Active index of the host; any move spends an armed phrase. */\n readonly activeIndex: () => number | undefined;\n /**\n * Copy voiced for a new refusal. Read untracked at arm time only, so a\n * language switch never re-speaks a phrase that was already voiced.\n */\n readonly copy: () => string;\n /**\n * Optional extra expiry trigger: a changed value (compared with\n * `!==`) spends an armed phrase, e.g. a newer close announcement that\n * must not be masked by a stale refusal.\n */\n readonly extraSpend?: () => unknown;\n}\n\n/**\n * Live-region phrase for a refused commit-gated transition (a step\n * change or tab switch whose `commitAction` answered `false`).\n *\n * A refusal settles the commit status back to `'idle'`, so no status\n * edge can voice it. This phrase arms on each new refused outcome (a new\n * `sequence`) and is spent by the next commit status change, an\n * active-index move, a cleared outcome or, when given, a changed\n * `extraSpend` value. A failed outcome never arms it. Arm wins over\n * spend in the same flush, so an optimistic rollback that moves the\n * active index still voices the refusal.\n *\n * Built on {@link createAnnouncementPhrase}: fully derived, no `effect`.\n * The same eager-read caveat applies - read the phrase before branching\n * on another arm of the live announcement, otherwise a spend transition\n * can be skipped.\n *\n * ```ts\n * const refusedPhrase = createRefusedPhrase({\n * outcome: () => presenter.lastOutcome(),\n * status: () => presenter.commitTransition.current(),\n * activeIndex: () => presenter.activeIndex(),\n * copy: () => i18n().commitRefusedGeneric,\n * });\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/commit/refused-phrase.ts\n * @since 0.3.0\n * @relatedTo CngxTransitionOutcome, createAnnouncementPhrase\n */\nexport function createRefusedPhrase(options: CngxRefusedPhraseOptions): Signal<string> {\n const { outcome, status, activeIndex, copy, extraSpend } = options;\n return createAnnouncementPhrase({\n source: () => {\n const current = outcome();\n return {\n sequence: current?.sequence,\n kind: current?.kind,\n status: status(),\n activeIndex: activeIndex(),\n extra: extraSpend?.(),\n };\n },\n arm: (curr, prev) =>\n curr.kind === 'refused' && curr.sequence !== prev.sequence ? untracked(copy) : null,\n spend: (curr, prev) =>\n curr.status !== prev.status ||\n curr.activeIndex !== prev.activeIndex ||\n curr.sequence === undefined ||\n curr.extra !== prev.extra,\n });\n}\n","import { InjectionToken } from '@angular/core';\n\nimport { createCommitController, type CngxCommitController } from './commit-controller';\n\n/**\n * Factory signature for producing {@link CngxCommitController}\n * instances. Consumers override the DI token\n * {@link CNGX_COMMIT_CONTROLLER_FACTORY} with a custom factory to\n * inject retry-with-backoff, offline queues, telemetry, or any\n * other enterprise-specific commit lifecycle - without forking the\n * features that consume it (select family, stepper, future wizards).\n */\nexport type CngxCommitControllerFactory = <T>() => CngxCommitController<T>;\n\n/**\n * DI token carrying the factory that every cngx feature uses to\n * allocate its commit controller. Default `providedIn: 'root'`\n * factory returns {@link createCommitController}. Override globally\n * via app providers or per-component via `viewProviders`.\n *\n * Symmetrical to `CNGX_SELECT_COMMIT_CONTROLLER_FACTORY`\n * (`@cngx/forms/select`); the select-side token's default factory\n * delegates to this one in the root injector, so an app-level override\n * here cascades into every select variant. A subtree override reaches\n * the stepper and tabs presenters, not the select family: override\n * `CNGX_SELECT_COMMIT_CONTROLLER_FACTORY` there.\n *\n * A replacement must honour `cancel({ settle: true })`, or `busy` stays\n * latched where the surface lives on. A custom factory usually wraps the\n * default one, here to time each commit that settles (`reportCommit`\n * stands for your telemetry call):\n *\n * ```ts\n * function createTimedCommitController<T>(): CngxCommitController<T> {\n * const inner = createCommitController<T>();\n * const begin: CngxCommitController<T>['begin'] = (runner, intended, previous, handlers) => {\n * const started = performance.now();\n * const report = (outcome: string) => reportCommit(outcome, performance.now() - started);\n * inner.begin(runner, intended, previous, {\n * onSuccess: (committed) => {\n * report('success');\n * handlers.onSuccess(committed);\n * },\n * onError: (err, prev) => {\n * report('error');\n * handlers.onError(err, prev);\n * },\n * onRefused: (prev) => {\n * report('refused');\n * handlers.onRefused?.(prev);\n * },\n * });\n * };\n * return { ...inner, begin };\n * }\n *\n * bootstrapApplication(App, {\n * providers: [\n * { provide: CNGX_COMMIT_CONTROLLER_FACTORY, useValue: createTimedCommitController },\n * ],\n * });\n * ```\n *\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/data/commit/commit-controller.token.ts\n * @since 0.3.0\n */\nexport const CNGX_COMMIT_CONTROLLER_FACTORY = new InjectionToken<CngxCommitControllerFactory>(\n 'CngxCommitControllerFactory',\n {\n providedIn: 'root',\n factory: () => createCommitController,\n },\n);\n","import {\n type DestroyRef,\n effect,\n type Injector,\n runInInjectionContext,\n type Signal,\n untracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport type { Observable } from 'rxjs';\n\n/**\n * Options for {@link createMaterialBidirectionalSync}.\n *\n * Material types never enter this surface. The caller maps Material's\n * own event/property shape to a host-agnostic `Signal<number>` /\n * `Observable<number>` / getter / setter at the directive boundary. \\\n * That keeps `@cngx/common/data` independent of `@angular/material`.\n */\nexport interface CngxMaterialBidirectionalSyncOptions {\n /**\n * Reactive source for the presenter's current index. The factory's\n * `effect()` tracks this signal - when it changes, Material is\n * written (subject to the equality guard against the Material\n * read-side).\n */\n readonly presenterIndex: Signal<number>;\n\n /**\n * Pulls the Material instance's current `selectedIndex` (or\n * equivalent). Called inside `untracked()` so the effect does not\n * subscribe to any signals the getter might read internally.\n */\n readonly readSelectedIndex: () => number;\n\n /**\n * Writes the Material instance's `selectedIndex` (or equivalent).\n * Called inside `untracked()` per\n * `reference_signal_architecture` rule 2.\n */\n readonly writeSelectedIndex: (idx: number) => void;\n\n /**\n * Stream of Material-driven selection changes, already mapped to a\n * plain index by the caller (`MatTabGroup.selectedIndexChange`\n * forwards directly; `MatStepper.selectionChange` needs\n * `.pipe(map(e => e.selectedIndex))`).\n */\n readonly selectionChange$: Observable<number>;\n\n /**\n * Routes a Material→presenter selection event into the presenter's\n * `select(idx)` method. Subject to an equality guard against\n * `presenterIndex()` so re-entrant events (the presenter's own\n * write firing back through Material) drop without re-routing.\n */\n readonly onMaterialSelection: (idx: number) => void;\n\n /** Injector used to install the effect inside an injection context. */\n readonly injector: Injector;\n\n /** DestroyRef used to clean up the effect and the subscription. */\n readonly destroyRef: DestroyRef;\n}\n\n/**\n * Handle returned by {@link createMaterialBidirectionalSync}.\n */\nexport interface CngxMaterialBidirectionalSyncHandle {\n /**\n * Force Material's selected index to the presenter's current index,\n * routed through the factory's self-echo suppression so it never\n * re-enters the Material→presenter path. Hosts call this from their\n * commit lifecycle when a pessimistic commit settles WITHOUT advancing\n * the presenter (a rejected switch), which leaves Material eager-\n * advanced on the refused tab. A no-op when already in sync.\n */\n readonly reconcile: () => void;\n}\n\n/**\n * Single shared bidirectional-sync factory for cngx organisms /\n * directives that bridge a cngx presenter against a Material parent\n * (`<mat-tab-group>`, `<mat-stepper>`, etc.).\n *\n * Lives at Level 2 in `@cngx/common/data` parallel to\n * `createCommitController`. Material types never enter the signature -\n * the caller maps Material-specific events and property accessors to a\n * host-agnostic shape at the directive boundary.\n *\n * Installs:\n *\n * 1. A presenter→Material `effect()` that tracks `presenterIndex` and\n * writes through `writeSelectedIndex`, equality-guarded against\n * `readSelectedIndex()` to suppress redundant writes. The Material\n * read+write pair runs inside `untracked()` per\n * `reference_signal_architecture` rule 2.\n * 2. A Material→presenter subscription that forwards each\n * `selectionChange$` emission to `onMaterialSelection`\n * (equality-guarded against `presenterIndex()` so a Material event\n * whose value already matches the presenter is dropped - closes\n * the re-entrancy loop).\n *\n * Both sides clean up via `destroyRef`.\n *\n * **Material-eager-advance reconciliation.** Material's MDC click\n * handler advances `selectedIndex` *before* the Material→presenter\n * subscription forwards the click. When the presenter HOLDS its index\n * (pessimistic mode + bound `commitAction`), the subscriber does NOT\n * write Material back: on a SUCCESSFUL commit the presenter later\n * advances to the clicked target and Material is already there, so the\n * mirror effect is a no-op (no flash); on a REJECTED commit the presenter\n * never moves, leaving Material eager-advanced on the refused tab. The\n * host detects the rejection through its own commit lifecycle and calls\n * {@link CngxMaterialBidirectionalSyncHandle.reconcile} to snap Material\n * back. Writing from inside the subscriber instead is unsafe: Material's\n * `selectedIndex` read-back lags a programmatic write, so the mirror\n * effect's equality guard reads a stale value and skips the corrective\n * write, sticking the visual on the wrong tab.\n *\n * **Self-echo suppression (loop-safety).** Every programmatic\n * `selectedIndex` write makes Material re-emit `selectionChange`. The\n * factory records each value it writes and drops the matching echo\n * (`indexOf` + splice, which also prunes earlier writes whose echo\n * Material coalesced away) before any other processing. This is\n * load-bearing for an ASYNC commit-action: Material emits the echo a\n * microtask later, by which point the commit may have advanced\n * `presenterIndex`, so an equality-only guard (`presenterIndex() ===\n * idx`) would FAIL to drop the echo - it would re-enter the subscriber\n * and ping-pong against the in-flight navigation (the demo freezes).\n * Matching the echo by the value we wrote drops it regardless of where\n * the presenter has moved.\n */\nexport function createMaterialBidirectionalSync(\n opts: CngxMaterialBidirectionalSyncOptions,\n): CngxMaterialBidirectionalSyncHandle {\n const {\n presenterIndex,\n readSelectedIndex,\n writeSelectedIndex,\n selectionChange$,\n onMaterialSelection,\n injector,\n destroyRef,\n } = opts;\n\n // Indices WE wrote into Material, awaiting their echo. Material\n // re-emits `selectionChange` for every programmatic `selectedIndex`\n // write, so each of our writes produces an echo that must NOT be\n // treated as a user selection. Equality against `presenterIndex()`\n // alone is insufficient: with an async commit-action the presenter may\n // have advanced by the time the echo arrives, so the echo no longer\n // equality-drops and would re-enter the subscriber. `indexOf` + splice\n // drops the echo by the value we wrote (and prunes any earlier write\n // whose echo Material coalesced away), regardless of where the\n // presenter has since moved - the loop can never form.\n const selfEchoes: number[] = [];\n const writeMaterial = (idx: number): void => {\n selfEchoes.push(idx);\n writeSelectedIndex(idx);\n };\n\n runInInjectionContext(injector, () => {\n effect(() => {\n const desired = presenterIndex();\n untracked(() => {\n if (readSelectedIndex() === desired) {\n return;\n }\n writeMaterial(desired);\n });\n });\n });\n\n selectionChange$.pipe(takeUntilDestroyed(destroyRef)).subscribe((idx) => {\n // Drop our own write-echo (and any coalesced-away earlier write).\n const echoAt = selfEchoes.indexOf(idx);\n if (echoAt !== -1) {\n selfEchoes.splice(0, echoAt + 1);\n return;\n }\n if (presenterIndex() === idx) {\n return;\n }\n onMaterialSelection(idx);\n // No write-back here. Material eager-advanced to the clicked tab; in\n // pessimistic mode the presenter HOLDS at origin, so on SUCCESS the\n // presenter later advances to this target and Material is already\n // there (no flash, no fight with Material's async `selectedIndex`).\n // On REJECTION the presenter never moves, leaving Material diverged -\n // the host detects that and calls `reconcile()` from its commit\n // lifecycle. Writing here while the commit is in flight is unsafe:\n // Material's `selectedIndex` read-back lags a programmatic write, so\n // the mirror effect's equality guard reads a stale value and skips\n // the corrective write (the visual sticks on the wrong tab).\n });\n\n return {\n reconcile: () => {\n writeMaterial(presenterIndex());\n },\n };\n}\n","/**\n * @module `@cngx/common/data`\n */\nexport { CngxSort, type SortEntry } from './sort/sort.directive';\nexport { CngxSortHeader } from './sort/sort-header.directive';\nexport { createSortHeaderState, type SortHeaderState } from './sort/sort-header-state';\nexport { CngxFilter } from './filter/filter.directive';\nexport {\n CngxFilterChips,\n CngxFilterChip,\n type CngxFilterChipContext,\n} from './filter-chips/filter-chips.component';\nexport { CngxPaginate } from './paginate/paginate.directive';\nexport { CngxPaginateResetOn, connectPaginateResetOn } from './paginate/paginate-reset.directive';\nexport { connectPaginateEmit, type CngxPaginateEmitHandlers } from './paginate/paginate-emit';\nexport { CngxPaginateRouting } from './paginate/paginate-routing.directive';\nexport { CngxBucketPaginate, type CngxBucket } from './paginate/bucket-paginate.directive';\nexport {\n CNGX_BUCKET_PAGINATE_HOST,\n type CngxBucketPaginateHost,\n type CngxBucketPaginateView,\n} from './paginate/bucket-paginate-host.token';\nexport { CngxDataSource, injectDataSource } from './data-source/data-source';\nexport {\n CngxSmartDataSource,\n injectSmartDataSource,\n type CngxSmartDataSourceOptions,\n} from './data-source/smart-data-source';\n\n// Re-export the curated async-state sub-barrel wholesale so additions there\n// (e.g. fromResource / fromHttpResource / tapAsyncState) cannot silently drop\n// out of `@cngx/common/data`.\nexport * from './async-state';\n\nexport { CngxAsyncRegistry, type CngxAsyncOperation } from './async-registry/async-registry';\nexport { provideAsyncRegistry, injectAsyncRegistry } from './async-registry/provide-async-registry';\nexport { injectLatencyProbe } from './async-registry/inject-latency-probe';\nexport { type CngxLatencyProbe } from '@cngx/core/utils';\nexport {\n CNGX_ASYNC_LABEL,\n CNGX_ASYNC_SKIP,\n withAsyncLabel,\n withAsyncSkip,\n} from './async-registry/http-context';\nexport {\n cngxAsyncInterceptor,\n provideAsyncHttpObservability,\n} from './async-registry/http-interceptor';\n\nexport { CngxAsync, type CngxAsyncContext } from './async/async.directive';\n\nexport { CngxMetric } from './display/metric/metric.component';\nexport { CngxTrend } from './display/trend/trend.component';\nexport { CngxDelta } from './display/delta/delta.component';\nexport {\n type DeltaPolarity,\n type DeltaMode,\n type DeltaDirection,\n type DeltaSentiment,\n} from './display/shared/delta-format';\nexport {\n CNGX_KPI_I18N,\n injectKpiI18n,\n provideKpiI18n,\n withKpiI18nLabels,\n type CngxKpiI18n,\n type CngxKpiI18nFeature,\n} from './display/shared/kpi-i18n';\nexport { CngxStat } from './display/stat/stat.component';\nexport { CngxStatCoordinator } from './display/stat/stat-coordinator.directive';\nexport {\n CngxStatLabel,\n CngxStatValue,\n CngxStatDelta,\n CngxStatCaption,\n} from './display/stat/stat-slots';\nexport { CNGX_STAT, type CngxStatRegistry, type CngxStatSlotKind } from './display/stat/stat.token';\nexport { CngxGoal } from './display/goal/goal.component';\n\nexport {\n injectRecycler,\n provideRecyclerI18n,\n withRecyclerI18nLabels,\n CNGX_RECYCLER_I18N,\n type CngxRecyclerI18nFeature,\n type RecyclerConfig,\n type CngxRecycler,\n type RecyclerI18n,\n} from './recycler/recycler';\nexport { CngxMeasure } from './recycler/measure.directive';\nexport { CngxVirtualItem } from './recycler/virtual-item.directive';\nexport { CngxRecyclerPlaceholder } from './recycler/recycler-placeholder.directive';\nexport {\n CngxRecyclerRow,\n CNGX_RECYCLER_PLACEHOLDER_ROW,\n provideRecyclerPlaceholderRow,\n type CngxRecyclerRowContext,\n} from './recycler/recycler-row.directive';\nexport { CngxRecyclerAnnouncer } from './recycler/recycler-announcer.component';\nexport { connectRecyclerToRoving } from './recycler/connect-recycler-roving';\nexport { connectRecyclerToActiveDescendant } from './recycler/connect-recycler-active-descendant';\n\n// Commit controller - generic async-commit state machine shared by\n// the select family and the stepper / wizard family.\nexport {\n createCommitController,\n type CngxCommitController,\n type CngxCommitBeginHandlers,\n type CngxCommitHandle,\n type CngxCommitRunner,\n type CngxTransitionOutcome,\n createRefusedPhrase,\n type CngxRefusedPhraseOptions,\n CNGX_COMMIT_CONTROLLER_FACTORY,\n type CngxCommitControllerFactory,\n} from './commit';\n\n// Material bidirectional sync - shared factory consumed by cngx\n// organisms / directives that bridge a cngx presenter against a\n// Material parent (`<mat-tab-group>`, `<mat-stepper>`, etc.).\n// Material types never enter the signature; the caller maps at the\n// directive boundary so `@cngx/common/data` stays Sheriff-Level-2\n// compliant (no `@angular/material` import).\nexport {\n createMaterialBidirectionalSync,\n type CngxMaterialBidirectionalSyncOptions,\n type CngxMaterialBidirectionalSyncHandle,\n} from './material-bridge/bidirectional-sync';\nexport { CNGX_KPI_LANGUAGE_EN, type CngxKpiLanguageSection } from './i18n/kpi-language-section';\nexport {\n CNGX_RECYCLER_LANGUAGE_EN,\n type CngxRecyclerLanguageSection,\n} from './i18n/recycler-language-section';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.CngxStatCoordinator"],"mappings":";;;;;;;;;;;;;;;;;AAUA,SAAS,UAAU,CAAC,CAA+B,EAAE,CAA+B,EAAA;AAClF,IAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,C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