import type { RegularTableElement } from "regular-table"; import type { HTMLPerspectiveViewerElement, PerspectiveCommandLocation, PerspectiveCommands, PerspectiveHitRef, PerspectiveViewFrame } from "@perspective-dev/viewer"; import type { DatagridModel, DatagridPluginElement } from "./types.ts"; /** The sentinel path of the synthetic trailing command column. */ export declare const COMMAND_COLUMN_PATH = "__COMMANDS__"; export declare const COMMAND_CELL_CLASS = "psp-command-cell"; export declare const COMMAND_BUTTON_CLASS = "psp-command-button"; /** * The viewport read the data listener just made, in the shape the viewer's * hit resolver reads; references, not copies. */ export declare function build_frame(model: DatagridModel, columns: Record, x0: number, y0: number, x1: number): PerspectiveViewFrame; /** * The viewer hosting `plugin`, the only party that evaluates the schema. */ export declare function host_viewer(plugin: DatagridPluginElement): HTMLPerspectiveViewerElement | null; /** * The app's commands for `refs` at `location`, none for any ref when the host * throws, or `undefined` when the location is out of scope, no schema is set, * or the host is too old to ask. */ export declare function query_commands(plugin: DatagridPluginElement, location: PerspectiveCommandLocation, frame: PerspectiveViewFrame, refs: PerspectiveHitRef[]): (PerspectiveCommands | undefined)[] | undefined; /** * Whether `location` is in the app's scopes, asked with an empty frame so no * schema call runs. */ export declare function is_command_scope(plugin: DatagridPluginElement, location: PerspectiveCommandLocation): boolean; /** * A block holding one button per command of `result`, empty when it has none; * `previous`, the block last drawn at this position, is updated in place and * returned so an unchanged row keeps its button elements across draws. */ export declare function command_block(result: PerspectiveCommands | undefined, previous?: HTMLElement): HTMLElement; /** * A block holding `content` (when any) followed by one button per command, * or `content` untouched when there are no commands; `previous`, the block * last drawn at this position, is updated in place and returned. */ export declare function command_cell(content: string | HTMLElement | null | undefined, result: PerspectiveCommands | undefined, previous?: HTMLElement): string | HTMLElement | null | undefined; /** * Bring an existing block's buttons to `result`: rebuilt when the specs * differ from those last rendered, else kept with their contexts refreshed. */ export declare function update_command_block(block: HTMLElement, result: PerspectiveCommands | undefined): void; /** * Whether `event` targets a command button, whose gesture belongs to the * command rather than to the grid. */ export declare function is_command_target(event: Event): boolean; /** * Isolate command-button gestures from the grid's own handlers and run the * command on click, through one capture-phase listener per event. */ export declare function install_command_listeners(plugin: DatagridPluginElement, table: RegularTableElement): void; /** * The button surfaces in force: each scope the app declared, less the ones * `plugin_config` turned off. */ export declare function effective_command_scopes(plugin: DatagridPluginElement): { row: boolean; cell: boolean; }; /** * Whether the scopes in force differ from those the last draw rendered, so * button chrome must be added or dropped by a redraw. */ export declare function command_scopes_changed(plugin: DatagridPluginElement): boolean;