import { Bounds, SeriesType, SeriesStyle } from '../types'; import { Annotation } from '../core/annotations'; /** Version of the serialization format */ export declare const SERIALIZATION_VERSION = 1; /** Serialized axis configuration */ export interface SerializedAxis { id: string; position?: 'left' | 'right' | 'top' | 'bottom'; label?: string; scale?: 'linear' | 'log'; min?: number; max?: number; auto?: boolean; invertAxis?: boolean; } /** Serialized series data */ export interface SerializedSeries { id: string; name?: string; type: SeriesType; yAxisId?: string; style?: SeriesStyle; visible?: boolean; /** Data is stored as base64 encoded Float32Array for compactness */ data: { x: string; y: string; y2?: string; }; } /** Complete serialized chart state */ export interface ChartState { /** Serialization format version */ version: number; /** Timestamp when state was saved */ timestamp: number; /** Current view bounds */ viewBounds: Bounds; /** X-axis configuration */ xAxis: SerializedAxis; /** Y-axes configurations */ yAxes: SerializedAxis[]; /** Primary Y axis ID */ primaryYAxisId: string; /** Series data and configuration */ series: SerializedSeries[]; /** Annotations */ annotations: Annotation[]; /** Active theme name (if applicable) */ themeName?: string; options?: { showLegend?: boolean; showControls?: boolean; showStatistics?: boolean; autoScroll?: boolean; }; /** Plugin-specific data */ plugins?: Record; } /** Options for serialization */ export interface SerializeOptions { /** Include series data (default: true) */ includeData?: boolean; /** Include annotations (default: true) */ includeAnnotations?: boolean; /** Compress output (default: false) */ compress?: boolean; } /** Options for deserialization */ export interface DeserializeOptions { /** Merge with existing state instead of replacing (default: false) */ merge?: boolean; /** Skip data loading (default: false) */ skipData?: boolean; /** Skip annotations (default: false) */ skipAnnotations?: boolean; } /** * Encode Float32Array to base64 string */ export declare function encodeFloat32Array(arr: Float32Array | Float64Array): string; /** * Decode base64 string to Float32Array */ export declare function decodeFloat32Array(base64: string): Float32Array; /** * Compress string using simple LZ-based compression */ export declare function compressString(str: string): string; /** * Decompress string */ export declare function decompressString(compressed: string): string; /** * Convert chart state to URL-safe hash */ export declare function stateToUrlHash(state: ChartState, compress?: boolean): string; /** * Parse chart state from URL hash */ export declare function urlHashToState(hash: string, compressed?: boolean): ChartState | null; /** * Validate a chart state object */ export declare function validateChartState(state: unknown): state is ChartState; /** State snapshot for undo/redo */ export interface StateSnapshot { timestamp: number; viewBounds: Bounds; label?: string; } /** * Simple state history manager for undo/redo */ export declare class StateHistory { private history; private currentIndex; private maxSize; constructor(maxSize?: number); /** * Push a new state to history */ push(snapshot: StateSnapshot): void; /** * Undo to previous state */ undo(): StateSnapshot | null; /** * Redo to next state */ redo(): StateSnapshot | null; /** * Check if undo is available */ canUndo(): boolean; /** * Check if redo is available */ canRedo(): boolean; /** * Get current state */ current(): StateSnapshot | null; /** * Clear history */ clear(): void; /** * Get history length */ get length(): number; }