/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type option, type ValueTypeOf } from "@elaraai/east"; import type { SeekQueryType, SeekRangeType } from "@elaraai/east-ui"; import { RecordSliceWhereType, type RecordSliceBindType } from "@elaraai/east-ui/internal"; import { type LensGeometry, type LensLayout, type LensWords } from "./lens-layout.js"; import type { SheetPagedSourceValue, SheetRowValue } from "./values.js"; type Where = ValueTypeOf; /** The most pages the lens has in flight at once: well within the record Slice's 32 cached pages and the paging runtime's held answers. */ export declare const LENS_BUDGET = 16; /** * Where a key lands among a `rows` source's record's own rows, in the * record's order (#1349): what the sheet's key search seeks over a record. A * tracked read: none while it is pending. * * @param part - The `rows` source's part of the slice * @param query - The key query, in the record's primary key's order * @returns Where it lands; none while pending */ export declare function seekRecord(part: ValueTypeOf, query: ValueTypeOf): option>; /** The lens's view of the record, as the sheet draws it. */ export interface RecordLens { /** The layout drawn: the narrowing's, the last one while a new narrowing or revision is read, or — switched off — the last one, kept for its host. */ layout: LensLayout | undefined; /** The rows that layout draws, in the record's order, and each one's position. */ rows: readonly SheetRowValue[]; positions: readonly number[]; /** The record's rows, once placed. */ total: number | undefined; /** How many rows the narrowing holds, once placed. */ matches: number | undefined; /** The record's revision the lens reads at, once known: what the answers of which choices hide a row are kept by. */ revision: string | undefined; /** * Whether the layout drawn was read before that revision: the last one's, standing in while this one's is read — * what a Save's rows are drawn over as it left them, never as they were before it. */ readBefore: boolean; /** Whether the narrowing's layout is drawn: its placement begun and the segments near the view read. */ ready: boolean; /** Whether a read is still in flight. */ loading: boolean; /** * The segments of matches it is reading, each by its first row — a piece of it wanted and not landed yet, on its way * or waiting a turn — in the order it reads them: a jump's, then those the view meets, then those beyond it. What its * host names and marks busy of the stretches it draws as bands (#1398): never one it is not reading. */ reading: readonly number[]; /** The last layout stands in while a new narrowing is read. */ replacing: boolean; /** * The last layout stands in while its rows are read again for a source that reads them another way (#1599): * retained, since its rows are the last reading's, until the rows near the view have landed. */ reread: boolean; /** Why the placement could not be read, while rows show beside it. */ sourceError: string | undefined; /** Why the placement could not be read, when nothing has been drawn. */ error: string | undefined; /** Bumps when what is drawn changes height at a constant count. */ sizeVersion: number; /** A key search's jump: its row, and whether it is drawn — or known to be a row the narrowing does not hold. */ jump: { window: number; settled: boolean; } | undefined; /** The view moved: the rows its first and last items stand for, read at rest. */ reportViewport: (from: number, to: number, isScrolling: boolean) => void; /** Read where a row is, beside the view, until it is drawn — its host scrolls to it — or known hidden. */ jumpToElement: (position: number) => void; /** Drop the jump: where it drew its row, the view stays read there until the frame reports where it rests. */ clearJump: () => void; /** Ask again: a failed segment, by its first row, or with none everything that failed. */ retry: (w?: number) => void; /** * The stored entry the page that read the row drawn at a position carried for an id (#1599) — the reading the layout * drawn was made from, the last one's while it stands in: what a gesture on a row the lens shows begins from, and * what its marks are read over. `undefined` where the source's pages carry none. */ entryOf: (id: string, at: number) => Uint8Array | undefined; } /** What {@link useRecordLens} lays out over. */ export interface RecordLensInput { /** The record's own rows, every one in its order — `undefined` while the lens is off. */ source: SheetPagedSourceValue | undefined; /** The `rows` source's part of the slice: what places the narrowing and asks which rows it holds. */ part: ValueTypeOf | undefined; /** The narrowing. */ where: Where | undefined; geometry: LensGeometry; words: LensWords; } /** * Reads and lays out the lens over a record (#1349). * * @param input - The record's rows, the narrowing, and how the lens draws * @returns What the sheet draws, and the callbacks it feeds back */ export declare function useRecordLens(input: RecordLensInput): RecordLens; export {}; //# sourceMappingURL=use-lens.d.ts.map