/**
* Copyright (c) 2025 Elara AI Pty Ltd
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
*
* What the inspector reads of the canvas's rows (#1197, `Plan Builder
* Spec.md` PB40): what a heat, table or chart row draws in one bucket, in
* words — the values the canvas draws there, folded to the period as the row
* draws them (#824), each said as its own cell says it to a reader (#819) —
* a resource's name where the canvas does not hold its landing row, its
* row read by its key (#1199, #1541), and a row's refusals holding Save
* (#1541, U5).
*
* @packageDocumentation
*/
import { type option } from "@elaraai/east";
import { type EditIssue } from "@elaraai/east-ui-components";
import type { PlanInstantValue } from "../instant.js";
import { type PlanDerived, type PlanRootValue, type PlanRowValue } from "../model.js";
import type { RowKey } from "../plan-state.js";
import type { PlanScale } from "../scale.js";
import type { PlanWords } from "../words.js";
import { type PlanLandingValue } from "./landings.js";
/** What the inspector reads of the canvas's rows (#1197). */
export interface PlanCanvasInspect {
/**
* A row the canvas holds, by its key.
*
* @param key - The row's key
* @returns The row, or `undefined` for one the canvas does not hold
*/
row(key: RowKey): PlanRowValue | undefined;
/**
* What a heat, table or chart row draws in the bucket an instant falls in.
*
* @param key - The row's key
* @param at - The instant
* @returns Its value there, in words; `undefined` where it draws nothing there, or for a row of another kind
*/
valueAt(key: RowKey, at: PlanInstantValue): string | undefined;
/**
* A resource's landing row (#1541): the row of the series an event's resource names whose path ends in its key, as
* the canvas holds it — what the panes name the resource by.
*
* The same function while the rows it reads are: a pane's names are made again only as they move.
*
* @param ref - The resource: its series' key and its key's text
* @returns Its row; `undefined` for one the canvas does not hold — over rows read a page at a time, one not read
*/
readonly resource: (ref: {
readonly kind: string;
readonly key: string;
}) => PlanRowValue | undefined;
/**
* A resource's name where the canvas does not hold its landing row (#1199, #1541): its row read by its key
* ({@link landingNameByKey}) — among the canvas's rows, then, for one the slice's `rows` source leaves out, among
* every row the source narrows. Called inside a tracked evaluation, so a pane names it once the read lands.
*
* The same function while the rows it reads through are.
*
* @param ref - The resource: its series' key and its key's text
* @returns `none` while the read is in flight; `some(none)` where no row is read for it; else `some(some(name))`
*/
readonly resourceByKey: (ref: {
readonly kind: string;
readonly key: string;
}) => option