/** * Represents an input or output port on a node. * @interface NodePort * @property {string} id - Unique identifier for the port * @property {string} name - Display name of the port * @property {'input' | 'output'} type - Whether this is an input or output port * @property {string} dataType - Type of data this port handles: * - number: Numeric values * - string: Text values * - boolean: True/false values * - vector3: 3D vector (x, y, z) * - color: Color values (RGB/RGBA) * - any: Any data type * @property {any} [value] - Current value at this port * @property {boolean} [connected] - Whether this port has active connections */ export interface NodePort { id: string; name: string; type: 'input' | 'output'; dataType: 'number' | 'string' | 'boolean' | 'vector3' | 'color' | 'any'; value?: any; connected?: boolean; } /** * Blueprint for creating node instances. * @interface NodeDefinition * @property {string} type - Unique node type identifier * @property {string} category - Category this node belongs to (math, geometry, etc.) * @property {string} label - Display name for the node * @property {string} [description] - Optional description of what this node does * @property {NodePort[]} inputs - Array of input port definitions * @property {NodePort[]} outputs - Array of output port definitions * @property {Function} compute - Function that processes inputs and produces outputs */ export interface NodeDefinition { type: string; category: string; label: string; description?: string; inputs: NodePort[]; outputs: NodePort[]; compute: (inputs: Record) => Record; } /** * Runtime instance of a node in the graph. * @interface NodeInstance * @property {string} id - Unique instance identifier * @property {string} type - Type of node (references NodeDefinition.type) * @property {{x: number, y: number}} position - Position in the graph canvas * @property {{width: number, height: number}} [size] - Optional custom size * @property {Record} data - Internal node state/parameters * @property {Record} inputs - Current input values (port id -> value) * @property {Record} outputs - Current output values (port id -> value) * @property {boolean} [selected] - Whether node is selected in UI * @property {boolean} [locked] - Whether node is locked from editing */ export interface NodeInstance { id: string; type: string; position: { x: number; y: number; }; size?: { width: number; height: number; }; data: Record; inputs: Record; outputs: Record; selected?: boolean; locked?: boolean; } /** * Connection between two nodes. * @interface NodeConnection * @property {string} id - Unique connection identifier * @property {string} source - Source node ID * @property {string} sourcePort - Source port ID * @property {string} target - Target node ID * @property {string} targetPort - Target port ID */ export interface NodeConnection { id: string; source: string; sourcePort: string; target: string; targetPort: string; } /** * Complete node graph containing nodes and their connections. * @interface NodeGraph * @property {string} id - Unique graph identifier * @property {string} name - Graph name * @property {NodeInstance[]} nodes - All nodes in the graph * @property {NodeConnection[]} connections - All connections between nodes * @property {Record} [metadata] - Optional graph metadata */ export interface NodeGraph { id: string; name: string; nodes: NodeInstance[]; connections: NodeConnection[]; metadata?: Record; } /** * Category grouping for organizing nodes. * @interface NodeCategory * @property {string} id - Category identifier * @property {string} name - Display name * @property {string} [color] - Optional UI color for this category * @property {string} [icon] - Optional icon identifier * @property {NodeDefinition[]} nodes - Node definitions in this category */ export interface NodeCategory { id: string; name: string; color?: string; icon?: string; nodes: NodeDefinition[]; } /** * Available node categories. * @const NodeCategories * - MATH: Mathematical operations (add, multiply, sin, cos, etc.) * - GEOMETRY: Geometric primitives and operations * - TRANSFORM: Spatial transformations (translate, rotate, scale) * - UTILITY: Helper nodes (converters, formatters, etc.) * - INPUT: Data input nodes (constants, parameters, time) * - OUTPUT: Data output nodes (display, export) * - ANIMATION: Animation-related nodes (curves, sequences) * - LOGIC: Conditional and flow control nodes */ export declare const NodeCategories: { readonly MATH: "math"; readonly GEOMETRY: "geometry"; readonly TRANSFORM: "transform"; readonly UTILITY: "utility"; readonly INPUT: "input"; readonly OUTPUT: "output"; readonly ANIMATION: "animation"; readonly LOGIC: "logic"; }; /** * Type representing valid node category values. */ export type NodeCategoryType = typeof NodeCategories[keyof typeof NodeCategories];