trellis
Version:
Agentic State Engine — event-sourced causal graph with branching, decision traces, and realtime sync for AI-native applications
25 lines • 965 B
TypeScript
/**
* Undo-history React — `useUndoHistory` hook (ADR 0034 wedge 8).
*
* Import from `trellis/undo-history/react`:
*
* const undo = useUndoHistory();
* undo.actions.push(insertChar, { coalesce: true });
* // <button disabled={!undo.state.canUndo} onClick={undo.actions.undo}>
* // Undo {undo.state.undoLabel}
* // </button>
*
* The core is created once per mount; state flows through
* `useSyncExternalStore` (same bridge as `trellis/forms/react`).
*
* @module trellis/undo-history/react
*/
import type { UndoConfig, UseUndoReturn } from '../core/index.js';
/** Accept either a config (fresh core) or an existing core (shared mount). */
export type UndoInput = UndoConfig | UseUndoReturn;
/**
* Bind an undo-history core to React. Pass a config for a fresh core, or
* an existing core to share one mount across adapters.
*/
export declare function useUndoHistory(input?: UndoInput): UseUndoReturn;
//# sourceMappingURL=index.d.ts.map