@dxos/app-framework - v0.16.0
    Preparing search index...

    Interface UndoMappingProps<Op, Inv>

    Props for creating an UndoMapping.

    interface UndoMappingProps<
        Op extends Operation.Definition<any, any>,
        Inv extends Operation.Definition<any, any>,
    > {
        context?: (input: InputOf<Op>, output: OutputOf<Op>) => unknown;
        deriveContext: (
            input: InputOf<Op>,
            output: OutputOf<Op>,
        ) => undefined | InputOf<Inv>;
        inverse: Inv;
        merge?: (earlier: Invocation<Op>, later: Invocation<Op>) => Invocation<Op>;
        mergeKey?: (input: InputOf<Op>, output: OutputOf<Op>) => undefined | string;
        message?: MessageProvider<Op>;
        operation: Op;
        scope?: (input: InputOf<Op>, output: OutputOf<Op>) => undefined | string;
        toast?: boolean;
    }

    Type Parameters

    • Op extends Operation.Definition<any, any>
    • Inv extends Operation.Definition<any, any>
    Index

    Properties

    context?: (input: InputOf<Op>, output: OutputOf<Op>) => unknown

    Optional opaque context (e.g. view path and selection) returned on undo and redo so the UI can return to where the change happened.

    deriveContext: (
        input: InputOf<Op>,
        output: OutputOf<Op>,
    ) => undefined | InputOf<Inv>

    Derives the input for the inverse operation from the forward operation's input and output. Return undefined to indicate the operation is not undoable.

    inverse: Inv

    The inverse operation to invoke for undo.

    merge?: (earlier: Invocation<Op>, later: Invocation<Op>) => Invocation<Op>

    Optional fold of two merged invocations into one forward, from which the inverse is derived again.

    mergeKey?: (input: InputOf<Op>, output: OutputOf<Op>) => undefined | string

    Optional merge key; consecutive entries in one scope with equal keys inside the tracker's merge window fold into one undo step (e.g. typing into one field).

    message?: MessageProvider<Op>

    Optional message to show in the undo toast. Can be a static Label or a function that derives the message from input/output.

    operation: Op

    The forward operation.

    scope?: (input: InputOf<Op>, output: OutputOf<Op>) => undefined | string

    Optional scope (document or subject id) so scoped undo/redo can act on this entry alone. Return undefined to leave the entry reachable only by unscoped undo/redo.

    toast?: boolean

    Whether recording an entry offers the undo toast; true when absent.