@theclearsky/react-blender-nodes 0.0.3 → 0.0.5
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 +131 -44
- package/dist/index.d.ts +269 -27
- package/dist/react-blender-nodes.css +1 -1
- package/dist/react-blender-nodes.es.js +6991 -4341
- package/dist/react-blender-nodes.es.js.map +1 -1
- package/dist/react-blender-nodes.umd.js +20 -20
- package/dist/react-blender-nodes.umd.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -5,53 +5,28 @@ a flexible and customizable node-based graph editor for web applications.
|
|
|
5
5
|
|
|
6
6
|

|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Quick Links
|
|
9
|
+
|
|
10
|
+
- [](https://theclearsky.github.io/react-blender-nodes/?path=/story/components-organisms-fullgraph--playground) -
|
|
11
|
+
Interactive examples and component playground
|
|
12
|
+
- [](https://www.npmjs.com/package/@theclearsky/react-blender-nodes) -
|
|
13
|
+
Install and use in your project
|
|
14
|
+
- [](https://github.com/TheClearSky/react-blender-nodes/issues) -
|
|
15
|
+
Report bugs and issues
|
|
16
|
+
- [](https://github.com/TheClearSky/react-blender-nodes/discussions) -
|
|
17
|
+
Request features and discuss ideas
|
|
18
|
+
|
|
19
|
+
## Overview
|
|
9
20
|
|
|
10
21
|
React Blender Nodes recreates the iconic Blender node editor experience on the
|
|
11
22
|
web. Built with modern React patterns and TypeScript, it offers a complete
|
|
12
23
|
solution for creating interactive node-based interfaces with support for custom
|
|
13
|
-
nodes, connections, and real-time manipulation.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
### 🎨 Blender-Inspired Interface
|
|
18
|
-
|
|
19
|
-

|
|
20
|
-
|
|
21
|
-
- Authentic dark theme matching Blender's node editor
|
|
22
|
-
- Familiar interactions and visual design
|
|
23
|
-
- Smooth animations and transitions
|
|
24
|
-
|
|
25
|
-
### 🔧 Customizable Nodes
|
|
26
|
-
|
|
27
|
-

|
|
28
|
-
|
|
29
|
-
- Dynamic inputs and outputs with custom shapes
|
|
30
|
-
- Collapsible input panels for complex configurations
|
|
31
|
-
- Interactive input components (text, number sliders)
|
|
32
|
-
- Custom handle shapes (circle, square, diamond, star, etc.)
|
|
33
|
-
|
|
34
|
-
### 🎮 Interactive Graph Editor
|
|
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.
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- Pan, zoom, and select nodes with intuitive controls
|
|
39
|
-
- Drag and drop node connections
|
|
40
|
-
- Context menu for adding new nodes
|
|
41
|
-
- Real-time node manipulation
|
|
42
|
-
|
|
43
|
-
### 🎯 Advanced Features
|
|
44
|
-
|
|
45
|
-

|
|
46
|
-
|
|
47
|
-
- **Handle Shapes**: 13+ custom handle shapes including geometric and artistic
|
|
48
|
-
designs
|
|
49
|
-
- **Input Components**: Built-in text and number inputs with validation
|
|
50
|
-
- **Panel System**: Collapsible panels for organizing complex node inputs
|
|
51
|
-
- **State Management**: Integrated reducer for managing graph state
|
|
52
|
-
- **TypeScript Support**: Full type safety with comprehensive definitions
|
|
53
|
-
|
|
54
|
-
## 🚀 Quick Start
|
|
29
|
+
## Quick Start
|
|
55
30
|
|
|
56
31
|
### Installation
|
|
57
32
|
|
|
@@ -122,7 +97,7 @@ function MyNodeEditor() {
|
|
|
122
97
|
}
|
|
123
98
|
```
|
|
124
99
|
|
|
125
|
-
###
|
|
100
|
+
### Type Safety with Auto-Infer Helpers
|
|
126
101
|
|
|
127
102
|
The auto-infer helper functions are **essential** for type safety in React
|
|
128
103
|
Blender Nodes. They ensure TypeScript can properly validate type references
|
|
@@ -164,7 +139,119 @@ const dataTypes = {
|
|
|
164
139
|
};
|
|
165
140
|
```
|
|
166
141
|
|
|
167
|
-
##
|
|
142
|
+
## Features
|
|
143
|
+
|
|
144
|
+
### 🎨 Blender-Inspired Interface
|
|
145
|
+
|
|
146
|
+

|
|
147
|
+
|
|
148
|
+
- Authentic dark theme matching Blender's node editor
|
|
149
|
+
- Familiar interactions and visual design
|
|
150
|
+
- Smooth animations and transitions
|
|
151
|
+
|
|
152
|
+
### 🔧 Customizable Nodes
|
|
153
|
+
|
|
154
|
+

|
|
155
|
+
|
|
156
|
+
- Dynamic inputs and outputs with custom shapes
|
|
157
|
+
- Collapsible input panels for complex configurations
|
|
158
|
+
- Interactive input components (text, number sliders)
|
|
159
|
+
- Custom handle shapes (circle, square, diamond, star, etc.)
|
|
160
|
+
|
|
161
|
+
### 🎮 Interactive Graph Editor
|
|
162
|
+
|
|
163
|
+

|
|
164
|
+
|
|
165
|
+
- Pan, zoom, and select nodes with intuitive controls
|
|
166
|
+
- Drag and drop node connections
|
|
167
|
+
- Context menu for adding new nodes
|
|
168
|
+
- Real-time node manipulation
|
|
169
|
+
|
|
170
|
+
### 🧠 Smart Type System & Validation + Advanced Features
|
|
171
|
+
|
|
172
|
+

|
|
173
|
+
|
|
174
|
+
- **Intelligent Type Inference**: Automatically infer node types from
|
|
175
|
+
connections
|
|
176
|
+
- Dynamic type resolution as you build your graph
|
|
177
|
+
- Real-time type updates when connections change
|
|
178
|
+
- Support for `inferFromConnection` data types
|
|
179
|
+
- **Advanced Type Validation**: Comprehensive type checking system
|
|
180
|
+
- **Complex Type Checking**: Zod schema validation for complex data structures
|
|
181
|
+
- **Type Conversion Control**: Fine-grained control over allowed type
|
|
182
|
+
conversions
|
|
183
|
+
- **Cycle Detection**: Prevent infinite loops in your node graphs
|
|
184
|
+
- **Multiple Data Types**: Support for diverse data structures
|
|
185
|
+
- Basic types: `string`, `number`
|
|
186
|
+
- Complex types: Custom objects with Zod schemas
|
|
187
|
+
- Special types: `inferFromConnection`, `noEquivalent`
|
|
188
|
+
- **Runtime Safety**: Catch type errors before they break your application
|
|
189
|
+
- Connection validation with detailed error messages
|
|
190
|
+
- Automatic type propagation across connected nodes
|
|
191
|
+
- Schema compatibility checking for complex types
|
|
192
|
+
- **State Management**: Integrated reducer for managing graph state
|
|
193
|
+
- **TypeScript Support**: Full type safety with comprehensive definitions
|
|
194
|
+
|
|
195
|
+
## Usage Examples
|
|
196
|
+
|
|
197
|
+
### Smart Type System with Validation
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
import { z } from 'zod';
|
|
201
|
+
|
|
202
|
+
// Define complex data types with Zod schemas
|
|
203
|
+
const userSchema = z.object({
|
|
204
|
+
id: z.string(),
|
|
205
|
+
name: z.string(),
|
|
206
|
+
email: z.string().email(),
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
const dataTypes = {
|
|
210
|
+
stringType: makeDataTypeWithAutoInfer({
|
|
211
|
+
name: 'String',
|
|
212
|
+
underlyingType: 'string',
|
|
213
|
+
color: '#4A90E2',
|
|
214
|
+
}),
|
|
215
|
+
userType: makeDataTypeWithAutoInfer({
|
|
216
|
+
name: 'User',
|
|
217
|
+
underlyingType: 'complex',
|
|
218
|
+
complexSchema: userSchema,
|
|
219
|
+
color: '#7ED321',
|
|
220
|
+
}),
|
|
221
|
+
inferredType: makeDataTypeWithAutoInfer({
|
|
222
|
+
name: 'Inferred',
|
|
223
|
+
underlyingType: 'inferFromConnection',
|
|
224
|
+
color: '#FF6B6B',
|
|
225
|
+
}),
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// Enable advanced validation features
|
|
229
|
+
const initialState = makeStateWithAutoInfer({
|
|
230
|
+
dataTypes,
|
|
231
|
+
typeOfNodes: {
|
|
232
|
+
userInput: makeTypeOfNodeWithAutoInfer({
|
|
233
|
+
name: 'User Input',
|
|
234
|
+
inputs: [{ name: 'User Data', dataType: 'userType' }],
|
|
235
|
+
outputs: [{ name: 'Output', dataType: 'inferredType' }],
|
|
236
|
+
}),
|
|
237
|
+
stringProcessor: makeTypeOfNodeWithAutoInfer({
|
|
238
|
+
name: 'String Processor',
|
|
239
|
+
inputs: [{ name: 'Input', dataType: 'inferredType' }],
|
|
240
|
+
outputs: [{ name: 'Result', dataType: 'stringType' }],
|
|
241
|
+
}),
|
|
242
|
+
},
|
|
243
|
+
nodeIdToNodeType: makeNodeIdToNodeTypeWithAutoInfer({}),
|
|
244
|
+
nodes: [],
|
|
245
|
+
edges: [],
|
|
246
|
+
// Enable smart validation features
|
|
247
|
+
enableTypeInference: true,
|
|
248
|
+
enableComplexTypeChecking: true,
|
|
249
|
+
enableCycleChecking: true,
|
|
250
|
+
allowedConversionsBetweenDataTypes: {
|
|
251
|
+
userType: { stringType: true }, // Allow user to string conversion
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
```
|
|
168
255
|
|
|
169
256
|
### Custom Node with Panels
|
|
170
257
|
|