/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import type { option } from "@elaraai/east"; import type { OptimiseRowRef } from "./optimise-diff.js"; /** The rows an answer waits on, as they are read, and what moves as they are. */ export interface OptimiseRows { /** * Names the rows an answer waits on: read by their keys from the next render. The same rows named again ask * nothing new. * * @param rows - The rows, each by its kind and its key's text; none once the answer has landed */ want(rows: readonly OptimiseRowRef[]): void; /** * A row named, as its read by its key left it. * * @param kind - The kind's slot, or the record's key * @param id - The row's key's text * @returns Its row; `none` for one the record does not hold; `undefined` for a row not named, or still being read */ read(kind: string, id: string): option | undefined; /** Moves as a row named is read: a text of the rows named and where each read stands. */ readonly key: string; } /** Several rows of one kind's record read by their keys, in one read: each row by its key's text; `undefined` while the read is on its way. */ export type OptimiseRowsReader = (kind: string, ids: readonly string[]) => ReadonlyMap> | undefined; /** No rows read by their keys: a builder with no session over its records — a read-only one, which has no optimiser — reads none. */ export declare const NO_OPTIMISE_ROWS: OptimiseRowsReader; /** * Reads the rows an answer waits on (see the module docs). * * @param readByKeys - Several rows of a kind's record by their keys, in one tracked read (`ScheduleEditing.rowsByKey`) * @returns How the builder names the rows, each as it is read, and what moves as they are */ export declare function useOptimiseRows(readByKeys: OptimiseRowsReader): OptimiseRows; //# sourceMappingURL=optimise-rows.d.ts.map