diff --git a/package.json b/package.json index 4b5759b..db25f03 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "eslint" + "lint": "eslint", + "typecheck": "tsc --noEmit" }, "dependencies": { "@supabase/ssr": "^0.8.0", diff --git a/src/types/flowchart.ts b/src/types/flowchart.ts new file mode 100644 index 0000000..21a5c54 --- /dev/null +++ b/src/types/flowchart.ts @@ -0,0 +1,73 @@ +// Position type for node coordinates +export type Position = { + x: number; + y: number; +}; + +// DialogueNode type: represents character speech/dialogue +export type DialogueNode = { + id: string; + type: 'dialogue'; + position: Position; + data: { + speaker?: string; + text: string; + }; +}; + +// Choice option type for ChoiceNode +export type ChoiceOption = { + id: string; + label: string; +}; + +// ChoiceNode type: represents branching decisions +export type ChoiceNode = { + id: string; + type: 'choice'; + position: Position; + data: { + prompt: string; + options: ChoiceOption[]; + }; +}; + +// VariableNode type: represents variable operations +export type VariableNode = { + id: string; + type: 'variable'; + position: Position; + data: { + variableName: string; + operation: 'set' | 'add' | 'subtract'; + value: number; + }; +}; + +// Union type for all node types +export type FlowchartNode = DialogueNode | ChoiceNode | VariableNode; + +// Condition type for conditional edges +export type Condition = { + variableName: string; + operator: '>' | '<' | '==' | '>=' | '<=' | '!='; + value: number; +}; + +// FlowchartEdge type: represents connections between nodes +export type FlowchartEdge = { + id: string; + source: string; + sourceHandle?: string; + target: string; + targetHandle?: string; + data?: { + condition?: Condition; + }; +}; + +// FlowchartData type: represents the complete flowchart structure +export type FlowchartData = { + nodes: FlowchartNode[]; + edges: FlowchartEdge[]; +};