/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. * * Row focus (R1 links / R2 expand): the links family it gathers, and the * focused row's developer render with its height clamp. * * @packageDocumentation */ import { type ComponentProps, type RefObject } from "react"; import { type EastChakraComponent } from "@elaraai/east-ui-components"; import { type LinkFamily, type PlanDerived, type PlanFocusCtx, type PlanLinkValue, type PlanRootValue, type PlanRowIndex, type VisibleRow } from "../model.js"; import type { RowKey } from "../plan-state.js"; import type { PlanUiView } from "./view.js"; type UIValue = ComponentProps["value"]; /** The focus's reach over the rows. */ export interface PlanFocus { /** The links focus's transitive family. */ linkFamily: LinkFamily | undefined; /** The rows a links focus gathers (focus + family) — the ends its ribbons may join. */ focusVisibleKeys: ReadonlySet | undefined; /** Which row is focused, and how — what the row roles need. */ focusCtx: PlanFocusCtx | undefined; } /** * The focus's family closure and height context. * * @param focus - The active row focus * @param links - The decoded link graph * @returns The family, the rows it gathers, and the focus context */ export declare function usePlanFocus(focus: PlanUiView["focus"], links: readonly PlanLinkValue[]): PlanFocus; /** Where the focused row's developer render is measured against. */ export interface PlanExpandFrame { /** The virtualizer's scroll viewport — how much canvas there is. */ scrollElRef: RefObject; /** The sticky chrome above the rows, inside that viewport. */ headerRef: RefObject; } /** The R2 render and the height context the rows are measured with. */ export interface PlanExpand { /** Whether the root declares `expandRender` (rows grow the expand control). */ canExpand: boolean; /** The focused row's developer render / gutter body, or `null`. */ expandBody: UIValue | null; expandGutterBody: UIValue | null; /** The focus context with the render's clamped height — every `rowHeight` call's. */ heightCtx: PlanFocusCtx | undefined; } /** * The focused row's developer render — the ROOT's `expandRender` resolver * called with the row's id (#822; rows only DECLARE `{ height, axis }`), * evaluated once per focus — and the v2 clamp on its height. * * @param value - The latest root (its resolvers) * @param focus - The active row focus * @param focusCtx - Which row is focused * @param rows - The row index, the visible rows and the derivations the clamp sums * @param dense - The declared density * @param chartsExpanded - The user's expanded chart rows * @param frame - The elements the clamp measures * @param live - Whether the canvas layout is showing (the narrow cards size their own render) * @returns The render and the height context */ export declare function usePlanExpand(value: PlanRootValue, focus: PlanUiView["focus"], focusCtx: PlanFocusCtx | undefined, rows: { index: PlanRowIndex; visible: readonly VisibleRow[]; derived: PlanDerived; }, dense: boolean, chartsExpanded: ReadonlySet, frame: PlanExpandFrame, live: boolean): PlanExpand; export {}; //# sourceMappingURL=focus.d.ts.map