refactor(commands): centralize command ids

This commit is contained in:
syntaxbullet
2026-07-03 11:31:02 +02:00
parent 8320203f11
commit 84a610f019
15 changed files with 66 additions and 38 deletions

View File

@@ -1,5 +1,6 @@
import type { ArtboardId, LayerId } from "@core/id";
import type { Command } from "./command";
import { commandIds } from "./ids";
export type SelectionSetPayload = {
artboardId?: ArtboardId;
@@ -11,7 +12,7 @@ export type SelectionAddLayerPayload = {
};
export const selectionSetCommand: Command<SelectionSetPayload> = {
id: "selection.set",
id: commandIds.selectionSet,
name: "Set selection",
execute({ state }, payload) {
return {
@@ -28,7 +29,7 @@ export const selectionSetCommand: Command<SelectionSetPayload> = {
};
export const selectionClearCommand: Command = {
id: "selection.clear",
id: commandIds.selectionClear,
name: "Clear selection",
execute({ state }) {
return {
@@ -42,7 +43,7 @@ export const selectionClearCommand: Command = {
};
export const selectionAddLayerCommand: Command<SelectionAddLayerPayload> = {
id: "selection.addLayer",
id: commandIds.selectionAddLayer,
name: "Add layer to selection",
execute({ state }, payload) {
if (state.editor.selection.layerIds.includes(payload.layerId)) return state;