@theclearsky/react-blender-nodes 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,10 @@ a flexible and customizable node-based graph editor for web applications.
21
21
  React Blender Nodes recreates the iconic Blender node editor experience on the
22
22
  web. Built with modern React patterns and TypeScript, it offers a complete
23
23
  solution for creating interactive node-based interfaces with support for custom
24
- nodes, connections, and real-time manipulation.
24
+ nodes, connections, and real-time manipulation. Features an intelligent type
25
+ system with automatic inference, complex data validation, and comprehensive
26
+ connection validation to ensure your node graphs are always type-safe and
27
+ error-free.
25
28
 
26
29
  ## Quick Start
27
30
 
@@ -38,7 +41,6 @@ import {
38
41
  FullGraph,
39
42
  useFullGraph,
40
43
  makeStateWithAutoInfer,
41
- makeNodeIdToNodeTypeWithAutoInfer,
42
44
  makeTypeOfNodeWithAutoInfer,
43
45
  makeDataTypeWithAutoInfer,
44
46
  } from 'react-blender-nodes';
@@ -72,14 +74,10 @@ function MyNodeEditor() {
72
74
  }),
73
75
  };
74
76
 
75
- // Define node ID to type mapping with auto-infer
76
- const nodeIdToNodeType = makeNodeIdToNodeTypeWithAutoInfer({});
77
-
78
77
  // Create state with auto-infer for complete type safety
79
78
  const initialState = makeStateWithAutoInfer({
80
79
  dataTypes,
81
80
  typeOfNodes,
82
- nodeIdToNodeType,
83
81
  nodes: [],
84
82
  edges: [],
85
83
  });
@@ -103,7 +101,6 @@ throughout your graph system:
103
101
  - **`makeDataTypeWithAutoInfer`**: Validates data type definitions
104
102
  - **`makeTypeOfNodeWithAutoInfer`**: Validates node type definitions and
105
103
  dataType references
106
- - **`makeNodeIdToNodeTypeWithAutoInfer`**: Validates node ID to type mappings
107
104
  - **`makeStateWithAutoInfer`**: Provides complete type inference for the entire
108
105
  state
109
106
 
