@cngx/common 0.1.0-rc.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/a11y/README.md +15 -2
  2. package/button/README.md +258 -0
  3. package/command/README.md +42 -2
  4. package/data/README.md +15 -12
  5. package/fesm2022/cngx-common-a11y.mjs +1076 -319
  6. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  7. package/fesm2022/cngx-common-audio.mjs +99 -77
  8. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  9. package/fesm2022/cngx-common-button.mjs +1084 -0
  10. package/fesm2022/cngx-common-button.mjs.map +1 -0
  11. package/fesm2022/cngx-common-card.mjs +138 -78
  12. package/fesm2022/cngx-common-card.mjs.map +1 -1
  13. package/fesm2022/cngx-common-chart.mjs +799 -327
  14. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  15. package/fesm2022/cngx-common-command.mjs +101 -25
  16. package/fesm2022/cngx-common-command.mjs.map +1 -1
  17. package/fesm2022/cngx-common-data.mjs +861 -423
  18. package/fesm2022/cngx-common-data.mjs.map +1 -1
  19. package/fesm2022/cngx-common-dialog.mjs +198 -160
  20. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  21. package/fesm2022/cngx-common-display.mjs +693 -329
  22. package/fesm2022/cngx-common-display.mjs.map +1 -1
  23. package/fesm2022/cngx-common-interactive.mjs +7303 -2774
  24. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  25. package/fesm2022/cngx-common-layout.mjs +2174 -442
  26. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  27. package/fesm2022/cngx-common-menu-button.mjs +557 -0
  28. package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
  29. package/fesm2022/cngx-common-popover.mjs +2109 -557
  30. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  31. package/fesm2022/cngx-common-stepper.mjs +548 -419
  32. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  33. package/fesm2022/cngx-common-tabs.mjs +442 -331
  34. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  35. package/fesm2022/cngx-common-timeline.mjs +44 -71
  36. package/fesm2022/cngx-common-timeline.mjs.map +1 -1
  37. package/fesm2022/cngx-common.mjs +10 -10
  38. package/fesm2022/cngx-common.mjs.map +1 -1
  39. package/interactive/README.md +30 -19
  40. package/layout/README.md +17 -1
  41. package/menu-button/README.md +234 -0
  42. package/package.json +31 -8
  43. package/popover/README.md +81 -4
  44. package/popover/tooltip-indicator.scss +52 -0
  45. package/schematics/collection.json +9 -0
  46. package/schematics/ng-add/index.js +9 -0
  47. package/schematics/ng-add/schema.json +96 -0
  48. package/schematics/package.json +3 -0
  49. package/stepper/README.md +5 -5
  50. package/theming/components/cngx-accordion.css +36 -7
  51. package/theming/components/cngx-async.css +185 -37
  52. package/theming/components/cngx-backdrop.css +3 -1
  53. package/theming/components/cngx-badge.css +20 -5
  54. package/theming/components/cngx-bottom-sheet.css +2 -0
  55. package/theming/components/cngx-breadcrumb.css +3 -1
  56. package/theming/components/cngx-button-group.css +325 -0
  57. package/theming/components/cngx-button-toggle.css +55 -23
  58. package/theming/components/cngx-button.css +975 -0
  59. package/theming/components/cngx-data-grid.css +2 -0
  60. package/theming/components/cngx-dialog.css +3 -1
  61. package/theming/components/cngx-divider.css +24 -9
  62. package/theming/components/cngx-drawer.css +153 -0
  63. package/theming/components/cngx-icon-glyph.css +76 -0
  64. package/theming/components/cngx-listbox.css +79 -25
  65. package/theming/components/cngx-menu.css +112 -52
  66. package/theming/components/cngx-nav.css +1220 -0
  67. package/theming/components/cngx-popover-sheet.css +434 -0
  68. package/theming/components/cngx-popover.css +37 -9
  69. package/theming/components/cngx-recycler-placeholder.css +2 -0
  70. package/theming/components/cngx-ripple.css +74 -16
  71. package/theming/components/cngx-sidebar.css +71 -0
  72. package/theming/components/cngx-slider.css +3 -1
  73. package/theming/components/cngx-tooltip.css +2 -0
  74. package/timeline/README.md +2 -2
  75. package/types/cngx-common-a11y.d.ts +488 -112
  76. package/types/cngx-common-audio.d.ts +60 -88
  77. package/types/cngx-common-button.d.ts +698 -0
  78. package/types/cngx-common-card.d.ts +104 -78
  79. package/types/cngx-common-chart.d.ts +677 -389
  80. package/types/cngx-common-command.d.ts +55 -41
  81. package/types/cngx-common-data.d.ts +506 -360
  82. package/types/cngx-common-dialog.d.ts +94 -127
  83. package/types/cngx-common-display.d.ts +475 -300
  84. package/types/cngx-common-interactive.d.ts +4383 -1721
  85. package/types/cngx-common-layout.d.ts +1399 -288
  86. package/types/cngx-common-menu-button.d.ts +382 -0
  87. package/types/cngx-common-popover.d.ts +990 -268
  88. package/types/cngx-common-stepper.d.ts +374 -465
  89. package/types/cngx-common-tabs.d.ts +309 -403
  90. package/types/cngx-common-timeline.d.ts +50 -109
