UNPKG

@infinite-canvas-tutorial/webcomponents

Version:
34 lines (33 loc) 1.48 kB
import { AppState } from '../context'; import { AppStateChange } from './AppStateChange'; import { ElementsChange, SceneElementsMap } from './ElementsChange'; import { Snapshot } from './Snapshot'; export declare class History { private readonly undoStack; private readonly redoStack; private static pop; private static push; get isUndoStackEmpty(): boolean; get isRedoStackEmpty(): boolean; clear(): void; /** * Record a local change which will go into the history */ record(elementsChange: ElementsChange, appStateChange: AppStateChange): void; undo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): void | [SceneElementsMap, AppState]; redo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): void | [SceneElementsMap, AppState]; private perform; } export declare class HistoryEntry { readonly appStateChange: AppStateChange; readonly elementsChange: ElementsChange; private constructor(); static create(appStateChange: AppStateChange, elementsChange: ElementsChange): HistoryEntry; inverse(): HistoryEntry; applyTo(elements: SceneElementsMap, appState: AppState, snapshot: Readonly<Snapshot>): [SceneElementsMap, AppState, boolean]; /** * Apply latest (remote) changes to the history entry, creates new instance of `HistoryEntry`. */ applyLatestChanges(elements: SceneElementsMap): HistoryEntry; isEmpty(): boolean; }