import { type CandidateStyleResolver, type LabelObstacle, type NormalisedPaddingOptions, type PlacedLabel, type PointLabelDatum, type PositionedCandidateResolver, type SeriesLabelDefaults } from 'ag-charts-core'; import { BBox } from '../../scene/bbox'; /** * Anything taking part in a label solve. A source contributes obstacles whether or not it places * labels of its own, so a module owning fixed, user-authored labels can reserve their space without * pretending to be a series. * * `id` shares a namespace with series ids and keys the placement result, so a registered source must * qualify its own (e.g. `crossLines:`). */ export interface LabelSource { readonly id: string; readonly usesPlacedLabels: boolean; /** Increments on every invalidation of the label inputs; lets placement skip unchanged ones. */ readonly nodeDataVersion: number; /** `seriesRect` is the placement space's canvas origin; series already work in it and ignore it. */ getLabelObstacles?(seriesRect: BBox): LabelObstacle[] | undefined; } /** * A source whose own labels the engine places. `ISeries` satisfies it structurally; a source reaches * this path only via {@link LabelSource.usesPlacedLabels}. */ export interface PlacedLabelSource extends LabelSource { getLabelData(seriesRect: BBox): PointLabelDatum[]; getLabelDefaults?(): SeriesLabelDefaults | undefined; getLabelCandidateStyler?(): CandidateStyleResolver | undefined; getLabelCandidateResolver?(): PositionedCandidateResolver | undefined; updatePlacedLabelData?(labels: PlacedLabel[], seriesRect: BBox): void; } export declare class LabelManager { private labelData; private lastPlacementSignature?; private lastPlacedLabels?; private readonly sources; registerSource(source: LabelSource): void; /** * A recreated axis registers its replacement before the old one is destroyed, so a source may only * drop its own entry — deleting by id alone would unregister the live replacement. */ unregisterSource(id: string, source?: LabelSource): void; updateLabels(visibleSources: PlacedLabelSource[], padding: NormalisedPaddingOptions, seriesRect?: BBox): void; private computePlacement; }