@theclearsky/react-blender-nodes 0.0.1
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/LICENSE +21 -0
- package/README.md +186 -0
- package/dist/index.d.ts +501 -0
- package/dist/react-blender-nodes.css +1 -0
- package/dist/react-blender-nodes.es.js +11527 -0
- package/dist/react-blender-nodes.es.js.map +1 -0
- package/dist/react-blender-nodes.umd.js +107 -0
- package/dist/react-blender-nodes.umd.js.map +1 -0
- package/package.json +93 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Deepak Prasad
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# React Blender Nodes
|
|
2
|
+
|
|
3
|
+
A React component library inspired by Blender's node editor interface, providing
|
|
4
|
+
a flexible and customizable node-based graph editor for web applications.
|
|
5
|
+
|
|
6
|
+
## 🎯 Overview
|
|
7
|
+
|
|
8
|
+
React Blender Nodes is a React library that recreates the iconic Blender node
|
|
9
|
+
editor experience on the web. Built with modern React patterns and TypeScript,
|
|
10
|
+
it offers a complete solution for creating interactive node-based interfaces
|
|
11
|
+
with support for custom nodes, connections, and real-time manipulation.
|
|
12
|
+
|
|
13
|
+
## ✨ Features
|
|
14
|
+
|
|
15
|
+
- **Blender-inspired UI**: Authentic node editor experience with dark theme and
|
|
16
|
+
familiar interactions
|
|
17
|
+
- **Fully Customizable Nodes**: Create nodes with custom inputs, outputs, and
|
|
18
|
+
styling
|
|
19
|
+
- **Interactive Graph Editor**: Pan, zoom, select, and manipulate nodes with
|
|
20
|
+
intuitive controls
|
|
21
|
+
- **TypeScript Support**: Full type safety with comprehensive type definitions
|
|
22
|
+
- **Storybook Integration**: Interactive component documentation and testing
|
|
23
|
+
- **Modular Architecture**: Atomic design pattern with reusable components
|
|
24
|
+
- **Modern React**: Built with React 19+ and modern hooks patterns
|
|
25
|
+
|
|
26
|
+
## 🚀 Quick Start
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install react-blender-nodes
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { FullGraph } from 'react-blender-nodes';
|
|
34
|
+
import 'react-blender-nodes/style.css';
|
|
35
|
+
|
|
36
|
+
function App() {
|
|
37
|
+
const nodes = [
|
|
38
|
+
{
|
|
39
|
+
id: '1',
|
|
40
|
+
type: 'configurableNode',
|
|
41
|
+
position: { x: 100, y: 100 },
|
|
42
|
+
data: {
|
|
43
|
+
name: 'Input Node',
|
|
44
|
+
outputs: [{ id: 'output-1', name: 'Value', type: 'number' }],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div style={{ height: '500px' }}>
|
|
51
|
+
<FullGraph nodes={nodes} edges={[]} />
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 📁 Project Structure
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
react-blender-nodes/
|
|
61
|
+
├── src/
|
|
62
|
+
│ ├── components/ # Component library organized by atomic design
|
|
63
|
+
│ │ ├── atoms/ # Basic building blocks (buttons, handles, etc.)
|
|
64
|
+
│ │ │ ├── Button/ # Reusable button component
|
|
65
|
+
│ │ │ ├── ConfigurableConnection/ # Node connection line component
|
|
66
|
+
│ │ │ ├── ConfigurableEdge/ # Edge/connection rendering component
|
|
67
|
+
│ │ │ └── NodeResizerWithMoreControls/ # Node resizing controls
|
|
68
|
+
│ │ ├── molecules/ # Composed components (input groups, controls)
|
|
69
|
+
│ │ │ └── SliderNumberInput/ # Combined slider and number input
|
|
70
|
+
│ │ └── organisms/ # Complex components (full nodes, graph)
|
|
71
|
+
│ │ ├── ConfigurableNode/ # Main node component with inputs/outputs
|
|
72
|
+
│ │ └── FullGraph/ # Complete graph editor with ReactFlow
|
|
73
|
+
│ ├── hooks/ # Custom React hooks
|
|
74
|
+
│ │ ├── useClickedOutside.ts # Click outside detection hook
|
|
75
|
+
│ │ └── index.ts # Hook exports
|
|
76
|
+
│ ├── utils/ # Utility functions and helpers
|
|
77
|
+
│ │ ├── nodeStateManagement/ # State management for node operations
|
|
78
|
+
│ │ │ ├── mainReducer.ts # Main state reducer
|
|
79
|
+
│ │ │ └── types.ts # State management types
|
|
80
|
+
│ │ ├── cnHelper.ts # Class name utility (tailwind-merge)
|
|
81
|
+
│ │ ├── geometry.ts # Geometric calculations
|
|
82
|
+
│ │ └── index.ts # Utility exports
|
|
83
|
+
│ ├── @types/ # TypeScript type definitions
|
|
84
|
+
│ │ └── globals.d.ts # Global type declarations
|
|
85
|
+
│ ├── index.ts # Main library entry point
|
|
86
|
+
│ └── index.css # Global styles and CSS variables
|
|
87
|
+
├── dist/ # Built library files (generated)
|
|
88
|
+
├── storybook-static/ # Built Storybook documentation (generated)
|
|
89
|
+
├── .storybook/ # Storybook configuration
|
|
90
|
+
├── .github/ # GitHub workflows and templates
|
|
91
|
+
├── node_modules/ # Dependencies (generated)
|
|
92
|
+
├── package.json # Project configuration and dependencies
|
|
93
|
+
├── vite.config.ts # Vite bundler configuration
|
|
94
|
+
├── tsconfig.json # TypeScript configuration
|
|
95
|
+
├── components.json # Shadcn/ui component configuration
|
|
96
|
+
├── eslint.config.js # ESLint linting rules
|
|
97
|
+
└── .prettierrc # Code formatting configuration
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 🧩 Component Architecture
|
|
101
|
+
|
|
102
|
+
### Atomic Design Pattern
|
|
103
|
+
|
|
104
|
+
This library follows the atomic design methodology:
|
|
105
|
+
|
|
106
|
+
- **Atoms**: Basic UI elements that cannot be broken down further (Button,
|
|
107
|
+
Handle, Edge)
|
|
108
|
+
- **Molecules**: Simple groups of atoms functioning together (SliderNumberInput)
|
|
109
|
+
- **Organisms**: Complex UI components composed of molecules and atoms
|
|
110
|
+
(ConfigurableNode, FullGraph)
|
|
111
|
+
|
|
112
|
+
### Key Components
|
|
113
|
+
|
|
114
|
+
- **FullGraph**: The main graph editor component with pan, zoom, and node
|
|
115
|
+
management
|
|
116
|
+
- **ConfigurableNode**: Customizable node component with dynamic inputs and
|
|
117
|
+
outputs
|
|
118
|
+
- **SliderNumberInput**: Combined slider and number input for precise value
|
|
119
|
+
control
|
|
120
|
+
- **NodeResizerWithMoreControls**: Enhanced node resizing with additional
|
|
121
|
+
controls
|
|
122
|
+
|
|
123
|
+
## 🛠️ Development
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Install dependencies
|
|
127
|
+
npm install
|
|
128
|
+
|
|
129
|
+
# Start development server
|
|
130
|
+
npm run dev
|
|
131
|
+
|
|
132
|
+
# Run Storybook
|
|
133
|
+
npm run storybook
|
|
134
|
+
|
|
135
|
+
# Build library
|
|
136
|
+
npm run build
|
|
137
|
+
|
|
138
|
+
# Run linting
|
|
139
|
+
npm run lint
|
|
140
|
+
|
|
141
|
+
# Format code
|
|
142
|
+
npm run pretty
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 📚 Documentation
|
|
146
|
+
|
|
147
|
+
Interactive component documentation is available via Storybook:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npm run storybook
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Visit `http://localhost:6006` to explore all components with live examples and
|
|
154
|
+
controls.
|
|
155
|
+
|
|
156
|
+
## 🎨 Styling
|
|
157
|
+
|
|
158
|
+
The library uses:
|
|
159
|
+
|
|
160
|
+
- **Tailwind CSS** for utility-first styling
|
|
161
|
+
- **React flow** for nodes base
|
|
162
|
+
|
|
163
|
+
## 🤝 Contributing
|
|
164
|
+
|
|
165
|
+
Contributions are welcome! Please read our contributing guidelines and ensure
|
|
166
|
+
all tests pass before submitting a PR.
|
|
167
|
+
|
|
168
|
+
## 📄 License
|
|
169
|
+
|
|
170
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
171
|
+
|
|
172
|
+
## 🙏 Acknowledgments
|
|
173
|
+
|
|
174
|
+
- **Blender Foundation**: For creating the amazing Blender software that
|
|
175
|
+
inspired this project
|
|
176
|
+
- **ReactFlow**: For providing the foundation for the graph editor functionality
|
|
177
|
+
- **Shadcn/ui**: For the component design system and utilities
|
|
178
|
+
|
|
179
|
+
> **Note**: This project is not affiliated with Blender Foundation. If you find
|
|
180
|
+
> Blender useful, consider
|
|
181
|
+
> [donating to support their work](https://fund.blender.org/).
|
|
182
|
+
|
|
183
|
+
## 🔗 Links
|
|
184
|
+
|
|
185
|
+
- [Blender Official Repository](https://projects.blender.org/blender/blender.git)
|
|
186
|
+
- [Support Blender Foundation](https://fund.blender.org/)
|