/** * Command Pattern Implementation for Undo/Redo * Core command abstraction and registry */ export interface Command { /** Unique command identifier */ id: string; /** Timestamp when command was created (ms) */ timestamp: number; /** User ID who executed command */ userId: string; /** Execute the command */ execute(): void; /** Undo the command (revert to previous state) */ undo(): void; /** Redo the command after undo */ redo(): void; /** Whether command can be merged with next command (typing chain) */ canMerge(nextCommand: Command): boolean; /** Merge with next command (returns merged command or null) */ merge(nextCommand: Command): Command | null; /** Size in bytes for memory tracking */ getSize(): number; /** Human-readable description for history UI */ getDescription(): string; } export declare class InsertTextCommand implements Command { readonly id: string; readonly timestamp: number; readonly userId: string; private previousContent; private newContent; private position; private insertedText; constructor(userId: string, previousContent: string, insertedText: string, position: number); execute(): void; undo(): void; redo(): void; canMerge(nextCommand: Command): boolean; merge(nextCommand: Command): Command | null; getSize(): number; getDescription(): string; getContent(version: 'previous' | 'new'): string; } export declare class DeleteTextCommand implements Command { readonly id: string; readonly timestamp: number; readonly userId: string; private previousContent; private newContent; private position; private deletedText; private length; constructor(userId: string, previousContent: string, position: number, length: number); execute(): void; undo(): void; redo(): void; canMerge(nextCommand: Command): boolean; merge(nextCommand: Command): Command | null; getSize(): number; getDescription(): string; getContent(version: 'previous' | 'new'): string; } export declare class FormatTextCommand implements Command { readonly id: string; readonly timestamp: number; readonly userId: string; private previousContent; private newContent; private startPos; private endPos; private format; private enabled; constructor(userId: string, previousContent: string, newContent: string, startPos: number, endPos: number, format: 'bold' | 'italic' | 'underline' | 'strikethrough', enabled: boolean); execute(): void; undo(): void; redo(): void; canMerge(nextCommand: Command): boolean; merge(nextCommand: Command): Command | null; getSize(): number; getDescription(): string; getContent(version: 'previous' | 'new'): string; } export declare class MacroCommand implements Command { readonly id: string; readonly timestamp: number; readonly userId: string; private commands; private name; constructor(userId: string, commands: Command[], name?: string); execute(): void; undo(): void; redo(): void; canMerge(): boolean; merge(): null; getSize(): number; getDescription(): string; getCommandCount(): number; } type CommandConstructor = new (...args: any[]) => Command; export declare class CommandRegistry { private registry; register(type: string, commandClass: CommandConstructor): void; get(type: string): CommandConstructor | undefined; has(type: string): boolean; } export declare const defaultRegistry: CommandRegistry; export {}; //# sourceMappingURL=commands.d.ts.map