import type { AxisBranch, AxisLayout, AxisLeaf, AxisScale, HeaderSpan, PathPart, Value, WorksheetSpec } from './types'; /** The only place layout sizes are defined. CSS px. */ export declare const metrics: { bandWidth: number; bandHeight: number; /** Member width when the marks are numbers rather than shapes. */ textCellWidth: number; legendMinWidth: number; legendMaxWidth: number; slotWidth: number; slotHeight: number; /** The least a continuous axis slot gets, whatever a host asks for and however little room there is. */ slotMinWidth: number; slotMinHeight: number; /** Side of the cell that holds one pie. */ pieSize: number; /** The least a pie gets when the sheet is stretched to its window. */ pieMinSize: number; headerHeight: number; captionHeight: number; xAxisHeight: number; headerMinWidth: number; headerMaxWidth: number; headerPadding: number; rotatedLabelMax: number; /** Inset of a continuous scale inside its slot, at the domain start and end. */ scalePadStart: number; scalePadEnd: number; fontSize: number; /** Share of a member step covered by a bar. */ barFill: number; }; export interface LeafSizes { band: number; continuous: number; } export declare function leafSizes(spec: WorksheetSpec): { row: LeafSizes; column: LeafSizes; }; /** * The least a stretched slot gets before the sheet scrolls instead. A pane size the host set is * that least size; without one a slot may get smaller than it is in a sheet that is not stretched. */ export declare function leafFloors(spec: WorksheetSpec): { row: number; column: number; }; export type TextMeasure = (text: string, fontSize: number, fontWeight: number, font: string) => number; export declare const defaultFont = "system-ui, sans-serif"; /** * The font every width is measured in until the next call. Layout and scene building are * synchronous and each sets it on entry, so two sheets with different fonts do not mix. */ export declare function setFont(next?: string): void; /** * Installs a real text measurer, for example a canvas context in the browser. Layout and * every backend read widths through textWidth, so they always agree. Without a measurer, * as in Node, widths are estimated from character counts. */ export declare function setTextMeasure(next?: TextMeasure): void; export declare function textWidth(text: string, fontSize?: number, fontWeight?: number): number; export declare function fitText(text: string, width: number, fontSize?: number, fontWeight?: number): string; /** * Ticks at multiples of 1, 2 or 5 times a power of ten. The domain stays the data range, * so marks use the whole slot and the last tick may sit below the maximum. */ export declare function tickScale(min: number, max: number, pixels: number, gap: number, least?: number): AxisScale; export interface LeafDraft { id: string; groupId: string; branch: AxisBranch; path: PathPart[]; kind: AxisLeaf['kind']; } /** `parent` is the header path above the two members, which a per-parent order needs. */ export type MemberCompare = (instanceId: string, a: Value, b: Value, parent: PathPart[]) => number; export declare function buildAxis(axis: 'row' | 'column', drafts: Iterable, compare: MemberCompare, sizes: LeafSizes, instances: WorksheetSpec['instances']): AxisLayout; /** Gives every leaf the size `sizeOf` returns and moves the leaves and groups after it along. */ export declare function resizeAxis(layout: AxisLayout, sizeOf: (leaf: AxisLeaf) => number): void; /** Stretches or squeezes every leaf by the same factor, so members keep one shared step. */ export declare function scaleAxis(layout: AxisLayout, factor: number): void; /** What the axis measures with every continuous slot at `floor`: the least room it can be stretched into. */ export declare function leastSize(layout: AxisLayout, floor: number): number; /** * Shares `room` among the continuous slots, after the member steps have taken theirs. The steps * keep their size whatever the room is. No slot gets less than `floor`, so an axis that does not * fit comes out longer than the room. */ export declare function stretchAxis(layout: AxisLayout, room: number, floor: number): void; /** Half-open range of leaves that intersect the logical interval [from, to). */ export declare function leafRange(layout: AxisLayout, from: number, to: number): [number, number]; /** Spans that intersect the half-open leaf range. */ export declare function spansIn(spans: HeaderSpan[], start: number, end: number): HeaderSpan[];