feat: add ComfyUI integration for image generation and management
- 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.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import type { ImageDocument } from "@core/document";
|
||||
import type { Rect, Size, Vec2D } from "@core/geometry";
|
||||
import type { ArtboardId, LayerId } from "@core/id";
|
||||
import type { Layer } from "@core/layer";
|
||||
import type { InputArtboardId, InputDocument, InputLayer, InputLayerId } from "./read-model";
|
||||
|
||||
export type InputViewportState = {
|
||||
center: Vec2D;
|
||||
@@ -11,21 +9,21 @@ export type InputViewportState = {
|
||||
};
|
||||
|
||||
export type InputSelectionState = {
|
||||
artboardId?: ArtboardId;
|
||||
layerIds: LayerId[];
|
||||
artboardId?: InputArtboardId;
|
||||
layerIds: InputLayerId[];
|
||||
};
|
||||
|
||||
export type InputTransformTarget =
|
||||
| { type: "artboard"; id: ArtboardId }
|
||||
| { type: "layer"; id: LayerId };
|
||||
| { type: "artboard"; id: InputArtboardId }
|
||||
| { type: "layer"; id: InputLayerId };
|
||||
|
||||
export function selectedTransformTarget(_document: ImageDocument, selection: InputSelectionState): InputTransformTarget | undefined {
|
||||
export function selectedTransformTarget(_document: InputDocument, selection: InputSelectionState): InputTransformTarget | undefined {
|
||||
if (selection.layerIds.length === 1 && selection.layerIds[0]) return { type: "layer", id: selection.layerIds[0] };
|
||||
if (selection.artboardId) return { type: "artboard", id: selection.artboardId };
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function resolveTransformTargetBounds(document: ImageDocument, target: InputTransformTarget): Rect | undefined {
|
||||
export function resolveTransformTargetBounds(document: InputDocument, target: InputTransformTarget): Rect | undefined {
|
||||
switch (target.type) {
|
||||
case "artboard":
|
||||
return document.artboards.find((artboard) => artboard.id === target.id)?.bounds;
|
||||
@@ -52,7 +50,7 @@ export function documentRectToViewportRect(rect: Rect, viewport: InputViewportSt
|
||||
};
|
||||
}
|
||||
|
||||
function findLayer(document: ImageDocument, layerId: LayerId): Layer | undefined {
|
||||
function findLayer(document: InputDocument, layerId: InputLayerId): InputLayer | undefined {
|
||||
for (const artboard of document.artboards) {
|
||||
const layer = findLayerInTree(artboard.layers, layerId);
|
||||
if (layer) return layer;
|
||||
@@ -61,7 +59,7 @@ function findLayer(document: ImageDocument, layerId: LayerId): Layer | undefined
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function findLayerInTree(layers: readonly Layer[], layerId: LayerId): Layer | undefined {
|
||||
function findLayerInTree(layers: readonly InputLayer[], layerId: InputLayerId): InputLayer | undefined {
|
||||
for (const layer of layers) {
|
||||
if (layer.id === layerId) return layer;
|
||||
if (layer.type === "group") {
|
||||
@@ -73,7 +71,7 @@ function findLayerInTree(layers: readonly Layer[], layerId: LayerId): Layer | un
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function resolveLayerBounds(document: ImageDocument, layer: Layer): Rect | undefined {
|
||||
function resolveLayerBounds(document: InputDocument, layer: InputLayer): Rect | undefined {
|
||||
switch (layer.type) {
|
||||
case "group":
|
||||
return unionRects(layer.children.flatMap((child) => {
|
||||
|
||||
Reference in New Issue
Block a user