import * as xb from "xrblocks"; //#region src/addons/editor/CommandHistory.d.ts export interface Command { undo: () => void | Promise; redo: () => void | Promise; } /** * Undo/redo command stack. Each entry is \{undo, redo\}; redo is never * called at push time (the action has already happened by then) -- it * only runs if the entry is later undone and then redone. Ctrl+Z / * Ctrl+Shift+Z wired here via onKeyDown, guarded against firing while an * inspector has focus (same guard SelectionManager uses for its * tool-mode shortcuts), so it doesn't fight the browser's native * in-field undo. * * Undo/redo requests run in order and move entries only after success. * A new edit or reset invalidates queued requests and pending stack * transfers; it does not roll back command side effects or partial batches. */ export declare class CommandHistory extends xb.Script { undoStack: Command[]; redoStack: Command[]; private pending; private generation; /** Set every frame by SceneEditor -- see SelectionManager.editorActive * for the same pattern and why. Keeps Ctrl+Z from firing as a global * page-wide shortcut while the user is just browsing in a non-Editor * simulator mode. */ editorActive: boolean; push(command: Command): void; /** Combines several \{undo, redo\} entries into a single stack entry, so * one Ctrl+Z reverts all of them together (e.g. a group gizmo drag or a * multi-object delete). Sub-commands undo in reverse order, redo in * forward order. No-op entries should be filtered out by the caller * before calling this. */ pushBatch(commands: Array): void; clearHistory(): void; undo(): Promise; redo(): Promise; private runCommand; onKeyDown(event: KeyboardEvent): void; } //#endregion