109 lines
2.4 KiB
TypeScript
109 lines
2.4 KiB
TypeScript
// Position type for node coordinates
|
|
export type Position = {
|
|
x: number;
|
|
y: number;
|
|
};
|
|
|
|
<<<<<<< HEAD
|
|
// Condition type for conditional edges and choice options
|
|
export type Condition = {
|
|
variableName: string;
|
|
operator: '>' | '<' | '==' | '>=' | '<=' | '!=';
|
|
value: number;
|
|
=======
|
|
// Character type: represents a defined character in the project
|
|
export type Character = {
|
|
id: string;
|
|
name: string;
|
|
color: string; // hex color
|
|
description?: string;
|
|
};
|
|
|
|
// Variable type: represents a defined variable in the project
|
|
export type Variable = {
|
|
id: string;
|
|
name: string;
|
|
type: 'numeric' | 'string' | 'boolean';
|
|
initialValue: number | string | boolean;
|
|
description?: string;
|
|
};
|
|
|
|
// Condition type for conditional edges and choice options
|
|
export type Condition = {
|
|
variableName: string;
|
|
variableId?: string;
|
|
operator: '>' | '<' | '==' | '>=' | '<=' | '!=';
|
|
value: number | string | boolean;
|
|
>>>>>>> ralph/collaboration-and-character-variables
|
|
};
|
|
|
|
// DialogueNode type: represents character speech/dialogue
|
|
export type DialogueNodeData = {
|
|
speaker?: string;
|
|
characterId?: string;
|
|
text: string;
|
|
};
|
|
|
|
export type DialogueNode = {
|
|
id: string;
|
|
type: 'dialogue';
|
|
position: Position;
|
|
data: DialogueNodeData;
|
|
};
|
|
|
|
// Choice option type for ChoiceNode
|
|
export type ChoiceOption = {
|
|
id: string;
|
|
label: string;
|
|
condition?: Condition;
|
|
};
|
|
|
|
// 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 VariableNodeData = {
|
|
variableName: string;
|
|
variableId?: string;
|
|
operation: 'set' | 'add' | 'subtract';
|
|
value: number;
|
|
};
|
|
|
|
export type VariableNode = {
|
|
id: string;
|
|
type: 'variable';
|
|
position: Position;
|
|
data: VariableNodeData;
|
|
};
|
|
|
|
// Union type for all node types
|
|
export type FlowchartNode = DialogueNode | ChoiceNode | VariableNode;
|
|
|
|
// 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[];
|
|
characters: Character[];
|
|
variables: Variable[];
|
|
};
|