import { PrimitiveVal } from './primitive_value'; import { JSUndoManager, JSUndoManagerCommand, JSUndoManagerCommand2 } from './JSUndoManager'; /** * Properties for the SetValueUndoCommand. * * @category Undo */ export interface SetValueUndoCommandProps { /** * If true, the command is final and will not be merged with the previous command. * This is ideally set to tru when the user has finished editing the value like on pressing enter or pointer up. */ last?: boolean; /** * Optional. The current before the change. * It can be set if known (but it should be exactly equal to the value in the binding and not cloned). * If not provided, it will be taken from the target object. */ lastValue?: T; } /** * Interface for a command that sets a value with a binding. * * @category Undo */ export interface SetValueUndoCommand = SetValueUndoCommandProps, TB = any> extends JSUndoManagerCommand2 { type: TS; lastVal: T; val: T; final: boolean; props: TP; uid: TD; time: number; binding?: [TB, keyof TB]; onUndoRedo?: (c: SetValueUndoCommand) => void; } /** * Interface for a command that performs an action(function). * * @category Undo */ export interface ActionUndoCommand extends JSUndoManagerCommand2 { type: TS; target: object; undo: () => any; redo: () => any; args: TA; uid: TD; onUndoRedo?: (c: ActionUndoCommand) => void; } /** * Records an undo command in the undo manager, supports merging of subsequent setValue commands. See uiconfig.js or threepipe `UndoManagerPlugin` for usage. * @param um - the undo manager to record the command in, if undefined, or not enabled the command will not be recorded * @param com - the command to record, should be of type SetValueUndoCommand, ActionUndoCommand or JSUndoManagerCommand * @param setValueCommandType - command type for the setValue command, used to identify the command type for merging * @param undoEditingWaitTime - time in milliseconds to wait before considering the command final, defaults to 2000ms * @category Undo */ export declare function recordUndoCommand(um: JSUndoManager | undefined, com: T, setValueCommandType: string, undoEditingWaitTime?: number): JSUndoManager | undefined; /** * Sets a value in the target object with undo/redo support. See uiconfig.js or threepipe `UndoManagerPlugin` for usage * @param um - the undo manager to record the command in, if undefined, or not enabled the command will not be recorded but the value will still be set. * @param binding - a tuple of target object and key to set the value on * @param value - the value to set * @param props - properties for the undo command, including last, and lastValue(optional) * @param uid - unique identifier for the command, used to merge commands * @param setValueCommandType - command type for the setValue command * @param trackUndo - whether to track the undo command or not, defaults to true * @param undoEditingWaitTime - time in milliseconds to wait before considering the command final, defaults to 2000ms * @param saveBinding - whether to save the binding in the command or not, defaults to false * @param onUndoRedo - optional callback function to be called on undo/redo of the command * @returns an object containing the last value, the new value, the last value before the change, and whether the command is undoable or not. * @category Undo */ export declare function setValueUndoCommand(um: JSUndoManager | undefined, binding: [T1, keyof T1], value: PrimitiveVal, props: SetValueUndoCommandProps, uid: any, setValueCommandType: string, trackUndo?: boolean, undoEditingWaitTime?: number, saveBinding?: boolean, onUndoRedo?: (c: SetValueUndoCommand) => void): { last: boolean; value: PrimitiveVal; lastValue: string | number | boolean | import('./primitive_value').PrimitiveValObject | PrimitiveVal[] | T; undoable: boolean; }; //# sourceMappingURL=undo_commands.d.ts.map