import { type NormalisedChartLabelPlacementStyleOptions, type NormalisedChartLabelStyleOptions, type NormalisedSeriesLabelOptions, type NormalisedTextOrSegments, type RequireOptional } from 'ag-charts-core'; import type { AgChartLabelFormatterParams, Padding, PaddingOptions } from 'ag-charts-types'; import type { AxisFormattableLabel, ContextFormatter } from '../module/axisContext'; export interface FormatterCache { type: string; format: string; formatter: ((value: any, fractionDigits?: number) => string) | undefined; } /** The label keys formatting reads; plain post-theme label options satisfy it directly. */ export type LabelFormatSource = Pick, 'formatter' | 'format'>; type LabelFormatParams = AgChartLabelFormatterParams & RequireOptional; /** Formats `value` via the label `formatter`, then its `format` string; `cache` keeps the compiled format string. */ export declare function formatLabelValue(label: LabelFormatSource, cache: { formatterCache: FormatterCache | undefined; }, formatWithContext: ContextFormatter>, type: 'number' | 'date' | 'category', value: any, params: LabelFormatParams): NormalisedTextOrSegments | undefined; /** Formats through one plain label options object, keeping its compiled `format` string; owned by base Series. */ export declare class LabelValueFormatter implements AxisFormattableLabel> { private readonly label; private readonly compiledFormats; private compiled; /** `compiledFormats` outlives the label object, which the theme rebuilds on every options update. */ constructor(label: LabelFormatSource, compiledFormats: Map); get formatterCache(): FormatterCache | undefined; set formatterCache(cache: FormatterCache | undefined); formatValue(formatWithContext: ContextFormatter>, type: 'number' | 'date' | 'category', value: any, params: LabelFormatParams): NormalisedTextOrSegments | undefined; } /** A label carrying both placement styles, resolved once the placement engine picks a side. */ /** Placement styles are absent on series whose labels expose none (cone funnel); the label's own style then applies. */ export type PlacementStyledLabelOptions = NormalisedChartLabelStyleOptions & { enabled: boolean; insideStyle?: NormalisedChartLabelPlacementStyleOptions; outsideStyle?: NormalisedChartLabelPlacementStyleOptions; }; type LabelBoxingMixin = { border?: { enabled?: boolean; stroke?: unknown; strokeWidth?: number; }; fill?: unknown; padding?: Padding; }; /** Whether the label draws a background box: it has a fill, or an enabled border with a stroke. */ export declare function labelHasBox(label: LabelBoxingMixin | undefined): boolean; export declare function expandLabelPadding(label: LabelBoxingMixin | undefined): Required; /** * Overlays the top-level label beneath a placement style so an explicit placement value wins and any * unset property falls back to the top-level label. `border` is merged field-wise so each border field, * including `enabled`, wins from the placement style and falls through to the top-level label when unset. */ export declare function resolvePlacementLabelStyle(label: TLabel, placementStyle: NormalisedChartLabelPlacementStyleOptions | undefined): TLabel; /** * Per-side extent of the label's drawn box beyond its text: box padding plus the outward half of any * border stroke. This is the footprint collisions must reserve so labels avoid the box, not just the text. */ export declare function expandLabelBoxExtent(label: LabelBoxingMixin | undefined): Required; /** Reserves the larger of the two placements' box extent, as placement is not resolved until layout. */ export declare function expandPlacementLabelBoxExtent(label: PlacementStyledLabelOptions): Required; /** * Resolved per-side box padding folded into a placement label's anchor offset. All-zero for a boxless * label, so its gap from the shape comes solely from `spacing`; the caller adds the side facing the * shape (known per datum) to keep the box edge — not the text — at `spacing`. */ export declare function resolvePlacementLabelPadding(label: NormalisedChartLabelStyleOptions, placementStyle: NormalisedChartLabelPlacementStyleOptions | undefined): Required; /** * Resolved per-side extent of a placement label's drawn box (padding plus the outward half of any border * stroke) folded into its anchor offset, so the box's outer edge — not just the padding boundary — sits * `spacing` from the shape. All-zero for a boxless label. */ export declare function resolvePlacementLabelBoxExtent(label: NormalisedChartLabelStyleOptions, placementStyle: NormalisedChartLabelPlacementStyleOptions | undefined): Required; /** * Offset from a placed label's reserved top-left to its text anchor. The reservation spans the larger of * the two placements' extents, so the surplus is split evenly to keep the drawn box centred on whatever * the placement engine centred the reservation on. */ export declare function placedLabelTextOffset(label: PlacementStyledLabelOptions, placementStyle: NormalisedChartLabelPlacementStyleOptions | undefined): { x: number; y: number; }; /** * A reservation sized from the style resolved at the winning placement is filled exactly by the drawn box, * so the text sits one box extent in from its top-left. */ export declare function styledLabelTextOffset(style: LabelBoxingMixin): { x: number; y: number; }; export {};