import { type Mountable } from './build-context.js'; import type { Renderable } from './element.js'; import { type RowCtx } from './row.js'; import type { EachSource } from './each.js'; export interface VirtualEachSpec extends EachSource { key: (item: T) => string | number; /** Row height in pixels. A `number` is a uniform fixed height (O(1) windowing); * a function returns a per-item height, letting rows vary — the window, spacer, * and row offsets are computed from cumulative heights (prefix sums, rebuilt when * `items` changes). Heights must be known from the data; measured/auto heights * are not supported. */ itemHeight: number | ((item: T, index: number) => number); /** scroll-container height in pixels */ containerHeight: number; /** extra rows rendered above/below the viewport (default 3) */ overscan?: number; /** optional class on the scroll container */ class?: string; /** Additional COMPONENT-STATE dep paths the rows read, merged into the * structural binding's deps so a state-only change (items unchanged) still fires * the reconcile and refreshes visible rows. The authoring `virtualEach` passes * `['']` (whole state); a compiled tier could pass precise paths. Without it, a * row reading component state was frozen out of state-only changes (stale DOM). */ extraDeps?: readonly string[]; /** build a row; `getCtx` exposes the row's live `{ item, state, index }` ctx * (same shape as `signalEach`) for runtime item/index handles. */ renderRow: (getCtx: () => RowCtx) => Renderable; } /** * Virtualized keyed list — only the rows in the scroll viewport (+overscan) exist * in the DOM. A scroll container (fixed `containerHeight`, `data-virtual-container`) * holds an inner spacer (`data-virtual-spacer`) sized to the total height; each * visible row is absolutely positioned (`translateY`) at its cumulative offset. * * On scroll the visible window is recomputed and rows are reconciled BY KEY using * the same per-row machinery as `signalEach` (per-row sub-build via `runBuild` * with `inherit`, a row scope mounted on a `{ item, state, index }` ctx, teardowns * on removal). Rows scrolled out are disposed; rows scrolled in are built. The * window also recomputes when `items` changes (a spec gated on `items.deps`). * * `itemHeight` is a uniform `number` (O(1) windowing) or a per-item function * `(item, index) => number` for variable-height rows (cumulative offsets via a * prefix sum, rebuilt when `items` changes). Heights come from the data — * measured/auto heights are not supported. */ export declare function signalVirtualEach(spec: VirtualEachSpec): Mountable; //# sourceMappingURL=virtual-each.d.ts.map