@cocorof/graphier 0.1.0 → 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 +4 -4
- package/dist/index.cjs +420 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +57 -2
- package/dist/index.js +420 -83
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,12 @@ export declare interface ConnectionGroup {
|
|
|
38
38
|
nodes: GraphNode[];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/** Context menu event: node + screen position for rendering custom menu */
|
|
42
|
+
export declare type ContextMenuHandler = (node: GraphNode, position: {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
}) => void;
|
|
46
|
+
|
|
41
47
|
export declare const DEFAULT_LAYOUT: Required<LayoutConfig>;
|
|
42
48
|
|
|
43
49
|
export declare const DEFAULT_STYLE: Required<StyleConfig>;
|
|
@@ -96,8 +102,21 @@ export declare interface LayoutConfig {
|
|
|
96
102
|
velocityDecay?: number;
|
|
97
103
|
/** Convergence threshold — simulation stops when alpha drops below this (default: 0.005) */
|
|
98
104
|
settledThreshold?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Spread multiplier — scales charge strength and link distance to control
|
|
107
|
+
* how far apart nodes spread. 1.0 = default, 2.0 = twice as spread out.
|
|
108
|
+
* Automatically scaled by node count when set to "auto".
|
|
109
|
+
* (default: "auto")
|
|
110
|
+
*/
|
|
111
|
+
spreadFactor?: "auto" | number;
|
|
99
112
|
}
|
|
100
113
|
|
|
114
|
+
/** Layout settled callback */
|
|
115
|
+
export declare type LayoutSettledHandler = () => void;
|
|
116
|
+
|
|
117
|
+
/** Layout tick callback with simulation alpha */
|
|
118
|
+
export declare type LayoutTickHandler = (alpha: number) => void;
|
|
119
|
+
|
|
101
120
|
export declare type LinkEventHandler = (link: GraphLink) => void;
|
|
102
121
|
|
|
103
122
|
export declare const minimal: ThemeConfig;
|
|
@@ -115,6 +134,20 @@ export declare interface NetworkGraph3DProps {
|
|
|
115
134
|
onNodeDoubleClick?: NodeEventHandler;
|
|
116
135
|
/** Hover on a node (null = hover out) */
|
|
117
136
|
onNodeHover?: NullableNodeEventHandler;
|
|
137
|
+
/** Right-click on a node — receives node + screen position for custom menu */
|
|
138
|
+
onContextMenu?: ContextMenuHandler;
|
|
139
|
+
/** Click on an edge/link */
|
|
140
|
+
onLinkClick?: LinkEventHandler;
|
|
141
|
+
/** Hover on an edge/link (null = hover out) */
|
|
142
|
+
onLinkHover?: NullableLinkEventHandler;
|
|
143
|
+
/** Node drag (fires continuously during drag) */
|
|
144
|
+
onNodeDrag?: NodeDragHandler;
|
|
145
|
+
/** Node drag end */
|
|
146
|
+
onNodeDragEnd?: NodeDragHandler;
|
|
147
|
+
/** Fired when force simulation converges */
|
|
148
|
+
onLayoutSettled?: LayoutSettledHandler;
|
|
149
|
+
/** Fired on each layout tick with current alpha */
|
|
150
|
+
onLayoutTick?: LayoutTickHandler;
|
|
118
151
|
/** Currently selected node ID (controlled mode) */
|
|
119
152
|
selectedNodeId?: string | null;
|
|
120
153
|
/** Number of hops to highlight around selected node (default: 3) */
|
|
@@ -164,8 +197,10 @@ export declare interface NetworkGraph3DRef {
|
|
|
164
197
|
getRenderer(): THREE.WebGLRenderer | null;
|
|
165
198
|
/** Access the Three.js camera */
|
|
166
199
|
getCamera(): THREE.PerspectiveCamera | null;
|
|
167
|
-
/** Capture a screenshot as a
|
|
168
|
-
|
|
200
|
+
/** Capture a screenshot as a PNG data URL string (synchronous, matches original) */
|
|
201
|
+
captureScreenshot(): string | null;
|
|
202
|
+
/** Re-run force layout from current positions (useful after changing spreadFactor) */
|
|
203
|
+
reheatLayout(): void;
|
|
169
204
|
}
|
|
170
205
|
|
|
171
206
|
export declare function NodeDetailPanel(props: NodeDetailPanelProps): JSX_2.Element;
|
|
@@ -189,8 +224,17 @@ export declare interface NodeDetailPanelProps {
|
|
|
189
224
|
style?: CSSProperties;
|
|
190
225
|
}
|
|
191
226
|
|
|
227
|
+
/** Node drag event (fires during drag) */
|
|
228
|
+
export declare type NodeDragHandler = (node: GraphNode, position: {
|
|
229
|
+
x: number;
|
|
230
|
+
y: number;
|
|
231
|
+
z: number;
|
|
232
|
+
}) => void;
|
|
233
|
+
|
|
192
234
|
export declare type NodeEventHandler = (node: GraphNode) => void;
|
|
193
235
|
|
|
236
|
+
export declare type NullableLinkEventHandler = (link: GraphLink | null) => void;
|
|
237
|
+
|
|
194
238
|
export declare type NullableNodeEventHandler = (node: GraphNode | null) => void;
|
|
195
239
|
|
|
196
240
|
/** Runtime node with layout positions (internal) */
|
|
@@ -205,6 +249,12 @@ export declare interface RendererConfig {
|
|
|
205
249
|
antialias?: boolean;
|
|
206
250
|
/** Max device pixel ratio (default: 1.5) */
|
|
207
251
|
pixelRatioMax?: number;
|
|
252
|
+
/**
|
|
253
|
+
* Camera control mode:
|
|
254
|
+
* - "fly" (default): WASD/arrow thrust-based flight with inertia (matches original)
|
|
255
|
+
* - "orbit": z/x zoom, arrow keys orbit around target
|
|
256
|
+
*/
|
|
257
|
+
cameraMode?: "fly" | "orbit";
|
|
208
258
|
}
|
|
209
259
|
|
|
210
260
|
export declare interface ResolvedTheme {
|
|
@@ -245,6 +295,11 @@ export declare interface StyleConfig {
|
|
|
245
295
|
maxLabels?: number;
|
|
246
296
|
/** Edge line width multiplier (default: 1.0). Note: WebGL limits linewidth to 1 on most platforms. */
|
|
247
297
|
edgeWidthScale?: number;
|
|
298
|
+
/**
|
|
299
|
+
* Fly camera thrust speed multiplier (default: 1.0).
|
|
300
|
+
* 0.5 = half speed, 2.0 = double speed.
|
|
301
|
+
*/
|
|
302
|
+
flySpeed?: number;
|
|
248
303
|
}
|
|
249
304
|
|
|
250
305
|
export declare interface SubgraphOptions {
|