History
Undo/redo stack for arbitrary state — editors, forms, and canvases.
@xngui/cdk/history@xngui/cdk/historyPreview
Workspace settings scenario
Edit fields and toggles — each committed change pushes a labeled checkpoint onto the undo stack.
Ctrl+Z to undo, Ctrl+Shift+Z to redo.
Stack: 0 past · 0 future
Undo timeline
No checkpoints yet — edit a field or apply a preset.
Workspace settings
Member preview
Acme Analytics
No announcement
import { XHistoryStack } from '@xngui/cdk/history';
const history = new XHistoryStack<WorkspaceSettings>({
limit: 30,
clone: structuredClone,
});
function applyPreset(next: WorkspaceSettings) {
history.beginTransaction('Maintenance window');
history.push(settings()); // checkpoint before batch
settings.set(next);
history.commitTransaction();
}
history.undo(settings()); // past: 0
history.redo(settings()); // future: 0
Events
Interact with the preview — events will appear here.