/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type ValueTypeOf } from "@elaraai/east"; import { Schematic } from "@elaraai/e3-ui/internal"; import { type SchematicDensity, type SchematicViewport, type SchematicViewportStore } from "./area.js"; import { type CardRoles, type DetailsRoles, type ItemRoles, type SchematicDrawn } from "./canvas/drawn.js"; import type { WorldBox } from "./canvas/model.js"; /** The Schematic's payload, decoded. */ export type SchematicValue = ValueTypeOf; /** * What the Schematic reads now, as the footer's loading line says it (#1398, CL3): the first kind in the Schematic's * order whose read is in flight, and whether that read is of a new narrowing, the last standing in. */ export interface SchematicReading { /** The kind's slot. */ readonly slot: string; /** * What of it is read: its record whole, or its narrowing complete (`rows`: `Loading racks…`); its window's rows * (`area`: `Loading racks in view`); its density's counts (`counts`: `Loading counts`); or its rows' details, its rows * drawn meanwhile (`details`: `Loading details for 12 racks`). */ readonly what: "rows" | "area" | "counts" | "details"; /** Whether its source's narrowing is not the one its drawing was read under: `Filtering racks…`, whatever is read. */ readonly filtering: boolean; /** How many of its rows drawn wait on their details; `0` but while its details are read. */ readonly waiting: number; } /** What the Schematic has read of its kinds' records. */ export interface SchematicData { /** What the canvas draws: the last settled read's entities. */ readonly drawn: SchematicDrawn; /** Whether a read the drawing needs — a kind's rows, or its details read whole — is in flight. */ readonly loading: boolean; /** What is read now, the first kind in flight in the Schematic's order; `undefined` while nothing is. */ readonly reading: SchematicReading | undefined; /** * Whether what the canvas draws of a kind was read under a narrowing its source no longer holds, the new one's read * in flight (#1398, CL8): it stands in, kept, until the new one lands — never a kind whose read of it failed. */ readonly filtering: boolean; /** Whether a read has settled: every kind read, or its read failed. */ readonly ready: boolean; /** Why the read as a whole failed — outside any one kind's. */ readonly error: string | undefined; /** Why a kind's read failed, by the kind's slot. */ readonly failures: ReadonlyMap; /** How many rows each kind's settled read holds, by the kind's slot — those with no position among them. */ readonly rows: ReadonlyMap; /** * Each kind's rows the settled read holds, by the kind's slot, then by key — each one's details' roles, where its * kind's details are read whole beside it (#1388): which rows a draft draws over, and what a drafted card draws. */ readonly held: SchematicHeldRows; /** * Each item kind's rows the settled read holds with no position, by the kind's slot, then by key — each one's roles, * in their keys' order (#1389, #1549): what the library's Backlog lists, the drafts over them. */ readonly unplaced: SchematicUnplacedRows; /** * Each kind read by area, by its slot: the rows its settled window holds, by key, each its row's bytes — what a * gesture's original, a Save's confirmation and the inspector find a row in before reading it by key (#1393). */ readonly windows: SchematicWindowRows; /** * Each kind read by area, by its slot: the revision its record reads at now, whatever of its window is in flight — * none for one whose record names none yet. A window read at another revision is from before it: what tells a window * read before a Save from one read since (`drafted.ts`). */ readonly revisions: ReadonlyMap; /** Each kind read by area drawing its density in place of items, by its slot (D25). */ readonly density: ReadonlyMap; /** Each kind read by area's whole drawing's density, by its slot: what the minimap draws of it (#1393). */ readonly overview: ReadonlyMap; /** * Each kind read by area under `narrowed="dim"` and a narrowing, by its slot: the rows its window holds that the * narrowing holds, as `within` answered (D28) — what draws as a match, and the rest as context. */ readonly matched: ReadonlyMap>; /** * What the reads in flight have not drawn yet, in world units, as disjoint boxes (#1398, CL2): each kind read by area * whose window's rows or counts are read, the reach it reads less the reach its drawing holds — what the canvas washes. */ readonly unread: readonly WorldBox[]; /** * Each kind read by area whose read failed, by its slot: the area it failed reading — its window's reach less what its * drawing holds, or, where its drawing holds it all, the reach — where the canvas says so, at its top-left (CL11). */ readonly failedAreas: ReadonlyMap; /** * Under `fit`, each kind read by area its narrowing narrows, by its slot: the box its narrowing's rows stand in, as its * area index's counts answer it (§10.3) — `null` where it holds none — what the camera flies to, beside the narrowing it * was read under, printed, so a narrowing that has moved since waits for its own. */ readonly fits: ReadonlyMap; /** Whether a kind's box under `fit` is read: the camera waits for it before it flies. */ readonly fitting: boolean; } /** The box a kind read by area's narrowing's rows stand in under `fit`, and the narrowing it was read under. */ export interface SchematicFit { /** The narrowing, printed. */ readonly under: string; /** The box, in world units; `null` where the narrowing holds no row. */ readonly box: WorldBox | null; } /** The rows a kind's window holds, by key, each its row's bytes, and the revision of the record they were read at. */ export interface SchematicWindowHeld { /** The record's revision they were read at. */ readonly revision: string; /** The rows, by key. */ readonly rows: ReadonlyMap; } /** Each kind read by area, by its slot: the rows its window holds, at the revision they were read at. */ export type SchematicWindowRows = ReadonlyMap; /** Each item kind's rows a read holds with no position, by the kind's slot, then by key: each one's roles. */ export type SchematicUnplacedRows = ReadonlyMap>; /** One row a kind's read holds: its details' roles, where its kind's details are read whole beside it. */ export interface SchematicHeldRow { readonly details: DetailsRoles | undefined; /** The card roles its kind's details give, while its details row is read and none stands in: a drafted card over it holds their places (#1398). */ readonly pending?: CardRoles | undefined; } /** Each kind's rows a read holds, by the kind's slot, then by key. */ export type SchematicHeldRows = ReadonlyMap>; /** The frame's data before its reader first reports: nothing drawn, a read in flight. */ export declare const INITIAL_SCHEMATIC_DATA: SchematicData; /** * The kinds read by area, by their slots (#1393): each item and zone kind * whose source of the slice lists an area index — what is never read whole, * nor its narrowing complete, whether or not its indexes read it. * * @param value - The payload * @returns Their slots */ export declare function areaSlots(value: SchematicValue): ReadonlySet; /** * Reads the drawing (see the module docs). * * @param value - The payload * @param attempt - Moves to read every kind afresh: a Retry * @param viewport - Where the canvas's viewport rests, which a kind read by area reads its window around; `undefined` before the canvas has reported it * @returns What the Schematic has read */ export declare function useSchematicData(value: SchematicValue, attempt?: number, viewport?: SchematicViewport): SchematicData; /** * The drawing's reads, in a component of its own (#1343): each scan and page * that lands re-runs it alone, and it hands the frame what it read only when * what the frame shows moves. It hears where the canvas's viewport rests from * the store the canvas writes (#1393), re-reading only itself as it moves. It * hands the frame what it read once its own render is done, so the frame * draws it in a task of its own: a read that settles a window of thousands of * rows, and the frame drawing them, are never one long task (#1393). * * @param props - The payload, the read's attempt, the viewport's store, and where the data goes * @returns Nothing: it reads */ export declare function SchematicDataReader({ value, attempt, viewport, onData }: { value: SchematicValue; attempt: number; viewport: SchematicViewportStore; onData: (data: SchematicData) => void; }): null; //# sourceMappingURL=data.d.ts.map