mobx-bonsai
Version:
A fast lightweight alternative to MobX-State-Tree + Y.js two-way binding
38 lines (37 loc) • 1.28 kB
TypeScript
import { TNode } from '../node/nodeTypeKey/nodeType';
import { UndoableChange } from './types';
declare const undoEventTypeKey = "mobx-bonsai/UndoEvent";
/**
* Represents a single undo/redo event.
* Contains all changes that occurred during a single MobX action.
*/
export type UndoEvent = TNode<typeof undoEventTypeKey, {
changes: readonly UndoableChange[];
attachedState?: {
beforeEvent: unknown;
afterEvent: unknown;
};
}>;
/**
* Node type for UndoEvent.
* Events are frozen (immutable) nodes.
*/
export declare const TUndoEvent: import('..').BaseNodeType<UndoEvent, "typed", "$$type", never, unknown>;
declare const undoStoreTypeKey = "mobx-bonsai/UndoStore";
/**
* UndoStore holds the undo and redo event queues.
* Simple observable data structure - all manipulation is handled by UndoManager.
*/
export type UndoStore = TNode<typeof undoStoreTypeKey, {
undoEvents: UndoEvent[];
redoEvents: UndoEvent[];
}>;
/**
* Node type for UndoStore with default empty arrays.
*/
export declare const TUndoStore: import('..').BaseNodeType<UndoStore, "typed", "$$type" | "undoEvents" | "redoEvents", never, unknown>;
/**
* Creates a new UndoStore with empty undo/redo queues.
*/
export declare function createUndoStore(): UndoStore;
export {};