/** Shared option shape for the SvGrid UI-kit selection controls. */ export type ListOption = { value: string | number; label: string; disabled?: boolean; /** Optional group heading this option belongs under. */ group?: string; /** Optional color swatch (any CSS color) shown before the label. */ color?: string; }; /** * Coerce a raw options array into well-formed ListOptions. A primitive item * (`1`, `'a'`) becomes `{ value, label: String(value) }`; an object missing a * `label` or `value` gets the other filled in. This makes a caller who passes * e.g. `[1, 2, 3]` or `['a', 'b']` render sensibly instead of crashing a keyed * `#each` on `undefined`/duplicate `value`s. */ export declare function normalizeOptions(raw: ReadonlyArray | null | undefined): ListOption[]; /** Case-insensitive substring filter over option labels. */ export declare function filterOptions(options: ReadonlyArray, query: string): ListOption[]; /** An option carrying its position in the flat source array (for prop-getters). */ export type IndexedOption = ListOption & { index: number; }; /** A section of options that share a `group` heading (null = ungrouped). */ export type OptionGroup = { group: string | null; options: IndexedOption[]; }; /** * Bucket options by their `group` heading, preserving each option's flat index * so grouped rendering still drives `optionProps(index)` etc. Groups appear in * first-seen order. When no option sets `group`, the result is a single * `group: null` section (render it flat). */ export declare function groupOptions(options: ReadonlyArray): OptionGroup[]; /** Whether any option declares a `group` (so headings are worth rendering). */ export declare function hasGroups(options: ReadonlyArray): boolean; /** Fixed px, or a per-option function - lets a virtualized list mix row heights. */ export type RowHeight = number | ((opt: IndexedOption, index: number) => number); /** One row of the flattened virtualization model: a group heading or an option. */ export type VirtualListRow = { type: 'group'; label: string; size: number; } | { type: 'option'; opt: IndexedOption; size: number; }; export type FlatVirtualModel = { /** Group headings + options in render order, each with its px height. */ entries: VirtualListRow[]; /** Whether any group heading rows are present. */ hasGroups: boolean; /** Height (px) of the entry at flat index `i` - feeds the virtualizer's `estimateSize`. */ sizeAt: (i: number) => number; /** Maps an OPTION index (position in the source options array, as used by * `optionProps(index)`) to its flat entry index - so the active option can * be scrolled into view even with group rows interleaved. */ optionFlatIndex: number[]; }; /** * Flatten a (possibly grouped) option list into a single virtualization model: * group headings become rows interleaved with their options, and each row * carries its pixel height. This is what lets the selection controls window a * GROUPED list (previously they fell back to rendering every node) and support * variable row heights, while reusing the shared `createSvelteVirtualizer`. * * Pure - no DOM. Builds on `groupOptions`, which already tags each option with * its flat `index` (the value `optionProps(index)` expects). */ export declare function flattenForVirtual(options: ReadonlyArray, opts: { rowHeight: RowHeight; groupHeaderHeight?: number; }): FlatVirtualModel; /** * Next enabled option index whose label starts with `buffer` (type-ahead), * searching forward from just after `from` and wrapping. Returns -1 for no * match / empty buffer. Case-insensitive. */ export declare function nextTypeaheadIndex(options: ReadonlyArray, buffer: string, from: number): number; /** * A tiny type-ahead buffer: accumulates printable characters within `timeout` * ms of each other, then resets. Frameworkfree; the caller supplies scheduling. */ export declare function createTypeaheadBuffer(timeout?: number): { readonly value: string; /** Append a character and (re)arm the reset timer. Returns the new buffer. */ push(char: string): string; clear(): void; }; /** Whether a keydown is a bare printable character (a type-ahead candidate). */ export declare function isTypeaheadKey(e: KeyboardEvent): boolean;