import { Model } from "../model/Model";
/**
* Options for the {@link useUndo} hook
*/
export interface IUndoOptions {
/** maximum number of undo steps to retain, default 100 */
maxBufferSize?: number;
/** action types that should not create an undo step, default [Actions.SET_ACTIVE_TABSET] */
ignoreActionTypes?: string[];
}
/**
* The result of the {@link useUndo} hook
*/
export interface IUseUndoResult {
/** the model to pass to the Layout component */
model: Model | null;
/**
* Replaces the model (e.g. after loading a layout). By default the undo/redo history is
* cleared; pass `false` as the second argument to keep it (for example for an in-place
* round-trip of the same model, which should not lose the history).
*/
setModel: (model: Model, resetHistory?: boolean) => void;
/** undo the most recent change, if any */
undo: () => void;
/** redo the most recently undone change, if any */
redo: () => void;
/** true if there is at least one undo step available */
canUndo: boolean;
/** true if there is at least one redo step available */
canRedo: boolean;
/** the number of undo steps available */
undoCount: number;
/** the number of redo steps available */
redoCount: number;
/** clear the undo/redo history without replacing the model */
reset: () => void;
}
/**
* React hook that encapsulates undo/redo for a FlexLayout {@link Model}. It owns the model state,
* records an undo snapshot before each model mutation (collapsing an entire drag gesture into a
* single step), and replaces the model on undo/redo via `Model.fromJson` so mounted tab content
* is preserved. The model is passed to the Layout component from the returned `model` field.
*
* ```javascript
* const { model, setModel, undo, redo, canUndo, canRedo, undoCount, redoCount } = useUndo(initialModel);
*
*
*
*
* ```
* @param initialModel the initial model (or null if the model is loaded asynchronously), or a
* function that lazily returns it (evaluated once, like a `useState` initializer)
* @param options optional configuration
*/
export declare function useUndo(initialModel?: Model | null | (() => Model | null), options?: IUndoOptions): IUseUndoResult;