/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. * * The canvas root's view of the controller's state (#815) — the UI facts it * lays the body out from, reconciled against the rows it renders NOW — and * the visible rows and derived numbers kept by identity, so a row whose facts * did not move keeps its memo. * * @packageDocumentation */ import { type PlanReconcileModel, type PlanSnapshot } from "../controller/index.js"; import type { PlanGrain, PlanUiState, RowKey } from "../plan-state.js"; import { type PlanDerived, type VisibleRow } from "../model.js"; /** The UI facts the canvas root lays the body out from. Selection is not one: * each row reads its own (`usePlanRowState`), so a click renders two rows. */ export interface PlanUiView { grain: PlanGrain; collapsed: ReadonlySet; chartsExpanded: ReadonlySet; /** The row-scoped focus, as the store holds it. */ focus: PlanUiState["focus"]; } /** * The root's UI view of a snapshot — the store as a reconcile against the * rendered rows leaves it. A new value's FIRST render therefore draws with * its vanished rows' focus / collapse already gone and its fresh declared * collapse already applied, and the controller's `setValue` commits the same * transition afterwards without changing what was drawn. * * @param snap - The controller's snapshot * @param model - The rows the canvas renders now * @returns The view */ export declare function uiViewOf(snap: PlanSnapshot, model: PlanReconcileModel): PlanUiView; /** Two views say the same thing — compared by CONTENT, so a store that moved * to what the view already showed renders nothing. */ export declare function sameUiView(a: PlanUiView, b: PlanUiView): boolean; /** * The visible rows, each kept by IDENTITY while its row value, depth and * collapse are unchanged — so a paged window landing (which re-derives the * list) hands every row already on screen the object it had, and its memo * holds (#815). * * @param visible - This render's visible rows * @returns The same rows, previous objects reused where nothing moved */ export declare function useStableVisible(visible: readonly VisibleRow[]): readonly VisibleRow[]; /** * The derived numbers, each row's entries kept by IDENTITY while their * content holds ({@link stableDerived}) — so a re-derivation that moved one * row's numbers renders that row, not every row with a derived entry. * * @param derived - This render's derivation * @returns The same numbers, previous entries reused where nothing moved */ export declare function useStableDerived(derived: PlanDerived): PlanDerived; //# sourceMappingURL=view.d.ts.map