force-3d-graph 1.0.3 → 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/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@ export declare interface EdgeObject {
33
33
 
34
34
  export declare type EventCallback = (...args: unknown[]) => void;
35
35
 
36
- export declare type EventType = 'nodeClick' | 'nodeHover' | 'edgeHover' | 'edgeClick' | 'nodeAdd' | 'nodeRemove' | 'edgeAdd' | 'edgeRemove' | 'expand' | 'ready';
36
+ export declare type EventType = 'nodeClick' | 'nodeHover' | 'edgeHover' | 'edgeClick' | 'nodeAdd' | 'nodeRemove' | 'edgeAdd' | 'edgeRemove' | 'expand' | 'viewChange' | 'ready';
37
37
 
38
38
  /**
39
39
  * ForceGraph3D
@@ -57,9 +57,13 @@ export declare class ForceGraph3D {
57
57
  private edgePanelManager;
58
58
  private edgeTooltipManager;
59
59
  private searchManager;
60
+ private viewToggleManager;
61
+ private forceGraph2D;
60
62
  private eventCallbacks;
61
63
  private initialized;
62
64
  private devControls;
65
+ private viewMode;
66
+ private graphData;
63
67
  constructor(container?: HTMLElement | null, options?: ForceGraph3DOptions);
64
68
  /**
65
69
  * Sets up internal callbacks
@@ -180,6 +184,14 @@ export declare class ForceGraph3D {
180
184
  * Checks if the graph is initialized
181
185
  */
182
186
  isInitialized(): boolean;
187
+ /**
188
+ * Gets the current view mode
189
+ */
190
+ getViewMode(): ViewMode;
191
+ /**
192
+ * Switches between 2D and 3D view modes
193
+ */
194
+ switchView(mode: ViewMode): void;
183
195
  /**
184
196
  * Registers an event listener
185
197
  */
@@ -189,7 +201,7 @@ export declare class ForceGraph3D {
189
201
  */
190
202
  private emit;
191
203
  /**
192
- * Sets physics parameters
204
+ * Sets physics parameters for both 3D and 2D views
193
205
  */
194
206
  setPhysicsParams(params: {
195
207
  repulsionStrength?: number;
@@ -233,6 +245,8 @@ export declare interface ForceGraph3DOptions {
233
245
  panelStyles?: Record<string, string>;
234
246
  showSearch?: boolean;
235
247
  searchPlaceholder?: string;
248
+ initialViewMode?: '2d' | '3d';
249
+ showViewToggle?: boolean;
236
250
  targetFPS?: number;
237
251
  maxVisibleNodes?: number;
238
252
  onNodeClick?: (nodeData: NodeData) => void;
@@ -330,4 +344,10 @@ export declare interface Vector3Data {
330
344
  z: number;
331
345
  }
332
346
 
347
+ /**
348
+ * View Toggle Manager
349
+ * Handles the 2D/3D view toggle button with glassmorphic styling
350
+ */
351
+ declare type ViewMode = '2d' | '3d';
352
+
333
353
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "force-3d-graph",
3
- "version": "1.0.3",
3
+ "version": "1.2.0",
4
4
  "description": "A 3D force-directed graph visualization library built with Three.js",
5
5
  "type": "module",
6
6
  "main": "./dist/force-3d-graph.umd.cjs",