/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type ValueTypeOf, type option } from "@elaraai/east"; import type { RecordSliceBindType } from "@elaraai/east-ui/internal"; import type { KeySearchSource } from "@elaraai/east-ui-components"; import { type ItemRoles, type SchematicRef } from "./canvas/drawn.js"; import { type RowHidden } from "../shared/schedule/hidden.js"; import type { HiddenPicks } from "../shared/schedule/hidden-pick.js"; import type { KindKeys } from "../shared/schedule/kind-keys.js"; import type { RowCodec } from "../shared/schedule/records.js"; import type { SchematicWords } from "./messages.js"; /** A record Slice's part, as a kind's source of the slice. */ type RecordPart = ValueTypeOf; /** One item kind, as Find seeks it. */ export interface FindKind { /** Its slot. */ readonly slot: string; /** Its name (`Rack`). */ readonly name: string; /** Its source of the slice, whose record it is sought in, through e3; `undefined` for a kind read whole. */ readonly part: RecordPart | undefined; /** Its rows, read whole — every row of its record, by key, each its roles; none while the read is in flight. */ readonly rows: () => option>; /** A stored row's roles, from its bytes and its key. */ readonly read: (bytes: Uint8Array, key: string) => ItemRoles; /** Its record's rows, as bytes and back. */ readonly codec: RowCodec; /** Its keys (#1549): each key's text read back at its record's key type, and their order. */ readonly keys: KindKeys; } /** One item Find found. */ export interface FoundItem { /** Its id on the canvas: its reference, printed. */ readonly id: string; /** Its kind's slot and its key. */ readonly ref: SchematicRef; /** Its card's name. */ readonly label: string; /** Its kind's name. */ readonly kind: string; /** Its centre; `undefined` for a row with no position. */ readonly position: { readonly x: number; readonly y: number; } | undefined; /** The layer it is on, by the layer's key. */ readonly layer: string | undefined; /** * What leaves it out on the rail — its kind's source, and which of its choices e3 has said hide it (the shared hidden * pick) — which a pick of it clears; `undefined` while the narrowing holds it. */ readonly hidden: readonly RowHidden[] | undefined; } /** What keeps a found item off the canvas but the rail's filters, as its line marks it — or `undefined` while nothing does. */ export type FoundMark = "layer" | "unplaced" | undefined; /** * What keeps a found item off the canvas but the rail's filters, which its line names apart and a pick of it clears: no * position first, then a hidden layer. * * @param item - The item found * @param hiddenLayers - The layers hidden, by key * @returns Its mark */ export declare function foundMark(item: FoundItem, hiddenLayers: ReadonlySet): FoundMark; /** * How a found item reads in Find's list: its key, its label when it is not its key, its kind's name, what keeps it off * the canvas — its layer, or no position — and, last, which of the rail's choices leave it out, as every builder's line * names them (`hiddenLine`): `hidden by the filters` until e3 has said which — or, where the narrowing draws what it * leaves out as context, `dimmed by the filters`, then the choices that dim it (`dimmedWords`). * * @param item - The item * @param mark - What keeps it off the canvas but the filters * @param words - The Schematic's words * @param dim - Whether the narrowing draws what it leaves out as context (`narrowed="dim"`), rather than hiding it * @returns Its line */ export declare function foundLine(item: FoundItem, mark: FoundMark, words: SchematicWords, dim: boolean): string; /** Props of {@link useSchematicFind}. */ export interface SchematicFindProps { /** The item kinds, in the Schematic's order. */ readonly kinds: readonly FindKind[]; /** The Schematic's words. */ readonly words: SchematicWords; /** * Each kind's hidden pick, by its slot (`hidden-pick.tsx`' `HideSources`): what a kind read through its source asks e3 * which of the rail's choices leave out a row its list shows. */ readonly picks: HiddenPicks; /** The layers hidden, by key. */ readonly hiddenLayers: ReadonlySet; /** * Whether the narrowing draws what it leaves out as context (`narrowed="dim"`), the frame's `look.dim`: a line names * the choices that dim an item, never that hide it. */ readonly dim: boolean; /** Told the item a pick lands on. */ readonly onPick: (item: FoundItem) => void; /** Told the last pick stands no more: the search cleared, or a new query asked in its place — never one asked again. */ readonly onCleared: () => void; } /** * Find's source, for the shared key search's toolbar item (see the module docs). * * @param props - The kinds, the words, each kind's hidden pick, the layers hidden, whether the narrowing dims, the pick, * and the pick let go * @returns The source; `undefined` with no item kind, which the Schematic's payload never holds */ export declare function useSchematicFind({ kinds, words, picks, hiddenLayers, dim, onPick, onCleared }: SchematicFindProps): KeySearchSource | undefined; export {}; //# sourceMappingURL=find.d.ts.map