@cocorof/graphier 1.3.2 → 1.4.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 +26 -0
- package/dist/index.cjs +530 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +98 -0
- package/dist/index.js +530 -51
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,6 +21,32 @@ High-performance 3D/2D graph renderer for React — powered by Three.js and d3-f
|
|
|
21
21
|
- **TypeScript** — Full type safety with exported types
|
|
22
22
|
- **Dual ESM/CJS** — Works in all bundler configurations
|
|
23
23
|
|
|
24
|
+
## 2D Mode, Filtering & Minimap (v1.4)
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
const ref = useRef<NetworkGraph3DRef>(null);
|
|
28
|
+
|
|
29
|
+
<NetworkGraph3D
|
|
30
|
+
ref={ref}
|
|
31
|
+
data={data}
|
|
32
|
+
layout={{ dimensions: 2, clusterBy: "type" }} // flat Obsidian-style plane
|
|
33
|
+
theme="paper" // light theme preset
|
|
34
|
+
style={{ starField: false, bloomStrength: 0, fogDensity: 0 }}
|
|
35
|
+
visibleNodeIds={visibleIds} // hide/show WITHOUT re-running layout
|
|
36
|
+
clickToFocus={false} // select on click, no camera flight
|
|
37
|
+
hoverHighlight // neighbor highlight on hover
|
|
38
|
+
/>
|
|
39
|
+
<GraphMinimap graphRef={ref} width={200} height={140} />
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- `layout.dimensions: 2` — simulation runs in 2D (z locked to 0); camera locks to pan/zoom (drag pans, wheel/pinch zooms, rotation off).
|
|
43
|
+
- `layout.clusterBy: "type" | "group"` + `clusterStrength` — pulls same-key nodes toward a shared centroid so categories form visible clusters.
|
|
44
|
+
- `linkVisibility={(link) => bool}` — reheat-free per-edge filter (e.g. hide a link type).
|
|
45
|
+
- `visibleNodeIds` — client-side filter; hidden nodes/edges/labels vanish via per-instance scale + collapsed segments. Positions are preserved: toggling filters never reheats the simulation.
|
|
46
|
+
- `hoverHighlight` / `hoverHighlightHops` — Obsidian-style neighborhood emphasis on hover (selection wins while active).
|
|
47
|
+
- `theme="paper"` — light background preset; edge blending switches to normal automatically (additive lines vanish on white) and highlight/dim directions invert.
|
|
48
|
+
- `GraphMinimap` — 2D-canvas overview (no second WebGL context): draws all visible nodes + the camera viewport rectangle, click/drag to pan. Powered by `ref.getGraphSnapshot()` / `ref.getViewportRect()` / `ref.panTo(x, y)`.
|
|
49
|
+
|
|
24
50
|
## Install
|
|
25
51
|
|
|
26
52
|
```bash
|