3d-force-graph 1.76.0 → 1.76.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.
Files changed (37) hide show
  1. package/dist/3d-force-graph.js +7251 -1815
  2. package/dist/3d-force-graph.js.map +1 -1
  3. package/dist/3d-force-graph.min.js +3 -3
  4. package/dist/3d-force-graph.mjs +9 -5
  5. package/example/async-load/index.html +1 -1
  6. package/example/auto-colored/index.html +1 -1
  7. package/example/basic/index.html +1 -1
  8. package/example/bloom-effect/index.html +1 -1
  9. package/example/camera-auto-orbit/index.html +1 -1
  10. package/example/click-to-focus/index.html +1 -1
  11. package/example/collision-detection/index.html +1 -1
  12. package/example/controls-fly/index.html +1 -1
  13. package/example/controls-orbit/index.html +1 -1
  14. package/example/curved-links/index.html +1 -1
  15. package/example/custom-node-geometry/index.html +1 -1
  16. package/example/dag-yarn/index.html +1 -1
  17. package/example/directional-links-arrows/index.html +1 -1
  18. package/example/directional-links-particles/index.html +1 -1
  19. package/example/dynamic/index.html +1 -1
  20. package/example/emit-particles/index.html +1 -1
  21. package/example/expandable-nodes/index.html +1 -1
  22. package/example/fit-to-canvas/index.html +1 -1
  23. package/example/fix-dragged-nodes/index.html +1 -1
  24. package/example/gradient-links/index.html +1 -1
  25. package/example/highlight/index.html +1 -1
  26. package/example/html-nodes/index.html +1 -1
  27. package/example/img-nodes/index.html +1 -1
  28. package/example/large-graph/index.html +1 -1
  29. package/example/manipulate-link-force/index.html +1 -1
  30. package/example/multi-selection/index.html +1 -1
  31. package/example/pause-resume/index.html +1 -1
  32. package/example/responsive/index.html +1 -1
  33. package/example/scene/index.html +1 -1
  34. package/example/text-links/index.html +1 -1
  35. package/example/text-nodes/index.html +1 -1
  36. package/example/tree/index.html +1 -1
  37. package/package.json +5 -4
@@ -1,4 +1,4 @@
1
- import { AmbientLight, DirectionalLight, Vector3, REVISION } from 'three';
1
+ import { REVISION, AmbientLight, DirectionalLight } from 'three';
2
2
  import { DragControls } from 'three/examples/jsm/controls/DragControls.js';
3
3
  import ThreeForceGraph from 'three-forcegraph';
4
4
  import ThreeRenderObjects from 'three-render-objects';
@@ -83,7 +83,7 @@ function _toPrimitive(t, r) {
83
83
  if ("object" != typeof t || !t) return t;
84
84
  var e = t[Symbol.toPrimitive];
85
85
  if (undefined !== e) {
86
- var i = e.call(t, r || "default");
86
+ var i = e.call(t, r);
87
87
  if ("object" != typeof i) return i;
88
88
  throw new TypeError("@@toPrimitive must return a primitive value.");
89
89
  }
@@ -134,7 +134,6 @@ var three = window.THREE ? window.THREE // Prefer consumption from global THREE,
134
134
  : {
135
135
  AmbientLight: AmbientLight,
136
136
  DirectionalLight: DirectionalLight,
137
- Vector3: Vector3,
138
137
  REVISION: REVISION
139
138
  };
140
139
 
@@ -368,12 +367,14 @@ var _3dForceGraph = Kapsule({
368
367
  return obj;
369
368
  }), camera, renderer.domElement);
