@omiron33/omi-neuron-web 0.1.1 → 0.1.2
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/dist/{NeuronWeb-BS4yLYQf.d.cts → NeuronWeb-DG5ICk2K.d.cts} +31 -3
- package/dist/{NeuronWeb-pWxbA_oL.d.ts → NeuronWeb-DbcYoeQE.d.ts} +31 -3
- package/dist/chunk-GPDX3O37.js +1194 -0
- package/dist/chunk-GPDX3O37.js.map +1 -0
- package/dist/chunk-KC7V76I3.cjs +1220 -0
- package/dist/chunk-KC7V76I3.cjs.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/visualization/index.cjs +6 -6
- package/dist/visualization/index.d.cts +24 -5
- package/dist/visualization/index.d.ts +24 -5
- package/dist/visualization/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2WP2AEZC.cjs +0 -545
- package/dist/chunk-2WP2AEZC.cjs.map +0 -1
- package/dist/chunk-DMF2DKZA.js +0 -519
- package/dist/chunk-DMF2DKZA.js.map +0 -1
package/dist/chunk-DMF2DKZA.js
DELETED
|
@@ -1,519 +0,0 @@
|
|
|
1
|
-
import { useRef, useMemo, useEffect, useState } from 'react';
|
|
2
|
-
import * as THREE2 from 'three';
|
|
3
|
-
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
|
|
4
|
-
import { CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRenderer.js';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
// src/visualization/constants.ts
|
|
8
|
-
var DEFAULT_THEME = {
|
|
9
|
-
colors: {
|
|
10
|
-
background: "#020314",
|
|
11
|
-
domainColors: {},
|
|
12
|
-
defaultDomainColor: "#c0c5ff",
|
|
13
|
-
edgeDefault: "#4d4d55",
|
|
14
|
-
edgeActive: "#c6d4ff",
|
|
15
|
-
edgeSelected: "#ffffff",
|
|
16
|
-
labelText: "#ffffff",
|
|
17
|
-
labelBackground: "rgba(0, 0, 0, 0.8)"
|
|
18
|
-
},
|
|
19
|
-
typography: {
|
|
20
|
-
labelFontFamily: "system-ui, sans-serif",
|
|
21
|
-
labelFontSize: 12,
|
|
22
|
-
labelFontWeight: "500"
|
|
23
|
-
},
|
|
24
|
-
effects: {
|
|
25
|
-
starfieldEnabled: true,
|
|
26
|
-
starfieldColor: "#ffffff",
|
|
27
|
-
glowEnabled: true,
|
|
28
|
-
glowIntensity: 0.6
|
|
29
|
-
},
|
|
30
|
-
animation: {
|
|
31
|
-
focusDuration: 800,
|
|
32
|
-
transitionDuration: 650,
|
|
33
|
-
easing: "easeInOut"
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var SceneManager = class {
|
|
37
|
-
constructor(container, config) {
|
|
38
|
-
this.container = container;
|
|
39
|
-
this.config = config;
|
|
40
|
-
this.scene = new THREE2.Scene();
|
|
41
|
-
this.camera = new THREE2.PerspectiveCamera(60, 1, 0.1, 2e3);
|
|
42
|
-
this.renderer = new THREE2.WebGLRenderer({ antialias: true });
|
|
43
|
-
this.labelRenderer = new CSS2DRenderer();
|
|
44
|
-
this.controls = new OrbitControls(this.camera, this.renderer.domElement);
|
|
45
|
-
}
|
|
46
|
-
scene;
|
|
47
|
-
camera;
|
|
48
|
-
renderer;
|
|
49
|
-
labelRenderer;
|
|
50
|
-
controls;
|
|
51
|
-
animationId = null;
|
|
52
|
-
initialize() {
|
|
53
|
-
const { cameraPosition, cameraTarget, backgroundColor } = this.config;
|
|
54
|
-
this.scene.background = new THREE2.Color(backgroundColor);
|
|
55
|
-
this.camera.position.set(...cameraPosition);
|
|
56
|
-
this.controls.target.set(...cameraTarget);
|
|
57
|
-
this.controls.update();
|
|
58
|
-
this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, this.config.pixelRatioCap));
|
|
59
|
-
this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
|
|
60
|
-
this.labelRenderer.setSize(this.container.clientWidth, this.container.clientHeight);
|
|
61
|
-
this.container.appendChild(this.renderer.domElement);
|
|
62
|
-
this.container.appendChild(this.labelRenderer.domElement);
|
|
63
|
-
window.addEventListener("resize", this.resize);
|
|
64
|
-
this.startAnimationLoop();
|
|
65
|
-
}
|
|
66
|
-
dispose() {
|
|
67
|
-
this.stopAnimationLoop();
|
|
68
|
-
window.removeEventListener("resize", this.resize);
|
|
69
|
-
this.renderer.dispose();
|
|
70
|
-
this.scene.clear();
|
|
71
|
-
this.container.innerHTML = "";
|
|
72
|
-
}
|
|
73
|
-
startAnimationLoop() {
|
|
74
|
-
const loop = () => {
|
|
75
|
-
this.render();
|
|
76
|
-
this.animationId = requestAnimationFrame(loop);
|
|
77
|
-
};
|
|
78
|
-
loop();
|
|
79
|
-
}
|
|
80
|
-
stopAnimationLoop() {
|
|
81
|
-
if (this.animationId) {
|
|
82
|
-
cancelAnimationFrame(this.animationId);
|
|
83
|
-
this.animationId = null;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
render() {
|
|
87
|
-
this.renderer.render(this.scene, this.camera);
|
|
88
|
-
this.labelRenderer.render(this.scene, this.camera);
|
|
89
|
-
}
|
|
90
|
-
resize = () => {
|
|
91
|
-
const width = this.container.clientWidth;
|
|
92
|
-
const height = this.container.clientHeight;
|
|
93
|
-
this.camera.aspect = width / height;
|
|
94
|
-
this.camera.updateProjectionMatrix();
|
|
95
|
-
this.renderer.setSize(width, height);
|
|
96
|
-
this.labelRenderer.setSize(width, height);
|
|
97
|
-
};
|
|
98
|
-
updateBackground(color) {
|
|
99
|
-
this.scene.background = new THREE2.Color(color);
|
|
100
|
-
}
|
|
101
|
-
updateCamera(position) {
|
|
102
|
-
this.camera.position.set(...position);
|
|
103
|
-
}
|
|
104
|
-
getWorldPosition(screenX, screenY) {
|
|
105
|
-
return this.screenToWorld(screenX, screenY);
|
|
106
|
-
}
|
|
107
|
-
screenToWorld(x, y) {
|
|
108
|
-
const rect = this.container.getBoundingClientRect();
|
|
109
|
-
const ndc = new THREE2.Vector3(
|
|
110
|
-
(x - rect.left) / rect.width * 2 - 1,
|
|
111
|
-
-((y - rect.top) / rect.height) * 2 + 1,
|
|
112
|
-
0.5
|
|
113
|
-
);
|
|
114
|
-
ndc.unproject(this.camera);
|
|
115
|
-
return ndc;
|
|
116
|
-
}
|
|
117
|
-
worldToScreen(position) {
|
|
118
|
-
const vector = position.clone().project(this.camera);
|
|
119
|
-
const rect = this.container.getBoundingClientRect();
|
|
120
|
-
return {
|
|
121
|
-
x: (vector.x * 0.5 + 0.5) * rect.width + rect.left,
|
|
122
|
-
y: (-vector.y * 0.5 + 0.5) * rect.height + rect.top
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
onContextLost = () => {
|
|
126
|
-
};
|
|
127
|
-
onContextRestored = () => {
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// src/visualization/hooks/useSceneManager.ts
|
|
132
|
-
function useSceneManager(containerRef, config) {
|
|
133
|
-
const [manager, setManager] = useState(null);
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
const container = containerRef.current;
|
|
136
|
-
if (!container) return;
|
|
137
|
-
const sceneManager = new SceneManager(container, config);
|
|
138
|
-
sceneManager.initialize();
|
|
139
|
-
setManager(sceneManager);
|
|
140
|
-
return () => {
|
|
141
|
-
sceneManager.dispose();
|
|
142
|
-
setManager(null);
|
|
143
|
-
};
|
|
144
|
-
}, [containerRef, config.backgroundColor]);
|
|
145
|
-
return manager;
|
|
146
|
-
}
|
|
147
|
-
var NodeRenderer = class {
|
|
148
|
-
constructor(scene, config) {
|
|
149
|
-
this.scene = scene;
|
|
150
|
-
this.config = config;
|
|
151
|
-
this.scene.add(this.group);
|
|
152
|
-
}
|
|
153
|
-
group = new THREE2.Group();
|
|
154
|
-
nodeObjects = /* @__PURE__ */ new Map();
|
|
155
|
-
renderNodes(nodes) {
|
|
156
|
-
this.clear();
|
|
157
|
-
nodes.forEach((node) => {
|
|
158
|
-
const color = this.config.domainColors[node.domain] ?? this.config.defaultColor;
|
|
159
|
-
const geometry = new THREE2.SphereGeometry(this.config.baseScale, 16, 16);
|
|
160
|
-
const material = new THREE2.MeshBasicMaterial({ color });
|
|
161
|
-
const mesh = new THREE2.Mesh(geometry, material);
|
|
162
|
-
if (node.position) {
|
|
163
|
-
mesh.position.set(...node.position);
|
|
164
|
-
}
|
|
165
|
-
mesh.userData = { nodeId: node.id };
|
|
166
|
-
this.group.add(mesh);
|
|
167
|
-
this.nodeObjects.set(node.id, mesh);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
updateNode(nodeId, updates) {
|
|
171
|
-
const obj = this.nodeObjects.get(nodeId);
|
|
172
|
-
if (!obj) return;
|
|
173
|
-
if (updates.position) {
|
|
174
|
-
obj.position.set(...updates.position);
|
|
175
|
-
}
|
|
176
|
-
if (updates.domain) {
|
|
177
|
-
const color = this.config.domainColors[updates.domain] ?? this.config.defaultColor;
|
|
178
|
-
obj.material.color = new THREE2.Color(color);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
removeNode(nodeId) {
|
|
182
|
-
const obj = this.nodeObjects.get(nodeId);
|
|
183
|
-
if (!obj) return;
|
|
184
|
-
this.group.remove(obj);
|
|
185
|
-
this.nodeObjects.delete(nodeId);
|
|
186
|
-
}
|
|
187
|
-
clear() {
|
|
188
|
-
this.group.clear();
|
|
189
|
-
this.nodeObjects.clear();
|
|
190
|
-
}
|
|
191
|
-
showNodes(nodeIds) {
|
|
192
|
-
nodeIds.forEach((id) => {
|
|
193
|
-
const obj = this.nodeObjects.get(id);
|
|
194
|
-
if (obj) obj.visible = true;
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
hideNodes(nodeIds) {
|
|
198
|
-
nodeIds.forEach((id) => {
|
|
199
|
-
const obj = this.nodeObjects.get(id);
|
|
200
|
-
if (obj) obj.visible = false;
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
setVisibleNodes(nodeIds) {
|
|
204
|
-
if (!nodeIds) {
|
|
205
|
-
this.nodeObjects.forEach((obj) => {
|
|
206
|
-
obj.visible = true;
|
|
207
|
-
});
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
const visibleSet = new Set(nodeIds);
|
|
211
|
-
this.nodeObjects.forEach((obj, id) => {
|
|
212
|
-
obj.visible = visibleSet.has(id);
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
updateLabelVisibility() {
|
|
216
|
-
}
|
|
217
|
-
highlightNode(nodeId) {
|
|
218
|
-
const obj = this.nodeObjects.get(nodeId);
|
|
219
|
-
if (obj) {
|
|
220
|
-
obj.material.color = new THREE2.Color("#ffffff");
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
unhighlightNode(nodeId) {
|
|
224
|
-
const obj = this.nodeObjects.get(nodeId);
|
|
225
|
-
if (obj) {
|
|
226
|
-
const color = this.config.defaultColor;
|
|
227
|
-
obj.material.color = new THREE2.Color(color);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
clearHighlights() {
|
|
231
|
-
this.nodeObjects.forEach((obj) => {
|
|
232
|
-
obj.material.color = new THREE2.Color(this.config.defaultColor);
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
getNodePosition(nodeId) {
|
|
236
|
-
const obj = this.nodeObjects.get(nodeId);
|
|
237
|
-
return obj ? obj.position.clone() : null;
|
|
238
|
-
}
|
|
239
|
-
getNodeObject(nodeId) {
|
|
240
|
-
return this.nodeObjects.get(nodeId) ?? null;
|
|
241
|
-
}
|
|
242
|
-
dispose() {
|
|
243
|
-
this.clear();
|
|
244
|
-
this.scene.remove(this.group);
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
var EdgeRenderer = class {
|
|
248
|
-
constructor(scene, config) {
|
|
249
|
-
this.scene = scene;
|
|
250
|
-
this.config = config;
|
|
251
|
-
this.scene.add(this.group);
|
|
252
|
-
}
|
|
253
|
-
group = new THREE2.Group();
|
|
254
|
-
edgeObjects = /* @__PURE__ */ new Map();
|
|
255
|
-
renderEdges(edges, nodePositions) {
|
|
256
|
-
this.clear();
|
|
257
|
-
edges.forEach((edge) => {
|
|
258
|
-
const from = nodePositions.get(edge.from);
|
|
259
|
-
const to = nodePositions.get(edge.to);
|
|
260
|
-
if (!from || !to) return;
|
|
261
|
-
const geometry = new THREE2.BufferGeometry().setFromPoints([from, to]);
|
|
262
|
-
const opacity = this.config.strengthOpacityScale ? edge.strength : this.config.baseOpacity;
|
|
263
|
-
const material = new THREE2.LineBasicMaterial({ color: this.config.defaultColor, transparent: true, opacity });
|
|
264
|
-
const line = new THREE2.Line(geometry, material);
|
|
265
|
-
line.userData = { edgeId: edge.id };
|
|
266
|
-
this.group.add(line);
|
|
267
|
-
this.edgeObjects.set(edge.id, line);
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
updateEdge(edgeId, updates) {
|
|
271
|
-
const line = this.edgeObjects.get(edgeId);
|
|
272
|
-
if (!line) return;
|
|
273
|
-
if (updates.strength !== void 0) {
|
|
274
|
-
const opacity = this.config.strengthOpacityScale ? updates.strength : this.config.baseOpacity;
|
|
275
|
-
line.material.opacity = opacity;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
removeEdge(edgeId) {
|
|
279
|
-
const line = this.edgeObjects.get(edgeId);
|
|
280
|
-
if (!line) return;
|
|
281
|
-
this.group.remove(line);
|
|
282
|
-
this.edgeObjects.delete(edgeId);
|
|
283
|
-
}
|
|
284
|
-
clear() {
|
|
285
|
-
this.group.clear();
|
|
286
|
-
this.edgeObjects.clear();
|
|
287
|
-
}
|
|
288
|
-
filterByStrength(minStrength) {
|
|
289
|
-
this.edgeObjects.forEach((line) => {
|
|
290
|
-
line.visible = line.material.opacity >= minStrength;
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
filterByType() {
|
|
294
|
-
}
|
|
295
|
-
highlightEdge(edgeId) {
|
|
296
|
-
const line = this.edgeObjects.get(edgeId);
|
|
297
|
-
if (line) {
|
|
298
|
-
line.material.color = new THREE2.Color(this.config.activeColor);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
highlightEdgesForNode() {
|
|
302
|
-
}
|
|
303
|
-
unhighlightEdge(edgeId) {
|
|
304
|
-
const line = this.edgeObjects.get(edgeId);
|
|
305
|
-
if (line) {
|
|
306
|
-
line.material.color = new THREE2.Color(this.config.defaultColor);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
clearHighlights() {
|
|
310
|
-
this.edgeObjects.forEach((line) => {
|
|
311
|
-
line.material.color = new THREE2.Color(this.config.defaultColor);
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
showEdges(edgeIds) {
|
|
315
|
-
edgeIds.forEach((id) => {
|
|
316
|
-
const line = this.edgeObjects.get(id);
|
|
317
|
-
if (line) line.visible = true;
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
hideEdges(edgeIds) {
|
|
321
|
-
edgeIds.forEach((id) => {
|
|
322
|
-
const line = this.edgeObjects.get(id);
|
|
323
|
-
if (line) line.visible = false;
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
dispose() {
|
|
327
|
-
this.clear();
|
|
328
|
-
this.scene.remove(this.group);
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
// src/visualization/layouts/fuzzy-layout.ts
|
|
333
|
-
var GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));
|
|
334
|
-
function hashString(input) {
|
|
335
|
-
let hash = 2166136261;
|
|
336
|
-
for (let i = 0; i < input.length; i += 1) {
|
|
337
|
-
hash ^= input.charCodeAt(i);
|
|
338
|
-
hash = Math.imul(hash, 16777619);
|
|
339
|
-
}
|
|
340
|
-
return hash >>> 0;
|
|
341
|
-
}
|
|
342
|
-
function mulberry32(seed) {
|
|
343
|
-
let t = seed;
|
|
344
|
-
return () => {
|
|
345
|
-
t += 1831565813;
|
|
346
|
-
let r = Math.imul(t ^ t >>> 15, t | 1);
|
|
347
|
-
r ^= r + Math.imul(r ^ r >>> 7, r | 61);
|
|
348
|
-
return ((r ^ r >>> 14) >>> 0) / 4294967296;
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
function buildSeed(baseSeed, nodeKey) {
|
|
352
|
-
return mulberry32(hashString(`${baseSeed}:${nodeKey}`));
|
|
353
|
-
}
|
|
354
|
-
function applyFuzzyLayout(nodes, options = {}) {
|
|
355
|
-
const mode = options.mode ?? "auto";
|
|
356
|
-
if (mode === "positioned") {
|
|
357
|
-
return nodes;
|
|
358
|
-
}
|
|
359
|
-
const needsLayout = mode === "fuzzy" || nodes.some((node) => !node.position);
|
|
360
|
-
if (!needsLayout) {
|
|
361
|
-
return nodes;
|
|
362
|
-
}
|
|
363
|
-
const baseSeed = options.seed ?? "omi-neuron-web";
|
|
364
|
-
const count = Math.max(nodes.length, 1);
|
|
365
|
-
const baseRadius = options.radius ?? Math.max(4, Math.sqrt(count) * 2.4);
|
|
366
|
-
const jitter = options.jitter ?? baseRadius * 0.15;
|
|
367
|
-
const zSpread = options.zSpread ?? baseRadius * 0.6;
|
|
368
|
-
return nodes.map((node, index) => {
|
|
369
|
-
const shouldApply = mode === "fuzzy" || !node.position;
|
|
370
|
-
if (!shouldApply) {
|
|
371
|
-
return node;
|
|
372
|
-
}
|
|
373
|
-
const nodeKey = node.slug || node.id || String(index);
|
|
374
|
-
const rand = buildSeed(baseSeed, nodeKey);
|
|
375
|
-
const angle = rand() * Math.PI * 2 + index * GOLDEN_ANGLE * 0.05;
|
|
376
|
-
const radius = baseRadius * Math.sqrt(rand());
|
|
377
|
-
const jitterOffset = (rand() - 0.5) * jitter;
|
|
378
|
-
const r = Math.max(0.6, radius + jitterOffset);
|
|
379
|
-
const x = Math.cos(angle) * r;
|
|
380
|
-
const y = Math.sin(angle) * r;
|
|
381
|
-
const z = (rand() - 0.5) * zSpread;
|
|
382
|
-
return { ...node, position: [x, y, z] };
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
function NeuronWeb({
|
|
386
|
-
graphData,
|
|
387
|
-
className,
|
|
388
|
-
style,
|
|
389
|
-
isLoading,
|
|
390
|
-
error,
|
|
391
|
-
renderEmptyState,
|
|
392
|
-
renderLoadingState,
|
|
393
|
-
ariaLabel,
|
|
394
|
-
theme,
|
|
395
|
-
layout
|
|
396
|
-
}) {
|
|
397
|
-
const containerRef = useRef(null);
|
|
398
|
-
const resolvedTheme = { ...DEFAULT_THEME, ...theme };
|
|
399
|
-
const sceneManager = useSceneManager(containerRef, {
|
|
400
|
-
backgroundColor: resolvedTheme.colors.background,
|
|
401
|
-
cameraPosition: [4, 8, 20],
|
|
402
|
-
cameraTarget: [0, 0, 0],
|
|
403
|
-
minZoom: 4,
|
|
404
|
-
maxZoom: 42,
|
|
405
|
-
enableStarfield: resolvedTheme.effects.starfieldEnabled,
|
|
406
|
-
starfieldCount: 1200,
|
|
407
|
-
pixelRatioCap: 2
|
|
408
|
-
});
|
|
409
|
-
const nodeRenderer = useMemo(() => {
|
|
410
|
-
if (!sceneManager) return null;
|
|
411
|
-
return new NodeRenderer(sceneManager.scene, {
|
|
412
|
-
domainColors: resolvedTheme.colors.domainColors,
|
|
413
|
-
defaultColor: resolvedTheme.colors.defaultDomainColor,
|
|
414
|
-
baseScale: 0.4,
|
|
415
|
-
tierScales: {
|
|
416
|
-
primary: 1.6,
|
|
417
|
-
secondary: 1.2,
|
|
418
|
-
tertiary: 1,
|
|
419
|
-
insight: 1
|
|
420
|
-
},
|
|
421
|
-
glowIntensity: resolvedTheme.effects.glowIntensity,
|
|
422
|
-
labelDistance: 20,
|
|
423
|
-
maxVisibleLabels: 50
|
|
424
|
-
});
|
|
425
|
-
}, [sceneManager]);
|
|
426
|
-
const edgeRenderer = useMemo(() => {
|
|
427
|
-
if (!sceneManager) return null;
|
|
428
|
-
return new EdgeRenderer(sceneManager.scene, {
|
|
429
|
-
defaultColor: resolvedTheme.colors.edgeDefault,
|
|
430
|
-
activeColor: resolvedTheme.colors.edgeActive,
|
|
431
|
-
selectedColor: resolvedTheme.colors.edgeSelected,
|
|
432
|
-
baseOpacity: 0.5,
|
|
433
|
-
strengthOpacityScale: true
|
|
434
|
-
});
|
|
435
|
-
}, [sceneManager]);
|
|
436
|
-
const resolvedNodes = useMemo(
|
|
437
|
-
() => applyFuzzyLayout(graphData.nodes, layout),
|
|
438
|
-
[graphData.nodes, layout]
|
|
439
|
-
);
|
|
440
|
-
useEffect(() => {
|
|
441
|
-
if (!sceneManager || !nodeRenderer || !edgeRenderer) return;
|
|
442
|
-
nodeRenderer.renderNodes(resolvedNodes);
|
|
443
|
-
const positions = /* @__PURE__ */ new Map();
|
|
444
|
-
resolvedNodes.forEach((node) => {
|
|
445
|
-
if (!node.position) return;
|
|
446
|
-
positions.set(node.slug, new THREE2.Vector3(...node.position));
|
|
447
|
-
});
|
|
448
|
-
edgeRenderer.renderEdges(graphData.edges, positions);
|
|
449
|
-
}, [resolvedNodes, graphData.edges, sceneManager, nodeRenderer, edgeRenderer]);
|
|
450
|
-
if (isLoading) {
|
|
451
|
-
return /* @__PURE__ */ jsx("div", { className, style, "aria-label": ariaLabel, children: renderLoadingState ? renderLoadingState() : /* @__PURE__ */ jsx("div", { children: "Loading\u2026" }) });
|
|
452
|
-
}
|
|
453
|
-
if (error) {
|
|
454
|
-
return /* @__PURE__ */ jsx("div", { className, style, "aria-label": ariaLabel, children: renderEmptyState ? renderEmptyState() : /* @__PURE__ */ jsx("div", { children: error }) });
|
|
455
|
-
}
|
|
456
|
-
if (!resolvedNodes.length) {
|
|
457
|
-
return /* @__PURE__ */ jsx("div", { className, style, "aria-label": ariaLabel, children: renderEmptyState ? renderEmptyState() : /* @__PURE__ */ jsx("div", { children: "No data" }) });
|
|
458
|
-
}
|
|
459
|
-
return /* @__PURE__ */ jsx("div", { ref: containerRef, className, style, "aria-label": ariaLabel });
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
// src/visualization/themes/theme-engine.ts
|
|
463
|
-
var ThemeEngine = class {
|
|
464
|
-
theme;
|
|
465
|
-
onThemeChange = () => {
|
|
466
|
-
};
|
|
467
|
-
constructor(initialTheme) {
|
|
468
|
-
this.theme = { ...DEFAULT_THEME, ...initialTheme };
|
|
469
|
-
}
|
|
470
|
-
getTheme() {
|
|
471
|
-
return this.theme;
|
|
472
|
-
}
|
|
473
|
-
setTheme(theme) {
|
|
474
|
-
this.theme = { ...this.theme, ...theme };
|
|
475
|
-
this.onThemeChange(this.theme);
|
|
476
|
-
}
|
|
477
|
-
resetTheme() {
|
|
478
|
-
this.theme = { ...DEFAULT_THEME };
|
|
479
|
-
this.onThemeChange(this.theme);
|
|
480
|
-
}
|
|
481
|
-
setDomainColor(domain, color) {
|
|
482
|
-
this.theme.colors.domainColors[domain] = color;
|
|
483
|
-
this.onThemeChange(this.theme);
|
|
484
|
-
}
|
|
485
|
-
setBackground(color) {
|
|
486
|
-
this.theme.colors.background = color;
|
|
487
|
-
this.onThemeChange(this.theme);
|
|
488
|
-
}
|
|
489
|
-
setLabelStyle(style) {
|
|
490
|
-
this.theme.typography = { ...this.theme.typography, ...style };
|
|
491
|
-
this.onThemeChange(this.theme);
|
|
492
|
-
}
|
|
493
|
-
applyPreset(preset) {
|
|
494
|
-
if (preset === "light") {
|
|
495
|
-
this.theme = {
|
|
496
|
-
...DEFAULT_THEME,
|
|
497
|
-
colors: { ...DEFAULT_THEME.colors, background: "#f7f7fb", labelText: "#111" }
|
|
498
|
-
};
|
|
499
|
-
} else if (preset === "dark") {
|
|
500
|
-
this.theme = { ...DEFAULT_THEME };
|
|
501
|
-
}
|
|
502
|
-
this.onThemeChange(this.theme);
|
|
503
|
-
}
|
|
504
|
-
saveToStorage() {
|
|
505
|
-
if (typeof window === "undefined") return;
|
|
506
|
-
window.localStorage.setItem("omi-neuron-theme", JSON.stringify(this.theme));
|
|
507
|
-
}
|
|
508
|
-
loadFromStorage() {
|
|
509
|
-
if (typeof window === "undefined") return;
|
|
510
|
-
const stored = window.localStorage.getItem("omi-neuron-theme");
|
|
511
|
-
if (stored) {
|
|
512
|
-
this.theme = { ...this.theme, ...JSON.parse(stored) };
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
export { DEFAULT_THEME, NeuronWeb, SceneManager, ThemeEngine, applyFuzzyLayout };
|
|
518
|
-
//# sourceMappingURL=chunk-DMF2DKZA.js.map
|
|
519
|
-
//# sourceMappingURL=chunk-DMF2DKZA.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/visualization/constants.ts","../src/visualization/scene/scene-manager.ts","../src/visualization/hooks/useSceneManager.ts","../src/visualization/scene/node-renderer.ts","../src/visualization/scene/edge-renderer.ts","../src/visualization/layouts/fuzzy-layout.ts","../src/visualization/NeuronWeb.tsx","../src/visualization/themes/theme-engine.ts"],"names":["THREE","THREE3","useEffect","THREE4"],"mappings":";;;;;;;AAEO,IAAM,aAAA,GAAgC;AAAA,EAC3C,MAAA,EAAQ;AAAA,IACN,UAAA,EAAY,SAAA;AAAA,IACZ,cAAc,EAAC;AAAA,IACf,kBAAA,EAAoB,SAAA;AAAA,IACpB,WAAA,EAAa,SAAA;AAAA,IACb,UAAA,EAAY,SAAA;AAAA,IACZ,YAAA,EAAc,SAAA;AAAA,IACd,SAAA,EAAW,SAAA;AAAA,IACX,eAAA,EAAiB;AAAA,GACnB;AAAA,EACA,UAAA,EAAY;AAAA,IACV,eAAA,EAAiB,uBAAA;AAAA,IACjB,aAAA,EAAe,EAAA;AAAA,IACf,eAAA,EAAiB;AAAA,GACnB;AAAA,EACA,OAAA,EAAS;AAAA,IACP,gBAAA,EAAkB,IAAA;AAAA,IAClB,cAAA,EAAgB,SAAA;AAAA,IAChB,WAAA,EAAa,IAAA;AAAA,IACb,aAAA,EAAe;AAAA,GACjB;AAAA,EACA,SAAA,EAAW;AAAA,IACT,aAAA,EAAe,GAAA;AAAA,IACf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,IAAA,CAAK,KAAA,GAAQ;AAAA,QACX,GAAG,aAAA;AAAA,QACH,MAAA,EAAQ,EAAE,GAAG,aAAA,CAAc,QAAQ,UAAA,EAAY,SAAA,EAAW,WAAW,MAAA;AAAO,OAC9E;AAAA,IACF,CAAA,MAAA,IAAW,WAAW,MAAA,EAAQ;AAC5B,MAAA,IAAA,CAAK,KAAA,GAAQ,EAAE,GAAG,aAAA,EAAc;AAAA,IAClC;AACA,IAAA,IAAA,CAAK,aAAA,CAAc,KAAK,KAAK,CAAA;AAAA,EAC/B;AAAA,EAEA,aAAA,GAAsB;AACpB,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,IAAA,MAAA,CAAO,aAAa,OAAA,CAAQ,kBAAA,EAAoB,KAAK,SAAA,CAAU,IAAA,CAAK,KAAK,CAAC,CAAA;AAAA,EAC5E;AAAA,EAEA,eAAA,GAAwB;AACtB,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,IAAA,MAAM,MAAA,GAAS,MAAA,CAAO,YAAA,CAAa,OAAA,CAAQ,kBAAkB,CAAA;AAC7D,IAAA,IAAI,MAAA,EAAQ;AACV,MAAA,IAAA,CAAK,KAAA,GAAQ,EAAE,GAAG,IAAA,CAAK,OAAO,GAAI,IAAA,CAAK,KAAA,CAAM,MAAM,CAAA,EAAqB;AAAA,IAC1E;AAAA,EACF;AACF","file":"chunk-DMF2DKZA.js","sourcesContent":["import type { NeuronWebTheme } from './types';\n\nexport const DEFAULT_THEME: NeuronWebTheme = {\n colors: {\n background: '#020314',\n domainColors: {},\n defaultDomainColor: '#c0c5ff',\n edgeDefault: '#4d4d55',\n edgeActive: '#c6d4ff',\n edgeSelected: '#ffffff',\n labelText: '#ffffff',\n labelBackground: 'rgba(0, 0, 0, 0.8)',\n },\n typography: {\n labelFontFamily: 'system-ui, sans-serif',\n labelFontSize: 12,\n labelFontWeight: '500',\n },\n effects: {\n starfieldEnabled: true,\n starfieldColor: '#ffffff',\n glowEnabled: true,\n glowIntensity: 0.6,\n },\n animation: {\n focusDuration: 800,\n transitionDuration: 650,\n easing: 'easeInOut',\n },\n};\n","import * as THREE from 'three';\nimport { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';\nimport { CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRenderer.js';\n\nexport interface SceneConfig {\n backgroundColor: string;\n cameraPosition: [number, number, number];\n cameraTarget: [number, number, number];\n minZoom: number;\n maxZoom: number;\n enableStarfield: boolean;\n starfieldCount: number;\n pixelRatioCap: number;\n}\n\nexport class SceneManager {\n scene: THREE.Scene;\n camera: THREE.PerspectiveCamera;\n renderer: THREE.WebGLRenderer;\n labelRenderer: CSS2DRenderer;\n controls: OrbitControls;\n private animationId: number | null = null;\n\n constructor(private container: HTMLElement, private config: SceneConfig) {\n this.scene = new THREE.Scene();\n this.camera = new THREE.PerspectiveCamera(60, 1, 0.1, 2000);\n this.renderer = new THREE.WebGLRenderer({ antialias: true });\n this.labelRenderer = new CSS2DRenderer();\n this.controls = new OrbitControls(this.camera, this.renderer.domElement);\n }\n\n initialize(): void {\n const { cameraPosition, cameraTarget, backgroundColor } = this.config;\n this.scene.background = new THREE.Color(backgroundColor);\n this.camera.position.set(...cameraPosition);\n this.controls.target.set(...cameraTarget);\n this.controls.update();\n\n this.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, this.config.pixelRatioCap));\n this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);\n this.labelRenderer.setSize(this.container.clientWidth, this.container.clientHeight);\n\n this.container.appendChild(this.renderer.domElement);\n this.container.appendChild(this.labelRenderer.domElement);\n\n window.addEventListener('resize', this.resize);\n this.startAnimationLoop();\n }\n\n dispose(): void {\n this.stopAnimationLoop();\n window.removeEventListener('resize', this.resize);\n this.renderer.dispose();\n this.scene.clear();\n this.container.innerHTML = '';\n }\n\n startAnimationLoop(): void {\n const loop = () => {\n this.render();\n this.animationId = requestAnimationFrame(loop);\n };\n loop();\n }\n\n stopAnimationLoop(): void {\n if (this.animationId) {\n cancelAnimationFrame(this.animationId);\n this.animationId = null;\n }\n }\n\n render(): void {\n this.renderer.render(this.scene, this.camera);\n this.labelRenderer.render(this.scene, this.camera);\n }\n\n resize = (): void => {\n const width = this.container.clientWidth;\n const height = this.container.clientHeight;\n this.camera.aspect = width / height;\n this.camera.updateProjectionMatrix();\n this.renderer.setSize(width, height);\n this.labelRenderer.setSize(width, height);\n };\n\n updateBackground(color: string): void {\n this.scene.background = new THREE.Color(color);\n }\n\n updateCamera(position: [number, number, number]): void {\n this.camera.position.set(...position);\n }\n\n getWorldPosition(screenX: number, screenY: number): THREE.Vector3 {\n return this.screenToWorld(screenX, screenY);\n }\n\n screenToWorld(x: number, y: number): THREE.Vector3 {\n const rect = this.container.getBoundingClientRect();\n const ndc = new THREE.Vector3(\n ((x - rect.left) / rect.width) * 2 - 1,\n -((y - rect.top) / rect.height) * 2 + 1,\n 0.5\n );\n ndc.unproject(this.camera);\n return ndc;\n }\n\n worldToScreen(position: THREE.Vector3): { x: number; y: number } {\n const vector = position.clone().project(this.camera);\n const rect = this.container.getBoundingClientRect();\n return {\n x: (vector.x * 0.5 + 0.5) * rect.width + rect.left,\n y: (-vector.y * 0.5 + 0.5) * rect.height + rect.top,\n };\n }\n\n onContextLost = () => {};\n onContextRestored = () => {};\n}\n","import { useEffect, useState } from 'react';\nimport type { RefObject } from 'react';\nimport { SceneManager, type SceneConfig } from '../scene/scene-manager';\n\nexport function useSceneManager(\n containerRef: RefObject<HTMLElement | null>,\n config: SceneConfig\n): SceneManager | null {\n const [manager, setManager] = useState<SceneManager | null>(null);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n const sceneManager = new SceneManager(container, config);\n sceneManager.initialize();\n setManager(sceneManager);\n return () => {\n sceneManager.dispose();\n setManager(null);\n };\n }, [containerRef, config.backgroundColor]);\n\n return manager;\n}\n","import * as THREE from 'three';\nimport type { NeuronVisualNode, NodeTier } from '../../core/types';\n\nexport interface NodeRenderConfig {\n domainColors: Record<string, string>;\n defaultColor: string;\n baseScale: number;\n tierScales: Record<NodeTier, number>;\n glowIntensity: number;\n labelDistance: number;\n maxVisibleLabels: number;\n}\n\nexport class NodeRenderer {\n private group = new THREE.Group();\n private nodeObjects = new Map<string, THREE.Mesh>();\n\n constructor(private scene: THREE.Scene, private config: NodeRenderConfig) {\n this.scene.add(this.group);\n }\n\n renderNodes(nodes: NeuronVisualNode[]): void {\n this.clear();\n nodes.forEach((node) => {\n const color = this.config.domainColors[node.domain] ?? this.config.defaultColor;\n const geometry = new THREE.SphereGeometry(this.config.baseScale, 16, 16);\n const material = new THREE.MeshBasicMaterial({ color });\n const mesh = new THREE.Mesh(geometry, material);\n if (node.position) {\n mesh.position.set(...node.position);\n }\n mesh.userData = { nodeId: node.id };\n this.group.add(mesh);\n this.nodeObjects.set(node.id, mesh);\n });\n }\n\n updateNode(nodeId: string, updates: Partial<NeuronVisualNode>): void {\n const obj = this.nodeObjects.get(nodeId) as THREE.Mesh | undefined;\n if (!obj) return;\n if (updates.position) {\n obj.position.set(...updates.position);\n }\n if (updates.domain) {\n const color = this.config.domainColors[updates.domain] ?? this.config.defaultColor;\n (obj.material as THREE.MeshBasicMaterial).color = new THREE.Color(color);\n }\n }\n\n removeNode(nodeId: string): void {\n const obj = this.nodeObjects.get(nodeId);\n if (!obj) return;\n this.group.remove(obj);\n this.nodeObjects.delete(nodeId);\n }\n\n clear(): void {\n this.group.clear();\n this.nodeObjects.clear();\n }\n\n showNodes(nodeIds: string[]): void {\n nodeIds.forEach((id) => {\n const obj = this.nodeObjects.get(id);\n if (obj) obj.visible = true;\n });\n }\n\n hideNodes(nodeIds: string[]): void {\n nodeIds.forEach((id) => {\n const obj = this.nodeObjects.get(id);\n if (obj) obj.visible = false;\n });\n }\n\n setVisibleNodes(nodeIds: string[] | null): void {\n if (!nodeIds) {\n this.nodeObjects.forEach((obj) => {\n obj.visible = true;\n });\n return;\n }\n const visibleSet = new Set(nodeIds);\n this.nodeObjects.forEach((obj, id) => {\n obj.visible = visibleSet.has(id);\n });\n }\n\n updateLabelVisibility(): void {\n // Labels not implemented in this stub.\n }\n\n highlightNode(nodeId: string): void {\n const obj = this.nodeObjects.get(nodeId) as THREE.Mesh | undefined;\n if (obj) {\n (obj.material as THREE.MeshBasicMaterial).color = new THREE.Color('#ffffff');\n }\n }\n\n unhighlightNode(nodeId: string): void {\n const obj = this.nodeObjects.get(nodeId) as THREE.Mesh | undefined;\n if (obj) {\n const color = this.config.defaultColor;\n (obj.material as THREE.MeshBasicMaterial).color = new THREE.Color(color);\n }\n }\n\n clearHighlights(): void {\n this.nodeObjects.forEach((obj) => {\n (obj.material as THREE.MeshBasicMaterial).color = new THREE.Color(this.config.defaultColor);\n });\n }\n\n getNodePosition(nodeId: string): THREE.Vector3 | null {\n const obj = this.nodeObjects.get(nodeId);\n return obj ? obj.position.clone() : null;\n }\n\n getNodeObject(nodeId: string): THREE.Object3D | null {\n return this.nodeObjects.get(nodeId) ?? null;\n }\n\n dispose(): void {\n this.clear();\n this.scene.remove(this.group);\n }\n}\n","import * as THREE from 'three';\nimport type { NeuronVisualEdge } from '../../core/types';\n\nexport interface EdgeRenderConfig {\n defaultColor: string;\n activeColor: string;\n selectedColor: string;\n baseOpacity: number;\n strengthOpacityScale: boolean;\n}\n\nexport class EdgeRenderer {\n private group = new THREE.Group();\n private edgeObjects = new Map<string, THREE.Line>();\n\n constructor(private scene: THREE.Scene, private config: EdgeRenderConfig) {\n this.scene.add(this.group);\n }\n\n renderEdges(edges: NeuronVisualEdge[], nodePositions: Map<string, THREE.Vector3>): void {\n this.clear();\n edges.forEach((edge) => {\n const from = nodePositions.get(edge.from);\n const to = nodePositions.get(edge.to);\n if (!from || !to) return;\n const geometry = new THREE.BufferGeometry().setFromPoints([from, to]);\n const opacity = this.config.strengthOpacityScale ? edge.strength : this.config.baseOpacity;\n const material = new THREE.LineBasicMaterial({ color: this.config.defaultColor, transparent: true, opacity });\n const line = new THREE.Line(geometry, material);\n line.userData = { edgeId: edge.id };\n this.group.add(line);\n this.edgeObjects.set(edge.id, line);\n });\n }\n\n updateEdge(edgeId: string, updates: Partial<NeuronVisualEdge>): void {\n const line = this.edgeObjects.get(edgeId);\n if (!line) return;\n if (updates.strength !== undefined) {\n const opacity = this.config.strengthOpacityScale ? updates.strength : this.config.baseOpacity;\n (line.material as THREE.LineBasicMaterial).opacity = opacity;\n }\n }\n\n removeEdge(edgeId: string): void {\n const line = this.edgeObjects.get(edgeId);\n if (!line) return;\n this.group.remove(line);\n this.edgeObjects.delete(edgeId);\n }\n\n clear(): void {\n this.group.clear();\n this.edgeObjects.clear();\n }\n\n filterByStrength(minStrength: number): void {\n this.edgeObjects.forEach((line) => {\n line.visible = (line.material as THREE.LineBasicMaterial).opacity >= minStrength;\n });\n }\n\n filterByType(): void {\n // Not implemented in stub.\n }\n\n highlightEdge(edgeId: string): void {\n const line = this.edgeObjects.get(edgeId);\n if (line) {\n (line.material as THREE.LineBasicMaterial).color = new THREE.Color(this.config.activeColor);\n }\n }\n\n highlightEdgesForNode(): void {\n // Not implemented in stub.\n }\n\n unhighlightEdge(edgeId: string): void {\n const line = this.edgeObjects.get(edgeId);\n if (line) {\n (line.material as THREE.LineBasicMaterial).color = new THREE.Color(this.config.defaultColor);\n }\n }\n\n clearHighlights(): void {\n this.edgeObjects.forEach((line) => {\n (line.material as THREE.LineBasicMaterial).color = new THREE.Color(this.config.defaultColor);\n });\n }\n\n showEdges(edgeIds: string[]): void {\n edgeIds.forEach((id) => {\n const line = this.edgeObjects.get(id);\n if (line) line.visible = true;\n });\n }\n\n hideEdges(edgeIds: string[]): void {\n edgeIds.forEach((id) => {\n const line = this.edgeObjects.get(id);\n if (line) line.visible = false;\n });\n }\n\n dispose(): void {\n this.clear();\n this.scene.remove(this.group);\n }\n}\n","import type { NeuronVisualNode } from '../../core/types';\nimport type { NeuronLayoutOptions } from '../types';\n\nconst GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));\n\nfunction hashString(input: string): number {\n let hash = 2166136261;\n for (let i = 0; i < input.length; i += 1) {\n hash ^= input.charCodeAt(i);\n hash = Math.imul(hash, 16777619);\n }\n return hash >>> 0;\n}\n\nfunction mulberry32(seed: number): () => number {\n let t = seed;\n return () => {\n t += 0x6d2b79f5;\n let r = Math.imul(t ^ (t >>> 15), t | 1);\n r ^= r + Math.imul(r ^ (r >>> 7), r | 61);\n return ((r ^ (r >>> 14)) >>> 0) / 4294967296;\n };\n}\n\nfunction buildSeed(baseSeed: string, nodeKey: string): () => number {\n return mulberry32(hashString(`${baseSeed}:${nodeKey}`));\n}\n\nexport function applyFuzzyLayout(\n nodes: NeuronVisualNode[],\n options: NeuronLayoutOptions = {}\n): NeuronVisualNode[] {\n const mode = options.mode ?? 'auto';\n if (mode === 'positioned') {\n return nodes;\n }\n\n const needsLayout = mode === 'fuzzy' || nodes.some((node) => !node.position);\n if (!needsLayout) {\n return nodes;\n }\n\n const baseSeed = options.seed ?? 'omi-neuron-web';\n const count = Math.max(nodes.length, 1);\n const baseRadius = options.radius ?? Math.max(4, Math.sqrt(count) * 2.4);\n const jitter = options.jitter ?? baseRadius * 0.15;\n const zSpread = options.zSpread ?? baseRadius * 0.6;\n\n return nodes.map((node, index) => {\n const shouldApply = mode === 'fuzzy' || !node.position;\n if (!shouldApply) {\n return node;\n }\n\n const nodeKey = node.slug || node.id || String(index);\n const rand = buildSeed(baseSeed, nodeKey);\n const angle = rand() * Math.PI * 2 + index * GOLDEN_ANGLE * 0.05;\n const radius = baseRadius * Math.sqrt(rand());\n const jitterOffset = (rand() - 0.5) * jitter;\n const r = Math.max(0.6, radius + jitterOffset);\n const x = Math.cos(angle) * r;\n const y = Math.sin(angle) * r;\n const z = (rand() - 0.5) * zSpread;\n\n return { ...node, position: [x, y, z] };\n });\n}\n","'use client';\n\nimport React, { useEffect, useMemo, useRef } from 'react';\nimport * as THREE from 'three';\nimport type { NeuronWebProps } from './types';\nimport { DEFAULT_THEME } from './constants';\nimport { useSceneManager } from './hooks/useSceneManager';\nimport { NodeRenderer } from './scene/node-renderer';\nimport { EdgeRenderer } from './scene/edge-renderer';\nimport { applyFuzzyLayout } from './layouts/fuzzy-layout';\n\nexport function NeuronWeb({\n graphData,\n className,\n style,\n isLoading,\n error,\n renderEmptyState,\n renderLoadingState,\n ariaLabel,\n theme,\n layout,\n}: NeuronWebProps): React.ReactElement {\n const containerRef = useRef<HTMLDivElement>(null);\n const resolvedTheme = { ...DEFAULT_THEME, ...theme };\n\n const sceneManager = useSceneManager(containerRef, {\n backgroundColor: resolvedTheme.colors.background,\n cameraPosition: [4, 8, 20],\n cameraTarget: [0, 0, 0],\n minZoom: 4,\n maxZoom: 42,\n enableStarfield: resolvedTheme.effects.starfieldEnabled,\n starfieldCount: 1200,\n pixelRatioCap: 2,\n });\n\n const nodeRenderer = useMemo(() => {\n if (!sceneManager) return null;\n return new NodeRenderer(sceneManager.scene, {\n domainColors: resolvedTheme.colors.domainColors,\n defaultColor: resolvedTheme.colors.defaultDomainColor,\n baseScale: 0.4,\n tierScales: {\n primary: 1.6,\n secondary: 1.2,\n tertiary: 1,\n insight: 1,\n },\n glowIntensity: resolvedTheme.effects.glowIntensity,\n labelDistance: 20,\n maxVisibleLabels: 50,\n });\n }, [sceneManager]);\n\n const edgeRenderer = useMemo(() => {\n if (!sceneManager) return null;\n return new EdgeRenderer(sceneManager.scene, {\n defaultColor: resolvedTheme.colors.edgeDefault,\n activeColor: resolvedTheme.colors.edgeActive,\n selectedColor: resolvedTheme.colors.edgeSelected,\n baseOpacity: 0.5,\n strengthOpacityScale: true,\n });\n }, [sceneManager]);\n\n const resolvedNodes = useMemo(\n () => applyFuzzyLayout(graphData.nodes, layout),\n [graphData.nodes, layout]\n );\n\n useEffect(() => {\n if (!sceneManager || !nodeRenderer || !edgeRenderer) return;\n nodeRenderer.renderNodes(resolvedNodes);\n const positions = new Map<string, THREE.Vector3>();\n resolvedNodes.forEach((node) => {\n if (!node.position) return;\n positions.set(node.slug, new THREE.Vector3(...node.position));\n });\n edgeRenderer.renderEdges(graphData.edges, positions);\n }, [resolvedNodes, graphData.edges, sceneManager, nodeRenderer, edgeRenderer]);\n\n if (isLoading) {\n return (\n <div className={className} style={style} aria-label={ariaLabel}>\n {renderLoadingState ? renderLoadingState() : <div>Loading…</div>}\n </div>\n );\n }\n\n if (error) {\n return (\n <div className={className} style={style} aria-label={ariaLabel}>\n {renderEmptyState ? renderEmptyState() : <div>{error}</div>}\n </div>\n );\n }\n\n if (!resolvedNodes.length) {\n return (\n <div className={className} style={style} aria-label={ariaLabel}>\n {renderEmptyState ? renderEmptyState() : <div>No data</div>}\n </div>\n );\n }\n\n return <div ref={containerRef} className={className} style={style} aria-label={ariaLabel} />;\n}\n","import { DEFAULT_THEME } from '../constants';\nimport type { NeuronWebTheme } from '../types';\n\nexport class ThemeEngine {\n private theme: NeuronWebTheme;\n onThemeChange: (theme: NeuronWebTheme) => void = () => {};\n\n constructor(initialTheme?: Partial<NeuronWebTheme>) {\n this.theme = { ...DEFAULT_THEME, ...initialTheme } as NeuronWebTheme;\n }\n\n getTheme(): NeuronWebTheme {\n return this.theme;\n }\n\n setTheme(theme: Partial<NeuronWebTheme>): void {\n this.theme = { ...this.theme, ...theme } as NeuronWebTheme;\n this.onThemeChange(this.theme);\n }\n\n resetTheme(): void {\n this.theme = { ...DEFAULT_THEME };\n this.onThemeChange(this.theme);\n }\n\n setDomainColor(domain: string, color: string): void {\n this.theme.colors.domainColors[domain] = color;\n this.onThemeChange(this.theme);\n }\n\n setBackground(color: string): void {\n this.theme.colors.background = color;\n this.onThemeChange(this.theme);\n }\n\n setLabelStyle(style: Partial<NeuronWebTheme['typography']>): void {\n this.theme.typography = { ...this.theme.typography, ...style };\n this.onThemeChange(this.theme);\n }\n\n applyPreset(preset: 'dark' | 'light' | 'custom'): void {\n if (preset === 'light') {\n this.theme = {\n ...DEFAULT_THEME,\n colors: { ...DEFAULT_THEME.colors, background: '#f7f7fb', labelText: '#111' },\n };\n } else if (preset === 'dark') {\n this.theme = { ...DEFAULT_THEME };\n }\n this.onThemeChange(this.theme);\n }\n\n saveToStorage(): void {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem('omi-neuron-theme', JSON.stringify(this.theme));\n }\n\n loadFromStorage(): void {\n if (typeof window === 'undefined') return;\n const stored = window.localStorage.getItem('omi-neuron-theme');\n if (stored) {\n this.theme = { ...this.theme, ...(JSON.parse(stored) as NeuronWebTheme) };\n }\n }\n}\n"]}
|