/** * D3 Shape Polyfill - Lightweight SVG shape generators. * * This is a drop-in replacement for d3-shape, implementing only the methods * used in the Vega chart rendering system: line, arc, and pie. * * @see VD-5022 - [Zero Dependencies] remove d3 dependency */ declare type LineAccessor = (d: T, i?: number) => number; /** * A line generator that creates SVG path data strings from data arrays. * Mimics d3.line() with .x() and .y() value extractors. */ declare class LineGenerator { /** * Sets the x accessor function. * * @param accessor - Function that returns the x value for a datum. * @returns This generator for chaining. */ x(accessor: LineAccessor): this; /** * Sets the y accessor function. * * @param accessor - Function that returns the y value for a datum. * @returns This generator for chaining. */ y(accessor: LineAccessor): this; /** * Generates an SVG path data string for the given data. * Called as a function (used by d3's attr('d', lineGenerator)). * * @param data - Array of data points. * @returns SVG path data string (M...L...L...). */ generate(data: T[]): string; /** Default x value extractor: reads `.x` property or first array index. */ private xAccessor; /** Default y value extractor: reads `.y` property or second array index. */ private yAccessor; } /** * Creates a line generator. Mimics d3.line(). * The returned object is also callable as a function for d3 compatibility. * * @returns A new LineGenerator with callable function interface. */ export declare function line(): LineGenerator & ((data: T[]) => string); /** * An arc generator that creates SVG path data strings for arc/pie slices. * Mimics d3.arc() with .innerRadius() and .outerRadius() value setters. */ declare class ArcGenerator { /** Inner radius value for the arc. */ private innerRadiusValue; /** Outer radius value for the arc. */ private outerRadiusValue; /** * Sets the inner radius for the arc. * * @param radius - Inner radius value. * @returns This generator for chaining. */ innerRadius(radius: number): this; /** * Sets the outer radius for the arc. * * @param radius - Outer radius value. * @returns This generator for chaining. */ outerRadius(radius: number): this; /** * Generates an SVG path data string for an arc datum. * The datum must have startAngle and endAngle properties (in angle units). * * @param d - Arc datum with startAngle and endAngle. * @returns SVG path data string for the arc. */ generate(d: T): string; } /** * Creates an arc generator. Mimics d3.arc(). * The returned object is also callable as a function for d3 compatibility. * * @returns A new ArcGenerator with callable function interface. */ export declare function arc(): ArcGenerator & ((d: T) => string); /** * A pie arc datum produced by the pie generator. */ export declare type PieArcDatum = { data: T; index: number; value: number; startAngle: number; endAngle: number; padAngle: number; }; declare type PieValueAccessor = (d: T) => number; /** * A pie layout generator that computes start/end angles for data items. * Mimics d3.pie() with .value() setter. */ declare class PieGenerator { /** * Sets the value accessor function. * * @param accessor - Function that returns the numeric value for each datum. * @returns This generator for chaining. */ value(accessor: PieValueAccessor): this & ((data: T[]) => PieArcDatum[]); /** * Computes pie arc data from the input data array. * * @param data - Array of data items. * @returns Array of PieArcDatum with computed angles. */ generate(data: T[]): PieArcDatum[]; /** Default value extractor: reads `.value` property or falls back to 0. */ private valueAccessor; } /** * Creates a pie layout generator. Mimics d3.pie(). * The returned object is also callable as a function for d3 compatibility. * * @returns A new PieGenerator with callable function interface. */ export declare function pie(): PieGenerator & ((data: T[]) => PieArcDatum[]); export {};