Files
image-studio/editor/initial-state.ts
syntaxbullet c3a75cf0d6 feat: add command palette functionality and shortcuts
- Implemented command palette with keyboard shortcut (⌘K) for opening.
- Added commands for opening, closing, setting query, and selecting items in the command palette.
- Created tests for command palette commands and input handling.
- Enhanced layer actions with functions for adding, grouping, and deleting layers.
- Updated UI components to integrate command palette and shortcuts.
2026-07-05 17:15:20 +02:00

44 lines
898 B
TypeScript

import type { AppState, EditorState } from "./state";
import { initialToolState } from "./tools";
export const initialEditorState: EditorState = {
viewport: {
center: { x: 0, y: 0 },
zoom: 1,
rotation: 0,
size: { w: 0, h: 0 },
},
selection: {
layerIds: [],
},
tools: initialToolState,
generation: {
candidates: [],
selectedCandidateId: undefined,
compareMode: "result",
},
commandPalette: {
open: false,
query: "",
selectedIndex: 0,
},
transformSession: undefined,
maskEdit: undefined,
brushPreview: undefined,
brushStrokePreview: undefined,
};
export function createInitialAppState(name = "Untitled"): AppState {
return {
document: {
id: crypto.randomUUID(),
name,
version: 1,
artboards: [],
assets: [],
},
editor: initialEditorState,
history: { past: [], future: [] },
};
}