@theclearsky/react-blender-nodes 0.0.5 → 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
|
@@ -41,7 +41,6 @@ import {
|
|
|
41
41
|
FullGraph,
|
|
42
42
|
useFullGraph,
|
|
43
43
|
makeStateWithAutoInfer,
|
|
44
|
-
makeNodeIdToNodeTypeWithAutoInfer,
|
|
45
44
|
makeTypeOfNodeWithAutoInfer,
|
|
46
45
|
makeDataTypeWithAutoInfer,
|
|
47
46
|
} from 'react-blender-nodes';
|
|
@@ -75,14 +74,10 @@ function MyNodeEditor() {
|
|
|
75
74
|
}),
|
|
76
75
|
};
|
|
77
76
|
|
|
78
|
-
// Define node ID to type mapping with auto-infer
|
|
79
|
-
const nodeIdToNodeType = makeNodeIdToNodeTypeWithAutoInfer({});
|
|
80
|
-
|
|
81
77
|
// Create state with auto-infer for complete type safety
|
|
82
78
|
const initialState = makeStateWithAutoInfer({
|
|
83
79
|
dataTypes,
|
|
84
80
|
typeOfNodes,
|
|
85
|
-
nodeIdToNodeType,
|
|
86
81
|
nodes: [],
|
|
87
82
|
edges: [],
|
|
88
83
|
});
|
|
@@ -106,7 +101,6 @@ throughout your graph system:
|
|
|
106
101
|
- **`makeDataTypeWithAutoInfer`**: Validates data type definitions
|
|
107
102
|
- **`makeTypeOfNodeWithAutoInfer`**: Validates node type definitions and
|
|
108
103
|
dataType references
|
|
109
|
-
- **`makeNodeIdToNodeTypeWithAutoInfer`**: Validates node ID to type mappings
|
|
110
104
|
- **`makeStateWithAutoInfer`**: Provides complete type inference for the entire
|
|
111
105
|
state
|
|
112
106
|
|
|
@@ -169,7 +163,7 @@ const dataTypes = {
|
|
|
169
163
|
|
|
170
164
|
### 🧠 Smart Type System & Validation + Advanced Features
|
|
171
165
|
|
|
172
|
-
|
|
166
|
+
https://github.com/user-attachments/assets/72d9384a-e9ca-4223-906a-dc422fb66f49
|
|
173
167
|
|
|
174
168
|
- **Intelligent Type Inference**: Automatically infer node types from
|
|
175
169
|
connections
|
|
@@ -240,7 +234,6 @@ const initialState = makeStateWithAutoInfer({
|
|
|
240
234
|
outputs: [{ name: 'Result', dataType: 'stringType' }],
|
|
241
235
|
}),
|
|
242
236
|
},
|
|
243
|
-
nodeIdToNodeType: makeNodeIdToNodeTypeWithAutoInfer({}),
|
|
244
237
|
nodes: [],
|
|
245
238
|
edges: [],
|
|
246
239
|
// Enable smart validation features
|
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:
|
|
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:
|
|
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
|
* });
|
|
@@ -1305,11 +1300,6 @@ export declare function isSupportedUnderlyingType(type: string): type is Support
|
|
|
1305
1300
|
*/
|
|
1306
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;
|
|
1307
1302
|
|
|
1308
|
-
/**
|
|
1309
|
-
* Type guard to check if a string is a valid NodeTypeUniqueId
|
|
1310
|
-
*/
|
|
1311
|
-
export declare function isValidNodeTypeUniqueId<NodeTypeUniqueId extends string>(id: string, nodeIdToNodeType: Record<string, NodeTypeUniqueId>): id is NodeTypeUniqueId;
|
|
1312
|
-
|
|
1313
1303
|
/**
|
|
1314
1304
|
* Main reducer function for managing graph state
|
|
1315
1305
|
*
|
|
@@ -1330,7 +1320,6 @@ export declare function isValidNodeTypeUniqueId<NodeTypeUniqueId extends string>
|
|
|
1330
1320
|
* import {
|
|
1331
1321
|
* mainReducer,
|
|
1332
1322
|
* makeStateWithAutoInfer,
|
|
1333
|
-
* makeNodeIdToNodeTypeWithAutoInfer,
|
|
1334
1323
|
* makeTypeOfNodeWithAutoInfer,
|
|
1335
1324
|
* makeDataTypeWithAutoInfer
|
|
1336
1325
|
* } from 'react-blender-nodes';
|
|
@@ -1353,14 +1342,9 @@ export declare function isValidNodeTypeUniqueId<NodeTypeUniqueId extends string>
|
|
|
1353
1342
|
* }),
|
|
1354
1343
|
* };
|
|
1355
1344
|
*
|
|
1356
|
-
* const nodeIdToNodeType = makeNodeIdToNodeTypeWithAutoInfer({
|
|
1357
|
-
* 'node-1': 'inputNode',
|
|
1358
|
-
* });
|
|
1359
|
-
*
|
|
1360
1345
|
* const state = makeStateWithAutoInfer({
|
|
1361
1346
|
* dataTypes,
|
|
1362
1347
|
* typeOfNodes,
|
|
1363
|
-
* nodeIdToNodeType,
|
|
1364
1348
|
* nodes: [],
|
|
1365
1349
|
* edges: [],
|
|
1366
1350
|
* });
|
|
@@ -1448,34 +1432,6 @@ export declare function makeAllowedConversionsBetweenDataTypesWithAutoInfer<Data
|
|
|
1448
1432
|
*/
|
|
1449
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>;
|
|
1450
1434
|
|
|
1451
|
-
/**
|
|
1452
|
-
* Helper function to create a node ID to node type mapping with automatic type inference
|
|
1453
|
-
*
|
|
1454
|
-
* This function is essential for type safety when mapping node IDs to their types.
|
|
1455
|
-
* It ensures that TypeScript can validate that all node type references are valid,
|
|
1456
|
-
* preventing runtime errors when dispatching actions and providing better IDE support.
|
|
1457
|
-
*
|
|
1458
|
-
* @template NodeTypeUniqueId - Unique identifier type for node types
|
|
1459
|
-
* @param input - The node ID to node type mapping
|
|
1460
|
-
* @returns The mapping with proper typing
|
|
1461
|
-
*
|
|
1462
|
-
* @example
|
|
1463
|
-
* ```tsx
|
|
1464
|
-
* // ✅ Type-safe - TypeScript will validate node type references
|
|
1465
|
-
* const nodeIdToNodeType = makeNodeIdToNodeTypeWithAutoInfer({
|
|
1466
|
-
* 'node-1': 'inputNode',
|
|
1467
|
-
* 'node-2': 'outputNode',
|
|
1468
|
-
* });
|
|
1469
|
-
*
|
|
1470
|
-
* // ❌ Without auto-infer - TypeScript can't validate node type references
|
|
1471
|
-
* const nodeIdToNodeType = {
|
|
1472
|
-
* 'node-1': 'inputNode',
|
|
1473
|
-
* 'node-2': 'outputNode',
|
|
1474
|
-
* };
|
|
1475
|
-
* ```
|
|
1476
|
-
*/
|
|
1477
|
-
export declare function makeNodeIdToNodeTypeWithAutoInfer<NodeTypeUniqueId extends string = string>(input: NodeIdToNodeType<NodeTypeUniqueId>): NodeIdToNodeType<NodeTypeUniqueId>;
|
|
1478
|
-
|
|
1479
1435
|
/**
|
|
1480
1436
|
* Helper function to create a state with automatic type inference
|
|
1481
1437
|
*
|
|
@@ -1508,7 +1464,6 @@ export declare function makeNodeIdToNodeTypeWithAutoInfer<NodeTypeUniqueId exten
|
|
|
1508
1464
|
* outputs: []
|
|
1509
1465
|
* })
|
|
1510
1466
|
* },
|
|
1511
|
-
* nodeIdToNodeType: makeNodeIdToNodeTypeWithAutoInfer({}),
|
|
1512
1467
|
* nodes: [],
|
|
1513
1468
|
* edges: [],
|
|
1514
1469
|
* });
|
|
@@ -1518,7 +1473,6 @@ export declare function makeNodeIdToNodeTypeWithAutoInfer<NodeTypeUniqueId exten
|
|
|
1518
1473
|
* dataTypes: { stringType: { name: 'String', underlyingType: 'string', color: '#4A90E2' } },
|
|
1519
1474
|
* typeOfNodes: { inputNode: { name: 'Input', inputs: [], outputs: [] } },
|
|
1520
1475
|
* nodes: [],
|
|
1521
|
-
* nodeIdToNodeType: {},
|
|
1522
1476
|
* edges: [],
|
|
1523
1477
|
* };
|
|
1524
1478
|
* ```
|
|
@@ -1560,14 +1514,7 @@ export declare function makeTypeOfNodeWithAutoInfer<DataTypeUniqueId extends str
|
|
|
1560
1514
|
/**
|
|
1561
1515
|
* Array of node changes for ReactFlow
|
|
1562
1516
|
*/
|
|
1563
|
-
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>>[];
|
|
1564
|
-
|
|
1565
|
-
/**
|
|
1566
|
-
* Mapping from node IDs to their node types
|
|
1567
|
-
*
|
|
1568
|
-
* @template NodeTypeUniqueId - Unique identifier type for node types
|
|
1569
|
-
*/
|
|
1570
|
-
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>>[];
|
|
1571
1518
|
|
|
1572
1519
|
declare type NodeOptionalKeys = 'draggable' | 'zIndex' | 'selectable' | 'deletable' | 'dragging' | 'selected' | 'isConnectable' | 'positionAbsoluteX' | 'positionAbsoluteY';
|
|
1573
1520
|
|
|
@@ -1639,7 +1586,7 @@ export declare type NodeResizerWithMoreControlsProps = NodeResizerProps & {
|
|
|
1639
1586
|
/**
|
|
1640
1587
|
* Array of configurable nodes in the graph
|
|
1641
1588
|
*/
|
|
1642
|
-
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>[];
|
|
1643
1590
|
|
|
1644
1591
|
declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
1645
1592
|
|
|
@@ -1687,7 +1634,7 @@ export declare type ReactFlowAwareInputProps = {
|
|
|
1687
1634
|
* @returns Object containing updated nodes, edges, and validation result
|
|
1688
1635
|
*/
|
|
1689
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>): {
|
|
1690
|
-
updatedNodes: Nodes<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>;
|
|
1637
|
+
updatedNodes: Nodes<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>;
|
|
1691
1638
|
updatedEdges: Edges;
|
|
1692
1639
|
validation: ConnectionValidationResult;
|
|
1693
1640
|
};
|
|
@@ -1785,9 +1732,7 @@ export declare type State<DataTypeUniqueId extends string = string, NodeTypeUniq
|
|
|
1785
1732
|
/** Map of node type definitions */
|
|
1786
1733
|
typeOfNodes: Record<NodeTypeUniqueId, TypeOfNode<DataTypeUniqueId>>;
|
|
1787
1734
|
/** Array of nodes in the graph */
|
|
1788
|
-
nodes: Nodes<UnderlyingType, ComplexSchemaType, DataTypeUniqueId>;
|
|
1789
|
-
/** Mapping from node IDs to their types */
|
|
1790
|
-
nodeIdToNodeType: NodeIdToNodeType<NodeTypeUniqueId>;
|
|
1735
|
+
nodes: Nodes<UnderlyingType, NodeTypeUniqueId, ComplexSchemaType, DataTypeUniqueId>;
|
|
1791
1736
|
/** Array of edges in the graph */
|
|
1792
1737
|
edges: Edges;
|
|
1793
1738
|
/**
|
|
@@ -1901,6 +1846,7 @@ export declare type TypeOfNode<DataTypeUniqueId extends string = string> = {
|
|
|
1901
1846
|
inputs: (TypeOfInput<DataTypeUniqueId> | TypeOfInputPanel<DataTypeUniqueId>)[];
|
|
1902
1847
|
/** Array of outputs */
|
|
1903
1848
|
outputs: TypeOfInput<DataTypeUniqueId>[];
|
|
1849
|
+
subtree?: {};
|
|
1904
1850
|
};
|
|
1905
1851
|
|
|
1906
1852
|
/**
|
|
@@ -2020,7 +1966,6 @@ export declare type UseDragReturn = {
|
|
|
2020
1966
|
* import {
|
|
2021
1967
|
* useFullGraph,
|
|
2022
1968
|
* makeStateWithAutoInfer,
|
|
2023
|
-
* makeNodeIdToNodeTypeWithAutoInfer,
|
|
2024
1969
|
* makeTypeOfNodeWithAutoInfer,
|
|
2025
1970
|
* makeDataTypeWithAutoInfer
|
|
2026
1971
|
* } from 'react-blender-nodes';
|
|
@@ -2053,16 +1998,10 @@ export declare type UseDragReturn = {
|
|
|
2053
1998
|
* }),
|
|
2054
1999
|
* };
|
|
2055
2000
|
*
|
|
2056
|
-
* // Define node ID to type mapping with auto-infer
|
|
2057
|
-
* const nodeIdToNodeType = makeNodeIdToNodeTypeWithAutoInfer({
|
|
2058
|
-
* 'node-1': 'inputNode',
|
|
2059
|
-
* });
|
|
2060
|
-
*
|
|
2061
2001
|
* // Create state with auto-infer for complete type safety
|
|
2062
2002
|
* const initialState = makeStateWithAutoInfer({
|
|
2063
2003
|
* dataTypes,
|
|
2064
2004
|
* typeOfNodes,
|
|
2065
|
-
* nodeIdToNodeType,
|
|
2066
2005
|
* nodes: [],
|
|
2067
2006
|
* edges: [],
|
|
2068
2007
|
* });
|
|
@@ -3227,16 +3227,10 @@ function Zb(e, t) {
|
|
|
3227
3227
|
function Kb(e) {
|
|
3228
3228
|
return e;
|
|
3229
3229
|
}
|
|
3230
|
-
function Qb(e
|
|
3231
|
-
return e in t;
|
|
3232
|
-
}
|
|
3233
|
-
function Jb(e) {
|
|
3230
|
+
function Qb(e) {
|
|
3234
3231
|
return e;
|
|
3235
3232
|
}
|
|
3236
|
-
function
|
|
3237
|
-
return e;
|
|
3238
|
-
}
|
|
3239
|
-
function tv(e) {
|
|
3233
|
+
function Jb(e) {
|
|
3240
3234
|
return e;
|
|
3241
3235
|
}
|
|
3242
3236
|
var Qa = Symbol.for("immer-nothing"), is = Symbol.for("immer-draftable"), ke = Symbol.for("immer-state"), Ef = process.env.NODE_ENV !== "production" ? [
|
|
@@ -10202,10 +10196,9 @@ function wa(e, t, n, o, r) {
|
|
|
10202
10196
|
name: i.name,
|
|
10203
10197
|
headerColor: i.headerColor,
|
|
10204
10198
|
inputs: s,
|
|
10205
|
-
outputs: a
|
|
10199
|
+
outputs: a,
|
|
10200
|
+
nodeTypeUniqueId: t
|
|
10206
10201
|
}
|
|
10207
|
-
//The types typescript complains about are internally set by ReactFlow, we don't need to set them here
|
|
10208
|
-
//This is perfectly fine, refer to: https://reactflow.dev/examples/nodes/add-node-on-edge-drop
|
|
10209
10202
|
};
|
|
10210
10203
|
}
|
|
10211
10204
|
function jx(e, t, n, o) {
|
|
@@ -10276,7 +10269,7 @@ function Vx(e, t, n, o, r, i) {
|
|
|
10276
10269
|
//Infer as connected node's type + connected handle's INFERRED type
|
|
10277
10270
|
{
|
|
10278
10271
|
dataTypeToInferAs: u.dataTypeUniqueId,
|
|
10279
|
-
connectedNodeType: e.
|
|
10272
|
+
connectedNodeType: e.nodes[t].data.nodeTypeUniqueId,
|
|
10280
10273
|
resetInferredType: !1
|
|
10281
10274
|
},
|
|
10282
10275
|
e.dataTypes,
|
|
@@ -10298,7 +10291,7 @@ function Vx(e, t, n, o, r, i) {
|
|
|
10298
10291
|
//Infer as connected node's type + connected handle's INFERRED type
|
|
10299
10292
|
{
|
|
10300
10293
|
dataTypeToInferAs: h.dataTypeUniqueId,
|
|
10301
|
-
connectedNodeType: e.
|
|
10294
|
+
connectedNodeType: e.nodes[n].data.nodeTypeUniqueId,
|
|
10302
10295
|
resetInferredType: !1
|
|
10303
10296
|
},
|
|
10304
10297
|
e.dataTypes,
|
|
@@ -10326,7 +10319,7 @@ function Vx(e, t, n, o, r, i) {
|
|
|
10326
10319
|
//Infer as connected node's type + connected handle's NON-INFERRED type
|
|
10327
10320
|
{
|
|
10328
10321
|
dataTypeToInferAs: l.dataTypeUniqueId,
|
|
10329
|
-
connectedNodeType: e.
|
|
10322
|
+
connectedNodeType: e.nodes[n].data.nodeTypeUniqueId,
|
|
10330
10323
|
resetInferredType: !1
|
|
10331
10324
|
},
|
|
10332
10325
|
e.dataTypes,
|
|
@@ -10353,7 +10346,7 @@ function Vx(e, t, n, o, r, i) {
|
|
|
10353
10346
|
//Infer as connected node's type + connected handle's NON-INFERRED type
|
|
10354
10347
|
{
|
|
10355
10348
|
dataTypeToInferAs: c.dataTypeUniqueId,
|
|
10356
|
-
connectedNodeType: e.
|
|
10349
|
+
connectedNodeType: e.nodes[t].data.nodeTypeUniqueId,
|
|
10357
10350
|
resetInferredType: !1
|
|
10358
10351
|
},
|
|
10359
10352
|
e.dataTypes,
|
|
@@ -10484,7 +10477,7 @@ function Wx(e, t, n, o, r, i) {
|
|
|
10484
10477
|
//RESET INFERRED TYPE
|
|
10485
10478
|
{
|
|
10486
10479
|
dataTypeToInferAs: u.dataTypeUniqueId,
|
|
10487
|
-
connectedNodeType: e.
|
|
10480
|
+
connectedNodeType: e.nodes[t].data.nodeTypeUniqueId,
|
|
10488
10481
|
resetInferredType: !0
|
|
10489
10482
|
},
|
|
10490
10483
|
e.dataTypes,
|
|
@@ -10519,7 +10512,7 @@ function Wx(e, t, n, o, r, i) {
|
|
|
10519
10512
|
//RESET INFERRED TYPE
|
|
10520
10513
|
{
|
|
10521
10514
|
dataTypeToInferAs: h.dataTypeUniqueId,
|
|
10522
|
-
connectedNodeType: e.
|
|
10515
|
+
connectedNodeType: e.nodes[n].data.nodeTypeUniqueId,
|
|
10523
10516
|
resetInferredType: !0
|
|
10524
10517
|
},
|
|
10525
10518
|
e.dataTypes,
|
|
@@ -10621,7 +10614,7 @@ function Xx(e, t, n, o, r) {
|
|
|
10621
10614
|
);
|
|
10622
10615
|
p = g;
|
|
10623
10616
|
}
|
|
10624
|
-
return
|
|
10617
|
+
return {
|
|
10625
10618
|
updatedNodes: f,
|
|
10626
10619
|
updatedEdges: lo(i, r.edges),
|
|
10627
10620
|
validation: p
|
|
@@ -10749,7 +10742,7 @@ function qx(e, t) {
|
|
|
10749
10742
|
i,
|
|
10750
10743
|
s
|
|
10751
10744
|
);
|
|
10752
|
-
o.nodes.push(a)
|
|
10745
|
+
o.nodes.push(a);
|
|
10753
10746
|
break;
|
|
10754
10747
|
case Ge.ADD_NODE_AND_SELECT:
|
|
10755
10748
|
const c = t.payload.type, l = Lt(ba), u = t.payload.position, h = wa(
|
|
@@ -10762,7 +10755,7 @@ function qx(e, t) {
|
|
|
10762
10755
|
o.nodes = o.nodes.map((w) => ({
|
|
10763
10756
|
...w,
|
|
10764
10757
|
selected: !1
|
|
10765
|
-
})), o.nodes.push({ ...h, selected: !0 })
|
|
10758
|
+
})), o.nodes.push({ ...h, selected: !0 });
|
|
10766
10759
|
break;
|
|
10767
10760
|
case Ge.UPDATE_NODE_BY_REACT_FLOW:
|
|
10768
10761
|
const d = t.payload.changes;
|
|
@@ -14037,7 +14030,7 @@ const Wb = {
|
|
|
14037
14030
|
}, Yb = {
|
|
14038
14031
|
configurableEdge: Wl
|
|
14039
14032
|
};
|
|
14040
|
-
function
|
|
14033
|
+
function ev(e) {
|
|
14041
14034
|
const [t, n] = Ed(
|
|
14042
14035
|
qx,
|
|
14043
14036
|
e
|
|
@@ -14165,7 +14158,7 @@ function Xb({
|
|
|
14165
14158
|
}
|
|
14166
14159
|
);
|
|
14167
14160
|
}
|
|
14168
|
-
function
|
|
14161
|
+
function tv({
|
|
14169
14162
|
state: e,
|
|
14170
14163
|
dispatch: t
|
|
14171
14164
|
}) {
|
|
@@ -14179,7 +14172,7 @@ export {
|
|
|
14179
14172
|
Li as ContextAwareHandle,
|
|
14180
14173
|
Bb as ContextAwareInput,
|
|
14181
14174
|
jb as ContextMenu,
|
|
14182
|
-
|
|
14175
|
+
tv as FullGraph,
|
|
14183
14176
|
Ko as Input,
|
|
14184
14177
|
ow as NodeResizerWithMoreControls,
|
|
14185
14178
|
Fb as ReactFlowAwareInput,
|
|
@@ -14199,19 +14192,17 @@ export {
|
|
|
14199
14192
|
os as isNumberInRange,
|
|
14200
14193
|
Gb as isSupportedUnderlyingType,
|
|
14201
14194
|
Zb as isValidDataTypeId,
|
|
14202
|
-
Qb as isValidNodeTypeUniqueId,
|
|
14203
14195
|
qx as mainReducer,
|
|
14204
|
-
|
|
14196
|
+
Qb as makeAllowedConversionsBetweenDataTypesWithAutoInfer,
|
|
14205
14197
|
qb as makeDataTypeWithAutoInfer,
|
|
14206
|
-
Jb as
|
|
14207
|
-
tv as makeStateWithAutoInfer,
|
|
14198
|
+
Jb as makeStateWithAutoInfer,
|
|
14208
14199
|
Kb as makeTypeOfNodeWithAutoInfer,
|
|
14209
14200
|
Ux as removeEdgeWithTypeChecking,
|
|
14210
14201
|
rs as sanitizeNumberToShowAsText,
|
|
14211
14202
|
_f as supportedUnderlyingTypesMap,
|
|
14212
14203
|
nw as useClickedOutside,
|
|
14213
14204
|
rw as useDrag,
|
|
14214
|
-
|
|
14205
|
+
ev as useFullGraph,
|
|
14215
14206
|
Gx as willAddingEdgeCreateCycle
|
|
14216
14207
|
};
|
|
14217
14208
|
//# sourceMappingURL=react-blender-nodes.es.js.map
|