3d-force-graph 1.74.3 → 1.74.5

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.
@@ -1,4 +1,4 @@
1
- // Version 1.74.3 3d-force-graph - https://github.com/vasturiano/3d-force-graph
1
+ // Version 1.74.5 3d-force-graph - https://github.com/vasturiano/3d-force-graph
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -35,29 +35,29 @@
35
35
  var css_248z$1 = ".graph-info-msg {\n top: 50%;\n width: 100%;\n text-align: center;\n color: lavender;\n opacity: 0.7;\n font-size: 22px;\n position: absolute;\n font-family: Sans-serif;\n}\n\n.scene-container .clickable {\n cursor: pointer;\n}\n\n.scene-container .grabbable {\n cursor: move;\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\n.scene-container .grabbable:active {\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n}";
36
36
  styleInject$1(css_248z$1);
37
37
 
38
- function _arrayLikeToArray$5(r, a) {
38
+ function _arrayLikeToArray$4(r, a) {
39
39
  (null == a || a > r.length) && (a = r.length);
40
40
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
41
41
  return n;
42
42
  }
43
- function _arrayWithoutHoles$4(r) {
44
- if (Array.isArray(r)) return _arrayLikeToArray$5(r);
43
+ function _arrayWithoutHoles$3(r) {
44
+ if (Array.isArray(r)) return _arrayLikeToArray$4(r);
45
45
  }
46
- function _defineProperty$3(e, r, t) {
47
- return (r = _toPropertyKey$4(r)) in e ? Object.defineProperty(e, r, {
46
+ function _defineProperty$2(e, r, t) {
47
+ return (r = _toPropertyKey$3(r)) in e ? Object.defineProperty(e, r, {
48
48
  value: t,
49
49
  enumerable: !0,
50
50
  configurable: !0,
51
51
  writable: !0
52
52
  }) : e[r] = t, e;
53
53
  }
54
- function _iterableToArray$4(r) {
54
+ function _iterableToArray$3(r) {
55
55
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
56
56
  }
57
- function _nonIterableSpread$4() {
57
+ function _nonIterableSpread$3() {
58
58
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
59
59
  }
60
- function ownKeys$2(e, r) {
60
+ function ownKeys$1(e, r) {
61
61
  var t = Object.keys(e);
62
62
  if (Object.getOwnPropertySymbols) {
63
63
  var o = Object.getOwnPropertySymbols(e);
@@ -67,21 +67,21 @@
67
67
  }
68
68
  return t;
69
69
  }
70
- function _objectSpread2$2(e) {
70
+ function _objectSpread2$1(e) {
71
71
  for (var r = 1; r < arguments.length; r++) {
72
72
  var t = null != arguments[r] ? arguments[r] : {};
73
- r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) {
74
- _defineProperty$3(e, r, t[r]);
75
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) {
73
+ r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) {
74
+ _defineProperty$2(e, r, t[r]);
75
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) {
76
76
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
77
77
  });
78
78
  }
79
79
  return e;
80
80
  }
81
- function _toConsumableArray$4(r) {
82
- return _arrayWithoutHoles$4(r) || _iterableToArray$4(r) || _unsupportedIterableToArray$5(r) || _nonIterableSpread$4();
81
+ function _toConsumableArray$3(r) {
82
+ return _arrayWithoutHoles$3(r) || _iterableToArray$3(r) || _unsupportedIterableToArray$4(r) || _nonIterableSpread$3();
83
83
  }
84
- function _toPrimitive$4(t, r) {
84
+ function _toPrimitive$3(t, r) {
85
85
  if ("object" != typeof t || !t) return t;
86
86
  var e = t[Symbol.toPrimitive];
87
87
  if (void 0 !== e) {
@@ -91,15 +91,15 @@
91
91
  }
92
92
  return ("string" === r ? String : Number)(t);
93
93
  }
94
- function _toPropertyKey$4(t) {
95
- var i = _toPrimitive$4(t, "string");
94
+ function _toPropertyKey$3(t) {
95
+ var i = _toPrimitive$3(t, "string");
96
96
  return "symbol" == typeof i ? i : i + "";
97
97
  }
98
- function _unsupportedIterableToArray$5(r, a) {
98
+ function _unsupportedIterableToArray$4(r, a) {
99
99
  if (r) {
100
- if ("string" == typeof r) return _arrayLikeToArray$5(r, a);
100
+ if ("string" == typeof r) return _arrayLikeToArray$4(r, a);
101
101
  var t = {}.toString.call(r).slice(8, -1);
102
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$5(r, a) : void 0;
102
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0;
103
103
  }
104
104
  }
105
105
 
@@ -26323,7 +26323,7 @@
26323
26323
 
26324
26324
  }
26325
26325
 
26326
- let _id$8 = 0;
26326
+ let _id$9 = 0;
26327
26327
 
26328
26328
  class WebGLShaderCache {
26329
26329
 
@@ -26437,7 +26437,7 @@
26437
26437
 
26438
26438
  constructor( code ) {
26439
26439
 
26440
- this.id = _id$8 ++;
26440
+ this.id = _id$9 ++;
26441
26441
 
26442
26442
  this.code = code;
26443
26443
  this.usedTimes = 0;
@@ -38984,7 +38984,7 @@ void main() {
38984
38984
  return (random() - 0.5) * 1e-6;
38985
38985
  }
38986
38986
 
38987
- function index$3(d) {
38987
+ function index$2(d) {
38988
38988
  return d.index;
38989
38989
  }
38990
38990
 
@@ -38995,7 +38995,7 @@ void main() {
38995
38995
  }
38996
38996
 
38997
38997
  function forceLink(links) {
38998
- var id = index$3,
38998
+ var id = index$2,
38999
38999
  strength = defaultStrength,
39000
39000
  strengths,
39001
39001
  distance = constant(30),
@@ -42748,23 +42748,23 @@ function InsertStackElement(node, body) {
42748
42748
  return debounced;
42749
42749
  }
42750
42750
 
42751
- function _arrayLikeToArray$4(r, a) {
42751
+ function _arrayLikeToArray$3(r, a) {
42752
42752
  (null == a || a > r.length) && (a = r.length);
42753
42753
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
42754
42754
  return n;
42755
42755
  }
42756
- function _arrayWithHoles$4(r) {
42756
+ function _arrayWithHoles$3(r) {
42757
42757
  if (Array.isArray(r)) return r;
42758
42758
  }
42759
- function _classCallCheck$1(a, n) {
42759
+ function _classCallCheck$2(a, n) {
42760
42760
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
42761
42761
  }
42762
- function _createClass$1(e, r, t) {
42762
+ function _createClass$2(e, r, t) {
42763
42763
  return Object.defineProperty(e, "prototype", {
42764
42764
  writable: !1
42765
42765
  }), e;
42766
42766
  }
42767
- function _iterableToArrayLimit$4(r, l) {
42767
+ function _iterableToArrayLimit$3(r, l) {
42768
42768
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
42769
42769
  if (null != t) {
42770
42770
  var e,
@@ -42788,34 +42788,34 @@ function InsertStackElement(node, body) {
42788
42788
  return a;
42789
42789
  }
42790
42790
  }
42791
- function _nonIterableRest$4() {
42791
+ function _nonIterableRest$3() {
42792
42792
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
42793
42793
  }
42794
- function _slicedToArray$4(r, e) {
42795
- return _arrayWithHoles$4(r) || _iterableToArrayLimit$4(r, e) || _unsupportedIterableToArray$4(r, e) || _nonIterableRest$4();
42794
+ function _slicedToArray$3(r, e) {
42795
+ return _arrayWithHoles$3(r) || _iterableToArrayLimit$3(r, e) || _unsupportedIterableToArray$3(r, e) || _nonIterableRest$3();
42796
42796
  }
42797
- function _unsupportedIterableToArray$4(r, a) {
42797
+ function _unsupportedIterableToArray$3(r, a) {
42798
42798
  if (r) {
42799
- if ("string" == typeof r) return _arrayLikeToArray$4(r, a);
42799
+ if ("string" == typeof r) return _arrayLikeToArray$3(r, a);
42800
42800
  var t = {}.toString.call(r).slice(8, -1);
42801
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0;
42801
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0;
42802
42802
  }
42803
42803
  }
42804
42804
 
42805
- var Prop = /*#__PURE__*/_createClass$1(function Prop(name, _ref) {
42805
+ var Prop = /*#__PURE__*/_createClass$2(function Prop(name, _ref) {
42806
42806
  var _ref$default = _ref["default"],
42807
42807
  defaultVal = _ref$default === void 0 ? null : _ref$default,
42808
42808
  _ref$triggerUpdate = _ref.triggerUpdate,
42809
42809
  triggerUpdate = _ref$triggerUpdate === void 0 ? true : _ref$triggerUpdate,
42810
42810
  _ref$onChange = _ref.onChange,
42811
42811
  onChange = _ref$onChange === void 0 ? function (newVal, state) {} : _ref$onChange;
42812
- _classCallCheck$1(this, Prop);
42812
+ _classCallCheck$2(this, Prop);
42813
42813
  this.name = name;
42814
42814
  this.defaultVal = defaultVal;
42815
42815
  this.triggerUpdate = triggerUpdate;
42816
42816
  this.onChange = onChange;
42817
42817
  });
42818
- function index$2 (_ref2) {
42818
+ function index$1 (_ref2) {
42819
42819
  var _ref2$stateInit = _ref2.stateInit,
42820
42820
  stateInit = _ref2$stateInit === void 0 ? function () {
42821
42821
  return {};
@@ -42915,7 +42915,7 @@ function InsertStackElement(node, body) {
42915
42915
 
42916
42916
  // Link aliases
42917
42917
  Object.entries(aliases).forEach(function (_ref4) {
42918
- var _ref5 = _slicedToArray$4(_ref4, 2),
42918
+ var _ref5 = _slicedToArray$3(_ref4, 2),
42919
42919
  alias = _ref5[0],
42920
42920
  target = _ref5[1];
42921
42921
  return comp[alias] = comp[target];
@@ -42939,7 +42939,7 @@ function InsertStackElement(node, body) {
42939
42939
  };
42940
42940
  }
42941
42941
 
42942
- var index$1 = (function (p) {
42942
+ var index = (function (p) {
42943
42943
  return typeof p === 'function' ? p // fn
42944
42944
  : typeof p === 'string' ? function (obj) {
42945
42945
  return obj[p];
@@ -43036,21 +43036,51 @@ function InsertStackElement(node, body) {
43036
43036
  return min;
43037
43037
  }
43038
43038
 
43039
- function _arrayLikeToArray$3(r, a) {
43039
+ function _arrayLikeToArray$2(r, a) {
43040
43040
  (null == a || a > r.length) && (a = r.length);
43041
43041
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
43042
43042
  return n;
43043
43043
  }
43044
- function _arrayWithHoles$3(r) {
43044
+ function _arrayWithHoles$2(r) {
43045
43045
  if (Array.isArray(r)) return r;
43046
43046
  }
43047
- function _arrayWithoutHoles$3(r) {
43048
- if (Array.isArray(r)) return _arrayLikeToArray$3(r);
43047
+ function _arrayWithoutHoles$2(r) {
43048
+ if (Array.isArray(r)) return _arrayLikeToArray$2(r);
43049
43049
  }
43050
- function _iterableToArray$3(r) {
43050
+ function _assertClassBrand$1(e, t, n) {
43051
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
43052
+ throw new TypeError("Private element is not present on this object");
43053
+ }
43054
+ function _checkPrivateRedeclaration$1(e, t) {
43055
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
43056
+ }
43057
+ function _classCallCheck$1(a, n) {
43058
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
43059
+ }
43060
+ function _classPrivateFieldGet2$1(s, a) {
43061
+ return s.get(_assertClassBrand$1(s, a));
43062
+ }
43063
+ function _classPrivateFieldInitSpec$1(e, t, a) {
43064
+ _checkPrivateRedeclaration$1(e, t), t.set(e, a);
43065
+ }
43066
+ function _classPrivateFieldSet2$1(s, a, r) {
43067
+ return s.set(_assertClassBrand$1(s, a), r), r;
43068
+ }
43069
+ function _defineProperties$1(e, r) {
43070
+ for (var t = 0; t < r.length; t++) {
43071
+ var o = r[t];
43072
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$2(o.key), o);
43073
+ }
43074
+ }
43075
+ function _createClass$1(e, r, t) {
43076
+ return r && _defineProperties$1(e.prototype, r), Object.defineProperty(e, "prototype", {
43077
+ writable: !1
43078
+ }), e;
43079
+ }
43080
+ function _iterableToArray$2(r) {
43051
43081
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
43052
43082
  }
43053
- function _iterableToArrayLimit$3(r, l) {
43083
+ function _iterableToArrayLimit$2(r, l) {
43054
43084
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
43055
43085
  if (null != t) {
43056
43086
  var e,
@@ -43074,421 +43104,137 @@ function InsertStackElement(node, body) {
43074
43104
  return a;
43075
43105
  }
43076
43106
  }
43077
- function _nonIterableRest$3() {
43107
+ function _nonIterableRest$2() {
43078
43108
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43079
43109
  }
43080
- function _nonIterableSpread$3() {
43110
+ function _nonIterableSpread$2() {
43081
43111
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43082
43112
  }
43083
- function _objectWithoutProperties$2(e, t) {
43084
- if (null == e) return {};
43085
- var o,
43086
- r,
43087
- i = _objectWithoutPropertiesLoose$2(e, t);
43088
- if (Object.getOwnPropertySymbols) {
43089
- var s = Object.getOwnPropertySymbols(e);
43090
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
43091
- }
43092
- return i;
43093
- }
43094
- function _objectWithoutPropertiesLoose$2(r, e) {
43095
- if (null == r) return {};
43096
- var t = {};
43097
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
43098
- if (e.includes(n)) continue;
43099
- t[n] = r[n];
43100
- }
43101
- return t;
43102
- }
43103
- function _slicedToArray$3(r, e) {
43104
- return _arrayWithHoles$3(r) || _iterableToArrayLimit$3(r, e) || _unsupportedIterableToArray$3(r, e) || _nonIterableRest$3();
43113
+ function _slicedToArray$2(r, e) {
43114
+ return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$2(r, e) || _nonIterableRest$2();
43105
43115
  }
43106
- function _toConsumableArray$3(r) {
43107
- return _arrayWithoutHoles$3(r) || _iterableToArray$3(r) || _unsupportedIterableToArray$3(r) || _nonIterableSpread$3();
43116
+ function _toConsumableArray$2(r) {
43117
+ return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread$2();
43108
43118
  }
43109
- function _toPrimitive$3(t, r) {
43119
+ function _toPrimitive$2(t, r) {
43110
43120
  if ("object" != typeof t || !t) return t;
43111
43121
  var e = t[Symbol.toPrimitive];
43112
43122
  if (void 0 !== e) {
43113
- var i = e.call(t, r );
43123
+ var i = e.call(t, r);
43114
43124
  if ("object" != typeof i) return i;
43115
43125
  throw new TypeError("@@toPrimitive must return a primitive value.");
43116
43126
  }
43117
43127
  return (String )(t);
43118
43128
  }
43119
- function _toPropertyKey$3(t) {
43120
- var i = _toPrimitive$3(t, "string");
43129
+ function _toPropertyKey$2(t) {
43130
+ var i = _toPrimitive$2(t, "string");
43121
43131
  return "symbol" == typeof i ? i : i + "";
43122
43132
  }
43123
- function _unsupportedIterableToArray$3(r, a) {
43133
+ function _unsupportedIterableToArray$2(r, a) {
43124
43134
  if (r) {
43125
- if ("string" == typeof r) return _arrayLikeToArray$3(r, a);
43135
+ if ("string" == typeof r) return _arrayLikeToArray$2(r, a);
43126
43136
  var t = {}.toString.call(r).slice(8, -1);
43127
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0;
43137
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0;
43128
43138
  }
43129
43139
  }
43130
43140
 
43131
- var index = (function () {
43132
- var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
43133
- var keyAccessors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
43134
- var multiItem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
43135
- var flattenKeys = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
43136
- var keys = (keyAccessors instanceof Array ? keyAccessors.length ? keyAccessors : [undefined] : [keyAccessors]).map(function (key) {
43137
- return {
43138
- keyAccessor: key,
43139
- isProp: !(key instanceof Function)
43140
- };
43141
- });
43142
- var indexedResult = list.reduce(function (res, item) {
43143
- var iterObj = res;
43144
- var itemVal = item;
43145
- keys.forEach(function (_ref, idx) {
43146
- var keyAccessor = _ref.keyAccessor,
43147
- isProp = _ref.isProp;
43148
- var key;
43149
- if (isProp) {
43150
- var _itemVal = itemVal,
43151
- propVal = _itemVal[keyAccessor],
43152
- rest = _objectWithoutProperties$2(_itemVal, [keyAccessor].map(_toPropertyKey$3));
43153
- key = propVal;
43154
- itemVal = rest;
43155
- } else {
43156
- key = keyAccessor(itemVal, idx);
43157
- }
43158
- if (idx + 1 < keys.length) {
43159
- if (!iterObj.hasOwnProperty(key)) {
43160
- iterObj[key] = {};
43161
- }
43162
- iterObj = iterObj[key];
43163
- } else {
43164
- // Leaf key
43165
- if (multiItem) {
43166
- if (!iterObj.hasOwnProperty(key)) {
43167
- iterObj[key] = [];
43168
- }
43169
- iterObj[key].push(itemVal);
43170
- } else {
43171
- iterObj[key] = itemVal;
43172
- }
43173
- }
43141
+ var _dataMap = /*#__PURE__*/new WeakMap();
43142
+ var _objMap = /*#__PURE__*/new WeakMap();
43143
+ var _id$8 = /*#__PURE__*/new WeakMap();
43144
+ var _createObj = /*#__PURE__*/new WeakMap();
43145
+ var _updateObj = /*#__PURE__*/new WeakMap();
43146
+ var _removeObj = /*#__PURE__*/new WeakMap();
43147
+ var DataBindMapper = /*#__PURE__*/function () {
43148
+ function DataBindMapper() {
43149
+ _classCallCheck$1(this, DataBindMapper);
43150
+ _classPrivateFieldInitSpec$1(this, _dataMap, new Map());
43151
+ _classPrivateFieldInitSpec$1(this, _objMap, new Map());
43152
+ _classPrivateFieldInitSpec$1(this, _id$8, function (d) {
43153
+ return d;
43174
43154
  });
43175
- return res;
43176
- }, {});
43177
- if (multiItem instanceof Function) {
43178
- // Reduce leaf multiple values
43179
- (function reduce(node) {
43180
- var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
43181
- if (level === keys.length) {
43182
- Object.keys(node).forEach(function (k) {
43183
- return node[k] = multiItem(node[k]);
43184
- });
43185
- } else {
43186
- Object.values(node).forEach(function (child) {
43187
- return reduce(child, level + 1);
43188
- });
43189
- }
43190
- })(indexedResult); // IIFE
43155
+ _classPrivateFieldInitSpec$1(this, _createObj, function () {
43156
+ return {};
43157
+ });
43158
+ _classPrivateFieldInitSpec$1(this, _updateObj, function () {});
43159
+ _classPrivateFieldInitSpec$1(this, _removeObj, function () {});
43191
43160
  }
43192
- var result = indexedResult;
43193
- if (flattenKeys) {
43194
- // flatten into array
43195
- result = [];
43196
- (function flatten(node) {
43197
- var accKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
43198
- if (accKeys.length === keys.length) {
43199
- result.push({
43200
- keys: accKeys,
43201
- vals: node
43202
- });
43203
- } else {
43204
- Object.entries(node).forEach(function (_ref2) {
43205
- var _ref3 = _slicedToArray$3(_ref2, 2),
43206
- key = _ref3[0],
43207
- val = _ref3[1];
43208
- return flatten(val, [].concat(_toConsumableArray$3(accKeys), [key]));
43209
- });
43210
- }
43211
- })(indexedResult); //IIFE
43212
-
43213
- if (keyAccessors instanceof Array && keyAccessors.length === 0 && result.length === 1) {
43214
- // clear keys if there's no key accessors (single result)
43215
- result[0].keys = [];
43161
+ return _createClass$1(DataBindMapper, [{
43162
+ key: "getObj",
43163
+ value: function getObj(d) {
43164
+ return _classPrivateFieldGet2$1(_dataMap, this).get(_classPrivateFieldGet2$1(_id$8, this).call(this, d));
43216
43165
  }
43217
- }
43218
- return result;
43219
- });
43220
-
43221
- function _iterableToArrayLimit$2(arr, i) {
43222
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
43223
- if (null != _i) {
43224
- var _s,
43225
- _e,
43226
- _x,
43227
- _r,
43228
- _arr = [],
43229
- _n = !0,
43230
- _d = !1;
43231
- try {
43232
- if (_x = (_i = _i.call(arr)).next, 0 === i) ; else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
43233
- } catch (err) {
43234
- _d = !0, _e = err;
43235
- } finally {
43236
- try {
43237
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
43238
- } finally {
43239
- if (_d) throw _e;
43240
- }
43166
+ }, {
43167
+ key: "getData",
43168
+ value: function getData(o) {
43169
+ return _classPrivateFieldGet2$1(_objMap, this).get(o);
43241
43170
  }
43242
- return _arr;
43243
- }
43244
- }
43245
- function ownKeys$1(object, enumerableOnly) {
43246
- var keys = Object.keys(object);
43247
- if (Object.getOwnPropertySymbols) {
43248
- var symbols = Object.getOwnPropertySymbols(object);
43249
- enumerableOnly && (symbols = symbols.filter(function (sym) {
43250
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
43251
- })), keys.push.apply(keys, symbols);
43252
- }
43253
- return keys;
43254
- }
43255
- function _objectSpread2$1(target) {
43256
- for (var i = 1; i < arguments.length; i++) {
43257
- var source = null != arguments[i] ? arguments[i] : {};
43258
- i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
43259
- _defineProperty$2(target, key, source[key]);
43260
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
43261
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
43262
- });
43263
- }
43264
- return target;
43265
- }
43266
- function _defineProperty$2(obj, key, value) {
43267
- key = _toPropertyKey$2(key);
43268
- if (key in obj) {
43269
- Object.defineProperty(obj, key, {
43270
- value: value,
43271
- enumerable: true,
43272
- configurable: true,
43273
- writable: true
43274
- });
43275
- } else {
43276
- obj[key] = value;
43277
- }
43278
- return obj;
43279
- }
43280
- function _objectWithoutPropertiesLoose$1(source, excluded) {
43281
- if (source == null) return {};
43282
- var target = {};
43283
- var sourceKeys = Object.keys(source);
43284
- var key, i;
43285
- for (i = 0; i < sourceKeys.length; i++) {
43286
- key = sourceKeys[i];
43287
- if (excluded.indexOf(key) >= 0) continue;
43288
- target[key] = source[key];
43289
- }
43290
- return target;
43291
- }
43292
- function _objectWithoutProperties$1(source, excluded) {
43293
- if (source == null) return {};
43294
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
43295
- var key, i;
43296
- if (Object.getOwnPropertySymbols) {
43297
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
43298
- for (i = 0; i < sourceSymbolKeys.length; i++) {
43299
- key = sourceSymbolKeys[i];
43300
- if (excluded.indexOf(key) >= 0) continue;
43301
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
43302
- target[key] = source[key];
43171
+ }, {
43172
+ key: "entries",
43173
+ value: function entries() {
43174
+ return _toConsumableArray$2(_classPrivateFieldGet2$1(_objMap, this).entries()).map(function (_ref) {
43175
+ var _ref2 = _slicedToArray$2(_ref, 2),
43176
+ o = _ref2[0],
43177
+ d = _ref2[1];
43178
+ return [d, o];
43179
+ });
43303
43180
  }
43304
- }
43305
- return target;
43306
- }
43307
- function _slicedToArray$2(arr, i) {
43308
- return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest$2();
43309
- }
43310
- function _toConsumableArray$2(arr) {
43311
- return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread$2();
43312
- }
43313
- function _arrayWithoutHoles$2(arr) {
43314
- if (Array.isArray(arr)) return _arrayLikeToArray$2(arr);
43315
- }
43316
- function _arrayWithHoles$2(arr) {
43317
- if (Array.isArray(arr)) return arr;
43318
- }
43319
- function _iterableToArray$2(iter) {
43320
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
43321
- }
43322
- function _unsupportedIterableToArray$2(o, minLen) {
43323
- if (!o) return;
43324
- if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
43325
- var n = Object.prototype.toString.call(o).slice(8, -1);
43326
- if (n === "Object" && o.constructor) n = o.constructor.name;
43327
- if (n === "Map" || n === "Set") return Array.from(o);
43328
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
43329
- }
43330
- function _arrayLikeToArray$2(arr, len) {
43331
- if (len == null || len > arr.length) len = arr.length;
43332
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
43333
- return arr2;
43334
- }
43335
- function _nonIterableSpread$2() {
43336
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43337
- }
43338
- function _nonIterableRest$2() {
43339
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
43340
- }
43341
- function _toPrimitive$2(input, hint) {
43342
- if (typeof input !== "object" || input === null) return input;
43343
- var prim = input[Symbol.toPrimitive];
43344
- if (prim !== undefined) {
43345
- var res = prim.call(input, hint || "default");
43346
- if (typeof res !== "object") return res;
43347
- throw new TypeError("@@toPrimitive must return a primitive value.");
43348
- }
43349
- return (hint === "string" ? String : Number)(input);
43350
- }
43351
- function _toPropertyKey$2(arg) {
43352
- var key = _toPrimitive$2(arg, "string");
43353
- return typeof key === "symbol" ? key : String(key);
43354
- }
43355
-
43356
- var _excluded$1 = ["createObj", "updateObj", "exitObj", "objBindAttr", "dataBindAttr"];
43357
- function diffArrays(prev, next, idAccessor) {
43358
- var result = {
43359
- enter: [],
43360
- update: [],
43361
- exit: []
43362
- };
43363
- if (!idAccessor) {
43364
- // use object references for comparison
43365
- var prevSet = new Set(prev);
43366
- var nextSet = new Set(next);
43367
- new Set([].concat(_toConsumableArray$2(prevSet), _toConsumableArray$2(nextSet))).forEach(function (item) {
43368
- var type = !prevSet.has(item) ? 'enter' : !nextSet.has(item) ? 'exit' : 'update';
43369
- result[type].push(type === 'update' ? [item, item] : item);
43370
- });
43371
- } else {
43372
- // compare by id (duplicate keys are ignored)
43373
- var prevById = index(prev, idAccessor, false);
43374
- var nextById = index(next, idAccessor, false);
43375
- var byId = Object.assign({}, prevById, nextById);
43376
- Object.entries(byId).forEach(function (_ref) {
43377
- var _ref2 = _slicedToArray$2(_ref, 2),
43378
- id = _ref2[0],
43379
- item = _ref2[1];
43380
- var type = !prevById.hasOwnProperty(id) ? 'enter' : !nextById.hasOwnProperty(id) ? 'exit' : 'update';
43381
- result[type].push(type === 'update' ? [prevById[id], nextById[id]] : item);
43382
- });
43383
- }
43384
- return result;
43385
- }
43386
- function dataBindDiff(data, existingObjs, _ref3) {
43387
- var _ref3$objBindAttr = _ref3.objBindAttr,
43388
- objBindAttr = _ref3$objBindAttr === void 0 ? '__obj' : _ref3$objBindAttr,
43389
- _ref3$dataBindAttr = _ref3.dataBindAttr,
43390
- dataBindAttr = _ref3$dataBindAttr === void 0 ? '__data' : _ref3$dataBindAttr,
43391
- idAccessor = _ref3.idAccessor,
43392
- _ref3$purge = _ref3.purge,
43393
- purge = _ref3$purge === void 0 ? false : _ref3$purge;
43394
- var isObjValid = function isObjValid(obj) {
43395
- return obj.hasOwnProperty(dataBindAttr);
43396
- };
43397
- var removeObjs = existingObjs.filter(function (obj) {
43398
- return !isObjValid(obj);
43399
- });
43400
- var prevD = existingObjs.filter(isObjValid).map(function (obj) {
43401
- return obj[dataBindAttr];
43402
- });
43403
- var nextD = data;
43404
- var diff = purge ? {
43405
- enter: nextD,
43406
- exit: prevD,
43407
- update: []
43408
- } // don't diff data in purge mode
43409
- : diffArrays(prevD, nextD, idAccessor);
43410
- diff.update = diff.update.map(function (_ref4) {
43411
- var _ref5 = _slicedToArray$2(_ref4, 2),
43412
- prevD = _ref5[0],
43413
- nextD = _ref5[1];
43414
- if (prevD !== nextD) {
43415
- // transfer obj to new data point (if different)
43416
- nextD[objBindAttr] = prevD[objBindAttr];
43417
- nextD[objBindAttr][dataBindAttr] = nextD;
43181
+ }, {
43182
+ key: "id",
43183
+ value: function id(p) {
43184
+ _classPrivateFieldSet2$1(_id$8, this, index(p));
43185
+ return this;
43418
43186
  }
43419
- return nextD;
43420
- });
43421
- diff.exit = diff.exit.concat(removeObjs.map(function (obj) {
43422
- return _defineProperty$2({}, objBindAttr, obj);
43423
- }));
43424
- return diff;
43425
- }
43426
- function viewDigest(data, existingObjs,
43427
- // list
43428
- appendObj,
43429
- // item => {...} function
43430
- removeObj, // item => {...} function
43431
- _ref7) {
43432
- var _ref7$createObj = _ref7.createObj,
43433
- createObj = _ref7$createObj === void 0 ? function (d) {
43434
- return {};
43435
- } : _ref7$createObj,
43436
- _ref7$updateObj = _ref7.updateObj,
43437
- updateObj = _ref7$updateObj === void 0 ? function (obj, d) {} : _ref7$updateObj,
43438
- _ref7$exitObj = _ref7.exitObj,
43439
- exitObj = _ref7$exitObj === void 0 ? function (obj) {} : _ref7$exitObj,
43440
- _ref7$objBindAttr = _ref7.objBindAttr,
43441
- objBindAttr = _ref7$objBindAttr === void 0 ? '__obj' : _ref7$objBindAttr,
43442
- _ref7$dataBindAttr = _ref7.dataBindAttr,
43443
- dataBindAttr = _ref7$dataBindAttr === void 0 ? '__data' : _ref7$dataBindAttr,
43444
- dataDiffOptions = _objectWithoutProperties$1(_ref7, _excluded$1);
43445
- var _dataBindDiff = dataBindDiff(data, existingObjs, _objectSpread2$1({
43446
- objBindAttr: objBindAttr,
43447
- dataBindAttr: dataBindAttr
43448
- }, dataDiffOptions)),
43449
- enter = _dataBindDiff.enter,
43450
- update = _dataBindDiff.update,
43451
- exit = _dataBindDiff.exit;
43452
-
43453
- // Remove exiting points
43454
- exit.forEach(function (d) {
43455
- var obj = d[objBindAttr];
43456
- delete d[objBindAttr]; // unbind obj
43457
-
43458
- exitObj(obj);
43459
- removeObj(obj);
43460
- });
43461
- var newObjs = createObjs(enter);
43462
- var pointsData = [].concat(_toConsumableArray$2(enter), _toConsumableArray$2(update));
43463
- updateObjs(pointsData);
43464
-
43465
- // Add new points
43466
- newObjs.forEach(appendObj);
43467
-
43468
- //
43469
-
43470
- function createObjs(data) {
43471
- var newObjs = [];
43472
- data.forEach(function (d) {
43473
- var obj = createObj(d);
43474
- if (obj) {
43475
- obj[dataBindAttr] = d;
43476
- d[objBindAttr] = obj;
43477
- newObjs.push(obj);
43478
- }
43479
- });
43480
- return newObjs;
43481
- }
43482
- function updateObjs(data) {
43483
- data.forEach(function (d) {
43484
- var obj = d[objBindAttr];
43485
- if (obj) {
43486
- obj[dataBindAttr] = d;
43487
- updateObj(obj, d);
43488
- }
43489
- });
43490
- }
43491
- }
43187
+ }, {
43188
+ key: "onCreateObj",
43189
+ value: function onCreateObj(fn) {
43190
+ _classPrivateFieldSet2$1(_createObj, this, fn);
43191
+ return this;
43192
+ }
43193
+ }, {
43194
+ key: "onUpdateObj",
43195
+ value: function onUpdateObj(fn) {
43196
+ _classPrivateFieldSet2$1(_updateObj, this, fn);
43197
+ return this;
43198
+ }
43199
+ }, {
43200
+ key: "onRemoveObj",
43201
+ value: function onRemoveObj(fn) {
43202
+ _classPrivateFieldSet2$1(_removeObj, this, fn);
43203
+ return this;
43204
+ }
43205
+ }, {
43206
+ key: "digest",
43207
+ value: function digest(data) {
43208
+ var _this = this;
43209
+ data.filter(function (d) {
43210
+ return !_classPrivateFieldGet2$1(_dataMap, _this).has(_classPrivateFieldGet2$1(_id$8, _this).call(_this, d));
43211
+ }).forEach(function (d) {
43212
+ var obj = _classPrivateFieldGet2$1(_createObj, _this).call(_this, d);
43213
+ _classPrivateFieldGet2$1(_dataMap, _this).set(_classPrivateFieldGet2$1(_id$8, _this).call(_this, d), obj);
43214
+ _classPrivateFieldGet2$1(_objMap, _this).set(obj, d);
43215
+ });
43216
+ var dataIdsMap = new Map(data.map(function (d) {
43217
+ return [_classPrivateFieldGet2$1(_id$8, _this).call(_this, d), d];
43218
+ }));
43219
+ _classPrivateFieldGet2$1(_dataMap, this).forEach(function (o, dId) {
43220
+ if (!dataIdsMap.has(dId)) {
43221
+ _classPrivateFieldGet2$1(_removeObj, _this).call(_this, o, dId);
43222
+ _classPrivateFieldGet2$1(_dataMap, _this)["delete"](dId);
43223
+ _classPrivateFieldGet2$1(_objMap, _this)["delete"](o);
43224
+ } else {
43225
+ _classPrivateFieldGet2$1(_updateObj, _this).call(_this, o, dataIdsMap.get(dId));
43226
+ }
43227
+ });
43228
+ return this;
43229
+ }
43230
+ }, {
43231
+ key: "clear",
43232
+ value: function clear() {
43233
+ this.digest([]);
43234
+ return this;
43235
+ }
43236
+ }]);
43237
+ }();
43492
43238
 
43493
43239
  function initRange(domain, range) {
43494
43240
  switch (arguments.length) {
@@ -44741,6 +44487,10 @@ function InsertStackElement(node, body) {
44741
44487
  function _arrayWithoutHoles$1(r) {
44742
44488
  if (Array.isArray(r)) return _arrayLikeToArray$1(r);
44743
44489
  }
44490
+ function _assertClassBrand(e, t, n) {
44491
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
44492
+ throw new TypeError("Private element is not present on this object");
44493
+ }
44744
44494
  function _assertThisInitialized$1(e) {
44745
44495
  if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
44746
44496
  return e;
@@ -44748,9 +44498,21 @@ function InsertStackElement(node, body) {
44748
44498
  function _callSuper(t, o, e) {
44749
44499
  return o = _getPrototypeOf$1(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$1() ? Reflect.construct(o, e || [], _getPrototypeOf$1(t).constructor) : o.apply(t, e));
44750
44500
  }
44501
+ function _checkPrivateRedeclaration(e, t) {
44502
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
44503
+ }
44751
44504
  function _classCallCheck(a, n) {
44752
44505
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
44753
44506
  }
44507
+ function _classPrivateFieldGet2(s, a) {
44508
+ return s.get(_assertClassBrand(s, a));
44509
+ }
44510
+ function _classPrivateFieldInitSpec(e, t, a) {
44511
+ _checkPrivateRedeclaration(e, t), t.set(e, a);
44512
+ }
44513
+ function _classPrivateFieldSet2(s, a, r) {
44514
+ return s.set(_assertClassBrand(s, a), r), r;
44515
+ }
44754
44516
  function _construct$1(t, e, r) {
44755
44517
  if (_isNativeReflectConstruct$1()) return Reflect.construct.apply(null, arguments);
44756
44518
  var o = [null];
@@ -44758,8 +44520,14 @@ function InsertStackElement(node, body) {
44758
44520
  var p = new (t.bind.apply(t, o))();
44759
44521
  return p;
44760
44522
  }
44523
+ function _defineProperties(e, r) {
44524
+ for (var t = 0; t < r.length; t++) {
44525
+ var o = r[t];
44526
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$1(o.key), o);
44527
+ }
44528
+ }
44761
44529
  function _createClass(e, r, t) {
44762
- return Object.defineProperty(e, "prototype", {
44530
+ return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
44763
44531
  writable: !1
44764
44532
  }), e;
44765
44533
  }
@@ -44771,6 +44539,15 @@ function InsertStackElement(node, body) {
44771
44539
  writable: !0
44772
44540
  }) : e[r] = t, e;
44773
44541
  }
44542
+ function _get() {
44543
+ return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
44544
+ var p = _superPropBase(e, t);
44545
+ if (p) {
44546
+ var n = Object.getOwnPropertyDescriptor(p, t);
44547
+ return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;
44548
+ }
44549
+ }, _get.apply(null, arguments);
44550
+ }
44774
44551
  function _getPrototypeOf$1(t) {
44775
44552
  return _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
44776
44553
  return t.__proto__ || Object.getPrototypeOf(t);
@@ -44850,26 +44627,6 @@ function InsertStackElement(node, body) {
44850
44627
  }
44851
44628
  return e;
44852
44629
  }
44853
- function _objectWithoutProperties(e, t) {
44854
- if (null == e) return {};
44855
- var o,
44856
- r,
44857
- i = _objectWithoutPropertiesLoose(e, t);
44858
- if (Object.getOwnPropertySymbols) {
44859
- var s = Object.getOwnPropertySymbols(e);
44860
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
44861
- }
44862
- return i;
44863
- }
44864
- function _objectWithoutPropertiesLoose(r, e) {
44865
- if (null == r) return {};
44866
- var t = {};
44867
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
44868
- if (e.includes(n)) continue;
44869
- t[n] = r[n];
44870
- }
44871
- return t;
44872
- }
44873
44630
  function _possibleConstructorReturn(t, e) {
44874
44631
  if (e && ("object" == typeof e || "function" == typeof e)) return e;
44875
44632
  if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
@@ -44883,6 +44640,16 @@ function InsertStackElement(node, body) {
44883
44640
  function _slicedToArray$1(r, e) {
44884
44641
  return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest$1();
44885
44642
  }
44643
+ function _superPropBase(t, o) {
44644
+ for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf$1(t)););
44645
+ return t;
44646
+ }
44647
+ function _superPropGet(t, o, e, r) {
44648
+ var p = _get(_getPrototypeOf$1(t.prototype ), o, e);
44649
+ return "function" == typeof p ? function (t) {
44650
+ return p.apply(e, t);
44651
+ } : p;
44652
+ }
44886
44653
  function _toConsumableArray$1(r) {
44887
44654
  return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1();
44888
44655
  }
@@ -44949,23 +44716,56 @@ function InsertStackElement(node, body) {
44949
44716
  }
44950
44717
  };
44951
44718
 
44952
- var _excluded = ["objFilter"];
44953
- function threeDigest(data, scene) {
44954
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
44955
- _ref$objFilter = _ref.objFilter,
44956
- objFilter = _ref$objFilter === void 0 ? function () {
44957
- return true;
44958
- } : _ref$objFilter,
44959
- options = _objectWithoutProperties(_ref, _excluded);
44960
- return viewDigest(data, scene.children.filter(objFilter), function (obj) {
44961
- return scene.add(obj);
44962
- }, function (obj) {
44963
- scene.remove(obj);
44964
- emptyObject(obj);
44965
- }, _objectSpread2({
44966
- objBindAttr: '__threeObj'
44967
- }, options));
44968
- }
44719
+ var _dataBindAttr = /*#__PURE__*/new WeakMap();
44720
+ var _objBindAttr = /*#__PURE__*/new WeakMap();
44721
+ var ThreeDigest = /*#__PURE__*/function (_DataBindMapper) {
44722
+ function ThreeDigest(scene) {
44723
+ var _this;
44724
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
44725
+ _ref$dataBindAttr = _ref.dataBindAttr,
44726
+ dataBindAttr = _ref$dataBindAttr === void 0 ? '__data' : _ref$dataBindAttr,
44727
+ _ref$objBindAttr = _ref.objBindAttr,
44728
+ objBindAttr = _ref$objBindAttr === void 0 ? '__threeObj' : _ref$objBindAttr;
44729
+ _classCallCheck(this, ThreeDigest);
44730
+ _this = _callSuper(this, ThreeDigest);
44731
+ _defineProperty$1(_this, "scene", void 0);
44732
+ _classPrivateFieldInitSpec(_this, _dataBindAttr, void 0);
44733
+ _classPrivateFieldInitSpec(_this, _objBindAttr, void 0);
44734
+ _this.scene = scene;
44735
+ _classPrivateFieldSet2(_dataBindAttr, _this, dataBindAttr);
44736
+ _classPrivateFieldSet2(_objBindAttr, _this, objBindAttr);
44737
+ _this.onRemoveObj(function () {});
44738
+ return _this;
44739
+ }
44740
+ _inherits(ThreeDigest, _DataBindMapper);
44741
+ return _createClass(ThreeDigest, [{
44742
+ key: "onCreateObj",
44743
+ value: function onCreateObj(fn) {
44744
+ var _this2 = this;
44745
+ _superPropGet(ThreeDigest, "onCreateObj", this)([function (d) {
44746
+ var obj = fn(d);
44747
+ d[_classPrivateFieldGet2(_objBindAttr, _this2)] = obj;
44748
+ obj[_classPrivateFieldGet2(_dataBindAttr, _this2)] = d;
44749
+ _this2.scene.add(obj);
44750
+ return obj;
44751
+ }]);
44752
+ return this;
44753
+ }
44754
+ }, {
44755
+ key: "onRemoveObj",
44756
+ value: function onRemoveObj(fn) {
44757
+ var _this3 = this;
44758
+ _superPropGet(ThreeDigest, "onRemoveObj", this)([function (obj, dId) {
44759
+ var d = _superPropGet(ThreeDigest, "getData", _this3)([obj]);
44760
+ fn(obj, dId);
44761
+ _this3.scene.remove(obj);
44762
+ emptyObject(obj);
44763
+ delete d[_classPrivateFieldGet2(_objBindAttr, _this3)];
44764
+ }]);
44765
+ return this;
44766
+ }
44767
+ }]);
44768
+ }(DataBindMapper);
44969
44769
 
44970
44770
  var colorStr2Hex = function colorStr2Hex(str) {
44971
44771
  return isNaN(str) ? parseInt(tinycolor(str).toHex(), 16) : str;
@@ -45099,7 +44899,7 @@ function InsertStackElement(node, body) {
45099
44899
  // support multiple method names for backwards threejs compatibility
45100
44900
  var setAttributeFn = new three$1$1.BufferGeometry().setAttribute ? 'setAttribute' : 'addAttribute';
45101
44901
  var applyMatrix4Fn = new three$1$1.BufferGeometry().applyMatrix4 ? 'applyMatrix4' : 'applyMatrix';
45102
- var ForceGraph = index$2({
44902
+ var ForceGraph = index$1({
45103
44903
  props: {
45104
44904
  jsonUrl: {
45105
44905
  onChange: function onChange(jsonUrl, state) {
@@ -45393,11 +45193,13 @@ function InsertStackElement(node, body) {
45393
45193
  state.layout[isD3Sim ? 'tick' : 'step'](); // Tick it
45394
45194
  state.onEngineTick();
45395
45195
  }
45396
- var nodeThreeObjectExtendAccessor = index$1(state.nodeThreeObjectExtend);
45196
+ var nodeThreeObjectExtendAccessor = index(state.nodeThreeObjectExtend);
45397
45197
 
45398
45198
  // Update nodes position
45399
- state.graphData.nodes.forEach(function (node) {
45400
- var obj = node.__threeObj;
45199
+ state.nodeDataMapper.entries().forEach(function (_ref) {
45200
+ var _ref2 = _slicedToArray$1(_ref, 2),
45201
+ node = _ref2[0],
45202
+ obj = _ref2[1];
45401
45203
  if (!obj) return;
45402
45204
  var pos = isD3Sim ? node : state.layout.getNodePosition(node[state.nodeId]);
45403
45205
  var extendedObj = nodeThreeObjectExtendAccessor(node);
@@ -45414,12 +45216,14 @@ function InsertStackElement(node, body) {
45414
45216
  });
45415
45217
 
45416
45218
  // Update links position
45417
- var linkWidthAccessor = index$1(state.linkWidth);
45418
- var linkCurvatureAccessor = index$1(state.linkCurvature);
45419
- var linkCurveRotationAccessor = index$1(state.linkCurveRotation);
45420
- var linkThreeObjectExtendAccessor = index$1(state.linkThreeObjectExtend);
45421
- state.graphData.links.forEach(function (link) {
45422
- var lineObj = link.__lineObj;
45219
+ var linkWidthAccessor = index(state.linkWidth);
45220
+ var linkCurvatureAccessor = index(state.linkCurvature);
45221
+ var linkCurveRotationAccessor = index(state.linkCurveRotation);
45222
+ var linkThreeObjectExtendAccessor = index(state.linkThreeObjectExtend);
45223
+ state.linkDataMapper.entries().forEach(function (_ref3) {
45224
+ var _ref4 = _slicedToArray$1(_ref3, 2),
45225
+ link = _ref4[0],
45226
+ lineObj = _ref4[1];
45423
45227
  if (!lineObj) return;
45424
45228
  var pos = isD3Sim ? link : state.layout.getLinkPosition(state.layout.graph.getLink(link.source, link.target).id);
45425
45229
  var start = pos[isD3Sim ? 'source' : 'from'];
@@ -45556,11 +45360,13 @@ function InsertStackElement(node, body) {
45556
45360
  }
45557
45361
  function updateArrows() {
45558
45362
  // update link arrow position
45559
- var arrowRelPosAccessor = index$1(state.linkDirectionalArrowRelPos);
45560
- var arrowLengthAccessor = index$1(state.linkDirectionalArrowLength);
45561
- var nodeValAccessor = index$1(state.nodeVal);
45562
- state.graphData.links.forEach(function (link) {
45563
- var arrowObj = link.__arrowObj;
45363
+ var arrowRelPosAccessor = index(state.linkDirectionalArrowRelPos);
45364
+ var arrowLengthAccessor = index(state.linkDirectionalArrowLength);
45365
+ var nodeValAccessor = index(state.nodeVal);
45366
+ state.arrowDataMapper.entries().forEach(function (_ref5) {
45367
+ var _ref6 = _slicedToArray$1(_ref5, 2),
45368
+ link = _ref6[0],
45369
+ arrowObj = _ref6[1];
45564
45370
  if (!arrowObj) return;
45565
45371
  var pos = isD3Sim ? link : state.layout.getLinkPosition(state.layout.graph.getLink(link.source, link.target).id);
45566
45372
  var start = pos[isD3Sim ? 'source' : 'from'];
@@ -45605,9 +45411,10 @@ function InsertStackElement(node, body) {
45605
45411
  }
45606
45412
  function updatePhotons() {
45607
45413
  // update link particle positions
45608
- var particleSpeedAccessor = index$1(state.linkDirectionalParticleSpeed);
45414
+ var particleSpeedAccessor = index(state.linkDirectionalParticleSpeed);
45609
45415
  state.graphData.links.forEach(function (link) {
45610
- var cyclePhotons = link.__photonsObj && link.__photonsObj.children;
45416
+ var photonsObj = state.particlesDataMapper.getObj(link);
45417
+ var cyclePhotons = photonsObj && photonsObj.children;
45611
45418
  var singleHopPhotons = link.__singleHopPhotonsObj && link.__singleHopPhotonsObj.children;
45612
45419
  if ((!singleHopPhotons || !singleHopPhotons.length) && (!cyclePhotons || !cyclePhotons.length)) return;
45613
45420
  var pos = isD3Sim ? link : state.layout.getLinkPosition(state.layout.graph.getLink(link.source, link.target).id);
@@ -45664,12 +45471,12 @@ function InsertStackElement(node, body) {
45664
45471
  link.__singleHopPhotonsObj = obj;
45665
45472
  state.graphScene.add(obj);
45666
45473
  }
45667
- var particleWidthAccessor = index$1(state.linkDirectionalParticleWidth);
45474
+ var particleWidthAccessor = index(state.linkDirectionalParticleWidth);
45668
45475
  var photonR = Math.ceil(particleWidthAccessor(link) * 10) / 10 / 2;
45669
45476
  var numSegments = state.linkDirectionalParticleResolution;
45670
45477
  var particleGeometry = new three$1$1.SphereGeometry(photonR, numSegments, numSegments);
45671
- var linkColorAccessor = index$1(state.linkColor);
45672
- var particleColorAccessor = index$1(state.linkDirectionalParticleColor);
45478
+ var linkColorAccessor = index(state.linkColor);
45479
+ var particleColorAccessor = index(state.linkDirectionalParticleColor);
45673
45480
  var photonColor = particleColorAccessor(link) || linkColorAccessor(link) || '#f0f0f0';
45674
45481
  var materialColor = new three$1$1.Color(colorStr2Hex(photonColor));
45675
45482
  var opacity = state.linkOpacity * 3;
@@ -45725,6 +45532,18 @@ function InsertStackElement(node, body) {
45725
45532
  init: function init(threeObj, state) {
45726
45533
  // Main three object to manipulate
45727
45534
  state.graphScene = threeObj;
45535
+ state.nodeDataMapper = new ThreeDigest(threeObj, {
45536
+ objBindAttr: '__threeObj'
45537
+ });
45538
+ state.linkDataMapper = new ThreeDigest(threeObj, {
45539
+ objBindAttr: '__lineObj'
45540
+ });
45541
+ state.arrowDataMapper = new ThreeDigest(threeObj, {
45542
+ objBindAttr: '__arrowObj'
45543
+ });
45544
+ state.particlesDataMapper = new ThreeDigest(threeObj, {
45545
+ objBindAttr: '__photonsObj'
45546
+ });
45728
45547
  },
45729
45548
  update: function update(state, changedProps) {
45730
45549
  var hasAnyPropChanged = function hasAnyPropChanged(propList) {
@@ -45733,95 +45552,89 @@ function InsertStackElement(node, body) {
45733
45552
  });
45734
45553
  };
45735
45554
  state.engineRunning = false; // pause simulation
45736
- state.onUpdate();
45555
+ typeof state.onUpdate === "function" && state.onUpdate();
45737
45556
  if (state.nodeAutoColorBy !== null && hasAnyPropChanged(['nodeAutoColorBy', 'graphData', 'nodeColor'])) {
45738
45557
  // Auto add color to uncolored nodes
45739
- autoColorObjects(state.graphData.nodes, index$1(state.nodeAutoColorBy), state.nodeColor);
45558
+ autoColorObjects(state.graphData.nodes, index(state.nodeAutoColorBy), state.nodeColor);
45740
45559
  }
45741
45560
  if (state.linkAutoColorBy !== null && hasAnyPropChanged(['linkAutoColorBy', 'graphData', 'linkColor'])) {
45742
45561
  // Auto add color to uncolored links
45743
- autoColorObjects(state.graphData.links, index$1(state.linkAutoColorBy), state.linkColor);
45562
+ autoColorObjects(state.graphData.links, index(state.linkAutoColorBy), state.linkColor);
45744
45563
  }
45745
45564
 
45746
45565
  // Digest nodes WebGL objects
45747
45566
  if (state._flushObjects || hasAnyPropChanged(['graphData', 'nodeThreeObject', 'nodeThreeObjectExtend', 'nodeVal', 'nodeColor', 'nodeVisibility', 'nodeRelSize', 'nodeResolution', 'nodeOpacity'])) {
45748
- var customObjectAccessor = index$1(state.nodeThreeObject);
45749
- var customObjectExtendAccessor = index$1(state.nodeThreeObjectExtend);
45750
- var valAccessor = index$1(state.nodeVal);
45751
- var colorAccessor = index$1(state.nodeColor);
45752
- var visibilityAccessor = index$1(state.nodeVisibility);
45567
+ var customObjectAccessor = index(state.nodeThreeObject);
45568
+ var customObjectExtendAccessor = index(state.nodeThreeObjectExtend);
45569
+ var valAccessor = index(state.nodeVal);
45570
+ var colorAccessor = index(state.nodeColor);
45571
+ var visibilityAccessor = index(state.nodeVisibility);
45753
45572
  var sphereGeometries = {}; // indexed by node value
45754
45573
  var sphereMaterials = {}; // indexed by color
45755
45574
 
45756
- threeDigest(state.graphData.nodes.filter(visibilityAccessor), state.graphScene, {
45757
- purge: state._flushObjects || hasAnyPropChanged([
45758
- // recreate objects if any of these props have changed
45759
- 'nodeThreeObject', 'nodeThreeObjectExtend']),
45760
- objFilter: function objFilter(obj) {
45761
- return obj.__graphObjType === 'node';
45762
- },
45763
- createObj: function createObj(node) {
45764
- var customObj = customObjectAccessor(node);
45765
- var extendObj = customObjectExtendAccessor(node);
45766
- if (customObj && state.nodeThreeObject === customObj) {
45767
- // clone object if it's a shared object among all nodes
45768
- customObj = customObj.clone();
45575
+ if (state._flushObjects || hasAnyPropChanged([
45576
+ // recreate objects if any of these props have changed
45577
+ 'nodeThreeObject', 'nodeThreeObjectExtend'])) state.nodeDataMapper.clear();
45578
+ state.nodeDataMapper.onCreateObj(function (node) {
45579
+ var customObj = customObjectAccessor(node);
45580
+ var extendObj = customObjectExtendAccessor(node);
45581
+ if (customObj && state.nodeThreeObject === customObj) {
45582
+ // clone object if it's a shared object among all nodes
45583
+ customObj = customObj.clone();
45584
+ }
45585
+ var obj;
45586
+ if (customObj && !extendObj) {
45587
+ obj = customObj;
45588
+ } else {
45589
+ // Add default object (sphere mesh)
45590
+ obj = new three$1$1.Mesh();
45591
+ obj.__graphDefaultObj = true;
45592
+ if (customObj && extendObj) {
45593
+ obj.add(customObj); // extend default with custom
45769
45594
  }
45770
- var obj;
45771
- if (customObj && !extendObj) {
45772
- obj = customObj;
45773
- } else {
45774
- // Add default object (sphere mesh)
45775
- obj = new three$1$1.Mesh();
45776
- obj.__graphDefaultObj = true;
45777
- if (customObj && extendObj) {
45778
- obj.add(customObj); // extend default with custom
45595
+ }
45596
+ obj.__graphObjType = 'node'; // Add object type
45597
+
45598
+ return obj;
45599
+ }).onUpdateObj(function (obj, node) {
45600
+ if (obj.__graphDefaultObj) {
45601
+ // bypass internal updates for custom node objects
45602
+ var val = valAccessor(node) || 1;
45603
+ var radius = Math.cbrt(val) * state.nodeRelSize;
45604
+ var numSegments = state.nodeResolution;
45605
+ if (!obj.geometry.type.match(/^Sphere(Buffer)?Geometry$/) || obj.geometry.parameters.radius !== radius || obj.geometry.parameters.widthSegments !== numSegments) {
45606
+ if (!sphereGeometries.hasOwnProperty(val)) {
45607
+ sphereGeometries[val] = new three$1$1.SphereGeometry(radius, numSegments, numSegments);
45779
45608
  }
45609
+ obj.geometry.dispose();
45610
+ obj.geometry = sphereGeometries[val];
45780
45611
  }
45781
- obj.__graphObjType = 'node'; // Add object type
45782
-
45783
- return obj;
45784
- },
45785
- updateObj: function updateObj(obj, node) {
45786
- if (obj.__graphDefaultObj) {
45787
- // bypass internal updates for custom node objects
45788
- var val = valAccessor(node) || 1;
45789
- var radius = Math.cbrt(val) * state.nodeRelSize;
45790
- var numSegments = state.nodeResolution;
45791
- if (!obj.geometry.type.match(/^Sphere(Buffer)?Geometry$/) || obj.geometry.parameters.radius !== radius || obj.geometry.parameters.widthSegments !== numSegments) {
45792
- if (!sphereGeometries.hasOwnProperty(val)) {
45793
- sphereGeometries[val] = new three$1$1.SphereGeometry(radius, numSegments, numSegments);
45794
- }
45795
- obj.geometry.dispose();
45796
- obj.geometry = sphereGeometries[val];
45797
- }
45798
- var color = colorAccessor(node);
45799
- var materialColor = new three$1$1.Color(colorStr2Hex(color || '#ffffaa'));
45800
- var opacity = state.nodeOpacity * colorAlpha(color);
45801
- if (obj.material.type !== 'MeshLambertMaterial' || !obj.material.color.equals(materialColor) || obj.material.opacity !== opacity) {
45802
- if (!sphereMaterials.hasOwnProperty(color)) {
45803
- sphereMaterials[color] = new three$1$1.MeshLambertMaterial({
45804
- color: materialColor,
45805
- transparent: true,
45806
- opacity: opacity
45807
- });
45808
- }
45809
- obj.material.dispose();
45810
- obj.material = sphereMaterials[color];
45612
+ var color = colorAccessor(node);
45613
+ var materialColor = new three$1$1.Color(colorStr2Hex(color || '#ffffaa'));
45614
+ var opacity = state.nodeOpacity * colorAlpha(color);
45615
+ if (obj.material.type !== 'MeshLambertMaterial' || !obj.material.color.equals(materialColor) || obj.material.opacity !== opacity) {
45616
+ if (!sphereMaterials.hasOwnProperty(color)) {
45617
+ sphereMaterials[color] = new three$1$1.MeshLambertMaterial({
45618
+ color: materialColor,
45619
+ transparent: true,
45620
+ opacity: opacity
45621
+ });
45811
45622
  }
45623
+ obj.material.dispose();
45624
+ obj.material = sphereMaterials[color];
45812
45625
  }
45813
45626
  }
45814
- });
45627
+ }).digest(state.graphData.nodes.filter(visibilityAccessor));
45815
45628
  }
45816
45629
 
45817
45630
  // Digest links WebGL objects
45818
45631
  if (state._flushObjects || hasAnyPropChanged(['graphData', 'linkThreeObject', 'linkThreeObjectExtend', 'linkMaterial', 'linkColor', 'linkWidth', 'linkVisibility', 'linkResolution', 'linkOpacity', 'linkDirectionalArrowLength', 'linkDirectionalArrowColor', 'linkDirectionalArrowResolution', 'linkDirectionalParticles', 'linkDirectionalParticleWidth', 'linkDirectionalParticleColor', 'linkDirectionalParticleResolution'])) {
45819
- var _customObjectAccessor = index$1(state.linkThreeObject);
45820
- var _customObjectExtendAccessor = index$1(state.linkThreeObjectExtend);
45821
- var customMaterialAccessor = index$1(state.linkMaterial);
45822
- var _visibilityAccessor = index$1(state.linkVisibility);
45823
- var _colorAccessor = index$1(state.linkColor);
45824
- var widthAccessor = index$1(state.linkWidth);
45632
+ var _customObjectAccessor = index(state.linkThreeObject);
45633
+ var _customObjectExtendAccessor = index(state.linkThreeObjectExtend);
45634
+ var customMaterialAccessor = index(state.linkMaterial);
45635
+ var _visibilityAccessor = index(state.linkVisibility);
45636
+ var _colorAccessor = index(state.linkColor);
45637
+ var widthAccessor = index(state.linkWidth);
45825
45638
  var cylinderGeometries = {}; // indexed by link width
45826
45639
  var lambertLineMaterials = {}; // for cylinder objects, indexed by link color
45827
45640
  var basicLineMaterials = {}; // for line objects, indexed by link color
@@ -45829,218 +45642,193 @@ function InsertStackElement(node, body) {
45829
45642
  var visibleLinks = state.graphData.links.filter(_visibilityAccessor);
45830
45643
 
45831
45644
  // lines digest cycle
45832
- threeDigest(visibleLinks, state.graphScene, {
45833
- objBindAttr: '__lineObj',
45834
- purge: state._flushObjects || hasAnyPropChanged([
45835
- // recreate objects if any of these props have changed
45836
- 'linkThreeObject', 'linkThreeObjectExtend', 'linkWidth']),
45837
- objFilter: function objFilter(obj) {
45838
- return obj.__graphObjType === 'link';
45839
- },
45840
- exitObj: function exitObj(obj) {
45841
- // remove trailing single photons
45842
- var singlePhotonsObj = obj.__data && obj.__data.__singleHopPhotonsObj;
45843
- if (singlePhotonsObj) {
45844
- singlePhotonsObj.parent.remove(singlePhotonsObj);
45845
- emptyObject(singlePhotonsObj);
45846
- delete obj.__data.__singleHopPhotonsObj;
45847
- }
45848
- },
45849
- createObj: function createObj(link) {
45850
- var customObj = _customObjectAccessor(link);
45851
- var extendObj = _customObjectExtendAccessor(link);
45852
- if (customObj && state.linkThreeObject === customObj) {
45853
- // clone object if it's a shared object among all links
45854
- customObj = customObj.clone();
45855
- }
45856
- var defaultObj;
45857
- if (!customObj || extendObj) {
45858
- // construct default line obj
45859
- var useCylinder = !!widthAccessor(link);
45860
- if (useCylinder) {
45861
- defaultObj = new three$1$1.Mesh();
45862
- } else {
45863
- // Use plain line (constant width)
45864
- var lineGeometry = new three$1$1.BufferGeometry();
45865
- lineGeometry[setAttributeFn]('position', new three$1$1.BufferAttribute(new Float32Array(2 * 3), 3));
45866
- defaultObj = new three$1$1.Line(lineGeometry);
45867
- }
45645
+ if (state._flushObjects || hasAnyPropChanged([
45646
+ // recreate objects if any of these props have changed
45647
+ 'linkThreeObject', 'linkThreeObjectExtend', 'linkWidth'])) state.linkDataMapper.clear();
45648
+ state.linkDataMapper.onRemoveObj(function (obj) {
45649
+ // remove trailing single photons
45650
+ var singlePhotonsObj = obj.__data && obj.__data.__singleHopPhotonsObj;
45651
+ if (singlePhotonsObj) {
45652
+ singlePhotonsObj.parent.remove(singlePhotonsObj);
45653
+ emptyObject(singlePhotonsObj);
45654
+ delete obj.__data.__singleHopPhotonsObj;
45655
+ }
45656
+ }).onCreateObj(function (link) {
45657
+ var customObj = _customObjectAccessor(link);
45658
+ var extendObj = _customObjectExtendAccessor(link);
45659
+ if (customObj && state.linkThreeObject === customObj) {
45660
+ // clone object if it's a shared object among all links
45661
+ customObj = customObj.clone();
45662
+ }
45663
+ var defaultObj;
45664
+ if (!customObj || extendObj) {
45665
+ // construct default line obj
45666
+ var useCylinder = !!widthAccessor(link);
45667
+ if (useCylinder) {
45668
+ defaultObj = new three$1$1.Mesh();
45669
+ } else {
45670
+ // Use plain line (constant width)
45671
+ var lineGeometry = new three$1$1.BufferGeometry();
45672
+ lineGeometry[setAttributeFn]('position', new three$1$1.BufferAttribute(new Float32Array(2 * 3), 3));
45673
+ defaultObj = new three$1$1.Line(lineGeometry);
45868
45674
  }
45869
- var obj;
45870
- if (!customObj) {
45871
- obj = defaultObj;
45872
- obj.__graphDefaultObj = true;
45675
+ }
45676
+ var obj;
45677
+ if (!customObj) {
45678
+ obj = defaultObj;
45679
+ obj.__graphDefaultObj = true;
45680
+ } else {
45681
+ if (!extendObj) {
45682
+ // use custom object
45683
+ obj = customObj;
45873
45684
  } else {
45874
- if (!extendObj) {
45875
- // use custom object
45876
- obj = customObj;
45877
- } else {
45878
- // extend default with custom in a group
45879
- obj = new three$1$1.Group();
45880
- obj.__graphDefaultObj = true;
45881
- obj.add(defaultObj);
45882
- obj.add(customObj);
45883
- }
45685
+ // extend default with custom in a group
45686
+ obj = new three$1$1.Group();
45687
+ obj.__graphDefaultObj = true;
45688
+ obj.add(defaultObj);
45689
+ obj.add(customObj);
45884
45690
  }
45885
- obj.renderOrder = 10; // Prevent visual glitches of dark lines on top of nodes by rendering them last
45886
-
45887
- obj.__graphObjType = 'link'; // Add object type
45888
-
45889
- return obj;
45890
- },
45891
- updateObj: function updateObj(updObj, link) {
45892
- if (updObj.__graphDefaultObj) {
45893
- // bypass internal updates for custom link objects
45894
- // select default object if it's an extended group
45895
- var obj = updObj.children.length ? updObj.children[0] : updObj;
45896
- var linkWidth = Math.ceil(widthAccessor(link) * 10) / 10;
45897
- var useCylinder = !!linkWidth;
45898
- if (useCylinder) {
45899
- var r = linkWidth / 2;
45900
- var numSegments = state.linkResolution;
45901
- if (!obj.geometry.type.match(/^Cylinder(Buffer)?Geometry$/) || obj.geometry.parameters.radiusTop !== r || obj.geometry.parameters.radialSegments !== numSegments) {
45902
- if (!cylinderGeometries.hasOwnProperty(linkWidth)) {
45903
- var geometry = new three$1$1.CylinderGeometry(r, r, 1, numSegments, 1, false);
45904
- geometry[applyMatrix4Fn](new three$1$1.Matrix4().makeTranslation(0, 1 / 2, 0));
45905
- geometry[applyMatrix4Fn](new three$1$1.Matrix4().makeRotationX(Math.PI / 2));
45906
- cylinderGeometries[linkWidth] = geometry;
45907
- }
45908
- obj.geometry.dispose();
45909
- obj.geometry = cylinderGeometries[linkWidth];
45691
+ }
45692
+ obj.renderOrder = 10; // Prevent visual glitches of dark lines on top of nodes by rendering them last
45693
+
45694
+ obj.__graphObjType = 'link'; // Add object type
45695
+
45696
+ return obj;
45697
+ }).onUpdateObj(function (updObj, link) {
45698
+ if (updObj.__graphDefaultObj) {
45699
+ // bypass internal updates for custom link objects
45700
+ // select default object if it's an extended group
45701
+ var obj = updObj.children.length ? updObj.children[0] : updObj;
45702
+ var linkWidth = Math.ceil(widthAccessor(link) * 10) / 10;
45703
+ var useCylinder = !!linkWidth;
45704
+ if (useCylinder) {
45705
+ var r = linkWidth / 2;
45706
+ var numSegments = state.linkResolution;
45707
+ if (!obj.geometry.type.match(/^Cylinder(Buffer)?Geometry$/) || obj.geometry.parameters.radiusTop !== r || obj.geometry.parameters.radialSegments !== numSegments) {
45708
+ if (!cylinderGeometries.hasOwnProperty(linkWidth)) {
45709
+ var geometry = new three$1$1.CylinderGeometry(r, r, 1, numSegments, 1, false);
45710
+ geometry[applyMatrix4Fn](new three$1$1.Matrix4().makeTranslation(0, 1 / 2, 0));
45711
+ geometry[applyMatrix4Fn](new three$1$1.Matrix4().makeRotationX(Math.PI / 2));
45712
+ cylinderGeometries[linkWidth] = geometry;
45910
45713
  }
45714
+ obj.geometry.dispose();
45715
+ obj.geometry = cylinderGeometries[linkWidth];
45911
45716
  }
45912
- var customMaterial = customMaterialAccessor(link);
45913
- if (customMaterial) {
45914
- obj.material = customMaterial;
45915
- } else {
45916
- var color = _colorAccessor(link);
45917
- var materialColor = new three$1$1.Color(colorStr2Hex(color || '#f0f0f0'));
45918
- var opacity = state.linkOpacity * colorAlpha(color);
45919
- var materialType = useCylinder ? 'MeshLambertMaterial' : 'LineBasicMaterial';
45920
- if (obj.material.type !== materialType || !obj.material.color.equals(materialColor) || obj.material.opacity !== opacity) {
45921
- var lineMaterials = useCylinder ? lambertLineMaterials : basicLineMaterials;
45922
- if (!lineMaterials.hasOwnProperty(color)) {
45923
- lineMaterials[color] = new three$1$1[materialType]({
45924
- color: materialColor,
45925
- transparent: opacity < 1,
45926
- opacity: opacity,
45927
- depthWrite: opacity >= 1 // Prevent transparency issues
45928
- });
45929
- }
45930
- obj.material.dispose();
45931
- obj.material = lineMaterials[color];
45717
+ }
45718
+ var customMaterial = customMaterialAccessor(link);
45719
+ if (customMaterial) {
45720
+ obj.material = customMaterial;
45721
+ } else {
45722
+ var color = _colorAccessor(link);
45723
+ var materialColor = new three$1$1.Color(colorStr2Hex(color || '#f0f0f0'));
45724
+ var opacity = state.linkOpacity * colorAlpha(color);
45725
+ var materialType = useCylinder ? 'MeshLambertMaterial' : 'LineBasicMaterial';
45726
+ if (obj.material.type !== materialType || !obj.material.color.equals(materialColor) || obj.material.opacity !== opacity) {
45727
+ var lineMaterials = useCylinder ? lambertLineMaterials : basicLineMaterials;
45728
+ if (!lineMaterials.hasOwnProperty(color)) {
45729
+ lineMaterials[color] = new three$1$1[materialType]({
45730
+ color: materialColor,
45731
+ transparent: opacity < 1,
45732
+ opacity: opacity,
45733
+ depthWrite: opacity >= 1 // Prevent transparency issues
45734
+ });
45932
45735
  }
45736
+ obj.material.dispose();
45737
+ obj.material = lineMaterials[color];
45933
45738
  }
45934
45739
  }
45935
45740
  }
45936
- });
45741
+ }).digest(visibleLinks);
45937
45742
 
45938
45743
  // Arrows digest cycle
45939
45744
  if (state.linkDirectionalArrowLength || changedProps.hasOwnProperty('linkDirectionalArrowLength')) {
45940
- var arrowLengthAccessor = index$1(state.linkDirectionalArrowLength);
45941
- var arrowColorAccessor = index$1(state.linkDirectionalArrowColor);
45942
- threeDigest(visibleLinks.filter(arrowLengthAccessor), state.graphScene, {
45943
- objBindAttr: '__arrowObj',
45944
- objFilter: function objFilter(obj) {
45945
- return obj.__linkThreeObjType === 'arrow';
45946
- },
45947
- createObj: function createObj() {
45948
- var obj = new three$1$1.Mesh(undefined, new three$1$1.MeshLambertMaterial({
45949
- transparent: true
45950
- }));
45951
- obj.__linkThreeObjType = 'arrow'; // Add object type
45952
-
45953
- return obj;
45954
- },
45955
- updateObj: function updateObj(obj, link) {
45956
- var arrowLength = arrowLengthAccessor(link);
45957
- var numSegments = state.linkDirectionalArrowResolution;
45958
- if (!obj.geometry.type.match(/^Cone(Buffer)?Geometry$/) || obj.geometry.parameters.height !== arrowLength || obj.geometry.parameters.radialSegments !== numSegments) {
45959
- var coneGeometry = new three$1$1.ConeGeometry(arrowLength * 0.25, arrowLength, numSegments);
45960
- // Correct orientation
45961
- coneGeometry.translate(0, arrowLength / 2, 0);
45962
- coneGeometry.rotateX(Math.PI / 2);
45963
- obj.geometry.dispose();
45964
- obj.geometry = coneGeometry;
45965
- }
45966
- var arrowColor = arrowColorAccessor(link) || _colorAccessor(link) || '#f0f0f0';
45967
- obj.material.color = new three$1$1.Color(colorStr2Hex(arrowColor));
45968
- obj.material.opacity = state.linkOpacity * 3 * colorAlpha(arrowColor);
45745
+ var arrowLengthAccessor = index(state.linkDirectionalArrowLength);
45746
+ var arrowColorAccessor = index(state.linkDirectionalArrowColor);
45747
+ state.arrowDataMapper.onCreateObj(function () {
45748
+ var obj = new three$1$1.Mesh(undefined, new three$1$1.MeshLambertMaterial({
45749
+ transparent: true
45750
+ }));
45751
+ obj.__linkThreeObjType = 'arrow'; // Add object type
45752
+
45753
+ return obj;
45754
+ }).onUpdateObj(function (obj, link) {
45755
+ var arrowLength = arrowLengthAccessor(link);
45756
+ var numSegments = state.linkDirectionalArrowResolution;
45757
+ if (!obj.geometry.type.match(/^Cone(Buffer)?Geometry$/) || obj.geometry.parameters.height !== arrowLength || obj.geometry.parameters.radialSegments !== numSegments) {
45758
+ var coneGeometry = new three$1$1.ConeGeometry(arrowLength * 0.25, arrowLength, numSegments);
45759
+ // Correct orientation
45760
+ coneGeometry.translate(0, arrowLength / 2, 0);
45761
+ coneGeometry.rotateX(Math.PI / 2);
45762
+ obj.geometry.dispose();
45763
+ obj.geometry = coneGeometry;
45969
45764
  }
45970
- });
45765
+ var arrowColor = arrowColorAccessor(link) || _colorAccessor(link) || '#f0f0f0';
45766
+ obj.material.color = new three$1$1.Color(colorStr2Hex(arrowColor));
45767
+ obj.material.opacity = state.linkOpacity * 3 * colorAlpha(arrowColor);
45768
+ }).digest(visibleLinks.filter(arrowLengthAccessor));
45971
45769
  }
45972
45770
 
45973
45771
  // Photon particles digest cycle
45974
45772
  if (state.linkDirectionalParticles || changedProps.hasOwnProperty('linkDirectionalParticles')) {
45975
- var particlesAccessor = index$1(state.linkDirectionalParticles);
45976
- var particleWidthAccessor = index$1(state.linkDirectionalParticleWidth);
45977
- var particleColorAccessor = index$1(state.linkDirectionalParticleColor);
45773
+ var particlesAccessor = index(state.linkDirectionalParticles);
45774
+ var particleWidthAccessor = index(state.linkDirectionalParticleWidth);
45775
+ var particleColorAccessor = index(state.linkDirectionalParticleColor);
45978
45776
  var particleMaterials = {}; // indexed by link color
45979
45777
  var particleGeometries = {}; // indexed by particle width
45980
45778
 
45981
- threeDigest(visibleLinks.filter(particlesAccessor), state.graphScene, {
45982
- objBindAttr: '__photonsObj',
45983
- objFilter: function objFilter(obj) {
45984
- return obj.__linkThreeObjType === 'photons';
45985
- },
45986
- createObj: function createObj() {
45987
- var obj = new three$1$1.Group();
45988
- obj.__linkThreeObjType = 'photons'; // Add object type
45989
-
45990
- return obj;
45991
- },
45992
- updateObj: function updateObj(obj, link) {
45993
- var numPhotons = Math.round(Math.abs(particlesAccessor(link)));
45994
- var curPhoton = !!obj.children.length && obj.children[0];
45995
- var photonR = Math.ceil(particleWidthAccessor(link) * 10) / 10 / 2;
45996
- var numSegments = state.linkDirectionalParticleResolution;
45997
- var particleGeometry;
45998
- if (curPhoton && curPhoton.geometry.parameters.radius === photonR && curPhoton.geometry.parameters.widthSegments === numSegments) {
45999
- particleGeometry = curPhoton.geometry;
46000
- } else {
46001
- if (!particleGeometries.hasOwnProperty(photonR)) {
46002
- particleGeometries[photonR] = new three$1$1.SphereGeometry(photonR, numSegments, numSegments);
46003
- }
46004
- particleGeometry = particleGeometries[photonR];
46005
- curPhoton && curPhoton.geometry.dispose();
45779
+ state.particlesDataMapper.onCreateObj(function () {
45780
+ var obj = new three$1$1.Group();
45781
+ obj.__linkThreeObjType = 'photons'; // Add object type
45782
+
45783
+ obj.__photonDataMapper = new ThreeDigest(obj);
45784
+ return obj;
45785
+ }).onUpdateObj(function (obj, link) {
45786
+ var numPhotons = Math.round(Math.abs(particlesAccessor(link)));
45787
+ var curPhoton = !!obj.children.length && obj.children[0];
45788
+ var photonR = Math.ceil(particleWidthAccessor(link) * 10) / 10 / 2;
45789
+ var numSegments = state.linkDirectionalParticleResolution;
45790
+ var particleGeometry;
45791
+ if (curPhoton && curPhoton.geometry.parameters.radius === photonR && curPhoton.geometry.parameters.widthSegments === numSegments) {
45792
+ particleGeometry = curPhoton.geometry;
45793
+ } else {
45794
+ if (!particleGeometries.hasOwnProperty(photonR)) {
45795
+ particleGeometries[photonR] = new three$1$1.SphereGeometry(photonR, numSegments, numSegments);
46006
45796
  }
46007
- var photonColor = particleColorAccessor(link) || _colorAccessor(link) || '#f0f0f0';
46008
- var materialColor = new three$1$1.Color(colorStr2Hex(photonColor));
46009
- var opacity = state.linkOpacity * 3;
46010
- var particleMaterial;
46011
- if (curPhoton && curPhoton.material.color.equals(materialColor) && curPhoton.material.opacity === opacity) {
46012
- particleMaterial = curPhoton.material;
46013
- } else {
46014
- if (!particleMaterials.hasOwnProperty(photonColor)) {
46015
- particleMaterials[photonColor] = new three$1$1.MeshLambertMaterial({
46016
- color: materialColor,
46017
- transparent: true,
46018
- opacity: opacity
46019
- });
46020
- }
46021
- particleMaterial = particleMaterials[photonColor];
46022
- curPhoton && curPhoton.material.dispose();
45797
+ particleGeometry = particleGeometries[photonR];
45798
+ curPhoton && curPhoton.geometry.dispose();
45799
+ }
45800
+ var photonColor = particleColorAccessor(link) || _colorAccessor(link) || '#f0f0f0';
45801
+ var materialColor = new three$1$1.Color(colorStr2Hex(photonColor));
45802
+ var opacity = state.linkOpacity * 3;
45803
+ var particleMaterial;
45804
+ if (curPhoton && curPhoton.material.color.equals(materialColor) && curPhoton.material.opacity === opacity) {
45805
+ particleMaterial = curPhoton.material;
45806
+ } else {
45807
+ if (!particleMaterials.hasOwnProperty(photonColor)) {
45808
+ particleMaterials[photonColor] = new three$1$1.MeshLambertMaterial({
45809
+ color: materialColor,
45810
+ transparent: true,
45811
+ opacity: opacity
45812
+ });
46023
45813
  }
46024
-
46025
- // digest cycle for each photon
46026
- threeDigest(_toConsumableArray$1(new Array(numPhotons)).map(function (_, idx) {
46027
- return {
46028
- idx: idx
46029
- };
46030
- }), obj, {
46031
- idAccessor: function idAccessor(d) {
46032
- return d.idx;
46033
- },
46034
- createObj: function createObj() {
46035
- return new three$1$1.Mesh(particleGeometry, particleMaterial);
46036
- },
46037
- updateObj: function updateObj(obj) {
46038
- obj.geometry = particleGeometry;
46039
- obj.material = particleMaterial;
46040
- }
46041
- });
45814
+ particleMaterial = particleMaterials[photonColor];
45815
+ curPhoton && curPhoton.material.dispose();
46042
45816
  }
46043
- });
45817
+
45818
+ // digest cycle for each photon
45819
+ obj.__photonDataMapper.id(function (d) {
45820
+ return d.idx;
45821
+ }).onCreateObj(function () {
45822
+ return new three$1$1.Mesh(particleGeometry, particleMaterial);
45823
+ }).onUpdateObj(function (obj) {
45824
+ obj.geometry = particleGeometry;
45825
+ obj.material = particleMaterial;
45826
+ }).digest(_toConsumableArray$1(new Array(numPhotons)).map(function (_, idx) {
45827
+ return {
45828
+ idx: idx
45829
+ };
45830
+ }));
45831
+ }).digest(visibleLinks.filter(particlesAccessor));
46044
45832
  }
46045
45833
  }
46046
45834
  state._flushObjects = false; // reset objects refresh flag
@@ -88852,7 +88640,7 @@ var<${access}> ${name} : ${structName};`;
88852
88640
  Spherical: Spherical,
88853
88641
  Clock: Clock
88854
88642
  };
88855
- var threeRenderObjects = index$2({
88643
+ var threeRenderObjects = index$1({
88856
88644
  props: {
88857
88645
  width: {
88858
88646
  "default": window.innerWidth,
@@ -88958,7 +88746,7 @@ var<${access}> ${name} : ${structName};`;
88958
88746
  }
88959
88747
  if (topObject !== state.hoverObj) {
88960
88748
  state.onHover(topObject, state.hoverObj);
88961
- state.toolTipElem.innerHTML = topObject ? index$1(state.tooltipContent)(topObject) || '' : '';
88749
+ state.toolTipElem.innerHTML = topObject ? index(state.tooltipContent)(topObject) || '' : '';
88962
88750
  state.hoverObj = topObject;
88963
88751
  }
88964
88752
  }
@@ -89411,20 +89199,20 @@ var<${access}> ${name} : ${structName};`;
89411
89199
 
89412
89200
  // Expose config from forceGraph
89413
89201
  var bindFG = linkKapsule('forceGraph', threeForcegraph);
89414
- var linkedFGProps = Object.assign.apply(Object, _toConsumableArray$4(['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) {
89415
- return _defineProperty$3({}, p, bindFG.linkProp(p));
89202
+ var linkedFGProps = Object.assign.apply(Object, _toConsumableArray$3(['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) {
89203
+ return _defineProperty$2({}, p, bindFG.linkProp(p));
89416
89204
  })));
89417
- var linkedFGMethods = Object.assign.apply(Object, _toConsumableArray$4(['refresh', 'getGraphBbox', 'd3Force', 'd3ReheatSimulation', 'emitParticle'].map(function (p) {
89418
- return _defineProperty$3({}, p, bindFG.linkMethod(p));
89205
+ var linkedFGMethods = Object.assign.apply(Object, _toConsumableArray$3(['refresh', 'getGraphBbox', 'd3Force', 'd3ReheatSimulation', 'emitParticle'].map(function (p) {
89206
+ return _defineProperty$2({}, p, bindFG.linkMethod(p));
89419
89207
  })));
89420
89208
 
89421
89209
  // Expose config from renderObjs
89422
89210
  var bindRenderObjs = linkKapsule('renderObjs', threeRenderObjects);
89423
- var linkedRenderObjsProps = Object.assign.apply(Object, _toConsumableArray$4(['width', 'height', 'backgroundColor', 'showNavInfo', 'enablePointerInteraction'].map(function (p) {
89424
- return _defineProperty$3({}, p, bindRenderObjs.linkProp(p));
89211
+ var linkedRenderObjsProps = Object.assign.apply(Object, _toConsumableArray$3(['width', 'height', 'backgroundColor', 'showNavInfo', 'enablePointerInteraction'].map(function (p) {
89212
+ return _defineProperty$2({}, p, bindRenderObjs.linkProp(p));
89425
89213
  })));
89426
- var linkedRenderObjsMethods = Object.assign.apply(Object, _toConsumableArray$4(['lights', 'cameraPosition', 'postProcessingComposer'].map(function (p) {
89427
- return _defineProperty$3({}, p, bindRenderObjs.linkMethod(p));
89214
+ var linkedRenderObjsMethods = Object.assign.apply(Object, _toConsumableArray$3(['lights', 'cameraPosition', 'postProcessingComposer'].map(function (p) {
89215
+ return _defineProperty$2({}, p, bindRenderObjs.linkMethod(p));
89428
89216
  })).concat([{
89429
89217
  graph2ScreenCoords: bindRenderObjs.linkMethod('getScreenCoords'),
89430
89218
  screen2GraphCoords: bindRenderObjs.linkMethod('getSceneCoords')
@@ -89432,8 +89220,8 @@ var<${access}> ${name} : ${structName};`;
89432
89220
 
89433
89221
  //
89434
89222
 
89435
- var _3dForceGraph = index$2({
89436
- props: _objectSpread2$2(_objectSpread2$2({
89223
+ var _3dForceGraph = index$1({
89224
+ props: _objectSpread2$1(_objectSpread2$1({
89437
89225
  nodeLabel: {
89438
89226
  "default": 'name',
89439
89227
  triggerUpdate: false
@@ -89498,7 +89286,7 @@ var<${access}> ${name} : ${structName};`;
89498
89286
  triggerUpdate: false
89499
89287
  }
89500
89288
  }, linkedFGProps), linkedRenderObjsProps),
89501
- methods: _objectSpread2$2(_objectSpread2$2({
89289
+ methods: _objectSpread2$1(_objectSpread2$1({
89502
89290
  zoomToFit: function zoomToFit(state, transitionDuration, padding) {
89503
89291
  var _state$forceGraph;
89504
89292
  for (var _len = arguments.length, bboxArgs = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
@@ -89751,7 +89539,7 @@ var<${access}> ${name} : ${structName};`;
89751
89539
  return isNode(bObj) - isNode(aObj);
89752
89540
  }).tooltipContent(function (obj) {
89753
89541
  var graphObj = getGraphObj(obj);
89754
- return graphObj ? index$1(state["".concat(graphObj.__graphObjType, "Label")])(graphObj.__data) || '' : '';
89542
+ return graphObj ? index(state["".concat(graphObj.__graphObjType, "Label")])(graphObj.__data) || '' : '';
89755
89543
  }).hoverDuringDrag(false).onHover(function (obj) {
89756
89544
  // Update tooltip and trigger onHover events
89757
89545
  var hoverObj = getGraphObj(obj);