370
369
  dragControls.addEventListener('dragstart', function (event) {
370
+ var nodeObj = getGraphObj(event.object);
371
+ if (!nodeObj) return;
371
372
  controls.enabled = false; // Disable controls while dragging
372
373
 
373
374
  // track drag object movement
374
375
  event.object.__initialPos = event.object.position.clone();
375
376
  event.object.__prevPos = event.object.position.clone();
376
- var node = getGraphObj(event.object).__data;
377
+ var node = nodeObj.__data;
377
378
  !node.__initialFixedPos && (node.__initialFixedPos = {
378
379
  fx: node.fx,
379
380
  fy: node.fy,
@@ -395,6 +396,7 @@ var _3dForceGraph = Kapsule({
395
396
  });
396
397
  dragControls.addEventListener('drag', function (event) {
397
398
  var nodeObj = getGraphObj(event.object);
399
+ if (!nodeObj) return;
398
400
  if (!event.object.hasOwnProperty('__graphObjType')) {
399
401
  // If dragging a child of the node, update the node object instead
400
402
  var initPos = event.object.__initialPos;
@@ -422,9 +424,11 @@ var _3dForceGraph = Kapsule({
422
424
  state.onNodeDrag(node, translate);
423
425
  });
424
426
  dragControls.addEventListener('dragend', function (event) {
427
+ var nodeObj = getGraphObj(event.object);
428
+ if (!nodeObj) return;
425
429
  delete event.object.__initialPos; // remove tracking attributes
426
430
  delete event.object.__prevPos;
427
- var node = getGraphObj(event.object).__data;
431
+ var node = nodeObj.__data;
428
432
 
429
433
  // dispose previous controls if needed
430
434
  if (node.__disposeControlsAfterDrag) {
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!-- <script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  <script src="//bundle.run/@yarnpkg/lockfile@1.1.0"></script>
5
5
 
6
- <script src="//unpkg.com/3d-force-graph"></script>
6
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
7
7
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
8
8
  </head>
9
9
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -10,7 +10,7 @@
10
10
  }
11
11
  </style>
12
12
 
13
- <script src="//unpkg.com/3d-force-graph"></script>
13
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
14
14
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
15
15
  </head>
16
16
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!-- <script src="../../dist/3d-force-graph.js"></script>-->
6
6
 
7
7
  <style>
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!-- <script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!-- <script src="../../dist/3d-force-graph.js"></script>-->
6
6
 
7
7
  <style>
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!-- <script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!-- <script src="../../dist/3d-force-graph.js"></script> -->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!-- <script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 30px; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!-- <script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!-- <script src="../../dist/3d-force-graph.js"></script> -->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
@@ -1,7 +1,7 @@
1
1
  <head>
2
2
  <style> body { margin: 0; } </style>
3
3
 
4
- <script src="//unpkg.com/3d-force-graph"></script>
4
+ <script src="//cdn.jsdelivr.net/npm/3d-force-graph"></script>
5
5
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
6
6
  </head>
7
7
 
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "3d-force-graph",
3
- "version": "1.76.0",
3
+ "version": "1.76.2",
4
4
  "description": "UI component for a 3D force-directed graph using ThreeJS and d3-force-3d layout engine",
5
5
  "type": "module",
6
6
  "unpkg": "dist/3d-force-graph.min.js",
7
+ "jsdelivr": "dist/3d-force-graph.min.js",
7
8
  "main": "dist/3d-force-graph.mjs",
8
9
  "module": "dist/3d-force-graph.mjs",
9
10
  "types": "dist/3d-force-graph.d.ts",
@@ -53,15 +54,15 @@
53
54
  "three-render-objects": "^1.35"
54
55
  },
55
56
  "devDependencies": {
56
- "@babel/core": "^7.26.0",
57
- "@babel/preset-env": "^7.26.0",
57
+ "@babel/core": "^7.26.7",
58
+ "@babel/preset-env": "^7.26.7",
58
59
  "@rollup/plugin-babel": "^6.0.4",
59
60
  "@rollup/plugin-commonjs": "^28.0.2",
60
61
  "@rollup/plugin-node-resolve": "^16.0.0",
61
62
  "@rollup/plugin-terser": "^0.4.4",
62
63
  "postcss": "^8.5.1",
63
64
  "rimraf": "^6.0.1",
64
- "rollup": "^4.30.1",
65
+ "rollup": "^4.34.4",
65
66
  "rollup-plugin-dts": "^6.1.1",
66
67
  "rollup-plugin-postcss": "^4.0.2",
67
68
  "typescript": "^5.7.3"