- Implemented ComfyGenerateRequest type and associated functions for generating images using various architectures and modes. - Added functions for listing generation options and handling image uploads. - Created workflows for different generation modes including SDXL, Z-Image, Z-Image Turbo, and Anima. - Introduced GenerationJobStatus component to display the status of ongoing generation jobs. - Developed MaskControls for managing mask operations and displaying mask analysis. - Created palette items for tool selection, layer management, and generation settings.
33 lines
1.5 KiB
TypeScript
33 lines
1.5 KiB
TypeScript
import type { WorkspacePanel } from "@editor/state";
|
|
import type { Command } from "./command";
|
|
import { commandIds } from "./ids";
|
|
|
|
export type WorkspaceSetPanelPayload = { panel: WorkspacePanel };
|
|
|
|
export const workspaceSetPanelCommand: Command<WorkspaceSetPanelPayload> = {
|
|
id: commandIds.workspaceSetPanel,
|
|
name: "Set workspace panel",
|
|
history: { mode: "ignore" },
|
|
execute({ state }, payload) {
|
|
if (!workspacePanels.has(payload.panel)) return state;
|
|
const currentTool = state.editor.tools.activeTool;
|
|
const previousNonGenerateTool = currentTool === "generate" ? state.editor.workspace.previousNonGenerateTool : currentTool;
|
|
const nextTool = payload.panel === "generate" ? "generate" : currentTool === "generate" ? previousNonGenerateTool : currentTool;
|
|
if (state.editor.workspace.panel === payload.panel && currentTool === nextTool) return state;
|
|
return {
|
|
...state,
|
|
editor: {
|
|
...state.editor,
|
|
workspace: { panel: payload.panel, previousNonGenerateTool },
|
|
tools: nextTool === currentTool ? state.editor.tools : { ...state.editor.tools, activeTool: nextTool, interactionMode: { type: "tool", tool: nextTool } },
|
|
brushPreview: nextTool === currentTool ? state.editor.brushPreview : undefined,
|
|
brushStrokePreview: nextTool === currentTool ? state.editor.brushStrokePreview : undefined,
|
|
},
|
|
};
|
|
},
|
|
};
|
|
|
|
const workspacePanels = new Set<WorkspacePanel>(["none", "generate", "layers"]);
|
|
|
|
export const workspaceCommands = [workspaceSetPanelCommand] satisfies Command<unknown>[];
|