@samoramachel/netuniverse 1.0.0
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 +175 -0
- package/dist/GraphScene.d.ts +10 -0
- package/dist/GraphScene.d.ts.map +1 -0
- package/dist/components/GalaxyGraph.d.ts +10 -0
- package/dist/components/GalaxyGraph.d.ts.map +1 -0
- package/dist/components/OverlayUI.d.ts +9 -0
- package/dist/components/OverlayUI.d.ts.map +1 -0
- package/dist/components/StarField.d.ts +3 -0
- package/dist/components/StarField.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +8389 -0
- package/dist/index.umd.js +78 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/types.d.ts +44 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# NetUniverse Explorer
|
|
2
|
+
|
|
3
|
+
A beautiful 3D graph visualization library for React built with Three.js and React Three Fiber.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🌌 **3D Network Visualization**: Immersive particle-based graph rendering with 4000+ background nodes
|
|
10
|
+
- ⚡ **Physics Simulation**: Cosmos force-directed layout for main nodes
|
|
11
|
+
- 🎨 **Interactive Animations**:
|
|
12
|
+
- Grab interaction (hover to connect)
|
|
13
|
+
- Color shift on click (customizable)
|
|
14
|
+
- Smooth camera transitions
|
|
15
|
+
- ⚙️ **Fully Configurable**: Control colors, distances, animations, and camera behavior via `config.json`
|
|
16
|
+
- 📦 **TypeScript Support**: Full type definitions included
|
|
17
|
+
- 🎯 **Zero Dependencies Bundled**: Peer dependencies for minimal bundle size
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install netuniverse
|
|
23
|
+
# or
|
|
24
|
+
yarn add netuniverse
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Peer Dependencies
|
|
28
|
+
|
|
29
|
+
You must install these alongside the library:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install react react-dom three
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### Basic Example
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { GraphScene } from 'netuniverse';
|
|
41
|
+
import type { GraphData } from 'netuniverse';
|
|
42
|
+
|
|
43
|
+
const data: GraphData = {
|
|
44
|
+
nodes: [
|
|
45
|
+
{ id: '1', label: 'Node 1', cluster: 'CORE', x: 0, y: 0, z: 0 },
|
|
46
|
+
{ id: '2', label: 'Node 2', cluster: 'FINANCE', x: 100, y: 0, z: 0 },
|
|
47
|
+
],
|
|
48
|
+
links: [
|
|
49
|
+
{ source: '1', target: '2' }
|
|
50
|
+
]
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
function App() {
|
|
54
|
+
const [selectedNode, setSelectedNode] = useState(null);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div style={{ width: '100vw', height: '100vh' }}>
|
|
58
|
+
<GraphScene
|
|
59
|
+
data={data}
|
|
60
|
+
onNodeSelect={setSelectedNode}
|
|
61
|
+
selectedNodeId={selectedNode?.id || null}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Next.js Usage
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
'use client';
|
|
72
|
+
import dynamic from 'next/dynamic';
|
|
73
|
+
|
|
74
|
+
const GraphScene = dynamic(
|
|
75
|
+
() => import('NetUniverse-explorer').then(mod => ({ default: mod.GraphScene })),
|
|
76
|
+
{ ssr: false }
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
export default function Page() {
|
|
80
|
+
// ... same as above
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Configuration
|
|
85
|
+
|
|
86
|
+
You can customize the graph behavior by importing and modifying the default config:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { defaultConfig } from 'NetUniverse-explorer';
|
|
90
|
+
|
|
91
|
+
// Modify settings
|
|
92
|
+
const myConfig = {
|
|
93
|
+
...defaultConfig,
|
|
94
|
+
graph: {
|
|
95
|
+
...defaultConfig.graph,
|
|
96
|
+
network_node_count: 5000,
|
|
97
|
+
connection_distance: 400,
|
|
98
|
+
},
|
|
99
|
+
controls: {
|
|
100
|
+
...defaultConfig.controls,
|
|
101
|
+
enablePan: true,
|
|
102
|
+
enableZoom: true,
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Key Configuration Options
|
|
108
|
+
|
|
109
|
+
- **Graph**: Node count, spread, connection distance, colors
|
|
110
|
+
- **Animation**: Bounce physics, camera transitions, highlight scaling
|
|
111
|
+
- **Controls**: Zoom/Pan/Rotate toggles, axis locking
|
|
112
|
+
|
|
113
|
+
## API
|
|
114
|
+
|
|
115
|
+
### GraphScene Props
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
interface GraphSceneProps {
|
|
119
|
+
data: GraphData; // Graph data (nodes & links)
|
|
120
|
+
onNodeSelect: (node: NodeData | null) => void; // Node selection callback
|
|
121
|
+
selectedNodeId: string | null; // Currently selected node ID
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Types
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
interface NodeData {
|
|
129
|
+
id: string;
|
|
130
|
+
label: string;
|
|
131
|
+
cluster: string;
|
|
132
|
+
x?: number;
|
|
133
|
+
y?: number;
|
|
134
|
+
z?: number;
|
|
135
|
+
size?: number;
|
|
136
|
+
description?: string;
|
|
137
|
+
connections?: string[];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface LinkData {
|
|
141
|
+
source: string | NodeData;
|
|
142
|
+
target: string | NodeData;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface GraphData {
|
|
146
|
+
nodes: NodeData[];
|
|
147
|
+
links: LinkData[];
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Development
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Install dependencies
|
|
155
|
+
npm install
|
|
156
|
+
|
|
157
|
+
# Run dev server
|
|
158
|
+
npm run dev
|
|
159
|
+
|
|
160
|
+
# Build library
|
|
161
|
+
npm run build
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
MIT
|
|
167
|
+
|
|
168
|
+
## Credits
|
|
169
|
+
|
|
170
|
+
Built with:
|
|
171
|
+
- [Three.js](https://threejs.org/)
|
|
172
|
+
- [React Three Fiber](https://docs.pmnd.rs/react-three-fiber)
|
|
173
|
+
- [React Three Drei](https://github.com/pmndrs/drei)
|
|
174
|
+
- [d3-force-3d](https://github.com/vasturiano/d3-force-3d)
|
|
175
|
+
- [GSAP](https://greensock.com/gsap/)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { GraphData, NodeData } from './types';
|
|
3
|
+
interface GraphSceneProps {
|
|
4
|
+
data: GraphData;
|
|
5
|
+
onNodeSelect: (node: NodeData | null) => void;
|
|
6
|
+
selectedNodeId: string | null;
|
|
7
|
+
}
|
|
8
|
+
export declare const GraphScene: React.FC<GraphSceneProps>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=GraphScene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphScene.d.ts","sourceRoot":"","sources":["../GraphScene.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI9C,UAAU,eAAe;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAyChD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { GraphData, NodeData } from '../types';
|
|
3
|
+
interface GalaxyGraphProps {
|
|
4
|
+
data: GraphData;
|
|
5
|
+
onNodeSelect: (node: NodeData | null) => void;
|
|
6
|
+
selectedNodeId: string | null;
|
|
7
|
+
}
|
|
8
|
+
export declare const GalaxyGraph: React.FC<GalaxyGraphProps>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=GalaxyGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GalaxyGraph.d.ts","sourceRoot":"","sources":["../../components/GalaxyGraph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAKjF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAK/C,UAAU,gBAAgB;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,YAAY,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAySlD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { NodeData } from '../types';
|
|
3
|
+
interface OverlayUIProps {
|
|
4
|
+
selectedNode: NodeData | null;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const OverlayUI: React.FC<OverlayUIProps>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=OverlayUI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayUI.d.ts","sourceRoot":"","sources":["../../components/OverlayUI.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,UAAU,cAAc;IACtB,YAAY,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAwD9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StarField.d.ts","sourceRoot":"","sources":["../../components/StarField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAI/C,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAkE7B,CAAC"}
|
package/dist/index.d.ts
ADDED