import type { TransformValue } from './transform.js'; import type { Channel, ChartKey, ChartMark, ChartMarkMotionOptions, ChartMarkState, ChartRectStateStyle, VisualChannel } from './types.js'; import type { HierarchyRectangularNode } from 'd3-hierarchy'; export type TreemapMethod = 'squarify' | 'binary' | 'dice' | 'slice' | 'slice-dice'; export interface TreemapTileDatum { readonly id: string; readonly parentId: string | null; readonly name: string; readonly datum: TDatum | null; readonly sourceIndex: number | null; } /** A native D3-compatible tiler over the mark's private hierarchy copy. */ export type TreemapTile = (node: HierarchyRectangularNode>, x0: number, y0: number, x1: number, y1: number) => void; export interface TreemapNode { readonly id: string; readonly parentId: string | null; readonly ancestorIds: readonly string[]; readonly name: string; readonly data: TDatum | null; readonly depth: number; readonly height: number; readonly internal: boolean; readonly external: boolean; readonly value: number; readonly source: readonly TDatum[]; readonly sourceIndexes: readonly number[]; } export type TreemapNodeComparator = (left: TreemapNode, right: TreemapNode) => number; interface TreemapSharedOptions extends ChartMarkMotionOptions> { /** Mark identity. Explicit hierarchy identity uses `nodeId`. */ readonly id?: string; readonly value: TransformValue; /** Built-in shorthand or a D3-compatible tiler. Defaults to `squarify`. */ readonly method?: TreemapMethod | TreemapTile; /** Target squarify aspect ratio. Defaults to the golden ratio. */ readonly ratio?: number; readonly round?: boolean; /** Pixel gap between adjacent children. Defaults to zero. */ readonly paddingInner?: number; /** Pixel gap between parent edges and children. Defaults to zero. */ readonly paddingOuter?: number; readonly sort?: TreemapNodeComparator; readonly color?: Channel, ChartKey | null | undefined>; readonly fill?: VisualChannel, string>; readonly fillOpacity?: number; readonly stroke?: VisualChannel, string>; readonly strokeOpacity?: number; readonly strokeWidth?: number; readonly inset?: number; readonly radius?: number; readonly states?: readonly ChartMarkState, ChartRectStateStyle>>[]; readonly label?: Channel, string | number | null | undefined>; readonly labelFill?: VisualChannel, string>; readonly labelFontSize?: number; readonly labelFontWeight?: number; /** Minimum painted pixels around an in-cell label. Defaults to 4. */ readonly labelPadding?: number; } export type TreemapPathOptions = TreemapSharedOptions & { readonly path: TransformValue; readonly delimiter?: string; readonly nodeId?: never; readonly parentId?: never; }; export type TreemapParentOptions = TreemapSharedOptions & { readonly nodeId: TransformValue; readonly parentId: TransformValue; readonly path?: never; readonly delimiter?: never; }; export type TreemapOptions = TreemapPathOptions | TreemapParentOptions; /** Lays out and renders hierarchy leaves in final plot-space pixels. */ export declare function treemap>(source: Iterable, options: TreemapSharedOptions & { readonly path: TPath; readonly delimiter?: string; readonly nodeId?: never; readonly parentId?: never; }): ChartMark, string, number, never, never>; export declare function treemap, const TParentId extends TransformValue>(source: Iterable, options: TreemapSharedOptions & { readonly nodeId: TNodeId; readonly parentId: TParentId; readonly path?: never; readonly delimiter?: never; }): ChartMark, string, number, never, never>; export {};