import { type Theme } from './color'; import { type Box } from './clip'; import { type Selection, type WorksheetModel } from './types'; /** x and y are the scroll offsets, width and height the size of the visible window. */ export interface Viewport { x: number; y: number; width: number; height: number; } /** * Painted in this order. The body scrolls both ways, row headers and the value axis on * the left scroll vertically, column headers and the bottom axis scroll horizontally, * corners and the legend stay put. Each later layer has an opaque background and covers * what is below. The xAxis layer is the strip under the body: the value axis of the * columns, or the innermost column headers when those are placed at the bottom. */ export declare const layers: readonly ["body", "rowHeader", "columnHeader", "xAxis", "corner", "legend"]; export type Layer = typeof layers[number]; export interface Primitive { /** path is an open stroked line. shape is a closed filled outline, such as a pie slice; its path is relative to x and y. */ kind: 'rect' | 'symbol' | 'path' | 'shape' | 'text'; layer: Layer; x: number; y: number; width?: number; height?: number; fill?: string; stroke?: string; strokeWidth?: number; path?: string; text?: string; /** Dash and gap of a path in px. */ dash?: [number, number]; /** Painted before everything else in its layer, whatever its kind: the surface and the grid, which marks cover. */ under?: boolean; /** Corner radii of a rect: top left, top right, bottom right, bottom left. */ radius?: [number, number, number, number]; /** Font family of a text. The system font when absent. */ font?: string; /** Outline of a symbol. A circle when absent. */ symbol?: string; align?: 'left' | 'center' | 'right'; angle?: number; size?: number; fontSize?: number; fontWeight?: number; opacity?: number; selection?: Selection; tooltip?: string; } export interface Scene { width: number; height: number; items: Primitive[]; visiblePanes: number; /** The surface color. Every layer paints it, so the backend may also clear with it. */ background: string; /** 'omitted' when the window is too narrow for the legend strip; the host should show the colors some other way. */ legend: 'none' | 'side' | 'omitted'; /** Screen rectangle of the scrolling body, where the marks are. */ body: Box; } export interface SceneState { /** Selection ids. While any is set, every other mark is dimmed. */ selected?: ReadonlySet; /** Surface, text and rule colors. Light when absent. */ theme?: Theme; } /** Produces pixel geometry for the window. The drawing backend does no grouping, stacking or scaling. */ export declare function buildScene(model: WorksheetModel, viewport: Viewport, state?: SceneState): Scene;