import { JSONObject } from '@phosphor/coreutils'; import { IObservableVector, ObservableVector } from './observablevector'; /** * An object which can be serialized to JSON. */ export interface ISerializable { /** * Convert the object to JSON. */ toJSON(): JSONObject; } /** * An observable vector that supports undo/redo. */ export interface IObservableUndoableVector extends IObservableVector { /** * Whether the object can redo changes. */ readonly canRedo: boolean; /** * Whether the object can undo changes. */ readonly canUndo: boolean; /** * Begin a compound operation. * * @param isUndoAble - Whether the operation is undoable. * The default is `false`. */ beginCompoundOperation(isUndoAble?: boolean): void; /** * End a compound operation. */ endCompoundOperation(): void; /** * Undo an operation. */ undo(): void; /** * Redo an operation. */ redo(): void; /** * Clear the change stack. */ clearUndo(): void; } /** * A concrete implementation of an observable undoable vector. */ export declare class ObservableUndoableVector extends ObservableVector implements IObservableUndoableVector { /** * Construct a new undoable observable vector. */ constructor(factory: (value: JSONObject) => T); /** * Whether the object can redo changes. */ readonly canRedo: boolean; /** * Whether the object can undo changes. */ readonly canUndo: boolean; /** * Dispose of the resources held by the model. */ dispose(): void; /** * Begin a compound operation. * * @param isUndoAble - Whether the operation is undoable. * The default is `true`. */ beginCompoundOperation(isUndoAble?: boolean): void; /** * End a compound operation. */ endCompoundOperation(): void; /** * Undo an operation. */ undo(): void; /** * Redo an operation. */ redo(): void; /** * Clear the change stack. */ clearUndo(): void; /** * Handle a change in the vector. */ private _onVectorChanged(list, change); /** * Undo a change event. */ private _undoChange(change); /** * Redo a change event. */ private _redoChange(change); /** * Copy a change as JSON. */ private _copyChange(change); private _inCompound; private _isUndoable; private _madeCompoundChange; private _index; private _stack; private _factory; }