import { Difference } from 'microdiff'; import { ClipJSON, ProjectJSON, StudioTrackJSON } from '../json-serialization'; export interface HistoryOptions { maxSize?: number; } export interface HistoryState { clips: Record; tracks: StudioTrackJSON[]; settings: any; } export declare class HistoryManager { private past; private future; private lastState; private maxSize; constructor(options?: HistoryOptions); private projectToHistoryState; /** * Initialize history with the starting state */ init(state: ProjectJSON): void; /** * Push a new state to history. Calculates the diff from the last state. */ push(newState: ProjectJSON): void; /** * Undo the last action. Returns the patches and the new target state. */ undo(currentState: ProjectJSON): { patches: Difference[]; state: HistoryState; } | null; /** * Redo the next action. Returns the patches and the new target state. */ redo(currentState: ProjectJSON): { patches: Difference[]; state: HistoryState; } | null; /** * Apply patches to an object. */ private applyPatches; canUndo(): boolean; canRedo(): boolean; }