import React from "react";
/**
 * Spec: https://tools.ietf.org/html/rfc6902
 *
 * add, { "op": "add", "path": ["data", "1,2"], "value": "hello world" }
 * remove { "op": "remove", "path": ["data", "1,2"], "value": "hello world" }
 * replace { "op": "replace", "path": ["data", "1,2"], "value": "hello world" }
 * move { "op": "move", "from": "/a/b/c", "path": "/a/b/d" }
 * copy
 */
export interface UndoProps {
    onRedo?: (patches: Patches) => void;
    onUndo?: (patches: Patches) => void;
}
export interface UndoResults {
    undo: () => void;
    redo: () => void;
    add: (stack: Stack) => void;
    canUndo: boolean;
    canRedo: boolean;
    onKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => void;
}
export declare type Path = [string, any];
export interface Patches {
    path: Path;
    value: any;
    op: Operator;
}
export interface Stack {
    patches: Patches;
    inversePatches: Patches;
}
export declare type Operator = "add" | "remove" | "replace" | "move";
/**
 * Create patches
 * @param path
 * @param value
 * @param previousValue
 * @param op
 */
export declare function createPatches(path: Path, value: any, previousValue: any, op?: Operator): Stack;
/**
 * Undo/Redo hook
 * @param
 */
declare const useUndo: (props?: UndoProps) => UndoResults;
export default useUndo;
