18 lines
419 B
TypeScript
18 lines
419 B
TypeScript
import type { AppState } from "@editor/state";
|
|
|
|
export type CommandContext = {
|
|
state: AppState;
|
|
};
|
|
|
|
export type CommandHistoryPolicy =
|
|
| { mode: "auto" }
|
|
| { mode: "ignore" }
|
|
| { mode: "deferred"; phase: "begin" | "update" | "commit" };
|
|
|
|
export type Command<TPayload = void> = {
|
|
id: string;
|
|
name: string;
|
|
history?: CommandHistoryPolicy;
|
|
execute(context: CommandContext, payload: TPayload): AppState;
|
|
};
|