/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type EastTypeValue, type option } from "@elaraai/east"; import { type DatasetKeyMatchRange, type DatasetKeyQuery } from "@elaraai/east-ui-components"; import type { SheetPagedSourceValue } from "./values.js"; /** A row the box lists: its place in the source, its line, and what the box shows once it is picked — its key. */ export interface SheetListed { readonly row: number; readonly label: string; readonly text: string; } /** What the toolbar's key search drives — the shared item's source (`useKeySearchToolbarItem`, #1221). */ export interface SheetSearch { /** Source snapshot identity; remounts cached positional search results. */ resetKey: string; keyType: EastTypeValue; /** Locate a query — resolves when the tracked search lands. */ find: (query: DatasetKeyQuery) => Promise; /** Label the popup's rows of the match run, each read through the source by its position — its row's id, and whether a narrowing hides it, and by which filters. */ listRange: (row: number, limit: number) => Promise; /** Jump to the match at source position `row` — a row the narrowing hides, by clearing the filters that hide it. */ jump: (row: number) => void; /** Drop the query and its jump target. */ clear: () => void; /** Moves as e3 says which filters hide the rows listed: the box lists them again. */ relist?: number | undefined; } export interface SheetSeekState { /** Mount data for the search control — `undefined` when the source declares no `seek`. */ search: SheetSearch | undefined; /** The source position the ring should land on once resident. */ target: number | undefined; /** The target landed (or was abandoned). */ clearTarget: () => void; } /** * Which of the source's rows `[from, from + count)` a narrowing of them holds — a tracked read, `none` while pending: * the `rows` source's narrowing drawn over its record's rows as the lens (#1349). */ export type SheetSeekHeld = (from: number, count: number) => option; /** * A narrowing of the source's rows that hides some of them: what the box asks * of a listed row, what it says of one it hides, and what a pick of one does * (the hidden pick). */ export interface SheetSeekNarrowing { /** Which of a run of the rows it holds. */ held: SheetSeekHeld; /** A listed row it hides, as the box lists it, by its key: the filters that hide it once e3 has said, else that filters do. */ hiddenLine: (key: string) => string; /** Asks e3 which filters hide the listed rows it hides, by the listing's first row, each row's key and whether it holds each. */ askHidden: (from: number, keys: readonly string[], held: readonly boolean[]) => void; /** A pick of a listed row it hides, by its position and its key: those filters cleared, and the row gone to. */ reveal: (row: number, key: string) => void; /** Moves as e3's answers land: the box lists its rows again. */ version: number; } /** * Wire a paged source's `seek` to the sheet. * * @param source - The decoded `paged` arm (undefined ⇒ inline sheet) * @param jumpToElement - Ask the driver to rebase residency on a position * @param clearJump - Drop the driver's pending jump pin * @param narrowing - A narrowing of the source's rows that hides some of them, and what the box does about those; else `undefined` * @returns The search mount and the landing target */ export declare function useSheetSeek(source: SheetPagedSourceValue | undefined, jumpToElement: (element: number) => void, clearJump: () => void, narrowing: SheetSeekNarrowing | undefined): SheetSeekState; //# sourceMappingURL=use-seek.d.ts.map