Skip to content

Interface: Command\<TRow\>

Defined in: src/tree-editor/types.ts:31

A reversible command that transforms tree state. All structural mutations (add, delete, move, etc.) are commands.

Type Parameters

TRow

TRow

Properties

description

description: string

Defined in: src/tree-editor/types.ts:35

Human-readable description for undo/redo UI.


type

type: string

Defined in: src/tree-editor/types.ts:33

Unique command type identifier (e.g., ‘add-node’, ‘move-node’).

Methods

execute()

execute(state): TreeState<TRow>

Defined in: src/tree-editor/types.ts:37

Apply the mutation. Returns the new tree state.

Parameters

state

TreeState<TRow>

Returns

TreeState<TRow>


undo()

undo(state): TreeState<TRow>

Defined in: src/tree-editor/types.ts:39

Reverse the mutation. Returns the previous tree state.

Parameters

state

TreeState<TRow>

Returns

TreeState<TRow>