Browse Source

feat(19-02): extract workflow and model types

Create models.ts with AspectRatio, Resolution, ModelType.
Create workflow.ts with WorkflowEdge, WorkflowEdgeData, WorkflowSaveConfig,
WorkflowCostData, NodeGroup, GroupColor. Update nodes.ts to import from
domain files instead of index.ts to avoid circular dependencies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
handoff-20260429-1057
shrimbly 6 months ago
parent
commit
e07ec512e0
  1. 25
      src/types/models.ts
  2. 12
      src/types/nodes.ts
  3. 51
      src/types/workflow.ts

25
src/types/models.ts

@ -0,0 +1,25 @@
/**
* Model Types
*
* Types for image generation model configuration including
* aspect ratios, resolutions, and model identifiers.
*/
// Aspect Ratios (supported by both Nano Banana and Nano Banana Pro)
export type AspectRatio =
| "1:1"
| "2:3"
| "3:2"
| "3:4"
| "4:3"
| "4:5"
| "5:4"
| "9:16"
| "16:9"
| "21:9";
// Resolution Options (only supported by Nano Banana Pro)
export type Resolution = "1K" | "2K" | "4K";
// Image Generation Model Options
export type ModelType = "nano-banana" | "nano-banana-pro";

12
src/types/nodes.ts

@ -15,15 +15,9 @@ import type {
// Re-export types from annotation for convenience
export type { AnnotationNodeData, BaseNodeData };
// Import shared types that remain in index.ts (will be moved in Plan 2)
import type {
AspectRatio,
Resolution,
ModelType,
LLMProvider,
LLMModelType,
SelectedModel,
} from "./index";
// Import from domain files to avoid circular dependencies
import type { AspectRatio, Resolution, ModelType } from "./models";
import type { LLMProvider, LLMModelType, SelectedModel } from "./providers";
/**
* All available node types in the workflow editor

51
src/types/workflow.ts

@ -0,0 +1,51 @@
/**
* Workflow Types
*
* Types for workflow management including edges, save configuration,
* cost tracking, and node groups.
*/
import { Edge } from "@xyflow/react";
// Workflow Edge Data
export interface WorkflowEdgeData extends Record<string, unknown> {
hasPause?: boolean;
}
// Workflow Edge
export type WorkflowEdge = Edge<WorkflowEdgeData>;
// Auto-save configuration stored in localStorage
export interface WorkflowSaveConfig {
workflowId: string;
name: string;
directoryPath: string;
generationsPath: string | null;
lastSavedAt: number | null;
}
// Cost tracking data stored per-workflow in localStorage
export interface WorkflowCostData {
workflowId: string;
incurredCost: number;
lastUpdated: number;
}
// Group background color options (dark mode tints)
export type GroupColor =
| "neutral"
| "blue"
| "green"
| "purple"
| "orange"
| "red";
// Group definition stored in workflow
export interface NodeGroup {
id: string;
name: string;
color: GroupColor;
position: { x: number; y: number };
size: { width: number; height: number };
locked?: boolean;
}
Loading…
Cancel
Save