@cngx/common 0.0.1-rc.0 → 0.1.0-rc.1
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 +13 -16
- package/card/README.md +2 -21
- package/chart/README.md +5 -8
- package/data/README.md +45 -47
- package/dialog/README.md +12 -15
- package/display/README.md +5 -9
- package/fesm2022/cngx-common-a11y.mjs +164 -51
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +157 -69
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +389 -92
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +311 -151
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +167 -29
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +445 -110
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +2059 -435
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +188 -31
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +711 -90
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +1479 -73
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1144 -85
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +2 -2
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +5 -5
- package/layout/README.md +2 -2
- package/package.json +7 -6
- package/popover/README.md +8 -34
- package/stepper/README.md +69 -8
- package/tabs/README.md +6 -6
- package/theming/components/cngx-async.css +74 -0
- package/theming/components/cngx-backdrop.css +73 -0
- package/theming/components/cngx-badge.css +340 -0
- package/theming/components/cngx-bottom-sheet.css +201 -0
- package/theming/components/cngx-button-toggle.css +99 -0
- package/theming/components/cngx-dialog.css +358 -0
- package/theming/components/cngx-divider.css +145 -0
- package/theming/components/cngx-listbox.css +220 -0
- package/theming/components/cngx-menu.css +371 -0
- package/theming/components/cngx-ripple.css +116 -0
- package/theming/components/cngx-tooltip.css +265 -0
- package/theming/system-tokens.css +24 -0
- package/types/cngx-common-a11y.d.ts +159 -38
- package/types/cngx-common-card.d.ts +137 -22
- package/types/cngx-common-chart.d.ts +337 -40
- package/types/cngx-common-data.d.ts +277 -45
- package/types/cngx-common-dialog.d.ts +162 -22
- package/types/cngx-common-display.d.ts +422 -78
- package/types/cngx-common-interactive.d.ts +1880 -305
- package/types/cngx-common-layout.d.ts +191 -28
- package/types/cngx-common-popover.d.ts +632 -87
- package/types/cngx-common-stepper.d.ts +1360 -45
- package/types/cngx-common-tabs.d.ts +1139 -56
- package/types/cngx-common.d.ts +1 -1
- package/README.md +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cngx-common-data.mjs","sources":["../../../projects/common/data/sort/sort.directive.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/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-state/create-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/from-resource.ts","../../../projects/common/data/async-state/from-http-resource.ts","../../../projects/common/data/async-state/operators.ts","../../../projects/common/data/async/async.directive.ts","../../../projects/common/data/display/metric.component.ts","../../../projects/common/data/display/trend.component.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-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 { 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\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 * 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 *\n * Consumer connects this to a table or list via a `computed()` — nothing is\n * injected automatically.\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 private readonly sortsState = signal<SortEntry[]>([]);\n\n /** The active sort column of the primary entry (controlled takes precedence in single-sort mode). */\n readonly active = computed(() => this.activeInput() ?? this.sortsState()[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.sortsState()[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 );\n\n /**\n * All active sort entries in priority order.\n * Contains at most one entry when additive mode has not been used.\n */\n readonly sorts = this.sortsState.asReadonly();\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 → toggle direction (asc → desc → asc)\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 setSort(field: string, additive = false): void {\n if (additive) {\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 const current = this.sortsState();\n const dir: 'asc' | 'desc' =\n field === current[0]?.active ? (current[0].direction === 'asc' ? 'desc' : 'asc') : 'asc';\n const entry: SortEntry = { active: field, direction: dir };\n this.sortsState.set([entry]);\n this.sortChange.emit(entry);\n this.sortsChange.emit([entry]);\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, Directive, input } from '@angular/core';\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@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 entry = computed(() =>\n this.cngxSortRef()\n .sorts()\n .find((s) => s.active === this.field()),\n );\n\n /** `true` when this column is part of the active sort (primary or secondary). */\n readonly isActive = computed(() => this.entry() !== undefined);\n /** `true` when this column is active and sorted ascending. */\n readonly isAsc = computed(() => this.entry()?.direction === 'asc');\n /** `true` when this column is active and sorted descending. */\n readonly isDesc = computed(() => this.entry()?.direction === 'desc');\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 = computed(() => {\n const idx = this.cngxSortRef()\n .sorts()\n .findIndex((s) => s.active === this.field());\n return idx === -1 ? 0 : idx + 1;\n });\n\n /** The `aria-sort` attribute value for the host element. */\n readonly ariaSort = computed((): 'ascending' | 'descending' | null => {\n if (!this.isActive()) {\n return null;\n }\n return this.isAsc() ? 'ascending' : 'descending';\n });\n\n protected handleSort(event?: MouseEvent): void {\n const additive = this.cngxSortRef().multiSort() && (event?.shiftKey ?? false);\n this.cngxSortRef().setSort(this.field(), additive);\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@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 DestroyRef,\n Directive,\n TemplateRef,\n afterNextRender,\n contentChild,\n inject,\n input,\n model,\n type Signal,\n} from '@angular/core';\nimport { CngxChip } from '@cngx/common/display';\nimport {\n CngxChipInGroup,\n CngxMultiChipGroup,\n} 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@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.** The bridge calls\n * `filterRef.addPredicate(filterKey, predicateFn)` EXACTLY ONCE\n * during mount (in `afterNextRender`, because `input.required()`\n * cannot be read from the constructor body). `predicateFn` is a\n * closure that reads `this.selectedValues()` and\n * `this.optionValueFn()` 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.\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.** `DestroyRef.onDestroy` calls `removePredicate` only\n * when registration actually happened (`registered` flag) — guards\n * against the case where the component is destroyed before\n * `afterNextRender` fires. The destroy callback reads `filterRef`\n * and `filterKey` lazily so a consumer that re-binds these between\n * mount and unmount cleans the latest binding (per\n * `reference_signal_architecture` memory-hygiene rule).\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@Component({\n selector: 'cngx-filter-chips',\n exportAs: 'cngxFilterChips',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CngxChip, CngxMultiChipGroup, CngxChipInGroup, NgTemplateOutlet],\n template: `\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\n *ngTemplateOutlet=\"tpl; context: chipContext(option)\"\n />\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<\n CngxFilterChip<TItem, TValue> | undefined\n > = contentChild(CngxFilterChip<TItem, TValue>);\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 = (\n option: TItem,\n ): 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 private registered = false;\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 afterNextRender(() => {\n this.filterRef().addPredicate(this.filterKey(), predicateFn);\n this.registered = true;\n });\n\n inject(DestroyRef).onDestroy(() => {\n if (!this.registered) {\n return;\n }\n this.filterRef().removePredicate(this.filterKey());\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 `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 * // 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 * // With CngxMatPaginator:\n * <cngx-mat-paginator [cngxPaginateRef]=\"pg\" />\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 const start = this.pageIndex() * this.pageSize();\n return [start, start + this.pageSize()];\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 { 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 */\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 */\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 type { CngxAsyncState } from '@cngx/core/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\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 case-insensitive match\n * across all primitive-valued properties.\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 locale-aware string comparison.\n */\n sortFn?: (a: T, b: T, field: string, direction: 'asc' | 'desc') => number;\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 * 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 */\nexport class CngxSmartDataSource<T> extends DataSource<T> {\n private readonly injector = inject(Injector);\n private readonly sort = inject(CngxSort, { optional: true });\n private readonly filter = inject(CngxFilter, { optional: true });\n // CngxSearch typically lives on a child <input> below the component injector,\n // so this inject returns null in the common case. It resolves only when CngxSearch\n // is placed as a hostDirective on the same component. For child-input search,\n // use injectDataSource() + manual computed() instead.\n private readonly search = inject(CngxSearch, { optional: true });\n private readonly paginate = inject(CngxPaginate, { optional: true });\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 /** The async state source, or `undefined` if constructed from a plain signal. */\n 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 const predicate = this.filter?.predicate();\n const term = this.search?.term();\n const searchFn =\n this.options?.searchFn ??\n ((item: T, t: string) => {\n const lower = t.toLowerCase();\n return Object.values(item as Record<string, unknown>).some((v) =>\n v === null || v === undefined || typeof v === 'object'\n ? false\n : String(v as string | number | boolean | bigint)\n .toLowerCase()\n .includes(lower),\n );\n });\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\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 const sorts = this.sort?.sorts() ?? [];\n const sortFn =\n this.options?.sortFn ??\n ((a: T, b: T, field: string, dir: 'asc' | 'desc') => {\n const toStr = (v: unknown): string =>\n v === null || v === undefined || typeof v === 'object'\n ? ''\n : String(v as string | number | boolean | bigint);\n const av = toStr((a as Record<string, unknown>)[field]);\n const bv = toStr((b as Record<string, unknown>)[field]);\n const cmp = av.localeCompare(bv, undefined, { numeric: true, sensitivity: 'base' });\n return dir === 'asc' ? cmp : -cmp;\n });\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 range = this.paginate?.range();\n return range ? sorted.slice(range[0], range[1]) : sorted;\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 */\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 */\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 */\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 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 { 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';\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.\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 */\nexport function createAsyncState<T>(): 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 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 // Check if this execution was superseded\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 { 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';\n\n/**\n * Configuration options for `injectAsyncState`.\n */\nexport interface InjectAsyncStateOptions {\n /**\n * Debounce time in ms for signal dependency changes.\n * Prevents request storms when multiple signals change rapidly.\n * @default 50\n */\n debounce?: number;\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. */\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 */\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 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 // Observable path — subscribe, cancel via unsubscribe\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 // Observable completed without emitting — treat as empty success\n state.setSuccess(undefined as T);\n }\n },\n });\n } else {\n // Promise path — cancel via AbortController\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 // The effect calls fn() exactly once per cycle.\n // The result is captured and forwarded to executeQuery — no double invocation.\n effect(() => {\n // fn() reads signals → tracked by effect. The returned Promise/Observable\n // is captured here and executed after debounce.\n let result: Promise<T> | Observable<T>;\n try {\n result = fn();\n } catch (err: unknown) {\n // fn() threw synchronously (e.g. required signal not yet set).\n // Schedule error state after debounce to match async behavior.\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 // Capture result in closure — executeQuery receives it directly.\n const captured = result;\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 */\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, effect, type Resource, signal } from '@angular/core';\nimport type { AsyncStatus, CngxAsyncState } from '@cngx/core/utils';\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 */\nexport function fromResource<T>(ref: Resource<T>): CngxAsyncState<T> {\n // Track whether a successful load has ever occurred.\n // Needed because ResourceStatus has no \"first load\" concept.\n const hadSuccess = signal(false);\n\n effect(() => {\n const s = ref.status();\n if (s === 'resolved' || s === 'local') {\n hadSuccess.set(true);\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 const data = computed(() => (ref.hasValue() ? ref.value() : undefined));\n const error = computed(() => ref.error());\n\n const isLoading = computed(() => status() === 'loading');\n const isPending = computed(() => false); // resource() has no mutation concept\n const isRefreshing = computed(() => status() === 'refreshing');\n const isBusy = computed(() => ref.isLoading());\n const isFirstLoad = computed(() => !hadSuccess() && (isBusy() || status() === 'idle'));\n const isEmpty = computed(() => {\n const d = data();\n return d == null || (Array.isArray(d) && d.length === 0);\n });\n const hasData = computed(() => ref.hasValue() && !isEmpty());\n const isSettled = computed(() => {\n const s = status();\n return s === 'success' || s === 'error';\n });\n const lastUpdated = signal<Date | undefined>(undefined);\n\n effect(() => {\n const s = ref.status();\n if (s === 'resolved' || s === 'local') {\n lastUpdated.set(new Date());\n }\n });\n\n return {\n status,\n data,\n error,\n progress: signal(undefined).asReadonly(),\n isLoading,\n isPending,\n isRefreshing,\n isBusy,\n isFirstLoad,\n isEmpty,\n hasData,\n isSettled,\n lastUpdated: lastUpdated.asReadonly(),\n };\n}\n","import { computed, effect, type Resource, signal } from '@angular/core';\nimport type { AsyncStatus, CngxAsyncState } from '@cngx/core/utils';\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 */\nexport function fromHttpResource<T>(ref: HttpResourceLike<T>): CngxAsyncState<T> {\n const hadSuccess = signal(false);\n\n effect(() => {\n const s = ref.status();\n if (s === 'resolved' || s === 'local') {\n hadSuccess.set(true);\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 const data = computed(() => (ref.hasValue() ? ref.value() : undefined));\n const error = computed(() => ref.error());\n\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 const isLoading = computed(() => status() === 'loading');\n const isPending = computed(() => false);\n const isRefreshing = computed(() => status() === 'refreshing');\n const isBusy = computed(() => ref.isLoading());\n const isFirstLoad = computed(() => !hadSuccess() && isBusy());\n const isEmpty = computed(() => {\n const d = data();\n return d == null || (Array.isArray(d) && d.length === 0);\n });\n const hasData = computed(() => ref.hasValue() && !isEmpty());\n const isSettled = computed(() => {\n const s = status();\n return s === 'success' || s === 'error';\n });\n const lastUpdated = signal<Date | undefined>(undefined);\n\n effect(() => {\n const s = ref.status();\n if (s === 'resolved' || s === 'local') {\n lastUpdated.set(new Date());\n }\n });\n\n return {\n status,\n data,\n error,\n progress,\n isLoading,\n isPending,\n isRefreshing,\n isBusy,\n isFirstLoad,\n isEmpty,\n hasData,\n isSettled,\n lastUpdated: lastUpdated.asReadonly(),\n };\n}\n","import {\n type MonoTypeOperatorFunction,\n type Observable,\n type OperatorFunction,\n defer,\n filter,\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: 'loading' | 'refreshing' | 'pending'): void;\n setSuccess(data: T): void;\n setError(error: unknown): void;\n setProgress(value: number | undefined): void;\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 * On next: calls `setSuccess(value)`.\n * On error: calls `setError(err)` and **re-throws** (does not swallow).\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 ?? 'loading');\n return source.pipe(\n tap({\n next: (value) => state.setSuccess(value),\n error: (err: unknown) => state.setError(err),\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 */\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 */\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 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) => state.setSuccess(value),\n error: (err: unknown) => state.setError(err),\n }),\n );\n });\n}\n","import {\n computed,\n Directive,\n effect,\n type EmbeddedViewRef,\n inject,\n input,\n signal,\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 */\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 *\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@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 private readonly currentView = signal<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.set(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 {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n LOCALE_ID,\n ViewEncapsulation,\n} from '@angular/core';\n\n/**\n * Displays a formatted numeric value with optional unit.\n *\n * Uses `Intl.NumberFormat` with the injected `LOCALE_ID` for locale-aware\n * formatting. Null values render as an em-dash.\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@Component({\n selector: 'cngx-metric',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'cngx-metric',\n '[attr.aria-label]': 'accessibleValue()',\n },\n template: `\n <span class=\"cngx-metric__value\">{{ formattedValue() }}</span>\n @if (unit()) {\n <span class=\"cngx-metric__unit\">{{ unit() }}</span>\n }\n `,\n})\nexport class CngxMetric {\n private readonly locale = inject(LOCALE_ID);\n\n /** Numeric or string value. `null` renders as em-dash. */\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 '\\u2014';\n }\n if (typeof v === 'string') {\n return v;\n }\n return this.format()\n ? new Intl.NumberFormat(this.locale, this.format()).format(v)\n : v.toLocaleString(this.locale);\n });\n\n /** @internal Full accessible description including unit. */\n readonly accessibleValue = computed(() => {\n const v = this.formattedValue();\n const u = this.unit();\n return u ? `${v} ${u}` : v;\n });\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\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@Component({\n selector: 'cngx-trend',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'cngx-trend',\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})\nexport class CngxTrend {\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 readonly icon = computed(() =>\n this.value() > 0 ? '\\u2191' : this.value() < 0 ? '\\u2193' : '\\u2192',\n );\n\n /** @internal */\n readonly formattedValue = computed(() => {\n const v = this.value();\n const abs = Math.abs(v);\n return `${v > 0 ? '+' : ''}${abs.toFixed(1)}\\u202F%`;\n });\n\n /** @internal */\n readonly resolvedLabel = computed(() => {\n if (this.label()) {\n return this.label()!;\n }\n const dir = this.value() > 0 ? 'up' : this.value() < 0 ? 'down' : 'unchanged';\n return `${this.formattedValue()} ${dir}`;\n });\n}\n","// Step 1: range-computer.ts — pure function, zero dependencies\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 */\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 overscan Number of extra items to render above/below the viewport.\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 * @returns The computed range with spacer offsets.\n */\nexport function computeRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n estimateSize: number | ((index: number) => number),\n overscan: number,\n columns = 1,\n): RangeResult {\n if (totalCount <= 0 || clientHeight <= 0) {\n return EMPTY_RANGE;\n }\n\n if (typeof estimateSize === 'number') {\n return computeFixedRange(scrollTop, clientHeight, totalCount, estimateSize, overscan, columns);\n }\n\n // Variable heights — grid mode not supported, columns ignored\n return computeVariableRange(scrollTop, clientHeight, totalCount, estimateSize, overscan);\n}\n\nfunction computeFixedRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n itemSize: number,\n overscan: number,\n columns: number,\n): RangeResult {\n if (columns > 1) {\n return computeGridRange(scrollTop, clientHeight, totalCount, itemSize, overscan, columns);\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 - overscan);\n const end = Math.min(totalCount, rawEnd + overscan);\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 */\nfunction computeGridRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n rowHeight: number,\n overscan: number,\n columns: number,\n): RangeResult {\n const totalRows = Math.ceil(totalCount / columns);\n const totalSize = totalRows * rowHeight;\n\n // Step 1+2: raw visible rows (inherently row-aligned)\n const rawStartRow = Math.floor(scrollTop / rowHeight);\n const rawEndRow = Math.ceil((scrollTop + clientHeight) / rowHeight);\n\n // Step 3: apply overscan in rows (convert item overscan to row overscan)\n const overscanRows = Math.ceil(overscan / columns);\n const startRow = Math.max(0, rawStartRow - overscanRows);\n const endRow = Math.min(totalRows, rawEndRow + overscanRows);\n\n // Step 4: convert to item indices, clamp end to totalCount\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 overscan: number,\n): RangeResult {\n // Accumulate heights to find the first visible item (binary search)\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 for the 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 - overscan);\n const end = Math.min(totalCount, rawEnd + 1 + overscan);\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/** Finds the index of the first item whose cumulative offset exceeds `target`. */\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","// Step 2: scroll-observer.ts — addEventListener + ResizeObserver → signals\n\nimport { 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';\n\n/**\n * Reactive scroll state of a container element.\n * Both signals are updated synchronously inside the same rAF callback —\n * Angular's Signal scheduling coalesces the two writes so consumers\n * evaluate once per frame, not twice.\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 function attachListeners(el: HTMLElement, onCleanup: (fn: () => void) => void): void {\n elementState.set(el);\n scrollTopState.set(el.scrollTop);\n clientHeightState.set(el.clientHeight);\n\n let rafId: number | null = null;\n\n const handleScroll = () => {\n if (rafId != null) {\n return;\n }\n rafId = requestAnimationFrame(() => {\n rafId = null;\n scrollTopState.set(el.scrollTop);\n clientHeightState.set(el.clientHeight);\n });\n };\n\n el.addEventListener('scroll', handleScroll, { passive: true });\n\n const resizeObserver = new ResizeObserver(() => {\n clientHeightState.set(el.clientHeight);\n });\n resizeObserver.observe(el);\n\n onCleanup(() => {\n el.removeEventListener('scroll', handleScroll);\n if (rafId != null) {\n cancelAnimationFrame(rafId);\n }\n resizeObserver.disconnect();\n elementState.set(null);\n });\n }\n\n effect((onCleanup) => {\n retryTick(); // tracked — effect re-runs when retryTick changes\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 retryTick.update((v) => v + 1);\n }\n });\n\n // Additional cleanup via DestroyRef as safety net\n destroyRef.onDestroy(() => {\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","// Phase 2: size-cache.ts — Signal-based measured height cache\n\nimport { 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 Signal,\n computed,\n effect,\n inject,\n isDevMode,\n signal,\n untracked,\n} from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\nimport { createTransitionTracker } from '@cngx/core/utils';\n\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/**\n * Injection token for recycler SR announcement texts.\n * Provides English defaults via factory. Override with `provideRecyclerI18n()`.\n */\nexport const CNGX_RECYCLER_I18N = new InjectionToken<RecyclerI18n>('CngxRecyclerI18n', {\n factory: (): RecyclerI18n => ({\n loaded: (n, t) => `${n} more items loaded. ${t} total.`,\n filtered: (c) => `${c} results found.`,\n empty: () => 'No results.',\n error: () => 'Error loading data.',\n }),\n});\n\n/**\n * Provider function for custom recycler i18n texts.\n *\n * ```typescript\n * providers: [provideRecyclerI18n({\n * loaded: (n, t) => `${n} weitere Einträge. ${t} gesamt.`,\n * filtered: (c) => `${c} Ergebnisse.`,\n * empty: () => 'Keine Ergebnisse.',\n * error: () => 'Fehler beim Laden.',\n * })]\n * ```\n */\nexport function provideRecyclerI18n(i18n: RecyclerI18n) {\n return { provide: CNGX_RECYCLER_I18N, useValue: i18n };\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 /** Estimated height per item (px). Number or function per index. */\n estimateSize: 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 */\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 /** 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 * Inline equivalent of `createVisibilityTimer` from `@cngx/ui/feedback` (Level 4, not importable).\n *\n * Uses `setTimeout` inside an effect — this is a timer-driven side effect, not derived state.\n * Same pattern accepted in `createVisibilityTimer` for `CngxLoadingOverlay`.\n * Safe in zoneless: the `setTimeout` callback only writes a signal, which schedules\n * Angular's own change detection — no Zone.js dependency.\n *\n * @param source Boolean signal to delay. When `true`, starts the timer.\n * @param delayMs Delay in milliseconds before the flag becomes `true`.\n * @returns A readonly signal that becomes `true` after `delayMs` when `source` is `true`.\n * @internal\n */\nfunction createDelayedFlag(source: Signal<boolean>, delayMs: number): Signal<boolean> {\n if (delayMs <= 0) {\n return source;\n }\n const flag = signal(false);\n effect((onCleanup) => {\n const active = source();\n if (active) {\n const timer = setTimeout(() => flag.set(true), delayMs);\n onCleanup(() => {\n clearTimeout(timer);\n flag.set(false);\n });\n } else {\n flag.set(false);\n }\n });\n return flag.asReadonly();\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 = 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 if (typeof config.estimateSize === 'function' && 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 // 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 return computeRange(\n scrollState.scrollTop(),\n scrollState.clientHeight(),\n config.totalCount(),\n size,\n overscan,\n cols,\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 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 Math.min(Math.max(0, end() - effectiveOverscan() - 1), 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 = createDelayedFlag(isLoading, config.skeletonDelay ?? 0);\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 if (current === 'success' && (previous === 'loading' || previous === 'refreshing')) {\n const diff = total - prevTotal;\n if (diff > 0) {\n announcementState.set(i18n.loaded(diff, total));\n } else {\n announcementState.set(i18n.filtered(total));\n }\n } else if (current === 'error') {\n announcementState.set(i18n.error());\n } else if (current === 'success' && total === 0) {\n announcementState.set(i18n.empty());\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 if (prevTotal > 0 && diff > 0) {\n announcementState.set(i18n.loaded(diff, total));\n } else if (prevTotal > 0 && total === 0) {\n announcementState.set(i18n.empty());\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\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","// Phase 2: measure.directive.ts — CngxMeasure atom\n\nimport { Directive, ElementRef, effect, inject, input } from '@angular/core';\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@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\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 // Initial measurement\n recycler.measure(index, element);\n\n // Observe size changes\n const observer = new ResizeObserver(() => {\n recycler.measure(index, element);\n });\n observer.observe(element);\n\n onCleanup(() => {\n observer.disconnect();\n });\n });\n }\n}\n","// Phase 4: virtual-item.directive.ts — CngxVirtualItem A11y atom\n\nimport { 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@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","// Phase 4: recycler-announcer.component.ts — CngxRecyclerAnnouncer convenience\n\nimport { 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@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","// Phase 4: connect-recycler-roving.ts — wires CngxRecycler to CngxRovingTabindex virtual mode\n\nimport { ElementRef, effect, inject, untracked } from '@angular/core';\n// Type-only: CngxRovingTabindex is passed as an argument at runtime, not imported as a value.\n// The consumer provides the instance via inject(CngxRovingTabindex, { 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","// connect-recycler-active-descendant.ts\n// Wires CngxRecycler to CngxActiveDescendant virtual mode.\n\nimport { effect, untracked } from '@angular/core';\n\n// Type-only: the directive is passed as a runtime argument, not value-imported,\n// so the helper can live in @cngx/common/data without a hard 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'] },\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 scrollToIndex — rapid keypresses (e.g. ArrowDown held)\n // otherwise enqueue one scroll call per keystroke. Each new pending\n // 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 pending target inside the frame — if the user continued\n // typing / arrow-pressing during the frame, the latest target wins.\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 */\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 */\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 */\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 */\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 cancel(): 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 */\nexport function createCommitController<T>(): CngxCommitController<T> {\n // Writable state slot — the `state` getter returns the read-only\n // `CngxAsyncState<T | undefined>` view so consumers can't bypass\n // the controller to flip status directly.\n const slot: ManualAsyncState<T | undefined> =\n createManualState<T | undefined>();\n\n // Monotonic commit id. Incremented on every `begin(...)`. An\n // outcome callback checks its captured id against the current\n // counter — if a newer commit has started, the callback is\n // ignored (supersede).\n let commitId = 0;\n\n // Cancel handle for the runner currently in flight. Replaced on\n // each `begin(...)` and cleared after the runner settles.\n let active: CngxCommitHandle | null = null;\n\n // Public signal: what the user was trying to commit. Exposed so\n // the template can render a pending spinner on THAT specific row\n // and the commit-error context can surface it.\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 // Supersede: tear down any previous runner. Must run BEFORE\n // we bump `commitId` — otherwise the previous callback's\n // supersede-check would pass and fire after all.\n active?.cancel();\n const id = ++commitId;\n intendedState.set(intended);\n slot.set('pending');\n\n active = runner({\n onSuccess: (committed) => {\n // Supersede guard. `commitId` advances on every new\n // `begin`; if our captured id is stale, a newer commit\n // has taken over.\n if (id !== commitId) {\n return;\n }\n slot.setSuccess(committed);\n active = null;\n handlers.onSuccess(committed);\n },\n onError: (err) => {\n if (id !== commitId) {\n return;\n }\n slot.setError(err);\n active = null;\n handlers.onError(err, previous);\n },\n });\n },\n\n cancel() {\n active?.cancel();\n active = null;\n // Bump the id so any pending callbacks from the aborted\n // runner are treated as superseded and do nothing.\n commitId++;\n },\n };\n}\n","import { InjectionToken } from '@angular/core';\n\nimport {\n createCommitController,\n type CngxCommitController,\n} 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, 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 */\nexport const CNGX_COMMIT_CONTROLLER_FACTORY =\n 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 * (Sheriff Level-2 invariant).\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 * 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 * **Pessimistic-commit gate (deliberately absent).** An earlier draft\n * carried a third option `commitState: CngxAsyncState<unknown>` that\n * gated the Material write while `commitState.isPending()`. The plan\n * (`global-material-bridge-and-architecture-hardening-plan` §54)\n * specified this gate \"for the pessimistic flow.\" Implementation\n * showed the gate is redundant: cngx commit handlers already keep\n * `presenter.activeIndex` at the origin during pessimistic-pending,\n * so the equality guard alone suppresses the Material write.\n * Conversely, in optimistic mode the presenter advances IMMEDIATELY\n * (before the commit settles); a `pending`-keyed gate would suppress\n * that legitimate advance and break the optimistic UX. Dropping the\n * gate makes both modes work via the simple presenter→Material\n * mirror — same outcome as the gate version for pessimistic, and the\n * correct outcome for optimistic.\n *\n * **Material-eager-advance reconciliation.** Material's MDC click\n * handler advances `selectedIndex` synchronously *before* the\n * Material→presenter subscription forwards the click to\n * `onMaterialSelection`. When the presenter HOLDS its index\n * (pessimistic mode + bound `commitAction`, or any future contract\n * that refuses a select), the presenter→Material `effect()` does\n * NOT fire — `presenterIndex` did not change — so Material's\n * eager-advance is never reverted, and the visual diverges from the\n * cngx semantic state. Closes `tabs-accepted-debt §6` by force-\n * writing Material back to the presenter's value when the\n * forwarding callback returns and the values still diverge. Idempotent\n * with the regular presenter→Material effect (the read-equality guard\n * at the effect site suppresses a duplicate write when the presenter\n * later changes to the same value).\n */\nexport function createMaterialBidirectionalSync(\n opts: CngxMaterialBidirectionalSyncOptions,\n): void {\n const {\n presenterIndex,\n readSelectedIndex,\n writeSelectedIndex,\n selectionChange$,\n onMaterialSelection,\n injector,\n destroyRef,\n } = opts;\n\n runInInjectionContext(injector, () => {\n effect(() => {\n const desired = presenterIndex();\n untracked(() => {\n if (readSelectedIndex() === desired) {\n return;\n }\n writeSelectedIndex(desired);\n });\n });\n });\n\n selectionChange$\n .pipe(takeUntilDestroyed(destroyRef))\n .subscribe((idx) => {\n if (presenterIndex() === idx) {\n return;\n }\n onMaterialSelection(idx);\n // Material-eager-advance reconciliation (tabs-accepted-debt §6).\n // The forwarding callback above lets the presenter run its\n // commit-action gate; in pessimistic mode the presenter holds\n // `activeIndex` at origin instead of advancing. The\n // presenter→Material effect only fires on signal CHANGE, so a\n // hold-at-origin leaves Material at the user-clicked target —\n // out of sync with the cngx semantic state. Detect the\n // post-callback divergence and force a Material write so the\n // visual snaps back to the presenter's authoritative index.\n // Loop-safe: writing `selectedIndex` re-emits `selectionChange$`,\n // but the early-return guard at the top of this subscriber\n // (`presenterIndex() === idx`) drops the re-entrant emission.\n const reconciled = presenterIndex();\n if (readSelectedIndex() !== reconciled) {\n writeSelectedIndex(reconciled);\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 { 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 { CngxDataSource, injectDataSource } from './data-source/data-source';\nexport {\n CngxSmartDataSource,\n injectSmartDataSource,\n type CngxSmartDataSourceOptions,\n} from './data-source/smart-data-source';\n\nexport {\n createManualState,\n type ManualAsyncState,\n createAsyncState,\n type MutableAsyncState,\n injectAsyncState,\n type ReactiveAsyncState,\n type InjectAsyncStateOptions,\n resolveAsyncView,\n type AsyncView,\n} from './async-state';\n\nexport { CngxAsync, type CngxAsyncContext } from './async/async.directive';\n\nexport { CngxMetric } from './display/metric.component';\nexport { CngxTrend } from './display/trend.component';\n\nexport {\n injectRecycler,\n provideRecyclerI18n,\n CNGX_RECYCLER_I18N,\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 { 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} from './material-bridge/bidirectional-sync';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAUA;;;;;;;;;;;;;;;AAeG;MAMU,QAAQ,CAAA;;IAEV,WAAW,GAAG,KAAK,CAAqB,SAAS,mFAAI,KAAK,EAAE,gBAAgB,EAAA,CAAG;;IAE/E,cAAc,GAAG,KAAK,CAA6B,SAAS,sFACnE,KAAK,EAAE,mBAAmB,EAAA,CAC1B;AACF;;;AAGG;AACM,IAAA,SAAS,GAAG,KAAK,CAAU,KAAK,gFAAC;AAEzB,IAAA,UAAU,GAAG,MAAM,CAAc,EAAE,iFAAC;;IAG5C,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,QAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;;IAE3E,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,WAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;AAE7F;;;AAGG;AACM,IAAA,IAAI,GAAG,QAAQ,CAAC,MACvB,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,KAAK,EAAE,GAAG,IAAI,2EACvF;AAED;;;AAGG;AACM,IAAA,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE;;AAGpC,IAAA,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,CA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,iBAAiB,EAAE,KAAK,OAAO,EAAE;oBACnC;gBACF;gBACA,kBAAkB,CAAC,OAAO,CAAC;AAC7B,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC,CAAC;IAEF;AACG,SAAA,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC;AACnC,SAAA,SAAS,CAAC,CAAC,GAAG,KAAI;AACjB,QAAA,IAAI,cAAc,EAAE,KAAK,GAAG,EAAE;YAC5B;QACF;QACA,mBAAmB,CAAC,GAAG,CAAC;;;;;;;;;;;;;AAaxB,QAAA,MAAM,UAAU,GAAG,cAAc,EAAE;AACnC,QAAA,IAAI,iBAAiB,EAAE,KAAK,UAAU,EAAE;YACtC,kBAAkB,CAAC,UAAU,CAAC;QAChC;AACF,IAAA,CAAC,CAAC;AACN;;AC1KA;;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.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/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-state/create-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/from-resource.ts","../../../projects/common/data/async-state/from-http-resource.ts","../../../projects/common/data/async-state/operators.ts","../../../projects/common/data/async/async.directive.ts","../../../projects/common/data/display/metric/metric.component.ts","../../../projects/common/data/display/trend/trend.component.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-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 { 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\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 * 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 *\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// * <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: '[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 private readonly sortsState = signal<SortEntry[]>([]);\n\n /** The active sort column of the primary entry (controlled takes precedence in single-sort mode). */\n readonly active = computed(() => this.activeInput() ?? this.sortsState()[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.sortsState()[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 );\n\n /**\n * All active sort entries in priority order.\n * Contains at most one entry when additive mode has not been used.\n */\n readonly sorts = this.sortsState.asReadonly();\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 → toggle direction (asc → desc → asc)\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 setSort(field: string, additive = false): void {\n if (additive) {\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 const current = this.sortsState();\n const dir: 'asc' | 'desc' =\n field === current[0]?.active ? (current[0].direction === 'asc' ? 'desc' : 'asc') : 'asc';\n const entry: SortEntry = { active: field, direction: dir };\n this.sortsState.set([entry]);\n this.sortChange.emit(entry);\n this.sortsChange.emit([entry]);\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, Directive, input } from '@angular/core';\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 entry = computed(() =>\n this.cngxSortRef()\n .sorts()\n .find((s) => s.active === this.field()),\n );\n\n /** `true` when this column is part of the active sort (primary or secondary). */\n readonly isActive = computed(() => this.entry() !== undefined);\n /** `true` when this column is active and sorted ascending. */\n readonly isAsc = computed(() => this.entry()?.direction === 'asc');\n /** `true` when this column is active and sorted descending. */\n readonly isDesc = computed(() => this.entry()?.direction === 'desc');\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 = computed(() => {\n const idx = this.cngxSortRef()\n .sorts()\n .findIndex((s) => s.active === this.field());\n return idx === -1 ? 0 : idx + 1;\n });\n\n /** The `aria-sort` attribute value for the host element. */\n readonly ariaSort = computed((): 'ascending' | 'descending' | null => {\n if (!this.isActive()) {\n return null;\n }\n return this.isAsc() ? 'ascending' : 'descending';\n });\n\n protected handleSort(event?: MouseEvent): void {\n const additive = this.cngxSortRef().multiSort() && (event?.shiftKey ?? false);\n this.cngxSortRef().setSort(this.field(), additive);\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 DestroyRef,\n Directive,\n TemplateRef,\n afterNextRender,\n contentChild,\n inject,\n input,\n model,\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.** The bridge calls\n * `filterRef.addPredicate(filterKey, predicateFn)` EXACTLY ONCE\n * during mount (in `afterNextRender`, because `input.required()`\n * cannot be read from the constructor body). `predicateFn` is a\n * closure that reads `this.selectedValues()` and\n * `this.optionValueFn()` 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.\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.** `DestroyRef.onDestroy` calls `removePredicate` only\n * when registration actually happened (`registered` flag) - guards\n * against the case where the component is destroyed before\n * `afterNextRender` fires. The destroy callback reads `filterRef`\n * and `filterKey` lazily so a consumer that re-binds these between\n * mount and unmount cleans the latest binding (per\n * `reference_signal_architecture` memory-hygiene rule).\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 *\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 template: `\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 private registered = false;\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 afterNextRender(() => {\n this.filterRef().addPredicate(this.filterKey(), predicateFn);\n this.registered = true;\n });\n\n inject(DestroyRef).onDestroy(() => {\n if (!this.registered) {\n return;\n }\n this.filterRef().removePredicate(this.filterKey());\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 `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 * // 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 * // With CngxMatPaginator:\n * <cngx-mat-paginator [cngxPaginateRef]=\"pg\" />\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/data-source/signal-observable-bridge</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/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: '[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 const start = this.pageIndex() * this.pageSize();\n return [start, start + this.pageSize()];\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 { 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 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\nfunction defaultSearchFn<T>(item: T, term: string): boolean {\n const lower = term.toLowerCase();\n return Object.values(item as Record<string, unknown>).some((v) =>\n v === null || v === undefined || typeof v === 'object'\n ? false\n : String(v as string | number | boolean | bigint)\n .toLowerCase()\n .includes(lower),\n );\n}\n\nfunction defaultSortFn<T>(a: T, b: T, field: string, dir: 'asc' | 'desc'): number {\n const toStr = (v: unknown): string =>\n v === null || v === undefined || typeof v === 'object'\n ? ''\n : String(v as string | number | boolean | bigint);\n const av = toStr((a as Record<string, unknown>)[field]);\n const bv = toStr((b as Record<string, unknown>)[field]);\n const cmp = av.localeCompare(bv, undefined, { numeric: true, sensitivity: 'base' });\n return dir === 'asc' ? cmp : -cmp;\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 case-insensitive match\n * across all primitive-valued properties.\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 locale-aware string comparison.\n */\n sortFn?: (a: T, b: T, field: string, direction: 'asc' | 'desc') => number;\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 * 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 sort = inject(CngxSort, { optional: true });\n private readonly filter = inject(CngxFilter, { optional: true });\n // CngxSearch typically lives on a child <input> below the component injector,\n // so this inject returns null in the common case. It resolves only when CngxSearch\n // is placed as a hostDirective on the same component. For child-input search,\n // use injectDataSource() + manual computed() instead.\n private readonly search = inject(CngxSearch, { optional: true });\n private readonly paginate = inject(CngxPaginate, { optional: true });\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 const predicate = this.filter?.predicate();\n const term = this.search?.term();\n const searchFn = this.options?.searchFn ?? defaultSearchFn<T>;\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 sorts = this.sort?.sorts() ?? [];\n const sortFn = this.options?.sortFn ?? defaultSortFn<T>;\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 range = this.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 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 { 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';\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>(): 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 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 { 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';\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 * Prevents request storms when multiple signals change rapidly.\n * @default 50\n */\n debounce?: number;\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 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 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, effect, type Resource, signal } from '@angular/core';\nimport type { AsyncStatus, CngxAsyncState } from '@cngx/core/utils';\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 // Track whether a successful load has ever occurred.\n // Needed because ResourceStatus has no \"first load\" concept.\n const hadSuccess = signal(false);\n\n effect(() => {\n const s = ref.status();\n if (s === 'resolved' || s === 'local') {\n hadSuccess.set(true);\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 const data = computed(() => (ref.hasValue() ? ref.value() : undefined));\n const error = computed(() => ref.error());\n\n const isLoading = computed(() => status() === 'loading');\n const isPending = computed(() => false); // resource() has no mutation concept\n const isRefreshing = computed(() => status() === 'refreshing');\n const isBusy = computed(() => ref.isLoading());\n const isFirstLoad = computed(() => !hadSuccess() && (isBusy() || status() === 'idle'));\n const isEmpty = computed(() => {\n const d = data();\n return d == null || (Array.isArray(d) && d.length === 0);\n });\n const hasData = computed(() => ref.hasValue() && !isEmpty());\n const isSettled = computed(() => {\n const s = status();\n return s === 'success' || s === 'error';\n });\n const lastUpdated = signal<Date | undefined>(undefined);\n\n effect(() => {\n const s = ref.status();\n if (s === 'resolved' || s === 'local') {\n lastUpdated.set(new Date());\n }\n });\n\n return {\n status,\n data,\n error,\n progress: signal(undefined).asReadonly(),\n isLoading,\n isPending,\n isRefreshing,\n isBusy,\n isFirstLoad,\n isEmpty,\n hasData,\n isSettled,\n lastUpdated: lastUpdated.asReadonly(),\n };\n}\n","import { computed, effect, type Resource, signal } from '@angular/core';\nimport type { AsyncStatus, CngxAsyncState } from '@cngx/core/utils';\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 const hadSuccess = signal(false);\n\n effect(() => {\n const s = ref.status();\n if (s === 'resolved' || s === 'local') {\n hadSuccess.set(true);\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 const data = computed(() => (ref.hasValue() ? ref.value() : undefined));\n const error = computed(() => ref.error());\n\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 const isLoading = computed(() => status() === 'loading');\n const isPending = computed(() => false);\n const isRefreshing = computed(() => status() === 'refreshing');\n const isBusy = computed(() => ref.isLoading());\n const isFirstLoad = computed(() => !hadSuccess() && isBusy());\n const isEmpty = computed(() => {\n const d = data();\n return d == null || (Array.isArray(d) && d.length === 0);\n });\n const hasData = computed(() => ref.hasValue() && !isEmpty());\n const isSettled = computed(() => {\n const s = status();\n return s === 'success' || s === 'error';\n });\n const lastUpdated = signal<Date | undefined>(undefined);\n\n effect(() => {\n const s = ref.status();\n if (s === 'resolved' || s === 'local') {\n lastUpdated.set(new Date());\n }\n });\n\n return {\n status,\n data,\n error,\n progress,\n isLoading,\n isPending,\n isRefreshing,\n isBusy,\n isFirstLoad,\n isEmpty,\n hasData,\n isSettled,\n lastUpdated: lastUpdated.asReadonly(),\n };\n}\n","import {\n type MonoTypeOperatorFunction,\n type Observable,\n type OperatorFunction,\n defer,\n filter,\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: 'loading' | 'refreshing' | 'pending'): void;\n setSuccess(data: T): void;\n setError(error: unknown): void;\n setProgress(value: number | undefined): void;\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 * On next: calls `setSuccess(value)`.\n * On error: calls `setError(err)` and **re-throws** (does not swallow).\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 ?? 'loading');\n return source.pipe(\n tap({\n next: (value) => state.setSuccess(value),\n error: (err: unknown) => state.setError(err),\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 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) => state.setSuccess(value),\n error: (err: unknown) => state.setError(err),\n }),\n );\n });\n}\n","import {\n computed,\n Directive,\n effect,\n type EmbeddedViewRef,\n inject,\n input,\n signal,\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 *\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 private readonly currentView = signal<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.set(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 {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n LOCALE_ID,\n ViewEncapsulation,\n} from '@angular/core';\n\n/**\n * Displays a formatted numeric value with optional unit.\n *\n * Uses `Intl.NumberFormat` with the injected `LOCALE_ID` for locale-aware\n * formatting. Null values render as an em-dash.\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 '[attr.aria-label]': 'accessibleValue()',\n },\n template: `\n <span class=\"cngx-metric__value\">{{ formattedValue() }}</span>\n @if (unit()) {\n <span class=\"cngx-metric__unit\">{{ unit() }}</span>\n }\n `,\n styleUrls: ['./metric.component.css'],\n})\nexport class CngxMetric {\n private readonly locale = inject(LOCALE_ID);\n\n /** Numeric or string value. `null` renders as a placeholder hyphen. */\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 '\\u2014';\n }\n if (typeof v === 'string') {\n return v;\n }\n return this.format()\n ? new Intl.NumberFormat(this.locale, this.format()).format(v)\n : v.toLocaleString(this.locale);\n });\n\n /** @internal Full accessible description including unit. */\n readonly accessibleValue = computed(() => {\n const v = this.formattedValue();\n const u = this.unit();\n return u ? `${v} ${u}` : v;\n });\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\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 '[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 /** 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 readonly icon = computed(() =>\n this.value() > 0 ? '\\u2191' : this.value() < 0 ? '\\u2193' : '\\u2192',\n );\n\n /** @internal */\n readonly formattedValue = computed(() => {\n const v = this.value();\n const abs = Math.abs(v);\n return `${v > 0 ? '+' : ''}${abs.toFixed(1)}\\u202F%`;\n });\n\n /** @internal */\n readonly resolvedLabel = computed(() => {\n if (this.label()) {\n return this.label()!;\n }\n const dir = this.value() > 0 ? 'up' : this.value() < 0 ? 'down' : 'unchanged';\n return `${this.formattedValue()} ${dir}`;\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 overscan Number of extra items to render above/below the viewport.\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 * @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 overscan: number,\n columns = 1,\n): RangeResult {\n if (totalCount <= 0 || clientHeight <= 0) {\n return EMPTY_RANGE;\n }\n\n if (typeof estimateSize === 'number') {\n return computeFixedRange(scrollTop, clientHeight, totalCount, estimateSize, overscan, columns);\n }\n\n // variable heights: grid mode unsupported, columns ignored\n return computeVariableRange(scrollTop, clientHeight, totalCount, estimateSize, overscan);\n}\n\nfunction computeFixedRange(\n scrollTop: number,\n clientHeight: number,\n totalCount: number,\n itemSize: number,\n overscan: number,\n columns: number,\n): RangeResult {\n if (columns > 1) {\n return computeGridRange(scrollTop, clientHeight, totalCount, itemSize, overscan, columns);\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 - overscan);\n const end = Math.min(totalCount, rawEnd + overscan);\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 overscan: 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 overscanRows = Math.ceil(overscan / columns);\n const startRow = Math.max(0, rawStartRow - overscanRows);\n const endRow = Math.min(totalRows, rawEndRow + overscanRows);\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 overscan: 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 - overscan);\n const end = Math.min(totalCount, rawEnd + 1 + overscan);\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';\n\n/**\n * Reactive scroll state of a container element.\n * Both signals are updated synchronously inside the same rAF callback —\n * Angular's Signal scheduling coalesces the two writes so consumers\n * evaluate once per frame, not twice.\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 function attachListeners(el: HTMLElement, onCleanup: (fn: () => void) => void): void {\n elementState.set(el);\n scrollTopState.set(el.scrollTop);\n clientHeightState.set(el.clientHeight);\n\n let rafId: number | null = null;\n\n const handleScroll = () => {\n if (rafId != null) {\n return;\n }\n rafId = requestAnimationFrame(() => {\n rafId = null;\n scrollTopState.set(el.scrollTop);\n clientHeightState.set(el.clientHeight);\n });\n };\n\n el.addEventListener('scroll', handleScroll, { passive: true });\n\n const resizeObserver = new ResizeObserver(() => {\n clientHeightState.set(el.clientHeight);\n });\n resizeObserver.observe(el);\n\n onCleanup(() => {\n el.removeEventListener('scroll', handleScroll);\n if (rafId != null) {\n cancelAnimationFrame(rafId);\n }\n resizeObserver.disconnect();\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 retryTick.update((v) => v + 1);\n }\n });\n\n destroyRef.onDestroy(() => {\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 Signal,\n computed,\n effect,\n inject,\n isDevMode,\n signal,\n untracked,\n} from '@angular/core';\nimport type { CngxAsyncState } from '@cngx/core/utils';\nimport { createTransitionTracker } from '@cngx/core/utils';\n\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/**\n * Injection token for recycler SR announcement texts.\n * Provides English defaults via factory. 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<RecyclerI18n>('CngxRecyclerI18n', {\n factory: (): RecyclerI18n => ({\n loaded: (n, t) => `${n} more items loaded. ${t} total.`,\n filtered: (c) => `${c} results found.`,\n empty: () => 'No results.',\n error: () => 'Error loading data.',\n }),\n});\n\n/**\n * Provider function for custom recycler i18n texts.\n *\n * ```typescript\n * providers: [provideRecyclerI18n({\n * loaded: (n, t) => `${n} weitere Einträge. ${t} gesamt.`,\n * filtered: (c) => `${c} Ergebnisse.`,\n * empty: () => 'Keine Ergebnisse.',\n * error: () => 'Fehler beim Laden.',\n * })]\n * ```\n *\n * @category common/data/recycler\n */\nexport function provideRecyclerI18n(i18n: RecyclerI18n) {\n return { provide: CNGX_RECYCLER_I18N, useValue: i18n };\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 /** Estimated height per item (px). Number or function per index. */\n estimateSize: 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 /** 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 * Inline equivalent of `createVisibilityTimer` from `@cngx/ui/feedback` (Level 4, not importable).\n *\n * Uses `setTimeout` inside an effect - this is a timer-driven side effect, not derived state.\n * Same pattern accepted in `createVisibilityTimer` for `CngxLoadingOverlay`.\n * Safe in zoneless: the `setTimeout` callback only writes a signal, which schedules\n * Angular's own change detection - no Zone.js dependency.\n *\n * @param source Boolean signal to delay. When `true`, starts the timer.\n * @param delayMs Delay in milliseconds before the flag becomes `true`.\n * @returns A readonly signal that becomes `true` after `delayMs` when `source` is `true`.\n * @internal\n */\nfunction createDelayedFlag(source: Signal<boolean>, delayMs: number): Signal<boolean> {\n if (delayMs <= 0) {\n return source;\n }\n const flag = signal(false);\n effect((onCleanup) => {\n const active = source();\n if (active) {\n const timer = setTimeout(() => flag.set(true), delayMs);\n onCleanup(() => {\n clearTimeout(timer);\n flag.set(false);\n });\n } else {\n flag.set(false);\n }\n });\n return flag.asReadonly();\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 = 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 if (typeof config.estimateSize === 'function' && 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 // 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 return computeRange(\n scrollState.scrollTop(),\n scrollState.clientHeight(),\n config.totalCount(),\n size,\n overscan,\n cols,\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 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 Math.min(Math.max(0, end() - effectiveOverscan() - 1), 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 = createDelayedFlag(isLoading, config.skeletonDelay ?? 0);\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 if (current === 'success' && (previous === 'loading' || previous === 'refreshing')) {\n const diff = total - prevTotal;\n if (diff > 0) {\n announcementState.set(i18n.loaded(diff, total));\n } else {\n announcementState.set(i18n.filtered(total));\n }\n } else if (current === 'error') {\n announcementState.set(i18n.error());\n } else if (current === 'success' && total === 0) {\n announcementState.set(i18n.empty());\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 if (prevTotal > 0 && diff > 0) {\n announcementState.set(i18n.loaded(diff, total));\n } else if (prevTotal > 0 && total === 0) {\n announcementState.set(i18n.empty());\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\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 { Directive, ElementRef, effect, inject, input } from '@angular/core';\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\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 const observer = new ResizeObserver(() => {\n recycler.measure(index, element);\n });\n observer.observe(element);\n\n onCleanup(() => {\n observer.disconnect();\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 { 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'] },\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 cancel(): 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 // tear down previous runner BEFORE bumping commitId, otherwise its\n // supersede-check would pass and fire after all\n active?.cancel();\n const id = ++commitId;\n intendedState.set(intended);\n slot.set('pending');\n\n active = runner({\n onSuccess: (committed) => {\n if (id !== commitId) {\n return;\n }\n slot.setSuccess(committed);\n active = null;\n handlers.onSuccess(committed);\n },\n onError: (err) => {\n if (id !== commitId) {\n return;\n }\n slot.setError(err);\n active = null;\n handlers.onError(err, previous);\n },\n });\n },\n\n cancel() {\n active?.cancel();\n active = null;\n // bump id so late callbacks from the aborted runner are superseded\n commitId++;\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 * (Sheriff Level-2 invariant).\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 * 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 * **Pessimistic-commit gate (deliberately absent).** An earlier draft\n * carried a third option `commitState: CngxAsyncState<unknown>` that\n * gated the Material write while `commitState.isPending()`. The plan\n * (`global-material-bridge-and-architecture-hardening-plan` §54)\n * specified this gate \"for the pessimistic flow.\" Implementation\n * showed the gate is redundant: cngx commit handlers already keep\n * `presenter.activeIndex` at the origin during pessimistic-pending,\n * so the equality guard alone suppresses the Material write.\n * Conversely, in optimistic mode the presenter advances IMMEDIATELY\n * (before the commit settles); a `pending`-keyed gate would suppress\n * that legitimate advance and break the optimistic UX. Dropping the\n * gate makes both modes work via the simple presenter→Material\n * mirror — same outcome as the gate version for pessimistic, and the\n * correct outcome for optimistic.\n *\n * **Material-eager-advance reconciliation.** Material's MDC click\n * handler advances `selectedIndex` synchronously *before* the\n * Material→presenter subscription forwards the click to\n * `onMaterialSelection`. When the presenter HOLDS its index\n * (pessimistic mode + bound `commitAction`, or any future contract\n * that refuses a select), the presenter→Material `effect()` does\n * NOT fire — `presenterIndex` did not change — so Material's\n * eager-advance is never reverted, and the visual diverges from the\n * cngx semantic state. Closes `tabs-accepted-debt §6` by force-\n * writing Material back to the presenter's value when the\n * forwarding callback returns and the values still diverge. Idempotent\n * with the regular presenter→Material effect (the read-equality guard\n * at the effect site suppresses a duplicate write when the presenter\n * later changes to the same value).\n *\n * @category common/data/material-bridge\n */\nexport function createMaterialBidirectionalSync(\n opts: CngxMaterialBidirectionalSyncOptions,\n): void {\n const {\n presenterIndex,\n readSelectedIndex,\n writeSelectedIndex,\n selectionChange$,\n onMaterialSelection,\n injector,\n destroyRef,\n } = opts;\n\n runInInjectionContext(injector, () => {\n effect(() => {\n const desired = presenterIndex();\n untracked(() => {\n if (readSelectedIndex() === desired) {\n return;\n }\n writeSelectedIndex(desired);\n });\n });\n });\n\n selectionChange$\n .pipe(takeUntilDestroyed(destroyRef))\n .subscribe((idx) => {\n if (presenterIndex() === idx) {\n return;\n }\n onMaterialSelection(idx);\n // Material-eager-advance reconciliation (tabs-accepted-debt §6).\n // The forwarding callback above lets the presenter run its\n // commit-action gate; in pessimistic mode the presenter holds\n // `activeIndex` at origin instead of advancing. The\n // presenter→Material effect only fires on signal CHANGE, so a\n // hold-at-origin leaves Material at the user-clicked target —\n // out of sync with the cngx semantic state. Detect the\n // post-callback divergence and force a Material write so the\n // visual snaps back to the presenter's authoritative index.\n // Loop-safe: writing `selectedIndex` re-emits `selectionChange$`,\n // but the early-return guard at the top of this subscriber\n // (`presenterIndex() === idx`) drops the re-entrant emission.\n const reconciled = presenterIndex();\n if (readSelectedIndex() !== reconciled) {\n writeSelectedIndex(reconciled);\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 { 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 { CngxDataSource, injectDataSource } from './data-source/data-source';\nexport {\n CngxSmartDataSource,\n injectSmartDataSource,\n type CngxSmartDataSourceOptions,\n} from './data-source/smart-data-source';\n\nexport {\n createManualState,\n type ManualAsyncState,\n createAsyncState,\n type MutableAsyncState,\n injectAsyncState,\n type ReactiveAsyncState,\n type InjectAsyncStateOptions,\n resolveAsyncView,\n type AsyncView,\n} from './async-state';\n\nexport { CngxAsync, type CngxAsyncContext } from './async/async.directive';\n\nexport { CngxMetric } from './display/metric/metric.component';\nexport { CngxTrend } from './display/trend/trend.component';\n\nexport {\n injectRecycler,\n provideRecyclerI18n,\n CNGX_RECYCLER_I18N,\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 { 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} from './material-bridge/bidirectional-sync';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;MAMU,QAAQ,CAAA;;IAEV,WAAW,GAAG,KAAK,CAAqB,SAAS,mFAAI,KAAK,EAAE,gBAAgB,EAAA,CAAG;;IAE/E,cAAc,GAAG,KAAK,CAA6B,SAAS,sFACnE,KAAK,EAAE,mBAAmB,EAAA,CAC1B;AACF;;;AAGG;AACM,IAAA,SAAS,GAAG,KAAK,CAAU,KAAK,gFAAC;AAEzB,IAAA,UAAU,GAAG,MAAM,CAAc,EAAE,iFAAC;;IAG5C,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,QAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;;IAE3E,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,WAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;AAE7F;;;AAGG;AACM,IAAA,IAAI,GAAG,QAAQ,CAAC,MACvB,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,KAAK,EAAE,GAAG,IAAI,2EACvF;AAED;;;AAGG;AACM,IAAA,KAAK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