/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. * * The paged canvas's vocabulary (#577) — the page size, the failed-band floor, * the decoded source type and the viewport report — shared by the paging * driver, the window reader and the chrome. * * The driver itself is framework-free since #815: `controller/paging.ts` holds * the ledger and the residency as plain state, and the canvas controller owns * it. (This module held the React hook that sequenced them through four * effects that set each other's state.) * * @packageDocumentation */ import type { option } from "@elaraai/east"; import type { PlanBand, PlanRootValue, PlanWireBlock } from "./model.js"; import { elementsIn, type CarriedEntry, type WindowedSourceValue } from "@elaraai/east-ui-components/internal"; /** * The decoded windowed arm — `paged`; `pinned` with its revision and refresh; * or `live` with its narrowing too, the rail's `rows` source (#1354) — the * derived source at the canvas's blocks (#823). A source the canvas composes * over another — a paged `data` with the event kinds' events joined into every * window (#1192, #1199, #1541) — names the snapshot of the data its * windows read apart from its revision, which moves too when its windows are * read again over the same data: new events placed on them, new drafts. A key * search's answer indexes the snapshot alone. */ export type PlanPagedSourceValue = WindowedSourceValue & { /** The snapshot of the data its windows read, `none` while it resolves; omitted, its revision is that snapshot. */ readonly snapshot?: (() => option) | undefined; /** * A window's blocks as the source draws them NOW, from the entries the window carried (#1599), reading nothing: * the canvas's unsaved changes, and what a Save landed, in their entries' place, with whatever the source composes * over them. What a window standing in while it is read again is drawn as, so a change made meanwhile is drawn at * once. `undefined` where it cannot — and for a source that draws its windows as they were read, which has none. */ readonly redraft?: ((entries: readonly CarriedEntry[]) => readonly PlanWireBlock[] | undefined) | undefined; /** What a redraft draws from, as text that moves when it does: a window standing in is drawn again only then. */ readonly redrafted?: (() => string) | undefined; }; /** * The windowed arm a source the canvas composes over another rides: that * source's own — a pinned source stays pinned, and a live one, the rail's * `rows` source, stays live (#1354), so the driver follows its narrowing. * * @param rows - The root's rows, a windowed arm * @returns The arm's name */ export declare function windowedArm(rows: PlanRootValue["rows"]): "paged" | "pinned" | "live"; /** Source elements per window — the IR's, since its editing session reads an * entry back from the very window the canvas paged it in (#880). */ export { PLAN_PAGE_SIZE } from "@elaraai/e3-ui/internal"; /** The shortest a failed window's band renders (#811) — its reason and its * Retry must stay legible even in a short last window, or before any window * has taught the ledger its geometry. The geometry table's entry (#817); the * same at every density. */ export declare const FAILED_BAND_MIN_PX: number; export type { PlanBand, PlanWindowFailure } from "./model.js"; /** * Where the viewport is, in the caller's own terms. * * @remarks * `VirtualRows` reports a mounted range in BODY-ITEM indices, and the body is * the canvas's business — it interleaves gap bands under a links focus, hides * collapsed subtrees, pins rows above the scroll. So the canvas says which ROW * (or which band) the viewport is over, and the driver maps that back to a * block and a window through the origin map (#823: each paged block pages on * its own, so demand follows the block the viewport is in). No layout * knowledge crosses the boundary. With it, where the caller can say, the * windows the view shows (`shows`): what the footer's loading line and the * frame's busy follow (#1398), never a window read ahead of the view. */ export type PlanViewport = ({ kind: "row"; key: string; } | { kind: "band"; /** The block whose band it is (#823). */ block: number; at: "head" | "tail"; /** Pixels from the band's own top to the viewport center, when the * caller knows them (`VirtualRows`' center report). Without them the * driver can only name the window adjacent to the run — a far * scrollbar drag then walks the gap instead of rebasing (#612). */ px?: number | undefined; } /** A failed window's band — it names its own block and window (#811). */ | { kind: "window"; block: number; w: number; }) & { /** The windows the view shows — each row's, a run's nearest its rows; absent, the driver takes any window in flight as the view's. */ shows?: readonly number[] | undefined; }; /** Elements the band covers, for its caption. */ export declare function bandElements(band: PlanBand): number; /** Re-exported so the renderer can size a band's own slot. */ export { elementsIn }; //# sourceMappingURL=use-plan-paging.d.ts.map