///
import { type Theme } from './color';
import type { Formats } from './formats';
import { type ResultTable } from './export';
import type { Computation, Selection, WorksheetSpec } from './types';
export interface WorksheetHandle {
/** The whole sheet, not only the part in the window, with headers, axes and legend. */
exportSVG(): Promise;
/**
* The whole sheet as a PNG data URL, at `scale` device pixels per CSS pixel. A sheet too
* large for a canvas at that scale is drawn at the largest scale that fits.
*/
exportPNG(scale?: number): Promise;
/** The records behind the marks, one table per query that is drawn. */
exportRecords(): ResultTable[];
/** Size of the whole sheet in CSS px, which is the size of an exported SVG. */
size(): {
width: number;
height: number;
};
}
/**
* querying: results are on their way; the last sheet stays on screen, faded and inert.
* drawing: results are in and the sheet is being painted. idle: what is on screen is current.
*/
export type WorksheetStatus = 'querying' | 'drawing' | 'idle' | 'error';
export interface WorksheetProps {
spec: WorksheetSpec;
computation: Computation;
/**
* Upper bound of the scroll window. A shorter worksheet takes only the height it needs. A sheet
* that is fitted or stretched in height takes all of it.
*/
height?: number;
/** Called with every selected mark. Click selects one, Ctrl or Cmd click adds or removes, a click on empty space or Escape clears. */
onSelectionChange?: (selections: Selection[]) => void;
/**
* Called with the mark under a plain click, after the sheet's own selection, and with the DOM
* event, whose position places a menu and whose propagation the host may stop.
*/
onMarkClick?: (selection: Selection, event: MouseEvent) => void;
onStatusChange?: (status: WorksheetStatus) => void;
/**
* Lets the viewer zoom and pan the value axes: the wheel zooms around the pointer, a drag
* pans, a double click returns every axis to the range the data asks for. Every pane that
* shares an axis range moves together. Over a zoomable pane the wheel no longer scrolls.
*/
zoomable?: boolean;
/** How numbers, dates and the sheet's own words are written. Keep the object the same between renders while nothing in it changes. */
formats?: Formats;
/**
* Called when the sheet cannot be drawn: the spec does not compile, a query fails, or the data
* does not fit, with the message shown in its place. Called with '' once it draws again.
*/
onError?: (message: string) => void;
/** Surface, text, rule and mark colors. Pass the host's own surface color as `paper` so the sheet blends in, and its palette so marks match its other charts. */
theme?: 'light' | 'dark' | Theme;
/**
* Draws nothing but the chart: no status line, no frame around the scroll area and no
* panel listing the selected records. For hosts that already provide that chrome.
*/
compact?: boolean;
}
export declare const Worksheet: import("react").ForwardRefExoticComponent>;