@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 CHANGED
@@ -5,53 +5,28 @@ a flexible and customizable node-based graph editor for web applications.
5
5
 
6
6
  ![React Blender Nodes Banner](./docs/screenshots/banner.png)
7
7
 
8
- ## 🎯 Overview
8
+ ## Quick Links
9
+
10
+ - [![Storybook](https://img.shields.io/badge/Storybook-FF4785?style=for-the-badge&logo=storybook&logoColor=white)](https://theclearsky.github.io/react-blender-nodes/?path=/story/components-organisms-fullgraph--playground) -
11
+ Interactive examples and component playground
12
+ - [![NPM](https://img.shields.io/badge/NPM-%23CB3837.svg?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/@theclearsky/react-blender-nodes) -
13
+ Install and use in your project
14
+ - [![GitHub Issues](https://img.shields.io/badge/GitHub-Issues-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/TheClearSky/react-blender-nodes/issues) -
15
+ Report bugs and issues
16
+ - [![GitHub Discussions](https://img.shields.io/badge/GitHub-Discussions-181717?style=for-the-badge&logo=github&logoColor=white)](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
- ## Features
16
-
17
- ### 🎨 Blender-Inspired Interface
18
-
19
- ![Blender Interface](./docs/screenshots/blender-interface.png)
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
- ![Customizable Nodes](./docs/screenshots/customizable-nodes.png)
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
- ![Interactive Graph](./docs/screenshots/interactive-graph.png)
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
- ![Advanced Features](./docs/screenshots/advanced-features.png)
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
- ### 🔒 Type Safety with Auto-Infer Helpers
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
- ## 📖 Usage Examples
142
+ ## Features
143
+
144
+ ### 🎨 Blender-Inspired Interface
145
+
146
+ ![Blender Interface](./docs/screenshots/blender-interface.png)
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
+ ![Customizable Nodes](./docs/screenshots/customizable-nodes.png)
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
+ ![Interactive Graph](./docs/screenshots/interactive-graph.png)
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
+ ![Smart Type System And Advanced Features](./docs/screenshots/smart-type-system-and-advanced-features.mp4)
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