R
I

History

tested

Undo/redo stacks of inverse-step entries. Borrows the ergonomics of stdlib's command history (bounded size, redo cleared on a new edit) but stores data (inverse steps) rather than closures — which is what makes it serializable and collab-friendly.

Signature

ts
interface History

Properties

PropertyTypeDescription
record(entry: HistoryEntry) => voidRecord a new edit, clearing the redo stack.
undo() => HistoryEntry | undefinedPop the latest undo entry (and push it onto the redo stack).
redo() => HistoryEntry | undefinedPop the latest redo entry (and push it back onto the undo stack).
canUndo() => boolean
canRedo() => boolean
clear() => void