forty-cdk 0.45.0 → 0.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/forty-cdk-avatar.mjs +6 -7
- package/fesm2022/forty-cdk-avatar.mjs.map +1 -1
- package/fesm2022/forty-cdk-combobox.mjs +6 -7
- package/fesm2022/forty-cdk-combobox.mjs.map +1 -1
- package/fesm2022/forty-cdk-core-anchored.mjs +9 -7
- package/fesm2022/forty-cdk-core-anchored.mjs.map +1 -1
- package/fesm2022/forty-cdk-core.mjs +33 -9
- package/fesm2022/forty-cdk-core.mjs.map +1 -1
- package/fesm2022/forty-cdk-select.mjs +6 -7
- package/fesm2022/forty-cdk-select.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forty-cdk-core-anchored.d.ts +21 -4
- package/types/forty-cdk-core.d.ts +6 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forty-cdk-select.mjs","names":["FOR_SELECT_DEFAULTS"],"sources":["../../../projects/forty-cdk/select/src/select-context.ts","../../../projects/forty-cdk/select/src/select.ts","../../../projects/forty-cdk/select/src/select-virtualized-navigator.ts","../../../projects/forty-cdk/select/src/select-virtualized.ts","../../../projects/forty-cdk/select/src/select-anchor.ts","../../../projects/forty-cdk/select/src/select-trigger.ts","../../../projects/forty-cdk/select/src/select-value.ts","../../../projects/forty-cdk/select/src/select-content.ts","../../../projects/forty-cdk/select/src/select-option.ts","../../../projects/forty-cdk/select/src/select-indicator.ts","../../../projects/forty-cdk/select/src/select-group.ts","../../../projects/forty-cdk/select/src/select-group-label.ts","../../../projects/forty-cdk/select/src/select-separator.ts","../../../projects/forty-cdk/select/src/select-host-directive.ts"],"sourcesContent":["import { computed, inject, InjectionToken, type Signal } from '@angular/core';\n\nimport {\n assertRootContext,\n type CollectionHandle,\n orphanContextError,\n RootedRegistry,\n unresolvedRootError,\n type Unset,\n type VirtualizedResume,\n type WritingDirection,\n} from 'forty-cdk/core';\nimport {\n type FloatingAlign,\n type FloatingSide,\n type ListboxOverlayPieceContext,\n type RootedTriggerHandle,\n} from 'forty-cdk/core-anchored';\nimport type {\n SelectPositionEntry,\n SelectVirtualizedNavigator,\n} from './select-virtualized-navigator';\n\n/**\n * Why a select requested close. Mirrors the menu primitive vocabulary so\n * downstream code that switches on close reasons stays consistent.\n */\nexport type ForSelectCloseReason =\n 'escape' | 'pointerDownOutside' | 'focusOutside' | 'select' | 'tab' | 'programmatic';\n\n/**\n * Where focus lands when the listbox opens. `'selected'` snaps to the first\n * currently-selected enabled option (matches native `<select>`); falls back\n * to `'first'` if no selection is enabled.\n */\nexport type ForSelectInitialFocus = 'first' | 'last' | 'selected';\n\n/**\n * Handle every `[forSelectOption]` registers with the root. The collection\n * orders entries by DOM document order so groups, separators, and `@for`\n * loops don't perturb keyboard navigation.\n *\n * Generic over the option value type `T` (default `unknown` at the contract\n * level; `string` at the public root). The handle carries the raw value so\n * the root can match it against `value()` via `compareWith`.\n */\nexport interface ForSelectOptionHandle<T = unknown> extends CollectionHandle {\n /**\n * Narrowed from {@link CollectionHandle}'s `Node`: the root focuses the\n * option and scrolls it into view.\n */\n readonly host: HTMLElement;\n /** The option's value, or {@link Unset} before its binding is written. */\n readonly value: Signal<T | Unset>;\n /**\n * The option's resolved display label as a reactive `Signal<string>` — the\n * trimmed `textContent` of the host. The root folds it into a persisted\n * snapshot so `selectedLabels` and closed-state typeahead resolve labels\n * without peeking at `textContent` from inside a `computed`.\n */\n readonly label: Signal<string>;\n /** The option's typeahead override, `''` when typeahead falls back to the root's resolution. */\n readonly textValue: Signal<string>;\n readonly disabled: Signal<boolean>;\n /** Stable host `id` — the activedescendant target in the virtualized path. */\n readonly id: Signal<string>;\n /**\n * Zero-based absolute position in the full source data. Required in the\n * virtualized path (drives the position snapshot + `aria-posinset`); `null`\n * outside it.\n */\n readonly posInSet: Signal<number | null>;\n}\n\n/**\n * The consumer-facing slice of the select's overlay surface, reached through\n * {@link ForSelectContext.overlay}: the trigger / content ids the ARIA wiring\n * points at, the reason of the last close, and the open / close commands that\n * mutate `open()` through the root's guards.\n *\n * It is narrow. The full state machine behind it — the trigger /\n * anchor / content / option registries, the DOM-focus navigation algorithm, the\n * initial-focus state, and the dismiss / auto-focus emit forwarders — is the\n * library's own wiring and is refactored without notice, so it stays on an\n * unexported surface the pieces reach through their own token.\n */\nexport interface ForSelectOverlayFacade {\n /** The active trigger's id, or `''` while no trigger is registered. */\n readonly triggerId: Signal<string>;\n /** The content surface's stable id, adopted from a consumer-set static id when present. */\n readonly contentId: Signal<string>;\n /** Reason of the most recent close, or `null` while open (or before any close). */\n readonly lastCloseReason: Signal<ForSelectCloseReason | null>;\n /**\n * Registers the element `[forSelectContent]` is positioned against, instead of\n * the trigger. The declarative `[forSelectAnchor]` covers the common case; call\n * this directly when the anchor element is only reachable imperatively — it\n * lives in an ancestor component's template, so a directive placed on it would\n * resolve DI outside this root. One anchor per `[forSelect]`: a second one\n * warns in dev mode, and the most recently registered one is used.\n */\n registerAnchor(el: HTMLElement): void;\n /** Unregisters the positioning anchor, falling back to the trigger. Reference-based. */\n unregisterAnchor(el: HTMLElement): void;\n /** Opens the listbox with the requested initial-focus target. */\n openOverlay(initialFocus: ForSelectInitialFocus): void;\n /** Closes the listbox, recording `reason` as the last close reason. */\n closeOverlay(reason: ForSelectCloseReason): void;\n /** Opens the listbox when closed (with `initialFocus`), closes it when open. */\n toggle(initialFocus: ForSelectInitialFocus): void;\n}\n\n/**\n * The shared overlay-listbox coordination surface backing\n * {@link ForSelectOverlayFacade}: trigger / anchor / content registries + ids,\n * DOM-focus navigation and open-state typeahead, the open / close machine, the initial-focus /\n * close-reason state, and the dismiss / auto-focus emit forwarders. Backed by\n * the shared `ListboxOverlayController`, so child directives read it here\n * instead of the root re-forwarding each member.\n *\n * Internal — never re-exported from `public-api.ts`; pieces reach it through\n * {@link SelectContext}.\n */\nexport type ForSelectOverlayContext<T = unknown> = ListboxOverlayPieceContext<\n ForSelectOptionHandle<T>,\n ForSelectInitialFocus,\n ForSelectCloseReason\n>;\n\n/**\n * Coordination contract owned by `[forSelect]` — the surface a consumer reads\n * and drives. Advanced consumers inject the token to read the selection and the\n * open state and to move them through the root's guards (`activate` /\n * `selectAll`, plus the open / close commands on {@link ForSelectContext.overlay}).\n * The wiring the library's own pieces read off the root is not\n * part of it.\n *\n * Generic over the option value type `T` (default `string` at the public\n * root). When a consumer binds object items the directive infers `T` from\n * `[(value)]` and the per-piece signatures specialize accordingly. Items are\n * compared via the consumer-provided `compareWith` and serialized for\n * the form's hidden inputs via `itemToFormValue`; option text labels are\n * still read from the rendered `textContent`.\n */\nexport interface ForSelectContext<T = unknown> {\n /**\n * The current selection, as a read-only signal. Mutate it through the guarded\n * methods (`activate` / `selectAll`) or the root's `[(value)]` binding — a\n * direct write would bypass the root's disabled / readonly guards and\n * `markTouched`.\n */\n readonly value: Signal<readonly T[]>;\n /**\n * Whether the listbox is open, as a read-only signal. Mutate it through\n * `overlay.toggle` / `overlay.openOverlay` / `overlay.closeOverlay` or the root's\n * `[(open)]` binding.\n */\n readonly open: Signal<boolean>;\n readonly multiple: Signal<boolean>;\n\n /**\n * The select's effective disabled — its own `disabled` input OR'd with a\n * surrounding disabled `[forFieldset]`. Trigger and options read this so a\n * disabled select (or fieldset) is inert: the trigger reflects the native\n * `disabled` attribute (its single channel) and the options, which\n * must stay focusable, reflect `aria-disabled`.\n */\n readonly effectiveDisabled: Signal<boolean>;\n readonly readonly: Signal<boolean>;\n readonly required: Signal<boolean>;\n readonly invalid: Signal<boolean>;\n readonly pending: Signal<boolean>;\n\n readonly dir: Signal<WritingDirection>;\n readonly placeholder: Signal<string>;\n\n /**\n * The consumer-facing slice of the overlay surface: the trigger / content ids,\n * the last close reason, and the open / close commands. The registration and\n * navigation machinery behind it is internal — see\n * {@link ForSelectOverlayFacade}.\n */\n readonly overlay: ForSelectOverlayFacade;\n\n /** Resolved labels of the options whose value is in `value()`, in selection order. */\n readonly selectedLabels: Signal<readonly string[]>;\n\n isSelected(value: T): boolean;\n /** Toggle in multi-mode, replace + close in single-mode. No-op on disabled / readonly. */\n activate(value: T | Unset): void;\n\n /**\n * Multi-select only (APG range keyboard, Ctrl/Cmd+A). Add every enabled\n * rendered option to the selection, or remove them when they are all already\n * selected (toggle). Selected values that are not an enabled rendered option\n * are kept. In the virtualized path that is the rendered window only, not the\n * whole source. No-op in single mode, disabled, or readonly.\n */\n selectAll(): void;\n\n /** Flip the `touched` model. Called by trigger on blur-to-outside and on dismiss events. */\n markTouched(): void;\n}\n\n/**\n * The select's piece-coordination surface: everything the library's own pieces\n * read off the root that a consumer has no call to touch — the positioning\n * mirrors `[forSelectContent]` feeds to floating-ui, the APG range-selection and\n * typeahead handlers `[forSelectOption]` routes its keys through, and the\n * virtualized activedescendant model.\n *\n * **Not** part of {@link ForSelectContext} and never exported from\n * `public-api.ts`: these are the members a refactor of the anatomy moves, so\n * freezing them at 1.0 would freeze the anatomy with them.\n */\nexport interface SelectPieceContext<T = unknown> {\n /**\n * When `true`, the listbox is a trapped / inert / scroll-locked modal\n * surface (routed through the core modal shell) instead of the anchored\n * popover. Read once when `[forSelectContent]` mounts; all anchored-\n * positioning state below is a no-op while modal.\n */\n readonly modal: Signal<boolean>;\n /**\n * Whether the mounted `[forSelectContent]` runs the modal shell: the mode it latched at mount,\n * or {@link SelectPieceContext.modal} while no content is mounted. The Tab handlers branch on\n * this, because a `[modal]` rebind reaches only the next mount.\n */\n readonly mountedModal: Signal<boolean>;\n /** Called by `[forSelectContent]` with the mode its shell runs in. */\n registerContentModal(modal: Signal<boolean>): void;\n /** Called by `[forSelectContent]` on destroy; a no-op unless `modal` is the registered one. */\n unregisterContentModal(modal: Signal<boolean>): void;\n /**\n * Called by `[forSelectVirtualized]` from its constructor. Hands the root the\n * virtualized focus model and returns the root state that model reads and\n * writes.\n */\n registerVirtualization(virtualization: SelectVirtualization): SelectVirtualizationHost;\n readonly dismissible: Signal<boolean>;\n readonly returnFocus: Signal<boolean>;\n /**\n * Positioning algorithm. `'popper'` (default) is standard floating-ui\n * anchored placement; `'item-aligned'` overlays the listbox so the\n * selected option's center aligns with the trigger's center (macOS-style\n * native `<select>`). All `side`/`align`/`*Offset`/`sticky`/\n * `hideWhenDetached`/`clipUntilPositioned`/`avoidCollisions` inputs are no-ops in\n * `'item-aligned'` mode (only `collisionPadding` is honored).\n */\n readonly position: Signal<'popper' | 'item-aligned'>;\n readonly side: Signal<FloatingSide | undefined>;\n readonly align: Signal<FloatingAlign | undefined>;\n readonly sideOffset: Signal<number>;\n readonly alignOffset: Signal<number>;\n readonly avoidCollisions: Signal<boolean>;\n readonly collisionPadding: Signal<number>;\n readonly sticky: Signal<'partial' | 'always' | false>;\n readonly hideWhenDetached: Signal<boolean>;\n readonly clipUntilPositioned: Signal<boolean>;\n readonly loop: Signal<boolean>;\n readonly orientation: Signal<'horizontal' | 'vertical'>;\n readonly selectionFollowsFocus: Signal<boolean>;\n\n readonly ariaLabel: Signal<string | null>;\n\n /**\n * The `[forSelect]` root (wrapper) element. Lets the trigger tell a focus\n * move to a sibling *inside* the wrapper (e.g. a clear button next to the\n * trigger) apart from a genuine focus leave, so `touched` isn't flipped\n * prematurely when focus stays within the control.\n */\n readonly host: HTMLElement;\n\n /** Compare two items for equality. Defaults to `===`; overridden for object values. */\n readonly compareWith: Signal<(a: T, b: T) => boolean>;\n /** Serialize an item for the hidden input's `value` attribute. Defaults to `String(item)`. */\n readonly itemToFormValue: Signal<(item: T) => string>;\n\n /**\n * Host element of the first enabled, currently-selected option, or `null`\n * when no selection exists. Used by `position=\"item-aligned\"` to anchor\n * the listbox over the trigger; falls back to the first enabled option\n * inside the listbox when this is `null`.\n */\n readonly selectedOptionEl: Signal<HTMLElement | null>;\n\n /**\n * Multi-select only (APG range keyboard). Move focus to the next / previous\n * enabled option and toggle it in/out of the selection, without moving the\n * range anchor. Non-wrapping. No-op in single mode, when disabled, or in the\n * virtualized path. Focus still moves under `readonly`; only the selection\n * mutation is blocked.\n */\n extendByArrow(currentOption: HTMLElement, action: 'next' | 'prev'): void;\n /**\n * Multi-select only (APG range keyboard, Shift+Space). Add every enabled\n * option between the range anchor and the focused option to the selection,\n * preserving any selection outside the span. Falls back to selecting just the\n * focused option when no anchor exists. No-op in single mode, disabled,\n * readonly, or the virtualized path.\n */\n selectRangeToFocused(currentOption: HTMLElement): void;\n /**\n * Multi-select only (APG range keyboard, Ctrl+Shift+Home / End). Add every\n * enabled option from the focused option to the first / last option to the\n * selection and move focus to that edge, preserving any selection outside the\n * span. No-op in single mode, disabled, or the virtualized path. Focus still\n * moves under `readonly`; only the selection mutation is blocked.\n */\n selectFromCurrentToEdge(currentOption: HTMLElement, edge: 'first' | 'last'): void;\n /**\n * Closed-state typeahead (single mode only). Selects the first enabled\n * matching option directly without opening the listbox — mirrors native\n * `<select>` behavior. Returns `true` if the key was consumed by typeahead.\n */\n handleClosedTypeahead(event: KeyboardEvent): boolean;\n\n /** Focus the first enabled option whose value is currently selected. Returns `false` if none. */\n focusSelectedOption(): boolean;\n /**\n * Scroll the option initial focus landed on into view, or the selected option\n * when the `(autoFocusOnOpen)` veto left focus on none, unless that option is\n * the first enabled one, already in view at the top. Driven from\n * `[forSelectContent]`'s positioner first-resolved-position hook\n * (`onFirstPosition`) in both positioning modes — the only moment both\n * prerequisites hold: the surface has been portaled to `document.body`\n * (resetting its `scrollTop` to 0) and is bounded by the CSS var the\n * positioner just wrote (so it is actually scrollable). The focus move itself\n * runs earlier, before the surface is bounded, so its own scroll is lost.\n * No-op while virtualizing: the navigator owns the virtualized scroll.\n */\n revealInitialFocus(): void;\n\n /**\n * The overlay shell's Tab-out wiring for `[forSelectContent]`: a Tab leaving\n * the surface from anything that is not an option continues from the trigger.\n * Inert while virtualizing, where the content's own keydown owns Tab.\n */\n readonly tabOut: { readonly target: () => HTMLElement | null; readonly close: () => void };\n\n /**\n * Commit the focused option's value (single mode) and close the listbox\n * with reason `'tab'`. Moves focus to the trigger synchronously so the\n * browser's Tab default action advances focus from there to the next\n * (or previous) focusable in tab order, never into the closing listbox.\n * Multi-mode skips the value-set — selection toggles already happened via\n * Space / Enter / click.\n */\n commitOnTab(value: T | Unset, event: KeyboardEvent): void;\n\n /**\n * Full source length when virtualizing, `undefined` in the default\n * DOM-focus path. Drives each option's `aria-setsize` / `aria-posinset`\n * and the focus-model branch.\n */\n readonly totalCount: Signal<number | undefined>;\n /**\n * The active option's `id` in the virtualized activedescendant model,\n * `null` in the default path. The content surface reflects it as\n * `aria-activedescendant`; options read it for `data-highlighted`.\n */\n readonly activeDescendantId: Signal<string | null>;\n /**\n * Virtualized-path open hook. Called by `[forSelectContent]` after it\n * focuses its own surface on open: seeds `aria-activedescendant` to the\n * committed option (scrolling it into view via `(scrollToIndex)`) when its\n * position is known — in the rendered window, previously rendered, or\n * supplied via the root's `[selectedIndex]`; otherwise focuses the first\n * enabled option.\n */\n seedVirtualizedInitialFocus(): void;\n /**\n * Virtualized-path keyboard handler. Called by `[forSelectContent]`'s host\n * keydown only when `totalCount()` is set: Arrow/Home/End navigation,\n * Enter/Space activation of the active descendant, single-mode Tab commit,\n * and typeahead — all in the activedescendant model.\n */\n handleVirtualizedKeydown(event: KeyboardEvent): void;\n /**\n * Called by an option on click in the virtualized path: moves\n * `aria-activedescendant` to that option and returns DOM focus to the\n * content surface. No-op in the default path.\n */\n notifyOptionClick(optionId: string): void;\n\n /**\n * Host element of the option the pointer is over in the default DOM-focus\n * path, `null` when the pointer is over none. Self-heals on read: a host that\n * has left the registered set or become disabled is discounted, so the focused\n * option reclaims the highlight. Always `null` in the virtualized path, where\n * hover moves {@link SelectPieceContext.activeDescendantId} itself.\n */\n readonly pointerHighlightedOption: Signal<HTMLElement | null>;\n /**\n * Reported by `[forSelectOption]` on `pointermove` so the highlight follows\n * the pointer. Never moves DOM focus, so it never commits a selection — not\n * even under `selectionFollowsFocus`, whose commit hangs off the navigation\n * focus move — and never touches the range anchor. A move arriving inside the\n * pointer-suppression window a programmatic scroll opened is ignored, or a\n * scroll sliding a different option under a stationary cursor would hand the\n * highlight to whatever the user merely scrolled past.\n *\n * @param host The hovered option's host — the DOM-focus path's highlight target.\n * @param id The hovered option's id — the virtualized path's highlight target.\n */\n highlightFromPointer(host: HTMLElement, id: string): void;\n /**\n * Called by an option when it takes DOM focus: drops any pointer highlight, so\n * the keyboard channel owns the highlight again from the move that focused the\n * option.\n */\n notifyOptionFocus(): void;\n /**\n * Called by `[forSelectContent]` when the pointer leaves the listbox surface:\n * drops any pointer highlight, so the focused option reclaims it instead of a\n * row staying decorated with the cursor elsewhere on the page. Crossing\n * between two adjacent options is not a leave, so the highlight never blinks\n * off. No-op in the virtualized path, where the pointer's claim *is*\n * {@link SelectPieceContext.activeDescendantId} and releasing it would leave\n * the container with no active option.\n */\n releasePointerHighlight(): void;\n}\n\n/**\n * The virtualized `aria-activedescendant` focus model `[forSelectVirtualized]`\n * lends the root. The root depends on this shape alone, so a select without the\n * piece never references the navigation engine.\n */\nexport interface SelectVirtualization<T = unknown> {\n /** Full source length, or `undefined` while the piece is present but unset. */\n readonly totalCount: Signal<number | undefined>;\n /** The open-time reveal hint the consumer bound, if any. */\n readonly selectedIndex: Signal<number | undefined>;\n /** The position the root resumes from once its active option unmounts. */\n readonly resume: VirtualizedResume<T, SelectPositionEntry<T>>;\n /** The navigation engine, constructed on first use. */\n navigator(): SelectVirtualizedNavigator<T>;\n /**\n * Rejects a multi-select range shortcut, which the virtualized path does not\n * support. Returns `true` when `event` was one, after preventing its default.\n */\n rejectRangeSelect(event: KeyboardEvent): boolean;\n}\n\n/** The root state the virtualized focus model reads and writes. */\nexport interface SelectVirtualizationHost<T = unknown> {\n /** The registered options — the rendered window. */\n readonly items: Signal<readonly ForSelectOptionHandle<T>[]>;\n /** Whether arrow navigation wraps at the ends. */\n readonly loop: () => boolean;\n /** The active option's id. */\n getActiveId(): string | null;\n /** Move the active option, forgetting any retained resume position. */\n setActiveId(id: string | null): void;\n /** Scroll an option into view with the pointer-suppression window open. */\n scrollActiveIntoView(host: HTMLElement): void;\n}\n\n/**\n * DI token for the select's coordination surface, provided by `[forSelect]`.\n *\n * Publicly typed as the read surface {@link ForSelectContext}, which is the whole of what\n * the token promises a consumer — `overlay` included, narrowed there to\n * {@link ForSelectOverlayFacade}. The pieces read the same token at an internal type that\n * widens it to the full overlay controller, so a wrapper re-providing it must alias it to\n * the root: `{ provide: FOR_SELECT_CONTEXT, useExisting: MySelect }`, where `MySelect`\n * extends `ForSelect`. A value that merely satisfies the declared type resolves too, and is\n * rejected in dev mode by the first piece to reach the controller.\n */\nexport const FOR_SELECT_CONTEXT = new InjectionToken<ForSelectContext>('FOR_SELECT_CONTEXT');\n\nexport const SELECT_TRIGGERS = new InjectionToken<RootedRegistry<object, RootedTriggerHandle>>(\n 'SELECT_TRIGGERS',\n { providedIn: 'root', factory: () => new RootedRegistry() },\n);\n\n/**\n * The select's internal coordination surface: everything {@link ForSelectContext}\n * publishes, plus the {@link SelectPieceContext} members and the full overlay\n * state machine instead of the consumer facade.\n *\n * Never exported from `public-api.ts`. It is the type the pieces read\n * {@link FOR_SELECT_CONTEXT} at, so a consumer who injects that token gets the\n * read surface while the pieces get the wiring protocol. `ForSelect` declares\n * `overlay` with the narrow public type and the piece members TS-`private`,\n * which keeps both out of the emitted `.d.ts` while `useExisting` still\n * satisfies this contract at runtime.\n */\nexport interface SelectContext<T = unknown> extends ForSelectContext<T>, SelectPieceContext<T> {\n readonly overlay: ForSelectOverlayContext<T>;\n}\n\n/**\n * The constant half of both resolvers' {@link assertRootContext} calls, so the\n * injected and the explicit path state the same requirement. `SelectContext`\n * adds no method of its own — it widens `overlay` from the consumer facade to\n * the full controller — so the probe each call site supplies is nested.\n */\nconst ROOT_ASSERTION = {\n entryPoint: 'select',\n token: 'FOR_SELECT_CONTEXT',\n root: '[forSelect]',\n};\n\nexport function injectSelectContext<T = unknown>(piece: string): SelectContext<T> {\n const ctx = inject(FOR_SELECT_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-SELECT-001',\n piece,\n root: '[forSelect]',\n token: 'FOR_SELECT_CONTEXT',\n });\n }\n const widened = ctx as unknown as SelectContext<T>;\n assertRootContext({\n ...ROOT_ASSERTION,\n piece,\n probe: () => widened.overlay.setInitialFocus,\n });\n return widened;\n}\n\n/**\n * Resolves the trigger's root context: the explicit reference when the\n * `[forSelectTrigger]` input carries one, the injected `FOR_SELECT_CONTEXT`\n * otherwise. `root` is `null` while neither resolves; `ctx` throws the orphan\n * error on read in that state. Must be called in an injection context.\n *\n * The explicit reference is a public `ForSelectContext`, so it is widened back\n * to the internal surface: the runtime object is always the `[forSelect]` root,\n * which owns the full overlay controller — the public interface only narrows\n * `overlay` to the consumer facade. Both paths are guarded, on read rather than\n * at injection time, because the explicit one only resolves inside the\n * `computed`; the explicit widening predates the one-token collapse\n * and was never\n * checked either.\n */\nexport function injectSelectTriggerContext<T = unknown>(\n explicitRoot: Signal<ForSelectContext<T> | ''>,\n): {\n readonly root: Signal<ForSelectContext<T> | ForSelectContext | null>;\n readonly ctx: Signal<SelectContext<T>>;\n} {\n const injected = inject(FOR_SELECT_CONTEXT, { optional: true });\n const root = computed(() => {\n const explicit = explicitRoot();\n return explicit === '' ? injected : explicit;\n });\n const ctx = computed(() => {\n const resolved = root();\n if (!resolved) {\n throw unresolvedRootError({\n code: 'FORCDK-SELECT-002',\n trigger: '[forSelectTrigger]',\n root: '[forSelect]',\n token: 'FOR_SELECT_CONTEXT',\n exportAs: 'forSelect',\n });\n }\n const widened = resolved as unknown as SelectContext<T>;\n assertRootContext({\n ...ROOT_ASSERTION,\n piece: 'ForSelectTrigger',\n probe: () => widened.overlay.setInitialFocus,\n });\n return widened;\n });\n return { root, ctx };\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n signal,\n type Signal,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport {\n accessibleTextContent,\n assertVirtualizedSelectionFollowsFocusSupported,\n createPointerHighlight,\n injectHiddenInput,\n injectNativeFormResetToInitial,\n LabelCache,\n lookupByValue,\n resolveCommittedPosition,\n resolveListNavigation,\n type WritingDirection,\n RangeSelectionEngine,\n defaultCompareWith,\n defaultItemToFormValue,\n isUnset,\n selectionMembership,\n singleSelected,\n toggleInArray,\n injectReflectedDirection,\n injectTextDirection,\n findTypeaheadMatch,\n injectTypeahead,\n type VetoableEvent,\n type VetoableNativeEvent,\n boundEntries,\n type Unset,\n} from 'forty-cdk/core';\nimport { warnIfOpenWithoutContent } from 'forty-cdk/core-overlay';\nimport { AnchoredFormValueControlBase, ListboxOverlayController } from 'forty-cdk/core-anchored';\nimport {\n FOR_SELECT_CONTEXT,\n SELECT_TRIGGERS,\n type ForSelectCloseReason,\n type ForSelectContext,\n type ForSelectInitialFocus,\n type ForSelectOptionHandle,\n type ForSelectOverlayFacade,\n type SelectVirtualization,\n type SelectVirtualizationHost,\n} from './select-context';\nimport { FOR_SELECT_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Headless implementation of the [WAI-ARIA select-only combobox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/).\n * Implements `FormValueControl<readonly T[]>` from\n * `@angular/forms/signals` for `[formField]` auto-wiring.\n *\n * Generic over the option value type `T` (default `string`). When the\n * consumer binds object items the directive infers `T` from `[(value)]` and\n * `[forSelectOption][value]`; object identity is resolved by the\n * consumer-supplied `[compareWith]` and the hidden inputs serialize\n * via `[itemToFormValue]`. Option display text is read from the rendered\n * `textContent`, so no separate label function is needed — supply the\n * optional `[itemToLabel]` only when a pre-set object value must render its\n * label before the listbox is ever opened (the documented `@if (open())`\n * pattern).\n *\n * Selection is always modeled as `readonly T[]`:\n * - In single mode (`multiple=false`, default), the array has 0 or 1 element\n * and option activation closes the listbox.\n * - In multi mode, option activation toggles and the listbox stays open.\n *\n * Typeahead has two modes mirroring native `<select>`:\n * - **Closed trigger** (single mode only): printable keys select the matching\n * option immediately without opening the listbox.\n * - **Open listbox**: printable keys move focus to the first matching option\n * (selection still requires Enter / Space / click).\n *\n * Both match an option's `textValue` when set, else `[itemToLabel]` of its value, else its\n * rendered text.\n */\n@Directive({\n selector: '[forSelect]',\n exportAs: 'forSelect',\n host: {\n '[attr.data-state]': 'open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'effectiveDisabled() ? \"\" : null',\n '[attr.data-readonly]': 'readonly() ? \"\" : null',\n '[attr.dir]': 'reflectedDir()',\n },\n providers: [{ provide: FOR_SELECT_CONTEXT, useExisting: ForSelect }],\n})\nexport class ForSelect<T = string>\n extends AnchoredFormValueControlBase\n implements FormValueControl<readonly T[]>, ForSelectContext<T>\n{\n readonly #typeahead = injectTypeahead();\n readonly #closedTypeahead = injectTypeahead();\n readonly #defaults = inject(FOR_SELECT_DEFAULTS);\n protected readonly positioningDefaults = this.#defaults;\n\n /** The `[forSelect]` root element (see `SelectPieceContext.host`). */\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n /**\n * Two-way bindable. Selected option values. Single-mode keeps 0 or 1\n * element. The `model()` change emitter (`(valueChange)`) fires only on\n * internal selection changes, never on consumer writes via `[(value)]`.\n */\n readonly value = model<readonly T[]>([]);\n\n /**\n * Compare two items for equality. Defaults to `===`, which is the\n * correct identity for primitive `T` (e.g. strings, numbers). Override\n * when binding object items so the directive can locate selected entries\n * by id (or any other stable key) instead of by reference:\n * `[compareWith]=\"(a, b) => a.id === b.id\"`.\n */\n readonly compareWith = input<(a: T, b: T) => boolean>(defaultCompareWith);\n\n /**\n * Serialize an item for the hidden input that participates in native\n * form submission. Defaults to identity for strings and to\n * `JSON.stringify` for non-string items so the primitive works out of\n * the box round-tripping objects. Override to emit a specific wire\n * format — typically a per-item id — when the backend expects that:\n * `[itemToFormValue]=\"(it) => it.id\"`.\n */\n readonly itemToFormValue = input<(item: T) => string>(defaultItemToFormValue);\n\n /**\n * Resolve the display label for an item without the listbox mounted.\n * When set, {@link selectedLabels} (and therefore `[forSelectValue]`)\n * renders this for any selected value, so a pre-set object value shows\n * its label on first paint — before the listbox has ever been opened, in\n * the documented `@if (forSelect.open())` pattern. Without it, object-value\n * labels resolve from the rendered option `textContent`, which is only\n * available once the content mounts; the serialized form value is shown as\n * a last-resort fallback in the meantime: `[itemToLabel]=\"(c) => c.name\"`.\n *\n * Typeahead matches this label too, on the open listbox and on the closed trigger, for every\n * option that sets no `textValue` of its own.\n *\n * Defaults to `undefined` (string mode renders the value verbatim, so no\n * label function is needed).\n */\n readonly itemToLabel = input<((item: T) => string) | undefined>(undefined);\n\n /**\n * Read-only single-select convenience view of {@link value}. Returns the\n * sole value when exactly one is selected (regardless of `multiple`),\n * otherwise `null` (zero, or 2+ selected). Lets single-select consumers\n * read `selected()` instead of unwrapping `value()[0]`. The array-backed\n * `value` model remains the source of truth and the `FormValueControl`\n * contract; this is a derived accessor.\n */\n readonly selected = singleSelected(this.value);\n\n /**\n * Two-way bindable. Whether the listbox is currently shown. The `model()`\n * change emitter (`(openChange)`) fires only on internal transitions\n * (trigger toggle, Escape, outside dismissal, single-mode option select),\n * never on consumer writes via `[(open)]`.\n */\n readonly open = model<boolean>(false);\n\n /**\n * When true, multiple options can be selected and option activation toggles\n * without closing the listbox. Single mode (default) keeps the value array at\n * 0 or 1 element and closes on select.\n *\n * In the default (non-virtualized) path the full APG range keyboard\n * (Shift+Arrow, Shift+Space, Ctrl/Cmd+A, Ctrl+Shift+Home/End) extends the\n * selection, matching `ForListbox`.\n *\n * That range keyboard is not supported together with virtualization\n * (`[forSelectVirtualized]` with `totalCount` set): range selection needs the full set of enabled options\n * across the range, which is unavailable while the list is partially\n * unmounted. Pressing one of those combinations on a virtualized multi-select\n * listbox throws in dev mode. Toggle options individually with Enter, Space,\n * or click, or drop `totalCount` to use the non-virtualized DOM-focus listbox.\n */\n readonly multiple = input(false, { transform: booleanAttribute });\n\n /**\n * Presentation mode. When `true`, `[forSelectContent]` mounts as a trapped /\n * inert / scroll-locked modal surface instead of the default anchored popover — the batteries-included touch\n * presentation a consumer opts into with `[modal]=\"isCoarsePointer()\"`. The\n * form-value wiring (`[(value)]`, `name`) is unchanged.\n *\n * Read when the content mounts, so a change takes effect on the next open.\n * Every anchored-positioning input — `position`, `side`, `align`,\n * `sideOffset`, `alignOffset`, `sticky`, `hideWhenDetached`,\n * `clipUntilPositioned`, `avoidCollisions`, `collisionPadding` — is a no-op\n * in this mode. Default `false`. The swipe / snap-point sheet is not this\n * mode — compose a `ForListbox` inside a `ForDrawer` for that.\n */\n readonly modal = input(false, { transform: booleanAttribute });\n\n /**\n * Positioning algorithm.\n *\n * - `'popper'` (default): standard floating-ui anchored placement using\n * `side` / `align` / `sideOffset` / `alignOffset`, with `flip` + `shift`\n * collision handling. Same path as Popover / DropdownMenu.\n * - `'item-aligned'`: the listbox overlays the trigger so the selected\n * option's vertical center aligns with the trigger's vertical center\n * — visually the menu \"snaps over\" the trigger when opened, mirroring\n * macOS native `<select>`. Falls back to the first enabled option when\n * nothing is selected. `side`, `align`, `sideOffset`, `alignOffset`,\n * `sticky`, `hideWhenDetached`, `clipUntilPositioned`, and `avoidCollisions` are ignored in\n * this mode; only `collisionPadding` is honored.\n */\n readonly position = input<'popper' | 'item-aligned'>('popper');\n\n /**\n * Whether arrow navigation wraps past the first / last enabled option. Default `true`.\n * The default is read from `provideForSelectDefaults` for the surrounding\n * scope.\n */\n readonly loop = input(this.#defaults.loop, { transform: booleanAttribute });\n\n /** Axis the arrow keys navigate. Reflected as `data-orientation` on the content. */\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n\n /**\n * Writing direction. When unset (default `null`), the inherited ambient direction is resolved\n * from the nearest ancestor carrying a `dir` attribute (or `<html dir>`), defaulting to `'ltr'`.\n * An explicit `[dir]` always wins. The resolved value is reflected to the host `dir` attribute\n * when a direction is set or declared.\n */\n readonly _dirInput = input<WritingDirection | null>(null, { alias: 'dir' });\n readonly dir = injectTextDirection(this._dirInput);\n private readonly reflectedDir = injectReflectedDirection(this._dirInput);\n\n /**\n * Single-mode only. When true, a keyboard focus move (arrow navigation or a\n * typeahead match) also selects the focused option while the listbox is\n * open. APG calls this optional and recommends caution — leave off unless\n * your UX truly benefits. When unset (default `undefined`), falls back to\n * `ForSelectDefaults.selectionFollowsFocus` from the surrounding\n * `provideForSelectDefaults` scope (`false` unless configured).\n *\n * Not supported together with virtualization (`[forSelectVirtualized]` with\n * `totalCount` set): the virtualized `aria-activedescendant` path resolves off-window navigation\n * targets asynchronously, so selection cannot follow focus there without\n * deriving the committed value from a render side effect. A virtualized select does not inherit\n * the scope default, and keyboard-navigating a virtualized single-select listbox that binds it to\n * `true` throws in dev mode, from the move the combination degrades.\n *\n * The input is aliased to `selectionFollowsFocus`; read the effective value through the public\n * `selectionFollowsFocus` computed below.\n */\n readonly _selectionFollowsFocusInput = input(undefined, {\n alias: 'selectionFollowsFocus',\n transform: (v: unknown): boolean | undefined => (v == null ? undefined : booleanAttribute(v)),\n });\n\n /** Effective `selectionFollowsFocus`: the input when set, else the scope default. */\n readonly selectionFollowsFocus = computed<boolean>(\n () => this._selectionFollowsFocusInput() ?? this.#defaults.selectionFollowsFocus,\n );\n\n /** Placeholder shown by `[forSelectValue]` when no option is selected. */\n readonly placeholder = input<string>('');\n\n /** When true (default), Escape, pointer-down outside, and focus outside close the listbox. */\n readonly dismissible = input(true, { transform: booleanAttribute });\n\n /**\n * When true (default), focus returns to the trigger after a close from Escape, from picking an\n * option or from setting `open` to `false`. A close from a press or focus outside the listbox, or\n * from a Tab out, leaves focus where the user moved it.\n */\n readonly returnFocus = input(true, { transform: booleanAttribute });\n\n /** Manual `aria-label` on `[forSelectContent]` when the trigger isn't a meaningful name. */\n readonly ariaLabel = input<string | null>(null);\n\n /** Emitted before Escape closes the listbox. Call `preventDefault()` to keep it open. */\n readonly escapeKeyDown = output<VetoableNativeEvent<KeyboardEvent>>();\n\n /** Emitted before an outside pointer-down closes the listbox. Vetoable with `preventDefault()`. */\n readonly pointerDownOutside = output<VetoableNativeEvent<PointerEvent>>();\n\n /** Emitted before focus leaving the surface closes the listbox. Vetoable with `preventDefault()`. */\n readonly focusOutside = output<VetoableNativeEvent<FocusEvent>>();\n\n /**\n * Emitted alongside {@link pointerDownOutside} and {@link focusOutside} for consumers that do not\n * care which one occurred. A `preventDefault()` on either channel suppresses the close.\n */\n readonly interactOutside = output<VetoableNativeEvent<PointerEvent | FocusEvent>>();\n\n /**\n * Fires just before the listbox sends focus to the selected option\n * (or first / last enabled) on mount. Call `preventDefault()` on the\n * emitted veto to skip the imperative focus move.\n */\n readonly autoFocusOnOpen = output<VetoableEvent>();\n\n /**\n * Fires just before focus returns to the trigger on unmount. Call\n * `preventDefault()` on the veto to suppress the return-focus.\n */\n readonly autoFocusOnClose = output<VetoableEvent>();\n\n readonly #virtualization = signal<SelectVirtualization<T> | null>(null);\n\n readonly #virtualized = computed(() => this.#virtualization()?.totalCount() !== undefined);\n\n /** Full source length while a `[forSelectVirtualized]` virtualizes the select. */\n private readonly totalCount = computed(() => this.#virtualization()?.totalCount());\n\n readonly #activeId = signal<string | null>(null);\n\n /** The mode the mounted `[forSelectContent]` published, `null` while none is mounted. */\n readonly #contentModal = signal<Signal<boolean> | null>(null);\n private readonly mountedModal = computed(() => this.#contentModal()?.() ?? this.modal());\n\n /**\n * Shared overlay-listbox state machine: option collection, trigger / anchor /\n * content registries + ids, DOM-focus navigation, the open / close machine,\n * the initial-focus / close-reason state, and the dismiss / auto-focus emit\n * forwarders. The value-specific behaviour (`isSelected`, `activate`,\n * `focusSelectedOption`, closed-state typeahead, the virtualized activedescendant path,\n * `commitOnTab`'s value set) stays in this root; close-time virtualized\n * cleanup and the post-navigate scroll / `selectionFollowsFocus` move are\n * threaded through the controller's side-effect callbacks.\n */\n readonly #controller = new ListboxOverlayController<\n ForSelectOptionHandle<T>,\n ForSelectInitialFocus,\n ForSelectCloseReason\n >({\n idPrefix: 'for-select',\n triggers: inject(SELECT_TRIGGERS).of(this),\n anchorSlot: { primitive: 'select', owner: '[forSelect]', claimant: '[forSelectAnchor]' },\n defaultInitialFocus: 'selected',\n effectiveDisabled: this.effectiveDisabled,\n setOpen: (open) => this.open.set(open),\n isOpen: () => this.open(),\n emit: {\n escapeKeyDown: this.escapeKeyDown,\n pointerDownOutside: this.pointerDownOutside,\n focusOutside: this.focusOutside,\n interactOutside: this.interactOutside,\n autoFocusOnOpen: this.autoFocusOnOpen,\n autoFocusOnClose: this.autoFocusOnClose,\n },\n loop: this.loop,\n dismissible: this.dismissible,\n escapeReason: 'escape',\n programmaticReason: 'programmatic',\n markTouched: () => this.markTouched(),\n onClose: () => {\n if (this.#virtualized()) {\n this.#activeId.set(null);\n this.#virtualModel().resume.clear();\n this.#virtualModel().navigator().resetPending();\n }\n },\n onNavigateFocus: (target) => this.#afterKeyboardFocus(target),\n typeaheadText: (o) => {\n const value = o.value();\n const fallback = () => accessibleTextContent(o.host);\n return isUnset(value) ? fallback() : this.#typeaheadText(o.textValue(), value, fallback);\n },\n onUnregisterOption: (handle) => {\n if (this.#virtualized() && this.#activeId() === handle.id()) {\n if (this.open()) {\n this.#virtualModel().resume.retain(handle.posInSet(), handle.value());\n }\n this.#activeId.set(null);\n }\n },\n });\n\n /**\n * The shared overlay-listbox coordination surface: trigger / anchor / content registration and\n * ids, DOM-focus navigation, the open / close machine, and the dismiss and auto-focus forwarders.\n *\n * Positioning prefers a registered `[forSelectAnchor]`, reached via `overlay.anchor`, and falls\n * back to the trigger.\n */\n readonly overlay: ForSelectOverlayFacade = this.#controller;\n\n private readonly tabOut = this.#controller.tabOut('tab', () => !this.#virtualized());\n\n /**\n * Shared APG range-selection state machine: owns the range anchor and the\n * Shift+Arrow / Shift+Space / Ctrl+A / Ctrl+Shift+Home/End actions plus the\n * single-mode idempotent select guard. The value-specific `activate` (which\n * also closes the listbox in single mode) and the virtualized activedescendant\n * path stay in this root; the range methods one-line delegate here.\n */\n readonly #rangeEngine = new RangeSelectionEngine<T, ForSelectOptionHandle<T>>({\n options: this.#controller.options,\n value: this.value,\n setValue: (v) => this.value.set(v),\n compareWith: this.compareWith,\n multiple: this.multiple,\n effectiveDisabled: this.effectiveDisabled,\n readonly: this.readonly,\n reveal: (host) => {\n host.focus();\n this.#scrollActiveIntoView(host);\n },\n });\n\n /** The active option's `id` in the virtualized path, `null` in the default path. */\n private readonly activeDescendantId = computed<string | null>(() =>\n this.#virtualized() ? this.#activeId() : null,\n );\n\n readonly #pointer = createPointerHighlight({\n items: () => this.#controller.options(),\n activeDescendant: {\n active: () => this.#virtualized(),\n claim: (id) => this.#setActiveId(id),\n },\n });\n\n private readonly pointerHighlightedOption = this.#pointer.pointed;\n\n /** The virtualized focus model; only reached while {@link #virtualized} holds. */\n #virtualModel(): SelectVirtualization<T> {\n return this.#virtualization()!;\n }\n\n #setActiveId(id: string | null): void {\n if (id !== null) {\n this.#virtualization()?.resume.clear();\n }\n this.#activeId.set(id);\n }\n\n private registerVirtualization(virtualization: SelectVirtualization): SelectVirtualizationHost {\n this.#virtualization.set(virtualization as unknown as SelectVirtualization<T>);\n return {\n items: this.#controller.options,\n loop: this.loop,\n getActiveId: () => this.#activeId(),\n setActiveId: (id) => this.#setActiveId(id),\n scrollActiveIntoView: (host) => this.#scrollActiveIntoView(host),\n };\n }\n\n /**\n * Bounded option-label cache. The live `options` registry is empty whenever\n * `[forSelectContent]` is unmounted, so {@link selectedLabels} reads the selection-keyed\n * projection and {@link handleClosedTypeahead} the last-window one.\n *\n * Because the window store is replaced rather than merged, a removal performed while the listbox\n * is **closed** cannot refresh it, so closed-state typeahead can still commit a value that no\n * longer exists until the next open. When virtualizing, the window is the rendered slice, so a\n * closed-state match is scoped to it. Selected labels are unaffected — they live in the\n * selection-keyed projection for as long as the value stays selected.\n */\n readonly #labelCache = new LabelCache<T>({\n items: this.#controller.options,\n value: this.value,\n itemToFormValue: this.itemToFormValue,\n compareWith: this.compareWith,\n });\n\n /**\n * Trimmed display labels of the selected values, in selection order. Pure\n * derivation: when `[itemToLabel]` is supplied it is authoritative; otherwise\n * resolve from the selection-keyed label cache, then the serialized form value\n * so non-string items still render meaningfully on a cold cache.\n *\n * The cache's labels come from each option's reactive `label` signal,\n * which reads the rendered `textContent`. `textContent` is not a signal, so a\n * label whose rendered text changes without a value change does not self-heal\n * here — supply `[itemToLabel]` for a pure signal derivation that observes\n * label changes directly.\n */\n readonly selectedLabels = computed<readonly string[]>(() => {\n const values = this.value();\n if (values.length === 0) {\n return [];\n }\n // When `[itemToLabel]` is supplied it is authoritative: the label resolves\n // without the listbox mounted, so a pre-set object value renders correctly\n // on first paint in the documented `@if (open())` pattern and never flickers\n // from a serialized id to the real label once the listbox is first opened.\n const itemToLabel = this.itemToLabel();\n if (itemToLabel) {\n return values.map(itemToLabel);\n }\n const cached = lookupByValue(\n this.#labelCache.selectedEntries(),\n (entry) => entry.value,\n this.compareWith(),\n );\n const toFormValue = this.itemToFormValue();\n return values.map(\n (v) => cached(v)?.label ?? (typeof v === 'string' ? (v as string) : toFormValue(v)),\n );\n });\n\n private readonly selectedOptionEl = computed<HTMLElement | null>(() => {\n const values = this.value();\n if (values.length === 0) {\n return null;\n }\n const byValue = lookupByValue(\n boundEntries(this.#controller.options(), (o) => o.value()),\n (entry) => entry.value,\n this.compareWith(),\n );\n for (const v of values) {\n const entry = byValue(v);\n if (entry) {\n return entry.handle.host;\n }\n }\n return null;\n });\n\n readonly #isSelected = selectionMembership(this.value, this.compareWith);\n\n protected override fieldLabelledElement(): HTMLElement | null {\n return this.#controller.trigger();\n }\n\n protected override fieldLabelledElementId(): string | null {\n return this.#controller.triggerId() || null;\n }\n\n /**\n * Move focus to the trigger, implementing `FormValueControl.focus` from\n * `@angular/forms/signals`. Without this override Signal Forms would focus the\n * host `[forSelect]` wrapper — which carries no focusable role — so\n * focus-on-error would silently go nowhere. No-op when disabled or before the\n * trigger has registered.\n */\n override focus(options?: FocusOptions): void {\n if (this.effectiveDisabled()) {\n return;\n }\n this.#controller.trigger()?.focus(options);\n }\n\n constructor() {\n super();\n warnIfOpenWithoutContent({\n primitive: 'select',\n piece: '[forSelectContent]',\n condition: 'select.open()',\n open: this.open,\n content: this.#controller.content,\n });\n injectHiddenInput<T>({\n name: this.name,\n values: this.value,\n serialize: (item) => this.itemToFormValue()(item),\n disabled: this.effectiveDisabled,\n required: this.required,\n focus: () => this.focus(),\n });\n injectNativeFormResetToInitial(this.value);\n\n // @sanctioned-pull(label-cache-window): the option window exists only while\n // the listbox is open, and the closed-state typeahead reading it has no\n // reader during that cycle.\n effect(() => {\n if (this.open()) {\n this.#labelCache.prime();\n }\n });\n }\n\n isSelected(v: T): boolean {\n return this.#isSelected()(v);\n }\n\n activate(v: T | Unset): void {\n if (this.effectiveDisabled() || this.readonly() || isUnset(v)) {\n return;\n }\n if (this.multiple()) {\n this.value.set(toggleInArray(this.value(), v, this.compareWith()));\n this.#rangeEngine.setAnchor(v);\n return;\n }\n this.#rangeEngine.selectSingle(v);\n this.#rangeEngine.setAnchor(v);\n this.#controller.closeOverlay('select');\n }\n\n private extendByArrow(currentOption: HTMLElement, action: 'next' | 'prev'): void {\n this.#rangeEngine.extendByArrow(currentOption, action);\n }\n\n private selectRangeToFocused(currentOption: HTMLElement): void {\n this.#rangeEngine.selectRangeToFocused(currentOption);\n }\n\n selectAll(): void {\n this.#rangeEngine.selectAll();\n }\n\n private selectFromCurrentToEdge(currentOption: HTMLElement, edge: 'first' | 'last'): void {\n this.#rangeEngine.selectFromCurrentToEdge(currentOption, edge);\n }\n\n #afterKeyboardFocus(target: ForSelectOptionHandle<T>): void {\n this.#scrollActiveIntoView(target.host);\n if (!this.multiple() && this.selectionFollowsFocus() && !this.readonly()) {\n this.#rangeEngine.selectSingle(target.value());\n }\n }\n\n /**\n * The text typeahead matches an option against, on every path: its `textValue`, else\n * `[itemToLabel]` of its value, else `fallback` (its accessible text).\n */\n #typeaheadText(textValue: string, value: T, fallback: () => string): string {\n if (textValue) {\n return textValue;\n }\n const itemToLabel = this.itemToLabel();\n return itemToLabel ? itemToLabel(value) : fallback();\n }\n\n private handleClosedTypeahead(event: KeyboardEvent): boolean {\n // Only single-mode replicates native <select>'s \"type-to-select\" behavior.\n // Multi-select is ambiguous (which one wins?) — caller falls back to opening.\n if (this.multiple() || this.effectiveDisabled() || this.readonly()) {\n return false;\n }\n if (!this.#closedTypeahead.handle(event)) {\n return false;\n }\n const cached = this.#labelCache.windowEntries();\n const selected = this.selected();\n const equals = this.compareWith();\n const anchorIndex = selected === null ? -1 : cached.findIndex((o) => equals(o.value, selected));\n const match = findTypeaheadMatch(\n cached,\n {\n buffer: this.#closedTypeahead.buffer(),\n repeated: this.#closedTypeahead.isRepeatedChar(),\n anchorIndex,\n },\n (o) => this.#typeaheadText(o.textValue ?? '', o.value, () => o.label),\n (o) => o.disabled,\n );\n if (match) {\n this.#rangeEngine.selectSingle(match.value);\n }\n return true;\n }\n\n private focusSelectedOption(): boolean {\n const values = this.value();\n if (values.length === 0) {\n return false;\n }\n const byValue = lookupByValue(\n boundEntries(\n this.#controller.options().filter((o) => !o.disabled()),\n (o) => o.value(),\n ),\n (entry) => entry.value,\n this.compareWith(),\n );\n for (const v of values) {\n const entry = byValue(v);\n if (entry) {\n this.#pointer.suppress();\n entry.handle.host.focus();\n return true;\n }\n }\n return false;\n }\n\n private revealInitialFocus(): void {\n if (this.#virtualized()) {\n return;\n }\n const target = this.#controller.revealTarget(() => this.selectedOptionEl());\n if (target) {\n this.#scrollActiveIntoView(target);\n }\n }\n\n private highlightFromPointer(host: HTMLElement, id: string): void {\n this.#pointer.claim(host, id);\n }\n\n private notifyOptionFocus(): void {\n this.#pointer.release();\n }\n\n private releasePointerHighlight(): void {\n this.#pointer.release();\n }\n\n private registerContentModal(modal: Signal<boolean>): void {\n this.#contentModal.set(modal);\n }\n\n private unregisterContentModal(modal: Signal<boolean>): void {\n if (this.#contentModal() === modal) {\n this.#contentModal.set(null);\n }\n }\n\n /**\n * Scroll an option into view with the pointer-suppression window open, so the\n * synthetic `pointermove` the scroll fires when a different option slides under\n * a stationary cursor cannot hand the highlight to it.\n */\n #scrollActiveIntoView(host: HTMLElement): void {\n this.#pointer.suppress();\n this.#pointer.release();\n host.scrollIntoView?.({ block: 'nearest' });\n }\n\n private commitOnTab(value: T | Unset, event: KeyboardEvent): void {\n if (this.effectiveDisabled() || isUnset(value)) {\n return;\n }\n if (!this.multiple() && !this.readonly()) {\n this.#rangeEngine.selectSingle(value);\n }\n // Move focus to the trigger BEFORE the unmount + close so the browser's\n // Tab default action has a stable active element to advance from. The\n // content's `DestroyRef` reads `lastCloseReason() === 'tab'` and skips\n // its own re-focus — otherwise it would steal focus back from wherever\n // the browser advanced it.\n this.#controller.commitTabToTrigger(event);\n this.#controller.closeOverlay('tab');\n }\n\n override markTouched(): void {\n super.markTouched();\n }\n\n private seedVirtualizedInitialFocus(): void {\n if (!this.#virtualized()) {\n return;\n }\n const navigator = this.#virtualModel().navigator();\n const target = this.#controller.initialFocus();\n if (target !== 'selected') {\n navigator.navigate(target);\n return;\n }\n const committed = resolveCommittedPosition({\n values: this.value(),\n snapshotByPos: navigator.snapshotByPos(),\n compareWith: this.compareWith(),\n selectedIndex: this.#virtualModel().selectedIndex(),\n totalCount: this.totalCount(),\n });\n if (committed !== null) {\n navigator.seedActive(committed);\n return;\n }\n navigator.navigate('first');\n }\n\n private handleVirtualizedKeydown(event: KeyboardEvent): void {\n if (!this.#virtualized() || this.effectiveDisabled()) {\n return;\n }\n if (this.#virtualModel().rejectRangeSelect(event)) {\n return;\n }\n if (event.key === 'Tab') {\n if (this.mountedModal()) {\n return;\n }\n this.#commitActiveDescendantOnTab(event);\n return;\n }\n if (event.key === ' ' && this.#typeaheadVirtualized(event)) {\n return;\n }\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.#activateActiveDescendant();\n return;\n }\n const action = resolveListNavigation(event, {\n orientation: this.orientation(),\n dir: this.dir(),\n pageKeys: true,\n });\n if (action) {\n event.preventDefault();\n this.#assertSelectionFollowsFocusSupported();\n this.#virtualModel().navigator().navigate(action);\n return;\n }\n this.#typeaheadVirtualized(event);\n }\n\n /**\n * Guards the `selectionFollowsFocus` + virtualization invariant at every\n * keyboard move of the virtualized activedescendant — arrow / Home / End /\n * Page navigation and a typeahead match alike, since both move focus without\n * carrying selection. Seeding on open and a click are not\n * covered: neither is a navigation the combination degrades.\n */\n #assertSelectionFollowsFocusSupported(): void {\n if (this.#virtualized()) {\n assertVirtualizedSelectionFollowsFocusSupported(\n { bound: this._selectionFollowsFocusInput(), multiple: this.multiple() },\n { primitive: 'select', focusModel: 'DOM-focus', collection: 'listbox' },\n );\n }\n }\n\n private notifyOptionClick(optionId: string): void {\n if (!this.#virtualized()) {\n return;\n }\n this.#setActiveId(optionId);\n this.#controller.content()?.focus();\n }\n\n #activeTarget(): { readonly value: T | Unset; readonly resumePos: number | null } | null {\n const id = this.#activeId();\n if (id === null) {\n const resumed = this.#virtualModel().resume.resolve();\n return resumed === null || resumed.entry.disabled\n ? null\n : { value: resumed.entry.value, resumePos: resumed.pos };\n }\n const handle = this.#controller.options().find((o) => o.id() === id);\n return !handle || handle.disabled() ? null : { value: handle.value(), resumePos: null };\n }\n\n #activateActiveDescendant(): void {\n const target = this.#activeTarget();\n if (target === null) {\n return;\n }\n if (target.resumePos !== null) {\n this.#virtualModel().navigator().seedActive(target.resumePos);\n }\n this.activate(target.value);\n }\n\n #commitActiveDescendantOnTab(event: KeyboardEvent): void {\n const target = this.#activeTarget();\n if (target !== null) {\n this.commitOnTab(target.value, event);\n return;\n }\n this.#controller.commitTabToTrigger(event);\n this.#controller.closeOverlay('tab');\n }\n\n /**\n * The virtualized typeahead searches the position snapshot, not the rendered\n * window, so a match the consumer's virtualizer has unmounted is reachable;\n * the match is seeded rather than focused, so an off-window one emits\n * `(scrollToIndex)` and settles once the option mounts.\n */\n #typeaheadVirtualized(event: KeyboardEvent): boolean {\n const navigator = this.#virtualModel().navigator();\n const { handled, pos } = navigator.resolveTypeahead(this.#typeahead, event, (entry) =>\n this.#typeaheadText(entry.textValue, entry.value, () => entry.label),\n );\n if (pos !== null) {\n this.#assertSelectionFollowsFocusSupported();\n navigator.seedActive(pos);\n }\n return handled;\n }\n}\n","import { isUnset, VirtualizedNavigator, type VirtualizedNavigatorDeps } from 'forty-cdk/core';\nimport type { ForSelectOptionHandle } from './select-context';\n\n/**\n * Position-snapshot entry for `ForSelect`. Carries the option's raw `value` and\n * its accessible text on top of the engine's `id` / `disabled`, so the root can\n * resolve the committed option's absolute index on open — and match a typeahead\n * — even while the option is outside the rendered window.\n */\nexport interface SelectPositionEntry<T> {\n /** Stable option host id — the activedescendant target. */\n readonly id: string;\n /** The option's raw value, matched against the selection by `compareWith`. */\n readonly value: T;\n /** The option's accessible text, the virtualized typeahead's last fallback. */\n readonly label: string;\n /** The option's `textValue`, which the virtualized typeahead prefers when set. */\n readonly textValue: string;\n /** Whether the option is disabled, so navigation skips over it. */\n readonly disabled: boolean;\n}\n\n/** The shared navigation engine as `ForSelect` parameterises it. */\nexport type SelectVirtualizedNavigator<T> = VirtualizedNavigator<\n ForSelectOptionHandle<T>,\n SelectPositionEntry<T>\n>;\n\n/**\n * Wire the shared `forty-cdk/core` navigation engine to the select option\n * handle: the handle carries its absolute `posInSet` and its raw `value`, and an\n * option whose `[value]` binding is not written yet is skipped this fold and\n * folded in on the binding's re-run. Scroll-into-view is routed through\n * `scrollActiveIntoView` so the root's pointer-suppression window opens first — a\n * synthetic `pointermove` from the scroll must not hijack the highlight.\n *\n * Internal — not re-exported from `select/index.ts` or `public-api.ts`.\n */\nexport function createSelectVirtualizedNavigator<T>(\n deps: VirtualizedNavigatorDeps<ForSelectOptionHandle<T>>,\n scrollActiveIntoView: (host: HTMLElement) => void,\n): SelectVirtualizedNavigator<T> {\n return new VirtualizedNavigator(deps, {\n posOf: (o) => o.posInSet(),\n idOf: (o) => o.id(),\n hostOf: (o) => o.host,\n isDisabled: (o) => o.disabled(),\n readEntry: (o) => {\n const id = o.id();\n const value = o.value();\n return isUnset(value)\n ? null\n : { id, value, label: o.label(), textValue: o.textValue(), disabled: o.disabled() };\n },\n scrollIntoView: (host) => scrollActiveIntoView(host),\n });\n}\n","import { Directive, effect, input, numberAttribute, output } from '@angular/core';\n\nimport {\n isRangeSelectShortcut,\n runVirtualizedNavigatorBridge,\n throwUnsupportedVirtualizedRangeSelect,\n VirtualizedResume,\n} from 'forty-cdk/core';\nimport { injectSelectContext } from './select-context';\nimport {\n createSelectVirtualizedNavigator,\n type SelectPositionEntry,\n type SelectVirtualizedNavigator,\n} from './select-virtualized-navigator';\n\n/**\n * Opts a `[forSelect]` into the virtualized focus model, for a listbox whose\n * options the consumer's virtualizer mounts only while they are in view. Placed\n * on the `[forSelect]` element itself. While `totalCount` is set, DOM focus\n * stays on `[forSelectContent]`, the active option is reflected as\n * `aria-activedescendant`, each rendered option carries `aria-setsize` /\n * `aria-posinset`, and keyboard navigation and typeahead reach options outside\n * the rendered window through `(scrollToIndex)`.\n *\n * A select without this directive never bundles the virtualized navigation\n * engine.\n *\n * @example\n * ```html\n * <div forSelect forSelectVirtualized [totalCount]=\"items.length\"\n * [visibleRange]=\"range()\" (scrollToIndex)=\"virtualizer.scrollToIndex($event)\">\n * …\n * </div>\n * ```\n */\n@Directive({\n selector: '[forSelectVirtualized]',\n exportAs: 'forSelectVirtualized',\n})\nexport class ForSelectVirtualized {\n readonly #ctx = injectSelectContext('ForSelectVirtualized');\n\n /**\n * Total number of items in the source data. When set, switches the listbox\n * to the virtualized `aria-activedescendant` focus model and populates\n * `aria-setsize` on each rendered option. Leave unset (default) for the\n * standard DOM-focus model.\n */\n readonly totalCount = input(undefined, {\n transform: (v: unknown): number | undefined => (v == null ? undefined : numberAttribute(v)),\n });\n\n /**\n * Inclusive-exclusive `[start, end)` index range of the currently rendered options, as provided\n * by `injectVirtualizer`. Decides whether a navigation target is inside the visible window.\n */\n readonly visibleRange = input<readonly [number, number] | undefined>(undefined);\n\n /**\n * Open-time reveal hint: the absolute index of the currently committed option\n * within the full source dataset. Consulted on open by the scroll-to-selected\n * algorithm as the authoritative index when the committed value's option lies\n * outside the rendered window and has never been rendered (so its position is\n * absent from the navigator snapshot). Bind it from the consumer's own\n * value→index lookup.\n *\n * This is a reveal hint, **not** a selection source — `value` / `[(value)]`\n * stay authoritative; it only decides which option is scrolled into view on\n * open. It is singular: in multiple mode it seeds the first committed option.\n * Leave unset (default) when the committed option is always inside the initial\n * window. An off-window committed value with no `[selectedIndex]` that was never\n * rendered falls back to focusing the first enabled option; an out-of-range\n * index (or an empty selection) is silently ignored.\n */\n readonly selectedIndex = input<number | undefined>(undefined);\n\n /**\n * Tells the select the source dataset changed **without** a `totalCount`\n * transition — a same-length re-sort or refresh (e.g. sorting a 1000-row\n * list). Bind any value that changes on such a refresh (a version counter,\n * the array reference, a sort-key string); when it changes the position\n * snapshot rebuilds from empty so navigation never resolves against a stale\n * off-window entry. Leave unset (default) when the dataset only ever changes\n * length. Equivalent to calling {@link ForSelectVirtualized.invalidateSnapshot}\n * imperatively.\n */\n readonly dataVersion = input<unknown>();\n\n /**\n * Emitted when navigation reaches an option outside the rendered window, or\n * on open-time scroll-to-selected when the committed option's absolute index\n * is resolvable — it is in the rendered window, was previously rendered (in\n * the snapshot), or was supplied via `[selectedIndex]`. Pass to\n * `injectVirtualizer`'s `scrollToIndex` so the correct option mounts.\n */\n readonly scrollToIndex = output<number>();\n\n #navigator: SelectVirtualizedNavigator<unknown> | null = null;\n\n readonly #resume = new VirtualizedResume<unknown, SelectPositionEntry<unknown>>({\n totalCount: this.totalCount,\n snapshotByPos: () => this.#requireNavigator().snapshotByPos(),\n compareWith: this.#ctx.compareWith,\n });\n\n readonly #host = this.#ctx.registerVirtualization({\n totalCount: this.totalCount,\n selectedIndex: this.selectedIndex,\n resume: this.#resume,\n navigator: () => this.#requireNavigator(),\n rejectRangeSelect: (event) => this.#rejectRangeSelect(event),\n });\n\n constructor() {\n // @sanctioned-pull(navigator-position-map): the rendered window is transient,\n // so a window nothing reads during is lost to the lazy fold.\n effect(() => {\n runVirtualizedNavigatorBridge({\n items: this.#host.items,\n virtualized: () => this.totalCount() !== undefined,\n requireNavigator: () => this.#requireNavigator(),\n });\n });\n }\n\n /**\n * Force the position snapshot to rebuild from empty on the next fold,\n * discarding stale off-window entries. Call after a same-length dataset\n * refresh (a re-sort / reload that keeps `totalCount` unchanged) when you\n * cannot express the change through the reactive `[dataVersion]` input. No-op\n * while `totalCount` is unset.\n */\n invalidateSnapshot(): void {\n if (this.totalCount() === undefined) {\n return;\n }\n this.#requireNavigator().invalidateSnapshot();\n }\n\n #requireNavigator(): SelectVirtualizedNavigator<unknown> {\n return (this.#navigator ??= createSelectVirtualizedNavigator(\n {\n items: this.#host.items,\n totalCount: this.totalCount,\n visibleRange: this.visibleRange,\n loop: this.#host.loop,\n getActiveId: () => this.#host.getActiveId(),\n setActiveId: (id) => this.#host.setActiveId(id),\n emitScrollToIndex: (idx) => this.scrollToIndex.emit(idx),\n getResumePos: () => this.#resume.pos(),\n dataVersion: this.dataVersion,\n },\n (host) => this.#host.scrollActiveIntoView(host),\n ));\n }\n\n #rejectRangeSelect(event: KeyboardEvent): boolean {\n if (\n !this.#ctx.multiple() ||\n !isRangeSelectShortcut(event, { orientation: this.#ctx.orientation(), dir: this.#ctx.dir() })\n ) {\n return false;\n }\n event.preventDefault();\n throwUnsupportedVirtualizedRangeSelect({\n primitive: 'select',\n focusModel: 'DOM-focus',\n collection: 'listbox',\n shortcuts: 'Shift+Arrow, Shift+Space, Ctrl/Cmd+A, Ctrl+Shift+Home/End',\n alternative: 'Toggle options individually with Enter, Space, or click',\n });\n return true;\n }\n}\n","import { Directive, ElementRef, inject } from '@angular/core';\n\nimport { registerHandle } from 'forty-cdk/core';\nimport { injectSelectContext } from './select-context';\n\n/**\n * Optional positioning anchor. When present, `[forSelectContent]` is\n * positioned against this element instead of `[forSelectTrigger]` — useful\n * when the trigger lives inside a decorated field box (padding, prefix icon,\n * clear / chevron buttons) and the listbox should match the visible field\n * rather than the inner button.\n *\n * Only positioning changes: the trigger still owns `aria-controls`,\n * `aria-expanded`, the click toggle, focus return on close, and its exemption\n * from outside-pointer dismissal. If no anchor is registered the listbox falls\n * back to anchoring against the trigger, so existing usages are unaffected.\n *\n * It wins over a surrounding field's `[forFieldAnchor]`. One\n * `[forSelectAnchor]` per `[forSelect]`; a second one warns in dev mode.\n *\n * ```html\n * <div forSelect [(value)]=\"v\">\n * <div forSelectAnchor class=\"field-box\">\n * <icon />\n * <button forSelectTrigger>…</button>\n * <button class=\"clear\">×</button>\n * </div>\n * @if (open()) {\n * <div forSelectContent>…</div>\n * }\n * </div>\n * ```\n */\n@Directive({\n selector: '[forSelectAnchor]',\n exportAs: 'forSelectAnchor',\n})\nexport class ForSelectAnchor {\n readonly #ctx = injectSelectContext('ForSelectAnchor');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n constructor() {\n registerHandle(\n this.#host.nativeElement,\n (el) => this.#ctx.overlay.registerAnchor(el),\n (el) => this.#ctx.overlay.unregisterAnchor(el),\n );\n }\n}\n","import { computed, Directive, ElementRef, inject, input, type Signal } from '@angular/core';\n\nimport {\n hostButtonType,\n hostId,\n reflectDisabled,\n registerHandle,\n leavesControl,\n} from 'forty-cdk/core';\nimport {\n type ForSelectContext,\n injectSelectTriggerContext,\n type SelectContext,\n SELECT_TRIGGERS,\n} from './select-context';\n\n/**\n * Combobox button that opens the listbox. Apply on a `<button>` so\n * Space / Enter dispatch native click events that toggle via `(click)`.\n *\n * Wires APG select-only combobox attributes: `role=\"combobox\"`,\n * `aria-haspopup=\"listbox\"`, `aria-expanded`, and `aria-controls` pointing\n * to the listbox. The button is exempt from the listbox's dismissible\n * layer — clicks on it route through `(click)` instead of triggering an\n * outside-pointer dismissal race.\n *\n * Disabling: the native `disabled` attribute is the single reflection channel\n * — no `aria-disabled` is emitted, because on a real single-purpose `<button>`\n * trigger the native attribute already conveys the state to assistive\n * technology, and it is what suppresses activation here. The\n * `role=\"combobox\"` override does not change that: the HTML `disabled`\n * attribute maps to the unavailable state regardless of the ARIA role, and a\n * native `<select disabled>` leaves the tab order the same way. It is\n * reflected non-destructively — the directive only removes the attribute when\n * it set it itself — and `data-disabled=\"\"` stays as the styling hook. The\n * remaining form-control state (`aria-readonly` / `aria-required` /\n * `aria-invalid` / `aria-busy`) is unaffected, and the read-only state carries\n * its own `data-readonly=\"\"` styling hook — `readonly` is not a valid attribute\n * of `<button>`, so a `data-*` channel is the only one available there.\n *\n * The root is normally resolved via DI from the enclosing `[forSelect]`.\n * When the trigger is declared inside an `ng-template` stamped into the root\n * (e.g. via `ngTemplateOutlet`), DI resolves at the template's declaration\n * site and misses the root — pass it explicitly through the selector input,\n * `routerLink`-style: `[forSelectTrigger]=\"root\"` with `#root=\"forSelect\"`.\n *\n * Keyboard:\n * - **Click / Enter / Space** — toggle (open focuses the selected option, or first).\n * - **ArrowDown** — open + focus selected option (or first).\n * - **ArrowUp** — open + focus selected option (or last when none selected).\n * - **Home** — open + focus the first enabled option.\n * - **End** — open + focus the last enabled option.\n * - **Typeahead** (single mode only) — printable keys select the matching\n * option immediately without opening the listbox, mirroring native\n * `<select>`. In multi mode the buffered key is ignored at the trigger;\n * open the listbox first to typeahead-focus.\n */\n@Directive({\n selector: '[forSelectTrigger]',\n exportAs: 'forSelectTrigger',\n host: {\n '[attr.type]': 'buttonType()',\n role: 'combobox',\n '[id]': 'id()',\n '[attr.aria-haspopup]': '\"listbox\"',\n '[attr.aria-expanded]': 'ctx().open() ? \"true\" : \"false\"',\n '[attr.aria-controls]': 'ctx().open() ? ctx().overlay.contentId() : null',\n '[attr.aria-readonly]': 'ctx().readonly() ? \"true\" : null',\n '[attr.aria-required]': 'ctx().required() ? \"true\" : null',\n '[attr.aria-invalid]': 'ctx().invalid() ? \"true\" : null',\n '[attr.aria-busy]': 'ctx().pending() ? \"true\" : null',\n '[attr.data-state]': 'ctx().open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'ctx().effectiveDisabled() ? \"\" : null',\n '[attr.data-readonly]': 'ctx().readonly() ? \"\" : null',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class ForSelectTrigger<T = unknown> {\n private readonly buttonType = hostButtonType();\n\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Optional explicit reference to the `[forSelect]` root, named after the\n * selector `routerLink`-style. The bare valueless attribute keeps resolving\n * the enclosing root via DI; pass the root explicitly\n * (`[forSelectTrigger]=\"root\"`, with `#root=\"forSelect\"`) when the trigger\n * is declared in an `ng-template` stamped inside the root — DI resolves at\n * the template's declaration site, so the enclosing root is invisible there.\n * The empty string (what the valueless attribute yields) is treated as unset.\n */\n readonly forSelectTrigger = input<ForSelectContext<T> | ''>('');\n\n readonly #resolved = injectSelectTriggerContext<T>(this.forSelectTrigger);\n readonly #root = this.#resolved.ctx;\n private readonly ctx: Signal<SelectContext<T>> = this.#root;\n\n private readonly id = hostId('for-select-trigger');\n\n constructor() {\n const triggers = inject(SELECT_TRIGGERS);\n registerHandle(\n { host: this.#host.nativeElement, id: this.id, root: this.#resolved.root },\n (handle) => triggers.add(handle),\n (handle) => triggers.remove(handle),\n );\n reflectDisabled(computed(() => this.ctx().effectiveDisabled()));\n }\n\n private onClick(): void {\n this.#activate();\n this.#root().overlay.toggle('selected');\n }\n\n /** Make this trigger the one the listbox anchors to, is labelled by and returns focus to. */\n #activate(): void {\n if (!this.ctx().effectiveDisabled()) {\n this.#root().overlay.activateTrigger(this.#host.nativeElement);\n }\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.ctx().effectiveDisabled()) {\n return;\n }\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.#activate();\n this.#root().overlay.openOverlay('selected');\n return;\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.#activate();\n // ArrowUp lands on the selected option if any, else the last enabled.\n this.#root().overlay.openOverlay(this.ctx().value().length > 0 ? 'selected' : 'last');\n return;\n }\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n this.#activate();\n this.#root().overlay.openOverlay(event.key === 'Home' ? 'first' : 'last');\n return;\n }\n // Closed-state typeahead — single-mode shortcut to match native <select>.\n // No-op (returns false) in multi mode or when the key isn't a printable\n // single char, so default browser behavior (e.g. nothing) takes over.\n this.ctx().handleClosedTypeahead(event);\n }\n\n private onFocusOut(event: FocusEvent): void {\n if (leavesControl(event, [this.#root().overlay.content(), this.ctx().host])) {\n this.ctx().markTouched();\n }\n }\n}\n","import { computed, Directive, input } from '@angular/core';\n\nimport { injectSelectContext } from './select-context';\n\n/**\n * Renders the currently-selected option's text — or the configured\n * placeholder when nothing is selected — into its host element via\n * `textContent`. Apply on a `<span>` (or any inline element) inside\n * `[forSelectTrigger]`:\n *\n * ```html\n * <button forSelectTrigger>\n * <span forSelectValue placeholder=\"Select fruit…\"></span>\n * </button>\n * ```\n *\n * In multi mode the labels are joined by `separator` (default `', '`). For\n * fully custom rendering, drop this directive and read\n * `forSelect.selectedLabels()` / `forSelect.value()` from your template.\n */\n@Directive({\n selector: '[forSelectValue]',\n exportAs: 'forSelectValue',\n host: {\n '[textContent]': 'displayText()',\n '[attr.data-placeholder]': 'isPlaceholder() ? \"\" : null',\n },\n})\nexport class ForSelectValue {\n readonly #ctx = injectSelectContext('ForSelectValue');\n\n /** Text shown when nothing is selected. Falls back to `[forSelect][placeholder]`. */\n readonly placeholder = input<string>('');\n\n /** Joiner for multi-mode label rendering. Default `', '`. */\n readonly separator = input<string>(', ');\n\n private readonly isPlaceholder = computed(() => this.#ctx.value().length === 0);\n\n private readonly displayText = computed(() => {\n const labels = this.#ctx.selectedLabels();\n if (labels.length === 0) {\n return this.placeholder() || this.#ctx.placeholder();\n }\n return labels.join(this.separator());\n });\n}\n","import { Directive, ElementRef, inject, type Signal, signal } from '@angular/core';\n\nimport {\n registerHandle,\n hostAriaLabel,\n hostLabelledBy,\n injectFieldLabelExemption,\n pressFocusesDescendant,\n preventPointerFocus,\n FOR_FIELD_ANCHOR_CONTEXT,\n FOR_FIELD_CONTEXT,\n dismissMarksTouched,\n} from 'forty-cdk/core';\nimport { injectModalShell, warnIfMountedWhileClosed } from 'forty-cdk/core-overlay';\nimport {\n floatingPositioner,\n injectOverlayShell,\n itemAlignedPositioner,\n} from 'forty-cdk/core-anchored';\nimport { injectSelectContext, type SelectContext } from './select-context';\n\n/**\n * The listbox surface. Carries `role=\"listbox\"`, is portaled to\n * `document.body`, and is positioned by `@floating-ui/dom` against the\n * trigger.\n *\n * Mount/unmount of the visible content is the consumer's responsibility —\n * wrap with `@if (open())` so `animate.enter` / `animate.leave` fire on the\n * natural mount cycle. While mounted it dismisses on Escape, pointer-down\n * outside or focus outside; the trigger element is exempt from outside-pointer\n * checks so trigger clicks toggle without dismissal racing.\n *\n * Initial focus is sent to the selected option (`'selected'`), the first\n * enabled option (`'first'`), or the last enabled option (`'last'`)\n * according to the trigger's hint, and that option is scrolled into view\n * once the surface has been positioned. On destroy, focus returns to the\n * trigger when `returnFocus` is true. A Tab that leaves the surface from\n * anything that is not an option continues from the trigger.\n *\n * A mouse press on the surface that lands on no focusable element of its own\n * (padding, a group label, a separator) is cancelled, so focus stays on the\n * option that held it and the arrow keys keep working; a press on an option\n * still focuses it, and a press on another focusable descendant takes focus\n * wherever the browser puts it.\n *\n * The lifecycle is picked once on construction from `[forSelect].modal`:\n *\n * - **non-modal (default)** — the listbox is anchored to the trigger and\n * branches on `[forSelect].position`:\n * - `'popper'` (default) — full anchored placement (`side`, `align`,\n * `sideOffset`, `alignOffset`, `flip`, `shift`, `hideWhenDetached`).\n * - `'item-aligned'` — the listbox overlays the trigger so the selected\n * option's center aligns with the trigger's center. The anchored-placement\n * inputs are no-ops in this mode.\n * - **modal** — focus is trapped, the background is inerted and body scroll is\n * locked; the surface is centered and positioned by the consumer's CSS rather\n * than anchored to the trigger, so every anchored-positioning input is a\n * no-op. Escape / outside-pointer dismiss, `dismissible` / `returnFocus` /\n * `ariaLabel` and the `autoFocusOnOpen` / `autoFocusOnClose` vetoes are\n * unchanged. Modality is conveyed by the `inert` siblings and reflected as\n * `data-modal` for styling; `role=\"listbox\"` does not support `aria-modal`,\n * so it is not emitted.\n *\n * A field boundary: a control inside it never registers with an ancestor\n * `[forField]`, and a `[forField]` inside it still wires its own control.\n */\n@Directive({\n selector: '[forSelectContent]',\n exportAs: 'forSelectContent',\n host: {\n role: 'listbox',\n '[attr.tabindex]': 'ctx.totalCount() !== undefined ? \"0\" : \"-1\"',\n '[attr.aria-activedescendant]': 'ctx.activeDescendantId()',\n '[id]': 'ctx.overlay.contentId()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.aria-multiselectable]': 'ctx.multiple() ? \"true\" : null',\n '[attr.aria-orientation]': 'ctx.orientation()',\n '[attr.data-state]': 'ctx.open() ? \"open\" : \"closed\"',\n '[attr.data-modal]': 'modal() ? \"\" : null',\n '[attr.data-orientation]': 'ctx.orientation()',\n '(keydown)': 'onKeyDown($event)',\n '(pointerleave)': 'onPointerLeave()',\n },\n providers: [\n { provide: FOR_FIELD_CONTEXT, useValue: null },\n { provide: FOR_FIELD_ANCHOR_CONTEXT, useValue: null },\n ],\n})\nexport class ForSelectContent {\n readonly #select = injectSelectContext('ForSelectContent');\n private readonly ctx: SelectContext = this.#select;\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly modal: Signal<boolean>;\n\n private readonly resolvedAriaLabel = hostAriaLabel(() => this.ctx.ariaLabel());\n\n private readonly labelledBy = hostLabelledBy(() =>\n this.resolvedAriaLabel() ? null : this.ctx.overlay.triggerId() || null,\n );\n\n constructor() {\n const ctx = this.#select;\n const host = this.#host.nativeElement;\n registerHandle(\n host,\n (el) => ctx.overlay.registerContent(el),\n (el) => ctx.overlay.unregisterContent(el),\n );\n preventPointerFocus((event) => !pressFocusesDescendant(event, host));\n\n warnIfMountedWhileClosed({\n primitive: 'select',\n piece: '[forSelectContent]',\n condition: 'select.open()',\n open: ctx.open,\n });\n\n // Primitive-owned initial-focus algorithm shared by both shells.\n // `'selected'` falls back to the first enabled option when nothing is\n // selected; returns `false` so the shell focuses the container on a miss.\n const focusInitial = (): boolean => {\n if (ctx.totalCount() !== undefined) {\n this.#host.nativeElement.focus();\n ctx.seedVirtualizedInitialFocus();\n return true;\n }\n const target = ctx.overlay.initialFocus();\n if (target === 'selected') {\n return ctx.focusSelectedOption() || ctx.overlay.focusFirstEnabledOption();\n }\n if (target === 'last') {\n return ctx.overlay.focusLastEnabledOption();\n }\n return ctx.overlay.focusFirstEnabledOption();\n };\n\n // Static branch — `modal` (and `position`) is read once on construction.\n // Switching modes at runtime would require re-creating the directive\n // (mount / unmount cycle), which is the expected pattern for primitives\n // whose surface is structurally different. The surface mounts lazily via\n // `@if (open())`, well after `modal` settles.\n if (ctx.modal()) {\n this.modal = injectModalShell({\n modal: ctx.modal,\n returnFocus: ctx.returnFocus,\n // The trap owns Tab; the shell runs `focusInitial()` (selected →\n // first → last) instead of its own first-focusable move.\n initialFocus: {\n move: focusInitial,\n veto: () => ctx.overlay.emitAutoFocusOnOpen(),\n },\n autoFocusOnClose: () => (event) => {\n if (ctx.overlay.emitAutoFocusOnClose()) {\n event.preventDefault();\n }\n },\n dismiss: {\n dismissible: ctx.dismissible,\n // The shell builds the veto and calls this when not vetoed; mirror\n // the anchored path's touched-on-dismiss behaviour.\n requestClose: (reason) => {\n if (dismissMarksTouched(reason)) {\n ctx.markTouched();\n }\n ctx.overlay.closeOverlay(reason);\n },\n emitEscapeKeyDown: (veto) => ctx.overlay.forwardEscapeKeyDown(veto),\n emitPointerDownOutside: (veto) => ctx.overlay.emitPointerDownOutside(veto),\n emitFocusOutside: (veto) => ctx.overlay.emitFocusOutside(veto),\n emitInteractOutside: (veto) => ctx.overlay.emitInteractOutside(veto),\n },\n }).modal;\n this.#publishModal();\n return;\n }\n\n const positioner =\n ctx.position() === 'item-aligned'\n ? itemAlignedPositioner({\n reference: ctx.overlay.anchor,\n open: ctx.open,\n selectedOption: ctx.selectedOptionEl,\n collisionPadding: ctx.collisionPadding,\n onFirstPosition: () => ctx.revealInitialFocus(),\n })\n : floatingPositioner({\n reference: ctx.overlay.anchor,\n open: ctx.open,\n side: ctx.side,\n align: ctx.align,\n sideOffset: ctx.sideOffset,\n alignOffset: ctx.alignOffset,\n avoidCollisions: ctx.avoidCollisions,\n collisionPadding: ctx.collisionPadding,\n sticky: ctx.sticky,\n hideWhenDetached: ctx.hideWhenDetached,\n clipUntilPositioned: ctx.clipUntilPositioned,\n onFirstPosition: () => ctx.revealInitialFocus(),\n });\n\n this.modal = signal(false).asReadonly();\n this.#publishModal();\n injectOverlayShell({\n positioner,\n dismiss: {\n dismissible: ctx.dismissible,\n // Mirror the modal path's touched-on-dismiss behaviour.\n requestClose: (reason) => {\n if (dismissMarksTouched(reason)) {\n ctx.markTouched();\n }\n ctx.overlay.closeOverlay(reason);\n },\n emitEscapeKeyDown: (event) => ctx.overlay.emitEscapeKeyDown(event),\n emitPointerDownOutside: (veto) => ctx.overlay.emitPointerDownOutside(veto),\n emitFocusOutside: (veto) => ctx.overlay.emitFocusOutside(veto),\n emitInteractOutside: (veto) => ctx.overlay.emitInteractOutside(veto),\n // Every trigger is exempt: each toggles the listbox from its own click.\n exemptElements: injectFieldLabelExemption(() => ctx.overlay.triggerHosts()),\n },\n initialFocus: {\n move: focusInitial,\n veto: () => ctx.overlay.emitAutoFocusOnOpen(),\n },\n returnFocus: {\n enabled: ctx.returnFocus,\n target: () => ctx.overlay.trigger(),\n // `(autoFocusOnClose)` lets the consumer veto the return-focus.\n veto: () => ctx.overlay.emitAutoFocusOnClose(),\n // Skip on `'tab'`: focus already landed where the user tabbed, so\n // re-focusing the trigger would steal it back. 'select' / 'escape' /\n // 'programmatic' still return focus to the trigger.\n skip: () => ctx.overlay.lastCloseReason() === 'tab',\n },\n tabOut: ctx.tabOut,\n });\n }\n\n #publishModal(): void {\n const ctx = this.#select;\n registerHandle(\n this.modal,\n (modal) => ctx.registerContentModal(modal),\n (modal) => ctx.unregisterContentModal(modal),\n );\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.ctx.totalCount() !== undefined) {\n this.ctx.handleVirtualizedKeydown(event);\n }\n }\n\n private onPointerLeave(): void {\n this.ctx.releasePointerHighlight();\n }\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n InjectionToken,\n input,\n signal,\n type InputSignal,\n} from '@angular/core';\n\nimport {\n assertInputBound,\n hostButtonType,\n accessibleTextContent,\n type DisabledRovingItemKeyOptions,\n focusAfterPress,\n handleDisabledRovingItemKey,\n isUnset,\n navigateFromRovingItem,\n registerHandle,\n hostId,\n injectPointerMove,\n preventPointerFocus,\n resolveListNavigation,\n unsetInput,\n type Unset,\n} from 'forty-cdk/core';\nimport { injectSelectContext } from './select-context';\n\n/**\n * Injection key the `[forSelectIndicator]` uses to resolve its parent option,\n * decoupled from the concrete `ForSelectOption` class. `ForSelectOption`\n * provides itself under this token, so a design system wrapping the option by\n * subclassing re-points it at the subclass with a single provider\n * (`{ provide: FOR_SELECT_OPTION, useExisting: MySelectOption }`) and the\n * indicator keeps resolving — see `docs/wrapping-form-primitives.md`.\n */\nexport const FOR_SELECT_OPTION = new InjectionToken<ForSelectOption>('FOR_SELECT_OPTION');\n\n/**\n * One option inside a `[forSelectContent]`. Apply on a `<button type=\"button\">`\n * so Space / Enter activation come from native button behavior — printable\n * keys fall through to the listbox for typeahead matching.\n *\n * Generic over the option value type `T` (default `string`). Inferred from\n * the `[value]` binding so consumers can pass either primitive ids or full\n * objects (`[value]=\"city\"` infers `T = City`); the parent `[forSelect]`\n * must be parameterized over the same `T`. The parent's\n * `[compareWith]` decides how options are matched against the\n * committed selection.\n *\n * Click activates: in single mode the value replaces `[(value)]` and the\n * listbox closes; in multi mode the value toggles in/out and the listbox\n * stays open.\n *\n * Hovering an enabled option hands it `data-highlighted`, so pointer and\n * keyboard feed one highlight and exactly one option is ever decorated. Hover\n * never moves DOM focus and never selects — the pointer's own click activates —\n * and moving the pointer off `[forSelectContent]` hands the highlight back to\n * the focused option.\n *\n * Keyboard while focused:\n * - **Enter / Space** — activate (via native button click).\n * - **ArrowDown / ArrowUp / Home / End** — move focus inside the listbox.\n * - **Shift+Arrow / Shift+Space / Ctrl+A / Ctrl+Shift+Home / Ctrl+Shift+End**\n * _(multi mode, non-virtualized)_ — APG range selection, matching\n * `ForListbox`.\n * - **Tab / Shift+Tab** — commit the focused option (single mode) and let\n * the browser advance focus to the next / previous focusable, mirroring\n * the WAI-ARIA select-only combobox pattern and native `<select>`.\n * - **Escape** — close the listbox.\n * - **Typeahead** — printable keys match by `textValue`, else the root's `[itemToLabel]`, else\n * text content.\n */\n@Directive({\n selector: '[forSelectOption]',\n exportAs: 'forSelectOption',\n providers: [{ provide: FOR_SELECT_OPTION, useExisting: ForSelectOption }],\n host: {\n role: 'option',\n '[attr.type]': 'buttonType()',\n tabindex: '-1',\n '[id]': 'id()',\n '[attr.aria-selected]': 'selected() ? \"true\" : \"false\"',\n '[attr.aria-disabled]': 'effectiveDisabled() ? \"true\" : null',\n '[attr.data-state]': 'selected() ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'effectiveDisabled() ? \"\" : null',\n '[attr.aria-setsize]': 'ariaSetSize()',\n '[attr.aria-posinset]': 'ariaPosInSet()',\n '[attr.data-highlighted]': 'highlighted() ? \"\" : null',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n '(focus)': 'onFocus()',\n '(blur)': 'onBlur()',\n '(pointerdown)': 'onPointerDown($event)',\n },\n})\nexport class ForSelectOption<T = string> {\n private readonly buttonType = hostButtonType();\n\n readonly #ctx = injectSelectContext<T>('ForSelectOption');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Stable identifier serialized into `[(value)]` and the hidden input.\n * Defaults to `string` for back-compat; bind an object to specialize the\n * parent `[forSelect]` over a richer `T`. The parent's\n * `[compareWith]` decides how options are matched against the\n * committed selection.\n *\n * Mandatory — an unbound option throws in dev mode.\n */\n readonly value: InputSignal<T | Unset> = input(unsetInput<T>());\n /**\n * Whether the option can be activated. A disabled option stays rendered and announced, is\n * skipped by arrow navigation and typeahead, and a mouse press on it leaves focus where it was.\n */\n readonly disabled = input(false, { transform: booleanAttribute });\n /**\n * Zero-based absolute position of this option in the full source data.\n * Required in the virtualized path — drives `aria-posinset` and the parent's\n * position snapshot. Leave unset (default `null`) outside it.\n */\n readonly posInSet = input<number | null>(null);\n\n /**\n * Override the string typeahead matches this option against, on the open listbox and on the\n * closed trigger alike. Defaults to `''`, which falls back to the root's `[itemToLabel]` when set,\n * else to the option's accessible text — an `aria-hidden` subtree is already excluded. Set this\n * when announced text still shouldn't bleed into the match — e.g. `textValue=\"France\"` for an\n * option rendered as `🇫🇷 France`. The label `[forSelectValue]` displays is unaffected.\n */\n readonly textValue = input<string>('');\n\n readonly id = hostId('for-select-option');\n\n readonly selected = computed(() => {\n const value = this.value();\n return isUnset(value) ? false : this.#ctx.isSelected(value);\n });\n readonly effectiveDisabled = computed(() => this.disabled() || this.#ctx.effectiveDisabled());\n\n private readonly ariaSetSize = computed<string | null>(() => {\n const total = this.#ctx.totalCount();\n return total === undefined ? null : String(total);\n });\n private readonly ariaPosInSet = computed<string | null>(() => {\n if (this.#ctx.totalCount() === undefined) {\n return null;\n }\n const pos = this.posInSet();\n return pos === null ? null : String(pos + 1);\n });\n\n readonly #focused = signal(false);\n /**\n * True when this option is the active candidate — the one the pointer is over,\n * else the keyboard's. In the default path the keyboard channel is the\n * DOM-focused option; in the virtualized path it is `aria-activedescendant`,\n * which hover moves too, so the highlight and the option `Enter` activates\n * never disagree there. Reflected as `data-highlighted`.\n */\n readonly highlighted = computed(() => {\n const activeId = this.#ctx.activeDescendantId();\n if (activeId !== null) {\n return activeId === this.id();\n }\n const pointed = this.#ctx.pointerHighlightedOption();\n if (pointed !== null) {\n return pointed === this.#host.nativeElement;\n }\n return this.#focused();\n });\n\n /**\n * Reactive effective label exposed on the handle — the trimmed `textContent`\n * of the host. Mirrors `ForComboboxOption`'s `#effectiveLabel` so the root\n * can fold a per-option `Signal<string>` into its persisted snapshot instead\n * of reading `textContent` from inside a `computed`. `textContent` is not a\n * signal, so this still does not self-heal on a text-only change with no\n * value change — supply `[forSelect][itemToLabel]` for a pure signal\n * derivation when the label can change without the value.\n */\n readonly #effectiveLabel = computed(() => accessibleTextContent(this.#host.nativeElement).trim());\n\n constructor() {\n assertInputBound(this.value, 'select', '[forSelectOption]', 'value');\n const handle = {\n host: this.#host.nativeElement,\n value: this.value,\n label: this.#effectiveLabel,\n textValue: this.textValue,\n disabled: this.effectiveDisabled,\n id: this.id,\n posInSet: this.posInSet,\n };\n registerHandle(\n handle,\n (h) => this.#ctx.overlay.registerOption(h),\n (h) => this.#ctx.overlay.unregisterOption(h),\n );\n preventPointerFocus(() => this.effectiveDisabled());\n injectPointerMove(() => this.onPointerMove());\n }\n\n private onClick(): void {\n if (this.effectiveDisabled()) {\n return;\n }\n if (this.#ctx.totalCount() === undefined) {\n focusAfterPress(this.#host.nativeElement);\n }\n if (this.#ctx.readonly()) {\n this.#ctx.notifyOptionClick(this.id());\n return;\n }\n this.#ctx.activate(this.value());\n this.#ctx.notifyOptionClick(this.id());\n }\n\n private onFocus(): void {\n this.#focused.set(true);\n this.#ctx.notifyOptionFocus();\n }\n\n private onBlur(): void {\n this.#focused.set(false);\n }\n\n private onPointerMove(): void {\n if (this.effectiveDisabled()) {\n return;\n }\n this.#ctx.highlightFromPointer(this.#host.nativeElement, this.id());\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.effectiveDisabled()) {\n handleDisabledRovingItemKey(event, this.#keyOptions());\n return;\n }\n\n if (event.key === 'Tab') {\n // In modal mode the focus trap owns Tab (it cycles focus inside the\n // surface in the capture phase); committing + closing here would defeat\n // the trap. Bail and let the trap's `preventDefault` keep focus inside.\n if (this.#ctx.mountedModal()) {\n return;\n }\n // APG (combobox-select-only): Tab commits the focused option and lets\n // the browser advance focus to the next / previous focusable. Do NOT\n // preventDefault — the browser's Tab default uses the focus we just\n // moved to the trigger as the starting point.\n this.#ctx.commitOnTab(this.value(), event);\n return;\n }\n\n if (this.#ctx.multiple()) {\n if ((event.ctrlKey || event.metaKey) && !event.shiftKey && !event.altKey) {\n if (event.key === 'a' || event.key === 'A') {\n event.preventDefault();\n this.#ctx.selectAll();\n return;\n }\n }\n\n if ((event.ctrlKey || event.metaKey) && event.shiftKey && !event.altKey) {\n if (event.key === 'Home') {\n event.preventDefault();\n this.#ctx.selectFromCurrentToEdge(this.#host.nativeElement, 'first');\n return;\n }\n if (event.key === 'End') {\n event.preventDefault();\n this.#ctx.selectFromCurrentToEdge(this.#host.nativeElement, 'last');\n return;\n }\n }\n\n if (event.shiftKey && event.key === ' ') {\n event.preventDefault();\n this.#ctx.selectRangeToFocused(this.#host.nativeElement);\n return;\n }\n\n if (event.shiftKey && !event.ctrlKey && !event.metaKey && !event.altKey) {\n const rangeAction = resolveListNavigation(event, {\n orientation: this.#ctx.orientation(),\n dir: this.#ctx.dir(),\n });\n if (rangeAction === 'next' || rangeAction === 'prev') {\n event.preventDefault();\n this.#ctx.extendByArrow(this.#host.nativeElement, rangeAction);\n return;\n }\n }\n }\n\n if (navigateFromRovingItem(event, this.#keyOptions())) {\n return;\n }\n\n this.#ctx.overlay.handleTypeahead(event);\n }\n\n #keyOptions(): DisabledRovingItemKeyOptions {\n return {\n groupDisabled: this.#ctx.effectiveDisabled(),\n orientation: this.#ctx.orientation(),\n dir: this.#ctx.dir(),\n pageKeys: true,\n navigate: (action) => this.#ctx.overlay.navigate(this.#host.nativeElement, action),\n typeahead: (e) => this.#ctx.overlay.handleTypeahead(e),\n };\n }\n\n private onPointerDown(event: PointerEvent): void {\n if (this.#ctx.totalCount() === undefined) {\n return;\n }\n event.preventDefault();\n }\n}\n","import { Directive, inject } from '@angular/core';\n\nimport { orphanContextError } from 'forty-cdk/core';\n\nimport { FOR_SELECT_OPTION, type ForSelectOption } from './select-option';\n\n/**\n * Visibility helper inside a `[forSelectOption]`. The directive flips a\n * `[hidden]` host binding so the consumer can keep the checkmark / icon\n * inline without extra `@if` glue:\n *\n * ```html\n * <button forSelectOption value=\"apple\">\n * <span forSelectIndicator>✓</span>\n * Apple\n * </button>\n * ```\n *\n * Reflects the parent option's `data-state` (`\"checked\" | \"unchecked\"`) so\n * the consumer can also style it from CSS. Visibility while unselected is\n * enforced with an inline `display: none` (which beats any author `display`\n * rule a consumer applies via a class) in addition to the `hidden` attribute\n * that removes it from the a11y tree.\n */\n@Directive({\n selector: '[forSelectIndicator]',\n exportAs: 'forSelectIndicator',\n host: {\n 'aria-hidden': 'true',\n '[attr.data-state]': 'option.selected() ? \"checked\" : \"unchecked\"',\n '[hidden]': '!option.selected()',\n '[style.display]': 'option.selected() ? null : \"none\"',\n },\n})\nexport class ForSelectIndicator {\n private readonly option = injectParentOption();\n}\n\nfunction injectParentOption(): ForSelectOption {\n const option = inject(FOR_SELECT_OPTION, { optional: true });\n if (!option) {\n throw orphanContextError({\n code: 'FORCDK-SELECT-004',\n piece: 'ForSelectIndicator',\n root: '[forSelectOption]',\n token: 'FOR_SELECT_OPTION',\n });\n }\n return option;\n}\n","import { Directive, signal } from '@angular/core';\n\nimport { hostLabelledBy } from 'forty-cdk/core';\n\n/**\n * Optional grouping wrapper inside a `[forSelectContent]`. Renders\n * `role=\"group\"` and references the descendant `[forSelectGroupLabel]`\n * (if any) via `aria-labelledby`. Options inside a group still register\n * with the root listbox normally, so keyboard navigation traverses across\n * groups in DOM order without special handling.\n */\n@Directive({\n selector: '[forSelectGroup]',\n exportAs: 'forSelectGroup',\n host: {\n role: 'group',\n },\n})\nexport class ForSelectGroup {\n readonly #labelId = signal<string | null>(null);\n\n /** The id of the registered group label (or `null` if none). */\n readonly labelId = this.#labelId.asReadonly();\n\n private readonly labelledBy = hostLabelledBy(() => this.labelId());\n\n /** Called by `ForSelectGroupLabel` on mount. */\n registerLabel(id: string): void {\n this.#labelId.set(id);\n }\n\n /** Called by `ForSelectGroupLabel` on destroy. Idempotent. */\n unregisterLabel(id: string): void {\n if (this.#labelId() === id) {\n this.#labelId.set(null);\n }\n }\n}\n","import { Directive, inject } from '@angular/core';\n\nimport { orphanContextError, registerA11yName } from 'forty-cdk/core';\nimport { ForSelectGroup } from './select-group';\n\n/**\n * Visible label for a `[forSelectGroup]`. Generates a stable id and\n * registers with its parent group so the group's `aria-labelledby` points\n * at this element. Apply on whatever heading element fits the design\n * (often `<div>` styled as a small caption).\n */\n@Directive({\n selector: '[forSelectGroupLabel]',\n exportAs: 'forSelectGroupLabel',\n host: {\n '[id]': 'id',\n },\n})\nexport class ForSelectGroupLabel {\n /** Stable host id used by the parent group's `aria-labelledby`. */\n readonly id: string;\n\n constructor() {\n const group = inject(ForSelectGroup, { optional: true });\n if (!group) {\n throw orphanContextError({\n code: 'FORCDK-SELECT-003',\n piece: 'ForSelectGroupLabel',\n root: '[forSelectGroup]',\n token: 'ForSelectGroup',\n });\n }\n this.id = registerA11yName(group, 'for-select-group-label');\n }\n}\n","import { Directive, input } from '@angular/core';\n\n/**\n * Visual separator between options or groups inside a `[forSelectContent]`. Keyboard\n * navigation and typeahead skip it. It is always presentational (`role=\"none\"`, no\n * `aria-orientation`), because a `role=\"listbox\"` may own only `option` and `group`\n * children: wrap related options in a `[forSelectGroup]` with a group label when the split\n * must be announced.\n */\n@Directive({\n selector: '[forSelectSeparator]',\n exportAs: 'forSelectSeparator',\n host: {\n role: 'none',\n '[attr.data-orientation]': 'orientation()',\n },\n})\nexport class ForSelectSeparator {\n /**\n * Axis the separator divides along, reflected to `data-orientation` for styling.\n * `horizontal` (default) splits options stacked vertically, the common case in a\n * listbox; `vertical` splits options laid out horizontally.\n */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n}\n","/**\n * Exact public names of every `ForSelect` input, its models included. Spread it into the\n * `inputs` array of a `hostDirectives` entry so a wrapper component re-exposes the\n * primitive's full surface — the Signal Forms members `[formField]` binds among them —\n * without hand-maintaining the list. Always spread into an inline object literal as shown\n * below: the literal is what keeps the entry statically analyzable for consumers compiling\n * against the published package. An anti-drift spec fails when this list no longer matches\n * the directive's actual API. See `docs/wrapping-form-primitives.md` for both supported\n * wrapping patterns.\n *\n * @example\n * ```ts\n * @Component({\n * selector: 'div[mySelect]',\n * template: '',\n * hostDirectives: [\n * {\n * directive: ForSelect,\n * inputs: [...FOR_SELECT_HOST_DIRECTIVE_INPUTS],\n * outputs: [...FOR_SELECT_HOST_DIRECTIVE_OUTPUTS],\n * },\n * ],\n * })\n * export class MySelect {}\n * ```\n */\nexport const FOR_SELECT_HOST_DIRECTIVE_INPUTS = [\n 'value',\n 'open',\n 'align',\n 'alignOffset',\n 'ariaLabel',\n 'avoidCollisions',\n 'clipUntilPositioned',\n 'collisionPadding',\n 'compareWith',\n 'dir',\n 'dirty',\n 'disabled',\n 'dismissible',\n 'errors',\n 'hideWhenDetached',\n 'invalid',\n 'itemToFormValue',\n 'itemToLabel',\n 'loop',\n 'modal',\n 'multiple',\n 'name',\n 'orientation',\n 'pending',\n 'placeholder',\n 'position',\n 'readonly',\n 'required',\n 'returnFocus',\n 'selectionFollowsFocus',\n 'side',\n 'sideOffset',\n 'sticky',\n 'touched',\n] as const;\n\n/**\n * Exact public names of every `ForSelect` output, the Signal Forms `touch` output\n * included. Spread it into the `outputs` array of the same `hostDirectives` entry as\n * {@link FOR_SELECT_HOST_DIRECTIVE_INPUTS}.\n */\nexport const FOR_SELECT_HOST_DIRECTIVE_OUTPUTS = [\n 'valueChange',\n 'openChange',\n 'escapeKeyDown',\n 'pointerDownOutside',\n 'focusOutside',\n 'interactOutside',\n 'autoFocusOnOpen',\n 'autoFocusOnClose',\n 'touchedChange',\n 'touch',\n] as const;\n\n/**\n * Exact public names of every `ForSelectVirtualized` input. Spread it into the `inputs`\n * array of a second `hostDirectives` entry, beside the `ForSelect` one, so a wrapper\n * component that virtualizes its options re-exposes the virtualization surface too.\n */\nexport const FOR_SELECT_VIRTUALIZED_HOST_DIRECTIVE_INPUTS = [\n 'dataVersion',\n 'selectedIndex',\n 'totalCount',\n 'visibleRange',\n] as const;\n\n/**\n * Exact public names of every `ForSelectVirtualized` output. Spread it into the\n * `outputs` array of the same `hostDirectives` entry as\n * {@link FOR_SELECT_VIRTUALIZED_HOST_DIRECTIVE_INPUTS}.\n */\nexport const FOR_SELECT_VIRTUALIZED_HOST_DIRECTIVE_OUTPUTS = ['scrollToIndex'] as const;\n"],"mappings":";;;;;;AAsdA,MAAa,qBAAqB,IAAI,eAAiC,oBAAoB;AAE3F,MAAa,kBAAkB,IAAI,eACjC,mBACA;CAAE,YAAY;CAAQ,eAAe,IAAI,eAAc;AAAE,CAAE;AAyB7D,MAAM,iBAAiB;CACrB,YAAY;CACZ,OAAO;CACP,MAAM;AACP;AAED,SAAgB,oBAAiC,OAAa;CAC5D,MAAM,MAAM,OAAO,oBAAoB,EAAE,UAAU,KAAI,CAAE;CACzD,IAAI,CAAC,KACH,MAAM,mBAAmB;EACvB,MAAM;EACN;EACA,MAAM;EACN,OAAO;CACR,CAAA;CAEH,MAAM,UAAU;CAChB,kBAAkB;EAChB,GAAG;EACH;EACA,aAAa,QAAQ,QAAQ;CAC9B,CAAA;CACD,OAAO;AACT;AAiBA,SAAgB,2BACd,cAA8C;CAK9C,MAAM,WAAW,OAAO,oBAAoB,EAAE,UAAU,KAAI,CAAE;CAC9D,MAAM,OAAO,eAAc;EACzB,MAAM,WAAW,aAAY;EAC7B,OAAO,aAAa,KAAK,WAAW;CACtC,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAoBF,OAAO;EAAE;EAAM,KAnBH,eAAc;GACxB,MAAM,WAAW,KAAI;GACrB,IAAI,CAAC,UACH,MAAM,oBAAoB;IACxB,MAAM;IACN,SAAS;IACT,MAAM;IACN,OAAO;IACP,UAAU;GACX,CAAA;GAEH,MAAM,UAAU;GAChB,kBAAkB;IAChB,GAAG;IACH,OAAO;IACP,aAAa,QAAQ,QAAQ;GAC9B,CAAA;GACD,OAAO;EACT,GAAE,GAAA,YAA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AA,EAAA,yBAAA,gBAAA;EAAA;EAAA,UAAA,CAAA,oBAAA;EAAA,UAAA;CAAA,CAAA;;AAAlB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAkB,YAAA,CAAA;EAR9B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM;IACJ,MAAM;IACN,2BAA2B;GAC5B;EACF,CAAA;;;;;;;;;;;ACUD,MAAa,mCAAmC;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACQ;AAOV,MAAa,oCAAoC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACQ;AAOV,MAAa,+CAA+C;CAC1D;CACA;CACA;CACA;AACQ;AAOV,MAAa,gDAAgD,CAAC,eAAe"}
|
|
1
|
+
{"version":3,"file":"forty-cdk-select.mjs","names":["FOR_SELECT_DEFAULTS"],"sources":["../../../projects/forty-cdk/select/src/select-context.ts","../../../projects/forty-cdk/select/src/select.ts","../../../projects/forty-cdk/select/src/select-virtualized-navigator.ts","../../../projects/forty-cdk/select/src/select-virtualized.ts","../../../projects/forty-cdk/select/src/select-anchor.ts","../../../projects/forty-cdk/select/src/select-trigger.ts","../../../projects/forty-cdk/select/src/select-value.ts","../../../projects/forty-cdk/select/src/select-content.ts","../../../projects/forty-cdk/select/src/select-option.ts","../../../projects/forty-cdk/select/src/select-indicator.ts","../../../projects/forty-cdk/select/src/select-group.ts","../../../projects/forty-cdk/select/src/select-group-label.ts","../../../projects/forty-cdk/select/src/select-separator.ts","../../../projects/forty-cdk/select/src/select-host-directive.ts"],"sourcesContent":["import { computed, inject, InjectionToken, type Signal } from '@angular/core';\n\nimport {\n assertRootContext,\n type CollectionHandle,\n orphanContextError,\n RootedRegistry,\n unresolvedRootError,\n type Unset,\n type VirtualizedResume,\n type WritingDirection,\n} from 'forty-cdk/core';\nimport {\n type FloatingAlign,\n type FloatingSide,\n type ListboxOverlayPieceContext,\n type RootedTriggerHandle,\n} from 'forty-cdk/core-anchored';\nimport type {\n SelectPositionEntry,\n SelectVirtualizedNavigator,\n} from './select-virtualized-navigator';\n\n/**\n * Why a select requested close. Mirrors the menu primitive vocabulary so\n * downstream code that switches on close reasons stays consistent.\n */\nexport type ForSelectCloseReason =\n 'escape' | 'pointerDownOutside' | 'focusOutside' | 'select' | 'tab' | 'programmatic';\n\n/**\n * Where focus lands when the listbox opens. `'selected'` snaps to the first\n * currently-selected enabled option (matches native `<select>`); falls back\n * to `'first'` if no selection is enabled.\n */\nexport type ForSelectInitialFocus = 'first' | 'last' | 'selected';\n\n/**\n * Handle every `[forSelectOption]` registers with the root. The collection\n * orders entries by DOM document order so groups, separators, and `@for`\n * loops don't perturb keyboard navigation.\n *\n * Generic over the option value type `T` (default `unknown` at the contract\n * level; `string` at the public root). The handle carries the raw value so\n * the root can match it against `value()` via `compareWith`.\n */\nexport interface ForSelectOptionHandle<T = unknown> extends CollectionHandle {\n /**\n * Narrowed from {@link CollectionHandle}'s `Node`: the root focuses the\n * option and scrolls it into view.\n */\n readonly host: HTMLElement;\n /** The option's value, or {@link Unset} before its binding is written. */\n readonly value: Signal<T | Unset>;\n /**\n * The option's resolved display label as a reactive `Signal<string>` — the\n * trimmed `textContent` of the host. The root folds it into a persisted\n * snapshot so `selectedLabels` and closed-state typeahead resolve labels\n * without peeking at `textContent` from inside a `computed`.\n */\n readonly label: Signal<string>;\n /** The option's typeahead override, `''` when typeahead falls back to the root's resolution. */\n readonly textValue: Signal<string>;\n readonly disabled: Signal<boolean>;\n /** Stable host `id` — the activedescendant target in the virtualized path. */\n readonly id: Signal<string>;\n /**\n * Zero-based absolute position in the full source data. Required in the\n * virtualized path (drives the position snapshot + `aria-posinset`); `null`\n * outside it.\n */\n readonly posInSet: Signal<number | null>;\n}\n\n/**\n * The consumer-facing slice of the select's overlay surface, reached through\n * {@link ForSelectContext.overlay}: the trigger / content ids the ARIA wiring\n * points at, the reason of the last close, and the open / close commands that\n * mutate `open()` through the root's guards.\n *\n * It is narrow. The full state machine behind it — the trigger /\n * anchor / content / option registries, the DOM-focus navigation algorithm, the\n * initial-focus state, and the dismiss / auto-focus emit forwarders — is the\n * library's own wiring and is refactored without notice, so it stays on an\n * unexported surface the pieces reach through their own token.\n */\nexport interface ForSelectOverlayFacade {\n /** The active trigger's id, or `''` while no trigger is registered. */\n readonly triggerId: Signal<string>;\n /** The content surface's stable id, adopted from a consumer-set static id when present. */\n readonly contentId: Signal<string>;\n /** Reason of the most recent close, or `null` while open (or before any close). */\n readonly lastCloseReason: Signal<ForSelectCloseReason | null>;\n /**\n * Registers the element `[forSelectContent]` is positioned against, instead of\n * the trigger. The declarative `[forSelectAnchor]` covers the common case; call\n * this directly when the anchor element is only reachable imperatively — it\n * lives in an ancestor component's template, so a directive placed on it would\n * resolve DI outside this root. One anchor per `[forSelect]`: a second one\n * warns in dev mode, and the most recently registered one is used.\n */\n registerAnchor(el: HTMLElement): void;\n /** Unregisters the positioning anchor, falling back to the trigger. Reference-based. */\n unregisterAnchor(el: HTMLElement): void;\n /** Opens the listbox with the requested initial-focus target. */\n openOverlay(initialFocus: ForSelectInitialFocus): void;\n /** Closes the listbox, recording `reason` as the last close reason. */\n closeOverlay(reason: ForSelectCloseReason): void;\n /** Opens the listbox when closed (with `initialFocus`), closes it when open. */\n toggle(initialFocus: ForSelectInitialFocus): void;\n}\n\n/**\n * The shared overlay-listbox coordination surface backing\n * {@link ForSelectOverlayFacade}: trigger / anchor / content registries + ids,\n * DOM-focus navigation and open-state typeahead, the open / close machine, the initial-focus /\n * close-reason state, and the dismiss / auto-focus emit forwarders. Backed by\n * the shared `ListboxOverlayController`, so child directives read it here\n * instead of the root re-forwarding each member.\n *\n * Internal — never re-exported from `public-api.ts`; pieces reach it through\n * {@link SelectContext}.\n */\nexport type ForSelectOverlayContext<T = unknown> = ListboxOverlayPieceContext<\n ForSelectOptionHandle<T>,\n ForSelectInitialFocus,\n ForSelectCloseReason\n>;\n\n/**\n * Coordination contract owned by `[forSelect]` — the surface a consumer reads\n * and drives. Advanced consumers inject the token to read the selection and the\n * open state and to move them through the root's guards (`activate` /\n * `selectAll`, plus the open / close commands on {@link ForSelectContext.overlay}).\n * The wiring the library's own pieces read off the root is not\n * part of it.\n *\n * Generic over the option value type `T` (default `string` at the public\n * root). When a consumer binds object items the directive infers `T` from\n * `[(value)]` and the per-piece signatures specialize accordingly. Items are\n * compared via the consumer-provided `compareWith` and serialized for\n * the form's hidden inputs via `itemToFormValue`; option text labels are\n * still read from the rendered `textContent`.\n */\nexport interface ForSelectContext<T = unknown> {\n /**\n * The current selection, as a read-only signal. Mutate it through the guarded\n * methods (`activate` / `selectAll`) or the root's `[(value)]` binding — a\n * direct write would bypass the root's disabled / readonly guards and\n * `markTouched`.\n */\n readonly value: Signal<readonly T[]>;\n /**\n * Whether the listbox is open, as a read-only signal. Mutate it through\n * `overlay.toggle` / `overlay.openOverlay` / `overlay.closeOverlay` or the root's\n * `[(open)]` binding.\n */\n readonly open: Signal<boolean>;\n readonly multiple: Signal<boolean>;\n\n /**\n * The select's effective disabled — its own `disabled` input OR'd with a\n * surrounding disabled `[forFieldset]`. Trigger and options read this so a\n * disabled select (or fieldset) is inert: the trigger reflects the native\n * `disabled` attribute (its single channel) and the options, which\n * must stay focusable, reflect `aria-disabled`.\n */\n readonly effectiveDisabled: Signal<boolean>;\n readonly readonly: Signal<boolean>;\n readonly required: Signal<boolean>;\n readonly invalid: Signal<boolean>;\n readonly pending: Signal<boolean>;\n\n readonly dir: Signal<WritingDirection>;\n readonly placeholder: Signal<string>;\n\n /**\n * The consumer-facing slice of the overlay surface: the trigger / content ids,\n * the last close reason, and the open / close commands. The registration and\n * navigation machinery behind it is internal — see\n * {@link ForSelectOverlayFacade}.\n */\n readonly overlay: ForSelectOverlayFacade;\n\n /** Resolved labels of the options whose value is in `value()`, in selection order. */\n readonly selectedLabels: Signal<readonly string[]>;\n\n isSelected(value: T): boolean;\n /** Toggle in multi-mode, replace + close in single-mode. No-op on disabled / readonly. */\n activate(value: T | Unset): void;\n\n /**\n * Multi-select only (APG range keyboard, Ctrl/Cmd+A). Add every enabled\n * rendered option to the selection, or remove them when they are all already\n * selected (toggle). Selected values that are not an enabled rendered option\n * are kept. In the virtualized path that is the rendered window only, not the\n * whole source. No-op in single mode, disabled, or readonly.\n */\n selectAll(): void;\n\n /** Flip the `touched` model. Called by trigger on blur-to-outside and on dismiss events. */\n markTouched(): void;\n}\n\n/**\n * The select's piece-coordination surface: everything the library's own pieces\n * read off the root that a consumer has no call to touch — the positioning\n * mirrors `[forSelectContent]` feeds to floating-ui, the APG range-selection and\n * typeahead handlers `[forSelectOption]` routes its keys through, and the\n * virtualized activedescendant model.\n *\n * **Not** part of {@link ForSelectContext} and never exported from\n * `public-api.ts`: these are the members a refactor of the anatomy moves, so\n * freezing them at 1.0 would freeze the anatomy with them.\n */\nexport interface SelectPieceContext<T = unknown> {\n /**\n * When `true`, the listbox is a trapped / inert / scroll-locked modal\n * surface (routed through the core modal shell) instead of the anchored\n * popover. Read once when `[forSelectContent]` mounts; all anchored-\n * positioning state below is a no-op while modal.\n */\n readonly modal: Signal<boolean>;\n /**\n * Whether the mounted `[forSelectContent]` runs the modal shell: the mode it latched at mount,\n * or {@link SelectPieceContext.modal} while no content is mounted. The Tab handlers branch on\n * this, because a `[modal]` rebind reaches only the next mount.\n */\n readonly mountedModal: Signal<boolean>;\n /** Called by `[forSelectContent]` with the mode its shell runs in. */\n registerContentModal(modal: Signal<boolean>): void;\n /** Called by `[forSelectContent]` on destroy; a no-op unless `modal` is the registered one. */\n unregisterContentModal(modal: Signal<boolean>): void;\n /**\n * Called by `[forSelectVirtualized]` from its constructor. Hands the root the\n * virtualized focus model and returns the root state that model reads and\n * writes.\n */\n registerVirtualization(virtualization: SelectVirtualization): SelectVirtualizationHost;\n readonly dismissible: Signal<boolean>;\n readonly returnFocus: Signal<boolean>;\n /**\n * Positioning algorithm. `'popper'` (default) is standard floating-ui\n * anchored placement; `'item-aligned'` overlays the listbox so the\n * selected option's center aligns with the trigger's center (macOS-style\n * native `<select>`). All `side`/`align`/`*Offset`/`sticky`/\n * `hideWhenDetached`/`clipUntilPositioned`/`avoidCollisions` inputs are no-ops in\n * `'item-aligned'` mode (only `collisionPadding` is honored).\n */\n readonly position: Signal<'popper' | 'item-aligned'>;\n readonly side: Signal<FloatingSide | undefined>;\n readonly align: Signal<FloatingAlign | undefined>;\n readonly sideOffset: Signal<number>;\n readonly alignOffset: Signal<number>;\n readonly avoidCollisions: Signal<boolean>;\n readonly collisionPadding: Signal<number>;\n readonly sticky: Signal<'partial' | 'always' | false>;\n readonly hideWhenDetached: Signal<boolean>;\n readonly clipUntilPositioned: Signal<boolean>;\n readonly loop: Signal<boolean>;\n readonly orientation: Signal<'horizontal' | 'vertical'>;\n readonly selectionFollowsFocus: Signal<boolean>;\n\n readonly ariaLabel: Signal<string | null>;\n\n /**\n * The `[forSelect]` root (wrapper) element. Lets the trigger tell a focus\n * move to a sibling *inside* the wrapper (e.g. a clear button next to the\n * trigger) apart from a genuine focus leave, so `touched` isn't flipped\n * prematurely when focus stays within the control.\n */\n readonly host: HTMLElement;\n\n /** Compare two items for equality. Defaults to `===`; overridden for object values. */\n readonly compareWith: Signal<(a: T, b: T) => boolean>;\n /** Serialize an item for the hidden input's `value` attribute. Defaults to `String(item)`. */\n readonly itemToFormValue: Signal<(item: T) => string>;\n\n /**\n * Host element of the first enabled, currently-selected option, or `null`\n * when no selection exists. Used by `position=\"item-aligned\"` to anchor\n * the listbox over the trigger; falls back to the first enabled option\n * inside the listbox when this is `null`.\n */\n readonly selectedOptionEl: Signal<HTMLElement | null>;\n\n /**\n * Multi-select only (APG range keyboard). Move focus to the next / previous\n * enabled option and toggle it in/out of the selection, without moving the\n * range anchor. Non-wrapping. No-op in single mode, when disabled, or in the\n * virtualized path. Focus still moves under `readonly`; only the selection\n * mutation is blocked.\n */\n extendByArrow(currentOption: HTMLElement, action: 'next' | 'prev'): void;\n /**\n * Multi-select only (APG range keyboard, Shift+Space). Add every enabled\n * option between the range anchor and the focused option to the selection,\n * preserving any selection outside the span. Falls back to selecting just the\n * focused option when no anchor exists. No-op in single mode, disabled,\n * readonly, or the virtualized path.\n */\n selectRangeToFocused(currentOption: HTMLElement): void;\n /**\n * Multi-select only (APG range keyboard, Ctrl+Shift+Home / End). Add every\n * enabled option from the focused option to the first / last option to the\n * selection and move focus to that edge, preserving any selection outside the\n * span. No-op in single mode, disabled, or the virtualized path. Focus still\n * moves under `readonly`; only the selection mutation is blocked.\n */\n selectFromCurrentToEdge(currentOption: HTMLElement, edge: 'first' | 'last'): void;\n /**\n * Closed-state typeahead (single mode only). Selects the first enabled\n * matching option directly without opening the listbox — mirrors native\n * `<select>` behavior. Returns `true` if the key was consumed by typeahead.\n */\n handleClosedTypeahead(event: KeyboardEvent): boolean;\n\n /** Focus the first enabled option whose value is currently selected. Returns `false` if none. */\n focusSelectedOption(): boolean;\n /**\n * Scroll the option initial focus landed on into view, or the selected option\n * when the `(autoFocusOnOpen)` veto left focus on none, unless that option is\n * the first enabled one, already in view at the top. Driven from\n * `[forSelectContent]`'s positioner first-resolved-position hook\n * (`onFirstPosition`) in both positioning modes — the only moment both\n * prerequisites hold: the surface has been portaled to `document.body`\n * (resetting its `scrollTop` to 0) and is bounded by the CSS var the\n * positioner just wrote (so it is actually scrollable). The focus move itself\n * runs earlier, before the surface is bounded, so its own scroll is lost.\n * No-op while virtualizing: the navigator owns the virtualized scroll.\n */\n revealInitialFocus(): void;\n\n /**\n * The overlay shell's Tab-out wiring for `[forSelectContent]`: a Tab leaving\n * the surface from anything that is not an option continues from the trigger.\n * Inert while virtualizing, where the content's own keydown owns Tab.\n */\n readonly tabOut: { readonly target: () => HTMLElement | null; readonly close: () => void };\n\n /**\n * Commit the focused option's value (single mode) and close the listbox\n * with reason `'tab'`. Moves focus to the trigger synchronously so the\n * browser's Tab default action advances focus from there to the next\n * (or previous) focusable in tab order, never into the closing listbox.\n * Multi-mode skips the value-set — selection toggles already happened via\n * Space / Enter / click.\n */\n commitOnTab(value: T | Unset, event: KeyboardEvent): void;\n\n /**\n * Full source length when virtualizing, `undefined` in the default\n * DOM-focus path. Drives each option's `aria-setsize` / `aria-posinset`\n * and the focus-model branch.\n */\n readonly totalCount: Signal<number | undefined>;\n /**\n * The active option's `id` in the virtualized activedescendant model,\n * `null` in the default path. The content surface reflects it as\n * `aria-activedescendant`; options read it for `data-highlighted`.\n */\n readonly activeDescendantId: Signal<string | null>;\n /**\n * Virtualized-path open hook. Called by `[forSelectContent]` after it\n * focuses its own surface on open: seeds `aria-activedescendant` to the\n * committed option (scrolling it into view via `(scrollToIndex)`) when its\n * position is known — in the rendered window, previously rendered, or\n * supplied via the root's `[selectedIndex]`; otherwise focuses the first\n * enabled option.\n */\n seedVirtualizedInitialFocus(): void;\n /**\n * Virtualized-path keyboard handler. Called by `[forSelectContent]`'s host\n * keydown only when `totalCount()` is set: Arrow/Home/End navigation,\n * Enter/Space activation of the active descendant, single-mode Tab commit,\n * and typeahead — all in the activedescendant model.\n */\n handleVirtualizedKeydown(event: KeyboardEvent): void;\n /**\n * Called by an option on click in the virtualized path: moves\n * `aria-activedescendant` to that option and returns DOM focus to the\n * content surface. No-op in the default path.\n */\n notifyOptionClick(optionId: string): void;\n\n /**\n * Host element of the option the pointer is over in the default DOM-focus\n * path, `null` when the pointer is over none. Self-heals on read: a host that\n * has left the registered set or become disabled is discounted, so the focused\n * option reclaims the highlight. Always `null` in the virtualized path, where\n * hover moves {@link SelectPieceContext.activeDescendantId} itself.\n */\n readonly pointerHighlightedOption: Signal<HTMLElement | null>;\n /**\n * Reported by `[forSelectOption]` on `pointermove` so the highlight follows\n * the pointer. Never moves DOM focus, so it never commits a selection — not\n * even under `selectionFollowsFocus`, whose commit hangs off the navigation\n * focus move — and never touches the range anchor. A move arriving inside the\n * pointer-suppression window a programmatic scroll opened is ignored, or a\n * scroll sliding a different option under a stationary cursor would hand the\n * highlight to whatever the user merely scrolled past.\n *\n * @param host The hovered option's host — the DOM-focus path's highlight target.\n * @param id The hovered option's id — the virtualized path's highlight target.\n */\n highlightFromPointer(host: HTMLElement, id: string): void;\n /**\n * Called by an option when it takes DOM focus: drops any pointer highlight, so\n * the keyboard channel owns the highlight again from the move that focused the\n * option.\n */\n notifyOptionFocus(): void;\n /**\n * Called by `[forSelectContent]` when the pointer leaves the listbox surface:\n * drops any pointer highlight, so the focused option reclaims it instead of a\n * row staying decorated with the cursor elsewhere on the page. Crossing\n * between two adjacent options is not a leave, so the highlight never blinks\n * off. No-op in the virtualized path, where the pointer's claim *is*\n * {@link SelectPieceContext.activeDescendantId} and releasing it would leave\n * the container with no active option.\n */\n releasePointerHighlight(): void;\n}\n\n/**\n * The virtualized `aria-activedescendant` focus model `[forSelectVirtualized]`\n * lends the root. The root depends on this shape alone, so a select without the\n * piece never references the navigation engine.\n */\nexport interface SelectVirtualization<T = unknown> {\n /** Full source length, or `undefined` while the piece is present but unset. */\n readonly totalCount: Signal<number | undefined>;\n /** The open-time reveal hint the consumer bound, if any. */\n readonly selectedIndex: Signal<number | undefined>;\n /** The position the root resumes from once its active option unmounts. */\n readonly resume: VirtualizedResume<T, SelectPositionEntry<T>>;\n /** The navigation engine, constructed on first use. */\n navigator(): SelectVirtualizedNavigator<T>;\n /**\n * Rejects a multi-select range shortcut, which the virtualized path does not\n * support. Returns `true` when `event` was one, after preventing its default.\n */\n rejectRangeSelect(event: KeyboardEvent): boolean;\n}\n\n/** The root state the virtualized focus model reads and writes. */\nexport interface SelectVirtualizationHost<T = unknown> {\n /** The registered options — the rendered window. */\n readonly items: Signal<readonly ForSelectOptionHandle<T>[]>;\n /** Whether arrow navigation wraps at the ends. */\n readonly loop: () => boolean;\n /** The active option's id. */\n getActiveId(): string | null;\n /** Move the active option, forgetting any retained resume position. */\n setActiveId(id: string | null): void;\n /** Scroll an option into view with the pointer-suppression window open. */\n scrollActiveIntoView(host: HTMLElement): void;\n}\n\n/**\n * DI token for the select's coordination surface, provided by `[forSelect]`.\n *\n * Publicly typed as the read surface {@link ForSelectContext}, which is the whole of what\n * the token promises a consumer — `overlay` included, narrowed there to\n * {@link ForSelectOverlayFacade}. The pieces read the same token at an internal type that\n * widens it to the full overlay controller, so a wrapper re-providing it must alias it to\n * the root: `{ provide: FOR_SELECT_CONTEXT, useExisting: MySelect }`, where `MySelect`\n * extends `ForSelect`. A value that merely satisfies the declared type resolves too, and is\n * rejected in dev mode by the first piece to reach the controller.\n */\nexport const FOR_SELECT_CONTEXT = new InjectionToken<ForSelectContext>('FOR_SELECT_CONTEXT');\n\nexport const SELECT_TRIGGERS = new InjectionToken<RootedRegistry<object, RootedTriggerHandle>>(\n 'SELECT_TRIGGERS',\n { providedIn: 'root', factory: () => new RootedRegistry() },\n);\n\n/**\n * The select's internal coordination surface: everything {@link ForSelectContext}\n * publishes, plus the {@link SelectPieceContext} members and the full overlay\n * state machine instead of the consumer facade.\n *\n * Never exported from `public-api.ts`. It is the type the pieces read\n * {@link FOR_SELECT_CONTEXT} at, so a consumer who injects that token gets the\n * read surface while the pieces get the wiring protocol. `ForSelect` declares\n * `overlay` with the narrow public type and the piece members TS-`private`,\n * which keeps both out of the emitted `.d.ts` while `useExisting` still\n * satisfies this contract at runtime.\n */\nexport interface SelectContext<T = unknown> extends ForSelectContext<T>, SelectPieceContext<T> {\n readonly overlay: ForSelectOverlayContext<T>;\n}\n\nexport function injectSelectContext<T = unknown>(piece: string): SelectContext<T> {\n const ctx = inject(FOR_SELECT_CONTEXT, { optional: true });\n if (!ctx) {\n throw orphanContextError({\n code: 'FORCDK-SELECT-001',\n piece,\n root: '[forSelect]',\n token: 'FOR_SELECT_CONTEXT',\n });\n }\n const widened = ctx as unknown as SelectContext<T>;\n assertRootContext({\n entryPoint: 'select',\n token: 'FOR_SELECT_CONTEXT',\n root: '[forSelect]',\n piece,\n probe: () => widened.overlay.setInitialFocus,\n });\n return widened;\n}\n\n/**\n * Resolves the trigger's root context: the explicit reference when the\n * `[forSelectTrigger]` input carries one, the injected `FOR_SELECT_CONTEXT`\n * otherwise. `root` is `null` while neither resolves; `ctx` throws the orphan\n * error on read in that state. Must be called in an injection context.\n *\n * The explicit reference is a public `ForSelectContext`, so it is widened back\n * to the internal surface: the runtime object is always the `[forSelect]` root,\n * which owns the full overlay controller — the public interface only narrows\n * `overlay` to the consumer facade. Both paths are guarded, on read rather than\n * at injection time, because the explicit one only resolves inside the\n * `computed`; the explicit widening predates the one-token collapse\n * and was never\n * checked either.\n */\nexport function injectSelectTriggerContext<T = unknown>(\n explicitRoot: Signal<ForSelectContext<T> | ''>,\n): {\n readonly root: Signal<ForSelectContext<T> | ForSelectContext | null>;\n readonly ctx: Signal<SelectContext<T>>;\n} {\n const injected = inject(FOR_SELECT_CONTEXT, { optional: true });\n const root = computed(() => {\n const explicit = explicitRoot();\n return explicit === '' ? injected : explicit;\n });\n const ctx = computed(() => {\n const resolved = root();\n if (!resolved) {\n throw unresolvedRootError({\n code: 'FORCDK-SELECT-002',\n trigger: '[forSelectTrigger]',\n root: '[forSelect]',\n token: 'FOR_SELECT_CONTEXT',\n exportAs: 'forSelect',\n });\n }\n const widened = resolved as unknown as SelectContext<T>;\n assertRootContext({\n entryPoint: 'select',\n token: 'FOR_SELECT_CONTEXT',\n root: '[forSelect]',\n piece: 'ForSelectTrigger',\n probe: () => widened.overlay.setInitialFocus,\n });\n return widened;\n });\n return { root, ctx };\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n signal,\n type Signal,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport {\n accessibleTextContent,\n assertVirtualizedSelectionFollowsFocusSupported,\n createPointerHighlight,\n injectHiddenInput,\n injectNativeFormResetToInitial,\n LabelCache,\n lookupByValue,\n resolveCommittedPosition,\n resolveListNavigation,\n type WritingDirection,\n RangeSelectionEngine,\n defaultCompareWith,\n defaultItemToFormValue,\n isUnset,\n selectionMembership,\n singleSelected,\n toggleInArray,\n injectReflectedDirection,\n injectTextDirection,\n findTypeaheadMatch,\n injectTypeahead,\n type VetoableEvent,\n type VetoableNativeEvent,\n boundEntries,\n type Unset,\n} from 'forty-cdk/core';\nimport { warnIfOpenWithoutContent } from 'forty-cdk/core-overlay';\nimport { AnchoredFormValueControlBase, ListboxOverlayController } from 'forty-cdk/core-anchored';\nimport {\n FOR_SELECT_CONTEXT,\n SELECT_TRIGGERS,\n type ForSelectCloseReason,\n type ForSelectContext,\n type ForSelectInitialFocus,\n type ForSelectOptionHandle,\n type ForSelectOverlayFacade,\n type SelectVirtualization,\n type SelectVirtualizationHost,\n} from './select-context';\nimport { FOR_SELECT_DEFAULTS } from 'forty-cdk/defaults';\n\n/**\n * Headless implementation of the [WAI-ARIA select-only combobox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/).\n * Implements `FormValueControl<readonly T[]>` from\n * `@angular/forms/signals` for `[formField]` auto-wiring.\n *\n * Generic over the option value type `T` (default `string`). When the\n * consumer binds object items the directive infers `T` from `[(value)]` and\n * `[forSelectOption][value]`; object identity is resolved by the\n * consumer-supplied `[compareWith]` and the hidden inputs serialize\n * via `[itemToFormValue]`. Option display text is read from the rendered\n * `textContent`, so no separate label function is needed — supply the\n * optional `[itemToLabel]` only when a pre-set object value must render its\n * label before the listbox is ever opened (the documented `@if (open())`\n * pattern).\n *\n * Selection is always modeled as `readonly T[]`:\n * - In single mode (`multiple=false`, default), the array has 0 or 1 element\n * and option activation closes the listbox.\n * - In multi mode, option activation toggles and the listbox stays open.\n *\n * Typeahead has two modes mirroring native `<select>`:\n * - **Closed trigger** (single mode only): printable keys select the matching\n * option immediately without opening the listbox.\n * - **Open listbox**: printable keys move focus to the first matching option\n * (selection still requires Enter / Space / click).\n *\n * Both match an option's `textValue` when set, else `[itemToLabel]` of its value, else its\n * rendered text.\n */\n@Directive({\n selector: '[forSelect]',\n exportAs: 'forSelect',\n host: {\n '[attr.data-state]': 'open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'effectiveDisabled() ? \"\" : null',\n '[attr.data-readonly]': 'readonly() ? \"\" : null',\n '[attr.dir]': 'reflectedDir()',\n },\n providers: [{ provide: FOR_SELECT_CONTEXT, useExisting: ForSelect }],\n})\nexport class ForSelect<T = string>\n extends AnchoredFormValueControlBase\n implements FormValueControl<readonly T[]>, ForSelectContext<T>\n{\n readonly #typeahead = injectTypeahead();\n readonly #closedTypeahead = injectTypeahead();\n readonly #defaults = inject(FOR_SELECT_DEFAULTS);\n protected readonly positioningDefaults = this.#defaults;\n\n /** The `[forSelect]` root element (see `SelectPieceContext.host`). */\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n /**\n * Two-way bindable. Selected option values. Single-mode keeps 0 or 1\n * element. The `model()` change emitter (`(valueChange)`) fires only on\n * internal selection changes, never on consumer writes via `[(value)]`.\n */\n readonly value = model<readonly T[]>([]);\n\n /**\n * Compare two items for equality. Defaults to `===`, which is the\n * correct identity for primitive `T` (e.g. strings, numbers). Override\n * when binding object items so the directive can locate selected entries\n * by id (or any other stable key) instead of by reference:\n * `[compareWith]=\"(a, b) => a.id === b.id\"`.\n */\n readonly compareWith = input<(a: T, b: T) => boolean>(defaultCompareWith);\n\n /**\n * Serialize an item for the hidden input that participates in native\n * form submission. Defaults to identity for strings and to\n * `JSON.stringify` for non-string items so the primitive works out of\n * the box round-tripping objects. Override to emit a specific wire\n * format — typically a per-item id — when the backend expects that:\n * `[itemToFormValue]=\"(it) => it.id\"`.\n */\n readonly itemToFormValue = input<(item: T) => string>(defaultItemToFormValue);\n\n /**\n * Resolve the display label for an item without the listbox mounted.\n * When set, {@link selectedLabels} (and therefore `[forSelectValue]`)\n * renders this for any selected value, so a pre-set object value shows\n * its label on first paint — before the listbox has ever been opened, in\n * the documented `@if (forSelect.open())` pattern. Without it, object-value\n * labels resolve from the rendered option `textContent`, which is only\n * available once the content mounts; the serialized form value is shown as\n * a last-resort fallback in the meantime: `[itemToLabel]=\"(c) => c.name\"`.\n *\n * Typeahead matches this label too, on the open listbox and on the closed trigger, for every\n * option that sets no `textValue` of its own.\n *\n * Defaults to `undefined` (string mode renders the value verbatim, so no\n * label function is needed).\n */\n readonly itemToLabel = input<((item: T) => string) | undefined>(undefined);\n\n /**\n * Read-only single-select convenience view of {@link value}. Returns the\n * sole value when exactly one is selected (regardless of `multiple`),\n * otherwise `null` (zero, or 2+ selected). Lets single-select consumers\n * read `selected()` instead of unwrapping `value()[0]`. The array-backed\n * `value` model remains the source of truth and the `FormValueControl`\n * contract; this is a derived accessor.\n */\n readonly selected = singleSelected(this.value);\n\n /**\n * Two-way bindable. Whether the listbox is currently shown. The `model()`\n * change emitter (`(openChange)`) fires only on internal transitions\n * (trigger toggle, Escape, outside dismissal, single-mode option select),\n * never on consumer writes via `[(open)]`.\n */\n readonly open = model<boolean>(false);\n\n /**\n * When true, multiple options can be selected and option activation toggles\n * without closing the listbox. Single mode (default) keeps the value array at\n * 0 or 1 element and closes on select.\n *\n * In the default (non-virtualized) path the full APG range keyboard\n * (Shift+Arrow, Shift+Space, Ctrl/Cmd+A, Ctrl+Shift+Home/End) extends the\n * selection, matching `ForListbox`.\n *\n * That range keyboard is not supported together with virtualization\n * (`[forSelectVirtualized]` with `totalCount` set): range selection needs the full set of enabled options\n * across the range, which is unavailable while the list is partially\n * unmounted. Pressing one of those combinations on a virtualized multi-select\n * listbox throws in dev mode. Toggle options individually with Enter, Space,\n * or click, or drop `totalCount` to use the non-virtualized DOM-focus listbox.\n */\n readonly multiple = input(false, { transform: booleanAttribute });\n\n /**\n * Presentation mode. When `true`, `[forSelectContent]` mounts as a trapped /\n * inert / scroll-locked modal surface instead of the default anchored popover — the batteries-included touch\n * presentation a consumer opts into with `[modal]=\"isCoarsePointer()\"`. The\n * form-value wiring (`[(value)]`, `name`) is unchanged.\n *\n * Read when the content mounts, so a change takes effect on the next open.\n * Every anchored-positioning input — `position`, `side`, `align`,\n * `sideOffset`, `alignOffset`, `sticky`, `hideWhenDetached`,\n * `clipUntilPositioned`, `avoidCollisions`, `collisionPadding` — is a no-op\n * in this mode. Default `false`. The swipe / snap-point sheet is not this\n * mode — compose a `ForListbox` inside a `ForDrawer` for that.\n */\n readonly modal = input(false, { transform: booleanAttribute });\n\n /**\n * Positioning algorithm.\n *\n * - `'popper'` (default): standard floating-ui anchored placement using\n * `side` / `align` / `sideOffset` / `alignOffset`, with `flip` + `shift`\n * collision handling. Same path as Popover / DropdownMenu.\n * - `'item-aligned'`: the listbox overlays the trigger so the selected\n * option's vertical center aligns with the trigger's vertical center\n * — visually the menu \"snaps over\" the trigger when opened, mirroring\n * macOS native `<select>`. Falls back to the first enabled option when\n * nothing is selected. `side`, `align`, `sideOffset`, `alignOffset`,\n * `sticky`, `hideWhenDetached`, `clipUntilPositioned`, and `avoidCollisions` are ignored in\n * this mode; only `collisionPadding` is honored.\n */\n readonly position = input<'popper' | 'item-aligned'>('popper');\n\n /**\n * Whether arrow navigation wraps past the first / last enabled option. Default `true`.\n * The default is read from `provideForSelectDefaults` for the surrounding\n * scope.\n */\n readonly loop = input(this.#defaults.loop, { transform: booleanAttribute });\n\n /** Axis the arrow keys navigate. Reflected as `data-orientation` on the content. */\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n\n /**\n * Writing direction. When unset (default `null`), the inherited ambient direction is resolved\n * from the nearest ancestor carrying a `dir` attribute (or `<html dir>`), defaulting to `'ltr'`.\n * An explicit `[dir]` always wins. The resolved value is reflected to the host `dir` attribute\n * when a direction is set or declared.\n */\n readonly _dirInput = input<WritingDirection | null>(null, { alias: 'dir' });\n readonly dir = injectTextDirection(this._dirInput);\n private readonly reflectedDir = injectReflectedDirection(this._dirInput);\n\n /**\n * Single-mode only. When true, a keyboard focus move (arrow navigation or a\n * typeahead match) also selects the focused option while the listbox is\n * open. APG calls this optional and recommends caution — leave off unless\n * your UX truly benefits. When unset (default `undefined`), falls back to\n * `ForSelectDefaults.selectionFollowsFocus` from the surrounding\n * `provideForSelectDefaults` scope (`false` unless configured).\n *\n * Not supported together with virtualization (`[forSelectVirtualized]` with\n * `totalCount` set): the virtualized `aria-activedescendant` path resolves off-window navigation\n * targets asynchronously, so selection cannot follow focus there without\n * deriving the committed value from a render side effect. A virtualized select does not inherit\n * the scope default, and keyboard-navigating a virtualized single-select listbox that binds it to\n * `true` throws in dev mode, from the move the combination degrades.\n *\n * The input is aliased to `selectionFollowsFocus`; read the effective value through the public\n * `selectionFollowsFocus` computed below.\n */\n readonly _selectionFollowsFocusInput = input(undefined, {\n alias: 'selectionFollowsFocus',\n transform: (v: unknown): boolean | undefined => (v == null ? undefined : booleanAttribute(v)),\n });\n\n /** Effective `selectionFollowsFocus`: the input when set, else the scope default. */\n readonly selectionFollowsFocus = computed<boolean>(\n () => this._selectionFollowsFocusInput() ?? this.#defaults.selectionFollowsFocus,\n );\n\n /** Placeholder shown by `[forSelectValue]` when no option is selected. */\n readonly placeholder = input<string>('');\n\n /** When true (default), Escape, pointer-down outside, and focus outside close the listbox. */\n readonly dismissible = input(true, { transform: booleanAttribute });\n\n /**\n * When true (default), focus returns to the trigger after a close from Escape, from picking an\n * option or from setting `open` to `false`. A close from a press or focus outside the listbox, or\n * from a Tab out, leaves focus where the user moved it.\n */\n readonly returnFocus = input(true, { transform: booleanAttribute });\n\n /** Manual `aria-label` on `[forSelectContent]` when the trigger isn't a meaningful name. */\n readonly ariaLabel = input<string | null>(null);\n\n /** Emitted before Escape closes the listbox. Call `preventDefault()` to keep it open. */\n readonly escapeKeyDown = output<VetoableNativeEvent<KeyboardEvent>>();\n\n /** Emitted before an outside pointer-down closes the listbox. Vetoable with `preventDefault()`. */\n readonly pointerDownOutside = output<VetoableNativeEvent<PointerEvent>>();\n\n /** Emitted before focus leaving the surface closes the listbox. Vetoable with `preventDefault()`. */\n readonly focusOutside = output<VetoableNativeEvent<FocusEvent>>();\n\n /**\n * Emitted alongside {@link pointerDownOutside} and {@link focusOutside} for consumers that do not\n * care which one occurred. A `preventDefault()` on either channel suppresses the close.\n */\n readonly interactOutside = output<VetoableNativeEvent<PointerEvent | FocusEvent>>();\n\n /**\n * Fires just before the listbox sends focus to the selected option\n * (or first / last enabled) on mount. Call `preventDefault()` on the\n * emitted veto to skip the imperative focus move.\n */\n readonly autoFocusOnOpen = output<VetoableEvent>();\n\n /**\n * Fires just before focus returns to the trigger on unmount. Call\n * `preventDefault()` on the veto to suppress the return-focus.\n */\n readonly autoFocusOnClose = output<VetoableEvent>();\n\n readonly #virtualization = signal<SelectVirtualization<T> | null>(null);\n\n readonly #virtualized = computed(() => this.#virtualization()?.totalCount() !== undefined);\n\n /** Full source length while a `[forSelectVirtualized]` virtualizes the select. */\n private readonly totalCount = computed(() => this.#virtualization()?.totalCount());\n\n readonly #activeId = signal<string | null>(null);\n\n /** The mode the mounted `[forSelectContent]` published, `null` while none is mounted. */\n readonly #contentModal = signal<Signal<boolean> | null>(null);\n private readonly mountedModal = computed(() => this.#contentModal()?.() ?? this.modal());\n\n /**\n * Shared overlay-listbox state machine: option collection, trigger / anchor /\n * content registries + ids, DOM-focus navigation, the open / close machine,\n * the initial-focus / close-reason state, and the dismiss / auto-focus emit\n * forwarders. The value-specific behaviour (`isSelected`, `activate`,\n * `focusSelectedOption`, closed-state typeahead, the virtualized activedescendant path,\n * `commitOnTab`'s value set) stays in this root; close-time virtualized\n * cleanup and the post-navigate scroll / `selectionFollowsFocus` move are\n * threaded through the controller's side-effect callbacks.\n */\n readonly #controller = new ListboxOverlayController<\n ForSelectOptionHandle<T>,\n ForSelectInitialFocus,\n ForSelectCloseReason\n >({\n idPrefix: 'for-select',\n triggers: inject(SELECT_TRIGGERS).of(this),\n anchorSlot: { primitive: 'select', owner: '[forSelect]', claimant: '[forSelectAnchor]' },\n defaultInitialFocus: 'selected',\n effectiveDisabled: this.effectiveDisabled,\n setOpen: (open) => this.open.set(open),\n isOpen: () => this.open(),\n emit: {\n escapeKeyDown: this.escapeKeyDown,\n pointerDownOutside: this.pointerDownOutside,\n focusOutside: this.focusOutside,\n interactOutside: this.interactOutside,\n autoFocusOnOpen: this.autoFocusOnOpen,\n autoFocusOnClose: this.autoFocusOnClose,\n },\n loop: this.loop,\n dismissible: this.dismissible,\n escapeReason: 'escape',\n programmaticReason: 'programmatic',\n markTouched: () => this.markTouched(),\n onClose: () => {\n if (this.#virtualized()) {\n this.#activeId.set(null);\n this.#virtualModel().resume.clear();\n this.#virtualModel().navigator().resetPending();\n }\n },\n onNavigateFocus: (target) => this.#afterKeyboardFocus(target),\n typeaheadText: (o) => {\n const value = o.value();\n const fallback = () => accessibleTextContent(o.host);\n return isUnset(value) ? fallback() : this.#typeaheadText(o.textValue(), value, fallback);\n },\n onUnregisterOption: (handle) => {\n if (this.#virtualized() && this.#activeId() === handle.id()) {\n if (this.open()) {\n this.#virtualModel().resume.retain(handle.posInSet(), handle.value());\n }\n this.#activeId.set(null);\n }\n },\n });\n\n /**\n * The shared overlay-listbox coordination surface: trigger / anchor / content registration and\n * ids, DOM-focus navigation, the open / close machine, and the dismiss and auto-focus forwarders.\n *\n * Positioning prefers a registered `[forSelectAnchor]`, reached via `overlay.anchor`, and falls\n * back to the trigger.\n */\n readonly overlay: ForSelectOverlayFacade = this.#controller;\n\n private readonly tabOut = this.#controller.tabOut('tab', () => !this.#virtualized());\n\n /**\n * Shared APG range-selection state machine: owns the range anchor and the\n * Shift+Arrow / Shift+Space / Ctrl+A / Ctrl+Shift+Home/End actions plus the\n * single-mode idempotent select guard. The value-specific `activate` (which\n * also closes the listbox in single mode) and the virtualized activedescendant\n * path stay in this root; the range methods one-line delegate here.\n */\n readonly #rangeEngine = new RangeSelectionEngine<T, ForSelectOptionHandle<T>>({\n options: this.#controller.options,\n value: this.value,\n setValue: (v) => this.value.set(v),\n compareWith: this.compareWith,\n multiple: this.multiple,\n effectiveDisabled: this.effectiveDisabled,\n readonly: this.readonly,\n reveal: (host) => {\n host.focus();\n this.#scrollActiveIntoView(host);\n },\n });\n\n /** The active option's `id` in the virtualized path, `null` in the default path. */\n private readonly activeDescendantId = computed<string | null>(() =>\n this.#virtualized() ? this.#activeId() : null,\n );\n\n readonly #pointer = createPointerHighlight({\n items: () => this.#controller.options(),\n activeDescendant: {\n active: () => this.#virtualized(),\n claim: (id) => this.#setActiveId(id),\n },\n });\n\n private readonly pointerHighlightedOption = this.#pointer.pointed;\n\n /** The virtualized focus model; only reached while {@link #virtualized} holds. */\n #virtualModel(): SelectVirtualization<T> {\n return this.#virtualization()!;\n }\n\n #setActiveId(id: string | null): void {\n if (id !== null) {\n this.#virtualization()?.resume.clear();\n }\n this.#activeId.set(id);\n }\n\n private registerVirtualization(virtualization: SelectVirtualization): SelectVirtualizationHost {\n this.#virtualization.set(virtualization as unknown as SelectVirtualization<T>);\n return {\n items: this.#controller.options,\n loop: this.loop,\n getActiveId: () => this.#activeId(),\n setActiveId: (id) => this.#setActiveId(id),\n scrollActiveIntoView: (host) => this.#scrollActiveIntoView(host),\n };\n }\n\n /**\n * Bounded option-label cache. The live `options` registry is empty whenever\n * `[forSelectContent]` is unmounted, so {@link selectedLabels} reads the selection-keyed\n * projection and {@link handleClosedTypeahead} the last-window one.\n *\n * Because the window store is replaced rather than merged, a removal performed while the listbox\n * is **closed** cannot refresh it, so closed-state typeahead can still commit a value that no\n * longer exists until the next open. When virtualizing, the window is the rendered slice, so a\n * closed-state match is scoped to it. Selected labels are unaffected — they live in the\n * selection-keyed projection for as long as the value stays selected.\n */\n readonly #labelCache = new LabelCache<T>({\n items: this.#controller.options,\n value: this.value,\n itemToFormValue: this.itemToFormValue,\n compareWith: this.compareWith,\n });\n\n /**\n * Trimmed display labels of the selected values, in selection order. Pure\n * derivation: when `[itemToLabel]` is supplied it is authoritative; otherwise\n * resolve from the selection-keyed label cache, then the serialized form value\n * so non-string items still render meaningfully on a cold cache.\n *\n * The cache's labels come from each option's reactive `label` signal,\n * which reads the rendered `textContent`. `textContent` is not a signal, so a\n * label whose rendered text changes without a value change does not self-heal\n * here — supply `[itemToLabel]` for a pure signal derivation that observes\n * label changes directly.\n */\n readonly selectedLabels = computed<readonly string[]>(() => {\n const values = this.value();\n if (values.length === 0) {\n return [];\n }\n // When `[itemToLabel]` is supplied it is authoritative: the label resolves\n // without the listbox mounted, so a pre-set object value renders correctly\n // on first paint in the documented `@if (open())` pattern and never flickers\n // from a serialized id to the real label once the listbox is first opened.\n const itemToLabel = this.itemToLabel();\n if (itemToLabel) {\n return values.map(itemToLabel);\n }\n const cached = lookupByValue(\n this.#labelCache.selectedEntries(),\n (entry) => entry.value,\n this.compareWith(),\n );\n const toFormValue = this.itemToFormValue();\n return values.map(\n (v) => cached(v)?.label ?? (typeof v === 'string' ? (v as string) : toFormValue(v)),\n );\n });\n\n private readonly selectedOptionEl = computed<HTMLElement | null>(() => {\n const values = this.value();\n if (values.length === 0) {\n return null;\n }\n const byValue = lookupByValue(\n boundEntries(this.#controller.options(), (o) => o.value()),\n (entry) => entry.value,\n this.compareWith(),\n );\n for (const v of values) {\n const entry = byValue(v);\n if (entry) {\n return entry.handle.host;\n }\n }\n return null;\n });\n\n readonly #isSelected = selectionMembership(this.value, this.compareWith);\n\n protected override fieldLabelledElement(): HTMLElement | null {\n return this.#controller.trigger();\n }\n\n protected override fieldLabelledElementId(): string | null {\n return this.#controller.triggerId() || null;\n }\n\n /**\n * Move focus to the trigger, implementing `FormValueControl.focus` from\n * `@angular/forms/signals`. Without this override Signal Forms would focus the\n * host `[forSelect]` wrapper — which carries no focusable role — so\n * focus-on-error would silently go nowhere. No-op when disabled or before the\n * trigger has registered.\n */\n override focus(options?: FocusOptions): void {\n if (this.effectiveDisabled()) {\n return;\n }\n this.#controller.trigger()?.focus(options);\n }\n\n constructor() {\n super();\n warnIfOpenWithoutContent({\n primitive: 'select',\n piece: '[forSelectContent]',\n condition: 'select.open()',\n open: this.open,\n content: this.#controller.content,\n });\n injectHiddenInput<T>({\n name: this.name,\n values: this.value,\n serialize: (item) => this.itemToFormValue()(item),\n disabled: this.effectiveDisabled,\n required: this.required,\n focus: () => this.focus(),\n });\n injectNativeFormResetToInitial(this.value);\n\n // @sanctioned-pull(label-cache-window): the option window exists only while\n // the listbox is open, and the closed-state typeahead reading it has no\n // reader during that cycle.\n effect(() => {\n if (this.open()) {\n this.#labelCache.prime();\n }\n });\n }\n\n isSelected(v: T): boolean {\n return this.#isSelected()(v);\n }\n\n activate(v: T | Unset): void {\n if (this.effectiveDisabled() || this.readonly() || isUnset(v)) {\n return;\n }\n if (this.multiple()) {\n this.value.set(toggleInArray(this.value(), v, this.compareWith()));\n this.#rangeEngine.setAnchor(v);\n return;\n }\n this.#rangeEngine.selectSingle(v);\n this.#rangeEngine.setAnchor(v);\n this.#controller.closeOverlay('select');\n }\n\n private extendByArrow(currentOption: HTMLElement, action: 'next' | 'prev'): void {\n this.#rangeEngine.extendByArrow(currentOption, action);\n }\n\n private selectRangeToFocused(currentOption: HTMLElement): void {\n this.#rangeEngine.selectRangeToFocused(currentOption);\n }\n\n selectAll(): void {\n this.#rangeEngine.selectAll();\n }\n\n private selectFromCurrentToEdge(currentOption: HTMLElement, edge: 'first' | 'last'): void {\n this.#rangeEngine.selectFromCurrentToEdge(currentOption, edge);\n }\n\n #afterKeyboardFocus(target: ForSelectOptionHandle<T>): void {\n this.#scrollActiveIntoView(target.host);\n if (!this.multiple() && this.selectionFollowsFocus() && !this.readonly()) {\n this.#rangeEngine.selectSingle(target.value());\n }\n }\n\n /**\n * The text typeahead matches an option against, on every path: its `textValue`, else\n * `[itemToLabel]` of its value, else `fallback` (its accessible text).\n */\n #typeaheadText(textValue: string, value: T, fallback: () => string): string {\n if (textValue) {\n return textValue;\n }\n const itemToLabel = this.itemToLabel();\n return itemToLabel ? itemToLabel(value) : fallback();\n }\n\n private handleClosedTypeahead(event: KeyboardEvent): boolean {\n // Only single-mode replicates native <select>'s \"type-to-select\" behavior.\n // Multi-select is ambiguous (which one wins?) — caller falls back to opening.\n if (this.multiple() || this.effectiveDisabled() || this.readonly()) {\n return false;\n }\n if (!this.#closedTypeahead.handle(event)) {\n return false;\n }\n const cached = this.#labelCache.windowEntries();\n const selected = this.selected();\n const equals = this.compareWith();\n const anchorIndex = selected === null ? -1 : cached.findIndex((o) => equals(o.value, selected));\n const match = findTypeaheadMatch(\n cached,\n {\n buffer: this.#closedTypeahead.buffer(),\n repeated: this.#closedTypeahead.isRepeatedChar(),\n anchorIndex,\n },\n (o) => this.#typeaheadText(o.textValue ?? '', o.value, () => o.label),\n (o) => o.disabled,\n );\n if (match) {\n this.#rangeEngine.selectSingle(match.value);\n }\n return true;\n }\n\n private focusSelectedOption(): boolean {\n const values = this.value();\n if (values.length === 0) {\n return false;\n }\n const byValue = lookupByValue(\n boundEntries(\n this.#controller.options().filter((o) => !o.disabled()),\n (o) => o.value(),\n ),\n (entry) => entry.value,\n this.compareWith(),\n );\n for (const v of values) {\n const entry = byValue(v);\n if (entry) {\n this.#pointer.suppress();\n entry.handle.host.focus();\n return true;\n }\n }\n return false;\n }\n\n private revealInitialFocus(): void {\n if (this.#virtualized()) {\n return;\n }\n const target = this.#controller.revealTarget(() => this.selectedOptionEl());\n if (target) {\n this.#scrollActiveIntoView(target);\n }\n }\n\n private highlightFromPointer(host: HTMLElement, id: string): void {\n this.#pointer.claim(host, id);\n }\n\n private notifyOptionFocus(): void {\n this.#pointer.release();\n }\n\n private releasePointerHighlight(): void {\n this.#pointer.release();\n }\n\n private registerContentModal(modal: Signal<boolean>): void {\n this.#contentModal.set(modal);\n }\n\n private unregisterContentModal(modal: Signal<boolean>): void {\n if (this.#contentModal() === modal) {\n this.#contentModal.set(null);\n }\n }\n\n /**\n * Scroll an option into view with the pointer-suppression window open, so the\n * synthetic `pointermove` the scroll fires when a different option slides under\n * a stationary cursor cannot hand the highlight to it.\n */\n #scrollActiveIntoView(host: HTMLElement): void {\n this.#pointer.suppress();\n this.#pointer.release();\n host.scrollIntoView?.({ block: 'nearest' });\n }\n\n private commitOnTab(value: T | Unset, event: KeyboardEvent): void {\n if (this.effectiveDisabled() || isUnset(value)) {\n return;\n }\n if (!this.multiple() && !this.readonly()) {\n this.#rangeEngine.selectSingle(value);\n }\n // Move focus to the trigger BEFORE the unmount + close so the browser's\n // Tab default action has a stable active element to advance from. The\n // content's `DestroyRef` reads `lastCloseReason() === 'tab'` and skips\n // its own re-focus — otherwise it would steal focus back from wherever\n // the browser advanced it.\n this.#controller.commitTabToTrigger(event);\n this.#controller.closeOverlay('tab');\n }\n\n override markTouched(): void {\n super.markTouched();\n }\n\n private seedVirtualizedInitialFocus(): void {\n if (!this.#virtualized()) {\n return;\n }\n const navigator = this.#virtualModel().navigator();\n const target = this.#controller.initialFocus();\n if (target !== 'selected') {\n navigator.navigate(target);\n return;\n }\n const committed = resolveCommittedPosition({\n values: this.value(),\n snapshotByPos: navigator.snapshotByPos(),\n compareWith: this.compareWith(),\n selectedIndex: this.#virtualModel().selectedIndex(),\n totalCount: this.totalCount(),\n });\n if (committed !== null) {\n navigator.seedActive(committed);\n return;\n }\n navigator.navigate('first');\n }\n\n private handleVirtualizedKeydown(event: KeyboardEvent): void {\n if (!this.#virtualized() || this.effectiveDisabled()) {\n return;\n }\n if (this.#virtualModel().rejectRangeSelect(event)) {\n return;\n }\n if (event.key === 'Tab') {\n if (this.mountedModal()) {\n return;\n }\n this.#commitActiveDescendantOnTab(event);\n return;\n }\n if (event.key === ' ' && this.#typeaheadVirtualized(event)) {\n return;\n }\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.#activateActiveDescendant();\n return;\n }\n const action = resolveListNavigation(event, {\n orientation: this.orientation(),\n dir: this.dir(),\n pageKeys: true,\n });\n if (action) {\n event.preventDefault();\n this.#assertSelectionFollowsFocusSupported();\n this.#virtualModel().navigator().navigate(action);\n return;\n }\n this.#typeaheadVirtualized(event);\n }\n\n /**\n * Guards the `selectionFollowsFocus` + virtualization invariant at every\n * keyboard move of the virtualized activedescendant — arrow / Home / End /\n * Page navigation and a typeahead match alike, since both move focus without\n * carrying selection. Seeding on open and a click are not\n * covered: neither is a navigation the combination degrades.\n */\n #assertSelectionFollowsFocusSupported(): void {\n if (this.#virtualized()) {\n assertVirtualizedSelectionFollowsFocusSupported(\n { bound: this._selectionFollowsFocusInput(), multiple: this.multiple() },\n { primitive: 'select', focusModel: 'DOM-focus', collection: 'listbox' },\n );\n }\n }\n\n private notifyOptionClick(optionId: string): void {\n if (!this.#virtualized()) {\n return;\n }\n this.#setActiveId(optionId);\n this.#controller.content()?.focus();\n }\n\n #activeTarget(): { readonly value: T | Unset; readonly resumePos: number | null } | null {\n const id = this.#activeId();\n if (id === null) {\n const resumed = this.#virtualModel().resume.resolve();\n return resumed === null || resumed.entry.disabled\n ? null\n : { value: resumed.entry.value, resumePos: resumed.pos };\n }\n const handle = this.#controller.options().find((o) => o.id() === id);\n return !handle || handle.disabled() ? null : { value: handle.value(), resumePos: null };\n }\n\n #activateActiveDescendant(): void {\n const target = this.#activeTarget();\n if (target === null) {\n return;\n }\n if (target.resumePos !== null) {\n this.#virtualModel().navigator().seedActive(target.resumePos);\n }\n this.activate(target.value);\n }\n\n #commitActiveDescendantOnTab(event: KeyboardEvent): void {\n const target = this.#activeTarget();\n if (target !== null) {\n this.commitOnTab(target.value, event);\n return;\n }\n this.#controller.commitTabToTrigger(event);\n this.#controller.closeOverlay('tab');\n }\n\n /**\n * The virtualized typeahead searches the position snapshot, not the rendered\n * window, so a match the consumer's virtualizer has unmounted is reachable;\n * the match is seeded rather than focused, so an off-window one emits\n * `(scrollToIndex)` and settles once the option mounts.\n */\n #typeaheadVirtualized(event: KeyboardEvent): boolean {\n const navigator = this.#virtualModel().navigator();\n const { handled, pos } = navigator.resolveTypeahead(this.#typeahead, event, (entry) =>\n this.#typeaheadText(entry.textValue, entry.value, () => entry.label),\n );\n if (pos !== null) {\n this.#assertSelectionFollowsFocusSupported();\n navigator.seedActive(pos);\n }\n return handled;\n }\n}\n","import { isUnset, VirtualizedNavigator, type VirtualizedNavigatorDeps } from 'forty-cdk/core';\nimport type { ForSelectOptionHandle } from './select-context';\n\n/**\n * Position-snapshot entry for `ForSelect`. Carries the option's raw `value` and\n * its accessible text on top of the engine's `id` / `disabled`, so the root can\n * resolve the committed option's absolute index on open — and match a typeahead\n * — even while the option is outside the rendered window.\n */\nexport interface SelectPositionEntry<T> {\n /** Stable option host id — the activedescendant target. */\n readonly id: string;\n /** The option's raw value, matched against the selection by `compareWith`. */\n readonly value: T;\n /** The option's accessible text, the virtualized typeahead's last fallback. */\n readonly label: string;\n /** The option's `textValue`, which the virtualized typeahead prefers when set. */\n readonly textValue: string;\n /** Whether the option is disabled, so navigation skips over it. */\n readonly disabled: boolean;\n}\n\n/** The shared navigation engine as `ForSelect` parameterises it. */\nexport type SelectVirtualizedNavigator<T> = VirtualizedNavigator<\n ForSelectOptionHandle<T>,\n SelectPositionEntry<T>\n>;\n\n/**\n * Wire the shared `forty-cdk/core` navigation engine to the select option\n * handle: the handle carries its absolute `posInSet` and its raw `value`, and an\n * option whose `[value]` binding is not written yet is skipped this fold and\n * folded in on the binding's re-run. Scroll-into-view is routed through\n * `scrollActiveIntoView` so the root's pointer-suppression window opens first — a\n * synthetic `pointermove` from the scroll must not hijack the highlight.\n *\n * Internal — not re-exported from `select/index.ts` or `public-api.ts`.\n */\nexport function createSelectVirtualizedNavigator<T>(\n deps: VirtualizedNavigatorDeps<ForSelectOptionHandle<T>>,\n scrollActiveIntoView: (host: HTMLElement) => void,\n): SelectVirtualizedNavigator<T> {\n return new VirtualizedNavigator(deps, {\n posOf: (o) => o.posInSet(),\n idOf: (o) => o.id(),\n hostOf: (o) => o.host,\n isDisabled: (o) => o.disabled(),\n readEntry: (o) => {\n const id = o.id();\n const value = o.value();\n return isUnset(value)\n ? null\n : { id, value, label: o.label(), textValue: o.textValue(), disabled: o.disabled() };\n },\n scrollIntoView: (host) => scrollActiveIntoView(host),\n });\n}\n","import { Directive, effect, input, numberAttribute, output } from '@angular/core';\n\nimport {\n isRangeSelectShortcut,\n runVirtualizedNavigatorBridge,\n throwUnsupportedVirtualizedRangeSelect,\n VirtualizedResume,\n} from 'forty-cdk/core';\nimport { injectSelectContext } from './select-context';\nimport {\n createSelectVirtualizedNavigator,\n type SelectPositionEntry,\n type SelectVirtualizedNavigator,\n} from './select-virtualized-navigator';\n\n/**\n * Opts a `[forSelect]` into the virtualized focus model, for a listbox whose\n * options the consumer's virtualizer mounts only while they are in view. Placed\n * on the `[forSelect]` element itself. While `totalCount` is set, DOM focus\n * stays on `[forSelectContent]`, the active option is reflected as\n * `aria-activedescendant`, each rendered option carries `aria-setsize` /\n * `aria-posinset`, and keyboard navigation and typeahead reach options outside\n * the rendered window through `(scrollToIndex)`.\n *\n * A select without this directive never bundles the virtualized navigation\n * engine.\n *\n * @example\n * ```html\n * <div forSelect forSelectVirtualized [totalCount]=\"items.length\"\n * [visibleRange]=\"range()\" (scrollToIndex)=\"virtualizer.scrollToIndex($event)\">\n * …\n * </div>\n * ```\n */\n@Directive({\n selector: '[forSelectVirtualized]',\n exportAs: 'forSelectVirtualized',\n})\nexport class ForSelectVirtualized {\n readonly #ctx = injectSelectContext('ForSelectVirtualized');\n\n /**\n * Total number of items in the source data. When set, switches the listbox\n * to the virtualized `aria-activedescendant` focus model and populates\n * `aria-setsize` on each rendered option. Leave unset (default) for the\n * standard DOM-focus model.\n */\n readonly totalCount = input(undefined, {\n transform: (v: unknown): number | undefined => (v == null ? undefined : numberAttribute(v)),\n });\n\n /**\n * Inclusive-exclusive `[start, end)` index range of the currently rendered options, as provided\n * by `injectVirtualizer`. Decides whether a navigation target is inside the visible window.\n */\n readonly visibleRange = input<readonly [number, number] | undefined>(undefined);\n\n /**\n * Open-time reveal hint: the absolute index of the currently committed option\n * within the full source dataset. Consulted on open by the scroll-to-selected\n * algorithm as the authoritative index when the committed value's option lies\n * outside the rendered window and has never been rendered (so its position is\n * absent from the navigator snapshot). Bind it from the consumer's own\n * value→index lookup.\n *\n * This is a reveal hint, **not** a selection source — `value` / `[(value)]`\n * stay authoritative; it only decides which option is scrolled into view on\n * open. It is singular: in multiple mode it seeds the first committed option.\n * Leave unset (default) when the committed option is always inside the initial\n * window. An off-window committed value with no `[selectedIndex]` that was never\n * rendered falls back to focusing the first enabled option; an out-of-range\n * index (or an empty selection) is silently ignored.\n */\n readonly selectedIndex = input<number | undefined>(undefined);\n\n /**\n * Tells the select the source dataset changed **without** a `totalCount`\n * transition — a same-length re-sort or refresh (e.g. sorting a 1000-row\n * list). Bind any value that changes on such a refresh (a version counter,\n * the array reference, a sort-key string); when it changes the position\n * snapshot rebuilds from empty so navigation never resolves against a stale\n * off-window entry. Leave unset (default) when the dataset only ever changes\n * length. Equivalent to calling {@link ForSelectVirtualized.invalidateSnapshot}\n * imperatively.\n */\n readonly dataVersion = input<unknown>();\n\n /**\n * Emitted when navigation reaches an option outside the rendered window, or\n * on open-time scroll-to-selected when the committed option's absolute index\n * is resolvable — it is in the rendered window, was previously rendered (in\n * the snapshot), or was supplied via `[selectedIndex]`. Pass to\n * `injectVirtualizer`'s `scrollToIndex` so the correct option mounts.\n */\n readonly scrollToIndex = output<number>();\n\n #navigator: SelectVirtualizedNavigator<unknown> | null = null;\n\n readonly #resume = new VirtualizedResume<unknown, SelectPositionEntry<unknown>>({\n totalCount: this.totalCount,\n snapshotByPos: () => this.#requireNavigator().snapshotByPos(),\n compareWith: this.#ctx.compareWith,\n });\n\n readonly #host = this.#ctx.registerVirtualization({\n totalCount: this.totalCount,\n selectedIndex: this.selectedIndex,\n resume: this.#resume,\n navigator: () => this.#requireNavigator(),\n rejectRangeSelect: (event) => this.#rejectRangeSelect(event),\n });\n\n constructor() {\n // @sanctioned-pull(navigator-position-map): the rendered window is transient,\n // so a window nothing reads during is lost to the lazy fold.\n effect(() => {\n runVirtualizedNavigatorBridge({\n items: this.#host.items,\n virtualized: () => this.totalCount() !== undefined,\n requireNavigator: () => this.#requireNavigator(),\n });\n });\n }\n\n /**\n * Force the position snapshot to rebuild from empty on the next fold,\n * discarding stale off-window entries. Call after a same-length dataset\n * refresh (a re-sort / reload that keeps `totalCount` unchanged) when you\n * cannot express the change through the reactive `[dataVersion]` input. No-op\n * while `totalCount` is unset.\n */\n invalidateSnapshot(): void {\n if (this.totalCount() === undefined) {\n return;\n }\n this.#requireNavigator().invalidateSnapshot();\n }\n\n #requireNavigator(): SelectVirtualizedNavigator<unknown> {\n return (this.#navigator ??= createSelectVirtualizedNavigator(\n {\n items: this.#host.items,\n totalCount: this.totalCount,\n visibleRange: this.visibleRange,\n loop: this.#host.loop,\n getActiveId: () => this.#host.getActiveId(),\n setActiveId: (id) => this.#host.setActiveId(id),\n emitScrollToIndex: (idx) => this.scrollToIndex.emit(idx),\n getResumePos: () => this.#resume.pos(),\n dataVersion: this.dataVersion,\n },\n (host) => this.#host.scrollActiveIntoView(host),\n ));\n }\n\n #rejectRangeSelect(event: KeyboardEvent): boolean {\n if (\n !this.#ctx.multiple() ||\n !isRangeSelectShortcut(event, { orientation: this.#ctx.orientation(), dir: this.#ctx.dir() })\n ) {\n return false;\n }\n event.preventDefault();\n throwUnsupportedVirtualizedRangeSelect({\n primitive: 'select',\n focusModel: 'DOM-focus',\n collection: 'listbox',\n shortcuts: 'Shift+Arrow, Shift+Space, Ctrl/Cmd+A, Ctrl+Shift+Home/End',\n alternative: 'Toggle options individually with Enter, Space, or click',\n });\n return true;\n }\n}\n","import { Directive, ElementRef, inject } from '@angular/core';\n\nimport { registerHandle } from 'forty-cdk/core';\nimport { injectSelectContext } from './select-context';\n\n/**\n * Optional positioning anchor. When present, `[forSelectContent]` is\n * positioned against this element instead of `[forSelectTrigger]` — useful\n * when the trigger lives inside a decorated field box (padding, prefix icon,\n * clear / chevron buttons) and the listbox should match the visible field\n * rather than the inner button.\n *\n * Only positioning changes: the trigger still owns `aria-controls`,\n * `aria-expanded`, the click toggle, focus return on close, and its exemption\n * from outside-pointer dismissal. If no anchor is registered the listbox falls\n * back to anchoring against the trigger, so existing usages are unaffected.\n *\n * It wins over a surrounding field's `[forFieldAnchor]`. One\n * `[forSelectAnchor]` per `[forSelect]`; a second one warns in dev mode.\n *\n * ```html\n * <div forSelect [(value)]=\"v\">\n * <div forSelectAnchor class=\"field-box\">\n * <icon />\n * <button forSelectTrigger>…</button>\n * <button class=\"clear\">×</button>\n * </div>\n * @if (open()) {\n * <div forSelectContent>…</div>\n * }\n * </div>\n * ```\n */\n@Directive({\n selector: '[forSelectAnchor]',\n exportAs: 'forSelectAnchor',\n})\nexport class ForSelectAnchor {\n readonly #ctx = injectSelectContext('ForSelectAnchor');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n constructor() {\n registerHandle(\n this.#host.nativeElement,\n (el) => this.#ctx.overlay.registerAnchor(el),\n (el) => this.#ctx.overlay.unregisterAnchor(el),\n );\n }\n}\n","import { computed, Directive, ElementRef, inject, input, type Signal } from '@angular/core';\n\nimport {\n hostButtonType,\n hostId,\n reflectDisabled,\n registerHandle,\n leavesControl,\n} from 'forty-cdk/core';\nimport {\n type ForSelectContext,\n injectSelectTriggerContext,\n type SelectContext,\n SELECT_TRIGGERS,\n} from './select-context';\n\n/**\n * Combobox button that opens the listbox. Apply on a `<button>` so\n * Space / Enter dispatch native click events that toggle via `(click)`.\n *\n * Wires APG select-only combobox attributes: `role=\"combobox\"`,\n * `aria-haspopup=\"listbox\"`, `aria-expanded`, and `aria-controls` pointing\n * to the listbox. The button is exempt from the listbox's dismissible\n * layer — clicks on it route through `(click)` instead of triggering an\n * outside-pointer dismissal race.\n *\n * Disabling: the native `disabled` attribute is the single reflection channel\n * — no `aria-disabled` is emitted, because on a real single-purpose `<button>`\n * trigger the native attribute already conveys the state to assistive\n * technology, and it is what suppresses activation here. The\n * `role=\"combobox\"` override does not change that: the HTML `disabled`\n * attribute maps to the unavailable state regardless of the ARIA role, and a\n * native `<select disabled>` leaves the tab order the same way. It is\n * reflected non-destructively — the directive only removes the attribute when\n * it set it itself — and `data-disabled=\"\"` stays as the styling hook. The\n * remaining form-control state (`aria-readonly` / `aria-required` /\n * `aria-invalid` / `aria-busy`) is unaffected, and the read-only state carries\n * its own `data-readonly=\"\"` styling hook — `readonly` is not a valid attribute\n * of `<button>`, so a `data-*` channel is the only one available there.\n *\n * The root is normally resolved via DI from the enclosing `[forSelect]`.\n * When the trigger is declared inside an `ng-template` stamped into the root\n * (e.g. via `ngTemplateOutlet`), DI resolves at the template's declaration\n * site and misses the root — pass it explicitly through the selector input,\n * `routerLink`-style: `[forSelectTrigger]=\"root\"` with `#root=\"forSelect\"`.\n *\n * Keyboard:\n * - **Click / Enter / Space** — toggle (open focuses the selected option, or first).\n * - **ArrowDown** — open + focus selected option (or first).\n * - **ArrowUp** — open + focus selected option (or last when none selected).\n * - **Home** — open + focus the first enabled option.\n * - **End** — open + focus the last enabled option.\n * - **Typeahead** (single mode only) — printable keys select the matching\n * option immediately without opening the listbox, mirroring native\n * `<select>`. In multi mode the buffered key is ignored at the trigger;\n * open the listbox first to typeahead-focus.\n */\n@Directive({\n selector: '[forSelectTrigger]',\n exportAs: 'forSelectTrigger',\n host: {\n '[attr.type]': 'buttonType()',\n role: 'combobox',\n '[id]': 'id()',\n '[attr.aria-haspopup]': '\"listbox\"',\n '[attr.aria-expanded]': 'ctx().open() ? \"true\" : \"false\"',\n '[attr.aria-controls]': 'ctx().open() ? ctx().overlay.contentId() : null',\n '[attr.aria-readonly]': 'ctx().readonly() ? \"true\" : null',\n '[attr.aria-required]': 'ctx().required() ? \"true\" : null',\n '[attr.aria-invalid]': 'ctx().invalid() ? \"true\" : null',\n '[attr.aria-busy]': 'ctx().pending() ? \"true\" : null',\n '[attr.data-state]': 'ctx().open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'ctx().effectiveDisabled() ? \"\" : null',\n '[attr.data-readonly]': 'ctx().readonly() ? \"\" : null',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class ForSelectTrigger<T = unknown> {\n private readonly buttonType = hostButtonType();\n\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Optional explicit reference to the `[forSelect]` root, named after the\n * selector `routerLink`-style. The bare valueless attribute keeps resolving\n * the enclosing root via DI; pass the root explicitly\n * (`[forSelectTrigger]=\"root\"`, with `#root=\"forSelect\"`) when the trigger\n * is declared in an `ng-template` stamped inside the root — DI resolves at\n * the template's declaration site, so the enclosing root is invisible there.\n * The empty string (what the valueless attribute yields) is treated as unset.\n */\n readonly forSelectTrigger = input<ForSelectContext<T> | ''>('');\n\n readonly #resolved = injectSelectTriggerContext<T>(this.forSelectTrigger);\n readonly #root = this.#resolved.ctx;\n private readonly ctx: Signal<SelectContext<T>> = this.#root;\n\n private readonly id = hostId('for-select-trigger');\n\n constructor() {\n const triggers = inject(SELECT_TRIGGERS);\n registerHandle(\n { host: this.#host.nativeElement, id: this.id, root: this.#resolved.root },\n (handle) => triggers.add(handle),\n (handle) => triggers.remove(handle),\n );\n reflectDisabled(computed(() => this.ctx().effectiveDisabled()));\n }\n\n private onClick(): void {\n this.#activate();\n this.#root().overlay.toggle('selected');\n }\n\n /** Make this trigger the one the listbox anchors to, is labelled by and returns focus to. */\n #activate(): void {\n if (!this.ctx().effectiveDisabled()) {\n this.#root().overlay.activateTrigger(this.#host.nativeElement);\n }\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.ctx().effectiveDisabled()) {\n return;\n }\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.#activate();\n this.#root().overlay.openOverlay('selected');\n return;\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.#activate();\n // ArrowUp lands on the selected option if any, else the last enabled.\n this.#root().overlay.openOverlay(this.ctx().value().length > 0 ? 'selected' : 'last');\n return;\n }\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n this.#activate();\n this.#root().overlay.openOverlay(event.key === 'Home' ? 'first' : 'last');\n return;\n }\n // Closed-state typeahead — single-mode shortcut to match native <select>.\n // No-op (returns false) in multi mode or when the key isn't a printable\n // single char, so default browser behavior (e.g. nothing) takes over.\n this.ctx().handleClosedTypeahead(event);\n }\n\n private onFocusOut(event: FocusEvent): void {\n if (leavesControl(event, [this.#root().overlay.content(), this.ctx().host])) {\n this.ctx().markTouched();\n }\n }\n}\n","import { computed, Directive, input } from '@angular/core';\n\nimport { injectSelectContext } from './select-context';\n\n/**\n * Renders the currently-selected option's text — or the configured\n * placeholder when nothing is selected — into its host element via\n * `textContent`. Apply on a `<span>` (or any inline element) inside\n * `[forSelectTrigger]`:\n *\n * ```html\n * <button forSelectTrigger>\n * <span forSelectValue placeholder=\"Select fruit…\"></span>\n * </button>\n * ```\n *\n * In multi mode the labels are joined by `separator` (default `', '`). For\n * fully custom rendering, drop this directive and read\n * `forSelect.selectedLabels()` / `forSelect.value()` from your template.\n */\n@Directive({\n selector: '[forSelectValue]',\n exportAs: 'forSelectValue',\n host: {\n '[textContent]': 'displayText()',\n '[attr.data-placeholder]': 'isPlaceholder() ? \"\" : null',\n },\n})\nexport class ForSelectValue {\n readonly #ctx = injectSelectContext('ForSelectValue');\n\n /** Text shown when nothing is selected. Falls back to `[forSelect][placeholder]`. */\n readonly placeholder = input<string>('');\n\n /** Joiner for multi-mode label rendering. Default `', '`. */\n readonly separator = input<string>(', ');\n\n private readonly isPlaceholder = computed(() => this.#ctx.value().length === 0);\n\n private readonly displayText = computed(() => {\n const labels = this.#ctx.selectedLabels();\n if (labels.length === 0) {\n return this.placeholder() || this.#ctx.placeholder();\n }\n return labels.join(this.separator());\n });\n}\n","import { Directive, ElementRef, inject, type Signal, signal } from '@angular/core';\n\nimport {\n registerHandle,\n hostAriaLabel,\n hostLabelledBy,\n injectFieldLabelExemption,\n pressFocusesDescendant,\n preventPointerFocus,\n FOR_FIELD_ANCHOR_CONTEXT,\n FOR_FIELD_CONTEXT,\n dismissMarksTouched,\n} from 'forty-cdk/core';\nimport { injectModalShell, warnIfMountedWhileClosed } from 'forty-cdk/core-overlay';\nimport {\n floatingPositioner,\n injectOverlayShell,\n itemAlignedPositioner,\n} from 'forty-cdk/core-anchored';\nimport { injectSelectContext, type SelectContext } from './select-context';\n\n/**\n * The listbox surface. Carries `role=\"listbox\"`, is portaled to\n * `document.body`, and is positioned by `@floating-ui/dom` against the\n * trigger.\n *\n * Mount/unmount of the visible content is the consumer's responsibility —\n * wrap with `@if (open())` so `animate.enter` / `animate.leave` fire on the\n * natural mount cycle. While mounted it dismisses on Escape, pointer-down\n * outside or focus outside; the trigger element is exempt from outside-pointer\n * checks so trigger clicks toggle without dismissal racing.\n *\n * Initial focus is sent to the selected option (`'selected'`), the first\n * enabled option (`'first'`), or the last enabled option (`'last'`)\n * according to the trigger's hint, and that option is scrolled into view\n * once the surface has been positioned. On destroy, focus returns to the\n * trigger when `returnFocus` is true. A Tab that leaves the surface from\n * anything that is not an option continues from the trigger.\n *\n * A mouse press on the surface that lands on no focusable element of its own\n * (padding, a group label, a separator) is cancelled, so focus stays on the\n * option that held it and the arrow keys keep working; a press on an option\n * still focuses it, and a press on another focusable descendant takes focus\n * wherever the browser puts it.\n *\n * The lifecycle is picked once on construction from `[forSelect].modal`:\n *\n * - **non-modal (default)** — the listbox is anchored to the trigger and\n * branches on `[forSelect].position`:\n * - `'popper'` (default) — full anchored placement (`side`, `align`,\n * `sideOffset`, `alignOffset`, `flip`, `shift`, `hideWhenDetached`).\n * - `'item-aligned'` — the listbox overlays the trigger so the selected\n * option's center aligns with the trigger's center. The anchored-placement\n * inputs are no-ops in this mode.\n * - **modal** — focus is trapped, the background is inerted and body scroll is\n * locked; the surface is centered and positioned by the consumer's CSS rather\n * than anchored to the trigger, so every anchored-positioning input is a\n * no-op. Escape / outside-pointer dismiss, `dismissible` / `returnFocus` /\n * `ariaLabel` and the `autoFocusOnOpen` / `autoFocusOnClose` vetoes are\n * unchanged. Modality is conveyed by the `inert` siblings and reflected as\n * `data-modal` for styling; `role=\"listbox\"` does not support `aria-modal`,\n * so it is not emitted.\n *\n * A field boundary: a control inside it never registers with an ancestor\n * `[forField]`, and a `[forField]` inside it still wires its own control.\n */\n@Directive({\n selector: '[forSelectContent]',\n exportAs: 'forSelectContent',\n host: {\n role: 'listbox',\n '[attr.tabindex]': 'ctx.totalCount() !== undefined ? \"0\" : \"-1\"',\n '[attr.aria-activedescendant]': 'ctx.activeDescendantId()',\n '[id]': 'ctx.overlay.contentId()',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.aria-multiselectable]': 'ctx.multiple() ? \"true\" : null',\n '[attr.aria-orientation]': 'ctx.orientation()',\n '[attr.data-state]': 'ctx.open() ? \"open\" : \"closed\"',\n '[attr.data-modal]': 'modal() ? \"\" : null',\n '[attr.data-orientation]': 'ctx.orientation()',\n '(keydown)': 'onKeyDown($event)',\n '(pointerleave)': 'onPointerLeave()',\n },\n providers: [\n { provide: FOR_FIELD_CONTEXT, useValue: null },\n { provide: FOR_FIELD_ANCHOR_CONTEXT, useValue: null },\n ],\n})\nexport class ForSelectContent {\n readonly #select = injectSelectContext('ForSelectContent');\n private readonly ctx: SelectContext = this.#select;\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly modal: Signal<boolean>;\n\n private readonly resolvedAriaLabel = hostAriaLabel(() => this.ctx.ariaLabel());\n\n private readonly labelledBy = hostLabelledBy(() =>\n this.resolvedAriaLabel() ? null : this.ctx.overlay.triggerId() || null,\n );\n\n constructor() {\n const ctx = this.#select;\n const host = this.#host.nativeElement;\n registerHandle(\n host,\n (el) => ctx.overlay.registerContent(el),\n (el) => ctx.overlay.unregisterContent(el),\n );\n preventPointerFocus((event) => !pressFocusesDescendant(event, host));\n\n warnIfMountedWhileClosed({\n primitive: 'select',\n piece: '[forSelectContent]',\n condition: 'select.open()',\n open: ctx.open,\n });\n\n // Primitive-owned initial-focus algorithm shared by both shells.\n // `'selected'` falls back to the first enabled option when nothing is\n // selected; returns `false` so the shell focuses the container on a miss.\n const focusInitial = (): boolean => {\n if (ctx.totalCount() !== undefined) {\n this.#host.nativeElement.focus();\n ctx.seedVirtualizedInitialFocus();\n return true;\n }\n const target = ctx.overlay.initialFocus();\n if (target === 'selected') {\n return ctx.focusSelectedOption() || ctx.overlay.focusFirstEnabledOption();\n }\n if (target === 'last') {\n return ctx.overlay.focusLastEnabledOption();\n }\n return ctx.overlay.focusFirstEnabledOption();\n };\n\n // Static branch — `modal` (and `position`) is read once on construction.\n // Switching modes at runtime would require re-creating the directive\n // (mount / unmount cycle), which is the expected pattern for primitives\n // whose surface is structurally different. The surface mounts lazily via\n // `@if (open())`, well after `modal` settles.\n if (ctx.modal()) {\n this.modal = injectModalShell({\n modal: ctx.modal,\n returnFocus: ctx.returnFocus,\n // The trap owns Tab; the shell runs `focusInitial()` (selected →\n // first → last) instead of its own first-focusable move.\n initialFocus: {\n move: focusInitial,\n veto: () => ctx.overlay.emitAutoFocusOnOpen(),\n },\n autoFocusOnClose: () => (event) => {\n if (ctx.overlay.emitAutoFocusOnClose()) {\n event.preventDefault();\n }\n },\n dismiss: {\n dismissible: ctx.dismissible,\n // The shell builds the veto and calls this when not vetoed; mirror\n // the anchored path's touched-on-dismiss behaviour.\n requestClose: (reason) => {\n if (dismissMarksTouched(reason)) {\n ctx.markTouched();\n }\n ctx.overlay.closeOverlay(reason);\n },\n emitEscapeKeyDown: (veto) => ctx.overlay.forwardEscapeKeyDown(veto),\n emitPointerDownOutside: (veto) => ctx.overlay.emitPointerDownOutside(veto),\n emitFocusOutside: (veto) => ctx.overlay.emitFocusOutside(veto),\n emitInteractOutside: (veto) => ctx.overlay.emitInteractOutside(veto),\n },\n }).modal;\n this.#publishModal();\n return;\n }\n\n const positioner =\n ctx.position() === 'item-aligned'\n ? itemAlignedPositioner({\n reference: ctx.overlay.anchor,\n open: ctx.open,\n selectedOption: ctx.selectedOptionEl,\n collisionPadding: ctx.collisionPadding,\n onFirstPosition: () => ctx.revealInitialFocus(),\n })\n : floatingPositioner({\n reference: ctx.overlay.anchor,\n open: ctx.open,\n side: ctx.side,\n align: ctx.align,\n sideOffset: ctx.sideOffset,\n alignOffset: ctx.alignOffset,\n avoidCollisions: ctx.avoidCollisions,\n collisionPadding: ctx.collisionPadding,\n sticky: ctx.sticky,\n hideWhenDetached: ctx.hideWhenDetached,\n clipUntilPositioned: ctx.clipUntilPositioned,\n onFirstPosition: () => ctx.revealInitialFocus(),\n });\n\n this.modal = signal(false).asReadonly();\n this.#publishModal();\n injectOverlayShell({\n positioner,\n dismiss: {\n dismissible: ctx.dismissible,\n // Mirror the modal path's touched-on-dismiss behaviour.\n requestClose: (reason) => {\n if (dismissMarksTouched(reason)) {\n ctx.markTouched();\n }\n ctx.overlay.closeOverlay(reason);\n },\n emitEscapeKeyDown: (event) => ctx.overlay.emitEscapeKeyDown(event),\n emitPointerDownOutside: (veto) => ctx.overlay.emitPointerDownOutside(veto),\n emitFocusOutside: (veto) => ctx.overlay.emitFocusOutside(veto),\n emitInteractOutside: (veto) => ctx.overlay.emitInteractOutside(veto),\n // Every trigger is exempt: each toggles the listbox from its own click.\n exemptElements: injectFieldLabelExemption(() => ctx.overlay.triggerHosts()),\n },\n initialFocus: {\n move: focusInitial,\n veto: () => ctx.overlay.emitAutoFocusOnOpen(),\n },\n returnFocus: {\n enabled: ctx.returnFocus,\n target: () => ctx.overlay.trigger(),\n // `(autoFocusOnClose)` lets the consumer veto the return-focus.\n veto: () => ctx.overlay.emitAutoFocusOnClose(),\n // Skip on `'tab'`: focus already landed where the user tabbed, so\n // re-focusing the trigger would steal it back. 'select' / 'escape' /\n // 'programmatic' still return focus to the trigger.\n skip: () => ctx.overlay.lastCloseReason() === 'tab',\n },\n tabOut: ctx.tabOut,\n });\n }\n\n #publishModal(): void {\n const ctx = this.#select;\n registerHandle(\n this.modal,\n (modal) => ctx.registerContentModal(modal),\n (modal) => ctx.unregisterContentModal(modal),\n );\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.ctx.totalCount() !== undefined) {\n this.ctx.handleVirtualizedKeydown(event);\n }\n }\n\n private onPointerLeave(): void {\n this.ctx.releasePointerHighlight();\n }\n}\n","import {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n InjectionToken,\n input,\n signal,\n type InputSignal,\n} from '@angular/core';\n\nimport {\n assertInputBound,\n hostButtonType,\n accessibleTextContent,\n type DisabledRovingItemKeyOptions,\n focusAfterPress,\n handleDisabledRovingItemKey,\n isUnset,\n navigateFromRovingItem,\n registerHandle,\n hostId,\n injectPointerMove,\n preventPointerFocus,\n resolveListNavigation,\n unsetInput,\n type Unset,\n} from 'forty-cdk/core';\nimport { injectSelectContext } from './select-context';\n\n/**\n * Injection key the `[forSelectIndicator]` uses to resolve its parent option,\n * decoupled from the concrete `ForSelectOption` class. `ForSelectOption`\n * provides itself under this token, so a design system wrapping the option by\n * subclassing re-points it at the subclass with a single provider\n * (`{ provide: FOR_SELECT_OPTION, useExisting: MySelectOption }`) and the\n * indicator keeps resolving — see `docs/wrapping-form-primitives.md`.\n */\nexport const FOR_SELECT_OPTION = new InjectionToken<ForSelectOption>('FOR_SELECT_OPTION');\n\n/**\n * One option inside a `[forSelectContent]`. Apply on a `<button type=\"button\">`\n * so Space / Enter activation come from native button behavior — printable\n * keys fall through to the listbox for typeahead matching.\n *\n * Generic over the option value type `T` (default `string`). Inferred from\n * the `[value]` binding so consumers can pass either primitive ids or full\n * objects (`[value]=\"city\"` infers `T = City`); the parent `[forSelect]`\n * must be parameterized over the same `T`. The parent's\n * `[compareWith]` decides how options are matched against the\n * committed selection.\n *\n * Click activates: in single mode the value replaces `[(value)]` and the\n * listbox closes; in multi mode the value toggles in/out and the listbox\n * stays open.\n *\n * Hovering an enabled option hands it `data-highlighted`, so pointer and\n * keyboard feed one highlight and exactly one option is ever decorated. Hover\n * never moves DOM focus and never selects — the pointer's own click activates —\n * and moving the pointer off `[forSelectContent]` hands the highlight back to\n * the focused option.\n *\n * Keyboard while focused:\n * - **Enter / Space** — activate (via native button click).\n * - **ArrowDown / ArrowUp / Home / End** — move focus inside the listbox.\n * - **Shift+Arrow / Shift+Space / Ctrl+A / Ctrl+Shift+Home / Ctrl+Shift+End**\n * _(multi mode, non-virtualized)_ — APG range selection, matching\n * `ForListbox`.\n * - **Tab / Shift+Tab** — commit the focused option (single mode) and let\n * the browser advance focus to the next / previous focusable, mirroring\n * the WAI-ARIA select-only combobox pattern and native `<select>`.\n * - **Escape** — close the listbox.\n * - **Typeahead** — printable keys match by `textValue`, else the root's `[itemToLabel]`, else\n * text content.\n */\n@Directive({\n selector: '[forSelectOption]',\n exportAs: 'forSelectOption',\n providers: [{ provide: FOR_SELECT_OPTION, useExisting: ForSelectOption }],\n host: {\n role: 'option',\n '[attr.type]': 'buttonType()',\n tabindex: '-1',\n '[id]': 'id()',\n '[attr.aria-selected]': 'selected() ? \"true\" : \"false\"',\n '[attr.aria-disabled]': 'effectiveDisabled() ? \"true\" : null',\n '[attr.data-state]': 'selected() ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'effectiveDisabled() ? \"\" : null',\n '[attr.aria-setsize]': 'ariaSetSize()',\n '[attr.aria-posinset]': 'ariaPosInSet()',\n '[attr.data-highlighted]': 'highlighted() ? \"\" : null',\n '(click)': 'onClick()',\n '(keydown)': 'onKeyDown($event)',\n '(focus)': 'onFocus()',\n '(blur)': 'onBlur()',\n '(pointerdown)': 'onPointerDown($event)',\n },\n})\nexport class ForSelectOption<T = string> {\n private readonly buttonType = hostButtonType();\n\n readonly #ctx = injectSelectContext<T>('ForSelectOption');\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Stable identifier serialized into `[(value)]` and the hidden input.\n * Defaults to `string` for back-compat; bind an object to specialize the\n * parent `[forSelect]` over a richer `T`. The parent's\n * `[compareWith]` decides how options are matched against the\n * committed selection.\n *\n * Mandatory — an unbound option throws in dev mode.\n */\n readonly value: InputSignal<T | Unset> = input(unsetInput<T>());\n /**\n * Whether the option can be activated. A disabled option stays rendered and announced, is\n * skipped by arrow navigation and typeahead, and a mouse press on it leaves focus where it was.\n */\n readonly disabled = input(false, { transform: booleanAttribute });\n /**\n * Zero-based absolute position of this option in the full source data.\n * Required in the virtualized path — drives `aria-posinset` and the parent's\n * position snapshot. Leave unset (default `null`) outside it.\n */\n readonly posInSet = input<number | null>(null);\n\n /**\n * Override the string typeahead matches this option against, on the open listbox and on the\n * closed trigger alike. Defaults to `''`, which falls back to the root's `[itemToLabel]` when set,\n * else to the option's accessible text — an `aria-hidden` subtree is already excluded. Set this\n * when announced text still shouldn't bleed into the match — e.g. `textValue=\"France\"` for an\n * option rendered as `🇫🇷 France`. The label `[forSelectValue]` displays is unaffected.\n */\n readonly textValue = input<string>('');\n\n readonly id = hostId('for-select-option');\n\n readonly selected = computed(() => {\n const value = this.value();\n return isUnset(value) ? false : this.#ctx.isSelected(value);\n });\n readonly effectiveDisabled = computed(() => this.disabled() || this.#ctx.effectiveDisabled());\n\n private readonly ariaSetSize = computed<string | null>(() => {\n const total = this.#ctx.totalCount();\n return total === undefined ? null : String(total);\n });\n private readonly ariaPosInSet = computed<string | null>(() => {\n if (this.#ctx.totalCount() === undefined) {\n return null;\n }\n const pos = this.posInSet();\n return pos === null ? null : String(pos + 1);\n });\n\n readonly #focused = signal(false);\n /**\n * True when this option is the active candidate — the one the pointer is over,\n * else the keyboard's. In the default path the keyboard channel is the\n * DOM-focused option; in the virtualized path it is `aria-activedescendant`,\n * which hover moves too, so the highlight and the option `Enter` activates\n * never disagree there. Reflected as `data-highlighted`.\n */\n readonly highlighted = computed(() => {\n const activeId = this.#ctx.activeDescendantId();\n if (activeId !== null) {\n return activeId === this.id();\n }\n const pointed = this.#ctx.pointerHighlightedOption();\n if (pointed !== null) {\n return pointed === this.#host.nativeElement;\n }\n return this.#focused();\n });\n\n /**\n * Reactive effective label exposed on the handle — the trimmed `textContent`\n * of the host. Mirrors `ForComboboxOption`'s `#effectiveLabel` so the root\n * can fold a per-option `Signal<string>` into its persisted snapshot instead\n * of reading `textContent` from inside a `computed`. `textContent` is not a\n * signal, so this still does not self-heal on a text-only change with no\n * value change — supply `[forSelect][itemToLabel]` for a pure signal\n * derivation when the label can change without the value.\n */\n readonly #effectiveLabel = computed(() => accessibleTextContent(this.#host.nativeElement).trim());\n\n constructor() {\n assertInputBound(this.value, 'select', '[forSelectOption]', 'value');\n const handle = {\n host: this.#host.nativeElement,\n value: this.value,\n label: this.#effectiveLabel,\n textValue: this.textValue,\n disabled: this.effectiveDisabled,\n id: this.id,\n posInSet: this.posInSet,\n };\n registerHandle(\n handle,\n (h) => this.#ctx.overlay.registerOption(h),\n (h) => this.#ctx.overlay.unregisterOption(h),\n );\n preventPointerFocus(() => this.effectiveDisabled());\n injectPointerMove(() => this.onPointerMove());\n }\n\n private onClick(): void {\n if (this.effectiveDisabled()) {\n return;\n }\n if (this.#ctx.totalCount() === undefined) {\n focusAfterPress(this.#host.nativeElement);\n }\n if (this.#ctx.readonly()) {\n this.#ctx.notifyOptionClick(this.id());\n return;\n }\n this.#ctx.activate(this.value());\n this.#ctx.notifyOptionClick(this.id());\n }\n\n private onFocus(): void {\n this.#focused.set(true);\n this.#ctx.notifyOptionFocus();\n }\n\n private onBlur(): void {\n this.#focused.set(false);\n }\n\n private onPointerMove(): void {\n if (this.effectiveDisabled()) {\n return;\n }\n this.#ctx.highlightFromPointer(this.#host.nativeElement, this.id());\n }\n\n private onKeyDown(event: KeyboardEvent): void {\n if (this.effectiveDisabled()) {\n handleDisabledRovingItemKey(event, this.#keyOptions());\n return;\n }\n\n if (event.key === 'Tab') {\n // In modal mode the focus trap owns Tab (it cycles focus inside the\n // surface in the capture phase); committing + closing here would defeat\n // the trap. Bail and let the trap's `preventDefault` keep focus inside.\n if (this.#ctx.mountedModal()) {\n return;\n }\n // APG (combobox-select-only): Tab commits the focused option and lets\n // the browser advance focus to the next / previous focusable. Do NOT\n // preventDefault — the browser's Tab default uses the focus we just\n // moved to the trigger as the starting point.\n this.#ctx.commitOnTab(this.value(), event);\n return;\n }\n\n if (this.#ctx.multiple()) {\n if ((event.ctrlKey || event.metaKey) && !event.shiftKey && !event.altKey) {\n if (event.key === 'a' || event.key === 'A') {\n event.preventDefault();\n this.#ctx.selectAll();\n return;\n }\n }\n\n if ((event.ctrlKey || event.metaKey) && event.shiftKey && !event.altKey) {\n if (event.key === 'Home') {\n event.preventDefault();\n this.#ctx.selectFromCurrentToEdge(this.#host.nativeElement, 'first');\n return;\n }\n if (event.key === 'End') {\n event.preventDefault();\n this.#ctx.selectFromCurrentToEdge(this.#host.nativeElement, 'last');\n return;\n }\n }\n\n if (event.shiftKey && event.key === ' ') {\n event.preventDefault();\n this.#ctx.selectRangeToFocused(this.#host.nativeElement);\n return;\n }\n\n if (event.shiftKey && !event.ctrlKey && !event.metaKey && !event.altKey) {\n const rangeAction = resolveListNavigation(event, {\n orientation: this.#ctx.orientation(),\n dir: this.#ctx.dir(),\n });\n if (rangeAction === 'next' || rangeAction === 'prev') {\n event.preventDefault();\n this.#ctx.extendByArrow(this.#host.nativeElement, rangeAction);\n return;\n }\n }\n }\n\n if (navigateFromRovingItem(event, this.#keyOptions())) {\n return;\n }\n\n this.#ctx.overlay.handleTypeahead(event);\n }\n\n #keyOptions(): DisabledRovingItemKeyOptions {\n return {\n groupDisabled: this.#ctx.effectiveDisabled(),\n orientation: this.#ctx.orientation(),\n dir: this.#ctx.dir(),\n pageKeys: true,\n navigate: (action) => this.#ctx.overlay.navigate(this.#host.nativeElement, action),\n typeahead: (e) => this.#ctx.overlay.handleTypeahead(e),\n };\n }\n\n private onPointerDown(event: PointerEvent): void {\n if (this.#ctx.totalCount() === undefined) {\n return;\n }\n event.preventDefault();\n }\n}\n","import { Directive, inject } from '@angular/core';\n\nimport { orphanContextError } from 'forty-cdk/core';\n\nimport { FOR_SELECT_OPTION, type ForSelectOption } from './select-option';\n\n/**\n * Visibility helper inside a `[forSelectOption]`. The directive flips a\n * `[hidden]` host binding so the consumer can keep the checkmark / icon\n * inline without extra `@if` glue:\n *\n * ```html\n * <button forSelectOption value=\"apple\">\n * <span forSelectIndicator>✓</span>\n * Apple\n * </button>\n * ```\n *\n * Reflects the parent option's `data-state` (`\"checked\" | \"unchecked\"`) so\n * the consumer can also style it from CSS. Visibility while unselected is\n * enforced with an inline `display: none` (which beats any author `display`\n * rule a consumer applies via a class) in addition to the `hidden` attribute\n * that removes it from the a11y tree.\n */\n@Directive({\n selector: '[forSelectIndicator]',\n exportAs: 'forSelectIndicator',\n host: {\n 'aria-hidden': 'true',\n '[attr.data-state]': 'option.selected() ? \"checked\" : \"unchecked\"',\n '[hidden]': '!option.selected()',\n '[style.display]': 'option.selected() ? null : \"none\"',\n },\n})\nexport class ForSelectIndicator {\n private readonly option = injectParentOption();\n}\n\nfunction injectParentOption(): ForSelectOption {\n const option = inject(FOR_SELECT_OPTION, { optional: true });\n if (!option) {\n throw orphanContextError({\n code: 'FORCDK-SELECT-004',\n piece: 'ForSelectIndicator',\n root: '[forSelectOption]',\n token: 'FOR_SELECT_OPTION',\n });\n }\n return option;\n}\n","import { Directive, signal } from '@angular/core';\n\nimport { hostLabelledBy } from 'forty-cdk/core';\n\n/**\n * Optional grouping wrapper inside a `[forSelectContent]`. Renders\n * `role=\"group\"` and references the descendant `[forSelectGroupLabel]`\n * (if any) via `aria-labelledby`. Options inside a group still register\n * with the root listbox normally, so keyboard navigation traverses across\n * groups in DOM order without special handling.\n */\n@Directive({\n selector: '[forSelectGroup]',\n exportAs: 'forSelectGroup',\n host: {\n role: 'group',\n },\n})\nexport class ForSelectGroup {\n readonly #labelId = signal<string | null>(null);\n\n /** The id of the registered group label (or `null` if none). */\n readonly labelId = this.#labelId.asReadonly();\n\n private readonly labelledBy = hostLabelledBy(() => this.labelId());\n\n /** Called by `ForSelectGroupLabel` on mount. */\n registerLabel(id: string): void {\n this.#labelId.set(id);\n }\n\n /** Called by `ForSelectGroupLabel` on destroy. Idempotent. */\n unregisterLabel(id: string): void {\n if (this.#labelId() === id) {\n this.#labelId.set(null);\n }\n }\n}\n","import { Directive, inject } from '@angular/core';\n\nimport { orphanContextError, registerA11yName } from 'forty-cdk/core';\nimport { ForSelectGroup } from './select-group';\n\n/**\n * Visible label for a `[forSelectGroup]`. Generates a stable id and\n * registers with its parent group so the group's `aria-labelledby` points\n * at this element. Apply on whatever heading element fits the design\n * (often `<div>` styled as a small caption).\n */\n@Directive({\n selector: '[forSelectGroupLabel]',\n exportAs: 'forSelectGroupLabel',\n host: {\n '[id]': 'id',\n },\n})\nexport class ForSelectGroupLabel {\n /** Stable host id used by the parent group's `aria-labelledby`. */\n readonly id: string;\n\n constructor() {\n const group = inject(ForSelectGroup, { optional: true });\n if (!group) {\n throw orphanContextError({\n code: 'FORCDK-SELECT-003',\n piece: 'ForSelectGroupLabel',\n root: '[forSelectGroup]',\n token: 'ForSelectGroup',\n });\n }\n this.id = registerA11yName(group, 'for-select-group-label');\n }\n}\n","import { Directive, input } from '@angular/core';\n\n/**\n * Visual separator between options or groups inside a `[forSelectContent]`. Keyboard\n * navigation and typeahead skip it. It is always presentational (`role=\"none\"`, no\n * `aria-orientation`), because a `role=\"listbox\"` may own only `option` and `group`\n * children: wrap related options in a `[forSelectGroup]` with a group label when the split\n * must be announced.\n */\n@Directive({\n selector: '[forSelectSeparator]',\n exportAs: 'forSelectSeparator',\n host: {\n role: 'none',\n '[attr.data-orientation]': 'orientation()',\n },\n})\nexport class ForSelectSeparator {\n /**\n * Axis the separator divides along, reflected to `data-orientation` for styling.\n * `horizontal` (default) splits options stacked vertically, the common case in a\n * listbox; `vertical` splits options laid out horizontally.\n */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n}\n","/**\n * Exact public names of every `ForSelect` input, its models included. Spread it into the\n * `inputs` array of a `hostDirectives` entry so a wrapper component re-exposes the\n * primitive's full surface — the Signal Forms members `[formField]` binds among them —\n * without hand-maintaining the list. Always spread into an inline object literal as shown\n * below: the literal is what keeps the entry statically analyzable for consumers compiling\n * against the published package. An anti-drift spec fails when this list no longer matches\n * the directive's actual API. See `docs/wrapping-form-primitives.md` for both supported\n * wrapping patterns.\n *\n * @example\n * ```ts\n * @Component({\n * selector: 'div[mySelect]',\n * template: '',\n * hostDirectives: [\n * {\n * directive: ForSelect,\n * inputs: [...FOR_SELECT_HOST_DIRECTIVE_INPUTS],\n * outputs: [...FOR_SELECT_HOST_DIRECTIVE_OUTPUTS],\n * },\n * ],\n * })\n * export class MySelect {}\n * ```\n */\nexport const FOR_SELECT_HOST_DIRECTIVE_INPUTS = [\n 'value',\n 'open',\n 'align',\n 'alignOffset',\n 'ariaLabel',\n 'avoidCollisions',\n 'clipUntilPositioned',\n 'collisionPadding',\n 'compareWith',\n 'dir',\n 'dirty',\n 'disabled',\n 'dismissible',\n 'errors',\n 'hideWhenDetached',\n 'invalid',\n 'itemToFormValue',\n 'itemToLabel',\n 'loop',\n 'modal',\n 'multiple',\n 'name',\n 'orientation',\n 'pending',\n 'placeholder',\n 'position',\n 'readonly',\n 'required',\n 'returnFocus',\n 'selectionFollowsFocus',\n 'side',\n 'sideOffset',\n 'sticky',\n 'touched',\n] as const;\n\n/**\n * Exact public names of every `ForSelect` output, the Signal Forms `touch` output\n * included. Spread it into the `outputs` array of the same `hostDirectives` entry as\n * {@link FOR_SELECT_HOST_DIRECTIVE_INPUTS}.\n */\nexport const FOR_SELECT_HOST_DIRECTIVE_OUTPUTS = [\n 'valueChange',\n 'openChange',\n 'escapeKeyDown',\n 'pointerDownOutside',\n 'focusOutside',\n 'interactOutside',\n 'autoFocusOnOpen',\n 'autoFocusOnClose',\n 'touchedChange',\n 'touch',\n] as const;\n\n/**\n * Exact public names of every `ForSelectVirtualized` input. Spread it into the `inputs`\n * array of a second `hostDirectives` entry, beside the `ForSelect` one, so a wrapper\n * component that virtualizes its options re-exposes the virtualization surface too.\n */\nexport const FOR_SELECT_VIRTUALIZED_HOST_DIRECTIVE_INPUTS = [\n 'dataVersion',\n 'selectedIndex',\n 'totalCount',\n 'visibleRange',\n] as const;\n\n/**\n * Exact public names of every `ForSelectVirtualized` output. Spread it into the\n * `outputs` array of the same `hostDirectives` entry as\n * {@link FOR_SELECT_VIRTUALIZED_HOST_DIRECTIVE_INPUTS}.\n */\nexport const FOR_SELECT_VIRTUALIZED_HOST_DIRECTIVE_OUTPUTS = ['scrollToIndex'] as const;\n"],"mappings":";;;;;;AAsdA,MAAa,qBAAqB,IAAI,eAAiC,oBAAoB;AAE3F,MAAa,kBAAkB,IAAI,eACjC,mBACA;CAAE,YAAY;CAAQ,eAAe,IAAI,eAAc;AAAE,CAAE;AAmB7D,SAAgB,oBAAiC,OAAa;CAC5D,MAAM,MAAM,OAAO,oBAAoB,EAAE,UAAU,KAAI,CAAE;CACzD,IAAI,CAAC,KACH,MAAM,mBAAmB;EACvB,MAAM;EACN;EACA,MAAM;EACN,OAAO;CACR,CAAA;CAEH,MAAM,UAAU;CAChB,kBAAkB;EAChB,YAAY;EACZ,OAAO;EACP,MAAM;EACN;EACA,aAAa,QAAQ,QAAQ;CAC9B,CAAA;CACD,OAAO;AACT;AAiBA,SAAgB,2BACd,cAA8C;CAK9C,MAAM,WAAW,OAAO,oBAAoB,EAAE,UAAU,KAAI,CAAE;CAC9D,MAAM,OAAO,eAAc;EACzB,MAAM,WAAW,aAAY;EAC7B,OAAO,aAAa,KAAK,WAAW;CACtC,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAsBF,OAAO;EAAE;EAAM,KArBH,eAAc;GACxB,MAAM,WAAW,KAAI;GACrB,IAAI,CAAC,UACH,MAAM,oBAAoB;IACxB,MAAM;IACN,SAAS;IACT,MAAM;IACN,OAAO;IACP,UAAU;GACX,CAAA;GAEH,MAAM,UAAU;GAChB,kBAAkB;IAChB,YAAY;IACZ,OAAO;IACP,MAAM;IACN,OAAO;IACP,aAAa,QAAQ,QAAQ;GAC9B,CAAA;GACD,OAAO;EACT,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CACa;CAAG;AACpB;ACjdA,IAAa,Y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