@dshtrading/client-ui-knowledge 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +515 -739
- package/lib/client.js.map +1 -1
- package/package.json +4 -4
package/lib/client.js
CHANGED
|
@@ -6,6 +6,17 @@ window.__ModuleLoader__.load({
|
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
Object.freeze({
|
|
10
|
+
"鳄鱼派": "鳄鱼派(像鳄鱼一样思考)",
|
|
11
|
+
"鳄鱼派(公众号:像鳄鱼一样思考)": "鳄鱼派(像鳄鱼一样思考)",
|
|
12
|
+
"像鳄鱼一样思考(鳄鱼派)": "鳄鱼派(像鳄鱼一样思考)",
|
|
13
|
+
"zcl × DSH Master(自有分析,非外部素材)": "zcl × DSH Master(自有分析)",
|
|
14
|
+
"zcl × DSH Master(自有框架综合,非外部素材)": "zcl × DSH Master(自有分析)",
|
|
15
|
+
"山基说(素材提炼)/ zcl(分层核查,事实依据 facts/oil.md、facts/fed.md)": "山基说",
|
|
16
|
+
"小鹿投研日记(转播大摩闭门会 9.14,发言人Robin/Steven/钟申/Jenny;Laura股票部分视频截断未录)": "小鹿投研日记",
|
|
17
|
+
"中金点睛(刘刚、杨萱庭)": "中金点睛"
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
9
20
|
//#region ../knowledge/lib/graph.js
|
|
10
21
|
function buildGraph(cards, options = {}) {
|
|
11
22
|
const { coTag = true, coAuthor = true, tagHubs = false } = options;
|
|
@@ -4204,12 +4215,12 @@ window.__ModuleLoader__.load({
|
|
|
4204
4215
|
TWEEN.update.bind(TWEEN);
|
|
4205
4216
|
//#endregion
|
|
4206
4217
|
//#region ../../node_modules/.pnpm/kapsule@1.16.3/node_modules/kapsule/dist/kapsule.mjs
|
|
4207
|
-
function _arrayLikeToArray$
|
|
4218
|
+
function _arrayLikeToArray$3(r, a) {
|
|
4208
4219
|
(null == a || a > r.length) && (a = r.length);
|
|
4209
4220
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
4210
4221
|
return n;
|
|
4211
4222
|
}
|
|
4212
|
-
function _arrayWithHoles$
|
|
4223
|
+
function _arrayWithHoles$2(r) {
|
|
4213
4224
|
if (Array.isArray(r)) return r;
|
|
4214
4225
|
}
|
|
4215
4226
|
function _classCallCheck$1(a, n) {
|
|
@@ -4218,7 +4229,7 @@ window.__ModuleLoader__.load({
|
|
|
4218
4229
|
function _createClass$1(e, r, t) {
|
|
4219
4230
|
return Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
4220
4231
|
}
|
|
4221
|
-
function _iterableToArrayLimit$
|
|
4232
|
+
function _iterableToArrayLimit$2(r, l) {
|
|
4222
4233
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
4223
4234
|
if (null != t) {
|
|
4224
4235
|
var e, n, i, u, a = [], f = true, o = false;
|
|
@@ -4237,17 +4248,17 @@ window.__ModuleLoader__.load({
|
|
|
4237
4248
|
return a;
|
|
4238
4249
|
}
|
|
4239
4250
|
}
|
|
4240
|
-
function _nonIterableRest$
|
|
4251
|
+
function _nonIterableRest$2() {
|
|
4241
4252
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4242
4253
|
}
|
|
4243
|
-
function _slicedToArray$
|
|
4244
|
-
return _arrayWithHoles$
|
|
4254
|
+
function _slicedToArray$2(r, e) {
|
|
4255
|
+
return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$3(r, e) || _nonIterableRest$2();
|
|
4245
4256
|
}
|
|
4246
|
-
function _unsupportedIterableToArray$
|
|
4257
|
+
function _unsupportedIterableToArray$3(r, a) {
|
|
4247
4258
|
if (r) {
|
|
4248
|
-
if ("string" == typeof r) return _arrayLikeToArray$
|
|
4259
|
+
if ("string" == typeof r) return _arrayLikeToArray$3(r, a);
|
|
4249
4260
|
var t = {}.toString.call(r).slice(8, -1);
|
|
4250
|
-
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$
|
|
4261
|
+
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;
|
|
4251
4262
|
}
|
|
4252
4263
|
}
|
|
4253
4264
|
var Prop = /*#__PURE__*/ _createClass$1(function Prop(name, _ref) {
|
|
@@ -4310,7 +4321,7 @@ window.__ModuleLoader__.load({
|
|
|
4310
4321
|
};
|
|
4311
4322
|
});
|
|
4312
4323
|
Object.entries(aliases).forEach(function(_ref4) {
|
|
4313
|
-
var _ref5 = _slicedToArray$
|
|
4324
|
+
var _ref5 = _slicedToArray$2(_ref4, 2), alias = _ref5[0];
|
|
4314
4325
|
return comp[alias] = comp[_ref5[1]];
|
|
4315
4326
|
});
|
|
4316
4327
|
comp.resetProps = function() {
|
|
@@ -4336,13 +4347,13 @@ window.__ModuleLoader__.load({
|
|
|
4336
4347
|
});
|
|
4337
4348
|
//#endregion
|
|
4338
4349
|
//#region ../../node_modules/.pnpm/tinycolor2@1.6.0/node_modules/tinycolor2/esm/tinycolor.js
|
|
4339
|
-
function _typeof$
|
|
4350
|
+
function _typeof$1(obj) {
|
|
4340
4351
|
"@babel/helpers - typeof";
|
|
4341
|
-
return _typeof$
|
|
4352
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
|
|
4342
4353
|
return typeof obj;
|
|
4343
4354
|
} : function(obj) {
|
|
4344
4355
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
4345
|
-
}, _typeof$
|
|
4356
|
+
}, _typeof$1(obj);
|
|
4346
4357
|
}
|
|
4347
4358
|
var trimLeft = /^\s+/;
|
|
4348
4359
|
var trimRight = /\s+$/;
|
|
@@ -4550,7 +4561,7 @@ window.__ModuleLoader__.load({
|
|
|
4550
4561
|
}
|
|
4551
4562
|
};
|
|
4552
4563
|
tinycolor.fromRatio = function(color, opts) {
|
|
4553
|
-
if (_typeof$
|
|
4564
|
+
if (_typeof$1(color) == "object") {
|
|
4554
4565
|
var newColor = {};
|
|
4555
4566
|
for (var i in color) if (color.hasOwnProperty(i)) {
|
|
4556
4567
|
if (i === "a") newColor[i] = color[i];
|
|
@@ -4573,7 +4584,7 @@ window.__ModuleLoader__.load({
|
|
|
4573
4584
|
var ok = false;
|
|
4574
4585
|
var format = false;
|
|
4575
4586
|
if (typeof color == "string") color = stringInputToObject(color);
|
|
4576
|
-
if (_typeof$
|
|
4587
|
+
if (_typeof$1(color) == "object") {
|
|
4577
4588
|
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
4578
4589
|
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
4579
4590
|
ok = true;
|
|
@@ -5234,13 +5245,13 @@ window.__ModuleLoader__.load({
|
|
|
5234
5245
|
}
|
|
5235
5246
|
//#endregion
|
|
5236
5247
|
//#region ../../node_modules/.pnpm/canvas-color-tracker@1.3.2/node_modules/canvas-color-tracker/dist/canvas-color-tracker.mjs
|
|
5237
|
-
function _arrayLikeToArray$
|
|
5248
|
+
function _arrayLikeToArray$2(r, a) {
|
|
5238
5249
|
(null == a || a > r.length) && (a = r.length);
|
|
5239
5250
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
5240
5251
|
return n;
|
|
5241
5252
|
}
|
|
5242
|
-
function _arrayWithoutHoles$
|
|
5243
|
-
if (Array.isArray(r)) return _arrayLikeToArray$
|
|
5253
|
+
function _arrayWithoutHoles$1(r) {
|
|
5254
|
+
if (Array.isArray(r)) return _arrayLikeToArray$2(r);
|
|
5244
5255
|
}
|
|
5245
5256
|
function _assertClassBrand(e, t, n) {
|
|
5246
5257
|
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
@@ -5264,22 +5275,22 @@ window.__ModuleLoader__.load({
|
|
|
5264
5275
|
function _defineProperties(e, r) {
|
|
5265
5276
|
for (var t = 0; t < r.length; t++) {
|
|
5266
5277
|
var o = r[t];
|
|
5267
|
-
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey$
|
|
5278
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey$2(o.key), o);
|
|
5268
5279
|
}
|
|
5269
5280
|
}
|
|
5270
5281
|
function _createClass(e, r, t) {
|
|
5271
5282
|
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e;
|
|
5272
5283
|
}
|
|
5273
|
-
function _iterableToArray$
|
|
5284
|
+
function _iterableToArray$1(r) {
|
|
5274
5285
|
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
5275
5286
|
}
|
|
5276
|
-
function _nonIterableSpread$
|
|
5287
|
+
function _nonIterableSpread$1() {
|
|
5277
5288
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5278
5289
|
}
|
|
5279
|
-
function _toConsumableArray$
|
|
5280
|
-
return _arrayWithoutHoles$
|
|
5290
|
+
function _toConsumableArray$1(r) {
|
|
5291
|
+
return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread$1();
|
|
5281
5292
|
}
|
|
5282
|
-
function _toPrimitive$
|
|
5293
|
+
function _toPrimitive$2(t, r) {
|
|
5283
5294
|
if ("object" != typeof t || !t) return t;
|
|
5284
5295
|
var e = t[Symbol.toPrimitive];
|
|
5285
5296
|
if (void 0 !== e) {
|
|
@@ -5289,15 +5300,15 @@ window.__ModuleLoader__.load({
|
|
|
5289
5300
|
}
|
|
5290
5301
|
return String(t);
|
|
5291
5302
|
}
|
|
5292
|
-
function _toPropertyKey$
|
|
5293
|
-
var i = _toPrimitive$
|
|
5303
|
+
function _toPropertyKey$2(t) {
|
|
5304
|
+
var i = _toPrimitive$2(t, "string");
|
|
5294
5305
|
return "symbol" == typeof i ? i : i + "";
|
|
5295
5306
|
}
|
|
5296
|
-
function _unsupportedIterableToArray$
|
|
5307
|
+
function _unsupportedIterableToArray$2(r, a) {
|
|
5297
5308
|
if (r) {
|
|
5298
|
-
if ("string" == typeof r) return _arrayLikeToArray$
|
|
5309
|
+
if ("string" == typeof r) return _arrayLikeToArray$2(r, a);
|
|
5299
5310
|
var t = {}.toString.call(r).slice(8, -1);
|
|
5300
|
-
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$
|
|
5311
|
+
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;
|
|
5301
5312
|
}
|
|
5302
5313
|
}
|
|
5303
5314
|
var ENTROPY = 123;
|
|
@@ -5346,7 +5357,7 @@ window.__ModuleLoader__.load({
|
|
|
5346
5357
|
key: "lookup",
|
|
5347
5358
|
value: function lookup(color) {
|
|
5348
5359
|
if (!color) return null;
|
|
5349
|
-
var n = typeof color === "string" ? colorStr2Int(color) : rgb2Int.apply(void 0, _toConsumableArray$
|
|
5360
|
+
var n = typeof color === "string" ? colorStr2Int(color) : rgb2Int.apply(void 0, _toConsumableArray$1(color));
|
|
5350
5361
|
if (!n) return null;
|
|
5351
5362
|
var idx = n & Math.pow(2, 24 - _classPrivateFieldGet2(_csBits, this)) - 1;
|
|
5352
5363
|
var cs = n >> 24 - _classPrivateFieldGet2(_csBits, this) & Math.pow(2, _classPrivateFieldGet2(_csBits, this)) - 1;
|
|
@@ -5632,23 +5643,23 @@ window.__ModuleLoader__.load({
|
|
|
5632
5643
|
}, H.__r = 0, f = Math.random().toString(8), c$1 = "__d" + f, a$1 = "__a" + f, s = /(PointerCapture)$|Capture$/i, h = 0, p = V(!1), v = V(!0);
|
|
5633
5644
|
//#endregion
|
|
5634
5645
|
//#region ../../node_modules/.pnpm/float-tooltip@1.7.5/node_modules/float-tooltip/dist/float-tooltip.mjs
|
|
5635
|
-
function _arrayLikeToArray$
|
|
5646
|
+
function _arrayLikeToArray$1(r, a) {
|
|
5636
5647
|
(null == a || a > r.length) && (a = r.length);
|
|
5637
5648
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
5638
5649
|
return n;
|
|
5639
5650
|
}
|
|
5640
|
-
function _arrayWithHoles$
|
|
5651
|
+
function _arrayWithHoles$1(r) {
|
|
5641
5652
|
if (Array.isArray(r)) return r;
|
|
5642
5653
|
}
|
|
5643
|
-
function _defineProperty
|
|
5644
|
-
return (r = _toPropertyKey$
|
|
5654
|
+
function _defineProperty(e, r, t) {
|
|
5655
|
+
return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
|
|
5645
5656
|
value: t,
|
|
5646
5657
|
enumerable: true,
|
|
5647
5658
|
configurable: true,
|
|
5648
5659
|
writable: true
|
|
5649
5660
|
}) : e[r] = t, e;
|
|
5650
5661
|
}
|
|
5651
|
-
function _iterableToArrayLimit$
|
|
5662
|
+
function _iterableToArrayLimit$1(r, l) {
|
|
5652
5663
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
5653
5664
|
if (null != t) {
|
|
5654
5665
|
var e, n, i, u, a = [], f = true, o = false;
|
|
@@ -5667,10 +5678,10 @@ window.__ModuleLoader__.load({
|
|
|
5667
5678
|
return a;
|
|
5668
5679
|
}
|
|
5669
5680
|
}
|
|
5670
|
-
function _nonIterableRest$
|
|
5681
|
+
function _nonIterableRest$1() {
|
|
5671
5682
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5672
5683
|
}
|
|
5673
|
-
function ownKeys
|
|
5684
|
+
function ownKeys(e, r) {
|
|
5674
5685
|
var t = Object.keys(e);
|
|
5675
5686
|
if (Object.getOwnPropertySymbols) {
|
|
5676
5687
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -5680,21 +5691,21 @@ window.__ModuleLoader__.load({
|
|
|
5680
5691
|
}
|
|
5681
5692
|
return t;
|
|
5682
5693
|
}
|
|
5683
|
-
function _objectSpread2
|
|
5694
|
+
function _objectSpread2(e) {
|
|
5684
5695
|
for (var r = 1; r < arguments.length; r++) {
|
|
5685
5696
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
5686
|
-
r % 2 ? ownKeys
|
|
5687
|
-
_defineProperty
|
|
5688
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys
|
|
5697
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r) {
|
|
5698
|
+
_defineProperty(e, r, t[r]);
|
|
5699
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
5689
5700
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
5690
5701
|
});
|
|
5691
5702
|
}
|
|
5692
5703
|
return e;
|
|
5693
5704
|
}
|
|
5694
|
-
function _slicedToArray$
|
|
5695
|
-
return _arrayWithHoles$
|
|
5705
|
+
function _slicedToArray$1(r, e) {
|
|
5706
|
+
return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest$1();
|
|
5696
5707
|
}
|
|
5697
|
-
function _toPrimitive$
|
|
5708
|
+
function _toPrimitive$1(t, r) {
|
|
5698
5709
|
if ("object" != typeof t || !t) return t;
|
|
5699
5710
|
var e = t[Symbol.toPrimitive];
|
|
5700
5711
|
if (void 0 !== e) {
|
|
@@ -5704,31 +5715,31 @@ window.__ModuleLoader__.load({
|
|
|
5704
5715
|
}
|
|
5705
5716
|
return ("string" === r ? String : Number)(t);
|
|
5706
5717
|
}
|
|
5707
|
-
function _toPropertyKey$
|
|
5708
|
-
var i = _toPrimitive$
|
|
5718
|
+
function _toPropertyKey$1(t) {
|
|
5719
|
+
var i = _toPrimitive$1(t, "string");
|
|
5709
5720
|
return "symbol" == typeof i ? i : i + "";
|
|
5710
5721
|
}
|
|
5711
|
-
function _typeof
|
|
5722
|
+
function _typeof(o) {
|
|
5712
5723
|
"@babel/helpers - typeof";
|
|
5713
|
-
return _typeof
|
|
5724
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
5714
5725
|
return typeof o;
|
|
5715
5726
|
} : function(o) {
|
|
5716
5727
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
5717
|
-
}, _typeof
|
|
5728
|
+
}, _typeof(o);
|
|
5718
5729
|
}
|
|
5719
|
-
function _unsupportedIterableToArray$
|
|
5730
|
+
function _unsupportedIterableToArray$1(r, a) {
|
|
5720
5731
|
if (r) {
|
|
5721
|
-
if ("string" == typeof r) return _arrayLikeToArray$
|
|
5732
|
+
if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
|
|
5722
5733
|
var t = {}.toString.call(r).slice(8, -1);
|
|
5723
|
-
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$
|
|
5734
|
+
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$1(r, a) : void 0;
|
|
5724
5735
|
}
|
|
5725
5736
|
}
|
|
5726
5737
|
var _reactElement2VNode = function reactElement2VNode(el) {
|
|
5727
|
-
if (!(_typeof
|
|
5738
|
+
if (!(_typeof(el) === "object")) return el;
|
|
5728
5739
|
var res = W(el);
|
|
5729
5740
|
if (res.props) {
|
|
5730
5741
|
var _res$props;
|
|
5731
|
-
res.props = _objectSpread2
|
|
5742
|
+
res.props = _objectSpread2({}, res.props);
|
|
5732
5743
|
if (res !== null && res !== void 0 && (_res$props = res.props) !== null && _res$props !== void 0 && _res$props.children) res.props.children = Array.isArray(res.props.children) ? res.props.children.map(_reactElement2VNode) : _reactElement2VNode(res.props.children);
|
|
5733
5744
|
}
|
|
5734
5745
|
return res;
|
|
@@ -5763,11 +5774,11 @@ window.__ModuleLoader__.load({
|
|
|
5763
5774
|
},
|
|
5764
5775
|
init: function init(domNode, state) {
|
|
5765
5776
|
var _ref$style = (arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}).style, style = _ref$style === void 0 ? {} : _ref$style;
|
|
5766
|
-
var el = select_default$1(!!domNode && _typeof
|
|
5777
|
+
var el = select_default$1(!!domNode && _typeof(domNode) === "object" && !!domNode.node && typeof domNode.node === "function" ? domNode.node() : domNode);
|
|
5767
5778
|
el.style("position") === "static" && el.style("position", "relative");
|
|
5768
5779
|
state.tooltipEl = el.append("div").attr("class", "float-tooltip-kap");
|
|
5769
5780
|
Object.entries(style).forEach(function(_ref2) {
|
|
5770
|
-
var _ref3 = _slicedToArray$
|
|
5781
|
+
var _ref3 = _slicedToArray$1(_ref2, 2), k = _ref3[0], v = _ref3[1];
|
|
5771
5782
|
return state.tooltipEl.style(k, v);
|
|
5772
5783
|
});
|
|
5773
5784
|
state.tooltipEl.style("left", "-10000px").style("display", "none");
|
|
@@ -8538,21 +8549,21 @@ window.__ModuleLoader__.load({
|
|
|
8538
8549
|
};
|
|
8539
8550
|
//#endregion
|
|
8540
8551
|
//#region ../../node_modules/.pnpm/index-array-by@1.4.2/node_modules/index-array-by/dist/index-array-by.mjs
|
|
8541
|
-
function _arrayLikeToArray
|
|
8552
|
+
function _arrayLikeToArray(r, a) {
|
|
8542
8553
|
(null == a || a > r.length) && (a = r.length);
|
|
8543
8554
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
8544
8555
|
return n;
|
|
8545
8556
|
}
|
|
8546
|
-
function _arrayWithHoles
|
|
8557
|
+
function _arrayWithHoles(r) {
|
|
8547
8558
|
if (Array.isArray(r)) return r;
|
|
8548
8559
|
}
|
|
8549
|
-
function _arrayWithoutHoles
|
|
8550
|
-
if (Array.isArray(r)) return _arrayLikeToArray
|
|
8560
|
+
function _arrayWithoutHoles(r) {
|
|
8561
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
8551
8562
|
}
|
|
8552
|
-
function _iterableToArray
|
|
8563
|
+
function _iterableToArray(r) {
|
|
8553
8564
|
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
8554
8565
|
}
|
|
8555
|
-
function _iterableToArrayLimit
|
|
8566
|
+
function _iterableToArrayLimit(r, l) {
|
|
8556
8567
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
8557
8568
|
if (null != t) {
|
|
8558
8569
|
var e, n, i, u, a = [], f = !0, o = !1;
|
|
@@ -8571,10 +8582,10 @@ window.__ModuleLoader__.load({
|
|
|
8571
8582
|
return a;
|
|
8572
8583
|
}
|
|
8573
8584
|
}
|
|
8574
|
-
function _nonIterableRest
|
|
8585
|
+
function _nonIterableRest() {
|
|
8575
8586
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8576
8587
|
}
|
|
8577
|
-
function _nonIterableSpread
|
|
8588
|
+
function _nonIterableSpread() {
|
|
8578
8589
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8579
8590
|
}
|
|
8580
8591
|
function _objectWithoutProperties(e, t) {
|
|
@@ -8595,13 +8606,13 @@ window.__ModuleLoader__.load({
|
|
|
8595
8606
|
}
|
|
8596
8607
|
return t;
|
|
8597
8608
|
}
|
|
8598
|
-
function _slicedToArray
|
|
8599
|
-
return _arrayWithHoles
|
|
8609
|
+
function _slicedToArray(r, e) {
|
|
8610
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
8600
8611
|
}
|
|
8601
|
-
function _toConsumableArray
|
|
8602
|
-
return _arrayWithoutHoles
|
|
8612
|
+
function _toConsumableArray(r) {
|
|
8613
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
8603
8614
|
}
|
|
8604
|
-
function _toPrimitive
|
|
8615
|
+
function _toPrimitive(t, r) {
|
|
8605
8616
|
if ("object" != typeof t || !t) return t;
|
|
8606
8617
|
var e = t[Symbol.toPrimitive];
|
|
8607
8618
|
if (void 0 !== e) {
|
|
@@ -8611,15 +8622,15 @@ window.__ModuleLoader__.load({
|
|
|
8611
8622
|
}
|
|
8612
8623
|
return String(t);
|
|
8613
8624
|
}
|
|
8614
|
-
function _toPropertyKey
|
|
8615
|
-
var i = _toPrimitive
|
|
8625
|
+
function _toPropertyKey(t) {
|
|
8626
|
+
var i = _toPrimitive(t, "string");
|
|
8616
8627
|
return "symbol" == typeof i ? i : i + "";
|
|
8617
8628
|
}
|
|
8618
|
-
function _unsupportedIterableToArray
|
|
8629
|
+
function _unsupportedIterableToArray(r, a) {
|
|
8619
8630
|
if (r) {
|
|
8620
|
-
if ("string" == typeof r) return _arrayLikeToArray
|
|
8631
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
8621
8632
|
var t = {}.toString.call(r).slice(8, -1);
|
|
8622
|
-
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
|
|
8633
|
+
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(r, a) : void 0;
|
|
8623
8634
|
}
|
|
8624
8635
|
}
|
|
8625
8636
|
var index = (function() {
|
|
@@ -8640,7 +8651,7 @@ window.__ModuleLoader__.load({
|
|
|
8640
8651
|
var keyAccessor = _ref.keyAccessor, isProp = _ref.isProp;
|
|
8641
8652
|
var key;
|
|
8642
8653
|
if (isProp) {
|
|
8643
|
-
var _itemVal = itemVal, propVal = _itemVal[keyAccessor], rest = _objectWithoutProperties(_itemVal, [keyAccessor].map(_toPropertyKey
|
|
8654
|
+
var _itemVal = itemVal, propVal = _itemVal[keyAccessor], rest = _objectWithoutProperties(_itemVal, [keyAccessor].map(_toPropertyKey));
|
|
8644
8655
|
key = propVal;
|
|
8645
8656
|
itemVal = rest;
|
|
8646
8657
|
} else key = keyAccessor(itemVal, idx);
|
|
@@ -8673,8 +8684,8 @@ window.__ModuleLoader__.load({
|
|
|
8673
8684
|
vals: node
|
|
8674
8685
|
});
|
|
8675
8686
|
else Object.entries(node).forEach(function(_ref2) {
|
|
8676
|
-
var _ref3 = _slicedToArray
|
|
8677
|
-
return flatten(val, [].concat(_toConsumableArray
|
|
8687
|
+
var _ref3 = _slicedToArray(_ref2, 2), key = _ref3[0], val = _ref3[1];
|
|
8688
|
+
return flatten(val, [].concat(_toConsumableArray(accKeys), [key]));
|
|
8678
8689
|
});
|
|
8679
8690
|
})(indexedResult);
|
|
8680
8691
|
if (keyAccessors instanceof Array && keyAccessors.length === 0 && result.length === 1) result[0].keys = [];
|
|
@@ -8738,7 +8749,7 @@ window.__ModuleLoader__.load({
|
|
|
8738
8749
|
//#region ../../node_modules/.pnpm/d3-scale-chromatic@3.1.0/node_modules/d3-scale-chromatic/src/categorical/Paired.js
|
|
8739
8750
|
var Paired_default = colors_default("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");
|
|
8740
8751
|
//#endregion
|
|
8741
|
-
//#region ../../node_modules/.pnpm/force-graph@1.51.
|
|
8752
|
+
//#region ../../node_modules/.pnpm/force-graph@1.51.5/node_modules/force-graph/dist/force-graph.mjs
|
|
8742
8753
|
function styleInject(css, ref) {
|
|
8743
8754
|
if (ref === void 0) ref = {};
|
|
8744
8755
|
var insertAt = ref.insertAt;
|
|
@@ -8754,208 +8765,64 @@ window.__ModuleLoader__.load({
|
|
|
8754
8765
|
else style.appendChild(document.createTextNode(css));
|
|
8755
8766
|
}
|
|
8756
8767
|
styleInject(".force-graph-container canvas {\n display: block;\n user-select: none;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.force-graph-container .clickable {\n cursor: pointer;\n}\n\n.force-graph-container .grabbable {\n cursor: move;\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\n.force-graph-container .grabbable:active {\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n}\n");
|
|
8757
|
-
|
|
8758
|
-
(null == a || a > r.length) && (a = r.length);
|
|
8759
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
8760
|
-
return n;
|
|
8761
|
-
}
|
|
8762
|
-
function _arrayWithHoles(r) {
|
|
8763
|
-
if (Array.isArray(r)) return r;
|
|
8764
|
-
}
|
|
8765
|
-
function _arrayWithoutHoles(r) {
|
|
8766
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
8767
|
-
}
|
|
8768
|
-
function _construct(t, e, r) {
|
|
8769
|
-
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
8770
|
-
var o = [null];
|
|
8771
|
-
o.push.apply(o, e);
|
|
8772
|
-
return new (t.bind.apply(t, o))();
|
|
8773
|
-
}
|
|
8774
|
-
function _defineProperty(e, r, t) {
|
|
8775
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
8776
|
-
value: t,
|
|
8777
|
-
enumerable: true,
|
|
8778
|
-
configurable: true,
|
|
8779
|
-
writable: true
|
|
8780
|
-
}) : e[r] = t, e;
|
|
8781
|
-
}
|
|
8782
|
-
function _isNativeReflectConstruct() {
|
|
8783
|
-
try {
|
|
8784
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
8785
|
-
} catch (t) {}
|
|
8786
|
-
return (_isNativeReflectConstruct = function() {
|
|
8787
|
-
return !!t;
|
|
8788
|
-
})();
|
|
8789
|
-
}
|
|
8790
|
-
function _iterableToArray(r) {
|
|
8791
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
8792
|
-
}
|
|
8793
|
-
function _iterableToArrayLimit(r, l) {
|
|
8794
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
8795
|
-
if (null != t) {
|
|
8796
|
-
var e, n, i, u, a = [], f = true, o = false;
|
|
8797
|
-
try {
|
|
8798
|
-
if (i = (t = t.call(r)).next, 0 === l);
|
|
8799
|
-
else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
8800
|
-
} catch (r) {
|
|
8801
|
-
o = true, n = r;
|
|
8802
|
-
} finally {
|
|
8803
|
-
try {
|
|
8804
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
8805
|
-
} finally {
|
|
8806
|
-
if (o) throw n;
|
|
8807
|
-
}
|
|
8808
|
-
}
|
|
8809
|
-
return a;
|
|
8810
|
-
}
|
|
8811
|
-
}
|
|
8812
|
-
function _nonIterableRest() {
|
|
8813
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8814
|
-
}
|
|
8815
|
-
function _nonIterableSpread() {
|
|
8816
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8817
|
-
}
|
|
8818
|
-
function ownKeys(e, r) {
|
|
8819
|
-
var t = Object.keys(e);
|
|
8820
|
-
if (Object.getOwnPropertySymbols) {
|
|
8821
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
8822
|
-
r && (o = o.filter(function(r) {
|
|
8823
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
8824
|
-
})), t.push.apply(t, o);
|
|
8825
|
-
}
|
|
8826
|
-
return t;
|
|
8827
|
-
}
|
|
8828
|
-
function _objectSpread2(e) {
|
|
8829
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
8830
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
8831
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function(r) {
|
|
8832
|
-
_defineProperty(e, r, t[r]);
|
|
8833
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
8834
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
8835
|
-
});
|
|
8836
|
-
}
|
|
8837
|
-
return e;
|
|
8838
|
-
}
|
|
8839
|
-
function _slicedToArray(r, e) {
|
|
8840
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
8841
|
-
}
|
|
8842
|
-
function _toConsumableArray(r) {
|
|
8843
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
8844
|
-
}
|
|
8845
|
-
function _toPrimitive(t, r) {
|
|
8846
|
-
if ("object" != typeof t || !t) return t;
|
|
8847
|
-
var e = t[Symbol.toPrimitive];
|
|
8848
|
-
if (void 0 !== e) {
|
|
8849
|
-
var i = e.call(t, r);
|
|
8850
|
-
if ("object" != typeof i) return i;
|
|
8851
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
8852
|
-
}
|
|
8853
|
-
return ("string" === r ? String : Number)(t);
|
|
8854
|
-
}
|
|
8855
|
-
function _toPropertyKey(t) {
|
|
8856
|
-
var i = _toPrimitive(t, "string");
|
|
8857
|
-
return "symbol" == typeof i ? i : i + "";
|
|
8858
|
-
}
|
|
8859
|
-
function _typeof(o) {
|
|
8860
|
-
"@babel/helpers - typeof";
|
|
8861
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
8862
|
-
return typeof o;
|
|
8863
|
-
} : function(o) {
|
|
8864
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
8865
|
-
}, _typeof(o);
|
|
8866
|
-
}
|
|
8867
|
-
function _unsupportedIterableToArray(r, a) {
|
|
8868
|
-
if (r) {
|
|
8869
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
8870
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
8871
|
-
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(r, a) : void 0;
|
|
8872
|
-
}
|
|
8873
|
-
}
|
|
8874
|
-
var autoColorScale = ordinal(Paired_default);
|
|
8768
|
+
const autoColorScale = ordinal(Paired_default);
|
|
8875
8769
|
function autoColorObjects(objects, colorByAccessor, colorField) {
|
|
8876
8770
|
if (!colorByAccessor || typeof colorField !== "string") return;
|
|
8877
|
-
objects.filter(
|
|
8878
|
-
return !obj[colorField];
|
|
8879
|
-
}).forEach(function(obj) {
|
|
8771
|
+
objects.filter((obj) => !obj[colorField]).forEach((obj) => {
|
|
8880
8772
|
obj[colorField] = autoColorScale(colorByAccessor(obj));
|
|
8881
8773
|
});
|
|
8882
8774
|
}
|
|
8883
|
-
function getDagDepths(
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
return graph[idAccessor(node)] = {
|
|
8893
|
-
data: node,
|
|
8894
|
-
out: [],
|
|
8895
|
-
depth: -1,
|
|
8896
|
-
skip: !nodeFilter(node)
|
|
8897
|
-
};
|
|
8775
|
+
function getDagDepths({ nodes, links }, idAccessor, { nodeFilter = () => true, onLoopError = (loopIds) => {
|
|
8776
|
+
throw `Invalid DAG structure! Found cycle in node path: ${loopIds.join(" -> ")}.`;
|
|
8777
|
+
} } = {}) {
|
|
8778
|
+
const graph = {};
|
|
8779
|
+
nodes.forEach((node) => graph[idAccessor(node)] = {
|
|
8780
|
+
data: node,
|
|
8781
|
+
out: [],
|
|
8782
|
+
depth: -1,
|
|
8783
|
+
skip: !nodeFilter(node)
|
|
8898
8784
|
});
|
|
8899
|
-
links.forEach(
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
if (!graph.hasOwnProperty(
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
var targetNode = graph[targetId];
|
|
8785
|
+
links.forEach(({ source, target }) => {
|
|
8786
|
+
const sourceId = getNodeId(source);
|
|
8787
|
+
const targetId = getNodeId(target);
|
|
8788
|
+
if (!graph.hasOwnProperty(sourceId)) throw `Missing source node with id: ${sourceId}`;
|
|
8789
|
+
if (!graph.hasOwnProperty(targetId)) throw `Missing target node with id: ${targetId}`;
|
|
8790
|
+
const sourceNode = graph[sourceId];
|
|
8791
|
+
const targetNode = graph[targetId];
|
|
8907
8792
|
sourceNode.out.push(targetNode);
|
|
8908
8793
|
function getNodeId(node) {
|
|
8909
|
-
return
|
|
8794
|
+
return typeof node === "object" ? idAccessor(node) : node;
|
|
8910
8795
|
}
|
|
8911
8796
|
});
|
|
8912
|
-
|
|
8797
|
+
const foundLoops = [];
|
|
8913
8798
|
traverse(Object.values(graph));
|
|
8914
|
-
return Object.assign
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
return _defineProperty({}, id, node.depth);
|
|
8919
|
-
}))));
|
|
8920
|
-
function traverse(nodes) {
|
|
8921
|
-
var nodeStack = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
8922
|
-
var currentDepth = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
8923
|
-
var _loop = function _loop() {
|
|
8924
|
-
var node = nodes[i];
|
|
8799
|
+
return Object.assign({}, ...Object.entries(graph).filter(([, node]) => !node.skip).map(([id, node]) => ({ [id]: node.depth })));
|
|
8800
|
+
function traverse(nodes, nodeStack = [], currentDepth = 0) {
|
|
8801
|
+
for (let i = 0, l = nodes.length; i < l; i++) {
|
|
8802
|
+
const node = nodes[i];
|
|
8925
8803
|
if (nodeStack.indexOf(node) !== -1) {
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
});
|
|
8929
|
-
if (!foundLoops.some(function(foundLoop) {
|
|
8930
|
-
return foundLoop.length === loop.length && foundLoop.every(function(id, idx) {
|
|
8931
|
-
return id === loop[idx];
|
|
8932
|
-
});
|
|
8933
|
-
})) {
|
|
8804
|
+
const loop = [...nodeStack.slice(nodeStack.indexOf(node)), node].map((d) => idAccessor(d.data));
|
|
8805
|
+
if (!foundLoops.some((foundLoop) => foundLoop.length === loop.length && foundLoop.every((id, idx) => id === loop[idx]))) {
|
|
8934
8806
|
foundLoops.push(loop);
|
|
8935
8807
|
onLoopError(loop);
|
|
8936
8808
|
}
|
|
8937
|
-
|
|
8809
|
+
continue;
|
|
8938
8810
|
}
|
|
8939
8811
|
if (currentDepth > node.depth) {
|
|
8940
8812
|
node.depth = currentDepth;
|
|
8941
|
-
traverse(node.out, [
|
|
8813
|
+
traverse(node.out, [...nodeStack, node], currentDepth + (node.skip ? 0 : 1));
|
|
8942
8814
|
}
|
|
8943
|
-
}
|
|
8944
|
-
for (var i = 0, l = nodes.length; i < l; i++) if (_loop()) continue;
|
|
8815
|
+
}
|
|
8945
8816
|
}
|
|
8946
8817
|
}
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
};
|
|
8951
|
-
var updDataPhotons = function updDataPhotons(_, state) {
|
|
8818
|
+
const DAG_LEVEL_NODE_RATIO = 2;
|
|
8819
|
+
const notifyRedraw = (_, state) => state.onNeedsRedraw && state.onNeedsRedraw();
|
|
8820
|
+
const updDataPhotons = (_, state) => {
|
|
8952
8821
|
if (!state.isShadow) {
|
|
8953
|
-
|
|
8954
|
-
state.graphData.links.forEach(
|
|
8955
|
-
|
|
8956
|
-
if (numPhotons) link.__photons =
|
|
8957
|
-
return {};
|
|
8958
|
-
});
|
|
8822
|
+
const linkParticlesAccessor = index$3(state.linkDirectionalParticles);
|
|
8823
|
+
state.graphData.links.forEach((link) => {
|
|
8824
|
+
const numPhotons = Math.round(Math.abs(linkParticlesAccessor(link)));
|
|
8825
|
+
if (numPhotons) link.__photons = [...Array(numPhotons)].map(() => ({}));
|
|
8959
8826
|
else delete link.__photons;
|
|
8960
8827
|
});
|
|
8961
8828
|
}
|
|
@@ -8963,38 +8830,34 @@ window.__ModuleLoader__.load({
|
|
|
8963
8830
|
var CanvasForceGraph = index$4({
|
|
8964
8831
|
props: {
|
|
8965
8832
|
graphData: {
|
|
8966
|
-
|
|
8833
|
+
default: {
|
|
8967
8834
|
nodes: [],
|
|
8968
8835
|
links: []
|
|
8969
8836
|
},
|
|
8970
|
-
onChange
|
|
8837
|
+
onChange(_, state) {
|
|
8971
8838
|
state.engineRunning = false;
|
|
8972
8839
|
updDataPhotons(_, state);
|
|
8973
8840
|
}
|
|
8974
8841
|
},
|
|
8975
|
-
dagMode: { onChange
|
|
8976
|
-
!dagMode && (state.graphData.nodes || []).forEach(
|
|
8977
|
-
n.fx = n.fy = void 0;
|
|
8978
|
-
});
|
|
8842
|
+
dagMode: { onChange(dagMode, state) {
|
|
8843
|
+
!dagMode && (state.graphData.nodes || []).forEach((n) => n.fx = n.fy = void 0);
|
|
8979
8844
|
} },
|
|
8980
8845
|
dagLevelDistance: {},
|
|
8981
|
-
dagNodeFilter: {
|
|
8982
|
-
return true;
|
|
8983
|
-
} },
|
|
8846
|
+
dagNodeFilter: { default: (node) => true },
|
|
8984
8847
|
onDagError: { triggerUpdate: false },
|
|
8985
8848
|
nodeRelSize: {
|
|
8986
|
-
|
|
8849
|
+
default: 4,
|
|
8987
8850
|
triggerUpdate: false,
|
|
8988
8851
|
onChange: notifyRedraw
|
|
8989
8852
|
},
|
|
8990
|
-
nodeId: {
|
|
8853
|
+
nodeId: { default: "id" },
|
|
8991
8854
|
nodeVal: {
|
|
8992
|
-
|
|
8855
|
+
default: "val",
|
|
8993
8856
|
triggerUpdate: false,
|
|
8994
8857
|
onChange: notifyRedraw
|
|
8995
8858
|
},
|
|
8996
8859
|
nodeColor: {
|
|
8997
|
-
|
|
8860
|
+
default: "color",
|
|
8998
8861
|
triggerUpdate: false,
|
|
8999
8862
|
onChange: notifyRedraw
|
|
9000
8863
|
},
|
|
@@ -9004,26 +8867,24 @@ window.__ModuleLoader__.load({
|
|
|
9004
8867
|
onChange: notifyRedraw
|
|
9005
8868
|
},
|
|
9006
8869
|
nodeCanvasObjectMode: {
|
|
9007
|
-
|
|
9008
|
-
return "replace";
|
|
9009
|
-
},
|
|
8870
|
+
default: () => "replace",
|
|
9010
8871
|
triggerUpdate: false,
|
|
9011
8872
|
onChange: notifyRedraw
|
|
9012
8873
|
},
|
|
9013
8874
|
nodeVisibility: {
|
|
9014
|
-
|
|
8875
|
+
default: true,
|
|
9015
8876
|
triggerUpdate: false,
|
|
9016
8877
|
onChange: notifyRedraw
|
|
9017
8878
|
},
|
|
9018
|
-
linkSource: {
|
|
9019
|
-
linkTarget: {
|
|
8879
|
+
linkSource: { default: "source" },
|
|
8880
|
+
linkTarget: { default: "target" },
|
|
9020
8881
|
linkVisibility: {
|
|
9021
|
-
|
|
8882
|
+
default: true,
|
|
9022
8883
|
triggerUpdate: false,
|
|
9023
8884
|
onChange: notifyRedraw
|
|
9024
8885
|
},
|
|
9025
8886
|
linkColor: {
|
|
9026
|
-
|
|
8887
|
+
default: "color",
|
|
9027
8888
|
triggerUpdate: false,
|
|
9028
8889
|
onChange: notifyRedraw
|
|
9029
8890
|
},
|
|
@@ -9033,12 +8894,12 @@ window.__ModuleLoader__.load({
|
|
|
9033
8894
|
onChange: notifyRedraw
|
|
9034
8895
|
},
|
|
9035
8896
|
linkWidth: {
|
|
9036
|
-
|
|
8897
|
+
default: 1,
|
|
9037
8898
|
triggerUpdate: false,
|
|
9038
8899
|
onChange: notifyRedraw
|
|
9039
8900
|
},
|
|
9040
8901
|
linkCurvature: {
|
|
9041
|
-
|
|
8902
|
+
default: 0,
|
|
9042
8903
|
triggerUpdate: false,
|
|
9043
8904
|
onChange: notifyRedraw
|
|
9044
8905
|
},
|
|
@@ -9047,14 +8908,12 @@ window.__ModuleLoader__.load({
|
|
|
9047
8908
|
onChange: notifyRedraw
|
|
9048
8909
|
},
|
|
9049
8910
|
linkCanvasObjectMode: {
|
|
9050
|
-
|
|
9051
|
-
return "replace";
|
|
9052
|
-
},
|
|
8911
|
+
default: () => "replace",
|
|
9053
8912
|
triggerUpdate: false,
|
|
9054
8913
|
onChange: notifyRedraw
|
|
9055
8914
|
},
|
|
9056
8915
|
linkDirectionalArrowLength: {
|
|
9057
|
-
|
|
8916
|
+
default: 0,
|
|
9058
8917
|
triggerUpdate: false,
|
|
9059
8918
|
onChange: notifyRedraw
|
|
9060
8919
|
},
|
|
@@ -9063,113 +8922,111 @@ window.__ModuleLoader__.load({
|
|
|
9063
8922
|
onChange: notifyRedraw
|
|
9064
8923
|
},
|
|
9065
8924
|
linkDirectionalArrowRelPos: {
|
|
9066
|
-
|
|
8925
|
+
default: .5,
|
|
9067
8926
|
triggerUpdate: false,
|
|
9068
8927
|
onChange: notifyRedraw
|
|
9069
8928
|
},
|
|
9070
8929
|
linkDirectionalParticles: {
|
|
9071
|
-
|
|
8930
|
+
default: 0,
|
|
9072
8931
|
triggerUpdate: false,
|
|
9073
8932
|
onChange: updDataPhotons
|
|
9074
8933
|
},
|
|
9075
8934
|
linkDirectionalParticleSpeed: {
|
|
9076
|
-
|
|
8935
|
+
default: .01,
|
|
9077
8936
|
triggerUpdate: false
|
|
9078
8937
|
},
|
|
9079
8938
|
linkDirectionalParticleOffset: {
|
|
9080
|
-
|
|
8939
|
+
default: 0,
|
|
9081
8940
|
triggerUpdate: false
|
|
9082
8941
|
},
|
|
9083
8942
|
linkDirectionalParticleWidth: {
|
|
9084
|
-
|
|
8943
|
+
default: 4,
|
|
9085
8944
|
triggerUpdate: false
|
|
9086
8945
|
},
|
|
9087
8946
|
linkDirectionalParticleColor: { triggerUpdate: false },
|
|
9088
8947
|
linkDirectionalParticleCanvasObject: { triggerUpdate: false },
|
|
9089
8948
|
globalScale: {
|
|
9090
|
-
|
|
8949
|
+
default: 1,
|
|
9091
8950
|
triggerUpdate: false
|
|
9092
8951
|
},
|
|
9093
8952
|
d3AlphaMin: {
|
|
9094
|
-
|
|
8953
|
+
default: 0,
|
|
9095
8954
|
triggerUpdate: false
|
|
9096
8955
|
},
|
|
9097
8956
|
d3AlphaDecay: {
|
|
9098
|
-
|
|
8957
|
+
default: .0228,
|
|
9099
8958
|
triggerUpdate: false,
|
|
9100
|
-
onChange
|
|
8959
|
+
onChange(alphaDecay, state) {
|
|
9101
8960
|
state.forceLayout.alphaDecay(alphaDecay);
|
|
9102
8961
|
}
|
|
9103
8962
|
},
|
|
9104
8963
|
d3AlphaTarget: {
|
|
9105
|
-
|
|
8964
|
+
default: 0,
|
|
9106
8965
|
triggerUpdate: false,
|
|
9107
|
-
onChange
|
|
8966
|
+
onChange(alphaTarget, state) {
|
|
9108
8967
|
state.forceLayout.alphaTarget(alphaTarget);
|
|
9109
8968
|
}
|
|
9110
8969
|
},
|
|
9111
8970
|
d3VelocityDecay: {
|
|
9112
|
-
|
|
8971
|
+
default: .4,
|
|
9113
8972
|
triggerUpdate: false,
|
|
9114
|
-
onChange
|
|
8973
|
+
onChange(velocityDecay, state) {
|
|
9115
8974
|
state.forceLayout.velocityDecay(velocityDecay);
|
|
9116
8975
|
}
|
|
9117
8976
|
},
|
|
9118
8977
|
warmupTicks: {
|
|
9119
|
-
|
|
8978
|
+
default: 0,
|
|
9120
8979
|
triggerUpdate: false
|
|
9121
8980
|
},
|
|
9122
8981
|
cooldownTicks: {
|
|
9123
|
-
|
|
8982
|
+
default: Infinity,
|
|
9124
8983
|
triggerUpdate: false
|
|
9125
8984
|
},
|
|
9126
8985
|
cooldownTime: {
|
|
9127
|
-
|
|
8986
|
+
default: 15e3,
|
|
9128
8987
|
triggerUpdate: false
|
|
9129
8988
|
},
|
|
9130
8989
|
onUpdate: {
|
|
9131
|
-
|
|
8990
|
+
default: () => {},
|
|
9132
8991
|
triggerUpdate: false
|
|
9133
8992
|
},
|
|
9134
8993
|
onFinishUpdate: {
|
|
9135
|
-
|
|
8994
|
+
default: () => {},
|
|
9136
8995
|
triggerUpdate: false
|
|
9137
8996
|
},
|
|
9138
8997
|
onEngineTick: {
|
|
9139
|
-
|
|
8998
|
+
default: () => {},
|
|
9140
8999
|
triggerUpdate: false
|
|
9141
9000
|
},
|
|
9142
9001
|
onEngineStop: {
|
|
9143
|
-
|
|
9002
|
+
default: () => {},
|
|
9144
9003
|
triggerUpdate: false
|
|
9145
9004
|
},
|
|
9146
9005
|
onNeedsRedraw: { triggerUpdate: false },
|
|
9147
9006
|
isShadow: {
|
|
9148
|
-
|
|
9007
|
+
default: false,
|
|
9149
9008
|
triggerUpdate: false
|
|
9150
9009
|
}
|
|
9151
9010
|
},
|
|
9152
9011
|
methods: {
|
|
9153
|
-
d3Force: function
|
|
9012
|
+
d3Force: function(state, forceName, forceFn) {
|
|
9154
9013
|
if (forceFn === void 0) return state.forceLayout.force(forceName);
|
|
9155
9014
|
state.forceLayout.force(forceName, forceFn);
|
|
9156
9015
|
return this;
|
|
9157
9016
|
},
|
|
9158
|
-
d3ReheatSimulation: function
|
|
9017
|
+
d3ReheatSimulation: function(state) {
|
|
9159
9018
|
state.forceLayout.alpha(1);
|
|
9160
9019
|
this.resetCountdown();
|
|
9161
9020
|
return this;
|
|
9162
9021
|
},
|
|
9163
|
-
resetCountdown: function
|
|
9022
|
+
resetCountdown: function(state) {
|
|
9164
9023
|
state.cntTicks = 0;
|
|
9165
9024
|
state.startTickTime = /* @__PURE__ */ new Date();
|
|
9166
9025
|
state.engineRunning = true;
|
|
9167
9026
|
return this;
|
|
9168
9027
|
},
|
|
9169
|
-
isEngineRunning:
|
|
9170
|
-
|
|
9171
|
-
},
|
|
9172
|
-
tickFrame: function tickFrame(state) {
|
|
9028
|
+
isEngineRunning: (state) => !!state.engineRunning,
|
|
9029
|
+
tickFrame: function(state) {
|
|
9173
9030
|
!state.isShadow && layoutTick();
|
|
9174
9031
|
paintLinks();
|
|
9175
9032
|
!state.isShadow && paintArrows();
|
|
@@ -9188,16 +9045,16 @@ window.__ModuleLoader__.load({
|
|
|
9188
9045
|
}
|
|
9189
9046
|
}
|
|
9190
9047
|
function paintNodes() {
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9048
|
+
const getVisibility = index$3(state.nodeVisibility);
|
|
9049
|
+
const getVal = index$3(state.nodeVal);
|
|
9050
|
+
const getColor = index$3(state.nodeColor);
|
|
9051
|
+
const getNodeCanvasObjectMode = index$3(state.nodeCanvasObjectMode);
|
|
9052
|
+
const ctx = state.ctx;
|
|
9053
|
+
const padAmount = state.isShadow / state.globalScale;
|
|
9054
|
+
const visibleNodes = state.graphData.nodes.filter(getVisibility);
|
|
9198
9055
|
ctx.save();
|
|
9199
|
-
visibleNodes.forEach(
|
|
9200
|
-
|
|
9056
|
+
visibleNodes.forEach((node) => {
|
|
9057
|
+
const nodeCanvasObjectMode = getNodeCanvasObjectMode(node);
|
|
9201
9058
|
if (state.nodeCanvasObject && (nodeCanvasObjectMode === "before" || nodeCanvasObjectMode === "replace")) {
|
|
9202
9059
|
state.nodeCanvasObject(node, ctx, state.globalScale);
|
|
9203
9060
|
if (nodeCanvasObjectMode === "replace") {
|
|
@@ -9205,7 +9062,7 @@ window.__ModuleLoader__.load({
|
|
|
9205
9062
|
return;
|
|
9206
9063
|
}
|
|
9207
9064
|
}
|
|
9208
|
-
|
|
9065
|
+
const r = Math.sqrt(Math.max(0, getVal(node) || 1)) * state.nodeRelSize + padAmount;
|
|
9209
9066
|
ctx.beginPath();
|
|
9210
9067
|
ctx.arc(node.x, node.y, r, 0, 2 * Math.PI, false);
|
|
9211
9068
|
ctx.fillStyle = getColor(node) || "rgba(31, 120, 180, 0.92)";
|
|
@@ -9215,60 +9072,55 @@ window.__ModuleLoader__.load({
|
|
|
9215
9072
|
ctx.restore();
|
|
9216
9073
|
}
|
|
9217
9074
|
function paintLinks() {
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9075
|
+
const getVisibility = index$3(state.linkVisibility);
|
|
9076
|
+
const getColor = index$3(state.linkColor);
|
|
9077
|
+
const getWidth = index$3(state.linkWidth);
|
|
9078
|
+
const getLineDash = index$3(state.linkLineDash);
|
|
9079
|
+
const getCurvature = index$3(state.linkCurvature);
|
|
9080
|
+
const getLinkCanvasObjectMode = index$3(state.linkCanvasObjectMode);
|
|
9081
|
+
const ctx = state.ctx;
|
|
9082
|
+
const padAmount = state.isShadow * 2;
|
|
9083
|
+
const visibleLinks = state.graphData.links.filter(getVisibility);
|
|
9227
9084
|
visibleLinks.forEach(calcLinkControlPoints);
|
|
9228
|
-
|
|
9085
|
+
let beforeCustomLinks = [], afterCustomLinks = [], defaultPaintLinks = visibleLinks;
|
|
9229
9086
|
if (state.linkCanvasObject) {
|
|
9230
|
-
|
|
9231
|
-
visibleLinks.forEach(
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9087
|
+
const replaceCustomLinks = [], otherCustomLinks = [];
|
|
9088
|
+
visibleLinks.forEach((d) => ({
|
|
9089
|
+
before: beforeCustomLinks,
|
|
9090
|
+
after: afterCustomLinks,
|
|
9091
|
+
replace: replaceCustomLinks
|
|
9092
|
+
}[getLinkCanvasObjectMode(d)] || otherCustomLinks).push(d));
|
|
9093
|
+
defaultPaintLinks = [
|
|
9094
|
+
...beforeCustomLinks,
|
|
9095
|
+
...afterCustomLinks,
|
|
9096
|
+
...otherCustomLinks
|
|
9097
|
+
];
|
|
9239
9098
|
beforeCustomLinks = beforeCustomLinks.concat(replaceCustomLinks);
|
|
9240
9099
|
}
|
|
9241
9100
|
ctx.save();
|
|
9242
|
-
beforeCustomLinks.forEach(
|
|
9243
|
-
return state.linkCanvasObject(link, ctx, state.globalScale);
|
|
9244
|
-
});
|
|
9101
|
+
beforeCustomLinks.forEach((link) => state.linkCanvasObject(link, ctx, state.globalScale));
|
|
9245
9102
|
ctx.restore();
|
|
9246
|
-
|
|
9103
|
+
const linksPerColor = index(defaultPaintLinks, [
|
|
9247
9104
|
getColor,
|
|
9248
9105
|
getWidth,
|
|
9249
9106
|
getLineDash
|
|
9250
9107
|
]);
|
|
9251
9108
|
ctx.save();
|
|
9252
|
-
Object.entries(linksPerColor).forEach(
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
Object.entries(linesPerLineDash).forEach(function(_ref5) {
|
|
9259
|
-
var _ref6 = _slicedToArray(_ref5, 2);
|
|
9260
|
-
_ref6[0];
|
|
9261
|
-
var links = _ref6[1];
|
|
9262
|
-
var lineDashSegments = getLineDash(links[0]);
|
|
9109
|
+
Object.entries(linksPerColor).forEach(([color, linksPerWidth]) => {
|
|
9110
|
+
const lineColor = !color || color === "undefined" ? "rgba(0,0,0,0.15)" : color;
|
|
9111
|
+
Object.entries(linksPerWidth).forEach(([width, linesPerLineDash]) => {
|
|
9112
|
+
const lineWidth = (width || 1) / state.globalScale + padAmount;
|
|
9113
|
+
Object.entries(linesPerLineDash).forEach(([dashSegments, links]) => {
|
|
9114
|
+
const lineDashSegments = getLineDash(links[0]);
|
|
9263
9115
|
ctx.beginPath();
|
|
9264
|
-
links.forEach(
|
|
9265
|
-
|
|
9266
|
-
|
|
9116
|
+
links.forEach((link) => {
|
|
9117
|
+
const start = link.source;
|
|
9118
|
+
const end = link.target;
|
|
9267
9119
|
if (!start || !end || !start.hasOwnProperty("x") || !end.hasOwnProperty("x")) return;
|
|
9268
9120
|
ctx.moveTo(start.x, start.y);
|
|
9269
|
-
|
|
9121
|
+
const controlPoints = link.__controlPoints;
|
|
9270
9122
|
if (!controlPoints) ctx.lineTo(end.x, end.y);
|
|
9271
|
-
else ctx[controlPoints.length === 2 ? "quadraticCurveTo" : "bezierCurveTo"]
|
|
9123
|
+
else ctx[controlPoints.length === 2 ? "quadraticCurveTo" : "bezierCurveTo"](...controlPoints, end.x, end.y);
|
|
9272
9124
|
});
|
|
9273
9125
|
ctx.strokeStyle = lineColor;
|
|
9274
9126
|
ctx.lineWidth = lineWidth;
|
|
@@ -9279,74 +9131,68 @@ window.__ModuleLoader__.load({
|
|
|
9279
9131
|
});
|
|
9280
9132
|
ctx.restore();
|
|
9281
9133
|
ctx.save();
|
|
9282
|
-
afterCustomLinks.forEach(
|
|
9283
|
-
return state.linkCanvasObject(link, ctx, state.globalScale);
|
|
9284
|
-
});
|
|
9134
|
+
afterCustomLinks.forEach((link) => state.linkCanvasObject(link, ctx, state.globalScale));
|
|
9285
9135
|
ctx.restore();
|
|
9286
9136
|
function calcLinkControlPoints(link) {
|
|
9287
|
-
|
|
9137
|
+
const curvature = getCurvature(link);
|
|
9288
9138
|
if (!curvature) {
|
|
9289
9139
|
link.__controlPoints = null;
|
|
9290
9140
|
return;
|
|
9291
9141
|
}
|
|
9292
|
-
|
|
9293
|
-
|
|
9142
|
+
const start = link.source;
|
|
9143
|
+
const end = link.target;
|
|
9294
9144
|
if (!start || !end || !start.hasOwnProperty("x") || !end.hasOwnProperty("x")) return;
|
|
9295
|
-
|
|
9145
|
+
const l = Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2));
|
|
9296
9146
|
if (l > 0) {
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9147
|
+
const a = Math.atan2(end.y - start.y, end.x - start.x);
|
|
9148
|
+
const d = l * curvature;
|
|
9149
|
+
const cp = {
|
|
9300
9150
|
x: (start.x + end.x) / 2 + d * Math.cos(a - Math.PI / 2),
|
|
9301
9151
|
y: (start.y + end.y) / 2 + d * Math.sin(a - Math.PI / 2)
|
|
9302
9152
|
};
|
|
9303
9153
|
link.__controlPoints = [cp.x, cp.y];
|
|
9304
9154
|
} else {
|
|
9305
|
-
|
|
9155
|
+
const d = curvature * 70;
|
|
9306
9156
|
link.__controlPoints = [
|
|
9307
9157
|
end.x,
|
|
9308
|
-
end.y -
|
|
9309
|
-
end.x +
|
|
9158
|
+
end.y - d,
|
|
9159
|
+
end.x + d,
|
|
9310
9160
|
end.y
|
|
9311
9161
|
];
|
|
9312
9162
|
}
|
|
9313
9163
|
}
|
|
9314
9164
|
}
|
|
9315
9165
|
function paintArrows() {
|
|
9316
|
-
|
|
9317
|
-
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9166
|
+
const ARROW_WH_RATIO = 1.6;
|
|
9167
|
+
const getLength = index$3(state.linkDirectionalArrowLength);
|
|
9168
|
+
const getRelPos = index$3(state.linkDirectionalArrowRelPos);
|
|
9169
|
+
const getVisibility = index$3(state.linkVisibility);
|
|
9170
|
+
const getColor = index$3(state.linkDirectionalArrowColor || state.linkColor);
|
|
9171
|
+
const getNodeVal = index$3(state.nodeVal);
|
|
9172
|
+
const ctx = state.ctx;
|
|
9323
9173
|
ctx.save();
|
|
9324
|
-
state.graphData.links.filter(getVisibility).forEach(
|
|
9325
|
-
|
|
9174
|
+
state.graphData.links.filter(getVisibility).forEach((link) => {
|
|
9175
|
+
const arrowLength = getLength(link);
|
|
9326
9176
|
if (!arrowLength || arrowLength < 0) return;
|
|
9327
|
-
|
|
9328
|
-
|
|
9177
|
+
const start = link.source;
|
|
9178
|
+
const end = link.target;
|
|
9329
9179
|
if (!start || !end || !start.hasOwnProperty("x") || !end.hasOwnProperty("x")) return;
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
var arrowHead = getCoordsAlongLine(posAlongLine / lineLen);
|
|
9347
|
-
var arrowTail = getCoordsAlongLine((posAlongLine - arrowLength) / lineLen);
|
|
9348
|
-
var arrowTailVertex = getCoordsAlongLine((posAlongLine - arrowLength * .8) / lineLen);
|
|
9349
|
-
var arrowTailAngle = Math.atan2(arrowHead.y - arrowTail.y, arrowHead.x - arrowTail.x) - Math.PI / 2;
|
|
9180
|
+
const startR = Math.sqrt(Math.max(0, getNodeVal(start) || 1)) * state.nodeRelSize;
|
|
9181
|
+
const endR = Math.sqrt(Math.max(0, getNodeVal(end) || 1)) * state.nodeRelSize;
|
|
9182
|
+
const arrowRelPos = Math.min(1, Math.max(0, getRelPos(link)));
|
|
9183
|
+
const arrowColor = getColor(link) || "rgba(0,0,0,0.28)";
|
|
9184
|
+
const arrowHalfWidth = arrowLength / ARROW_WH_RATIO / 2;
|
|
9185
|
+
const bzLine = link.__controlPoints && new Bezier(start.x, start.y, ...link.__controlPoints, end.x, end.y);
|
|
9186
|
+
const getCoordsAlongLine = bzLine ? (t) => bzLine.get(t) : (t) => ({
|
|
9187
|
+
x: start.x + (end.x - start.x) * t || 0,
|
|
9188
|
+
y: start.y + (end.y - start.y) * t || 0
|
|
9189
|
+
});
|
|
9190
|
+
const lineLen = bzLine ? bzLine.length() : Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2));
|
|
9191
|
+
const posAlongLine = startR + arrowLength + (lineLen - startR - endR - arrowLength) * arrowRelPos;
|
|
9192
|
+
const arrowHead = getCoordsAlongLine(posAlongLine / lineLen);
|
|
9193
|
+
const arrowTail = getCoordsAlongLine((posAlongLine - arrowLength) / lineLen);
|
|
9194
|
+
const arrowTailVertex = getCoordsAlongLine((posAlongLine - arrowLength * .8) / lineLen);
|
|
9195
|
+
const arrowTailAngle = Math.atan2(arrowHead.y - arrowTail.y, arrowHead.x - arrowTail.x) - Math.PI / 2;
|
|
9350
9196
|
ctx.beginPath();
|
|
9351
9197
|
ctx.moveTo(arrowHead.x, arrowHead.y);
|
|
9352
9198
|
ctx.lineTo(arrowTail.x + arrowHalfWidth * Math.cos(arrowTailAngle), arrowTail.y + arrowHalfWidth * Math.sin(arrowTailAngle));
|
|
@@ -9358,30 +9204,31 @@ window.__ModuleLoader__.load({
|
|
|
9358
9204
|
ctx.restore();
|
|
9359
9205
|
}
|
|
9360
9206
|
function paintPhotons() {
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9207
|
+
const getNumPhotons = index$3(state.linkDirectionalParticles);
|
|
9208
|
+
const getSpeed = index$3(state.linkDirectionalParticleSpeed);
|
|
9209
|
+
const getOffset = index$3(state.linkDirectionalParticleOffset);
|
|
9210
|
+
const getDiameter = index$3(state.linkDirectionalParticleWidth);
|
|
9211
|
+
const getVisibility = index$3(state.linkVisibility);
|
|
9212
|
+
const getColor = index$3(state.linkDirectionalParticleColor || state.linkColor);
|
|
9213
|
+
const ctx = state.ctx;
|
|
9368
9214
|
ctx.save();
|
|
9369
|
-
state.graphData.links.filter(getVisibility).forEach(
|
|
9370
|
-
|
|
9215
|
+
state.graphData.links.filter(getVisibility).forEach((link) => {
|
|
9216
|
+
const numCyclePhotons = getNumPhotons(link);
|
|
9371
9217
|
if (!link.hasOwnProperty("__photons") || !link.__photons.length) return;
|
|
9372
|
-
|
|
9373
|
-
|
|
9218
|
+
const start = link.source;
|
|
9219
|
+
const end = link.target;
|
|
9374
9220
|
if (!start || !end || !start.hasOwnProperty("x") || !end.hasOwnProperty("x")) return;
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9221
|
+
const particleSpeed = getSpeed(link);
|
|
9222
|
+
const particleOffset = Math.abs(getOffset(link));
|
|
9223
|
+
const photons = link.__photons || [];
|
|
9224
|
+
const photonR = Math.max(0, getDiameter(link) / 2) / Math.sqrt(state.globalScale);
|
|
9225
|
+
const photonColor = getColor(link) || "rgba(0,0,0,0.28)";
|
|
9226
|
+
ctx.fillStyle = photonColor;
|
|
9227
|
+
const bzLine = link.__controlPoints ? new Bezier(start.x, start.y, ...link.__controlPoints, end.x, end.y) : null;
|
|
9228
|
+
let cyclePhotonIdx = 0;
|
|
9229
|
+
let needsCleanup = false;
|
|
9230
|
+
photons.forEach((photon) => {
|
|
9231
|
+
const singleHop = !!photon.__singleHop;
|
|
9385
9232
|
if (!photon.hasOwnProperty("__progressRatio")) photon.__progressRatio = singleHop ? particleSpeed < 0 ? 1 : 0 : (cyclePhotonIdx + particleOffset) / numCyclePhotons;
|
|
9386
9233
|
!singleHop && cyclePhotonIdx++;
|
|
9387
9234
|
photon.__progressRatio += particleSpeed;
|
|
@@ -9394,8 +9241,8 @@ window.__ModuleLoader__.load({
|
|
|
9394
9241
|
return;
|
|
9395
9242
|
}
|
|
9396
9243
|
}
|
|
9397
|
-
|
|
9398
|
-
|
|
9244
|
+
const photonPosRatio = photon.__progressRatio;
|
|
9245
|
+
const coords = bzLine ? bzLine.get(photonPosRatio) : {
|
|
9399
9246
|
x: start.x + (end.x - start.x) * photonPosRatio || 0,
|
|
9400
9247
|
y: start.y + (end.y - start.y) * photonPosRatio || 0
|
|
9401
9248
|
};
|
|
@@ -9406,14 +9253,12 @@ window.__ModuleLoader__.load({
|
|
|
9406
9253
|
ctx.fill();
|
|
9407
9254
|
}
|
|
9408
9255
|
});
|
|
9409
|
-
if (needsCleanup) link.__photons = link.__photons.filter(
|
|
9410
|
-
return !photon.__singleHop || photon.__progressRatio <= 1 && photon.__progressRatio >= 0;
|
|
9411
|
-
});
|
|
9256
|
+
if (needsCleanup) link.__photons = link.__photons.filter((photon) => !photon.__singleHop || photon.__progressRatio <= 1 && photon.__progressRatio >= 0);
|
|
9412
9257
|
});
|
|
9413
9258
|
ctx.restore();
|
|
9414
9259
|
}
|
|
9415
9260
|
},
|
|
9416
|
-
emitParticle: function
|
|
9261
|
+
emitParticle: function(state, link) {
|
|
9417
9262
|
if (link) {
|
|
9418
9263
|
!link.__photons && (link.__photons = []);
|
|
9419
9264
|
link.__photons.push({ __singleHop: true });
|
|
@@ -9421,47 +9266,39 @@ window.__ModuleLoader__.load({
|
|
|
9421
9266
|
return this;
|
|
9422
9267
|
}
|
|
9423
9268
|
},
|
|
9424
|
-
stateInit:
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
},
|
|
9430
|
-
init: function init(canvasCtx, state) {
|
|
9269
|
+
stateInit: () => ({
|
|
9270
|
+
forceLayout: simulation_default().force("link", link_default()).force("charge", manyBody_default()).force("center", center_default()).force("dagRadial", null).stop(),
|
|
9271
|
+
engineRunning: false
|
|
9272
|
+
}),
|
|
9273
|
+
init(canvasCtx, state) {
|
|
9431
9274
|
state.ctx = canvasCtx;
|
|
9432
9275
|
},
|
|
9433
|
-
update
|
|
9276
|
+
update(state, changedProps) {
|
|
9434
9277
|
state.engineRunning = false;
|
|
9435
9278
|
state.onUpdate();
|
|
9436
9279
|
if (state.nodeAutoColorBy !== null) autoColorObjects(state.graphData.nodes, index$3(state.nodeAutoColorBy), state.nodeColor);
|
|
9437
9280
|
if (state.linkAutoColorBy !== null) autoColorObjects(state.graphData.links, index$3(state.linkAutoColorBy), state.linkColor);
|
|
9438
|
-
state.graphData.links.forEach(
|
|
9281
|
+
state.graphData.links.forEach((link) => {
|
|
9439
9282
|
link.source = link[state.linkSource];
|
|
9440
9283
|
link.target = link[state.linkTarget];
|
|
9441
9284
|
});
|
|
9442
9285
|
state.forceLayout.stop().alpha(1).nodes(state.graphData.nodes);
|
|
9443
|
-
|
|
9444
|
-
if (linkForce) linkForce.id(
|
|
9445
|
-
|
|
9446
|
-
}).links(state.graphData.links);
|
|
9447
|
-
var nodeDepths = state.dagMode && getDagDepths(state.graphData, function(node) {
|
|
9448
|
-
return node[state.nodeId];
|
|
9449
|
-
}, {
|
|
9286
|
+
const linkForce = state.forceLayout.force("link");
|
|
9287
|
+
if (linkForce) linkForce.id((d) => d[state.nodeId]).links(state.graphData.links);
|
|
9288
|
+
const nodeDepths = state.dagMode && getDagDepths(state.graphData, (node) => node[state.nodeId], {
|
|
9450
9289
|
nodeFilter: state.dagNodeFilter,
|
|
9451
9290
|
onLoopError: state.onDagError || void 0
|
|
9452
9291
|
});
|
|
9453
|
-
|
|
9454
|
-
|
|
9292
|
+
const maxDepth = Math.max(...Object.values(nodeDepths || []));
|
|
9293
|
+
const dagLevelDistance = state.dagLevelDistance || state.graphData.nodes.length / (maxDepth || 1) * DAG_LEVEL_NODE_RATIO * (["radialin", "radialout"].indexOf(state.dagMode) !== -1 ? .7 : 1);
|
|
9455
9294
|
if ([
|
|
9456
9295
|
"lr",
|
|
9457
9296
|
"rl",
|
|
9458
9297
|
"td",
|
|
9459
9298
|
"bu"
|
|
9460
9299
|
].includes(changedProps.dagMode)) {
|
|
9461
|
-
|
|
9462
|
-
state.graphData.nodes.filter(state.dagNodeFilter).forEach(
|
|
9463
|
-
return delete node[resetProp];
|
|
9464
|
-
});
|
|
9300
|
+
const resetProp = ["lr", "rl"].includes(changedProps.dagMode) ? "fx" : "fy";
|
|
9301
|
+
state.graphData.nodes.filter(state.dagNodeFilter).forEach((node) => delete node[resetProp]);
|
|
9465
9302
|
}
|
|
9466
9303
|
if ([
|
|
9467
9304
|
"lr",
|
|
@@ -9469,49 +9306,40 @@ window.__ModuleLoader__.load({
|
|
|
9469
9306
|
"td",
|
|
9470
9307
|
"bu"
|
|
9471
9308
|
].includes(state.dagMode)) {
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
var _resetProp = ["lr", "rl"].includes(state.dagMode) ? "fx" : "fy";
|
|
9477
|
-
state.graphData.nodes.filter(state.dagNodeFilter).forEach(function(node) {
|
|
9478
|
-
return node[_resetProp] = fixFn(node);
|
|
9479
|
-
});
|
|
9309
|
+
const invert = ["rl", "bu"].includes(state.dagMode);
|
|
9310
|
+
const fixFn = (node) => (nodeDepths[node[state.nodeId]] - maxDepth / 2) * dagLevelDistance * (invert ? -1 : 1);
|
|
9311
|
+
const resetProp = ["lr", "rl"].includes(state.dagMode) ? "fx" : "fy";
|
|
9312
|
+
state.graphData.nodes.filter(state.dagNodeFilter).forEach((node) => node[resetProp] = fixFn(node));
|
|
9480
9313
|
}
|
|
9481
|
-
state.forceLayout.force("dagRadial", ["radialin", "radialout"].indexOf(state.dagMode) !== -1 ? radial_default(
|
|
9482
|
-
|
|
9314
|
+
state.forceLayout.force("dagRadial", ["radialin", "radialout"].indexOf(state.dagMode) !== -1 ? radial_default((node) => {
|
|
9315
|
+
const nodeDepth = nodeDepths[node[state.nodeId]] || -1;
|
|
9483
9316
|
return (state.dagMode === "radialin" ? maxDepth - nodeDepth : nodeDepth) * dagLevelDistance;
|
|
9484
|
-
}).strength(
|
|
9485
|
-
|
|
9486
|
-
}) : null);
|
|
9487
|
-
for (var i = 0; i < state.warmupTicks && !(state.d3AlphaMin > 0 && state.forceLayout.alpha() < state.d3AlphaMin); i++) state.forceLayout.tick();
|
|
9317
|
+
}).strength((node) => state.dagNodeFilter(node) ? 1 : 0) : null);
|
|
9318
|
+
for (let i = 0; i < state.warmupTicks && !(state.d3AlphaMin > 0 && state.forceLayout.alpha() < state.d3AlphaMin); i++) state.forceLayout.tick();
|
|
9488
9319
|
this.resetCountdown();
|
|
9489
9320
|
state.onFinishUpdate();
|
|
9490
9321
|
}
|
|
9491
9322
|
});
|
|
9492
9323
|
function linkKapsule(kapsulePropNames, kapsuleType) {
|
|
9493
|
-
|
|
9494
|
-
|
|
9324
|
+
const propNames = kapsulePropNames instanceof Array ? kapsulePropNames : [kapsulePropNames];
|
|
9325
|
+
const dummyK = new kapsuleType();
|
|
9495
9326
|
dummyK._destructor && dummyK._destructor();
|
|
9496
9327
|
return {
|
|
9497
|
-
linkProp: function
|
|
9328
|
+
linkProp: function(prop) {
|
|
9498
9329
|
return {
|
|
9499
|
-
|
|
9500
|
-
onChange
|
|
9501
|
-
propNames.forEach(
|
|
9502
|
-
return state[propName][prop](v);
|
|
9503
|
-
});
|
|
9330
|
+
default: dummyK[prop](),
|
|
9331
|
+
onChange(v, state) {
|
|
9332
|
+
propNames.forEach((propName) => state[propName][prop](v));
|
|
9504
9333
|
},
|
|
9505
9334
|
triggerUpdate: false
|
|
9506
9335
|
};
|
|
9507
9336
|
},
|
|
9508
|
-
linkMethod: function
|
|
9509
|
-
return function(state) {
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
var returnVal = kapsuleInstance[method].apply(kapsuleInstance, args);
|
|
9337
|
+
linkMethod: function(method) {
|
|
9338
|
+
return function(state, ...args) {
|
|
9339
|
+
const returnVals = [];
|
|
9340
|
+
propNames.forEach((propName) => {
|
|
9341
|
+
const kapsuleInstance = state[propName];
|
|
9342
|
+
const returnVal = kapsuleInstance[method](...args);
|
|
9515
9343
|
if (returnVal !== kapsuleInstance) returnVals.push(returnVal);
|
|
9516
9344
|
});
|
|
9517
9345
|
return returnVals.length ? returnVals[0] : this;
|
|
@@ -9519,12 +9347,12 @@ window.__ModuleLoader__.load({
|
|
|
9519
9347
|
}
|
|
9520
9348
|
};
|
|
9521
9349
|
}
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
|
|
9350
|
+
const HOVER_CANVAS_THROTTLE_DELAY = 800;
|
|
9351
|
+
const ZOOM2NODES_FACTOR = 4;
|
|
9352
|
+
const DRAG_CLICK_TOLERANCE_PX = 5;
|
|
9353
|
+
const bindFG = linkKapsule("forceGraph", CanvasForceGraph);
|
|
9354
|
+
const bindBoth = linkKapsule(["forceGraph", "shadowGraph"], CanvasForceGraph);
|
|
9355
|
+
const linkedProps = Object.assign(...[
|
|
9528
9356
|
"nodeColor",
|
|
9529
9357
|
"nodeAutoColorBy",
|
|
9530
9358
|
"nodeCanvasObject",
|
|
@@ -9556,9 +9384,7 @@ window.__ModuleLoader__.load({
|
|
|
9556
9384
|
"cooldownTime",
|
|
9557
9385
|
"onEngineTick",
|
|
9558
9386
|
"onEngineStop"
|
|
9559
|
-
].map(
|
|
9560
|
-
return _defineProperty({}, p, bindFG.linkProp(p));
|
|
9561
|
-
})).concat(_toConsumableArray([
|
|
9387
|
+
].map((p) => ({ [p]: bindFG.linkProp(p) })), ...[
|
|
9562
9388
|
"nodeRelSize",
|
|
9563
9389
|
"nodeId",
|
|
9564
9390
|
"nodeVal",
|
|
@@ -9567,38 +9393,34 @@ window.__ModuleLoader__.load({
|
|
|
9567
9393
|
"linkTarget",
|
|
9568
9394
|
"linkVisibility",
|
|
9569
9395
|
"linkCurvature"
|
|
9570
|
-
].map(
|
|
9571
|
-
|
|
9572
|
-
}))));
|
|
9573
|
-
var linkedMethods = Object.assign.apply(Object, _toConsumableArray([
|
|
9396
|
+
].map((p) => ({ [p]: bindBoth.linkProp(p) })));
|
|
9397
|
+
const linkedMethods = Object.assign(...[
|
|
9574
9398
|
"d3Force",
|
|
9575
9399
|
"d3ReheatSimulation",
|
|
9576
9400
|
"emitParticle"
|
|
9577
|
-
].map(
|
|
9578
|
-
return _defineProperty({}, p, bindFG.linkMethod(p));
|
|
9579
|
-
})));
|
|
9401
|
+
].map((p) => ({ [p]: bindFG.linkMethod(p) })));
|
|
9580
9402
|
function adjustCanvasSize(state) {
|
|
9581
9403
|
if (state.canvas) {
|
|
9582
|
-
|
|
9583
|
-
|
|
9404
|
+
let curWidth = state.canvas.width;
|
|
9405
|
+
let curHeight = state.canvas.height;
|
|
9584
9406
|
if (curWidth === 300 && curHeight === 150) curWidth = curHeight = 0;
|
|
9585
|
-
|
|
9407
|
+
const pxScale = window.devicePixelRatio;
|
|
9586
9408
|
curWidth /= pxScale;
|
|
9587
9409
|
curHeight /= pxScale;
|
|
9588
|
-
[state.canvas, state.shadowCanvas].forEach(
|
|
9589
|
-
canvas.style.width =
|
|
9590
|
-
canvas.style.height =
|
|
9410
|
+
[state.canvas, state.shadowCanvas].forEach((canvas) => {
|
|
9411
|
+
canvas.style.width = `${state.width}px`;
|
|
9412
|
+
canvas.style.height = `${state.height}px`;
|
|
9591
9413
|
canvas.width = state.width * pxScale;
|
|
9592
9414
|
canvas.height = state.height * pxScale;
|
|
9593
9415
|
if (!curWidth && !curHeight) canvas.getContext("2d").scale(pxScale, pxScale);
|
|
9594
9416
|
});
|
|
9595
|
-
|
|
9417
|
+
const k = transform(state.canvas).k;
|
|
9596
9418
|
state.zoom.translateBy(state.zoom.__baseElem, (state.width - curWidth) / 2 / k, (state.height - curHeight) / 2 / k);
|
|
9597
9419
|
state.needsRedraw = true;
|
|
9598
9420
|
}
|
|
9599
9421
|
}
|
|
9600
9422
|
function resetTransform(ctx) {
|
|
9601
|
-
|
|
9423
|
+
const pxRatio = window.devicePixelRatio;
|
|
9602
9424
|
ctx.setTransform(pxRatio, 0, 0, pxRatio, 0, 0);
|
|
9603
9425
|
}
|
|
9604
9426
|
function clearCanvas(ctx, width, height) {
|
|
@@ -9608,32 +9430,24 @@ window.__ModuleLoader__.load({
|
|
|
9608
9430
|
ctx.restore();
|
|
9609
9431
|
}
|
|
9610
9432
|
var forceGraph = index$4({
|
|
9611
|
-
props:
|
|
9433
|
+
props: {
|
|
9612
9434
|
width: {
|
|
9613
|
-
|
|
9614
|
-
onChange:
|
|
9615
|
-
return adjustCanvasSize(state);
|
|
9616
|
-
},
|
|
9435
|
+
default: window.innerWidth,
|
|
9436
|
+
onChange: (_, state) => adjustCanvasSize(state),
|
|
9617
9437
|
triggerUpdate: false
|
|
9618
9438
|
},
|
|
9619
9439
|
height: {
|
|
9620
|
-
|
|
9621
|
-
onChange:
|
|
9622
|
-
return adjustCanvasSize(state);
|
|
9623
|
-
},
|
|
9440
|
+
default: window.innerHeight,
|
|
9441
|
+
onChange: (_, state) => adjustCanvasSize(state),
|
|
9624
9442
|
triggerUpdate: false
|
|
9625
9443
|
},
|
|
9626
9444
|
graphData: {
|
|
9627
|
-
|
|
9445
|
+
default: {
|
|
9628
9446
|
nodes: [],
|
|
9629
9447
|
links: []
|
|
9630
9448
|
},
|
|
9631
|
-
onChange:
|
|
9632
|
-
[d.nodes, d.links].every(
|
|
9633
|
-
return (arr || []).every(function(d) {
|
|
9634
|
-
return !d.hasOwnProperty("__indexColor");
|
|
9635
|
-
});
|
|
9636
|
-
}) && state.colorTracker.reset();
|
|
9449
|
+
onChange: (d, state) => {
|
|
9450
|
+
[d.nodes, d.links].every((arr) => (arr || []).every((d) => !d.hasOwnProperty("__indexColor"))) && state.colorTracker.reset();
|
|
9637
9451
|
[{
|
|
9638
9452
|
type: "Node",
|
|
9639
9453
|
objs: d.nodes
|
|
@@ -9643,13 +9457,12 @@ window.__ModuleLoader__.load({
|
|
|
9643
9457
|
}].forEach(hexIndex);
|
|
9644
9458
|
state.forceGraph.graphData(d);
|
|
9645
9459
|
state.shadowGraph.graphData(d);
|
|
9646
|
-
function hexIndex(
|
|
9647
|
-
|
|
9648
|
-
_ref4.objs.filter(function(d) {
|
|
9460
|
+
function hexIndex({ type, objs }) {
|
|
9461
|
+
objs.filter((d) => {
|
|
9649
9462
|
if (!d.hasOwnProperty("__indexColor")) return true;
|
|
9650
|
-
|
|
9463
|
+
const cur = state.colorTracker.lookup(d.__indexColor);
|
|
9651
9464
|
return !cur || !cur.hasOwnProperty("d") || cur.d !== d;
|
|
9652
|
-
}).forEach(
|
|
9465
|
+
}).forEach((d) => {
|
|
9653
9466
|
d.__indexColor = state.colorTracker.register({
|
|
9654
9467
|
type,
|
|
9655
9468
|
d
|
|
@@ -9660,88 +9473,84 @@ window.__ModuleLoader__.load({
|
|
|
9660
9473
|
triggerUpdate: false
|
|
9661
9474
|
},
|
|
9662
9475
|
backgroundColor: {
|
|
9663
|
-
onChange
|
|
9476
|
+
onChange(color, state) {
|
|
9664
9477
|
state.canvas && color && (state.canvas.style.background = color);
|
|
9665
9478
|
},
|
|
9666
9479
|
triggerUpdate: false
|
|
9667
9480
|
},
|
|
9668
9481
|
nodeLabel: {
|
|
9669
|
-
|
|
9482
|
+
default: "name",
|
|
9670
9483
|
triggerUpdate: false
|
|
9671
9484
|
},
|
|
9672
9485
|
nodePointerAreaPaint: {
|
|
9673
|
-
onChange
|
|
9674
|
-
state.shadowGraph.nodeCanvasObject(!paintFn ? null :
|
|
9675
|
-
return paintFn(node, node.__indexColor, ctx, globalScale);
|
|
9676
|
-
});
|
|
9486
|
+
onChange(paintFn, state) {
|
|
9487
|
+
state.shadowGraph.nodeCanvasObject(!paintFn ? null : (node, ctx, globalScale) => paintFn(node, node.__indexColor, ctx, globalScale));
|
|
9677
9488
|
state.flushShadowCanvas && state.flushShadowCanvas();
|
|
9678
9489
|
},
|
|
9679
9490
|
triggerUpdate: false
|
|
9680
9491
|
},
|
|
9681
9492
|
linkPointerAreaPaint: {
|
|
9682
|
-
onChange
|
|
9683
|
-
state.shadowGraph.linkCanvasObject(!paintFn ? null :
|
|
9684
|
-
return paintFn(link, link.__indexColor, ctx, globalScale);
|
|
9685
|
-
});
|
|
9493
|
+
onChange(paintFn, state) {
|
|
9494
|
+
state.shadowGraph.linkCanvasObject(!paintFn ? null : (link, ctx, globalScale) => paintFn(link, link.__indexColor, ctx, globalScale));
|
|
9686
9495
|
state.flushShadowCanvas && state.flushShadowCanvas();
|
|
9687
9496
|
},
|
|
9688
9497
|
triggerUpdate: false
|
|
9689
9498
|
},
|
|
9690
9499
|
linkLabel: {
|
|
9691
|
-
|
|
9500
|
+
default: "name",
|
|
9692
9501
|
triggerUpdate: false
|
|
9693
9502
|
},
|
|
9694
9503
|
linkHoverPrecision: {
|
|
9695
|
-
|
|
9504
|
+
default: 4,
|
|
9696
9505
|
triggerUpdate: false
|
|
9697
9506
|
},
|
|
9698
9507
|
minZoom: {
|
|
9699
|
-
|
|
9700
|
-
onChange
|
|
9508
|
+
default: .01,
|
|
9509
|
+
onChange(minZoom, state) {
|
|
9701
9510
|
state.zoom.scaleExtent([minZoom, state.zoom.scaleExtent()[1]]);
|
|
9702
9511
|
},
|
|
9703
9512
|
triggerUpdate: false
|
|
9704
9513
|
},
|
|
9705
9514
|
maxZoom: {
|
|
9706
|
-
|
|
9707
|
-
onChange
|
|
9515
|
+
default: 1e3,
|
|
9516
|
+
onChange(maxZoom, state) {
|
|
9708
9517
|
state.zoom.scaleExtent([state.zoom.scaleExtent()[0], maxZoom]);
|
|
9709
9518
|
},
|
|
9710
9519
|
triggerUpdate: false
|
|
9711
9520
|
},
|
|
9712
9521
|
enableNodeDrag: {
|
|
9713
|
-
|
|
9522
|
+
default: true,
|
|
9714
9523
|
triggerUpdate: false
|
|
9715
9524
|
},
|
|
9716
9525
|
enableZoomInteraction: {
|
|
9717
|
-
|
|
9526
|
+
default: true,
|
|
9718
9527
|
triggerUpdate: false
|
|
9719
9528
|
},
|
|
9720
9529
|
enablePanInteraction: {
|
|
9721
|
-
|
|
9530
|
+
default: true,
|
|
9722
9531
|
triggerUpdate: false
|
|
9723
9532
|
},
|
|
9724
9533
|
enableZoomPanInteraction: {
|
|
9725
|
-
|
|
9534
|
+
default: true,
|
|
9726
9535
|
triggerUpdate: false
|
|
9727
9536
|
},
|
|
9728
9537
|
enablePointerInteraction: {
|
|
9729
|
-
|
|
9730
|
-
onChange
|
|
9538
|
+
default: true,
|
|
9539
|
+
onChange(_, state) {
|
|
9731
9540
|
state.hoverObj = null;
|
|
9732
9541
|
},
|
|
9733
9542
|
triggerUpdate: false
|
|
9734
9543
|
},
|
|
9735
9544
|
autoPauseRedraw: {
|
|
9736
|
-
|
|
9545
|
+
default: true,
|
|
9737
9546
|
triggerUpdate: false
|
|
9738
9547
|
},
|
|
9739
9548
|
onNodeDrag: {
|
|
9740
|
-
|
|
9549
|
+
default: () => {},
|
|
9741
9550
|
triggerUpdate: false
|
|
9742
9551
|
},
|
|
9743
9552
|
onNodeDragEnd: {
|
|
9744
|
-
|
|
9553
|
+
default: () => {},
|
|
9745
9554
|
triggerUpdate: false
|
|
9746
9555
|
},
|
|
9747
9556
|
onNodeClick: { triggerUpdate: false },
|
|
@@ -9753,34 +9562,35 @@ window.__ModuleLoader__.load({
|
|
|
9753
9562
|
onBackgroundClick: { triggerUpdate: false },
|
|
9754
9563
|
onBackgroundRightClick: { triggerUpdate: false },
|
|
9755
9564
|
showPointerCursor: {
|
|
9756
|
-
|
|
9565
|
+
default: true,
|
|
9757
9566
|
triggerUpdate: false
|
|
9758
9567
|
},
|
|
9759
9568
|
onZoom: { triggerUpdate: false },
|
|
9760
9569
|
onZoomEnd: { triggerUpdate: false },
|
|
9761
9570
|
onRenderFramePre: { triggerUpdate: false },
|
|
9762
|
-
onRenderFramePost: { triggerUpdate: false }
|
|
9763
|
-
|
|
9571
|
+
onRenderFramePost: { triggerUpdate: false },
|
|
9572
|
+
...linkedProps
|
|
9573
|
+
},
|
|
9764
9574
|
aliases: { stopAnimation: "pauseAnimation" },
|
|
9765
|
-
methods:
|
|
9766
|
-
graph2ScreenCoords: function
|
|
9767
|
-
|
|
9575
|
+
methods: {
|
|
9576
|
+
graph2ScreenCoords: function(state, x, y) {
|
|
9577
|
+
const t = transform(state.canvas);
|
|
9768
9578
|
return {
|
|
9769
9579
|
x: x * t.k + t.x,
|
|
9770
9580
|
y: y * t.k + t.y
|
|
9771
9581
|
};
|
|
9772
9582
|
},
|
|
9773
|
-
screen2GraphCoords: function
|
|
9774
|
-
|
|
9583
|
+
screen2GraphCoords: function(state, x, y) {
|
|
9584
|
+
const t = transform(state.canvas);
|
|
9775
9585
|
return {
|
|
9776
9586
|
x: (x - t.x) / t.k,
|
|
9777
9587
|
y: (y - t.y) / t.k
|
|
9778
9588
|
};
|
|
9779
9589
|
},
|
|
9780
|
-
centerAt: function
|
|
9590
|
+
centerAt: function(state, x, y, transitionDuration) {
|
|
9781
9591
|
if (!state.canvas) return null;
|
|
9782
9592
|
if (x !== void 0 || y !== void 0) {
|
|
9783
|
-
|
|
9593
|
+
const finalPos = Object.assign({}, x !== void 0 ? { x } : {}, y !== void 0 ? { y } : {});
|
|
9784
9594
|
if (!transitionDuration) setCenter(finalPos);
|
|
9785
9595
|
else state.tweenGroup.add(new Tween(getCenter()).to(finalPos, transitionDuration).easing(Easing.Quadratic.Out).onUpdate(setCenter).onComplete(function() {
|
|
9786
9596
|
state.tweenGroup.remove(this);
|
|
@@ -9789,26 +9599,22 @@ window.__ModuleLoader__.load({
|
|
|
9789
9599
|
}
|
|
9790
9600
|
return getCenter();
|
|
9791
9601
|
function getCenter() {
|
|
9792
|
-
|
|
9602
|
+
const t = transform(state.canvas);
|
|
9793
9603
|
return {
|
|
9794
9604
|
x: (state.width / 2 - t.x) / t.k,
|
|
9795
9605
|
y: (state.height / 2 - t.y) / t.k
|
|
9796
9606
|
};
|
|
9797
9607
|
}
|
|
9798
|
-
function setCenter(
|
|
9799
|
-
var x = _ref5.x, y = _ref5.y;
|
|
9608
|
+
function setCenter({ x, y }) {
|
|
9800
9609
|
state.zoom.translateTo(state.zoom.__baseElem, x === void 0 ? getCenter().x : x, y === void 0 ? getCenter().y : y);
|
|
9801
9610
|
state.needsRedraw = true;
|
|
9802
9611
|
}
|
|
9803
9612
|
},
|
|
9804
|
-
zoom: function
|
|
9613
|
+
zoom: function(state, k, transitionDuration) {
|
|
9805
9614
|
if (!state.canvas) return null;
|
|
9806
9615
|
if (k !== void 0) {
|
|
9807
9616
|
if (!transitionDuration) setZoom(k);
|
|
9808
|
-
else state.tweenGroup.add(new Tween({ k: getZoom() }).to({ k }, transitionDuration).easing(Easing.Quadratic.Out).onUpdate(function(
|
|
9809
|
-
var k = _ref6.k;
|
|
9810
|
-
return setZoom(k);
|
|
9811
|
-
}).onComplete(function() {
|
|
9617
|
+
else state.tweenGroup.add(new Tween({ k: getZoom() }).to({ k }, transitionDuration).easing(Easing.Quadratic.Out).onUpdate(({ k }) => setZoom(k)).onComplete(function() {
|
|
9812
9618
|
state.tweenGroup.remove(this);
|
|
9813
9619
|
}).start());
|
|
9814
9620
|
return this;
|
|
@@ -9822,83 +9628,63 @@ window.__ModuleLoader__.load({
|
|
|
9822
9628
|
state.needsRedraw = true;
|
|
9823
9629
|
}
|
|
9824
9630
|
},
|
|
9825
|
-
zoomToFit: function
|
|
9826
|
-
|
|
9827
|
-
var padding = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 10;
|
|
9828
|
-
for (var _len = arguments.length, bboxArgs = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) bboxArgs[_key - 3] = arguments[_key];
|
|
9829
|
-
var bbox = this.getGraphBbox.apply(this, bboxArgs);
|
|
9631
|
+
zoomToFit: function(state, transitionDuration = 0, padding = 10, ...bboxArgs) {
|
|
9632
|
+
const bbox = this.getGraphBbox(...bboxArgs);
|
|
9830
9633
|
if (bbox) {
|
|
9831
|
-
|
|
9634
|
+
const center = {
|
|
9832
9635
|
x: (bbox.x[0] + bbox.x[1]) / 2,
|
|
9833
9636
|
y: (bbox.y[0] + bbox.y[1]) / 2
|
|
9834
9637
|
};
|
|
9835
|
-
|
|
9638
|
+
const zoomK = Math.max(1e-12, Math.min(0xe8d4a51000, (state.width - padding * 2) / (bbox.x[1] - bbox.x[0]), (state.height - padding * 2) / (bbox.y[1] - bbox.y[0])));
|
|
9836
9639
|
this.centerAt(center.x, center.y, transitionDuration);
|
|
9837
9640
|
this.zoom(zoomK, transitionDuration);
|
|
9838
9641
|
}
|
|
9839
9642
|
return this;
|
|
9840
9643
|
},
|
|
9841
|
-
getGraphBbox: function
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
};
|
|
9849
|
-
var nodesPos = state.graphData.nodes.filter(nodeFilter).map(function(node) {
|
|
9850
|
-
return {
|
|
9851
|
-
x: node.x,
|
|
9852
|
-
y: node.y,
|
|
9853
|
-
r: getR(node)
|
|
9854
|
-
};
|
|
9855
|
-
});
|
|
9644
|
+
getGraphBbox: function(state, nodeFilter = () => true) {
|
|
9645
|
+
const getVal = index$3(state.nodeVal);
|
|
9646
|
+
const getR = (node) => Math.sqrt(Math.max(0, getVal(node) || 1)) * state.nodeRelSize;
|
|
9647
|
+
const nodesPos = state.graphData.nodes.filter(nodeFilter).map((node) => ({
|
|
9648
|
+
x: node.x,
|
|
9649
|
+
y: node.y,
|
|
9650
|
+
r: getR(node)
|
|
9651
|
+
}));
|
|
9856
9652
|
return !nodesPos.length ? null : {
|
|
9857
|
-
x: [min$1(nodesPos,
|
|
9858
|
-
|
|
9859
|
-
}), max$1(nodesPos, function(node) {
|
|
9860
|
-
return node.x + node.r;
|
|
9861
|
-
})],
|
|
9862
|
-
y: [min$1(nodesPos, function(node) {
|
|
9863
|
-
return node.y - node.r;
|
|
9864
|
-
}), max$1(nodesPos, function(node) {
|
|
9865
|
-
return node.y + node.r;
|
|
9866
|
-
})]
|
|
9653
|
+
x: [min$1(nodesPos, (node) => node.x - node.r), max$1(nodesPos, (node) => node.x + node.r)],
|
|
9654
|
+
y: [min$1(nodesPos, (node) => node.y - node.r), max$1(nodesPos, (node) => node.y + node.r)]
|
|
9867
9655
|
};
|
|
9868
9656
|
},
|
|
9869
|
-
pauseAnimation: function
|
|
9657
|
+
pauseAnimation: function(state) {
|
|
9870
9658
|
if (state.animationFrameRequestId) {
|
|
9871
9659
|
cancelAnimationFrame(state.animationFrameRequestId);
|
|
9872
9660
|
state.animationFrameRequestId = null;
|
|
9873
9661
|
}
|
|
9874
9662
|
return this;
|
|
9875
9663
|
},
|
|
9876
|
-
resumeAnimation: function
|
|
9664
|
+
resumeAnimation: function(state) {
|
|
9877
9665
|
if (!state.animationFrameRequestId) this._animationCycle();
|
|
9878
9666
|
return this;
|
|
9879
9667
|
},
|
|
9880
|
-
_destructor: function
|
|
9668
|
+
_destructor: function() {
|
|
9881
9669
|
this.pauseAnimation();
|
|
9882
9670
|
this.graphData({
|
|
9883
9671
|
nodes: [],
|
|
9884
9672
|
links: []
|
|
9885
9673
|
});
|
|
9886
|
-
}
|
|
9887
|
-
|
|
9888
|
-
stateInit: function stateInit() {
|
|
9889
|
-
return {
|
|
9890
|
-
lastSetZoom: 1,
|
|
9891
|
-
zoom: zoom_default(),
|
|
9892
|
-
forceGraph: new CanvasForceGraph(),
|
|
9893
|
-
shadowGraph: new CanvasForceGraph().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(true),
|
|
9894
|
-
colorTracker: new _default(),
|
|
9895
|
-
tweenGroup: new Group()
|
|
9896
|
-
};
|
|
9674
|
+
},
|
|
9675
|
+
...linkedMethods
|
|
9897
9676
|
},
|
|
9898
|
-
|
|
9899
|
-
|
|
9677
|
+
stateInit: () => ({
|
|
9678
|
+
lastSetZoom: 1,
|
|
9679
|
+
zoom: zoom_default(),
|
|
9680
|
+
forceGraph: new CanvasForceGraph(),
|
|
9681
|
+
shadowGraph: new CanvasForceGraph().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(true),
|
|
9682
|
+
colorTracker: new _default(),
|
|
9683
|
+
tweenGroup: new Group()
|
|
9684
|
+
}),
|
|
9685
|
+
init: function(domNode, state) {
|
|
9900
9686
|
domNode.innerHTML = "";
|
|
9901
|
-
|
|
9687
|
+
const container = document.createElement("div");
|
|
9902
9688
|
container.classList.add("force-graph-container");
|
|
9903
9689
|
container.style.position = "relative";
|
|
9904
9690
|
domNode.appendChild(container);
|
|
@@ -9906,25 +9692,25 @@ window.__ModuleLoader__.load({
|
|
|
9906
9692
|
if (state.backgroundColor) state.canvas.style.background = state.backgroundColor;
|
|
9907
9693
|
container.appendChild(state.canvas);
|
|
9908
9694
|
state.shadowCanvas = document.createElement("canvas");
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9695
|
+
const ctx = state.canvas.getContext("2d");
|
|
9696
|
+
const shadowCtx = state.shadowCanvas.getContext("2d", { willReadFrequently: true });
|
|
9697
|
+
const pointerPos = {
|
|
9912
9698
|
x: -0xe8d4a51000,
|
|
9913
9699
|
y: -0xe8d4a51000
|
|
9914
9700
|
};
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9701
|
+
const getObjUnderPointer = () => {
|
|
9702
|
+
let obj = null;
|
|
9703
|
+
const pxScale = window.devicePixelRatio;
|
|
9704
|
+
const px = pointerPos.x > 0 && pointerPos.y > 0 ? shadowCtx.getImageData(pointerPos.x * pxScale, pointerPos.y * pxScale, 1, 1) : null;
|
|
9919
9705
|
px && (obj = state.colorTracker.lookup(px.data));
|
|
9920
9706
|
return obj;
|
|
9921
9707
|
};
|
|
9922
|
-
select_default$1(state.canvas).call(drag_default().subject(
|
|
9708
|
+
select_default$1(state.canvas).call(drag_default().subject(() => {
|
|
9923
9709
|
if (!state.enableNodeDrag) return null;
|
|
9924
|
-
|
|
9710
|
+
const obj = getObjUnderPointer();
|
|
9925
9711
|
return obj && obj.type === "Node" ? obj.d : null;
|
|
9926
|
-
}).on("start",
|
|
9927
|
-
|
|
9712
|
+
}).on("start", (ev) => {
|
|
9713
|
+
const obj = ev.subject;
|
|
9928
9714
|
obj.__initialDragPos = {
|
|
9929
9715
|
x: obj.x,
|
|
9930
9716
|
y: obj.y,
|
|
@@ -9936,29 +9722,25 @@ window.__ModuleLoader__.load({
|
|
|
9936
9722
|
obj.fy = obj.y;
|
|
9937
9723
|
}
|
|
9938
9724
|
state.canvas.classList.add("grabbable");
|
|
9939
|
-
}).on("drag",
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9725
|
+
}).on("drag", (ev) => {
|
|
9726
|
+
const obj = ev.subject;
|
|
9727
|
+
const initPos = obj.__initialDragPos;
|
|
9728
|
+
const dragPos = ev;
|
|
9729
|
+
const k = transform(state.canvas).k;
|
|
9730
|
+
const translate = {
|
|
9945
9731
|
x: initPos.x + (dragPos.x - initPos.x) / k - obj.x,
|
|
9946
9732
|
y: initPos.y + (dragPos.y - initPos.y) / k - obj.y
|
|
9947
9733
|
};
|
|
9948
|
-
["x", "y"].forEach(
|
|
9949
|
-
|
|
9950
|
-
});
|
|
9951
|
-
if (!obj.__dragged && DRAG_CLICK_TOLERANCE_PX >= Math.sqrt(sum(["x", "y"].map(function(k) {
|
|
9952
|
-
return Math.pow(ev[k] - initPos[k], 2);
|
|
9953
|
-
})))) return;
|
|
9734
|
+
["x", "y"].forEach((c) => obj[`f${c}`] = obj[c] = initPos[c] + (dragPos[c] - initPos[c]) / k);
|
|
9735
|
+
if (!obj.__dragged && DRAG_CLICK_TOLERANCE_PX >= Math.sqrt(sum(["x", "y"].map((k) => (ev[k] - initPos[k]) ** 2)))) return;
|
|
9954
9736
|
state.forceGraph.d3AlphaTarget(.3).resetCountdown();
|
|
9955
9737
|
state.isPointerDragging = true;
|
|
9956
9738
|
obj.__dragged = true;
|
|
9957
9739
|
state.onNodeDrag(obj, translate);
|
|
9958
|
-
}).on("end",
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9740
|
+
}).on("end", (ev) => {
|
|
9741
|
+
const obj = ev.subject;
|
|
9742
|
+
const initPos = obj.__initialDragPos;
|
|
9743
|
+
const translate = {
|
|
9962
9744
|
x: obj.x - initPos.x,
|
|
9963
9745
|
y: obj.y - initPos.y
|
|
9964
9746
|
};
|
|
@@ -9975,120 +9757,114 @@ window.__ModuleLoader__.load({
|
|
|
9975
9757
|
}));
|
|
9976
9758
|
state.zoom(state.zoom.__baseElem = select_default$1(state.canvas));
|
|
9977
9759
|
state.zoom.__baseElem.on("dblclick.zoom", null);
|
|
9978
|
-
state.zoom.filter(
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
var t = ev.transform;
|
|
9982
|
-
[ctx, shadowCtx].forEach(function(c) {
|
|
9760
|
+
state.zoom.filter((ev) => !ev.button && state.enableZoomPanInteraction && (ev.type !== "wheel" || index$3(state.enableZoomInteraction)(ev)) && (ev.type === "wheel" || index$3(state.enablePanInteraction)(ev))).on("zoom", (ev) => {
|
|
9761
|
+
const t = ev.transform;
|
|
9762
|
+
[ctx, shadowCtx].forEach((c) => {
|
|
9983
9763
|
resetTransform(c);
|
|
9984
9764
|
c.translate(t.x, t.y);
|
|
9985
9765
|
c.scale(t.k, t.k);
|
|
9986
9766
|
});
|
|
9987
9767
|
state.isPointerDragging = true;
|
|
9988
|
-
state.onZoom && state.onZoom(
|
|
9768
|
+
state.onZoom && state.onZoom({
|
|
9769
|
+
...t,
|
|
9770
|
+
...this.centerAt()
|
|
9771
|
+
});
|
|
9989
9772
|
state.needsRedraw = true;
|
|
9990
|
-
}).on("end",
|
|
9773
|
+
}).on("end", (ev) => {
|
|
9991
9774
|
state.isPointerDragging = false;
|
|
9992
|
-
state.onZoomEnd && state.onZoomEnd(
|
|
9775
|
+
state.onZoomEnd && state.onZoomEnd({
|
|
9776
|
+
...ev.transform,
|
|
9777
|
+
...this.centerAt()
|
|
9778
|
+
});
|
|
9993
9779
|
});
|
|
9994
9780
|
adjustCanvasSize(state);
|
|
9995
|
-
state.forceGraph.onNeedsRedraw(
|
|
9996
|
-
return state.needsRedraw = true;
|
|
9997
|
-
}).onFinishUpdate(function() {
|
|
9781
|
+
state.forceGraph.onNeedsRedraw(() => state.needsRedraw = true).onFinishUpdate(() => {
|
|
9998
9782
|
if (transform(state.canvas).k === state.lastSetZoom && state.graphData.nodes.length) {
|
|
9999
9783
|
state.zoom.scaleTo(state.zoom.__baseElem, state.lastSetZoom = ZOOM2NODES_FACTOR / Math.cbrt(state.graphData.nodes.length));
|
|
10000
9784
|
state.needsRedraw = true;
|
|
10001
9785
|
}
|
|
10002
9786
|
});
|
|
10003
9787
|
state.tooltip = new index$2(container);
|
|
10004
|
-
["pointermove", "pointerdown"].forEach(
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
}
|
|
10023
|
-
}, { passive: true });
|
|
10024
|
-
});
|
|
10025
|
-
container.addEventListener("pointerup", function(ev) {
|
|
9788
|
+
["pointermove", "pointerdown"].forEach((evType) => container.addEventListener(evType, (ev) => {
|
|
9789
|
+
if (evType === "pointerdown") {
|
|
9790
|
+
state.isPointerPressed = true;
|
|
9791
|
+
state.pointerDownEvent = ev;
|
|
9792
|
+
}
|
|
9793
|
+
!state.isPointerDragging && ev.type === "pointermove" && state.onBackgroundClick && (ev.pressure > 0 || state.isPointerPressed) && (ev.pointerType === "mouse" || ev.movementX === void 0 || [ev.movementX, ev.movementY].some((m) => Math.abs(m) > 1)) && (state.isPointerDragging = true);
|
|
9794
|
+
const offset = getOffset(container);
|
|
9795
|
+
pointerPos.x = ev.pageX - offset.left;
|
|
9796
|
+
pointerPos.y = ev.pageY - offset.top;
|
|
9797
|
+
function getOffset(el) {
|
|
9798
|
+
const rect = el.getBoundingClientRect(), scrollLeft = window.pageXOffset || document.documentElement.scrollLeft, scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
9799
|
+
return {
|
|
9800
|
+
top: rect.top + scrollTop,
|
|
9801
|
+
left: rect.left + scrollLeft
|
|
9802
|
+
};
|
|
9803
|
+
}
|
|
9804
|
+
}, { passive: true }));
|
|
9805
|
+
container.addEventListener("pointerup", (ev) => {
|
|
10026
9806
|
if (!state.isPointerPressed) return;
|
|
10027
9807
|
state.isPointerPressed = false;
|
|
10028
9808
|
if (state.isPointerDragging) {
|
|
10029
9809
|
state.isPointerDragging = false;
|
|
10030
9810
|
return;
|
|
10031
9811
|
}
|
|
10032
|
-
|
|
10033
|
-
requestAnimationFrame(
|
|
9812
|
+
const cbEvents = [ev, state.pointerDownEvent];
|
|
9813
|
+
requestAnimationFrame(() => {
|
|
10034
9814
|
if (ev.button === 0) {
|
|
10035
9815
|
if (state.hoverObj) {
|
|
10036
|
-
|
|
10037
|
-
fn && fn
|
|
10038
|
-
} else state.onBackgroundClick && state.onBackgroundClick
|
|
9816
|
+
const fn = state[`on${state.hoverObj.type}Click`];
|
|
9817
|
+
fn && fn(state.hoverObj.d, ...cbEvents);
|
|
9818
|
+
} else state.onBackgroundClick && state.onBackgroundClick(...cbEvents);
|
|
10039
9819
|
}
|
|
10040
9820
|
if (ev.button === 2) {
|
|
10041
9821
|
if (state.hoverObj) {
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
} else state.onBackgroundRightClick && state.onBackgroundRightClick
|
|
9822
|
+
const fn = state[`on${state.hoverObj.type}RightClick`];
|
|
9823
|
+
fn && fn(state.hoverObj.d, ...cbEvents);
|
|
9824
|
+
} else state.onBackgroundRightClick && state.onBackgroundRightClick(...cbEvents);
|
|
10045
9825
|
}
|
|
10046
9826
|
});
|
|
10047
9827
|
}, { passive: true });
|
|
10048
|
-
container.addEventListener("contextmenu",
|
|
9828
|
+
container.addEventListener("contextmenu", (ev) => {
|
|
10049
9829
|
if (!state.onBackgroundRightClick && !state.onNodeRightClick && !state.onLinkRightClick) return true;
|
|
10050
9830
|
ev.preventDefault();
|
|
10051
9831
|
return false;
|
|
10052
9832
|
});
|
|
10053
9833
|
state.forceGraph(ctx);
|
|
10054
9834
|
state.shadowGraph(shadowCtx);
|
|
10055
|
-
|
|
9835
|
+
const refreshShadowCanvas = throttle(() => {
|
|
10056
9836
|
clearCanvas(shadowCtx, state.width, state.height);
|
|
10057
|
-
state.shadowGraph.linkWidth(
|
|
10058
|
-
|
|
10059
|
-
});
|
|
10060
|
-
var t = transform(state.canvas);
|
|
9837
|
+
state.shadowGraph.linkWidth((l) => index$3(state.linkWidth)(l) + state.linkHoverPrecision);
|
|
9838
|
+
const t = transform(state.canvas);
|
|
10061
9839
|
state.shadowGraph.globalScale(t.k).tickFrame();
|
|
10062
9840
|
}, HOVER_CANVAS_THROTTLE_DELAY);
|
|
10063
9841
|
state.flushShadowCanvas = refreshShadowCanvas.flush;
|
|
10064
9842
|
(this._animationCycle = function animate() {
|
|
10065
|
-
|
|
10066
|
-
return d.__photons && d.__photons.length;
|
|
10067
|
-
});
|
|
9843
|
+
const doRedraw = !state.autoPauseRedraw || !!state.needsRedraw || state.forceGraph.isEngineRunning() || state.graphData.links.some((d) => d.__photons && d.__photons.length);
|
|
10068
9844
|
state.needsRedraw = false;
|
|
10069
9845
|
if (state.enablePointerInteraction) {
|
|
10070
|
-
|
|
9846
|
+
const obj = !state.isPointerDragging ? getObjUnderPointer() : null;
|
|
10071
9847
|
if (obj !== state.hoverObj) {
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
9848
|
+
const prevObj = state.hoverObj;
|
|
9849
|
+
const prevObjType = prevObj ? prevObj.type : null;
|
|
9850
|
+
const objType = obj ? obj.type : null;
|
|
10075
9851
|
if (prevObjType && prevObjType !== objType) {
|
|
10076
|
-
|
|
9852
|
+
const fn = state[`on${prevObjType}Hover`];
|
|
10077
9853
|
fn && fn(null, prevObj.d);
|
|
10078
9854
|
}
|
|
10079
9855
|
if (objType) {
|
|
10080
|
-
|
|
10081
|
-
|
|
9856
|
+
const fn = state[`on${objType}Hover`];
|
|
9857
|
+
fn && fn(obj.d, prevObjType === objType ? prevObj.d : null);
|
|
10082
9858
|
}
|
|
10083
|
-
state.tooltip.content(obj ? index$3(state[
|
|
10084
|
-
state.canvas.classList[(obj && state[
|
|
9859
|
+
state.tooltip.content(obj ? index$3(state[`${obj.type.toLowerCase()}Label`])(obj.d) || null : null);
|
|
9860
|
+
state.canvas.classList[(obj && state[`on${objType}Click`] || !obj && state.onBackgroundClick) && index$3(state.showPointerCursor)(obj?.d) ? "add" : "remove"]("clickable");
|
|
10085
9861
|
state.hoverObj = obj;
|
|
10086
9862
|
}
|
|
10087
9863
|
doRedraw && refreshShadowCanvas();
|
|
10088
9864
|
}
|
|
10089
9865
|
if (doRedraw) {
|
|
10090
9866
|
clearCanvas(ctx, state.width, state.height);
|
|
10091
|
-
|
|
9867
|
+
const globalScale = transform(state.canvas).k;
|
|
10092
9868
|
state.onRenderFramePre && state.onRenderFramePre(ctx, globalScale);
|
|
10093
9869
|
state.forceGraph.globalScale(globalScale).tickFrame();
|
|
10094
9870
|
state.onRenderFramePost && state.onRenderFramePost(ctx, globalScale);
|
|
@@ -10345,47 +10121,47 @@ window.__ModuleLoader__.load({
|
|
|
10345
10121
|
document.head.appendChild(tag);
|
|
10346
10122
|
}
|
|
10347
10123
|
var KnowledgeView_module_css_default = {
|
|
10348
|
-
"emptyHint": "bZAtrq_emptyHint",
|
|
10349
|
-
"filterSelect": "bZAtrq_filterSelect",
|
|
10350
|
-
"drawerHeader": "bZAtrq_drawerHeader",
|
|
10351
|
-
"openSourceBtn": "bZAtrq_openSourceBtn",
|
|
10352
|
-
"factUnverifiable": "bZAtrq_factUnverifiable",
|
|
10353
|
-
"badgeMedium": "bZAtrq_badgeMedium",
|
|
10354
|
-
"drawerTitleGroup": "bZAtrq_drawerTitleGroup",
|
|
10355
|
-
"drawerBody": "bZAtrq_drawerBody",
|
|
10356
|
-
"drawer": "bZAtrq_drawer",
|
|
10357
|
-
"mainArea": "bZAtrq_mainArea",
|
|
10358
|
-
"badgePlatform": "bZAtrq_badgePlatform",
|
|
10359
|
-
"tagPills": "bZAtrq_tagPills",
|
|
10360
|
-
"factDiscrepancies": "bZAtrq_factDiscrepancies",
|
|
10361
|
-
"statsText": "bZAtrq_statsText",
|
|
10362
10124
|
"badgeHigh": "bZAtrq_badgeHigh",
|
|
10363
|
-
"
|
|
10364
|
-
"
|
|
10365
|
-
"
|
|
10366
|
-
"badge": "bZAtrq_badge",
|
|
10125
|
+
"drawerFooter": "bZAtrq_drawerFooter",
|
|
10126
|
+
"mainArea": "bZAtrq_mainArea",
|
|
10127
|
+
"drawer": "bZAtrq_drawer",
|
|
10367
10128
|
"searchInput": "bZAtrq_searchInput",
|
|
10368
|
-
"section": "bZAtrq_section",
|
|
10369
|
-
"relatedItem": "bZAtrq_relatedItem",
|
|
10370
|
-
"searchIcon": "bZAtrq_searchIcon",
|
|
10371
10129
|
"emptyState": "bZAtrq_emptyState",
|
|
10130
|
+
"closeBtn": "bZAtrq_closeBtn",
|
|
10131
|
+
"resetBtn": "bZAtrq_resetBtn",
|
|
10132
|
+
"statsText": "bZAtrq_statsText",
|
|
10133
|
+
"metaRow": "bZAtrq_metaRow",
|
|
10134
|
+
"emptyHint": "bZAtrq_emptyHint",
|
|
10135
|
+
"toolbar": "bZAtrq_toolbar",
|
|
10372
10136
|
"slideIn": "bZAtrq_slideIn",
|
|
10373
|
-
"
|
|
10374
|
-
"
|
|
10375
|
-
"bucketList": "bZAtrq_bucketList",
|
|
10137
|
+
"badge": "bZAtrq_badge",
|
|
10138
|
+
"drawerBody": "bZAtrq_drawerBody",
|
|
10376
10139
|
"badgeLow": "bZAtrq_badgeLow",
|
|
10140
|
+
"factDiscrepancies": "bZAtrq_factDiscrepancies",
|
|
10141
|
+
"factUnverifiable": "bZAtrq_factUnverifiable",
|
|
10142
|
+
"tagPill": "bZAtrq_tagPill",
|
|
10143
|
+
"tagPills": "bZAtrq_tagPills",
|
|
10377
10144
|
"drawerTitle": "bZAtrq_drawerTitle",
|
|
10378
10145
|
"searchBox": "bZAtrq_searchBox",
|
|
10379
|
-
"
|
|
10380
|
-
"
|
|
10381
|
-
"
|
|
10146
|
+
"drawerHeader": "bZAtrq_drawerHeader",
|
|
10147
|
+
"emptyIcon": "bZAtrq_emptyIcon",
|
|
10148
|
+
"bucketTitle": "bZAtrq_bucketTitle",
|
|
10149
|
+
"factVerified": "bZAtrq_factVerified",
|
|
10150
|
+
"relatedItem": "bZAtrq_relatedItem",
|
|
10151
|
+
"searchIcon": "bZAtrq_searchIcon",
|
|
10382
10152
|
"factBucket": "bZAtrq_factBucket",
|
|
10153
|
+
"badgeMedium": "bZAtrq_badgeMedium",
|
|
10154
|
+
"claimsList": "bZAtrq_claimsList",
|
|
10155
|
+
"filterSelect": "bZAtrq_filterSelect",
|
|
10156
|
+
"graphCanvas": "bZAtrq_graphCanvas",
|
|
10157
|
+
"openSourceBtn": "bZAtrq_openSourceBtn",
|
|
10158
|
+
"section": "bZAtrq_section",
|
|
10383
10159
|
"root": "bZAtrq_root",
|
|
10384
|
-
"
|
|
10385
|
-
"
|
|
10386
|
-
"tagPill": "bZAtrq_tagPill",
|
|
10160
|
+
"badgePlatform": "bZAtrq_badgePlatform",
|
|
10161
|
+
"bucketList": "bZAtrq_bucketList",
|
|
10387
10162
|
"filtersGroup": "bZAtrq_filtersGroup",
|
|
10388
|
-
"
|
|
10163
|
+
"drawerTitleGroup": "bZAtrq_drawerTitleGroup",
|
|
10164
|
+
"sectionLabel": "bZAtrq_sectionLabel"
|
|
10389
10165
|
};
|
|
10390
10166
|
//#endregion
|
|
10391
10167
|
//#region src/client/KnowledgeView.tsx
|