@@ -1 +1 @@
1
- {"version":3,"file":"cngx-common-a11y.mjs","sources":["../../../projects/common/a11y/aria/aria-expanded.directive.ts","../../../projects/common/a11y/aria/live-region.directive.ts","../../../projects/common/a11y/aria/live-announcer.ts","../../../projects/common/a11y/focus/autofocus.directive.ts","../../../projects/common/a11y/focus/focus-restore.directive.ts","../../../projects/common/a11y/focus/focus-trap.directive.ts","../../../projects/common/a11y/focus/focus-visible.directive.ts","../../../projects/common/a11y/roving/roving-tabindex.directive.ts","../../../projects/common/a11y/active-descendant/ad-item.token.ts","../../../projects/common/a11y/active-descendant/active-descendant.directive.ts","../../../projects/common/a11y/motion/reduced-motion.directive.ts","../../../projects/common/a11y/public-api.ts","../../../projects/common/a11y/cngx-common-a11y.ts"],"sourcesContent":["import { Directive, input } from '@angular/core';\n\n/**\n * Manages `aria-expanded` and optionally `aria-controls` on the host element.\n *\n * Pairs a disclosure trigger (button) with its controlled region via standard\n * WAI-ARIA attributes. Supports accordions, dropdowns, tree items, and any\n * disclosure pattern where a control toggles visibility of another element.\n *\n * Unlike manual `[attr.aria-expanded]` binding, this directive couples both\n * attributes (`aria-expanded` + `aria-controls`) in a single declaration,\n * preventing mismatches where one is set without the other.\n *\n * ### Simple disclosure\n * ```html\n * <button [cngxAriaExpanded]=\"open()\" [controls]=\"'panel-id'\" (click)=\"open.set(!open())\">\n * Toggle\n * </button>\n * <div id=\"panel-id\" role=\"region\" [hidden]=\"!open()\">Panel content</div>\n * ```\n *\n * ### Accordion with multiple panels\n * ```html\n * @for (panel of panels(); track panel.id) {\n * <button [cngxAriaExpanded]=\"panel.open\" [controls]=\"panel.id\" (click)=\"toggle(panel)\">\n * {{ panel.label }}\n * </button>\n * @if (panel.open) {\n * <div [id]=\"panel.id\" role=\"region\">{{ panel.content }}</div>\n * }\n * }\n * ```\n *\n * @category common/a11y\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/aria-expanded.directive.ts\n * @since 0.1.0\n * @relatedTo CngxLiveRegion, CngxExpandable, CngxDisclosure\n * <example-url>http://localhost:4200/#/common/a11y/aria-expanded/accordion-multiple-panels</example-url>\n * <example-url>http://localhost:4200/#/common/a11y/aria-expanded/disclosure-pattern</example-url>\n */\n@Directive({\n selector: '[cngxAriaExpanded]',\n exportAs: 'cngxAriaExpanded',\n standalone: true,\n host: {\n '[attr.aria-expanded]': 'expanded()',\n '[attr.aria-controls]': 'controls() ?? null',\n },\n})\nexport class CngxAriaExpanded {\n /** Whether the controlled element is currently expanded. Sets `aria-expanded`. */\n readonly expanded = input<boolean>(false, { alias: 'cngxAriaExpanded' });\n /** The `id` of the controlled element. Sets `aria-controls`. */\n readonly controls = input<string | undefined>(undefined);\n}\n","import { Directive, input } from '@angular/core';\n\n/**\n * Configures the host element as an ARIA live region.\n *\n * Screen readers monitor live regions and announce content changes automatically.\n * `polite` announcements are queued after the current utterance finishes;\n * `assertive` announcements interrupt immediately. `off` disables announcements.\n *\n * Sets `role=\"alert\"` for assertive regions and `role=\"status\"` for polite regions\n * via a host binding - no manual attribute wiring needed.\n *\n * Unlike CDK's `LiveAnnouncer` service (which creates a hidden DOM element and\n * requires imperative `announce()` calls), this directive decorates your own\n * element declaratively - the content you render IS the announcement.\n *\n * ### Status message\n * ```html\n * <div cngxLiveRegion [politeness]=\"'polite'\">\n * {{ statusMessage() }}\n * </div>\n * ```\n *\n * ### Form validation error (assertive)\n * ```html\n * <div cngxLiveRegion [politeness]=\"'assertive'\"\n * [style.color]=\"error() ? 'red' : 'transparent'\">\n * {{ error() }}\n * </div>\n * ```\n *\n * @category common/a11y\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/live-region.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAriaExpanded\n * <example-url>http://localhost:4200/#/common/a11y/live-region/form-validation-assertive-error-announcements</example-url>\n * <example-url>http://localhost:4200/#/common/a11y/live-region/polite-vs-assertive</example-url>\n */\n@Directive({\n selector: '[cngxLiveRegion]',\n exportAs: 'cngxLiveRegion',\n standalone: true,\n host: {\n '[attr.aria-live]': 'politeness()',\n '[attr.aria-atomic]': 'atomic()',\n '[attr.aria-relevant]': 'relevant()',\n '[attr.role]':\n \"politeness() === 'off' ? null : politeness() === 'assertive' ? 'alert' : 'status'\",\n },\n})\nexport class CngxLiveRegion {\n /**\n * Controls the urgency of announcements.\n * - `'polite'` - queued after current speech (default)\n * - `'assertive'` - interrupts immediately\n * - `'off'` - no announcements\n */\n readonly politeness = input<'polite' | 'assertive' | 'off'>('polite');\n /** Whether the entire region should be announced as a whole. */\n readonly atomic = input<boolean>(true);\n /** Which types of content changes to announce. Space-separated: `additions`, `removals`, `text`. */\n readonly relevant = input<string>('additions text');\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { inject, Injectable, type OnDestroy, PLATFORM_ID } from '@angular/core';\n\n/**\n * Politeness channel for {@link CngxLiveAnnouncer.announce}: `'polite'` queues\n * after the current utterance, `'assertive'` interrupts it immediately.\n *\n * @category common/a11y\n */\nexport type AriaLivePoliteness = 'polite' | 'assertive';\n\n// One frame. Clear the region this long before writing so an intentionally\n// repeated identical string still registers as a content change for the SR.\nconst CLEAR_DELAY_MS = 16;\n\n/**\n * Imperative, reusable polite/assertive live-region announcer.\n *\n * The imperative counterpart to {@link CngxLiveRegion}: where the directive\n * decorates an element you render (the content IS the announcement), this\n * service owns two visually-hidden `aria-live` regions appended to\n * `document.body` - one persistent polite node and one persistent assertive\n * node - and exposes an `announce(message, politeness)` call for template-less\n * directives and event handlers (e.g. `CngxCopyValue` copy success,\n * `CngxOtpInput` completion).\n *\n * Each region is created lazily on the first announcement of its politeness and\n * reused thereafter. Because polite and assertive live in separate fixed-\n * politeness nodes, an assertive announcement never clobbers a concurrent\n * polite one. Per region, the text is cleared and re-set one frame later so an\n * identical consecutive message is still re-read by the screen reader.\n *\n * SSR-safe: all DOM access is guarded by `isPlatformBrowser`; on the server\n * `announce()` is a no-op and no region is created.\n *\n * ```typescript\n * const announcer = inject(CngxLiveAnnouncer);\n * announcer.announce('Copied');\n * announcer.announce('Save failed', 'assertive');\n * ```\n *\n * @category common/a11y\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/live-announcer.ts\n * @since 0.1.0\n * @relatedTo CngxLiveRegion\n */\n@Injectable({ providedIn: 'root' })\nexport class CngxLiveAnnouncer implements OnDestroy {\n private readonly doc = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private politeRegion: HTMLElement | null = null;\n private assertiveRegion: HTMLElement | null = null;\n private readonly pending: Record<AriaLivePoliteness, ReturnType<typeof setTimeout> | null> = {\n polite: null,\n assertive: null,\n };\n\n /**\n * Announces `message` through the fixed-politeness live region.\n *\n * @param message Text read by the screen reader.\n * @param politeness `'polite'` (default) queues after the current\n * utterance; `'assertive'` interrupts immediately. Each politeness owns its\n * own region, so the two never overwrite each other.\n */\n announce(message: string, politeness: AriaLivePoliteness = 'polite'): void {\n if (!this.isBrowser) {\n return;\n }\n const region = this.ensureRegion(politeness);\n // Clear first, then write one frame later so repeating the same string\n // still registers as a content change for the SR. Polite and assertive\n // keep independent timers so one politeness never cancels the other.\n region.textContent = '';\n const existing = this.pending[politeness];\n if (existing !== null) {\n clearTimeout(existing);\n }\n this.pending[politeness] = setTimeout(() => {\n region.textContent = message;\n this.pending[politeness] = null;\n }, CLEAR_DELAY_MS);\n }\n\n ngOnDestroy(): void {\n for (const politeness of ['polite', 'assertive'] as const) {\n const timer = this.pending[politeness];\n if (timer !== null) {\n clearTimeout(timer);\n this.pending[politeness] = null;\n }\n }\n this.politeRegion?.remove();\n this.assertiveRegion?.remove();\n this.politeRegion = null;\n this.assertiveRegion = null;\n }\n\n private ensureRegion(politeness: AriaLivePoliteness): HTMLElement {\n const existing = politeness === 'polite' ? this.politeRegion : this.assertiveRegion;\n if (existing) {\n return existing;\n }\n const span = this.doc.createElement('span');\n span.setAttribute('aria-live', politeness);\n span.setAttribute('aria-atomic', 'true');\n span.className = 'cngx-sr-only';\n span.style.position = 'absolute';\n span.style.width = '1px';\n span.style.height = '1px';\n span.style.padding = '0';\n span.style.margin = '-1px';\n span.style.overflow = 'hidden';\n span.style.clip = 'rect(0, 0, 0, 0)';\n span.style.whiteSpace = 'nowrap';\n span.style.border = '0';\n this.doc.body.appendChild(span);\n if (politeness === 'polite') {\n this.politeRegion = span;\n } else {\n this.assertiveRegion = span;\n }\n return span;\n }\n}\n","import {\n afterNextRender,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n Injector,\n} from '@angular/core';\n\n/**\n * Reactive autofocus for dynamically inserted elements.\n *\n * The native `autofocus` HTML attribute only works on initial page load.\n * This directive handles dynamic content: dialogs, panels, stepper steps,\n * and any element that appears after the initial render.\n *\n * Focuses the host element after the next render frame using `afterNextRender`.\n * When `when` changes to `true`, focus is re-applied.\n *\n * ### Focus on insertion\n * ```html\n * @if (showSearch()) {\n * <input cngxAutofocus placeholder=\"Search…\" />\n * }\n * ```\n *\n * ### Conditional focus\n * ```html\n * <input [cngxAutofocus]=\"isActive()\" />\n * ```\n *\n * ### With delay for transitions\n * ```html\n * <input cngxAutofocus [autofocusDelay]=\"200\" />\n * ```\n *\n * @category common/a11y\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/autofocus.directive.ts\n * @since 0.1.0\n * @relatedTo CngxFocusRestore, CngxFocusTrap, CngxFocusVisible\n * <example-url>http://localhost:4200/#/common/a11y/autofocus/conditional-focus</example-url>\n * <example-url>http://localhost:4200/#/common/a11y/autofocus/focus-on-insert</example-url>\n */\n@Directive({\n selector: '[cngxAutofocus]',\n exportAs: 'cngxAutofocus',\n standalone: true,\n})\nexport class CngxAutofocus {\n /** Whether to focus the element. Defaults to `true` (always focus on render). */\n readonly when = input<boolean>(true, { alias: 'cngxAutofocus' });\n /** Delay in ms before focusing - useful when the element appears during a transition. */\n readonly delay = input<number>(0, { alias: 'autofocusDelay' });\n /** `FocusOptions` passed to `element.focus()`. */\n readonly options = input<FocusOptions>({}, { alias: 'autofocusOptions' });\n\n private readonly el = inject(ElementRef<HTMLElement>);\n private readonly injector = inject(Injector);\n private pendingTimer: ReturnType<typeof setTimeout> | null = null;\n private initialized = false;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.clearPending());\n\n afterNextRender(() => {\n if (this.when()) {\n this.scheduleFocus();\n }\n this.initialized = true;\n });\n\n // Re-focus on false→true transitions only; `previousWhen` starts as `true`\n // so the initial effect run does not double-trigger alongside afterNextRender.\n let previousWhen = true;\n effect(() => {\n const current = this.when();\n if (this.initialized && current && !previousWhen) {\n this.scheduleFocus();\n }\n previousWhen = current;\n });\n }\n\n private scheduleFocus(): void {\n this.clearPending();\n const delayMs = this.delay();\n if (delayMs > 0) {\n this.pendingTimer = setTimeout(() => this.applyFocus(), delayMs);\n } else {\n afterNextRender(() => this.applyFocus(), { injector: this.injector });\n }\n }\n\n private applyFocus(): void {\n const el = this.el.nativeElement as HTMLElement;\n // A delayed schedule can outlive its trigger: the condition may have\n // flipped off or the element may have left the DOM. Re-check both so a\n // stale timer cannot steal focus from wherever it moved meanwhile.\n if (!this.when() || !el.isConnected) {\n return;\n }\n el.focus(this.options());\n }\n\n private clearPending(): void {\n if (this.pendingTimer !== null) {\n clearTimeout(this.pendingTimer);\n this.pendingTimer = null;\n }\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { DestroyRef, Directive, ElementRef, inject, input, signal } from '@angular/core';\n\n/**\n * CSS selector matching natively-focusable elements: links with an\n * `href`, the enabled form controls, and anything with an explicit\n * non-negative `tabindex`. Form controls carry `:not(:disabled)` because\n * a disabled control is not in the tab order - without it a descendant\n * probe would count a disabled button as focusable and a restore target\n * could land on an unfocusable element. Single source of truth for \"is\n * this focusable\" - the element-level {@link CngxFocusRestore} predicate\n * matches against it, and descendant probes (e.g. \"does this panel\n * contain a focusable child?\") query against it. Keeping one selector\n * stops the two uses from drifting apart.\n *\n * @category common/a11y\n * @since 0.1.0\n */\nexport const CNGX_FOCUSABLE_SELECTOR =\n 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * Stores the previously focused element and restores focus on destroy.\n *\n * Prevents focus from falling to `<body>` when dynamic content is removed\n * (dialogs closing, panels collapsing, tabs switching). The directive captures\n * `document.activeElement` at initialization time and restores it when the\n * host element is destroyed.\n *\n * Fallback chain: stored element → provided fallback → nearest focusable ancestor.\n * When none resolves, focus is left where the browser put it - `<body>` is\n * deliberately never a restore target.\n *\n * ### Panel that restores focus on close\n * ```html\n * @if (panelOpen()) {\n * <div cngxFocusRestore>\n * Panel content…\n * <button (click)=\"panelOpen.set(false)\">Close</button>\n * </div>\n * }\n * ```\n *\n * ### With explicit fallback\n * ```html\n * <div cngxFocusRestore [focusRestoreFallback]=\"fallbackBtn\">\n * Dynamic content…\n * </div>\n * <button #fallbackBtn>Fallback target</button>\n * ```\n *\n * @category common/a11y\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-restore.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAutofocus, CngxFocusTrap, CngxFocusVisible\n * <example-url>http://localhost:4200/#/common/a11y/focus-restore/inline-details</example-url>\n * <example-url>http://localhost:4200/#/common/a11y/focus-restore/panel-with-automatic-restore</example-url>\n */\n@Directive({\n selector: '[cngxFocusRestore]',\n exportAs: 'cngxFocusRestore',\n standalone: true,\n})\nexport class CngxFocusRestore {\n /** Whether to restore focus when the host element is destroyed. */\n readonly restoreOnDestroy = input<boolean>(true);\n /** Explicit fallback element if the stored element is no longer in the DOM. */\n readonly fallback = input<HTMLElement | null>(null);\n\n private readonly doc = inject(DOCUMENT);\n private readonly el = inject(ElementRef<HTMLElement>);\n private readonly storedElement = signal<HTMLElement | null>(null);\n\n constructor() {\n const activeEl = this.doc.activeElement;\n if (activeEl instanceof HTMLElement) {\n this.storedElement.set(activeEl);\n }\n\n inject(DestroyRef).onDestroy(() => {\n if (!this.restoreOnDestroy()) {\n return;\n }\n\n const target = this.resolveTarget();\n if (target) {\n target.focus();\n }\n });\n }\n\n /** Manually store the current focus target for later restoration. */\n capture(): void {\n const activeEl = this.doc.activeElement;\n if (activeEl instanceof HTMLElement) {\n this.storedElement.set(activeEl);\n }\n }\n\n /** Manually restore focus to the stored element. */\n restore(): void {\n const target = this.resolveTarget();\n if (target) {\n target.focus();\n }\n }\n\n /**\n * Walks the fallback chain:\n * 1. Stored element (if still in DOM and not body/self)\n * 2. Explicit fallback input\n * 3. Nearest focusable ancestor\n */\n private resolveTarget(): HTMLElement | null {\n const stored = this.storedElement();\n // Skip body - it signals \"nothing meaningful was focused\", not a real restore target.\n if (\n stored &&\n stored !== this.doc.body &&\n this.doc.contains(stored) &&\n stored !== (this.el.nativeElement as HTMLElement)\n ) {\n return stored;\n }\n\n const fallback = this.fallback();\n if (fallback && this.doc.contains(fallback)) {\n return fallback;\n }\n\n return this.findFocusableAncestor();\n }\n\n /** Traverses up the DOM tree looking for the first natively focusable element. */\n private findFocusableAncestor(): HTMLElement | null {\n let current = (this.el.nativeElement as HTMLElement).parentElement;\n while (current) {\n if (this.isFocusable(current)) {\n return current;\n }\n current = current.parentElement;\n }\n return null;\n }\n\n /**\n * Checks if an element is natively focusable (tabindex, links, form\n * controls). Element-level predicate over the shared\n * {@link CNGX_FOCUSABLE_SELECTOR}, so it never drifts from the\n * descendant-query callers.\n */\n private isFocusable(el: HTMLElement): boolean {\n return el.matches(CNGX_FOCUSABLE_SELECTOR);\n }\n}\n","import { type FocusTrap, FocusTrapFactory } from '@angular/cdk/a11y';\nimport {\n computed,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n untracked,\n} from '@angular/core';\n\n/**\n * Traps keyboard focus within the host element using the CDK `FocusTrap`.\n *\n * When enabled, Tab and Shift+Tab cycle only within the host element's\n * focusable children. When `autoFocus` is `true` (default), focus moves to\n * the first tabbable element automatically on activation.\n *\n * Wraps CDK's `FocusTrapFactory` with a declarative, Signal-driven API.\n * The CDK's imperative `create()` / `destroy()` / `enabled` setter lifecycle\n * is handled internally via `effect()` and `DestroyRef`.\n *\n * **Nesting:** traps do not coordinate with each other. When traps nest\n * (dialog over drawer), enable only the innermost one and drive each\n * `enabled` from your layering state - two simultaneously enabled traps\n * fight over Tab. `CngxDialogStack` already does this for stacked dialogs.\n *\n * ### Modal dialog\n * ```html\n * <div cngxFocusTrap [enabled]=\"isOpen()\" [autoFocus]=\"true\"\n * tabindex=\"-1\" role=\"dialog\" aria-modal=\"true\"\n * (keydown.escape)=\"isOpen.set(false)\">\n * <input placeholder=\"First input\" />\n * <button (click)=\"isOpen.set(false)\">Close</button>\n * </div>\n * ```\n *\n * ### Drawer / sidebar\n * ```html\n * <nav cngxFocusTrap [enabled]=\"drawerOpen()\" tabindex=\"-1\">\n * <a href=\"/home\">Home</a>\n * <a href=\"/settings\">Settings</a>\n * </nav>\n * ```\n *\n * @category common/a11y\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-trap.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAutofocus, CngxFocusRestore, CngxDialog\n * <example-url>http://localhost:4200/#/common/a11y/focus-trap/modal-dialog</example-url>\n * <example-url>http://localhost:4200/#/common/a11y/focus-trap/slide-out-drawer</example-url>\n */\n@Directive({\n selector: '[cngxFocusTrap]',\n exportAs: 'cngxFocusTrap',\n standalone: true,\n})\nexport class CngxFocusTrap {\n /** Whether the focus trap is active. When `false`, Tab navigates normally. */\n readonly enabled = input<boolean>(false);\n /** Whether to auto-focus the first tabbable element when the trap activates. */\n readonly autoFocus = input<boolean>(true);\n\n /**\n * Readable alias of `enabled` for `exportAs` consumers\n * (`trap.isActive()` reads better than re-binding the input).\n */\n readonly isActive = computed(() => this.enabled());\n\n private readonly trap: FocusTrap;\n\n constructor() {\n const el = inject(ElementRef<HTMLElement>);\n this.trap = inject(FocusTrapFactory).create(el.nativeElement as HTMLElement);\n\n // Track ONLY enabled: with autoFocus inside the tracked zone, flipping\n // [autoFocus] while the trap is active would re-run the effect and yank\n // focus back to the first tabbable element. The CDK calls are service\n // work, not dependencies.\n effect(() => {\n const enabled = this.enabled();\n untracked(() => {\n this.trap.enabled = enabled;\n if (enabled && this.autoFocus()) {\n void this.trap.focusFirstTabbableElementWhenReady();\n }\n });\n });\n\n inject(DestroyRef).onDestroy(() => this.trap.destroy());\n }\n\n /** Programmatically focus the first tabbable element within the trap. */\n focusFirst(): void {\n void this.trap.focusFirstTabbableElementWhenReady();\n }\n\n /** Programmatically focus the last tabbable element within the trap. */\n focusLast(): void {\n void this.trap.focusLastTabbableElementWhenReady();\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { DestroyRef, Directive, inject, signal } from '@angular/core';\n\n/**\n * Tracks keyboard-initiated focus on the host element.\n *\n * Adds `cngx-focus-visible` CSS class when the element receives focus via keyboard\n * and removes it on blur or when focus was initiated by pointer interaction.\n *\n *\n * ```html\n * <button cngxFocusVisible #fv=\"cngxFocusVisible\">\n * @if (fv.focusVisible()) { Focus ring visible }\n * </button>\n * ```\n *\n * @category common/a11y\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-visible.directive.ts\n * @since 0.1.0\n * @relatedTo CngxAutofocus, CngxFocusRestore, CngxFocusTrap\n * <example-url>http://localhost:4200/#/common/a11y/focus-visible/form-fields-custom-focus-ring</example-url>\n * <example-url>http://localhost:4200/#/common/a11y/focus-visible/keyboard-vs-pointer</example-url>\n */\n@Directive({\n selector: '[cngxFocusVisible]',\n exportAs: 'cngxFocusVisible',\n standalone: true,\n host: {\n '(pointerdown)': 'handlePointerDown()',\n '(focusin)': 'handleFocus()',\n '(focusout)': 'handleBlur()',\n '[class.cngx-focus-visible]': 'focusVisible()',\n },\n})\nexport class CngxFocusVisible {\n private readonly doc = inject(DOCUMENT);\n private readonly focusVisibleState = signal(false);\n /** `true` when focus was initiated via keyboard (not pointer). */\n readonly focusVisible = this.focusVisibleState.asReadonly();\n\n private pointerActive = false;\n private pointerClearTimer: ReturnType<typeof setTimeout> | null = null;\n\n private readonly schedulePointerClear = (): void => {\n // One macrotask of grace: on touch, the compat mousedown and the focusin\n // fire AFTER pointerup, so a synchronous clear here would misread a tap\n // as keyboard focus. The deferred clear runs after the whole tap\n // sequence settled.\n if (this.pointerClearTimer !== null) {\n clearTimeout(this.pointerClearTimer);\n }\n this.pointerClearTimer = setTimeout(() => {\n this.pointerActive = false;\n this.pointerClearTimer = null;\n }, 0);\n };\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.doc.removeEventListener('pointerup', this.schedulePointerClear, true);\n if (this.pointerClearTimer !== null) {\n clearTimeout(this.pointerClearTimer);\n }\n });\n }\n\n /** @internal Arms the pointer flag for the imminent focusin. */\n protected handlePointerDown(): void {\n // A pending clear from the previous release must not fire mid-press.\n if (this.pointerClearTimer !== null) {\n clearTimeout(this.pointerClearTimer);\n this.pointerClearTimer = null;\n }\n this.pointerActive = true;\n // The flag must not outlive the click: a pointerdown that never focuses\n // (disabled child, text selection, drag released off-host) would\n // otherwise suppress the ring on the NEXT keyboard Tab-in. Document-level\n // capture catches the release wherever it lands.\n this.doc.addEventListener('pointerup', this.schedulePointerClear, {\n once: true,\n capture: true,\n });\n }\n\n /** @internal Sets focus-visible state; clears pointer flag. */\n protected handleFocus(): void {\n this.focusVisibleState.set(!this.pointerActive);\n this.pointerActive = false;\n }\n\n /** @internal Clears focus-visible state on blur. */\n protected handleBlur(): void {\n this.focusVisibleState.set(false);\n }\n}\n","import {\n afterNextRender,\n contentChildren,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n model,\n signal,\n untracked,\n} from '@angular/core';\nimport {\n injectDirection,\n resolveBoundaryStep,\n resolveInlineStep,\n resolveStepFrom,\n} from '@cngx/core';\n\n/**\n * Marker directive for items managed by `CngxRovingTabindex`.\n *\n * Place on each focusable child inside a `[cngxRovingTabindex]` container.\n * The roving tabindex controller sets `tabindex=\"0\"` on the active item\n * and `tabindex=\"-1\"` on all others.\n *\n * ```html\n * <div cngxRovingTabindex>\n * <button cngxRovingItem>One</button>\n * <button cngxRovingItem>Two</button>\n * <button cngxRovingItem>Three</button>\n * </div>\n * ```\n *\n * @category common/a11y\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/roving/roving-tabindex.directive.ts\n * @since 0.1.0\n * @relatedTo CngxRovingTabindex, CngxButtonToggle\n * <example-url>http://localhost:4200/#/common/a11y/roving-tabindex/horizontal-toolbar</example-url>\n * <example-url>http://localhost:4200/#/common/a11y/roving-tabindex/vertical-menu</example-url>\n */\n@Directive({\n selector: '[cngxRovingItem]',\n exportAs: 'cngxRovingItem',\n standalone: true,\n})\nexport class CngxRovingItem {\n /** @internal Reference used by the parent `CngxRovingTabindex` to set `tabindex`. */\n readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /** Whether this item is disabled and should be skipped during navigation. */\n readonly disabled = input<boolean>(false, { alias: 'cngxRovingItemDisabled' });\n\n /** Programmatically focus this item. Called by the parent on arrow-key navigation. */\n focus(): void {\n (this.elementRef.nativeElement as HTMLElement).focus();\n }\n}\n\n/**\n * Implements the WAI-ARIA roving tabindex pattern for composite widgets.\n *\n * Only the active item in the group has `tabindex=\"0\"` - all others get\n * `tabindex=\"-1\"`. Arrow keys move focus within the group; Tab leaves it.\n * Home/End jump to first/last item.\n *\n * Works for toolbars, tab lists, card grids, menu bars, and any composite\n * widget where only one item should be in the tab order at a time.\n *\n * ### Virtual mode\n *\n * When `virtualCount` is set, `activeIndex` ranges from 0 to `virtualCount - 1`\n * instead of being bounded by `contentChildren.length`. Items are matched by\n * `data-cngx-recycle-index` attribute. When the target item is not in the DOM\n * (out of rendered range), `pendingFocus` is set so a wiring function like\n * `connectRecyclerToRoving()` can scroll it into view.\n *\n * ### Horizontal toolbar\n * ```html\n * <div cngxRovingTabindex orientation=\"horizontal\" #rv=\"cngxRovingTabindex\">\n * <button cngxRovingItem>Cut</button>\n * <button cngxRovingItem>Copy</button>\n * <button cngxRovingItem>Paste</button>\n * </div>\n * ```\n *\n * ### Vertical menu with controlled index\n * ```html\n * <ul cngxRovingTabindex orientation=\"vertical\" [(activeIndex)]=\"selectedIdx\">\n * @for (item of items(); track item.id) {\n * <li cngxRovingItem>{{ item.label }}</li>\n * }\n * </ul>\n * ```\n *\n * ### Virtual scroll integration\n * ```html\n * <div cngxRovingTabindex orientation=\"vertical\" [virtualCount]=\"recycler.ariaSetSize()\">\n * @for (item of visibleItems(); track item.id; let i = $index) {\n * <div cngxRovingItem [cngxVirtualItem]=\"recycler\" [cngxVirtualItemIndex]=\"recycler.start() + i\">\n * {{ item.name }}\n * </div>\n * }\n * </div>\n * ```\n *\n * @category common/a11y\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/roving/roving-tabindex.directive.ts\n * @since 0.1.0\n * @relatedTo CngxRovingItem, CngxActiveDescendant\n * <example-url>http://localhost:4200/#/common/a11y/roving-tabindex/horizontal-toolbar</example-url>\n * <example-url>http://localhost:4200/#/common/a11y/roving-tabindex/vertical-menu</example-url>\n */\n@Directive({\n selector: '[cngxRovingTabindex]',\n exportAs: 'cngxRovingTabindex',\n standalone: true,\n host: {\n '(keydown)': 'handleKeyDown($event)',\n '(focusin)': 'handleFocusIn($event)',\n },\n})\nexport class CngxRovingTabindex {\n /**\n * Arrow key navigation axis. `'both'` enables both horizontal and\n * vertical arrows. Exposed as a `model` so composite hosts (e.g.\n * `CngxRadioGroup`, where the keyboard axis must always be `'both'`\n * per WAI-ARIA APG regardless of the cosmetic group orientation) can\n * override it from their own constructor.\n */\n readonly orientation = model<'horizontal' | 'vertical' | 'both'>('horizontal');\n /** Whether navigation wraps from last to first and vice versa. */\n readonly loop = input<boolean>(true);\n /** Index of the currently active (focusable) item. Supports two-way `[(activeIndex)]` binding. */\n readonly activeIndex = model<number>(0);\n\n /**\n * Total item count for virtual mode. When set, `activeIndex` ranges from 0 to\n * `virtualCount - 1` and items are matched by `data-cngx-recycle-index` attribute.\n * When not set, standard `contentChildren`-based navigation is used.\n */\n readonly virtualCount = input<number | undefined>(undefined);\n\n /** All `CngxRovingItem` children discovered via `contentChildren`. */\n private readonly items = contentChildren(CngxRovingItem);\n\n /** Guards against setting `tabindex` before the DOM is ready. */\n private readonly initialized = signal(false);\n\n /** Host element for `data-cngx-recycle-index` queries in virtual mode. */\n private readonly hostEl = inject(ElementRef<HTMLElement>);\n\n private readonly pendingFocusState = signal<number | null>(null);\n\n /** Document writing direction - flips the horizontal-arrow index deltas under `rtl` (APG). */\n private readonly direction = injectDirection();\n\n /**\n * Set true just before a navigation key (arrow / Home / End) moves focus to a\n * new item, cleared by {@link consumeNavigationKey}. Transient handshake, not\n * reactive state: consumer groups read it synchronously from the\n * newly-focused leaf's `(focus)` handler.\n */\n private navigationKeyInFlight = false;\n\n /**\n * Index of the item that should receive focus but is not currently in the DOM.\n * Non-null when virtual navigation targets an out-of-range item.\n * Used by `connectRecyclerToRoving()` to scroll the item into view and focus it.\n */\n readonly pendingFocus = this.pendingFocusState.asReadonly();\n\n constructor() {\n afterNextRender(() => this.initialized.set(true));\n\n effect(() => {\n if (!this.initialized()) {\n return;\n }\n const items = this.items();\n const active = this.activeIndex();\n const vc = this.virtualCount();\n\n if (vc != null) {\n // Virtual mode: match by data-cngx-recycle-index attribute. Clamp the\n // model itself when the virtual space shrinks below it - a ghost\n // index would otherwise anchor the next arrow press. An empty space\n // (vc 0) keeps the model untouched so a repopulated list restores it.\n const clamped = vc > 0 ? Math.max(0, Math.min(active, vc - 1)) : active;\n if (clamped !== active) {\n untracked(() => this.activeIndex.set(clamped));\n }\n items.forEach((item) => {\n const el = item.elementRef.nativeElement as HTMLElement;\n const idx = el.dataset['cngxRecycleIndex'];\n el.setAttribute('tabindex', idx != null && Number(idx) === clamped ? '0' : '-1');\n });\n } else {\n // Standard mode: match by array index. The tab stop must land on an\n // enabled item - fall back to the first enabled one when the clamped\n // target is disabled (initial index into a disabled leaf, or the\n // active item got disabled). The model is written back so keyboard\n // navigation anchors where the tab stop actually sits. An empty list\n // keeps the model untouched so a repopulated list restores it.\n if (items.length === 0) {\n return;\n }\n let target = Math.max(0, Math.min(active, items.length - 1));\n if (items[target]?.disabled()) {\n target = this.findFirst(items) ?? target;\n }\n if (target !== active) {\n untracked(() => this.activeIndex.set(target));\n }\n items.forEach((item, i) =>\n (item.elementRef.nativeElement as HTMLElement).setAttribute(\n 'tabindex',\n i === target ? '0' : '-1',\n ),\n );\n }\n });\n }\n\n /**\n * Clears the pending focus target. Called by `connectRecyclerToRoving()`\n * after the item has been scrolled into view and focused.\n */\n clearPendingFocus(): void {\n this.pendingFocusState.set(null);\n }\n\n /**\n * Whether the last focus move was driven by a navigation key, consuming the\n * flag so it reads `true` exactly once. Consumer groups (radio,\n * button-toggle) call this from the newly-focused leaf's `(focus)` handler to\n * decide whether to auto-select. The flag is set before `.focus()`, so it is\n * already `true` when focus lands - this closes the one-press-behind race\n * that a group's own `(keydown)` binding suffered (#135).\n */\n consumeNavigationKey(): boolean {\n const inFlight = this.navigationKeyInFlight;\n this.navigationKeyInFlight = false;\n return inFlight;\n }\n\n /**\n * Handles arrow-key, Home, and End navigation within the group.\n * Prevents default scrolling on arrow keys.\n *\n * Unified handler - delegates to virtual or contentChildren navigation\n * based on whether `virtualCount` is set.\n */\n protected handleKeyDown(event: KeyboardEvent): void {\n // Never hijack browser/app shortcuts: Ctrl/Cmd/Alt combos pass through\n // untouched (Ctrl+Home, Cmd+ArrowLeft and friends belong to the app).\n if (event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n\n const vc = this.virtualCount();\n const allItems = this.items();\n const isVirtual = vc != null;\n const total = isVirtual ? vc : allItems.length;\n\n if (total === 0) {\n return;\n }\n if (!isVirtual && this.enabledItems().length === 0) {\n return;\n }\n\n const currentActive = this.activeIndex();\n const navigate = (direction: 1 | -1): number | null =>\n isVirtual\n ? this.findNextVirtual(currentActive, total, direction)\n : this.findNext(currentActive, allItems, direction);\n\n const inlineNav = (key: string): number | null => {\n if (!this.isHorizontal()) {\n return null;\n }\n const step = resolveInlineStep(key, this.direction());\n return step === null ? null : navigate(step);\n };\n\n const keyMap: Record<string, () => number | null> = {\n ArrowRight: () => inlineNav('ArrowRight'),\n ArrowLeft: () => inlineNav('ArrowLeft'),\n ArrowDown: () => (this.isVertical() ? navigate(1) : null),\n ArrowUp: () => (this.isVertical() ? navigate(-1) : null),\n Home: () => (isVirtual ? 0 : this.findFirst(allItems)),\n End: () => (isVirtual ? total - 1 : this.findLast(allItems)),\n };\n\n const handler = keyMap[event.key];\n if (!handler) {\n return;\n }\n\n const nextIndex = handler();\n if (nextIndex !== null && nextIndex !== currentActive) {\n event.preventDefault();\n this.activeIndex.set(nextIndex);\n // Expose the navigation intent before focus moves, so the newly-focused\n // leaf's (focus) handler reads an already-set fact instead of racing the\n // group's own late (keydown) binding (#135).\n this.navigationKeyInFlight = true;\n if (isVirtual) {\n this.focusVirtualItem(nextIndex);\n } else {\n allItems[nextIndex].focus();\n }\n } else if (nextIndex === currentActive) {\n event.preventDefault();\n }\n }\n\n /**\n * Keeps `activeIndex` in sync with real focus (APG): when an item gains\n * focus by any means - pointer click, script focus, assistive tech - the\n * tab stop follows it instead of staying on the last arrow-key target.\n */\n protected handleFocusIn(event: FocusEvent): void {\n const target = event.target as HTMLElement | null;\n if (target === null) {\n return;\n }\n const vc = this.virtualCount();\n if (vc != null) {\n const holder = target.closest('[data-cngx-recycle-index]');\n const idx = holder === null ? NaN : Number(holder.getAttribute('data-cngx-recycle-index'));\n if (Number.isInteger(idx) && idx >= 0 && idx < vc && idx !== this.activeIndex()) {\n this.activeIndex.set(idx);\n }\n return;\n }\n const items = this.items();\n const idx = items.findIndex((item) => {\n const el = item.elementRef.nativeElement as HTMLElement;\n return el === target || el.contains(target);\n });\n if (idx >= 0 && !items[idx].disabled() && idx !== this.activeIndex()) {\n this.activeIndex.set(idx);\n }\n }\n\n /**\n * Attempts to focus a virtual item by querying `data-cngx-recycle-index`.\n * If the element is not in the DOM, sets `pendingFocus` for external resolution.\n */\n private focusVirtualItem(index: number): void {\n const el = (this.hostEl.nativeElement as HTMLElement).querySelector(\n `[data-cngx-recycle-index=\"${index}\"]`,\n );\n if (el instanceof HTMLElement) {\n el.focus();\n this.pendingFocusState.set(null);\n } else {\n this.pendingFocusState.set(index);\n }\n }\n\n /**\n * Finds the next index in virtual mode. No disabled-item skipping - can't check\n * disabled state of items not in the DOM (the resolver treats every index as\n * enabled when no `isDisabledAt` is supplied).\n */\n private findNextVirtual(current: number, total: number, direction: 1 | -1): number | null {\n return resolveStepFrom(current, direction, { count: total, loop: this.loop() });\n }\n\n private enabledItems(): readonly CngxRovingItem[] {\n return this.items().filter((item) => !item.disabled());\n }\n\n private isHorizontal(): boolean {\n const o = this.orientation();\n return o === 'horizontal' || o === 'both';\n }\n\n private isVertical(): boolean {\n const o = this.orientation();\n return o === 'vertical' || o === 'both';\n }\n\n /**\n * Searches for the next enabled item starting from `current + direction`.\n * Respects `loop` - wraps around or stops at the boundary.\n * Skips disabled items.\n */\n private findNext(\n current: number,\n items: readonly CngxRovingItem[],\n direction: 1 | -1,\n ): number | null {\n return resolveStepFrom(current, direction, {\n count: items.length,\n loop: this.loop(),\n isDisabledAt: (i) => items[i].disabled(),\n });\n }\n\n private findFirst(items: readonly CngxRovingItem[]): number | null {\n return resolveBoundaryStep(1, {\n count: items.length,\n isDisabledAt: (i) => items[i].disabled(),\n });\n }\n\n private findLast(items: readonly CngxRovingItem[]): number | null {\n return resolveBoundaryStep(-1, {\n count: items.length,\n isDisabledAt: (i) => items[i].disabled(),\n });\n }\n}\n","import { InjectionToken, type Signal } from '@angular/core';\n\n/**\n * Descriptor of an item managed by `CngxActiveDescendant`.\n *\n * `id` must be unique and stable across change detection runs (use `nextUid()`\n * from `@cngx/core/utils`). `label` is used by typeahead matching.\n *\n * @category common/a11y\n */\nexport interface ActiveDescendantItem {\n /** Unique DOM `id` on the element - required for `aria-activedescendant`. */\n readonly id: string;\n /** Opaque value emitted on `activated`. Compared with `Object.is` by default. */\n readonly value: unknown;\n /** Human-readable text used by typeahead. Falls back to empty string. */\n readonly label: string;\n /** Disabled items are skipped during navigation when `skipDisabled` is true. */\n readonly disabled?: boolean;\n}\n\n/**\n * DI token for content-projected items that should register with the\n * surrounding `CngxActiveDescendant`.\n *\n * Consumers like `CngxOption` and `CngxMenuItem` expose themselves via:\n *\n * ```typescript\n * providers: [{ provide: CNGX_AD_ITEM, useExisting: MyItem }]\n * ```\n *\n * The contained directive must expose `id`, `value`, `label`, and optionally\n * `disabled` as signals - the AD reads them reactively.\n *\n * @category common/a11y\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/active-descendant/ad-item.token.ts\n * @since 0.1.0\n */\nexport const CNGX_AD_ITEM = new InjectionToken<CngxAdItemHandle>('CNGX_AD_ITEM');\n\n/**\n * Minimum shape an AD-registered directive must expose.\n *\n * The shape is signal-based so the AD recomputes when any field changes.\n *\n * @category common/a11y\n */\nexport interface CngxAdItemHandle {\n readonly id: string;\n readonly value: Signal<unknown>;\n /**\n * Label accessor. Typically a signal, but may be a plain getter when the\n * label derives from runtime DOM state (e.g. `textContent` fallback).\n */\n readonly label: Signal<string> | (() => string);\n readonly disabled?: Signal<boolean>;\n}\n","import {\n afterNextRender,\n computed,\n contentChildren,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n output,\n signal,\n untracked,\n} from '@angular/core';\nimport {\n injectDirection,\n resolveBoundaryStep,\n resolveInlineStep,\n resolveStepFrom,\n} from '@cngx/core';\nimport { createTypeaheadMatcher, injectLocale } from '@cngx/core/utils';\n\nimport { CNGX_AD_ITEM, type ActiveDescendantItem, type CngxAdItemHandle } from './ad-item.token';\n\n/**\n * WAI-ARIA active-descendant pattern. Focus stays on the host; the active\n * option is reported via `aria-activedescendant`.\n *\n * ### When to use this vs. `CngxRovingTabindex`\n *\n * - **Active-descendant** when focus stays on one container (listbox, menu,\n * combobox input) and items must not be tab-stops. Screen readers announce\n * the referenced option while the focus ring stays on the host.\n * - **Roving tabindex** when items themselves are tab-stops (toolbar, tab\n * list, grid cells). See `CngxRovingTabindex`.\n *\n * ### Item registration\n *\n * Items register either by providing `CNGX_AD_ITEM` via `hostDirectives` /\n * `providers`, or by passing a `Signal<ActiveDescendantItem[]>` through the\n * `items` input. The `items` input wins when both are present; use it when\n * items come from a dynamic data source.\n *\n * ### Virtualization\n *\n * When `virtualCount` is set, navigation addresses the absolute index space\n * `[0, virtualCount)` even when only a window is rendered. Bind `windowStart`\n * to the recycler's window start so item lookups (id resolution, disabled\n * checks, typeahead labels) map absolute indices onto the rendered subset.\n * Targets outside the window surface as `pendingHighlight`; the consumer\n * scrolls them into view (`connectRecyclerToActiveDescendant`) and the\n * directive clears the pending state once the target renders.\n *\n * ### Material/CDK equivalent\n *\n * Same model as `cdk-listbox` and `mat-select`, without the visual shell and\n * driven by signals instead of `ListKeyManager`.\n *\n * @category common/a11y\n * @docsKind primary\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/active-descendant/active-descendant.directive.ts\n * @since 0.1.0\n * @relatedTo CngxRovingTabindex, CngxListbox, CngxMenu\n * <example-url>http://localhost:4200/#/common/a11y/active-descendant/listbox-with-items-input</example-url>\n * <example-url>http://localhost:4200/#/common/a11y/active-descendant/typeahead</example-url>\n */\n@Directive({\n selector: '[cngxActiveDescendant]',\n exportAs: 'cngxActiveDescendant',\n standalone: true,\n host: {\n '[attr.aria-activedescendant]': 'activeId()',\n '(keydown)': 'handleKeydown($event)',\n },\n})\nexport class CngxActiveDescendant {\n /**\n * Optional explicit item list. When provided, takes precedence over items\n * registered via `CNGX_AD_ITEM`. Useful for combobox-style consumers that\n * drive the menu from a dynamic data source - pass the unwrapped array\n * (typically the result of a `computed()`), Angular's signal inputs make it\n * reactive automatically.\n */\n readonly items = input<ActiveDescendantItem[] | undefined>(undefined);\n\n /** Arrow-key navigation axis. Defaults to `'vertical'` (listbox/menu style). */\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n /** Whether navigation wraps from last to first and vice versa. */\n readonly loop = input<boolean>(true);\n /** Whether alphanumeric typeahead navigation is enabled. */\n readonly typeahead = input<boolean>(true);\n /** Buffer reset window for typeahead, in milliseconds. */\n readonly typeaheadDebounce = input<number>(300);\n /** Whether the first non-disabled item is highlighted automatically. */\n readonly autoHighlightFirst = input<boolean>(false);\n /** Whether disabled items are skipped during navigation and value lookup. */\n readonly skipDisabled = input<boolean>(true);\n /**\n * When set, navigation treats the range `[0, virtualCount)` as the item\n * space even if only a subset is rendered. Targets outside the rendered\n * range surface as `pendingHighlight` for scroll-and-retry protocols.\n */\n readonly virtualCount = input<number | undefined>(undefined);\n /**\n * Absolute index of the first rendered item in virtual mode - the recycler\n * window start. All rendered-item lookups are offset by it so absolute\n * indices resolve the right item once the window has scrolled past 0.\n * Ignored when `virtualCount` is unset.\n */\n readonly windowStart = input<number>(0);\n\n /** Emitted when `activateCurrent()` is called with an active item. */\n readonly activated = output<unknown>();\n /** Emitted whenever the highlighted item changes. */\n readonly highlighted = output<ActiveDescendantItem | null>();\n /**\n * Emitted when a typeahead query finds no match in the rendered window.\n * Carries the resolved query term (lowercased; a repeated single letter\n * collapses to that letter per the APG cycle rule). The rendered window\n * is AD's whole search space - hosts whose real item space is larger\n * (collapsed tree branches, virtualized rows outside the window) listen\n * here to resolve the miss themselves.\n */\n readonly typeaheadMissed = output<string>();\n\n private readonly hostEl = inject(ElementRef<HTMLElement>);\n private readonly locale = injectLocale();\n private readonly registered = contentChildren(CNGX_AD_ITEM, { descendants: true });\n\n /** Document writing direction - flips the horizontal-arrow steps under `rtl` (APG). */\n private readonly direction = injectDirection();\n\n /** Guards host attribute writes until after first render. */\n private readonly initialized = signal(false);\n\n /** -1 means \"no active item\". Range is [0, resolvedItems().length). */\n private readonly activeIndexState = signal<number>(-1);\n\n /** Index of an item that should be highlighted but is not in the DOM. */\n private readonly pendingHighlightState = signal<number | null>(null);\n readonly pendingHighlight = this.pendingHighlightState.asReadonly();\n\n /**\n * Resolved item list. Input `items` wins; otherwise the contentChildren\n * handles are projected into `ActiveDescendantItem` shape.\n */\n readonly resolvedItems = computed<ActiveDescendantItem[]>(() => {\n const explicit = this.items();\n if (explicit) {\n return explicit;\n }\n return this.registered().map(handleToItem);\n });\n\n /** Current active index. `-1` when no item is highlighted. */\n readonly activeIndex = computed<number>(() => {\n const idx = this.activeIndexState();\n const total = this.totalCount();\n if (idx < 0 || idx >= total) {\n return -1;\n }\n return idx;\n });\n\n /**\n * `activeIndex` always mapped back to an item. `null` when no active index\n * or the item is out of rendered range (virtual mode).\n */\n readonly activeItem = computed<ActiveDescendantItem | null>(() => {\n const idx = this.activeIndex();\n if (idx < 0) {\n return null;\n }\n return this.itemAt(idx);\n });\n\n /**\n * `activeItem` pinned to the item id for the `highlighted` emission: a\n * re-render that produces a fresh object for the same item must not\n * re-emit. `activeItem` itself stays identity-equal so `activeValue`\n * tracks value changes on an unchanged id.\n */\n private readonly highlightedItem = computed<ActiveDescendantItem | null>(\n () => this.activeItem(),\n { equal: (a, b) => a === b || (a !== null && b !== null && a.id === b.id) },\n );\n\n readonly activeId = computed<string | null>(() => this.activeItem()?.id ?? null);\n readonly activeValue = computed<unknown>(() => this.activeItem()?.value ?? null);\n\n private readonly typeaheadBuffer = signal<string>('');\n private typeaheadTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n afterNextRender(() => this.initialized.set(true));\n\n effect(() => {\n if (!this.initialized()) {\n return;\n }\n if (this.autoHighlightFirst() && this.activeIndexState() === -1) {\n this.highlightFirst();\n }\n });\n\n // Leading nulls are start-up state, not a highlight change - emit only\n // once something was highlighted (later resets back to null still emit).\n let hadHighlight = false;\n effect(() => {\n const item = this.highlightedItem();\n if (!hadHighlight && item === null) {\n return;\n }\n hadHighlight = true;\n this.highlighted.emit(item);\n });\n\n effect(() => {\n const idx = this.activeIndex();\n if (idx < 0) {\n return;\n }\n if (this.virtualCount() != null) {\n if (!this.isRendered(idx)) {\n this.pendingHighlightState.set(idx);\n return;\n }\n this.pendingHighlightState.set(null);\n }\n queueMicrotask(() => this.scrollActiveIntoView());\n });\n\n // Clamp the active STATE, not just the derived display, when the item\n // space shrinks below it - otherwise the next arrow press navigates\n // relative to a ghost index.\n effect(() => {\n const total = this.totalCount();\n const idx = this.activeIndexState();\n if (idx >= total) {\n untracked(() => this.activeIndexState.set(total > 0 ? total - 1 : -1));\n }\n });\n\n inject(DestroyRef).onDestroy(() => {\n if (this.typeaheadTimer !== null) {\n clearTimeout(this.typeaheadTimer);\n }\n });\n }\n\n highlightNext(): void {\n const next = this.findFrom(this.activeIndexState(), 1);\n if (next !== null) {\n this.activeIndexState.set(next);\n }\n }\n\n highlightPrev(): void {\n const next = this.findFrom(this.activeIndexState(), -1);\n if (next !== null) {\n this.activeIndexState.set(next);\n }\n }\n\n highlightFirst(): void {\n const first = this.findBoundary(1);\n if (first !== null) {\n this.activeIndexState.set(first);\n }\n }\n\n highlightLast(): void {\n const last = this.findBoundary(-1);\n if (last !== null) {\n this.activeIndexState.set(last);\n }\n }\n\n /**\n * Highlight by zero-based index. Out-of-range indices are ignored.\n * Disabled items are rejected when `skipDisabled()` is true.\n */\n highlightByIndex(index: number): void {\n const total = this.totalCount();\n if (index < 0 || index >= total) {\n return;\n }\n if (this.skipDisabled() && this.isDisabledAt(index)) {\n return;\n }\n this.activeIndexState.set(index);\n }\n\n /**\n * Highlight the first rendered item whose value matches (via `Object.is`).\n * No-op if no match. Disabled items are rejected when `skipDisabled()` is\n * true. In virtual mode only the rendered window is searched; the resolved\n * index is absolute.\n */\n highlightByValue(value: unknown): void {\n const items = this.resolvedItems();\n const idx = items.findIndex((it) => Object.is(it.value, value));\n if (idx < 0) {\n return;\n }\n if (this.skipDisabled() && items[idx].disabled) {\n return;\n }\n this.activeIndexState.set(idx + this.windowOffset());\n }\n\n /** Clear the highlight. */\n resetHighlight(): void {\n this.activeIndexState.set(-1);\n }\n\n /** Emit `activated` with the current item's value. No-op if nothing active. */\n activateCurrent(): void {\n const item = this.activeItem();\n if (item) {\n this.activated.emit(item.value);\n }\n }\n\n /** Called by recycler bridges after scrolling the pending index into view. */\n clearPendingHighlight(): void {\n this.pendingHighlightState.set(null);\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n // Never hijack browser/app shortcuts: Ctrl/Cmd/Alt combos pass through\n // untouched (Ctrl+C would otherwise hit the typeahead branch and get\n // preventDefault'd). Shift stays allowed - it produces printable chars.\n if (event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n\n // Skip events from editable descendants. Without this, every\n // printable key typed into a descendant <input> hits AD's typeahead\n // branch, gets preventDefault'd, and never reaches the input.\n const target = event.target as HTMLElement | null;\n if (target && target !== event.currentTarget && isEditableTarget(target)) {\n return;\n }\n\n const key = event.key;\n\n if (this.isNavKey(key)) {\n const before = this.activeIndexState();\n this.dispatchNav(key);\n if (this.activeIndexState() !== before) {\n event.preventDefault();\n }\n return;\n }\n\n if (key === 'Enter' || key === ' ') {\n if (this.activeItem()) {\n event.preventDefault();\n this.activateCurrent();\n }\n return;\n }\n\n if (this.typeahead() && isPrintableChar(key)) {\n event.preventDefault();\n this.handleTypeahead(key);\n }\n }\n\n private isNavKey(key: string): boolean {\n switch (key) {\n case 'ArrowDown':\n case 'ArrowUp':\n case 'ArrowLeft':\n case 'ArrowRight':\n case 'Home':\n case 'End':\n return true;\n default:\n return false;\n }\n }\n\n private dispatchNav(key: string): void {\n const orientation = this.orientation();\n switch (key) {\n case 'ArrowDown':\n if (orientation === 'vertical') {\n this.highlightNext();\n }\n return;\n case 'ArrowRight':\n case 'ArrowLeft': {\n if (orientation !== 'horizontal') {\n return;\n }\n // RTL flips the horizontal arrows (same kernel roving uses).\n const step = resolveInlineStep(key, this.direction());\n if (step === 1) {\n this.highlightNext();\n } else if (step === -1) {\n this.highlightPrev();\n }\n return;\n }\n case 'ArrowUp':\n if (orientation === 'vertical') {\n this.highlightPrev();\n }\n return;\n case 'Home':\n this.highlightFirst();\n return;\n case 'End':\n this.highlightLast();\n return;\n }\n }\n\n /**\n * Push a printable character into the typeahead buffer and jump to the next\n * matching option. Exposed for external keyboard hosts (e.g. a select\n * trigger) that keep focus on themselves while using active-descendant\n * semantics on a separate listbox.\n *\n * Consumers should only forward single-character printable keys (`length === 1`,\n * non-whitespace). Navigation keys and non-printables must not be forwarded.\n */\n typeaheadChar(ch: string): void {\n if (!this.typeahead()) {\n return;\n }\n this.handleTypeahead(ch);\n }\n\n private handleTypeahead(ch: string): void {\n const locale = this.locale();\n const next = this.typeaheadBuffer() + ch.toLocaleLowerCase(locale);\n this.typeaheadBuffer.set(next);\n\n if (this.typeaheadTimer !== null) {\n clearTimeout(this.typeaheadTimer);\n }\n this.typeaheadTimer = setTimeout(() => {\n this.typeaheadBuffer.set('');\n this.typeaheadTimer = null;\n }, this.typeaheadDebounce());\n\n // Labels exist only for rendered items, so the search space is the\n // rendered window; matches map back to absolute indices in virtual mode.\n const items = this.resolvedItems();\n const skip = this.skipDisabled();\n const count = items.length;\n // APG cycle: a single-character query (including a repeated letter, whose\n // buffer collapses back to that letter) searches AFTER the active item so\n // each press advances through the matches. A genuine multi-character query\n // keeps matching the current item first.\n const sameChar = next.length > 1 && [...next].every((c) => c === next[0]);\n const term = sameChar ? next[0] : next;\n if (count === 0) {\n this.typeaheadMissed.emit(term);\n return;\n }\n const windowOffset = this.windowOffset();\n const activeRel = this.activeIndexState() < 0 ? -1 : this.activeIndexState() - windowOffset;\n const cycles = term.length === 1;\n const startRel = cycles ? activeRel + 1 : Math.max(0, activeRel);\n const matches = createTypeaheadMatcher(term, locale);\n for (let step = 0; step < count; step++) {\n const rel = (((startRel + step) % count) + count) % count;\n const candidate = items[rel];\n if (skip && candidate.disabled) {\n continue;\n }\n if (matches(candidate.label, candidate)) {\n this.activeIndexState.set(rel + windowOffset);\n return;\n }\n }\n this.typeaheadMissed.emit(term);\n }\n\n private findFrom(current: number, direction: 1 | -1): number | null {\n return resolveStepFrom(current, direction, {\n count: this.totalCount(),\n loop: this.loop(),\n isDisabledAt: this.skipDisabled() ? (i) => this.isDisabledAt(i) : undefined,\n });\n }\n\n /**\n * First/last navigable absolute index. Spans the full virtual range - End\n * targets `totalCount - 1` even when that item is not rendered (it surfaces\n * as `pendingHighlight`); unrendered items count as enabled because their\n * disabled state is unknowable (`isDisabledAt` resolves them to `false`).\n */\n private findBoundary(direction: 1 | -1): number | null {\n return resolveBoundaryStep(direction, {\n count: this.totalCount(),\n isDisabledAt: this.skipDisabled() ? (i) => this.isDisabledAt(i) : undefined,\n });\n }\n\n private totalCount(): number {\n const vc = this.virtualCount();\n if (vc != null) {\n return vc;\n }\n return this.resolvedItems().length;\n }\n\n /** Rendered-window offset: `windowStart` in virtual mode, `0` otherwise. */\n private windowOffset(): number {\n return this.virtualCount() != null ? this.windowStart() : 0;\n }\n\n /** Item at an absolute index, `null` when outside the rendered window. */\n private itemAt(index: number): ActiveDescendantItem | null {\n const rel = index - this.windowOffset();\n const items = this.resolvedItems();\n if (rel < 0 || rel >= items.length) {\n return null;\n }\n return items[rel] ?? null;\n }\n\n private isDisabledAt(index: number): boolean {\n return !!this.itemAt(index)?.disabled;\n }\n\n private isRendered(index: number): boolean {\n return this.itemAt(index) !== null;\n }\n\n private scrollActiveIntoView(): void {\n const id = this.activeId();\n if (!id) {\n return;\n }\n // Document-wide by escaped id: aria-owns layouts render the option list\n // outside the host subtree, a host-scoped query never finds those.\n const doc = (this.hostEl.nativeElement as HTMLElement).ownerDocument;\n const el = doc.querySelector(`#${cssEscape(id)}`);\n if (el instanceof HTMLElement && typeof el.scrollIntoView === 'function') {\n el.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }\n }\n}\n\n/** @internal */\nfunction handleToItem(handle: CngxAdItemHandle): ActiveDescendantItem {\n return {\n id: handle.id,\n value: handle.value(),\n label: handle.label(),\n disabled: handle.disabled?.() ?? false,\n };\n}\n\n/** @internal */\nfunction isPrintableChar(key: string): boolean {\n return key.length === 1 && /\\S/.exec(key) !== null;\n}\n\n/**\n * True when the element would capture text input natively - a text\n * `<input>`, `<textarea>`, or any `contenteditable` host. Read-only /\n * button-type inputs (submit, radio, checkbox) are NOT editable; AD's\n * keyboard navigation still applies when focus lands on them.\n *\n * @internal\n */\nfunction isEditableTarget(el: HTMLElement): boolean {\n if (el.isContentEditable) {\n return true;\n }\n const tag = el.tagName;\n if (tag === 'TEXTAREA') {\n return true;\n }\n if (tag === 'INPUT') {\n const type = (el as HTMLInputElement).type.toLowerCase();\n return (\n type !== 'button' &&\n type !== 'submit' &&\n type !== 'reset' &&\n type !== 'checkbox' &&\n type !== 'radio' &&\n type !== 'range' &&\n type !== 'color' &&\n type !== 'file' &&\n type !== 'image'\n );\n }\n return false;\n}\n\n/** @internal */\nfunction cssEscape(id: string): string {\n const api = (globalThis as { CSS?: { escape?: (s: string) => string } }).CSS;\n if (api && typeof api.escape === 'function') {\n return api.escape(id);\n }\n return id.replace(/[^a-zA-Z0-9_-]/g, (m) => `\\\\${m}`);\n}\n","import { DOCUMENT } from '@angular/common';\nimport { DestroyRef, Directive, inject, type Signal } from '@angular/core';\nimport { createMediaQuerySignal } from '@cngx/core/utils';\n\n/**\n * Reflects the user's `prefers-reduced-motion` media query as a reactive signal.\n *\n * Adds the `cngx-reduced-motion` CSS class to the host when the user prefers\n * reduced motion. The `prefersReducedMotion()` signal updates live when the\n * OS preference changes - use it in TypeScript to skip animations, disable\n * auto-playing media, or choose between animated and instant transitions.\n *\n * Unlike a CSS-only `@media (prefers-reduced-motion: reduce)` approach, this\n * directive makes the preference available in component logic (e.g., to pick\n * a different animation strategy or suppress requestAnimationFrame loops).\n *\n * ### Conditional animation\n * ```html\n * <div cngxReducedMotion #rm=\"cngxReducedMotion\"\n * [style.animation]=\"rm.prefersReducedMotion() ? 'none' : 'spin 2s linear infinite'\">\n * </div>\n * ```\n *\n * ### TypeScript logic\n * ```typescript\n * readonly rm = viewChild(CngxReducedMotion);\n * readonly duration = computed(() => this.rm()?.prefersReducedMotion() ? 0 : 300);\n * ```\n *\n * @category common/a11y\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/motion/reduced-motion.directive.ts\n * @since 0.1.0\n * <example-url>http://localhost:4200/#/common/a11y/reduced-motion/animation-toggle</example-url>\n * <example-url>http://localhost:4200/#/common/a11y/reduced-motion/toast-notifications-motion-aware</example-url>\n */\n@Directive({\n selector: '[cngxReducedMotion]',\n exportAs: 'cngxReducedMotion',\n standalone: true,\n host: { '[class.cngx-reduced-motion]': 'prefersReducedMotion()' },\n})\nexport class CngxReducedMotion {\n /** `true` when the user's OS is set to prefer reduced motion. Updates reactively. */\n readonly prefersReducedMotion: Signal<boolean>;\n\n constructor() {\n this.prefersReducedMotion = createMediaQuerySignal(\n '(prefers-reduced-motion: reduce)',\n inject(DestroyRef),\n inject(DOCUMENT).defaultView,\n );\n }\n}\n","/**\n * @module @cngx/common/a11y\n */\nexport { CngxAriaExpanded } from './aria/aria-expanded.directive';\nexport { CngxLiveRegion } from './aria/live-region.directive';\nexport { CngxLiveAnnouncer, type AriaLivePoliteness } from './aria/live-announcer';\nexport { CngxAutofocus } from './focus/autofocus.directive';\nexport {\n CngxFocusRestore,\n CNGX_FOCUSABLE_SELECTOR,\n} from './focus/focus-restore.directive';\nexport { CngxFocusTrap } from './focus/focus-trap.directive';\nexport { CngxFocusVisible } from './focus/focus-visible.directive';\nexport { CngxRovingTabindex, CngxRovingItem } from './roving/roving-tabindex.directive';\nexport { CngxActiveDescendant } from './active-descendant/active-descendant.directive';\nexport {\n CNGX_AD_ITEM,\n type ActiveDescendantItem,\n type CngxAdItemHandle,\n} from './active-descendant/ad-item.token';\nexport { CngxReducedMotion } from './motion/reduced-motion.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCG;MAUU,gBAAgB,CAAA;;IAElB,QAAQ,GAAG,KAAK,CAAU,KAAK,gFAAI,KAAK,EAAE,kBAAkB,EAAA,CAAG;;AAE/D,IAAA,QAAQ,GAAG,KAAK,CAAqB,SAAS,+EAAC;uGAJ7C,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAhB,gBAAgB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,kBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,oBAAA,EAAA,YAAA,EAAA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AAA,CAAA;kBAN7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE,EAAE,6BAA6B,EAAE,wBAAwB,EAAE;AAClE,iBAAA;;;ACzCD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"cngx-common-a11y.mjs","sources":["../../../projects/common/a11y/aria/aria-expanded.directive.ts","../../../projects/common/a11y/aria/live-region.directive.ts","../../../projects/common/a11y/aria/live-region-pair.ts","../../../projects/common/a11y/aria/live-announcer.ts","../../../projects/common/a11y/aria/scoped-live-region.ts","../../../projects/common/a11y/focus/autofocus.directive.ts","../../../projects/common/a11y/focus/focus-restore.directive.ts","../../../projects/common/a11y/focus/focus-trap.directive.ts","../../../projects/common/a11y/focus/focus-visible.directive.ts","../../../projects/common/a11y/roving/roving-tabindex.directive.ts","../../../projects/common/a11y/active-descendant/ad-item.token.ts","../../../projects/common/a11y/active-descendant/active-descendant.directive.ts","../../../projects/common/a11y/motion/reduced-motion.directive.ts","../../../projects/common/a11y/public-api.ts","../../../projects/common/a11y/cngx-common-a11y.ts"],"sourcesContent":["import {\n booleanAttribute,\n computed,\n Directive,\n inject,\n InjectionToken,\n Injector,\n input,\n type Signal,\n} from '@angular/core';\n\n/**\n * Lets a directive that composes `CngxAriaExpanded` as a host directive drive\n * `aria-expanded` from its own state instead of `[cngxAriaExpanded]`.\n * Provided by the composer on the same element (`useExisting`); the ARIA\n * directive resolves it lazily with `self: true`, because the composer\n * constructs after its host directives. `CngxExpandable` is the in-library\n * composer.\n *\n * @relatedTo CngxAriaExpanded, CNGX_ARIA_EXPANDED_DRIVER\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/aria-expanded.directive.ts\n * @since 0.3.0\n */\nexport interface CngxAriaExpandedDriver {\n /**\n * The `aria-expanded` value; wins over `[cngxAriaExpanded]`. `null` omits\n * the attribute, for a host that has nothing to expand (a leaf tree item).\n */\n readonly ariaExpanded: Signal<boolean | null>;\n}\n\n/**\n * Injection token for a {@link CngxAriaExpandedDriver}. A composer provides it\n * on its own element (`useExisting`) to override `[cngxAriaExpanded]` of its\n * `CngxAriaExpanded` host directive; `aria-controls` still follows\n * `[controls]`. Used by `CngxExpandable`.\n *\n * @relatedTo CngxAriaExpanded\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/aria-expanded.directive.ts\n * @since 0.3.0\n */\nexport const CNGX_ARIA_EXPANDED_DRIVER = new InjectionToken<CngxAriaExpandedDriver>(\n 'CngxAriaExpandedDriver',\n);\n\n/**\n * Manages `aria-expanded` and optionally `aria-controls` on the host element.\n *\n * Pairs a disclosure trigger (button) with its controlled region via standard\n * WAI-ARIA attributes. Supports accordions, dropdowns, tree items, and any\n * disclosure pattern where a control toggles visibility of another element.\n *\n * Unlike manual `[attr.aria-expanded]` binding, this directive couples both\n * attributes (`aria-expanded` + `aria-controls`) in a single declaration,\n * preventing mismatches where one is set without the other.\n *\n * ### Simple disclosure\n * ```html\n * <button [cngxAriaExpanded]=\"open()\" [controls]=\"'panel-id'\" (click)=\"open.set(!open())\">\n * Toggle\n * </button>\n * <div id=\"panel-id\" role=\"region\" [hidden]=\"!open()\">Panel content</div>\n * ```\n *\n * ### Accordion with multiple panels\n * ```html\n * @for (panel of panels(); track panel.id) {\n * <button [cngxAriaExpanded]=\"panel.open\" [controls]=\"panel.id\" (click)=\"toggle(panel)\">\n * {{ panel.label }}\n * </button>\n * @if (panel.open) {\n * <div [id]=\"panel.id\" role=\"region\">{{ panel.content }}</div>\n * }\n * }\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/aria-expanded.directive.ts\n * @since 0.3.0\n * @relatedTo CngxLiveRegion, CngxExpandable, CngxDisclosure\n * <example-url>/#/common/a11y/aria-expanded/accordion-multiple-panels</example-url>\n * <example-url>/#/common/a11y/aria-expanded/disclosure-pattern</example-url>\n * @axis level atom\n */\n@Directive({\n selector: '[cngxAriaExpanded]',\n exportAs: 'cngxAriaExpanded',\n standalone: true,\n host: {\n '[attr.aria-expanded]': 'ariaExpanded()',\n '[attr.aria-controls]': 'controls() ?? null',\n },\n})\nexport class CngxAriaExpanded {\n /** Whether the controlled element is currently expanded. Sets `aria-expanded`. */\n readonly expanded = input<boolean, unknown>(false, {\n alias: 'cngxAriaExpanded',\n transform: booleanAttribute,\n });\n /** The `id` of the controlled element. Sets `aria-controls`. */\n readonly controls = input<string | undefined>(undefined);\n\n private readonly injector = inject(Injector);\n private resolvedDriver: CngxAriaExpandedDriver | null | undefined = undefined;\n private driver(): CngxAriaExpandedDriver | null {\n if (this.resolvedDriver === undefined) {\n this.resolvedDriver = this.injector.get(CNGX_ARIA_EXPANDED_DRIVER, null, { self: true });\n }\n return this.resolvedDriver;\n }\n\n /** @internal The written attribute value: the driver's when composed, else the input. */\n protected readonly ariaExpanded = computed(() => {\n const driver = this.driver();\n return driver ? driver.ariaExpanded() : this.expanded();\n });\n}\n","import { Directive, input } from '@angular/core';\n\n/**\n * Configures the host element as an ARIA live region.\n *\n * Screen readers monitor live regions and announce content changes automatically.\n * `polite` announcements are queued after the current utterance finishes;\n * `assertive` announcements interrupt immediately. `off` disables announcements.\n *\n * Sets `role=\"alert\"` for assertive regions and `role=\"status\"` for polite regions\n * via a host binding - no manual attribute wiring needed.\n *\n * Unlike `CngxLiveAnnouncer` (hidden regions it owns, imperative\n * `announce()` calls), this directive decorates your own element\n * declaratively - the content you render IS the announcement.\n *\n * ### Status message\n * ```html\n * <div cngxLiveRegion [politeness]=\"'polite'\">\n * {{ statusMessage() }}\n * </div>\n * ```\n *\n * ### Form validation error (assertive)\n * ```html\n * <div cngxLiveRegion [politeness]=\"'assertive'\"\n * [style.color]=\"error() ? 'red' : 'transparent'\">\n * {{ error() }}\n * </div>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/live-region.directive.ts\n * @since 0.3.0\n * @relatedTo CngxLiveAnnouncer\n * <example-url>/#/common/a11y/live-region/form-validation-assertive-error-announcements</example-url>\n * <example-url>/#/common/a11y/live-region/polite-vs-assertive</example-url>\n * @axis level atom\n */\n@Directive({\n selector: '[cngxLiveRegion]',\n exportAs: 'cngxLiveRegion',\n standalone: true,\n host: {\n '[attr.aria-live]': 'politeness()',\n '[attr.aria-atomic]': 'atomic()',\n '[attr.aria-relevant]': 'relevant()',\n '[attr.role]':\n \"politeness() === 'off' ? null : politeness() === 'assertive' ? 'alert' : 'status'\",\n },\n})\nexport class CngxLiveRegion {\n /**\n * Controls the urgency of announcements.\n * - `'polite'` - queued after current speech (default)\n * - `'assertive'` - interrupts immediately\n * - `'off'` - no announcements\n */\n readonly politeness = input<'polite' | 'assertive' | 'off'>('polite');\n /** Whether the entire region should be announced as a whole. */\n readonly atomic = input<boolean>(true);\n /** Which types of content changes to announce. Space-separated: `additions`, `removals`, `text`. */\n readonly relevant = input<string>('additions text');\n}\n","import type { AriaLivePoliteness } from './live-announcer';\n\n// One frame. Clear the region this long before writing so an intentionally\n// repeated identical string still registers as a content change for the SR.\nconst CLEAR_DELAY_MS = 16;\n\n// How long a written message stays in its region before it is cleared. A\n// screen reader takes the text when the change event fires, so the clear is\n// silent; it stops a stale message from being read by browsing to the end\n// of the document, or after a route change.\nconst HOLD_MS = 7000;\n\n/**\n * A message whose write into its live region has not landed yet.\n */\nexport interface CngxPendingAnnouncement {\n readonly message: string;\n readonly politeness: AriaLivePoliteness;\n}\n\n/**\n * @internal Polite + assertive live-region pair inside one container. The\n * engine behind `CngxLiveAnnouncer` (container `document.body`) and\n * `injectScopedLiveRegion` (container: an overlay host).\n */\nexport interface CngxLiveRegionPair {\n /**\n * Clear the region of `politeness` now, write `message` `delayMs` later\n * (default one frame).\n */\n announce(message: string, politeness: AriaLivePoliteness, delayMs?: number): void;\n /** Create both regions up front so they are in the DOM before any message. */\n ensure(): void;\n /** Cancel every write that has not landed and return what it would have said. */\n takePending(): readonly CngxPendingAnnouncement[];\n /** Cancel pending writes and remove both regions. */\n destroy(): void;\n}\n\nconst POLITENESS: readonly AriaLivePoliteness[] = ['polite', 'assertive'];\n\ninterface PendingWrite {\n readonly message: string;\n readonly timer: ReturnType<typeof setTimeout>;\n}\n\n/**\n * @internal Browser only: callers guard the server path. Each region is a\n * visually hidden `aria-live` + `aria-atomic=\"true\"` span (the attribute\n * contract of `CngxLiveRegion`), created lazily on the first announce of its\n * politeness or by `ensure()`. A written message is cleared again after a\n * hold, so the region never keeps stale text.\n *\n * `redirect` is asked when a write is due: returning `true` means the caller\n * took the message elsewhere (its container stopped being readable while the\n * write was pending), so nothing is written here.\n */\nexport function createLiveRegionPair(\n container: HTMLElement,\n doc: Document,\n redirect?: (announcement: CngxPendingAnnouncement) => boolean,\n): CngxLiveRegionPair {\n const regions: Record<AriaLivePoliteness, HTMLElement | null> = {\n polite: null,\n assertive: null,\n };\n const pending: Record<AriaLivePoliteness, PendingWrite | null> = {\n polite: null,\n assertive: null,\n };\n const holds: Record<AriaLivePoliteness, ReturnType<typeof setTimeout> | null> = {\n polite: null,\n assertive: null,\n };\n\n const cancelHold = (politeness: AriaLivePoliteness): void => {\n const hold = holds[politeness];\n if (hold !== null) {\n clearTimeout(hold);\n holds[politeness] = null;\n }\n };\n\n const ensureRegion = (politeness: AriaLivePoliteness): HTMLElement => {\n const existing = regions[politeness];\n if (existing) {\n return existing;\n }\n const span = doc.createElement('span');\n span.setAttribute('aria-live', politeness);\n span.setAttribute('aria-atomic', 'true');\n span.className = 'cngx-sr-only';\n span.style.position = 'absolute';\n span.style.width = '1px';\n span.style.height = '1px';\n span.style.padding = '0';\n span.style.margin = '-1px';\n span.style.overflow = 'hidden';\n span.style.clip = 'rect(0, 0, 0, 0)';\n span.style.whiteSpace = 'nowrap';\n span.style.border = '0';\n container.appendChild(span);\n regions[politeness] = span;\n return span;\n };\n\n const cancel = (politeness: AriaLivePoliteness): PendingWrite | null => {\n const write = pending[politeness];\n if (write) {\n clearTimeout(write.timer);\n pending[politeness] = null;\n }\n return write;\n };\n\n return {\n announce(message, politeness, delayMs = CLEAR_DELAY_MS) {\n const region = ensureRegion(politeness);\n // Clear first, then write one frame later so repeating the same string\n // still registers as a content change for the SR. Polite and assertive\n // keep independent timers so one politeness never cancels the other.\n region.textContent = '';\n cancel(politeness);\n cancelHold(politeness);\n pending[politeness] = {\n message,\n timer: setTimeout(() => {\n pending[politeness] = null;\n if (redirect?.({ message, politeness })) {\n return;\n }\n region.textContent = message;\n holds[politeness] = setTimeout(() => {\n holds[politeness] = null;\n region.textContent = '';\n }, HOLD_MS);\n }, delayMs),\n };\n },\n ensure() {\n for (const politeness of POLITENESS) {\n ensureRegion(politeness);\n }\n },\n takePending() {\n const taken: CngxPendingAnnouncement[] = [];\n for (const politeness of POLITENESS) {\n const write = cancel(politeness);\n if (write) {\n taken.push({ message: write.message, politeness });\n }\n }\n return taken;\n },\n destroy() {\n for (const politeness of POLITENESS) {\n cancel(politeness);\n cancelHold(politeness);\n regions[politeness]?.remove();\n regions[politeness] = null;\n }\n },\n };\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { inject, Injectable, type OnDestroy, PLATFORM_ID } from '@angular/core';\n\nimport {\n createLiveRegionPair,\n type CngxLiveRegionPair,\n type CngxPendingAnnouncement,\n} from './live-region-pair';\n\n// A screen reader commonly misses a change to a live region that entered the\n// DOM a frame earlier. A modal pair is created on the announcement that needs\n// it, so its first write waits until the regions have settled.\nconst FIRST_MODAL_WRITE_DELAY_MS = 100;\n\nconst MODAL_SELECTOR = '[aria-modal=\"true\"]';\n\n/** A modal container a screen reader currently reads. */\nfunction isOpenModal(el: HTMLElement): boolean {\n if (!el.isConnected || el.getAttribute('aria-modal') !== 'true') {\n return false;\n }\n return !(el instanceof HTMLDialogElement) || el.open;\n}\n\n// Overlays such as CngxDialog are appended to the body, and a nested modal\n// follows its container, so document order is stacking order: the last open\n// modal outside an inert subtree is the one a screen reader still reads.\nfunction topmostOpenModal(doc: Document): HTMLElement | null {\n const open = Array.from(doc.querySelectorAll<HTMLElement>(MODAL_SELECTOR)).filter(\n (el) => isOpenModal(el) && !el.closest('[inert]'),\n );\n return open.at(-1) ?? null;\n}\n\n/**\n * Politeness channel for {@link CngxLiveAnnouncer.announce}: `'polite'` queues\n * after the current utterance, `'assertive'` interrupts it immediately.\n */\nexport type AriaLivePoliteness = 'polite' | 'assertive';\n\n/**\n * Imperative, reusable polite/assertive live-region announcer.\n *\n * The imperative counterpart to {@link CngxLiveRegion}: where the directive\n * decorates an element you render (the content IS the announcement), this\n * service owns two visually-hidden `aria-live` regions appended to\n * `document.body` - one persistent polite node and one persistent assertive\n * node - and exposes an `announce(message, politeness)` call for template-less\n * directives and event handlers (e.g. `CngxCopyValue` copy success,\n * `CngxOtpInput` completion).\n *\n * Both body regions are created when the service is created, so they are in\n * the DOM before the first announcement (a screen reader commonly misses a\n * change to a region inserted a frame earlier), and reused thereafter.\n * Because polite and assertive live in separate fixed-politeness nodes, an\n * assertive announcement never clobbers a concurrent polite one. Per region,\n * the text is cleared and re-set one frame later so an identical consecutive\n * message is still re-read by the screen reader. A written message is cleared\n * again after 7 s, so no stale text stays in the region.\n *\n * A modal dialog hides everything outside it from assistive technology, so a\n * body region is silent while one is open. Pass the announcing element as the\n * third argument and the message goes to a region pair inside its enclosing\n * `[aria-modal=\"true\"]` container instead; without a modal ancestor it goes to\n * the body regions as before. When another modal covers that one, the topmost\n * open modal receives it: the last `[aria-modal=\"true\"]` element in document\n * order that is open and not inside an `[inert]` subtree. That covers a modal\n * nested inside the scope's own one as well as a sibling stacked on top of it,\n * which is how `CngxDialog` stacks dialogs (every host is appended to\n * `document.body`); a covered modal is hidden from assistive technology, so\n * its region would be silent. The pair is created with both regions on first\n * use and its first write waits until the regions have settled in the DOM. A\n * message still pending when its modal closes moves to the next enclosing open\n * modal, else to the topmost modal still open, else to the body regions, and\n * the pair is removed. The scope is opt-in per call - an unscoped announcement\n * never guesses a modal. {@link injectScopedLiveRegion} is the injection-time\n * alternative when the caller knows its overlay host up front.\n *\n * SSR-safe: all DOM access is guarded by `isPlatformBrowser`; on the server\n * `announce()` is a no-op and no region is created.\n *\n * ```typescript\n * const announcer = inject(CngxLiveAnnouncer);\n * announcer.announce('Copied');\n * announcer.announce('Save failed', 'assertive');\n * announcer.announce('Alert dismissed', 'polite', hostElement); // inside a modal\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/live-announcer.ts\n * @since 0.3.0\n * @relatedTo CngxLiveRegion\n * <example-url>/#/common/a11y/live-announcer/polite-vs-assertive</example-url>\n */\n@Injectable({ providedIn: 'root' })\nexport class CngxLiveAnnouncer implements OnDestroy {\n private readonly doc = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private regions: CngxLiveRegionPair | null = null;\n\n constructor() {\n if (this.isBrowser) {\n this.regions = createLiveRegionPair(this.doc.body, this.doc);\n this.regions.ensure();\n }\n }\n /**\n * One pair per open `aria-modal` container, released once it closes.\n * `outer` is the container's parent at creation, the route for its unwritten\n * messages when it is removed from the DOM.\n */\n private readonly modalRegions = new Map<\n HTMLElement,\n { readonly pair: CngxLiveRegionPair; readonly outer: Element | null }\n >();\n\n /**\n * Announces `message` through the fixed-politeness live region.\n *\n * @param message Text read by the screen reader.\n * @param politeness `'polite'` (default) queues after the current\n * utterance; `'assertive'` interrupts immediately. Each politeness owns its\n * own region, so the two never overwrite each other.\n * @param scope The announcing element. When it sits inside an\n * `[aria-modal=\"true\"]` container, the message is written into a region\n * inside the topmost open modal (that container unless another modal\n * covers it), which a screen reader still reads while the modal hides the\n * rest of the page. `null` / omitted: the body regions.\n */\n announce(\n message: string,\n politeness: AriaLivePoliteness = 'polite',\n scope?: Element | null,\n ): void {\n if (!this.isBrowser) {\n return;\n }\n this.releaseClosedModals();\n this.route(scope, { message, politeness });\n }\n\n ngOnDestroy(): void {\n this.regions?.destroy();\n this.regions = null;\n for (const { pair } of this.modalRegions.values()) {\n pair.destroy();\n }\n this.modalRegions.clear();\n }\n\n /**\n * `fromModal` marks a message that was already scoped to a modal which has\n * since closed: with no open modal around its new scope it still goes to the\n * topmost open modal rather than to the silent body regions.\n */\n private route(\n scope: Element | null | undefined,\n announcement: CngxPendingAnnouncement,\n fromModal = false,\n ): void {\n const modal = this.targetModal(scope, fromModal);\n if (!modal) {\n this.regions ??= createLiveRegionPair(this.doc.body, this.doc);\n this.regions.announce(announcement.message, announcement.politeness);\n return;\n }\n const existing = this.modalRegions.get(modal);\n if (existing) {\n existing.pair.announce(announcement.message, announcement.politeness);\n return;\n }\n const pair = createLiveRegionPair(modal, this.doc, (due) => this.redirectIfClosed(modal, due));\n pair.ensure();\n this.modalRegions.set(modal, { pair, outer: modal.parentElement });\n pair.announce(announcement.message, announcement.politeness, FIRST_MODAL_WRITE_DELAY_MS);\n }\n\n /**\n * The topmost open modal when `scope` sits in an open modal (or the message\n * comes from a closed one), else `null` for the body regions. Falls back to\n * the scope's own modal when no candidate outside an inert subtree is open.\n */\n private targetModal(scope: Element | null | undefined, fromModal: boolean): HTMLElement | null {\n const own = this.enclosingOpenModal(scope);\n if (!own && !fromModal) {\n return null;\n }\n return topmostOpenModal(this.doc) ?? own;\n }\n\n private enclosingOpenModal(scope: Element | null | undefined): HTMLElement | null {\n let candidate = scope?.closest(MODAL_SELECTOR) ?? null;\n while (candidate) {\n if (candidate instanceof HTMLElement && isOpenModal(candidate)) {\n return candidate;\n }\n candidate = candidate.parentElement?.closest(MODAL_SELECTOR) ?? null;\n }\n return null;\n }\n\n private redirectIfClosed(modal: HTMLElement, due: CngxPendingAnnouncement): boolean {\n if (isOpenModal(modal)) {\n return false;\n }\n const outer = this.outerOf(modal);\n this.release(modal);\n this.route(outer, due, true);\n return true;\n }\n\n private releaseClosedModals(): void {\n for (const modal of Array.from(this.modalRegions.keys())) {\n if (!isOpenModal(modal)) {\n this.release(modal);\n }\n }\n }\n\n /** Drop the pair of a closed modal; its unwritten messages move outward. */\n private release(modal: HTMLElement): void {\n const entry = this.modalRegions.get(modal);\n if (!entry) {\n return;\n }\n const outer = this.outerOf(modal);\n this.modalRegions.delete(modal);\n const unwritten = entry.pair.takePending();\n entry.pair.destroy();\n for (const announcement of unwritten) {\n this.route(outer, announcement, true);\n }\n }\n\n private outerOf(modal: HTMLElement): Element | null {\n return modal.parentElement ?? this.modalRegions.get(modal)?.outer ?? null;\n }\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, inject, PLATFORM_ID } from '@angular/core';\n\nimport type { AriaLivePoliteness } from './live-announcer';\nimport {\n type CngxLiveRegionPair,\n type CngxPendingAnnouncement,\n createLiveRegionPair,\n} from './live-region-pair';\n\n/**\n * Polite + assertive live regions inside one host element.\n */\nexport interface CngxScopedLiveRegion {\n /** Speak `message` from the region of `politeness` (default `'polite'`). */\n announce(message: string, politeness?: AriaLivePoliteness): void;\n /** Create both regions now, so they are in the DOM before the first message. */\n ensure(): void;\n /** Cancel every write that has not landed yet and return what it would have said. */\n takePending(): readonly CngxPendingAnnouncement[];\n /** Cancel pending writes and remove the regions. Runs on destroy as well. */\n destroy(): void;\n}\n\n/**\n * Create a polite + assertive live-region pair inside `host`.\n *\n * The scoped counterpart to {@link CngxLiveAnnouncer}: same regions, same\n * clear-then-set timing, but appended to an overlay host instead of\n * `document.body`. Use it for modal overlays: under `aria-modal` VoiceOver\n * drops body-level live regions and speaks them late after the overlay\n * closes, while a region inside the modal is spoken on every platform.\n * Polite and assertive keep separate regions, so an assertive error never\n * clobbers a polite status.\n *\n * Must run in an injection context; the regions are removed when that context\n * is destroyed, and later calls are no-ops. No-op on the server.\n *\n * ```typescript\n * private readonly region = injectScopedLiveRegion(inject(ElementRef).nativeElement);\n *\n * protected handleSaveFailed(): void {\n * this.region.announce('Save failed', 'assertive');\n * }\n * ```\n *\n * @param host - Element that receives the two visually hidden regions.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/aria/scoped-live-region.ts\n * @since 0.3.0\n * @relatedTo CngxLiveAnnouncer, CngxLiveRegion\n * <example-url>/#/common/a11y/live-announcer/scoped-announcing-in-a-modal</example-url>\n */\nexport function injectScopedLiveRegion(host: HTMLElement): CngxScopedLiveRegion {\n const doc = inject(DOCUMENT);\n const isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n let pair: CngxLiveRegionPair | null = null;\n // A manual destroy() may be followed by a new ensure() (an overlay that\n // reopens); a destroyed host never takes regions again.\n let hostDestroyed = false;\n const usable = () => isBrowser && !hostDestroyed;\n const ensurePair = (): CngxLiveRegionPair => {\n pair ??= createLiveRegionPair(host, doc);\n return pair;\n };\n\n const region: CngxScopedLiveRegion = {\n announce(message, politeness = 'polite') {\n if (!usable()) {\n return;\n }\n ensurePair().announce(message, politeness);\n },\n ensure() {\n if (!usable()) {\n return;\n }\n ensurePair().ensure();\n },\n takePending() {\n return pair?.takePending() ?? [];\n },\n destroy() {\n pair?.destroy();\n pair = null;\n },\n };\n inject(DestroyRef).onDestroy(() => {\n hostDestroyed = true;\n region.destroy();\n });\n return region;\n}\n","import {\n afterNextRender,\n booleanAttribute,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n Injector,\n} from '@angular/core';\n\n/**\n * Reactive autofocus for dynamically inserted elements.\n *\n * The native `autofocus` HTML attribute only works on initial page load.\n * This directive handles dynamic content: dialogs, panels, stepper steps,\n * and any element that appears after the initial render.\n *\n * Focuses the host element after the next render frame using `afterNextRender`.\n * When `when` changes to `true`, focus is re-applied.\n *\n * ### Focus on insertion\n * ```html\n * @if (showSearch()) {\n * <input cngxAutofocus placeholder=\"Search…\" />\n * }\n * ```\n *\n * ### Conditional focus\n * ```html\n * <input [cngxAutofocus]=\"isActive()\" />\n * ```\n *\n * ### With delay for transitions\n * ```html\n * <input cngxAutofocus [autofocusDelay]=\"200\" />\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/autofocus.directive.ts\n * @since 0.3.0\n * @relatedTo CngxFocusRestore, CngxFocusTrap, CngxFocusVisible\n * <example-url>/#/common/a11y/autofocus/conditional-focus</example-url>\n * <example-url>/#/common/a11y/autofocus/focus-on-insert</example-url>\n * @axis level atom\n */\n@Directive({\n selector: '[cngxAutofocus]',\n exportAs: 'cngxAutofocus',\n standalone: true,\n})\nexport class CngxAutofocus {\n /** Whether to focus the element. Defaults to `true` (always focus on render). */\n readonly when = input<boolean, unknown>(true, {\n alias: 'cngxAutofocus',\n transform: booleanAttribute,\n });\n /** Delay in ms before focusing - useful when the element appears during a transition. */\n readonly delay = input<number>(0, { alias: 'autofocusDelay' });\n /** `FocusOptions` passed to `element.focus()`. */\n readonly options = input<FocusOptions>({}, { alias: 'autofocusOptions' });\n\n private readonly el = inject(ElementRef<HTMLElement>);\n private readonly injector = inject(Injector);\n private pendingTimer: ReturnType<typeof setTimeout> | null = null;\n private initialized = false;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.clearPending());\n\n afterNextRender(() => {\n if (this.when()) {\n this.scheduleFocus();\n }\n this.initialized = true;\n });\n\n // Re-focus on false→true transitions only; `previousWhen` starts as `true`\n // so the initial effect run does not double-trigger alongside afterNextRender.\n let previousWhen = true;\n effect(() => {\n const current = this.when();\n if (this.initialized && current && !previousWhen) {\n this.scheduleFocus();\n }\n previousWhen = current;\n });\n }\n\n private scheduleFocus(): void {\n this.clearPending();\n const delayMs = this.delay();\n if (delayMs > 0) {\n this.pendingTimer = setTimeout(() => this.applyFocus(), delayMs);\n } else {\n afterNextRender(() => this.applyFocus(), { injector: this.injector });\n }\n }\n\n private applyFocus(): void {\n const el = this.el.nativeElement as HTMLElement;\n // A delayed schedule can outlive its trigger: the condition may have\n // flipped off or the element may have left the DOM. Re-check both so a\n // stale timer cannot steal focus from wherever it moved meanwhile.\n if (!this.when() || !el.isConnected) {\n return;\n }\n el.focus(this.options());\n }\n\n private clearPending(): void {\n if (this.pendingTimer !== null) {\n clearTimeout(this.pendingTimer);\n this.pendingTimer = null;\n }\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n afterNextRender,\n computed,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n InjectionToken,\n Injector,\n input,\n type Signal,\n untracked,\n} from '@angular/core';\nimport { createTransitionTracker } from '@cngx/core/utils';\n\n/**\n * CSS selector matching natively-focusable elements: links with an\n * `href`, the enabled form controls, the summary of a `<details>`,\n * editable content, and anything with an explicit non-negative `tabindex`.\n * Form controls carry `:not(:disabled)` because a disabled control is not in\n * the tab order - without it a descendant probe would count a disabled button\n * as focusable and a restore target could land on an unfocusable element.\n * Single source of truth for \"is this focusable\" - the element-level\n * {@link CngxFocusRestore} predicate matches against it, and descendant probes\n * (e.g. \"does this panel contain a focusable child?\") query against it.\n * Keeping one selector stops the two uses from drifting apart.\n *\n * @since 0.3.0\n */\nexport const CNGX_FOCUSABLE_SELECTOR =\n 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), details > summary:first-of-type, [contenteditable]:not([contenteditable=\"false\"]), [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * Lets a directive that composes `CngxFocusRestore` as a host directive drive\n * its capture / restore edges from its own state instead of\n * `[cngxFocusRestoreWhile]`. Provided by the composer on the same element\n * (`useExisting`); the restore directive resolves it lazily with\n * `self: true`, because the composer constructs after its host directives.\n * `CngxDrawerSurface` is the in-library composer.\n *\n * @relatedTo CngxFocusRestore, CNGX_FOCUS_RESTORE_DRIVER\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-restore.directive.ts\n * @since 0.3.0\n */\nexport interface CngxFocusRestoreDriver {\n /** Whether the surface is engaged; wins over `[cngxFocusRestoreWhile]`. */\n readonly focusRestoreActive: Signal<boolean>;\n /**\n * The fallback when the stored element cannot take focus back; wins over\n * the `[fallback]` input. Read at restore time, so a composer can derive\n * it from the DOM (the element that controls the host).\n */\n focusRestoreFallback?(): HTMLElement | null;\n}\n\n/**\n * Injection token for a {@link CngxFocusRestoreDriver}. A composer provides it\n * on its own element (`useExisting`) to override `[cngxFocusRestoreWhile]`\n * and `[fallback]` of its `CngxFocusRestore` host directive. Used by\n * `CngxDrawerSurface`.\n *\n * @relatedTo CngxFocusRestore\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-restore.directive.ts\n * @since 0.3.0\n */\nexport const CNGX_FOCUS_RESTORE_DRIVER = new InjectionToken<CngxFocusRestoreDriver>(\n 'CngxFocusRestoreDriver',\n);\n\n/**\n * Stores the previously focused element and restores focus on destroy, or on\n * the falling edge of `[cngxFocusRestoreWhile]` for a surface that stays in\n * the DOM while closed.\n *\n * Prevents focus from falling to `<body>` when dynamic content is removed\n * (dialogs closing, panels collapsing, tabs switching). The directive captures\n * `document.activeElement` at initialization time and restores it when the\n * host element is destroyed while focus is inside it or has dropped to\n * `<body>`. Focus the user moved elsewhere before the destroy stays put.\n *\n * Fallback chain: stored element → provided fallback → nearest focusable ancestor.\n * When none resolves, focus is left where the browser put it - `<body>` is\n * deliberately never a restore target.\n *\n * ### Panel that restores focus on close\n * ```html\n * @if (panelOpen()) {\n * <div cngxFocusRestore>\n * Panel content…\n * <button (click)=\"panelOpen.set(false)\">Close</button>\n * </div>\n * }\n * ```\n *\n * ### Persistent surface (drawer, sidebar overlay)\n * ```html\n * <aside cngxFocusRestore [cngxFocusRestoreWhile]=\"open()\">…</aside>\n * ```\n * `true` captures the focused element, `false` restores it when focus is\n * still inside the host or has dropped to `<body>`. Focus the user moved\n * elsewhere in the meantime stays where it is. A target that is still\n * `inert` at the falling edge (a backdrop released in the same pass) is\n * focused after the next render instead.\n *\n * ### With explicit fallback\n * ```html\n * <div cngxFocusRestore [fallback]=\"fallbackBtn\">\n * Dynamic content…\n * </div>\n * <button #fallbackBtn>Fallback target</button>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-restore.directive.ts\n * @since 0.3.0\n * @relatedTo CngxAutofocus, CngxFocusTrap, CngxFocusVisible\n * <example-url>/#/common/a11y/focus-restore/inline-details</example-url>\n * <example-url>/#/common/a11y/focus-restore/panel-with-automatic-restore</example-url>\n * <example-url>/#/common/a11y/focus-restore/persistent-panel-restore-while-open</example-url>\n * @axis level atom\n */\n@Directive({\n selector: '[cngxFocusRestore]',\n exportAs: 'cngxFocusRestore',\n standalone: true,\n})\nexport class CngxFocusRestore {\n /**\n * Whether to restore focus when the host element is destroyed. Applies only\n * when focus is inside the host or on `<body>` at that moment.\n */\n readonly restoreOnDestroy = input<boolean>(true);\n /** Explicit fallback element if the stored element is no longer in the DOM. */\n readonly fallback = input<HTMLElement | null>(null);\n /**\n * Bind to the open state of a surface that stays in the DOM while closed.\n * The `false -> true` edge captures the focused element, the\n * `true -> false` edge restores it when focus is inside the host or on\n * `<body>`. While bound, destroying the host restores only when it is\n * engaged. Unbound (`undefined`), only destroy and the manual\n * `capture()` / `restore()` apply.\n */\n readonly whileActive = input<boolean | undefined>(undefined, {\n alias: 'cngxFocusRestoreWhile',\n });\n\n private readonly doc = inject(DOCUMENT);\n private readonly el = inject(ElementRef<HTMLElement>);\n private readonly injector = inject(Injector);\n // Read only inside the restore paths (untracked edge, destroy, manual\n // restore()); nothing derives from it, so it is not a signal.\n private storedElement: HTMLElement | null = null;\n // The host is already detached when DestroyRef fires, so the ancestor\n // walk starts from the parent recorded while it was still attached.\n private lastParent: HTMLElement | null = null;\n\n private resolvedDriver: CngxFocusRestoreDriver | null | undefined = undefined;\n private driver(): CngxFocusRestoreDriver | null {\n if (this.resolvedDriver === undefined) {\n this.resolvedDriver = this.injector.get(CNGX_FOCUS_RESTORE_DRIVER, null, { self: true });\n }\n return this.resolvedDriver;\n }\n\n private readonly engaged = computed(\n () => this.driver()?.focusRestoreActive() ?? this.whileActive() === true,\n );\n private readonly engagement = createTransitionTracker(() => this.engaged());\n\n constructor() {\n const activeEl = this.doc.activeElement;\n if (activeEl instanceof HTMLElement) {\n this.storedElement = activeEl;\n }\n afterNextRender({ read: () => (this.lastParent = this.host().parentElement) });\n\n effect(() => {\n const current = this.engagement.current();\n if (current === this.engagement.previous()) {\n return;\n }\n untracked(() => (current ? this.captureOutside() : this.restoreIfFocusInside()));\n });\n\n inject(DestroyRef).onDestroy(() => {\n if (!this.restoreOnDestroy()) {\n return;\n }\n // A closed edge-driven surface already restored (or never captured);\n // tearing it down must not pull focus from wherever the user is.\n if (this.edgeDriven() && !untracked(this.engaged)) {\n return;\n }\n\n // Focus the user moved elsewhere in the meantime stays where it is.\n if (!this.focusLost()) {\n return;\n }\n this.resolveTarget()?.focus();\n });\n }\n\n /** Manually store the current focus target for later restoration. */\n capture(): void {\n const activeEl = this.doc.activeElement;\n if (activeEl instanceof HTMLElement) {\n this.storedElement = activeEl;\n }\n }\n\n /** Manually restore focus to the stored element. */\n restore(): void {\n const target = this.resolveTarget();\n if (target) {\n target.focus();\n }\n }\n\n private edgeDriven(): boolean {\n return this.driver() !== null || untracked(this.whileActive) !== undefined;\n }\n\n // A composer's trap can move focus inside before this edge runs; the\n // element inside is never the one to return to.\n private captureOutside(): void {\n const activeEl = this.doc.activeElement;\n if (activeEl instanceof HTMLElement && !this.host().contains(activeEl)) {\n this.storedElement = activeEl;\n }\n }\n\n private restoreIfFocusInside(): void {\n if (!this.focusLost()) {\n return;\n }\n const target = this.resolveTarget();\n if (!target) {\n return;\n }\n if (!target.closest('[inert]')) {\n target.focus();\n return;\n }\n // Another owner (a backdrop) can still hold `inert` on the target in\n // this pass; focus() on an inert element is a no-op. Its release runs in\n // the same change detection, so retry once after the render.\n afterNextRender(\n () => {\n if (this.focusLost() && !target.closest('[inert]')) {\n target.focus();\n }\n },\n { injector: this.injector },\n );\n }\n\n // A detached host still contains the element that had focus in it, so the\n // check also holds on destroy, where the browser may report either that\n // element or `<body>`.\n private focusLost(): boolean {\n const activeEl = this.doc.activeElement;\n return !activeEl || activeEl === this.doc.body || this.host().contains(activeEl);\n }\n\n private host(): HTMLElement {\n return this.el.nativeElement as HTMLElement;\n }\n\n /**\n * Walks the fallback chain:\n * 1. Stored element (if still in DOM and not body/self)\n * 2. The driver's fallback, else the explicit fallback input\n * 3. Nearest focusable ancestor\n */\n private resolveTarget(): HTMLElement | null {\n const stored = this.storedElement;\n // Skip body - it signals \"nothing meaningful was focused\", not a real\n // restore target - and anything inside the host, which is the focus\n // being restored away from (engaged while focus was already inside).\n if (\n stored &&\n stored !== this.doc.body &&\n this.doc.contains(stored) &&\n !this.host().contains(stored)\n ) {\n return stored;\n }\n\n const fallback = this.driver()?.focusRestoreFallback?.() ?? this.fallback();\n if (fallback && this.doc.contains(fallback)) {\n return fallback;\n }\n\n return this.findFocusableAncestor();\n }\n\n /** Traverses up the DOM tree looking for the first natively focusable element. */\n private findFocusableAncestor(): HTMLElement | null {\n let current = this.host().parentElement ?? this.lastParent;\n while (current) {\n if (this.isFocusable(current)) {\n return current;\n }\n current = current.parentElement;\n }\n return null;\n }\n\n /**\n * Checks if an element is natively focusable (tabindex, links, form\n * controls). Element-level predicate over the shared\n * {@link CNGX_FOCUSABLE_SELECTOR}, so it never drifts from the\n * descendant-query callers.\n */\n private isFocusable(el: HTMLElement): boolean {\n return el.matches(CNGX_FOCUSABLE_SELECTOR);\n }\n}\n","import { type FocusTrap, FocusTrapFactory } from '@angular/cdk/a11y';\nimport {\n computed,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n InjectionToken,\n Injector,\n input,\n type Signal,\n untracked,\n} from '@angular/core';\n\n/**\n * Lets a directive that composes `CngxFocusTrap` as a host directive drive it\n * from its own state instead of the inputs. Provided by the composer on the\n * same element (`useExisting`); the trap resolves it lazily with\n * `self: true`, because the composer constructs after its host directives.\n * `CngxDrawerSurface` and `CngxPopoverSheet` are the in-library composers.\n *\n * @relatedTo CngxFocusTrap, CNGX_FOCUS_TRAP_DRIVER\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-trap.directive.ts\n * @since 0.3.0\n */\nexport interface CngxFocusTrapDriver {\n /** Whether the trap is active; wins over `[enabled]`. */\n readonly focusTrapEnabled: Signal<boolean>;\n /** Whether activation auto-focuses; wins over `[autoFocus]`. */\n readonly focusTrapAutoFocus: boolean;\n}\n\n/**\n * Injection token for a {@link CngxFocusTrapDriver}. A composer provides it on\n * its own element (`useExisting`) to override `[enabled]` and `[autoFocus]` of\n * its `CngxFocusTrap` host directive. Used by `CngxDrawerSurface` and\n * `CngxPopoverSheet`.\n *\n * @relatedTo CngxFocusTrap\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-trap.directive.ts\n * @since 0.3.0\n */\nexport const CNGX_FOCUS_TRAP_DRIVER = new InjectionToken<CngxFocusTrapDriver>(\n 'CngxFocusTrapDriver',\n);\n\n/**\n * Traps keyboard focus within the host element using the CDK `FocusTrap`.\n *\n * When enabled, Tab and Shift+Tab cycle only within the host element's\n * focusable children. When `autoFocus` is `true` (default), focus moves to\n * the first tabbable element automatically on activation.\n *\n * Wraps CDK's `FocusTrapFactory` with a declarative, Signal-driven API.\n * The CDK's imperative `create()` / `destroy()` / `enabled` setter lifecycle\n * is handled internally via `effect()` and `DestroyRef`.\n *\n * **Nesting:** traps do not coordinate with each other. When traps nest\n * (dialog over drawer), enable only the innermost one and drive each\n * `enabled` from your layering state - two simultaneously enabled traps\n * fight over Tab. `CngxDialogStack` already does this for stacked dialogs.\n *\n * ### Modal dialog\n * ```html\n * <div cngxFocusTrap [enabled]=\"isOpen()\" [autoFocus]=\"true\"\n * tabindex=\"-1\" role=\"dialog\" aria-modal=\"true\"\n * (keydown.escape)=\"isOpen.set(false)\">\n * <input placeholder=\"First input\" />\n * <button (click)=\"isOpen.set(false)\">Close</button>\n * </div>\n * ```\n *\n * ### Drawer / sidebar\n * ```html\n * <nav cngxFocusTrap [enabled]=\"drawerOpen()\" tabindex=\"-1\">\n * <a href=\"/home\">Home</a>\n * <a href=\"/settings\">Settings</a>\n * </nav>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-trap.directive.ts\n * @since 0.3.0\n * @relatedTo CngxAutofocus, CngxFocusRestore, CngxDialog\n * <example-url>/#/common/a11y/focus-trap/modal-dialog</example-url>\n * <example-url>/#/common/a11y/focus-trap/slide-out-drawer</example-url>\n * @axis level atom\n */\n@Directive({\n selector: '[cngxFocusTrap]',\n exportAs: 'cngxFocusTrap',\n standalone: true,\n})\nexport class CngxFocusTrap {\n /** Whether the focus trap is active. When `false`, Tab navigates normally. */\n readonly enabled = input<boolean>(false);\n /** Whether to auto-focus the first tabbable element when the trap activates. */\n readonly autoFocus = input<boolean>(true);\n\n private readonly injector = inject(Injector);\n private resolvedDriver: CngxFocusTrapDriver | null | undefined = undefined;\n private driver(): CngxFocusTrapDriver | null {\n if (this.resolvedDriver === undefined) {\n this.resolvedDriver = this.injector.get(CNGX_FOCUS_TRAP_DRIVER, null, { self: true });\n }\n return this.resolvedDriver;\n }\n\n /**\n * The enabled state the trap actually follows: a composer's driver\n * (see {@link CngxFocusTrapDriver}) wins over the `[enabled]` input.\n */\n private readonly effectiveEnabled = computed(\n () => this.driver()?.focusTrapEnabled() ?? this.enabled(),\n );\n\n /**\n * Readable alias of the effective enabled state for `exportAs` consumers\n * (`trap.isActive()` reads better than re-binding the input).\n */\n readonly isActive = computed(() => this.effectiveEnabled());\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly factory = inject(FocusTrapFactory);\n private trap: FocusTrap | null = null;\n\n constructor() {\n // Track ONLY the effective enabled state: with autoFocus inside the\n // tracked zone, flipping [autoFocus] while the trap is active would\n // re-run the effect and yank focus back to the first tabbable element.\n // The CDK calls are service work, not dependencies.\n effect(() => {\n const enabled = this.effectiveEnabled();\n untracked(() => {\n if (!enabled && !this.trap) {\n return;\n }\n const trap = this.ensureTrap();\n trap.enabled = enabled;\n if (enabled && !trap.hasAttached()) {\n trap.attachAnchors();\n }\n if (enabled && (this.driver()?.focusTrapAutoFocus ?? this.autoFocus())) {\n void trap.focusFirstTabbableElementWhenReady();\n }\n });\n });\n\n inject(DestroyRef).onDestroy(() => this.trap?.destroy());\n }\n\n /** Programmatically focus the first tabbable element within the trap. */\n focusFirst(): void {\n void this.ensureTrap().focusFirstTabbableElementWhenReady();\n }\n\n /** Programmatically focus the last tabbable element within the trap. */\n focusLast(): void {\n void this.ensureTrap().focusLastTabbableElementWhenReady();\n }\n\n /**\n * @internal Focus the first tabbable element right now, in the caller's\n * stack. `focusFirst()` waits for the next render, which is too late for a\n * composer that must move focus inside the user gesture that opened it.\n * Returns `false` when nothing inside is tabbable.\n */\n focusFirstNow(): boolean {\n return this.ensureTrap().focusFirstTabbableElement();\n }\n\n // Deferred anchors: the CDK sentinels are inserted on the first enable,\n // so a trap that is never enabled leaves the DOM untouched.\n private ensureTrap(): FocusTrap {\n this.trap ??= this.factory.create(this.host, true);\n return this.trap;\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport { DestroyRef, Directive, inject, signal } from '@angular/core';\n\n/**\n * Tracks keyboard-initiated focus on the host element.\n *\n * Adds `cngx-focus-visible` CSS class when the element receives focus via keyboard\n * and removes it on blur or when focus was initiated by pointer interaction.\n *\n *\n * ```html\n * <button cngxFocusVisible #fv=\"cngxFocusVisible\">\n * @if (fv.focusVisible()) { Focus ring visible }\n * </button>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/focus/focus-visible.directive.ts\n * @since 0.3.0\n * @relatedTo CngxAutofocus, CngxFocusRestore, CngxFocusTrap\n * <example-url>/#/common/a11y/focus-visible/form-fields-custom-focus-ring</example-url>\n * <example-url>/#/common/a11y/focus-visible/keyboard-vs-pointer</example-url>\n * @axis level atom\n */\n@Directive({\n selector: '[cngxFocusVisible]',\n exportAs: 'cngxFocusVisible',\n standalone: true,\n host: {\n '(pointerdown)': 'handlePointerDown()',\n '(focusin)': 'handleFocus()',\n '(focusout)': 'handleBlur()',\n '[class.cngx-focus-visible]': 'focusVisible()',\n },\n})\nexport class CngxFocusVisible {\n private readonly doc = inject(DOCUMENT);\n private readonly focusVisibleState = signal(false);\n /** `true` when focus was initiated via keyboard (not pointer). */\n readonly focusVisible = this.focusVisibleState.asReadonly();\n\n private pointerActive = false;\n private pointerClearTimer: ReturnType<typeof setTimeout> | null = null;\n\n // pointercancel (touch scroll start, OS gesture) ends a press without a\n // pointerup; either release clears the flag and drops both listeners.\n private readonly releasePointer = (): void => {\n this.removeReleaseListeners();\n this.schedulePointerClear();\n };\n\n private readonly schedulePointerClear = (): void => {\n // One macrotask of grace: on touch, the compat mousedown and the focusin\n // fire AFTER pointerup, so a synchronous clear here would misread a tap\n // as keyboard focus. The deferred clear runs after the whole tap\n // sequence settled.\n if (this.pointerClearTimer !== null) {\n clearTimeout(this.pointerClearTimer);\n }\n this.pointerClearTimer = setTimeout(() => {\n this.pointerActive = false;\n this.pointerClearTimer = null;\n }, 0);\n };\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.removeReleaseListeners();\n if (this.pointerClearTimer !== null) {\n clearTimeout(this.pointerClearTimer);\n }\n });\n }\n\n /** @internal Arms the pointer flag for the imminent focusin. */\n protected handlePointerDown(): void {\n // A pending clear from the previous release must not fire mid-press.\n if (this.pointerClearTimer !== null) {\n clearTimeout(this.pointerClearTimer);\n this.pointerClearTimer = null;\n }\n this.pointerActive = true;\n // The flag must not outlive the click: a pointerdown that never focuses\n // (disabled child, text selection, drag released off-host) would\n // otherwise suppress the ring on the NEXT keyboard Tab-in. Document-level\n // capture catches the release wherever it lands.\n this.doc.addEventListener('pointerup', this.releasePointer, true);\n this.doc.addEventListener('pointercancel', this.releasePointer, true);\n }\n\n private removeReleaseListeners(): void {\n this.doc.removeEventListener('pointerup', this.releasePointer, true);\n this.doc.removeEventListener('pointercancel', this.releasePointer, true);\n }\n\n /** @internal Sets focus-visible state; clears pointer flag. */\n protected handleFocus(): void {\n this.focusVisibleState.set(!this.pointerActive);\n this.pointerActive = false;\n }\n\n /** @internal Clears focus-visible state on blur. */\n protected handleBlur(): void {\n this.focusVisibleState.set(false);\n }\n}\n","import {\n afterNextRender,\n contentChildren,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n model,\n signal,\n untracked,\n} from '@angular/core';\nimport {\n injectDirection,\n resolveBoundaryStep,\n resolveInlineStep,\n resolveStepFrom,\n} from '@cngx/core';\nimport { isComposingKeydown, isTextEntryTarget } from '@cngx/core/utils';\n\n/**\n * Widgets whose arrow keys are their own. A key from inside one that sits in\n * the roving group (a slider in a toolbar item, a nested listbox) belongs to\n * it, not to the group.\n */\nconst ARROW_KEY_WIDGETS = [\n 'input[type=\"range\"]',\n '[role=\"slider\"]',\n '[role=\"spinbutton\"]',\n '[role=\"scrollbar\"]',\n '[role=\"combobox\"]',\n '[role=\"listbox\"]',\n '[role=\"tree\"]',\n '[role=\"treegrid\"]',\n '[role=\"grid\"]',\n '[role=\"menu\"]',\n '[role=\"menubar\"]',\n '[role=\"tablist\"]',\n '[role=\"radiogroup\"]',\n '[role=\"toolbar\"]',\n].join(', ');\n\n/**\n * Marker directive for items managed by `CngxRovingTabindex`.\n *\n * Place on each focusable child inside a `[cngxRovingTabindex]` container.\n * The roving tabindex controller sets `tabindex=\"0\"` on the active item\n * and `tabindex=\"-1\"` on all others.\n *\n * ```html\n * <div cngxRovingTabindex>\n * <button cngxRovingItem>One</button>\n * <button cngxRovingItem>Two</button>\n * <button cngxRovingItem>Three</button>\n * </div>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/roving/roving-tabindex.directive.ts\n * @since 0.3.0\n * @relatedTo CngxRovingTabindex, CngxButtonToggle\n * <example-url>/#/common/a11y/roving-tabindex/horizontal-toolbar</example-url>\n * <example-url>/#/common/a11y/roving-tabindex/vertical-menu</example-url>\n */\n@Directive({\n selector: '[cngxRovingItem]',\n exportAs: 'cngxRovingItem',\n standalone: true,\n})\nexport class CngxRovingItem {\n /** @internal Reference used by the parent `CngxRovingTabindex` to set `tabindex`. */\n readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /** Whether this item is disabled and should be skipped during navigation. */\n readonly disabled = input<boolean>(false, { alias: 'cngxRovingItemDisabled' });\n\n /** Programmatically focus this item. Called by the parent on arrow-key navigation. */\n focus(): void {\n (this.elementRef.nativeElement as HTMLElement).focus();\n }\n}\n\n/**\n * Implements the WAI-ARIA roving tabindex pattern for composite widgets.\n *\n * Only the active item in the group has `tabindex=\"0\"` - all others get\n * `tabindex=\"-1\"`. Arrow keys move focus within the group; Tab leaves it.\n * Home/End jump to first/last item.\n *\n * Works for toolbars, tab lists, card grids, menu bars, and any composite\n * widget where only one item should be in the tab order at a time.\n *\n * ### Keys the group leaves alone\n *\n * A key from a text field (an `<input>` item, a field inside an item), a key\n * of an IME composition, and an arrow from inside a nested widget that owns\n * its arrows (a range input or an element with a slider, spinbutton,\n * scrollbar, combobox, listbox, tree, treegrid, grid, menu, menubar,\n * tablist, radiogroup or toolbar role)\n * stays with that element. A custom widget without one of those roles keeps\n * its arrows by calling `preventDefault()` on the keys it handles: the group\n * skips every key that arrives already handled.\n *\n * ### Virtual mode\n *\n * When `virtualCount` is set, `activeIndex` ranges from 0 to `virtualCount - 1`\n * instead of being bounded by `contentChildren.length`. Items are matched by\n * `data-cngx-recycle-index` attribute. When the target item is not in the DOM\n * (out of rendered range), `pendingFocus` is set so a wiring function like\n * `connectRecyclerToRoving()` can scroll it into view.\n *\n * ### Horizontal toolbar\n * ```html\n * <div cngxRovingTabindex orientation=\"horizontal\" #rv=\"cngxRovingTabindex\">\n * <button cngxRovingItem>Cut</button>\n * <button cngxRovingItem>Copy</button>\n * <button cngxRovingItem>Paste</button>\n * </div>\n * ```\n *\n * ### Vertical menu with controlled index\n * ```html\n * <ul cngxRovingTabindex orientation=\"vertical\" [(activeIndex)]=\"selectedIdx\">\n * @for (item of items(); track item.id) {\n * <li cngxRovingItem>{{ item.label }}</li>\n * }\n * </ul>\n * ```\n *\n * ### Virtual scroll integration\n * ```html\n * <div cngxRovingTabindex orientation=\"vertical\" [virtualCount]=\"recycler.ariaSetSize()\">\n * @for (item of visibleItems(); track item.id; let i = $index) {\n * <div cngxRovingItem [cngxVirtualItem]=\"recycler\" [cngxVirtualItemIndex]=\"recycler.start() + i\">\n * {{ item.name }}\n * </div>\n * }\n * </div>\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/roving/roving-tabindex.directive.ts\n * @since 0.3.0\n * @relatedTo CngxRovingItem, CngxActiveDescendant\n * <example-url>/#/common/a11y/roving-tabindex/horizontal-toolbar</example-url>\n * <example-url>/#/common/a11y/roving-tabindex/vertical-menu</example-url>\n * @axis level atom\n */\n@Directive({\n selector: '[cngxRovingTabindex]',\n exportAs: 'cngxRovingTabindex',\n standalone: true,\n host: {\n '(keydown)': 'handleKeyDown($event)',\n '(focusin)': 'handleFocusIn($event)',\n },\n})\nexport class CngxRovingTabindex {\n /**\n * Arrow key navigation axis. `'both'` enables both horizontal and\n * vertical arrows. Exposed as a `model` so composite hosts (e.g.\n * `CngxRadioGroup`, where the keyboard axis must always be `'both'`\n * per WAI-ARIA APG regardless of the cosmetic group orientation) can\n * override it from their own constructor.\n */\n readonly orientation = model<'horizontal' | 'vertical' | 'both'>('horizontal');\n /** Whether navigation wraps from last to first and vice versa. */\n readonly loop = input<boolean>(true);\n /** Index of the currently active (focusable) item. Supports two-way `[(activeIndex)]` binding. */\n readonly activeIndex = model<number>(0);\n\n /**\n * Total item count for virtual mode. When set, `activeIndex` ranges from 0 to\n * `virtualCount - 1` and items are matched by `data-cngx-recycle-index` attribute.\n * When not set, standard `contentChildren`-based navigation is used.\n */\n readonly virtualCount = input<number | undefined>(undefined);\n\n /** All `CngxRovingItem` children discovered via `contentChildren`. */\n private readonly items = contentChildren(CngxRovingItem);\n\n /**\n * Flips after the first browser render. Virtual mode waits for it: it reads\n * the `data-cngx-recycle-index` attributes, which the item bindings write\n * during that render. Standard mode writes before it (so a server render\n * carries the tab stops) and once more after it, because an item's own\n * `[attr.tabindex]` binding (null under a roving parent) clears the\n * attribute during that render.\n */\n private readonly rendered = signal(false);\n\n /** Host element for `data-cngx-recycle-index` queries in virtual mode. */\n private readonly hostEl = inject(ElementRef<HTMLElement>);\n\n private readonly pendingFocusState = signal<number | null>(null);\n\n /** Document writing direction - flips the horizontal-arrow index deltas under `rtl` (APG). */\n private readonly direction = injectDirection();\n\n /**\n * Set true just before a navigation key (arrow / Home / End) moves focus to a\n * new item, cleared by {@link consumeNavigationKey}. Transient handshake, not\n * reactive state: consumer groups read it synchronously from the\n * newly-focused leaf's `(focus)` handler.\n */\n private navigationKeyInFlight = false;\n\n /**\n * Index of the item that should receive focus but is not currently in the DOM.\n * Non-null when virtual navigation targets an out-of-range item.\n * Used by `connectRecyclerToRoving()` to scroll the item into view and focus it.\n */\n readonly pendingFocus = this.pendingFocusState.asReadonly();\n\n constructor() {\n // The item list and the index the last run settled on: a list change with\n // an unchanged index re-finds the item that held the tab stop.\n let previousItems: readonly CngxRovingItem[] = [];\n let previousActive = -1;\n\n afterNextRender(() => this.rendered.set(true));\n\n effect(() => {\n const rendered = this.rendered();\n const items = this.items();\n const active = this.activeIndex();\n const vc = this.virtualCount();\n\n if (vc != null) {\n if (!rendered) {\n return;\n }\n // Virtual mode: match by data-cngx-recycle-index attribute. Clamp the\n // model itself when the virtual space shrinks below it - a ghost\n // index would otherwise anchor the next arrow press. An empty space\n // (vc 0) keeps the model untouched so a repopulated list restores it.\n const clamped = vc > 0 ? Math.max(0, Math.min(active, vc - 1)) : active;\n if (clamped !== active) {\n untracked(() => this.activeIndex.set(clamped));\n }\n const stop = virtualTabStop(items, clamped);\n items.forEach((item) =>\n (item.elementRef.nativeElement as HTMLElement).setAttribute(\n 'tabindex',\n item === stop ? '0' : '-1',\n ),\n );\n return;\n }\n\n // Standard mode: match by array index. When the list changed under an\n // unchanged index, the item that held the tab stop is looked up again,\n // so a removal or reorder before it does not hand the stop to another\n // item. The tab stop must land on an enabled item - fall back to the\n // first enabled one when the target is disabled (initial index into a\n // disabled leaf, or the active item got disabled). The model is written\n // back so keyboard navigation anchors where the tab stop actually sits.\n // An empty list keeps the model untouched so a repopulated list\n // restores it.\n if (items.length === 0) {\n return;\n }\n let anchor = active;\n if (items !== previousItems && active === previousActive) {\n const held = previousItems[active];\n const moved = held ? items.indexOf(held) : -1;\n anchor = moved >= 0 ? moved : active;\n }\n let target = Math.max(0, Math.min(anchor, items.length - 1));\n if (items[target]?.disabled()) {\n target = this.findFirst(items) ?? target;\n }\n previousItems = items;\n previousActive = target;\n if (target !== active) {\n untracked(() => this.activeIndex.set(target));\n }\n items.forEach((item, i) =>\n (item.elementRef.nativeElement as HTMLElement).setAttribute(\n 'tabindex',\n i === target ? '0' : '-1',\n ),\n );\n });\n }\n\n /**\n * Clears the pending focus target. Called by `connectRecyclerToRoving()`\n * after the item has been scrolled into view and focused.\n */\n clearPendingFocus(): void {\n this.pendingFocusState.set(null);\n }\n\n /**\n * Whether the last focus move was driven by a navigation key, consuming the\n * flag so it reads `true` exactly once. Consumer groups (radio,\n * button-toggle) call this from the newly-focused leaf's `(focus)` handler to\n * decide whether to auto-select. The flag is set before `.focus()`, so it is\n * already `true` when focus lands - this closes the one-press-behind race\n * that a group's own `(keydown)` binding suffered (#135).\n */\n consumeNavigationKey(): boolean {\n const inFlight = this.navigationKeyInFlight;\n this.navigationKeyInFlight = false;\n return inFlight;\n }\n\n /**\n * Handles arrow-key, Home, and End navigation within the group.\n * Prevents default scrolling on arrow keys.\n *\n * Unified handler - delegates to virtual or contentChildren navigation\n * based on whether `virtualCount` is set.\n */\n protected handleKeyDown(event: KeyboardEvent): void {\n // Never hijack browser/app shortcuts: Ctrl/Cmd/Alt combos pass through\n // untouched (Ctrl+Home, Cmd+ArrowLeft and friends belong to the app).\n if (event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n if (!this.ownsKey(event)) {\n return;\n }\n\n const vc = this.virtualCount();\n const allItems = this.items();\n const isVirtual = vc != null;\n const total = isVirtual ? vc : allItems.length;\n\n if (total === 0) {\n return;\n }\n if (!isVirtual && this.enabledItems().length === 0) {\n return;\n }\n\n const currentActive = this.activeIndex();\n const navigate = (direction: 1 | -1): number | null =>\n isVirtual\n ? this.findNextVirtual(currentActive, total, direction)\n : this.findNext(currentActive, allItems, direction);\n\n const inlineNav = (key: string): number | null => {\n if (!this.isHorizontal()) {\n return null;\n }\n const step = resolveInlineStep(key, this.direction());\n return step === null ? null : navigate(step);\n };\n\n const keyMap: Record<string, () => number | null> = {\n ArrowRight: () => inlineNav('ArrowRight'),\n ArrowLeft: () => inlineNav('ArrowLeft'),\n ArrowDown: () => (this.isVertical() ? navigate(1) : null),\n ArrowUp: () => (this.isVertical() ? navigate(-1) : null),\n Home: () => (isVirtual ? 0 : this.findFirst(allItems)),\n End: () => (isVirtual ? total - 1 : this.findLast(allItems)),\n };\n\n const handler = keyMap[event.key];\n if (!handler) {\n return;\n }\n\n const nextIndex = handler();\n if (nextIndex !== null && nextIndex !== currentActive) {\n event.preventDefault();\n this.activeIndex.set(nextIndex);\n // Expose the navigation intent before focus moves, so the newly-focused\n // leaf's (focus) handler reads an already-set fact instead of racing the\n // group's own late (keydown) binding (#135).\n this.navigationKeyInFlight = true;\n if (isVirtual) {\n this.focusVirtualItem(nextIndex);\n } else {\n allItems[nextIndex].focus();\n }\n } else if (nextIndex === currentActive) {\n event.preventDefault();\n }\n }\n\n /**\n * Whether the group may take the key: not one a nested widget already\n * handled, not part of an IME composition, not from a text field (an\n * `<input>` item or one inside an item keeps its caret keys) and not from\n * inside a nested widget that owns its arrows.\n */\n private ownsKey(event: KeyboardEvent): boolean {\n if (event.defaultPrevented || isComposingKeydown(event)) {\n return false;\n }\n const target = event.target as Element | null;\n if (isTextEntryTarget(target)) {\n return false;\n }\n const host = this.hostEl.nativeElement as HTMLElement;\n const widget = target?.closest(ARROW_KEY_WIDGETS) ?? null;\n return widget === null || widget === host || !host.contains(widget);\n }\n\n /**\n * Keeps `activeIndex` in sync with real focus (APG): when an item gains\n * focus by any means - pointer click, script focus, assistive tech - the\n * tab stop follows it instead of staying on the last arrow-key target.\n */\n protected handleFocusIn(event: FocusEvent): void {\n const target = event.target as HTMLElement | null;\n if (target === null) {\n return;\n }\n const vc = this.virtualCount();\n if (vc != null) {\n const holder = target.closest('[data-cngx-recycle-index]');\n const idx = holder === null ? NaN : Number(holder.getAttribute('data-cngx-recycle-index'));\n if (Number.isInteger(idx) && idx >= 0 && idx < vc && idx !== this.activeIndex()) {\n this.activeIndex.set(idx);\n }\n return;\n }\n const items = this.items();\n const idx = items.findIndex((item) => {\n const el = item.elementRef.nativeElement as HTMLElement;\n return el === target || el.contains(target);\n });\n if (idx >= 0 && !items[idx].disabled() && idx !== this.activeIndex()) {\n this.activeIndex.set(idx);\n }\n }\n\n /**\n * Attempts to focus a virtual item by querying `data-cngx-recycle-index`.\n * If the element is not in the DOM, sets `pendingFocus` for external resolution.\n */\n private focusVirtualItem(index: number): void {\n const el = (this.hostEl.nativeElement as HTMLElement).querySelector(\n `[data-cngx-recycle-index=\"${index}\"]`,\n );\n if (el instanceof HTMLElement) {\n el.focus();\n this.pendingFocusState.set(null);\n } else {\n this.pendingFocusState.set(index);\n }\n }\n\n /**\n * Finds the next index in virtual mode. No disabled-item skipping - can't check\n * disabled state of items not in the DOM (the resolver treats every index as\n * enabled when no `isDisabledAt` is supplied).\n */\n private findNextVirtual(current: number, total: number, direction: 1 | -1): number | null {\n return resolveStepFrom(current, direction, { count: total, loop: this.loop() });\n }\n\n private enabledItems(): readonly CngxRovingItem[] {\n return this.items().filter((item) => !item.disabled());\n }\n\n private isHorizontal(): boolean {\n const o = this.orientation();\n return o === 'horizontal' || o === 'both';\n }\n\n private isVertical(): boolean {\n const o = this.orientation();\n return o === 'vertical' || o === 'both';\n }\n\n /**\n * Searches for the next enabled item starting from `current + direction`.\n * Respects `loop` - wraps around or stops at the boundary.\n * Skips disabled items.\n */\n private findNext(\n current: number,\n items: readonly CngxRovingItem[],\n direction: 1 | -1,\n ): number | null {\n return resolveStepFrom(current, direction, {\n count: items.length,\n loop: this.loop(),\n isDisabledAt: (i) => items[i].disabled(),\n });\n }\n\n private findFirst(items: readonly CngxRovingItem[]): number | null {\n return resolveBoundaryStep(1, {\n count: items.length,\n isDisabledAt: (i) => items[i].disabled(),\n });\n }\n\n private findLast(items: readonly CngxRovingItem[]): number | null {\n return resolveBoundaryStep(-1, {\n count: items.length,\n isDisabledAt: (i) => items[i].disabled(),\n });\n }\n}\n\n/**\n * @internal The rendered item that holds the tab stop in virtual mode: the\n * one at the active index, or, while that index is outside the rendered\n * window, the rendered item nearest to it, so the group never drops out of\n * the Tab order. Focusing it moves the active index there (`focusin`).\n */\nfunction virtualTabStop(\n items: readonly CngxRovingItem[],\n active: number,\n): CngxRovingItem | null {\n let nearest: CngxRovingItem | null = null;\n let distance = Infinity;\n for (const item of items) {\n const raw = (item.elementRef.nativeElement as HTMLElement).dataset['cngxRecycleIndex'];\n if (raw == null) {\n continue;\n }\n const gap = Math.abs(Number(raw) - active);\n if (gap < distance) {\n nearest = item;\n distance = gap;\n }\n }\n return nearest;\n}\n","import { InjectionToken, type Signal } from '@angular/core';\n\n/**\n * Descriptor of an item managed by `CngxActiveDescendant`.\n *\n * `id` must be unique and stable across change detection runs (use `nextUid()`\n * from `@cngx/core/utils`). `label` is used by typeahead matching.\n */\nexport interface ActiveDescendantItem {\n /** Unique DOM `id` on the element - required for `aria-activedescendant`. */\n readonly id: string;\n /** Opaque value emitted on `activated`. Compared with `Object.is` by default. */\n readonly value: unknown;\n /** Human-readable text used by typeahead. Falls back to empty string. */\n readonly label: string;\n /** Disabled items are skipped during navigation when `skipDisabled` is true. */\n readonly disabled?: boolean;\n}\n\n/**\n * DI token for content-projected items that should register with the\n * surrounding `CngxActiveDescendant`.\n *\n * Consumers like `CngxOption` and `CngxMenuItem` expose themselves via:\n *\n * ```typescript\n * providers: [{ provide: CNGX_AD_ITEM, useExisting: MyItem }]\n * ```\n *\n * The contained directive must expose `id`, `value`, `label`, and optionally\n * `disabled` as signals - the AD reads them reactively.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/active-descendant/ad-item.token.ts\n * @since 0.3.0\n */\nexport const CNGX_AD_ITEM = new InjectionToken<CngxAdItemHandle>('CNGX_AD_ITEM');\n\n/**\n * Minimum shape an AD-registered directive must expose.\n *\n * The shape is signal-based so the AD recomputes when any field changes.\n */\nexport interface CngxAdItemHandle {\n readonly id: string;\n readonly value: Signal<unknown>;\n /**\n * Label accessor. Typically a signal, but may be a plain getter when the\n * label derives from runtime DOM state (e.g. `textContent` fallback).\n */\n readonly label: Signal<string> | (() => string);\n readonly disabled?: Signal<boolean>;\n}\n","import {\n afterNextRender,\n computed,\n contentChildren,\n DestroyRef,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n linkedSignal,\n output,\n signal,\n} from '@angular/core';\nimport {\n injectDirection,\n resolveBoundaryStep,\n resolveInlineStep,\n resolveStepFrom,\n} from '@cngx/core';\nimport {\n CNGX_NESTED_INTERACTIVE_SELECTOR,\n createTypeaheadWalker,\n injectLocale,\n isComposingKeydown,\n isTextEntryTarget,\n} from '@cngx/core/utils';\n\nimport { CNGX_AD_ITEM, type ActiveDescendantItem, type CngxAdItemHandle } from './ad-item.token';\n\n/**\n * WAI-ARIA active-descendant pattern. Focus stays on the host; the active\n * option is reported via `aria-activedescendant`.\n *\n * ### When to use this vs. `CngxRovingTabindex`\n *\n * - **Active-descendant** when focus stays on one container (listbox, menu,\n * combobox input) and items must not be tab-stops. Screen readers announce\n * the referenced option while the focus ring stays on the host.\n * - **Roving tabindex** when items themselves are tab-stops (toolbar, tab\n * list, grid cells). See `CngxRovingTabindex`.\n *\n * ### Item registration\n *\n * Items register either by providing `CNGX_AD_ITEM` via `hostDirectives` /\n * `providers`, or by passing a `Signal<ActiveDescendantItem[]>` through the\n * `items` input. The `items` input wins when both are present; use it when\n * items come from a dynamic data source.\n *\n * ### Virtualization\n *\n * When `virtualCount` is set, navigation addresses the absolute index space\n * `[0, virtualCount)` even when only a window is rendered. Bind `windowStart`\n * to the recycler's window start so item lookups (id resolution, disabled\n * checks, typeahead labels) map absolute indices onto the rendered subset.\n * Targets outside the window surface as `pendingHighlight`; the consumer\n * scrolls them into view (`connectRecyclerToActiveDescendant`) and the\n * directive clears the pending state once the target renders; no\n * `clearPendingHighlight()` call is needed.\n *\n * ### Material/CDK equivalent\n *\n * Same model as `cdk-listbox` and `mat-select`, without the visual shell and\n * driven by signals instead of `ListKeyManager`.\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/active-descendant/active-descendant.directive.ts\n * @since 0.3.0\n * @relatedTo CngxRovingTabindex, CngxListbox, CngxMenu\n * <example-url>/#/common/a11y/active-descendant/listbox-with-items-input</example-url>\n * <example-url>/#/common/a11y/active-descendant/typeahead</example-url>\n * <example-url>/#/common/a11y/active-descendant/horizontal-option-row</example-url>\n * @axis level atom\n */\n@Directive({\n selector: '[cngxActiveDescendant]',\n exportAs: 'cngxActiveDescendant',\n standalone: true,\n host: {\n '[attr.aria-activedescendant]': 'activeId()',\n '(keydown)': 'handleKeydown($event)',\n },\n})\nexport class CngxActiveDescendant {\n /**\n * Optional explicit item list. When provided, takes precedence over items\n * registered via `CNGX_AD_ITEM`. Useful for combobox-style consumers that\n * drive the menu from a dynamic data source - pass the unwrapped array\n * (typically the result of a `computed()`), Angular's signal inputs make it\n * reactive automatically.\n */\n readonly items = input<ActiveDescendantItem[] | undefined>(undefined);\n\n /** Arrow-key navigation axis. Defaults to `'vertical'` (listbox/menu style). */\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n /** Whether navigation wraps from last to first and vice versa. */\n readonly loop = input<boolean>(true);\n /** Whether alphanumeric typeahead navigation is enabled. */\n readonly typeahead = input<boolean>(true);\n /** Buffer reset window for typeahead, in milliseconds. */\n readonly typeaheadDebounce = input<number>(300);\n /** Whether the first non-disabled item is highlighted automatically. */\n readonly autoHighlightFirst = input<boolean>(false);\n /** Whether disabled items are skipped during navigation and value lookup. */\n readonly skipDisabled = input<boolean>(true);\n /**\n * When set, navigation treats the range `[0, virtualCount)` as the item\n * space even if only a subset is rendered. Targets outside the rendered\n * range surface as `pendingHighlight` for scroll-and-retry protocols.\n */\n readonly virtualCount = input<number | undefined>(undefined);\n /**\n * Absolute index of the first rendered item in virtual mode - the recycler\n * window start. All rendered-item lookups are offset by it so absolute\n * indices resolve the right item once the window has scrolled past 0.\n * Ignored when `virtualCount` is unset.\n */\n readonly windowStart = input<number>(0);\n /**\n * The full list in absolute index space, for a windowed list whose rendered\n * rows are only part of it. When bound, typeahead searches this list and a\n * match anywhere in it becomes the highlight; `typeaheadMissed` then means no\n * match in the whole list. Unbound, the rendered window stays the search\n * space. Items are read for `label` and `disabled` only, so `id` may be empty.\n */\n readonly typeaheadItems = input<readonly ActiveDescendantItem[] | undefined>(undefined);\n /**\n * Equality used to find the previously active value again after the item\n * list changes. Defaults to `Object.is`; pass the same comparator as the\n * surrounding listbox / select when options are re-fetched as new objects\n * with equal identity, or the highlight drops on every refresh. The\n * parameters are typed `never` so a comparator over any value type binds\n * while the directive itself stays non-generic.\n */\n readonly compareWith = input<(a: never, b: never) => boolean>(Object.is);\n\n /** Emitted when `activateCurrent()` is called with an active item. */\n readonly activated = output<unknown>();\n /** Emitted whenever the highlighted item changes. */\n readonly highlighted = output<ActiveDescendantItem | null>();\n /**\n * Emitted when a typeahead query finds no match in the rendered window.\n * Carries the resolved query term (lowercased; a repeated single letter\n * collapses to that letter per the APG cycle rule). The rendered window\n * is AD's whole search space - hosts whose real item space is larger\n * (collapsed tree branches, virtualized rows outside the window) listen\n * here to resolve the miss themselves.\n */\n readonly typeaheadMissed = output<string>();\n\n private readonly hostEl = inject(ElementRef<HTMLElement>);\n private readonly locale = injectLocale();\n private readonly registered = contentChildren(CNGX_AD_ITEM, { descendants: true });\n\n /** Document writing direction - flips the horizontal-arrow steps under `rtl` (APG). */\n private readonly direction = injectDirection();\n\n /** Holds `autoHighlightFirst` back until after first render. */\n private readonly initialized = signal(false);\n\n /**\n * A highlight gesture that fired while the option rows were not in the DOM\n * (a deferred-render panel just opened, OD5): the id space does not exist\n * yet, so the gesture is kept as INTENT - not a resolved index, which an\n * empty item space resolves to nothing. It is a source of\n * `activeIndexState` and resolves there once the rows render. Written only\n * by the imperative highlight methods; every index write clears it.\n * Non-virtual path only; the virtual path uses `pendingHighlight`.\n */\n private readonly pendingIntentState = signal<PendingIntent | null>(null);\n\n /**\n * Resolved item list. Input `items` wins; otherwise the contentChildren\n * handles are projected into `ActiveDescendantItem` shape.\n */\n readonly resolvedItems = computed<ActiveDescendantItem[]>(() => {\n const explicit = this.items();\n if (explicit) {\n return explicit;\n }\n return this.registered().map(handleToItem);\n });\n\n /**\n * -1 means \"no active item\". Range is `[0, totalCount())`.\n *\n * Navigation writes the index; a change of the item space re-derives it.\n * In a plain list the highlight follows its value: after the item list\n * changes, the previously active value is looked up again with `compareWith`,\n * and gone means no highlight. In a virtual window it holds its absolute\n * index, because the rendered rows trail `windowStart` and cannot say where a\n * value sits; a window turning plain drops it. The result is clamped to the\n * new item space, so the next arrow press never starts from a ghost index.\n *\n * A pending open gesture (`pendingIntentState`) resolves here against every\n * populated item space until an index write clears it, so rows that arrive\n * in several passes settle on the gesture's target.\n */\n private readonly activeIndexState = linkedSignal<ActiveIndexSource, number>({\n source: () => ({\n items: this.resolvedItems(),\n total: this.totalCount(),\n virtual: this.virtualCount() != null,\n offset: this.windowOffset(),\n compareWith: this.compareWith() as (a: unknown, b: unknown) => boolean,\n skipDisabled: this.skipDisabled(),\n intent: this.pendingIntentState(),\n }),\n computation: (source, previous) => {\n const { intent } = source;\n if (intent !== null && source.items.length > 0) {\n return resolveIntent({ ...source, intent });\n }\n if (!previous) {\n return -1;\n }\n const index = clampIndex(\n reResolveIndex(source, previous.source, previous.value),\n source.total,\n );\n // An item that turned disabled cannot hold a highlight navigation skips.\n const disabled = source.skipDisabled && !!source.items[index - source.offset]?.disabled;\n return disabled ? -1 : index;\n },\n });\n\n /** Current active index. `-1` when no item is highlighted. */\n readonly activeIndex = computed<number>(() => {\n const idx = this.activeIndexState();\n const total = this.totalCount();\n if (idx < 0 || idx >= total) {\n return -1;\n }\n return idx;\n });\n\n /**\n * The highlight plus whether its row is rendered. Structural equal: a window\n * move that leaves both unchanged notifies nobody.\n */\n private readonly highlightPlacement = computed<HighlightPlacement>(\n () => {\n const index = this.activeIndex();\n return {\n index,\n rendered: index >= 0 && this.isRendered(index),\n virtual: this.virtualCount() != null,\n };\n },\n {\n equal: (a, b) => a.index === b.index && a.rendered === b.rendered && a.virtual === b.virtual,\n },\n );\n\n /**\n * Index the highlight moved to while its row is not rendered. Armed by the\n * highlight change alone and cleared when the row renders; the same highlight\n * leaving the window later stays cleared, so scrolling a virtual list away\n * never asks to be scrolled back.\n */\n private readonly pendingHighlightState = linkedSignal<HighlightPlacement, number | null>({\n source: this.highlightPlacement,\n computation: (placement, previous) => {\n if (!placement.virtual || placement.index < 0 || placement.rendered) {\n return null;\n }\n return previous?.source.index === placement.index ? previous.value : placement.index;\n },\n });\n /** Index of an item that should be highlighted but is not in the DOM. */\n readonly pendingHighlight = this.pendingHighlightState.asReadonly();\n\n /**\n * `activeIndex` always mapped back to an item. `null` when no active index\n * or the item is out of rendered range (virtual mode).\n */\n readonly activeItem = computed<ActiveDescendantItem | null>(() => {\n const idx = this.activeIndex();\n if (idx < 0) {\n return null;\n }\n return this.itemAt(idx);\n });\n\n /**\n * `activeItem` pinned to the item id for the `highlighted` emission: a\n * re-render that produces a fresh object for the same item must not\n * re-emit. `activeItem` itself stays identity-equal so `activeValue`\n * tracks value changes on an unchanged id.\n */\n private readonly highlightedItem = computed<ActiveDescendantItem | null>(\n () => this.activeItem(),\n { equal: (a, b) => a === b || (a !== null && b !== null && a.id === b.id) },\n );\n\n readonly activeId = computed<string | null>(() => this.activeItem()?.id ?? null);\n readonly activeValue = computed<unknown>(() => this.activeItem()?.value ?? null);\n\n private readonly typeaheadWalker = createTypeaheadWalker({\n debounceMs: this.typeaheadDebounce,\n locale: this.locale,\n });\n\n /**\n * `true` while a typeahead term is being typed (the buffer has not reset\n * yet). A space typed then belongs to the term (\"new y\" reaches \"New\n * York\") instead of activating the highlight. External keyboard hosts read\n * it to route Space through {@link typeaheadChar}.\n */\n readonly typeaheadActive = computed<boolean>(() => this.typeaheadWalker.buffer() !== '');\n\n constructor() {\n afterNextRender(() => this.initialized.set(true));\n\n effect(() => {\n if (!this.initialized()) {\n return;\n }\n if (this.autoHighlightFirst() && this.activeIndexState() === -1) {\n this.highlightFirst();\n }\n });\n\n // Leading nulls are start-up state, not a highlight change - emit only\n // once something was highlighted (later resets back to null still emit).\n let hadHighlight = false;\n effect(() => {\n const item = this.highlightedItem();\n if (!hadHighlight && item === null) {\n return;\n }\n hadHighlight = true;\n this.highlighted.emit(item);\n });\n\n // One DOM scroll per highlight change, delayed until the row renders. A\n // window move alone never scrolls: the row of an unchanged highlight\n // re-entering the window must not pull the list back to it.\n let lastIndex = -1;\n let scrollDue = false;\n effect(() => {\n const { index, rendered } = this.highlightPlacement();\n if (index !== lastIndex) {\n lastIndex = index;\n scrollDue = index >= 0;\n }\n if (!scrollDue || !rendered) {\n return;\n }\n scrollDue = false;\n queueMicrotask(() => this.scrollActiveIntoView());\n });\n\n inject(DestroyRef).onDestroy(() => this.typeaheadWalker.clear());\n }\n\n /**\n * Non-virtual path with no rendered rows yet (a deferred-render panel just\n * opened, OD5): the option id space does not exist, so a highlight resolves\n * against nothing and is lost. Remember the gesture as intent -\n * `activeIndexState` resolves it once the rows render - and report that it\n * was deferred. The virtual path never defers here; its out-of-window\n * targets surface through `pendingHighlight` instead.\n */\n private deferIfUnrendered(intent: PendingIntent): boolean {\n if (this.virtualCount() == null && this.resolvedItems().length === 0) {\n this.pendingIntentState.set(intent);\n return true;\n }\n return false;\n }\n\n /** Index write of a navigation step; a resolved intent never re-applies after it. */\n private writeIndex(index: number): void {\n this.pendingIntentState.set(null);\n this.activeIndexState.set(index);\n }\n\n /**\n * Moves the highlight to the next item after the active one. Disabled items\n * are skipped while `skipDisabled` is true; past the last item it wraps to the\n * first when `loop` is true and stays put otherwise. With no rows it does\n * nothing: a step inside an empty list is not an open gesture to keep.\n */\n highlightNext(): void {\n const next = this.findFrom(this.activeIndexState(), 1);\n if (next !== null) {\n this.writeIndex(next);\n }\n }\n\n /**\n * Moves the highlight to the item before the active one. Disabled items are\n * skipped while `skipDisabled` is true; before the first item it wraps to the\n * last when `loop` is true and stays put otherwise. With no rows it does\n * nothing.\n */\n highlightPrev(): void {\n const next = this.findFrom(this.activeIndexState(), -1);\n if (next !== null) {\n this.writeIndex(next);\n }\n }\n\n /**\n * Moves the highlight to the first enabled item (the first item when\n * `skipDisabled` is false). Does nothing when no item qualifies.\n */\n highlightFirst(): void {\n if (this.deferIfUnrendered({ kind: 'first' })) {\n return;\n }\n const first = this.findBoundary(1);\n if (first !== null) {\n this.writeIndex(first);\n }\n }\n\n /**\n * Moves the highlight to the last enabled item (the last item when\n * `skipDisabled` is false). With a virtual count it targets the last absolute\n * index even when that item is not rendered yet. Does nothing when no item\n * qualifies.\n */\n highlightLast(): void {\n if (this.deferIfUnrendered({ kind: 'last' })) {\n return;\n }\n const last = this.findBoundary(-1);\n if (last !== null) {\n this.writeIndex(last);\n }\n }\n\n /**\n * Highlight by zero-based index. Out-of-range indices are ignored.\n * Disabled items are rejected when `skipDisabled()` is true.\n */\n highlightByIndex(index: number): void {\n if (this.deferIfUnrendered({ kind: 'byIndex', index })) {\n return;\n }\n const total = this.totalCount();\n if (index < 0 || index >= total) {\n return;\n }\n if (this.skipDisabled() && this.isDisabledAt(index)) {\n return;\n }\n this.writeIndex(index);\n }\n\n /**\n * Highlight the first rendered item whose value matches (via `compareWith`).\n * No-op if no match. Disabled items are rejected when `skipDisabled()` is\n * true. In virtual mode only the rendered window is searched; the resolved\n * index is absolute.\n */\n highlightByValue(value: unknown): void {\n if (this.deferIfUnrendered({ kind: 'byValue', value })) {\n return;\n }\n const items = this.resolvedItems();\n const compare = this.compareWith() as (a: unknown, b: unknown) => boolean;\n const idx = items.findIndex((it) => compare(it.value, value));\n if (idx < 0) {\n return;\n }\n if (this.skipDisabled() && items[idx].disabled) {\n return;\n }\n this.writeIndex(idx + this.windowOffset());\n }\n\n /** Clear the highlight, including a gesture still pending a deferred render. */\n resetHighlight(): void {\n this.pendingIntentState.set(null);\n this.activeIndexState.set(-1);\n }\n\n /** Emit `activated` with the current item's value. No-op if nothing active. */\n activateCurrent(): void {\n const item = this.activeItem();\n if (item) {\n this.activated.emit(item.value);\n }\n }\n\n /**\n * Drops `pendingHighlight` without waiting for the row to render. Optional:\n * the directive clears it on its own once the target row renders, and\n * `connectRecyclerToActiveDescendant` never calls this.\n */\n clearPendingHighlight(): void {\n this.pendingHighlightState.set(null);\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n // Never hijack browser/app shortcuts: Ctrl/Cmd/Alt combos pass through\n // untouched (Ctrl+C would otherwise hit the typeahead branch and get\n // preventDefault'd). Shift stays allowed - it produces printable chars.\n // A key a nested widget already handled, and every key of an IME\n // composition (the commit Enter included), is not ours either.\n if (event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n if (event.defaultPrevented || isComposingKeydown(event)) {\n return;\n }\n\n // Skip events from editable descendants. Without this, every\n // printable key typed into a descendant <input> hits AD's typeahead\n // branch, gets preventDefault'd, and never reaches the input.\n const target = event.target as Element | null;\n if (target !== event.currentTarget && isTextEntryTarget(target)) {\n return;\n }\n\n // A text host (combobox input, textarea) keeps the caret keys and the\n // characters it types: only the arrows and Enter drive the list.\n const textHost = isTextEntryTarget(this.hostEl.nativeElement as HTMLElement);\n const key = event.key;\n\n if (this.isNavKey(key)) {\n if (textHost && (key === 'Home' || key === 'End')) {\n return;\n }\n const before = this.activeIndexState();\n const intentBefore = this.pendingIntentState();\n this.dispatchNav(key);\n const moved = this.activeIndexState() !== before;\n const deferred = this.pendingIntentState() !== intentBefore;\n if (moved || deferred) {\n event.preventDefault();\n }\n return;\n }\n\n if (textHost && (key === ' ' || isPrintableChar(key))) {\n return;\n }\n\n if (key === ' ' && this.typeahead() && this.typeaheadActive()) {\n event.preventDefault();\n this.handleTypeahead(key);\n return;\n }\n\n if (key === 'Enter' || key === ' ') {\n this.handleActivationKey(event, key);\n return;\n }\n\n if (this.typeahead() && isPrintableChar(key)) {\n event.preventDefault();\n this.handleTypeahead(key);\n }\n }\n\n /** @internal True when `el` renders one of the host's own items. */\n private isOwnItemElement(el: Element): boolean {\n const id = el.id;\n return id !== '' && this.resolvedItems().some((item) => item.id === id);\n }\n\n /** Descendants that own Enter / Space; `CNGX_NESTED_INTERACTIVE_SELECTOR`. */\n private readonly nestedInteractive = inject(CNGX_NESTED_INTERACTIVE_SELECTOR);\n\n private handleActivationKey(event: KeyboardEvent, key: string): void {\n const host = this.hostEl.nativeElement as HTMLElement;\n // A focused control inside the host (a Retry button in an error banner)\n // owns its Enter / Space: no preventDefault, so its native activation runs,\n // and the active item stays untouched. The host's own item elements\n // (a role=\"menuitem\" row that took focus from a click) are not such a\n // control: their keys still activate through the directive.\n const target = event.target as Element | null;\n const interactive = target?.closest(this.nestedInteractive);\n if (\n interactive &&\n interactive !== host &&\n host.contains(interactive) &&\n !this.isOwnItemElement(interactive)\n ) {\n return;\n }\n\n if (this.activeItem()) {\n event.preventDefault();\n this.activateCurrent();\n return;\n }\n\n // Nothing to activate: Space would scroll the page from a focused host.\n // A text host never gets here with Space (the keydown handler leaves it\n // to the field). Enter stays untouched so a consumer's own Enter handler\n // still runs.\n if (key === ' ') {\n event.preventDefault();\n }\n }\n\n private isNavKey(key: string): boolean {\n switch (key) {\n case 'ArrowDown':\n case 'ArrowUp':\n case 'ArrowLeft':\n case 'ArrowRight':\n case 'Home':\n case 'End':\n return true;\n default:\n return false;\n }\n }\n\n private dispatchNav(key: string): void {\n const orientation = this.orientation();\n switch (key) {\n case 'ArrowDown':\n if (orientation === 'vertical') {\n this.highlightNext();\n }\n return;\n case 'ArrowRight':\n case 'ArrowLeft': {\n if (orientation !== 'horizontal') {\n return;\n }\n // RTL flips the horizontal arrows (same kernel roving uses).\n const step = resolveInlineStep(key, this.direction());\n if (step === 1) {\n this.highlightNext();\n } else if (step === -1) {\n this.highlightPrev();\n }\n return;\n }\n case 'ArrowUp':\n if (orientation === 'vertical') {\n this.highlightPrev();\n }\n return;\n case 'Home':\n this.highlightFirst();\n return;\n case 'End':\n this.highlightLast();\n return;\n }\n }\n\n /**\n * Push a printable character into the typeahead buffer and jump to the next\n * matching option. Exposed for external keyboard hosts (e.g. a select\n * trigger) that keep focus on themselves while using active-descendant\n * semantics on a separate listbox.\n *\n * Consumers should only forward single-character printable keys (`length === 1`,\n * non-whitespace), plus a space while {@link typeaheadActive} is `true`.\n * Navigation keys and non-printables must not be forwarded.\n */\n typeaheadChar(ch: string): void {\n if (!this.typeahead()) {\n return;\n }\n this.handleTypeahead(ch);\n }\n\n private handleTypeahead(ch: string): void {\n const term = this.typeaheadWalker.type(ch);\n // Labels exist only for rendered items unless the host hands the full list\n // over, so the search space is the rendered window by default; matches map\n // back to absolute indices in virtual mode.\n const fullList = this.typeaheadItems();\n const items = fullList ?? this.resolvedItems();\n if (items.length === 0) {\n this.typeaheadMissed.emit(term);\n return;\n }\n const offset = fullList ? 0 : this.windowOffset();\n const activeRel = this.activeIndexState() < 0 ? -1 : this.activeIndexState() - offset;\n const rel = this.typeaheadWalker.find(items, term, activeRel, this.skipDisabled());\n if (rel < 0) {\n this.typeaheadMissed.emit(term);\n return;\n }\n this.writeIndex(rel + offset);\n }\n\n private findFrom(current: number, direction: 1 | -1): number | null {\n return resolveStepFrom(current, direction, {\n count: this.totalCount(),\n loop: this.loop(),\n isDisabledAt: this.skipDisabled() ? (i) => this.isDisabledAt(i) : undefined,\n });\n }\n\n /**\n * First/last navigable absolute index. Spans the full virtual range - End\n * targets `totalCount - 1` even when that item is not rendered (it surfaces\n * as `pendingHighlight`); unrendered items count as enabled because their\n * disabled state is unknowable (`isDisabledAt` resolves them to `false`).\n */\n private findBoundary(direction: 1 | -1): number | null {\n return resolveBoundaryStep(direction, {\n count: this.totalCount(),\n isDisabledAt: this.skipDisabled() ? (i) => this.isDisabledAt(i) : undefined,\n });\n }\n\n private totalCount(): number {\n const vc = this.virtualCount();\n if (vc != null) {\n return vc;\n }\n return this.resolvedItems().length;\n }\n\n /** Rendered-window offset: `windowStart` in virtual mode, `0` otherwise. */\n private windowOffset(): number {\n return this.virtualCount() != null ? this.windowStart() : 0;\n }\n\n /** Item at an absolute index, `null` when outside the rendered window. */\n private itemAt(index: number): ActiveDescendantItem | null {\n const rel = index - this.windowOffset();\n const items = this.resolvedItems();\n if (rel < 0 || rel >= items.length) {\n return null;\n }\n return items[rel] ?? null;\n }\n\n private isDisabledAt(index: number): boolean {\n return !!this.itemAt(index)?.disabled;\n }\n\n private isRendered(index: number): boolean {\n return this.itemAt(index) !== null;\n }\n\n private scrollActiveIntoView(): void {\n const id = this.activeId();\n if (!id) {\n return;\n }\n // Document-wide by escaped id: aria-owns layouts render the option list\n // outside the host subtree, a host-scoped query never finds those.\n const doc = (this.hostEl.nativeElement as HTMLElement).ownerDocument;\n const el = doc.querySelector(`#${cssEscape(id)}`);\n if (el instanceof HTMLElement && typeof el.scrollIntoView === 'function') {\n el.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }\n }\n}\n\n/**\n * @internal An open gesture remembered while the option rows are absent,\n * resolved once they render. Captured as the gesture, not a resolved index:\n * an empty item space resolves to nothing, so the index must be computed\n * against the populated space.\n */\ntype PendingIntent =\n | { readonly kind: 'first' }\n | { readonly kind: 'last' }\n | { readonly kind: 'byIndex'; readonly index: number }\n | { readonly kind: 'byValue'; readonly value: unknown };\n\n/** @internal Where the highlight sits relative to the rendered rows. */\ninterface HighlightPlacement {\n readonly index: number;\n readonly rendered: boolean;\n readonly virtual: boolean;\n}\n\n/** @internal Item space the active index is derived against. */\ninterface ActiveIndexSource {\n readonly items: readonly ActiveDescendantItem[];\n readonly total: number;\n readonly virtual: boolean;\n /** Absolute index of the first rendered item (`windowStart`, 0 when plain). */\n readonly offset: number;\n readonly compareWith: (a: unknown, b: unknown) => boolean;\n readonly skipDisabled: boolean;\n readonly intent: PendingIntent | null;\n}\n\n/** @internal Resolves an open gesture against a populated item space; -1 when nothing qualifies. */\nfunction resolveIntent(source: ActiveIndexSource & { readonly intent: PendingIntent }): number {\n const { items, offset, total, intent } = source;\n const isDisabledAt = source.skipDisabled\n ? (i: number): boolean => !!items[i - offset]?.disabled\n : undefined;\n switch (intent.kind) {\n case 'first':\n return resolveBoundaryStep(1, { count: total, isDisabledAt }) ?? -1;\n case 'last':\n return resolveBoundaryStep(-1, { count: total, isDisabledAt }) ?? -1;\n case 'byIndex': {\n const outside = intent.index < 0 || intent.index >= total;\n return outside || isDisabledAt?.(intent.index) ? -1 : intent.index;\n }\n case 'byValue': {\n const idx = items.findIndex((it) => source.compareWith(it.value, intent.value));\n return idx < 0 || (source.skipDisabled && items[idx].disabled) ? -1 : idx + offset;\n }\n }\n}\n\n/**\n * @internal\n * Re-derives the index for a new item space. A virtual window keeps its\n * absolute index while its total holds (a window move); a changed total is a\n * new list, so the index is dropped rather than left on another option. The\n * index also means nothing once the list turns plain. In a\n * plain list the previously active value is looked up again; unchanged items,\n * no previous highlight, or an index past the old items keep the index.\n */\nfunction reResolveIndex(\n source: ActiveIndexSource,\n previousSource: ActiveIndexSource,\n previousIndex: number,\n): number {\n if (source.virtual) {\n return source.total === previousSource.total ? previousIndex : -1;\n }\n if (previousSource.virtual) {\n return -1;\n }\n if (previousSource.items === source.items || previousIndex < 0) {\n return previousIndex;\n }\n const previous = previousSource.items[previousIndex];\n if (!previous) {\n return previousIndex;\n }\n return source.items.findIndex((it) => source.compareWith(it.value, previous.value));\n}\n\n/** @internal Pulls an index that ran past the item space back onto its last item. */\nfunction clampIndex(index: number, total: number): number {\n if (index < total) {\n return index;\n }\n return total > 0 ? total - 1 : -1;\n}\n\n/** @internal */\nfunction handleToItem(handle: CngxAdItemHandle): ActiveDescendantItem {\n return {\n id: handle.id,\n value: handle.value(),\n label: handle.label(),\n disabled: handle.disabled?.() ?? false,\n };\n}\n\n/** @internal */\nfunction isPrintableChar(key: string): boolean {\n return key.length === 1 && /\\S/.exec(key) !== null;\n}\n\n/** @internal */\nfunction cssEscape(id: string): string {\n const api = (globalThis as { CSS?: { escape?: (s: string) => string } }).CSS;\n if (api && typeof api.escape === 'function') {\n return api.escape(id);\n }\n return id.replace(/[^a-zA-Z0-9_-]/g, (m) => `\\\\${m}`);\n}\n","import { DOCUMENT } from '@angular/common';\nimport { DestroyRef, Directive, inject, type Signal } from '@angular/core';\nimport { createMediaQuerySignal } from '@cngx/core/utils';\n\n/**\n * Reflects the user's `prefers-reduced-motion` media query as a reactive signal.\n *\n * Adds the `cngx-reduced-motion` CSS class to the host when the user prefers\n * reduced motion. The `prefersReducedMotion()` signal updates live when the\n * OS preference changes - use it in TypeScript to skip animations, disable\n * auto-playing media, or choose between animated and instant transitions.\n *\n * Unlike a CSS-only `@media (prefers-reduced-motion: reduce)` approach, this\n * directive makes the preference available in component logic (e.g., to pick\n * a different animation strategy or suppress requestAnimationFrame loops).\n *\n * This is the OS preference only. An in-app pick through `provideMotion` /\n * `injectMotion` (`CNGX_MOTION`, `<html data-motion>`) is not seen here; to\n * decide on the motion the user actually gets, read `injectEffectiveMotion()`\n * from `@cngx/core` instead.\n *\n * ### Conditional animation\n * ```html\n * <div cngxReducedMotion #rm=\"cngxReducedMotion\"\n * [style.animation]=\"rm.prefersReducedMotion() ? 'none' : 'spin 2s linear infinite'\">\n * </div>\n * ```\n *\n * ### TypeScript logic\n * ```typescript\n * readonly rm = viewChild(CngxReducedMotion);\n * readonly duration = computed(() => this.rm()?.prefersReducedMotion() ? 0 : 300);\n * ```\n *\n * @wcag AA\n * @github https://github.com/cngxjs/cngx/blob/main/projects/common/a11y/motion/reduced-motion.directive.ts\n * @since 0.3.0\n * <example-url>/#/common/a11y/reduced-motion/animation-toggle</example-url>\n * <example-url>/#/common/a11y/reduced-motion/toast-notifications-motion-aware</example-url>\n * @axis level atom\n */\n@Directive({\n selector: '[cngxReducedMotion]',\n exportAs: 'cngxReducedMotion',\n standalone: true,\n host: { '[class.cngx-reduced-motion]': 'prefersReducedMotion()' },\n})\nexport class CngxReducedMotion {\n /** `true` when the user's OS is set to prefer reduced motion (ignores `CNGX_MOTION`). Updates reactively. */\n readonly prefersReducedMotion: Signal<boolean>;\n\n constructor() {\n this.prefersReducedMotion = createMediaQuerySignal(\n '(prefers-reduced-motion: reduce)',\n inject(DestroyRef),\n inject(DOCUMENT).defaultView,\n );\n }\n}\n","/**\n * @module `@cngx/common/a11y`\n */\nexport {\n CngxAriaExpanded,\n CNGX_ARIA_EXPANDED_DRIVER,\n type CngxAriaExpandedDriver,\n} from './aria/aria-expanded.directive';\nexport { CngxLiveRegion } from './aria/live-region.directive';\nexport { CngxLiveAnnouncer, type AriaLivePoliteness } from './aria/live-announcer';\nexport { injectScopedLiveRegion, type CngxScopedLiveRegion } from './aria/scoped-live-region';\nexport type { CngxPendingAnnouncement } from './aria/live-region-pair';\nexport { CngxAutofocus } from './focus/autofocus.directive';\nexport {\n CngxFocusRestore,\n CNGX_FOCUSABLE_SELECTOR,\n CNGX_FOCUS_RESTORE_DRIVER,\n type CngxFocusRestoreDriver,\n} from './focus/focus-restore.directive';\nexport {\n CngxFocusTrap,\n CNGX_FOCUS_TRAP_DRIVER,\n type CngxFocusTrapDriver,\n} from './focus/focus-trap.directive';\nexport { CngxFocusVisible } from './focus/focus-visible.directive';\nexport { CngxRovingTabindex, CngxRovingItem } from './roving/roving-tabindex.directive';\nexport { CngxActiveDescendant } from './active-descendant/active-descendant.directive';\nexport {\n CNGX_AD_ITEM,\n type ActiveDescendantItem,\n type CngxAdItemHandle,\n} from './active-descendant/ad-item.token';\nexport { CngxReducedMotion } from './motion/reduced-motion.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AA+BA;;;;;;;;;AASG;MACU,yBAAyB,GAAG,IAAI,cAAc,CACzD,wBAAwB;AAG1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCG;MAUU,gBAAgB,CAAA;;AAElB,IAAA,QAAQ,GAAG,KAAK,CAAmB,KAAK,EAAA,EAAA,IAAA,SAAA,GAAA,EAAA,SAAA,EAAA,UAAA,EAAA,8BAAA,EAAA,CAAA,EAC/C,KAAK,EAAE,kBAAkB;QACzB,SAAS,EAAE,gBAAgB,EAAA,CAC3B;;AAEO,IAAA,QAAQ,GAAG,KAAK,CAAqB,SAAS,+EAAC;AAEvC,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IACpC,cAAc,GAA8C,SAAS;IACrE,MAAM,GAAA;AACZ,QAAA,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE;AACrC,YAAA,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,yBAAyB,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC1F;QACA,OAAO,IAAI,CAAC,cAAc;IAC5B;;AAGmB,IAAA,YAAY,GAAG,QAAQ,CAAC,MAAK;AAC9C,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE;AAC5B,QAAA,OAAO,MAAM,GAAG,MAAM,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE;AACzD,IAAA,CAAC,mFAAC;uGAtBS,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAhB,gBAAgB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,EAAA,Q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