import { ChartController } from '../types'; import { ResolvedX, XKind } from '../cards/keys'; /** The hovered or pinned position a sync group shares, in the x field's own terms. */ export interface ChartSyncPosition { /** The hovered x value: the Date, number, or label of the row under the pointer. */ readonly value: Date | number | string; readonly kind: XKind; readonly pinned: boolean; } interface SyncState { readonly key: number | string; readonly kind: XKind; readonly pinned: boolean; /** The card whose pointer or keyboard set this position. */ readonly source: string; /** That card's name, so linked cards can say where a pin came from. */ readonly label?: string; } /** Inspections this bridge writes into a card's controller carry this owner. */ export declare const SYNC_OWNER = "sync"; /** * Read a sync group's shared position from any component, e.g. to show the hovered date in your * own dashboard header. Returns null while nothing in the group is hovered or pinned. */ export declare function useChartSync(name: string | undefined): ChartSyncPosition | null; /** * Where a shared position lands in one card: labels match exactly, and dates or numbers snap to * the nearest row within half a step, so a weekly card follows a daily one. Returns null when the * card has no row there. */ export declare function syncTarget(state: Pick, kind: XKind, labels: readonly string[], positions: readonly number[]): number | null; export interface CardSyncOptions { /** The card's name, shown on linked cards' pins: "Pinned from Revenue". */ label?: string; /** Releases the card's own pin when a linked card releases the group's. */ release?: () => void; } /** * Link a card's hover and pin to every other card in the same named group. The card's own * controller stays the source of truth; this bridge only copies positions between controllers. * A pin is shared unless it is local, as Alt-click makes it; a shared pin can be released from * any card in the group, and local pins stay put. */ export declare function useCardSync(name: string | undefined, controller: ChartController, data: readonly Row[], x: string, resolved: ResolvedX, { label, release }?: CardSyncOptions): void; export {};