@samoramachel/netuniverse 1.1.1 → 1.2.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 +8 -3
- package/dist/index.es.js +1 -0
- package/dist/index.umd.js +6 -6
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,10 +37,11 @@ npm install react react-dom three
|
|
|
37
37
|
### Basic Example
|
|
38
38
|
|
|
39
39
|
```tsx
|
|
40
|
-
import { GraphScene } from 'netuniverse';
|
|
40
|
+
import { GraphScene, generateGraphData } from 'netuniverse';
|
|
41
41
|
import type { GraphData } from 'netuniverse';
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
// Option 1: Use your own data
|
|
44
|
+
const myData: GraphData = {
|
|
44
45
|
nodes: [
|
|
45
46
|
{ id: '1', label: 'Node 1', cluster: 'CORE', x: 0, y: 0, z: 0 },
|
|
46
47
|
{ id: '2', label: 'Node 2', cluster: 'FINANCE', x: 100, y: 0, z: 0 },
|
|
@@ -50,13 +51,17 @@ const data: GraphData = {
|
|
|
50
51
|
]
|
|
51
52
|
};
|
|
52
53
|
|
|
54
|
+
// Option 2: Prototype with default random data
|
|
55
|
+
const defaultData = generateGraphData();
|
|
56
|
+
|
|
53
57
|
function App() {
|
|
54
58
|
const [selectedNode, setSelectedNode] = useState(null);
|
|
55
59
|
|
|
60
|
+
// Use myData or defaultData
|
|
56
61
|
return (
|
|
57
62
|
<div style={{ width: '100vw', height: '100vh' }}>
|
|
58
63
|
<GraphScene
|
|
59
|
-
data={
|
|
64
|
+
data={defaultData}
|
|
60
65
|
onNodeSelect={setSelectedNode}
|
|
61
66
|
selectedNodeId={selectedNode?.id || null}
|
|
62
67
|
/>
|