import { type Readable } from '@vielzeug/ripple'; import { type DirectiveResult, type HTMLResult } from '../template/result'; type MaybeReactiveArray = Readable | (() => T[]) | T[]; /** * Renders a keyed list of items as a `DirectiveResult`. * * Each item is rendered by the provided render function. * Items are reused by key when the list changes; only stale items are destroyed. * * The render function receives a `Readable` signal and a `Readable` index * signal. Use `item.value` to read the current item inside reactive expressions: * * ```ts * html`${each(items, (item) => item.id, (item) => html`
  • ${() => item.value.name}
  • `)}` * ``` * * **Plain array:** when a plain `T[]` is passed (not a signal or getter), it is * treated as a one-time static render. Mutations to the original array are not * tracked. Pass a `Signal` or `() => T[]` for reactive lists. * * **Optional fallback:** the fourth argument renders when the list is empty. * * **Key choice:** pass a stable item identifier (e.g. `item.id`), never the * array index — an index-based key reassigns to a different item whenever the * list is reordered or an item is inserted/removed before it, causing full * item teardown/recreation instead of the in-place update `each()` is built * for. * * **Duplicate keys:** a reconciliation failure (e.g. duplicate keys, see `eachDuplicateKey`) * does not throw past this function — an uncaught exception inside the reactive effect that * drives `each()` would risk corrupting unrelated effects scheduled in the same update batch. * Instead the list is cleared and the failure is reported via the `ore:error` DOM event (see * `OreLifecycleError`, phase `'each-reconcile'`) plus a dev-only console log — listen for * `ore:error` on `document`/`window` to observe this in every build, including production. */ export declare function each(list: MaybeReactiveArray, keyFn: (item: T, index: number) => string | number, render: (item: Readable, index: Readable) => HTMLResult, fallback?: () => HTMLResult): DirectiveResult; export {}; //# sourceMappingURL=each.d.ts.map