import type { Rect } from "@core/geometry"; import type { ArtboardId } from "@core/id"; import type { Command } from "./command"; import { commandIds } from "./ids"; export type DocumentAddArtboardPayload = { id: ArtboardId; name: string; bounds: Rect; }; export const documentAddArtboardCommand: Command = { id: commandIds.documentAddArtboard, name: "Add artboard", execute({ state }, payload) { return { ...state, document: { ...state.document, artboards: [ ...state.document.artboards, { id: payload.id, name: payload.name, bounds: payload.bounds, backgroundColor: "transparent", layers: [], }, ], }, }; }, }; export const documentCommands = [documentAddArtboardCommand] satisfies Command[];