/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The Index of the item kinds read by area (#1393, `Schematic Builder Spec.md` * §8, D52): what no window holds of them, read for the Index alone. * * - **An open zone's items** are read through each such kind's source by the * zone's box: the area index its window would read through * (`schematicWindowPlan`), the box's cells (`areaCells`) counted, then — * while they hold no more than a window reads — their entries read, each * cell's kept at its revision while an open zone wants it; the narrowing's * choices that index doesn't lead asked of the rows in one `within` (D28). * The rows whose centre the zone holds are its items, nested as every item * is. A zone whose box holds more than a window reads lists none of them, * and says so. * - **Their details** are read beside them by the same cells, as the canvas * reads a window's (D45): the details' rows of each cell's entries, every * cell not held in one request of the details' record — the server reading * each entry's key from the area index, none sent — kept at the kind's * revision and the details' while an open zone wants it. So each item's dot * carries its status, and its row its figure, as the canvas draws them * (#1570); a zone's items are listed only once both have landed. * - **Its search** reads each such kind through its source's `search` fields * (ruling 11), as a paged tab's search does (`pagedSearchWhere`): a prefix of * the first field that combines with the rail's choices, its first * {@link INDEX_MATCHES} matches read, and how many more it holds said. * * Nothing it reads is the record whole. Each result is the same object while * what it was read from is, and names the revision it read each kind at: what * a Save landed of a kind is drawn until the Index reads it since * (`drafted.ts`' `landedRead`). * * @packageDocumentation */ import { type ValueTypeOf } from "@elaraai/east"; import { type RecordSliceBindType } from "@elaraai/east-ui/internal"; import { type SchematicAreaIndexes } from "@elaraai/e3-ui/internal"; import { type Reading } from "./area.js"; import { type DrawnItem, type DrawnZone, type ItemRoles } from "./canvas/drawn.js"; import type { SchematicValue } from "./data.js"; import { type KindRows } from "./kind-rows.js"; /** A kind's source of the slice. */ type Part = ValueTypeOf; /** An item kind, decoded. */ type ItemKind = SchematicValue["items"][number]; /** The most matches of a search the Index reads a kind: past them, it says how many more there are. */ export declare const INDEX_MATCHES = 50; /** An item kind read by area: the kind, its source of the slice and its area indexes. */ export interface IndexAreaKind { /** The kind. */ readonly kind: ItemKind; /** Its source of the slice. */ readonly part: Part; /** Its area indexes. */ readonly areas: SchematicAreaIndexes; } /** What the Index read of the item kinds read by area. */ export interface IndexAreaRead { /** Their items: the open zones', or the search's matches — each once. */ readonly items: readonly DrawnItem[]; /** The zones whose box was read, by id: what they hold of those kinds is whole. */ readonly read: ReadonlySet; /** The zones whose box holds more than a window reads, by id: they list none of those kinds' items. */ readonly crowded: ReadonlySet; /** How many matches of the search those kinds hold past those read. */ readonly more: number; /** The revision each kind was read at, by its slot. */ readonly revisions: ReadonlyMap; } /** Nothing read: no kind read by area, or no zone open and no search. */ export declare const NO_INDEX_AREA: IndexAreaRead; /** The Index's reads of the item kinds read by area, kept across reads — see the module docs. */ export declare class SchematicIndexArea { private readonly rows; /** Each kind's cells' entries, by its slot, then by the index they were read through, at a revision: those an open zone wants. */ private readonly kept; /** Each kind's cells' details, by its slot, then by the index they were read through (D45): those an open zone wants. */ private readonly joined; /** What the details' `rowsOf` has made of their rows: all a read asks for, at once, since the Index draws them in one pass. */ private readonly making; /** The last result, and what it was read from. */ private last; /** * @param rows - The kinds' rows as their `rowsOf` makes them, shared with the paged Backlog: what a gesture on one rewrites */ constructor(rows: KindRows); /** * What the Index reads of the kinds: the open zones' items, or — searching — the matches. * * @param kinds - The item kinds read by area * @param open - The zones open in the Index * @param query - The Index's search; empty, none * @returns What it read; {@link READING} while a count, a page or an answer is read */ read(kinds: readonly IndexAreaKind[], open: readonly DrawnZone[], query: string): IndexAreaRead | Reading; /** A kind's items in the open zones: each zone's box's cells counted, then read while they hold no more than a window reads. */ private zones; /** A kind's search through its source's `search` fields: its first {@link INDEX_MATCHES} matches, and how many more. */ private search; /** Some cells' entries through an index at a revision: those not held read in one request. */ private entriesOf; /** * Some cells' details' rows (D45), as the canvas reads a window's (`area.ts`' `detailsOf`): the details' rows of the * cells' entries through an index — those not held read in one request of the details' record, the server reading * each entry's key from the index, none sent — kept at the kind's revision and the details', made their stored rows. * * @param kind - The kind * @param index - The area index the cells are of * @param revision - The kind's revision the cells' entries were read at * @param cells - The cells * @param keys - The kind's keys, which its details are keyed as: each details row by its key's text (#1549) * @returns The cells' rows of the details, in order, and the rows made of them, by key; `undefined` for a kind with * no details, or details read by no paged read; {@link READING} while the details' revision or a cell's rows are read * @throws {Error} When the details' paged read is bound on no page this runtime serves */ private detailsOf; /** Lets go of the cells of a kind no open zone wants, its entries' and its details', through every index. */ private forget; } export {}; //# sourceMappingURL=index-area.d.ts.map