3d-force-graph 1.70.5 → 1.70.9

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 CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  [![NPM package][npm-img]][npm-url]
5
5
  [![Build Size][build-size-img]][build-size-url]
6
- [![Dependencies][dependencies-img]][dependencies-url]
6
+ [![NPM Downloads][npm-downloads-img]][npm-downloads-url]
7
7
 
8
8
  <p align="center">
9
9
  <a href="https://vasturiano.github.io/3d-force-graph/example/large-graph/"><img width="80%" src="http://gist.github.com/vasturiano/02affe306ce445e423f992faeea13521/raw/preview.png"></a>
@@ -12,7 +12,12 @@
12
12
  A web component to represent a graph data structure in a 3-dimensional space using a [force-directed](https://en.wikipedia.org/wiki/Force-directed_graph_drawing) iterative layout.
13
13
  Uses [ThreeJS](https://github.com/mrdoob/three.js/)/WebGL for 3D rendering and either [d3-force-3d](https://github.com/vasturiano/d3-force-3d) or [ngraph](https://github.com/anvaka/ngraph.forcelayout3d) for the underlying physics engine.
14
14
 
15
- Check out the examples:
15
+ See also the [2D canvas version](https://github.com/vasturiano/force-graph), [VR version](https://github.com/vasturiano/3d-force-graph-vr) and [AR version](https://github.com/vasturiano/3d-force-graph-ar).
16
+
17
+ And check out the [React bindings](https://github.com/vasturiano/react-force-graph).
18
+
19
+ ## Examples
20
+
16
21
  * [Basic](https://vasturiano.github.io/3d-force-graph/example/basic/) ([source](https://github.com/vasturiano/3d-force-graph/blob/master/example/basic/index.html))
17
22
  * [Asynchronous load](https://vasturiano.github.io/3d-force-graph/example/async-load/) ([source](https://github.com/vasturiano/3d-force-graph/blob/master/example/async-load/index.html))
18
23
  * [Larger graph (~4k elements)](https://vasturiano.github.io/3d-force-graph/example/large-graph/) ([source](https://github.com/vasturiano/3d-force-graph/blob/master/example/large-graph/index.html))
@@ -45,34 +50,30 @@ Check out the examples:
45
50
  * [Bloom Post-Processing Effect](https://vasturiano.github.io/3d-force-graph/example/bloom-effect/) ([source](https://github.com/vasturiano/3d-force-graph/blob/master/example/bloom-effect/index.html))
46
51
  * [Pause / Resume animation](https://vasturiano.github.io/3d-force-graph/example/pause-resume/) ([source](https://github.com/vasturiano/3d-force-graph/blob/master/example/pause-resume/index.html))
47
52
 
48
- See also the [2D canvas version](https://github.com/vasturiano/force-graph), [VR version](https://github.com/vasturiano/3d-force-graph-vr) and [AR version](https://github.com/vasturiano/3d-force-graph-ar).
49
-
50
- And check out the [React bindings](https://github.com/vasturiano/react-force-graph).
51
-
52
53
  ## Quick start
53
54
 
54
- ```
55
+ ```js
55
56
  import ForceGraph3D from '3d-force-graph';
56
57
  ```
57
58
  or
58
- ```
59
- var ForceGraph3D = require('3d-force-graph');
59
+ ```js
60
+ const ForceGraph3D = require('3d-force-graph');
60
61
  ```
61
62
  or even
62
- ```
63
+ ```html
63
64
  <script src="//unpkg.com/3d-force-graph"></script>
64
65
  ```
65
66
  then
66
- ```
67
- var myGraph = ForceGraph3D();
67
+ ```js
68
+ const myGraph = ForceGraph3D();
68
69
  myGraph(<myDOMElement>)
69
- .graphData(<myData>);
70
+ .graphData(<myData>);
70
71
  ```
71
72
 
72
73
  ## API reference
73
74
 
74
75
  ### Initialisation
75
- ```
76
+ ```js
76
77
  ForceGraph3d({ configOptions })(<domElement>)
77
78
  ```
78
79
 
@@ -209,7 +210,7 @@ ForceGraph3d({ configOptions })(<domElement>)
209
210
  | <b>screen2GraphCoords</b>(<i>x</i>, <i>y</i>, <i>distance</i>) | Utility method to translate viewport distance coordinates to the graph domain. Given a pair of `x`,`y` screen coordinates and distance from the camera, returns the current equivalent `{x, y, z}` in the domain of graph node coordinates. |
210
211
 
211
212
  ### Input JSON syntax
212
- ```
213
+ ```json
213
214
  {
214
215
  "nodes": [
215
216
  {
@@ -222,14 +223,14 @@ ForceGraph3d({ configOptions })(<domElement>)
222
223
  "name": "name2",
223
224
  "val": 10
224
225
  },
225
- (...)
226
+ ...
226
227
  ],
227
228
  "links": [
228
229
  {
229
230
  "source": "id1",
230
231
  "target": "id2"
231
232
  },
232
- (...)
233
+ ...
233
234
  ]
234
235
  }
235
236
  ```
@@ -238,9 +239,9 @@ ForceGraph3d({ configOptions })(<domElement>)
238
239
 
239
240
  [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=L398E7PKP47E8&currency_code=USD&source=url) If this project has helped you and you'd like to contribute back, you can always [buy me a ☕](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=L398E7PKP47E8&currency_code=USD&source=url)!
240
241
 
241
- [npm-img]: https://img.shields.io/npm/v/3d-force-graph.svg
242
+ [npm-img]: https://img.shields.io/npm/v/3d-force-graph
242
243
  [npm-url]: https://npmjs.org/package/3d-force-graph
243
- [build-size-img]: https://img.shields.io/bundlephobia/minzip/3d-force-graph.svg
244
+ [build-size-img]: https://img.shields.io/bundlephobia/minzip/3d-force-graph
244
245
  [build-size-url]: https://bundlephobia.com/result?p=3d-force-graph
245
- [dependencies-img]: https://img.shields.io/david/vasturiano/3d-force-graph.svg
246
- [dependencies-url]: https://david-dm.org/vasturiano/3d-force-graph
246
+ [npm-downloads-img]: https://img.shields.io/npm/dt/3d-force-graph
247
+ [npm-downloads-url]: https://www.npmtrends.com/3d-force-graph
@@ -51,14 +51,9 @@ function ownKeys(object, enumerableOnly) {
51
51
 
52
52
  if (Object.getOwnPropertySymbols) {
53
53
  var symbols = Object.getOwnPropertySymbols(object);
54
-
55
- if (enumerableOnly) {
56
- symbols = symbols.filter(function (sym) {
57
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
58
- });
59
- }
60
-
61
- keys.push.apply(keys, symbols);
54
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
55
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
56
+ })), keys.push.apply(keys, symbols);
62
57
  }
63
58
 
64
59
  return keys;
@@ -66,19 +61,12 @@ function ownKeys(object, enumerableOnly) {
66
61
 
67
62
  function _objectSpread2(target) {
68
63
  for (var i = 1; i < arguments.length; i++) {
69
- var source = arguments[i] != null ? arguments[i] : {};
70
-
71
- if (i % 2) {
72
- ownKeys(Object(source), true).forEach(function (key) {
73
- _defineProperty(target, key, source[key]);
74
- });
75
- } else if (Object.getOwnPropertyDescriptors) {
76
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
77
- } else {
78
- ownKeys(Object(source)).forEach(function (key) {
79
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
80
- });
81
- }
64
+ var source = null != arguments[i] ? arguments[i] : {};
65
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
66
+ _defineProperty(target, key, source[key]);
67
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
68
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
69
+ });
82
70
  }
83
71
 
84
72
  return target;
@@ -173,7 +161,7 @@ var three = window.THREE ? window.THREE // Prefer consumption from global THREE,
173
161
  var CAMERA_DISTANCE2NODES_FACTOR = 170; //
174
162
  // Expose config from forceGraph
175
163
 
176
- var bindFG = linkKapsule('forceGraph', ThreeForceGraph__default['default']);
164
+ var bindFG = linkKapsule('forceGraph', ThreeForceGraph__default["default"]);
177
165
  var linkedFGProps = Object.assign.apply(Object, _toConsumableArray(['jsonUrl', 'graphData', 'numDimensions', 'dagMode', 'dagLevelDistance', 'dagNodeFilter', 'onDagError', 'nodeRelSize', 'nodeId', 'nodeVal', 'nodeResolution', 'nodeColor', 'nodeAutoColorBy', 'nodeOpacity', 'nodeVisibility', 'nodeThreeObject', 'nodeThreeObjectExtend', 'linkSource', 'linkTarget', 'linkVisibility', 'linkColor', 'linkAutoColorBy', 'linkOpacity', 'linkWidth', 'linkResolution', 'linkCurvature', 'linkCurveRotation', 'linkMaterial', 'linkThreeObject', 'linkThreeObjectExtend', 'linkPositionUpdate', 'linkDirectionalArrowLength', 'linkDirectionalArrowColor', 'linkDirectionalArrowRelPos', 'linkDirectionalArrowResolution', 'linkDirectionalParticles', 'linkDirectionalParticleSpeed', 'linkDirectionalParticleWidth', 'linkDirectionalParticleColor', 'linkDirectionalParticleResolution', 'forceEngine', 'd3AlphaDecay', 'd3VelocityDecay', 'd3AlphaMin', 'ngraphPhysics', 'warmupTicks', 'cooldownTicks', 'cooldownTime', 'onEngineTick', 'onEngineStop'].map(function (p) {
178
166
  return _defineProperty({}, p, bindFG.linkProp(p));
179
167
  })));
@@ -181,7 +169,7 @@ var linkedFGMethods = Object.assign.apply(Object, _toConsumableArray(['refresh',
181
169
  return _defineProperty({}, p, bindFG.linkMethod(p));
182
170
  }))); // Expose config from renderObjs
183
171
 
184
- var bindRenderObjs = linkKapsule('renderObjs', ThreeRenderObjects__default['default']);
172
+ var bindRenderObjs = linkKapsule('renderObjs', ThreeRenderObjects__default["default"]);
185
173
  var linkedRenderObjsProps = Object.assign.apply(Object, _toConsumableArray(['width', 'height', 'backgroundColor', 'showNavInfo', 'enablePointerInteraction'].map(function (p) {
186
174
  return _defineProperty({}, p, bindRenderObjs.linkProp(p));
187
175
  })));
@@ -192,7 +180,7 @@ var linkedRenderObjsMethods = Object.assign.apply(Object, _toConsumableArray(['c
192
180
  screen2GraphCoords: bindRenderObjs.linkMethod('getSceneCoords')
193
181
  }])); //
194
182
 
195
- var _3dForceGraph = Kapsule__default['default']({
183
+ var _3dForceGraph = Kapsule__default["default"]({
196
184
  props: _objectSpread2(_objectSpread2({
197
185
  nodeLabel: {
198
186
  "default": 'name',
@@ -327,8 +315,8 @@ var _3dForceGraph = Kapsule__default['default']({
327
315
  rendererConfig = _ref5.rendererConfig,
328
316
  extraRenderers = _ref5.extraRenderers;
329
317
  return {
330
- forceGraph: new ThreeForceGraph__default['default'](),
331
- renderObjs: ThreeRenderObjects__default['default']({
318
+ forceGraph: new ThreeForceGraph__default["default"](),
319
+ renderObjs: ThreeRenderObjects__default["default"]({
332
320
  controlType: controlType,
333
321
  rendererConfig: rendererConfig,
334
322
  extraRenderers: extraRenderers
@@ -522,7 +510,7 @@ var _3dForceGraph = Kapsule__default['default']({
522
510
  return isNode(bObj) - isNode(aObj);
523
511
  }).tooltipContent(function (obj) {
524
512
  var graphObj = getGraphObj(obj);
525
- return graphObj ? accessorFn__default['default'](state["".concat(graphObj.__graphObjType, "Label")])(graphObj.__data) || '' : '';
513
+ return graphObj ? accessorFn__default["default"](state["".concat(graphObj.__graphObjType, "Label")])(graphObj.__data) || '' : '';
526
514
  }).hoverDuringDrag(false).onHover(function (obj) {
527
515
  // Update tooltip and trigger onHover events
528
516
  var hoverObj = getGraphObj(obj);
@@ -78,5 +78,4 @@ type ForceGraph3DInstance = ForceGraph3DGenericInstance<ForceGraph3DInstance>;
78
78
 
79
79
  declare function ForceGraph3D(configOptions?: ConfigOptions): ForceGraph3DInstance;
80
80
 
81
- export default ForceGraph3D;
82
- export { ConfigOptions, ForceGraph3DGenericInstance, ForceGraph3DInstance };
81
+ export { ConfigOptions, ForceGraph3DGenericInstance, ForceGraph3DInstance, ForceGraph3D as default };