UNPKG

trellis

Version:

Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications

24 lines 1.2 kB
/** * Undo-history core — generic command stack (ADR 0034 wedge 8). * * Framework-free, DOM-free, timer-free: state only changes through * explicit `actions`, so every behavior is deterministic and testable in * Node. It is a service core — it renders nothing; it augments every * domain that can be edited (editor/code/table/composer cores). * * const undo = createUndoHistoryCore(); * undo.actions.push(insertChar, { coalesce: true }); // typing burst * undo.actions.undo(); // one step back * undo.actions.redo(); * * Contract: the caller executes a command, then pushes it. Undo executes * the pushed command's `invert()`; redo re-executes the original. The core * owns grouping (one gesture = one step), coalescing (adjacent same-key * commands merge), depth limiting, and redo invalidation on new edits. * * @module trellis/undo-history */ import type { UndoConfig, UseUndoReturn } from './types.js'; export type { UndoActions, UndoCommand, UndoConfig, UndoPushOptions, UndoState, UseUndoReturn, } from './types.js'; export declare function createUndoHistoryCore(config?: UndoConfig): UseUndoReturn; //# sourceMappingURL=index.d.ts.map