@@ -164,19 +161,91 @@ const dataTypes = {
164
161
  - Context menu for adding new nodes
165
162
  - Real-time node manipulation
166
163
 
167
- ### 🎯 Advanced Features
168
-
169
- ![Advanced Features](./docs/screenshots/advanced-features.png)
170
-
171
- - **Handle Shapes**: 13+ custom handle shapes including geometric and artistic
172
- designs
173
- - **Input Components**: Built-in text and number inputs with validation
174
- - **Panel System**: Collapsible panels for organizing complex node inputs
164
+ ### 🧠 Smart Type System & Validation + Advanced Features
165
+
166
+ https://github.com/user-attachments/assets/72d9384a-e9ca-4223-906a-dc422fb66f49
167
+
168
+ - **Intelligent Type Inference**: Automatically infer node types from
169
+ connections
170
+ - Dynamic type resolution as you build your graph
171
+ - Real-time type updates when connections change
172
+ - Support for `inferFromConnection` data types
173
+ - **Advanced Type Validation**: Comprehensive type checking system
174
+ - **Complex Type Checking**: Zod schema validation for complex data structures
175
+ - **Type Conversion Control**: Fine-grained control over allowed type
176
+ conversions
177
+ - **Cycle Detection**: Prevent infinite loops in your node graphs
178
+ - **Multiple Data Types**: Support for diverse data structures
179
+ - Basic types: `string`, `number`
180
+ - Complex types: Custom objects with Zod schemas
181
+ - Special types: `inferFromConnection`, `noEquivalent`
182
+ - **Runtime Safety**: Catch type errors before they break your application
183
+ - Connection validation with detailed error messages
184
+ - Automatic type propagation across connected nodes
185
+ - Schema compatibility checking for complex types
175
186
  - **State Management**: Integrated reducer for managing graph state
176
187
  - **TypeScript Support**: Full type safety with comprehensive definitions
177
188
 
178
189
  ## Usage Examples
179
190
 
191
+ ### Smart Type System with Validation
192
+
193
+ ```tsx
194
+ import { z } from 'zod';
195
+
196
+ // Define complex data types with Zod schemas
197
+ const userSchema = z.object({
198
+ id: z.string(),
199
+ name: z.string(),
200
+ email: z.string().email(),
201
+ });
202
+
203
+ const dataTypes = {
204
+ stringType: makeDataTypeWithAutoInfer({
205
+ name: 'String',
206
+ underlyingType: 'string',
207
+ color: '#4A90E2',
208
+ }),
209
+ userType: makeDataTypeWithAutoInfer({
210
+ name: 'User',
211
+ underlyingType: 'complex',
212
+ complexSchema: userSchema,
213
+ color: '#7ED321',
214
+ }),
215
+ inferredType: makeDataTypeWithAutoInfer({
216
+ name: 'Inferred',
217
+ underlyingType: 'inferFromConnection',
218
+ color: '#FF6B6B',
219
+ }),
220
+ };
221
+
222
+ // Enable advanced validation features
223
+ const initialState = makeStateWithAutoInfer({
224
+ dataTypes,
225
+ typeOfNodes: {
226
+ userInput: makeTypeOfNodeWithAutoInfer({
227
+ name: 'User Input',
228
+ inputs: [{ name: 'User Data', dataType: 'userType' }],
229
+ outputs: [{ name: 'Output', dataType: 'inferredType' }],
230
+ }),
231
+ stringProcessor: makeTypeOfNodeWithAutoInfer({
232
+ name: 'String Processor',
233
+ inputs: [{ name: 'Input', dataType: 'inferredType' }],
234
+ outputs: [{ name: 'Result', dataType: 'stringType' }],
235
+ }),
236
+ },
237
+ nodes: [],
238
+ edges: [],
239
+ // Enable smart validation features
240
+ enableTypeInference: true,
241
+ enableComplexTypeChecking: true,
242
+ enableCycleChecking: true,
243
+ allowedConversionsBetweenDataTypes: {
244
+ userType: { stringType: true }, // Allow user to string conversion
245
+ },
246
+ });
247
+ ```
248
+
180
249
  ### Custom Node with Panels
181
250
 
182
251
  ```tsx
package/dist/index.d.ts CHANGED
@@ -40,7 +40,7 @@ export declare type Action<DataTypeUniqueId extends string = string, NodeTypeUni
40
40
  type: typeof actionTypesMap.ADD_NODE;
41
41
  payload: {
42
42
  /** Type of node to add */
43
- type: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['nodeIdToNodeType'][string];
43
+ type: NodeTypeUniqueId;
44
44
  /** Position where to place the node */
45
45
  position: XYPosition;
46
46
  };
@@ -49,7 +49,7 @@ export declare type Action<DataTypeUniqueId extends string = string, NodeTypeUni
49
49
  type: typeof actionTypesMap.ADD_NODE_AND_SELECT;
50
50
  payload: {
51
51
  /** Type of node to add */
52
- type: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['nodeIdToNodeType'][string];
52
+ type: NodeTypeUniqueId;
53
53
  /** Position where to place the node */
54
54
  position: XYPosition;
55
55
  };
@@ -58,7 +58,7 @@ export declare type Action<DataTypeUniqueId extends string = string, NodeTypeUni
58
58
  type: typeof actionTypesMap.UPDATE_NODE_BY_REACT_FLOW;
59
59
  payload: {
60
60
  /** Array of node changes from ReactFlow */
61
- changes: NodeChanges<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>;
61
+ changes: NodeChanges<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>;
62
62
  };
63
63
  } | {
64
64
  /** Update edges based on ReactFlow changes */
@@ -121,7 +121,7 @@ export declare const actionTypesMap: {
121
121
  * @returns Object containing updated nodes, edges, and validation result
122
122
  */
123
123
  export declare function addEdgeWithTypeChecking<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(newEdgeSourceNodeId: string, newEdgeSourceHandleId: string, newEdgeTargetNodeId: string, newEdgeTargetHandleId: string, state: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>): {
124
- updatedNodes: Nodes<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>;
124
+ updatedNodes: Nodes<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>;
125
125
  updatedEdges: Edges;
126
126
  validation: ConnectionValidationResult;
127
127
  };
@@ -375,6 +375,8 @@ outputs?: ConfigurableNodeOutput<"string" | "number" | "complex" | "noEquivalent
375
375
  isCurrentlyInsideReactFlow?: boolean;
376
376
  /** Props for the node resizer component */
377
377
  nodeResizerProps?: NodeResizerWithMoreControlsProps;
378
+ /** Node type unique id */
379
+ nodeTypeUniqueId?: string | undefined;
378
380
  } & HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>>;
379
381
 
380
382
  /**
@@ -472,7 +474,7 @@ export declare type ConfigurableNodeOutput<UnderlyingType extends SupportedUnder
472
474
  * Defines the complete configuration for a customizable node with inputs, outputs,
473
475
  * and optional panels. Supports both standalone usage and ReactFlow integration.
474
476
  */
475
- export declare type ConfigurableNodeProps<UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never, DataTypeUniqueId extends string = string> = {
477
+ export declare type ConfigurableNodeProps<UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, NodeTypeUniqueId extends string = string, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never, DataTypeUniqueId extends string = string> = {
476
478
  /** Display name of the node */
477
479
  name?: string;
478
480
  /** Background color of the node header */
@@ -485,6 +487,8 @@ export declare type ConfigurableNodeProps<UnderlyingType extends SupportedUnderl
485
487
  isCurrentlyInsideReactFlow?: boolean;
486
488
  /** Props for the node resizer component */
487
489
  nodeResizerProps?: NodeResizerWithMoreControlsProps;
490
+ /** Node type unique id */
491
+ nodeTypeUniqueId?: NodeTypeUniqueId;
488
492
  } & HTMLAttributes<HTMLDivElement>;
489
493
 
490
494
  /**
@@ -530,15 +534,15 @@ export declare type ConfigurableNodeProps<UnderlyingType extends SupportedUnderl
530
534
  * />
531
535
  * ```
532
536
  */
533
- export declare const ConfigurableNodeReactFlowWrapper: ForwardRefExoticComponent<Omit<ConfigurableNodeReactFlowWrapperProps<"string" | "number" | "complex" | "noEquivalent" | "inferFromConnection", never, string>, "position"> & RefAttributes<HTMLDivElement>>;
537
+ export declare const ConfigurableNodeReactFlowWrapper: ForwardRefExoticComponent<Omit<ConfigurableNodeReactFlowWrapperProps<"string" | "number" | "complex" | "noEquivalent" | "inferFromConnection", string, never, string>, "position"> & RefAttributes<HTMLDivElement>>;
534
538
 
535
539
  /** Props for the ConfigurableNodeReactFlowWrapper component */
536
- export declare type ConfigurableNodeReactFlowWrapperProps<UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never, DataTypeUniqueId extends string = string> = NodeProps<ConfigurableNodeState<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>> & {
540
+ export declare type ConfigurableNodeReactFlowWrapperProps<UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, NodeTypeUniqueId extends string = string, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never, DataTypeUniqueId extends string = string> = NodeProps<ConfigurableNodeState<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>> & {
537
541
  position: XYPosition;
538
542
  };
539
543
 
540
544
  /** State type for configurable nodes in ReactFlow */
541
- export declare type ConfigurableNodeState<UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never, DataTypeUniqueId extends string = string> = Node_2<Omit<ConfigurableNodeProps<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>, 'isCurrentlyInsideReactFlow'>, 'configurableNode'>;
545
+ export declare type ConfigurableNodeState<UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, NodeTypeUniqueId extends string = string, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never, DataTypeUniqueId extends string = string> = Node_2<Omit<ConfigurableNodeProps<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>, 'isCurrentlyInsideReactFlow'>, 'configurableNode'>;
542
546
 
543
547
  /**
544
548
  * Type for connection validation result
@@ -663,7 +667,6 @@ export declare function constructInputPanelOfType<DataTypeUniqueId extends strin
663
667
  * import {
664
668
  * constructNodeOfType,
665
669
  * makeStateWithAutoInfer,
666
- * makeNodeIdToNodeTypeWithAutoInfer,
667
670
  * makeTypeOfNodeWithAutoInfer,
668
671
  * makeDataTypeWithAutoInfer
669
672
  * } from 'react-blender-nodes';
@@ -1060,7 +1063,6 @@ export declare type Edges = ConfigurableEdgeState[];
1060
1063
  * FullGraph,
1061
1064
  * useFullGraph,
1062
1065
  * makeStateWithAutoInfer,
1063
- * makeNodeIdToNodeTypeWithAutoInfer,
1064
1066
  * makeTypeOfNodeWithAutoInfer,
1065
1067
  * makeDataTypeWithAutoInfer
1066
1068
  * } from 'react-blender-nodes';
@@ -1102,17 +1104,10 @@ export declare type Edges = ConfigurableEdgeState[];
1102
1104
  * }),
1103
1105
  * };
1104
1106
  *
1105
- * // Define node ID to type mapping with auto-infer
1106
- * const nodeIdToNodeType = makeNodeIdToNodeTypeWithAutoInfer({
1107
- * 'node-1': 'inputNode',
1108
- * 'node-2': 'outputNode',
1109
- * });
1110
- *
1111
1107
  * // Create state with auto-infer for complete type safety
1112
1108
  * const initialState = makeStateWithAutoInfer({
1113
1109
  * dataTypes,
1114
1110
  * typeOfNodes,
1115
- * nodeIdToNodeType,
1116
1111
  * nodes: [],
1117
1112
  * edges: [],
1118
1113
  * });
@@ -1146,6 +1141,11 @@ export declare type FullGraphProps<DataTypeUniqueId extends string = string, Nod
1146
1141
  ]>;
1147
1142
  };
1148
1143
 
1144
+ export declare function getResultantDataTypeOfHandleConsideringInferredType<DataTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(handle: ConfigurableNodeInput<UnderlyingType, ComplexSchemaType, DataTypeUniqueId> | ConfigurableNodeOutput<UnderlyingType, ComplexSchemaType, DataTypeUniqueId> | undefined): {
1145
+ dataTypeObject: DataType<UnderlyingType, ComplexSchemaType>;
1146
+ dataTypeUniqueId: DataTypeUniqueId;
1147
+ } | undefined;
1148
+
1149
1149
  declare type HandleIndices = {
1150
1150
  type: 'input';
1151
1151
  index1: number;
@@ -1300,11 +1300,6 @@ export declare function isSupportedUnderlyingType(type: string): type is Support
1300
1300
  */
1301
1301
  export declare function isValidDataTypeId<DataTypeUniqueId extends string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(id: string, dataTypes: Record<DataTypeUniqueId, DataType<UnderlyingType, ComplexSchemaType>>): id is DataTypeUniqueId;
1302
1302
 
1303
- /**
1304
- * Type guard to check if a string is a valid NodeTypeUniqueId
1305
- */
1306
- export declare function isValidNodeTypeUniqueId<NodeTypeUniqueId extends string>(id: string, nodeIdToNodeType: Record<string, NodeTypeUniqueId>): id is NodeTypeUniqueId;
1307
-
1308
1303
  /**
1309
1304
  * Main reducer function for managing graph state
1310
1305
  *
@@ -1325,7 +1320,6 @@ export declare function isValidNodeTypeUniqueId<NodeTypeUniqueId extends string>
1325
1320
  * import {
1326
1321
  * mainReducer,
1327
1322
  * makeStateWithAutoInfer,
1328
- * makeNodeIdToNodeTypeWithAutoInfer,
1329
1323
  * makeTypeOfNodeWithAutoInfer,
1330
1324
  * makeDataTypeWithAutoInfer
1331
1325
  * } from 'react-blender-nodes';
@@ -1348,14 +1342,9 @@ export declare function isValidNodeTypeUniqueId<NodeTypeUniqueId extends string>
1348
1342
  * }),
1349
1343
  * };
1350
1344
  *
1351
- * const nodeIdToNodeType = makeNodeIdToNodeTypeWithAutoInfer({
1352
- * 'node-1': 'inputNode',
1353
- * });
1354
- *
1355
1345
  * const state = makeStateWithAutoInfer({
1356
1346
  * dataTypes,
1357
1347
  * typeOfNodes,
1358
- * nodeIdToNodeType,
1359
1348
  * nodes: [],
1360
1349
  * edges: [],
1361
1350
  * });
@@ -1443,34 +1432,6 @@ export declare function makeAllowedConversionsBetweenDataTypesWithAutoInfer<Data
1443
1432
  */
1444
1433
  export declare function makeDataTypeWithAutoInfer<UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(input: DataType<UnderlyingType, ComplexSchemaType>): DataType<UnderlyingType, ComplexSchemaType>;
1445
1434
 
1446
- /**
1447
- * Helper function to create a node ID to node type mapping with automatic type inference
1448
- *
1449
- * This function is essential for type safety when mapping node IDs to their types.
1450
- * It ensures that TypeScript can validate that all node type references are valid,
1451
- * preventing runtime errors when dispatching actions and providing better IDE support.
1452
- *
1453
- * @template NodeTypeUniqueId - Unique identifier type for node types
1454
- * @param input - The node ID to node type mapping
1455
- * @returns The mapping with proper typing
1456
- *
1457
- * @example
1458
- * ```tsx
1459
- * // ✅ Type-safe - TypeScript will validate node type references
1460
- * const nodeIdToNodeType = makeNodeIdToNodeTypeWithAutoInfer({
1461
- * 'node-1': 'inputNode',
1462
- * 'node-2': 'outputNode',
1463
- * });
1464
- *
1465
- * // ❌ Without auto-infer - TypeScript can't validate node type references
1466
- * const nodeIdToNodeType = {
1467
- * 'node-1': 'inputNode',
1468
- * 'node-2': 'outputNode',
1469
- * };
1470
- * ```
1471
- */
1472
- export declare function makeNodeIdToNodeTypeWithAutoInfer<NodeTypeUniqueId extends string = string>(input: NodeIdToNodeType<NodeTypeUniqueId>): NodeIdToNodeType<NodeTypeUniqueId>;
1473
-
1474
1435
  /**
1475
1436
  * Helper function to create a state with automatic type inference
1476
1437
  *
@@ -1503,7 +1464,6 @@ export declare function makeNodeIdToNodeTypeWithAutoInfer<NodeTypeUniqueId exten
1503
1464
  * outputs: []
1504
1465
  * })
1505
1466
  * },
1506
- * nodeIdToNodeType: makeNodeIdToNodeTypeWithAutoInfer({}),
1507
1467
  * nodes: [],
1508
1468
  * edges: [],
1509
1469
  * });
@@ -1513,7 +1473,6 @@ export declare function makeNodeIdToNodeTypeWithAutoInfer<NodeTypeUniqueId exten
1513
1473
  * dataTypes: { stringType: { name: 'String', underlyingType: 'string', color: '#4A90E2' } },
1514
1474
  * typeOfNodes: { inputNode: { name: 'Input', inputs: [], outputs: [] } },
1515
1475
  * nodes: [],
1516
- * nodeIdToNodeType: {},
1517
1476
  * edges: [],
1518
1477
  * };
1519
1478
  * ```
@@ -1555,14 +1514,7 @@ export declare function makeTypeOfNodeWithAutoInfer<DataTypeUniqueId extends str
1555
1514
  /**
1556
1515
  * Array of node changes for ReactFlow
1557
1516
  */
1558
- export declare type NodeChanges<UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never, DataTypeUniqueId extends string = string> = NodeChange<Optional<ConfigurableNodeReactFlowWrapperProps<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>, NodeOptionalKeys>>[];
1559
-
1560
- /**
1561
- * Mapping from node IDs to their node types
1562
- *
1563
- * @template NodeTypeUniqueId - Unique identifier type for node types
1564
- */
1565
- export declare type NodeIdToNodeType<NodeTypeUniqueId extends string = string> = Record<string, NodeTypeUniqueId>;
1517
+ export declare type NodeChanges<UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, NodeTypeUniqueId extends string = string, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never, DataTypeUniqueId extends string = string> = NodeChange<Optional<ConfigurableNodeReactFlowWrapperProps<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>, NodeOptionalKeys>>[];
1566
1518
 
1567
1519
  declare type NodeOptionalKeys = 'draggable' | 'zIndex' | 'selectable' | 'deletable' | 'dragging' | 'selected' | 'isConnectable' | 'positionAbsoluteX' | 'positionAbsoluteY';
1568
1520
 
@@ -1634,7 +1586,7 @@ export declare type NodeResizerWithMoreControlsProps = NodeResizerProps & {
1634
1586
  /**
1635
1587
  * Array of configurable nodes in the graph
1636
1588
  */
1637
- export declare type Nodes<UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never, DataTypeUniqueId extends string = string> = Optional<ConfigurableNodeReactFlowWrapperProps<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>, NodeOptionalKeys>[];
1589
+ export declare type Nodes<UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, NodeTypeUniqueId extends string = string, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never, DataTypeUniqueId extends string = string> = Optional<ConfigurableNodeReactFlowWrapperProps<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>, NodeOptionalKeys>[];
1638
1590
 
1639
1591
  declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
1640
1592
 
@@ -1682,7 +1634,7 @@ export declare type ReactFlowAwareInputProps = {
1682
1634
  * @returns Object containing updated nodes, edges, and validation result
1683
1635
  */
1684
1636
  export declare function removeEdgeWithTypeChecking<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(removedEdge: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>['edges'][number], state: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, removedEdgeChange: EdgeChange<ConfigurableEdgeState>): {
1685
- updatedNodes: Nodes<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>;
1637
+ updatedNodes: Nodes<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>;
1686
1638
  updatedEdges: Edges;
1687
1639
  validation: ConnectionValidationResult;
1688
1640
  };
@@ -1780,17 +1732,57 @@ export declare type State<DataTypeUniqueId extends string = string, NodeTypeUniq
1780
1732
  /** Map of node type definitions */
1781
1733
  typeOfNodes: Record<NodeTypeUniqueId, TypeOfNode<DataTypeUniqueId>>;
1782
1734
  /** Array of nodes in the graph */
1783
- nodes: Nodes<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>;
1784
- /** Mapping from node IDs to their types */
1785
- nodeIdToNodeType: NodeIdToNodeType<NodeTypeUniqueId>;
1735
+ nodes: Nodes<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>;
1786
1736
  /** Array of edges in the graph */
1787
1737
  edges: Edges;
1788
- /** Optional mapping of allowed conversions between data types */
1738
+ /**
1739
+ * Optional mapping of allowed conversions between data types
1740
+ * - When not provided, all conversions are allowed
1741
+ * - If provided, only the conversions that are explicitly allowed will be allowed (happens even with empty object)
1742
+ * - By default, it will not allow conversion between complex types unless explicitly allowed here (even if complex type checking is enabled)
1743
+ * - If you want to allow conversion between complex types unless disallowed by complex type checking, you can set `allowConversionBetweenComplexTypesUnlessDisallowedByComplexTypeChecking` to true
1744
+ *
1745
+ * @default undefined
1746
+ */
1789
1747
  allowedConversionsBetweenDataTypes?: AllowedConversionsBetweenDataTypes<DataTypeUniqueId>;
1790
- /** Whether to enable type inference */
1748
+ /**
1749
+ * Whether to allow conversion between complex types unless disallowed by complex type checking
1750
+ * - If not provided, is considered disabled
1751
+ * - Only takes effect if complex type checking is enabled (`allowedConversionsBetweenDataTypes` is provided)
1752
+ * - If enabled, it will allow conversion between complex types unless disallowed by complex type checking
1753
+ * - If disabled, it will not allow conversion between complex types unless explicitly allowed by `allowedConversionsBetweenDataTypes`, even if complex type checking is enabled
1754
+ *
1755
+ * @default undefined
1756
+ */
1757
+ allowConversionBetweenComplexTypesUnlessDisallowedByComplexTypeChecking?: boolean;
1758
+ /**
1759
+ * Whether to enable type inference
1760
+ * - If not provided, is considered disabled
1761
+ * - When disabled, the types of the nodes are not inferred from the connections
1762
+ * - When enabled, the types of the nodes are inferred from the connections and reset when edges are removed
1763
+ *
1764
+ * @default undefined
1765
+ */
1791
1766
  enableTypeInference?: boolean;
1792
- /** Whether to enable complex type checking */
1767
+ /**
1768
+ * Whether to enable complex type checking
1769
+ * - If not provided, is considered disabled
1770
+ * - When disabled, the complex types are not checked for compatibility, all connections are allowed
1771
+ * - When enabled, the complex types are checked for compatibility, and connections are not allowed if the complex types are not compatible
1772
+ * - Complex types are compatible if they are the same type or if they have exactly the same schema
1773
+ *
1774
+ * @default undefined
1775
+ */
1793
1776
  enableComplexTypeChecking?: boolean;
1777
+ /**
1778
+ * Whether to enable cycle checking
1779
+ * - If not provided, is considered disabled
1780
+ * - When disabled, the cycles are not checked, all connections are allowed
1781
+ * - When enabled, the cycles are checked, and connections are not allowed if they create a cycle
1782
+ *
1783
+ * @default undefined
1784
+ */
1785
+ enableCycleChecking?: boolean;
1794
1786
  };
1795
1787
 
1796
1788
  /**
@@ -1854,6 +1846,7 @@ export declare type TypeOfNode<DataTypeUniqueId extends string = string> = {
1854
1846
  inputs: (TypeOfInput<DataTypeUniqueId> | TypeOfInputPanel<DataTypeUniqueId>)[];
1855
1847
  /** Array of outputs */
1856
1848
  outputs: TypeOfInput<DataTypeUniqueId>[];
1849
+ subtree?: {};
1857
1850
  };
1858
1851
 
1859
1852
  /**
@@ -1973,7 +1966,6 @@ export declare type UseDragReturn = {
1973
1966
  * import {
1974
1967
  * useFullGraph,
1975
1968
  * makeStateWithAutoInfer,
1976
- * makeNodeIdToNodeTypeWithAutoInfer,
1977
1969
  * makeTypeOfNodeWithAutoInfer,
1978
1970
  * makeDataTypeWithAutoInfer
1979
1971
  * } from 'react-blender-nodes';
@@ -2006,16 +1998,10 @@ export declare type UseDragReturn = {
2006
1998
  * }),
2007
1999
  * };
2008
2000
  *
2009
- * // Define node ID to type mapping with auto-infer
2010
- * const nodeIdToNodeType = makeNodeIdToNodeTypeWithAutoInfer({
2011
- * 'node-1': 'inputNode',
2012
- * });
2013
- *
2014
2001
  * // Create state with auto-infer for complete type safety
2015
2002
  * const initialState = makeStateWithAutoInfer({
2016
2003
  * dataTypes,
2017
2004
  * typeOfNodes,
2018
- * nodeIdToNodeType,
2019
2005
  * nodes: [],
2020
2006
  * edges: [],
2021
2007
  * });
@@ -2034,4 +2020,17 @@ export declare function useFullGraph<DataTypeUniqueId extends string = string, N
2034
2020
  dispatch: ActionDispatch<[action: Action<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>]>;
2035
2021
  };
2036
2022
 
2023
+ /**
2024
+ * Checks if adding an edge will create a cycle in the graph
2025
+ *
2026
+ * @template DataTypeUniqueId - Unique identifier type for data types
2027
+ * @template NodeTypeUniqueId - Unique identifier type for node types
2028
+ * @template UnderlyingType - Supported underlying data types
2029
+ * @template ComplexSchemaType - Zod schema type for complex data types
2030
+ * @param state - The current graph state
2031
+ * @param newEdge - The edge to check
2032
+ * @returns Whether the edge will create a cycle
2033
+ */
2034
+ export declare function willAddingEdgeCreateCycle<DataTypeUniqueId extends string = string, NodeTypeUniqueId extends string = string, UnderlyingType extends SupportedUnderlyingTypes = SupportedUnderlyingTypes, ComplexSchemaType extends UnderlyingType extends 'complex' ? z.ZodType : never = never>(state: State<DataTypeUniqueId, NodeTypeUniqueId, UnderlyingType, ComplexSchemaType>, sourceNodeId: string, targetNodeId: string): boolean;
2035
+
2037
2036
  export { }