force-graph 1.47.4 → 1.49.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/README.md +2 -2
- package/dist/force-graph.d.ts +6 -4
- package/dist/force-graph.js +108 -25
- package/dist/force-graph.js.map +1 -1
- package/dist/force-graph.min.js +3 -3
- package/package.json +3 -3
- package/src/index.d.ts +6 -4
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ const myGraph = new ForceGraph(<myDOMElement>)
|
|
|
92
92
|
| --- | --- | :--: |
|
|
93
93
|
| <b>nodeRelSize</b>([<i>num</i>]) | Getter/setter for the ratio of node circle area (square px) per value unit. | 4 |
|
|
94
94
|
| <b>nodeVal</b>([<i>num</i>, <i>str</i> or <i>fn</i>]) | Node object accessor function, attribute or a numeric constant for the node numeric value (affects circle area). | `val` |
|
|
95
|
-
| <b>nodeLabel</b>([<i>str</i> or <i>fn</i>]) | Node object accessor function or attribute for name (shown in label). Supports plain text
|
|
95
|
+
| <b>nodeLabel</b>([<i>str</i> or <i>fn</i>]) | Node object accessor function or attribute for name (shown in label). Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | `name` |
|
|
96
96
|
| <b>nodeVisibility</b>([<i>boolean</i>, <i>str</i> or <i>fn</i>]) | Node object accessor function, attribute or a boolean constant for whether to display the node. | `true` |
|
|
97
97
|
| <b>nodeColor</b>([<i>str</i> or <i>fn</i>]) | Node object accessor function or attribute for node color (affects circle color). | `color` |
|
|
98
98
|
| <b>nodeAutoColorBy</b>([<i>str</i> or <i>fn</i>]) | Node object accessor function (`fn(node)`) or attribute (e.g. `'type'`) to automatically group colors by. Only affects nodes without a color attribute. | |
|
|
@@ -103,7 +103,7 @@ const myGraph = new ForceGraph(<myDOMElement>)
|
|
|
103
103
|
|
|
104
104
|
| Method | Description | Default |
|
|
105
105
|
| --- | --- | :--: |
|
|
106
|
-
| <b>linkLabel</b>([<i>str</i> or <i>fn</i>]) | Link object accessor function or attribute for name (shown in label). Supports plain text
|
|
106
|
+
| <b>linkLabel</b>([<i>str</i> or <i>fn</i>]) | Link object accessor function or attribute for name (shown in label). Supports plain text, HTML string content or an [HTML element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement). | `name` |
|
|
107
107
|
| <b>linkVisibility</b>([<i>boolean</i>, <i>str</i> or <i>fn</i>]) | Link object accessor function, attribute or a boolean constant for whether to display the link line. A value of `false` maintains the link force without rendering it. | `true` |
|
|
108
108
|
| <b>linkColor</b>([<i>str</i> or <i>fn</i>]) | Link object accessor function or attribute for line color. | `color` |
|
|
109
109
|
| <b>linkAutoColorBy</b>([<i>str</i> or <i>fn</i>]) | Link object accessor function (`fn(link)`) or attribute (e.g. `'type'`) to automatically group colors by. Only affects links without a color attribute. | |
|
package/dist/force-graph.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ type Accessor<In, Out> = Out | string | ((obj: In) => Out);
|
|
|
23
23
|
type NodeAccessor<T, N> = Accessor<N, T>;
|
|
24
24
|
type LinkAccessor<T, N, L> = Accessor<L, T>;
|
|
25
25
|
|
|
26
|
+
type Label = string | HTMLElement;
|
|
27
|
+
|
|
26
28
|
type CanvasCustomRenderMode = 'replace' | 'before' | 'after';
|
|
27
29
|
type CanvasCustomRenderModeFn<T> = (obj: T) => CanvasCustomRenderMode | any;
|
|
28
30
|
type CanvasCustomRenderFn<T> = (obj: T, canvasContext: CanvasRenderingContext2D, globalScale: number) => void;
|
|
@@ -64,8 +66,8 @@ declare class ForceGraphGeneric<ChainableInstance, N extends NodeObject = NodeOb
|
|
|
64
66
|
nodeRelSize(size: number): ChainableInstance;
|
|
65
67
|
nodeVal(): NodeAccessor<number, N>;
|
|
66
68
|
nodeVal(valAccessor: NodeAccessor<number, N>): ChainableInstance;
|
|
67
|
-
nodeLabel(): NodeAccessor<
|
|
68
|
-
nodeLabel(labelAccessor: NodeAccessor<
|
|
69
|
+
nodeLabel(): NodeAccessor<Label, N>;
|
|
70
|
+
nodeLabel(labelAccessor: NodeAccessor<Label, N>): ChainableInstance;
|
|
69
71
|
nodeVisibility(): NodeAccessor<boolean, N>;
|
|
70
72
|
nodeVisibility(visibilityAccessor: NodeAccessor<boolean, N>): ChainableInstance;
|
|
71
73
|
nodeColor(): NodeAccessor<string, N>;
|
|
@@ -80,8 +82,8 @@ declare class ForceGraphGeneric<ChainableInstance, N extends NodeObject = NodeOb
|
|
|
80
82
|
nodePointerAreaPaint(renderFn: CanvasPointerAreaPaintFn<N>): ChainableInstance;
|
|
81
83
|
|
|
82
84
|
// Link styling
|
|
83
|
-
linkLabel(): LinkAccessor<
|
|
84
|
-
linkLabel(labelAccessor: LinkAccessor<
|
|
85
|
+
linkLabel(): LinkAccessor<Label, N, L>;
|
|
86
|
+
linkLabel(labelAccessor: LinkAccessor<Label, N, L>): ChainableInstance;
|
|
85
87
|
linkVisibility(): LinkAccessor<boolean, N, L>;
|
|
86
88
|
linkVisibility(visibilityAccessor: LinkAccessor<boolean, N, L>): ChainableInstance;
|
|
87
89
|
linkColor(): LinkAccessor<string, N, L>;
|
package/dist/force-graph.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 1.
|
|
1
|
+
// Version 1.49.0 force-graph - https://github.com/vasturiano/force-graph
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
var p = new (t.bind.apply(t, o))();
|
|
54
54
|
return p;
|
|
55
55
|
}
|
|
56
|
-
function _defineProperty(e, r, t) {
|
|
57
|
-
return (r = _toPropertyKey$
|
|
56
|
+
function _defineProperty$1(e, r, t) {
|
|
57
|
+
return (r = _toPropertyKey$3(r)) in e ? Object.defineProperty(e, r, {
|
|
58
58
|
value: t,
|
|
59
59
|
enumerable: true,
|
|
60
60
|
configurable: true,
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
function _nonIterableSpread$2() {
|
|
103
103
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
104
104
|
}
|
|
105
|
-
function ownKeys(e, r) {
|
|
105
|
+
function ownKeys$1(e, r) {
|
|
106
106
|
var t = Object.keys(e);
|
|
107
107
|
if (Object.getOwnPropertySymbols) {
|
|
108
108
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -112,12 +112,12 @@
|
|
|
112
112
|
}
|
|
113
113
|
return t;
|
|
114
114
|
}
|
|
115
|
-
function _objectSpread2(e) {
|
|
115
|
+
function _objectSpread2$1(e) {
|
|
116
116
|
for (var r = 1; r < arguments.length; r++) {
|
|
117
117
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
118
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
119
|
-
_defineProperty(e, r, t[r]);
|
|
120
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
118
|
+
r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) {
|
|
119
|
+
_defineProperty$1(e, r, t[r]);
|
|
120
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) {
|
|
121
121
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
122
122
|
});
|
|
123
123
|
}
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
function _toConsumableArray$2(r) {
|
|
130
130
|
return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$4(r) || _nonIterableSpread$2();
|
|
131
131
|
}
|
|
132
|
-
function _toPrimitive$
|
|
132
|
+
function _toPrimitive$3(t, r) {
|
|
133
133
|
if ("object" != typeof t || !t) return t;
|
|
134
134
|
var e = t[Symbol.toPrimitive];
|
|
135
135
|
if (undefined !== e) {
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
}
|
|
140
140
|
return ("string" === r ? String : Number)(t);
|
|
141
141
|
}
|
|
142
|
-
function _toPropertyKey$
|
|
143
|
-
var i = _toPrimitive$
|
|
142
|
+
function _toPropertyKey$3(t) {
|
|
143
|
+
var i = _toPrimitive$3(t, "string");
|
|
144
144
|
return "symbol" == typeof i ? i : i + "";
|
|
145
145
|
}
|
|
146
146
|
function _typeof$2(o) {
|
|
@@ -6820,7 +6820,7 @@
|
|
|
6820
6820
|
function _defineProperties(e, r) {
|
|
6821
6821
|
for (var t = 0; t < r.length; t++) {
|
|
6822
6822
|
var o = r[t];
|
|
6823
|
-
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey$
|
|
6823
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey$2(o.key), o);
|
|
6824
6824
|
}
|
|
6825
6825
|
}
|
|
6826
6826
|
function _createClass(e, r, t) {
|
|
@@ -6837,7 +6837,7 @@
|
|
|
6837
6837
|
function _toConsumableArray$1(r) {
|
|
6838
6838
|
return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread$1();
|
|
6839
6839
|
}
|
|
6840
|
-
function _toPrimitive$
|
|
6840
|
+
function _toPrimitive$2(t, r) {
|
|
6841
6841
|
if ("object" != typeof t || !t) return t;
|
|
6842
6842
|
var e = t[Symbol.toPrimitive];
|
|
6843
6843
|
if (undefined !== e) {
|
|
@@ -6847,8 +6847,8 @@
|
|
|
6847
6847
|
}
|
|
6848
6848
|
return (String )(t);
|
|
6849
6849
|
}
|
|
6850
|
-
function _toPropertyKey$
|
|
6851
|
-
var i = _toPrimitive$
|
|
6850
|
+
function _toPropertyKey$2(t) {
|
|
6851
|
+
var i = _toPrimitive$2(t, "string");
|
|
6852
6852
|
return "symbol" == typeof i ? i : i + "";
|
|
6853
6853
|
}
|
|
6854
6854
|
function _unsupportedIterableToArray$2(r, a) {
|
|
@@ -6926,6 +6926,8 @@
|
|
|
6926
6926
|
}]);
|
|
6927
6927
|
}();
|
|
6928
6928
|
|
|
6929
|
+
var n,l,u,t$1,i,r,o,e,f,c$1,s,a$1,p={},v=[],y$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,d=Array.isArray;function w(n,l){for(var u in l)n[u]=l[u];return n}function _(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function g(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps) undefined===e[o]&&(e[o]=l.defaultProps[o]);return m$1(l,e,i,r,null)}function m$1(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:undefined,__v:null==o?++u:o,__i:-1,__u:0};return null==o&&null!=l.vnode&&l.vnode(e),e}function k(n){return n.children}function x$1(n,l){this.props=n,this.context=l;}function C(n,l){if(null==l)return n.__?C(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?C(n):null}function S(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return S(n)}}function M(n){(!n.__d&&(n.__d=true)&&i.push(n)&&!P.__r++||r!==l.debounceRendering)&&((r=l.debounceRendering)||o)(P);}function P(){var n,u,t,r,o,f,c,s;for(i.sort(e);n=i.shift();)n.__d&&(u=i.length,r=undefined,f=(o=(t=n).__v).__e,c=[],s=[],t.__P&&((r=w({},o)).__v=o.__v+1,l.vnode&&l.vnode(r),j(t.__P,r,o,t.__n,t.__P.namespaceURI,32&o.__u?[f]:null,c,null==f?C(o):f,!!(32&o.__u),s),r.__v=o.__v,r.__.__k[r.__i]=r,z$1(c,r,s),r.__e!=f&&S(r)),i.length>u&&i.sort(e));P.__r=0;}function $(n,l,u,t,i,r,o,e,f,c,s){var a,h,y,d,w,_,g=t&&t.__k||v,m=l.length;for(f=I(u,l,g,f,m),a=0;a<m;a++)null!=(y=u.__k[a])&&(h=-1===y.__i?p:g[y.__i]||p,y.__i=a,_=j(n,y,h,i,r,o,e,f,c,s),d=y.__e,y.ref&&h.ref!=y.ref&&(h.ref&&V(h.ref,null,y),s.push(y.ref,y.__c||d,y)),null==w&&null!=d&&(w=d),4&y.__u||h.__k===y.__k?f=A(y,f,n):"function"==typeof y.type&&undefined!==_?f=_:d&&(f=d.nextSibling),y.__u&=-7);return u.__e=w,f}function I(n,l,u,t,i){var r,o,e,f,c,s=u.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?(f=r+h,(o=n.__k[r]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?m$1(null,o,null,null,null):d(o)?m$1(k,{children:o},null,null,null):undefined===o.constructor&&o.__b>0?m$1(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=n,o.__b=n.__b+1,e=null,-1!==(c=o.__i=L(o,u,f,a))&&(a--,(e=u[c])&&(e.__u|=2)),null==e||null===e.__v?(-1==c&&h--,"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=C(e)),q(e,e));return t}function A(n,l,u){var t,i;if("function"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=A(t[i],l,u));return l}n.__e!=l&&(l&&n.type&&!u.contains(l)&&(l=C(n)),u.insertBefore(n.__e,l||null),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function L(n,l,u,t){var i,r,o=n.key,e=n.type,f=l[u];if(null===f||f&&o==f.key&&e===f.type&&0==(2&f.__u))return u;if(t>(null!=f&&0==(2&f.__u)?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;){if(i>=0){if((f=l[i])&&0==(2&f.__u)&&o==f.key&&e===f.type)return i;i--;}if(r<l.length){if((f=l[r])&&0==(2&f.__u)&&o==f.key&&e===f.type)return r;r++;}}return -1}function T(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||y$1.test(l)?u:u+"px";}function F(n,l,u,t,i){var r;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||T(n.style,l,"");if(u)for(l in u)t&&u[l]===t[l]||T(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(f,"$1")),l=l.toLowerCase()in n||"onFocusOut"==l||"onFocusIn"==l?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u.u=t.u:(u.u=c$1,n.addEventListener(l,r?a$1:s,r)):n.removeEventListener(l,r?a$1:s,r);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||false===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u));}}function O(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u.t)u.t=c$1++;else if(u.t<t.u)return;return t(l.event?l.event(u):u)}}}function j(n,u,t,i,r,o,e,f,c,s){var a,h,p,v,y,g,m,b,C,S,M,P,I,A,H,L,T,F=u.type;if(undefined!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(a=l.__b)&&a(u);n:if("function"==typeof F)try{if(b=u.props,C="prototype"in F&&F.prototype.render,S=(a=F.contextType)&&i[a.__c],M=a?S?S.props.value:a.__:i,t.__c?m=(h=u.__c=t.__c).__=h.__E:(C?u.__c=h=new F(b,M):(u.__c=h=new x$1(b,M),h.constructor=F,h.render=B),S&&S.sub(h),h.props=b,h.state||(h.state={}),h.context=M,h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),C&&null==h.__s&&(h.__s=h.state),C&&null!=F.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=w({},h.__s)),w(h.__s,F.getDerivedStateFromProps(b,h.__s))),v=h.props,y=h.state,h.__v=u,p)C&&null==F.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),C&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(C&&null==F.getDerivedStateFromProps&&b!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(b,M),!h.__e&&(null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(b,h.__s,M)||u.__v==t.__v)){for(u.__v!=t.__v&&(h.props=b,h.state=h.__s,h.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u);}),P=0;P<h._sb.length;P++)h.__h.push(h._sb[P]);h._sb=[],h.__h.length&&e.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(b,h.__s,M),C&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,y,g);});}if(h.context=M,h.props=b,h.__P=n,h.__e=!1,I=l.__r,A=0,C){for(h.state=h.__s,h.__d=!1,I&&I(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,I&&I(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++A<25);h.state=h.__s,null!=h.getChildContext&&(i=w(w({},i),h.getChildContext())),C&&!p&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(v,y)),f=$(n,d(L=null!=a&&a.type===k&&null==a.key?a.props.children:a)?L:[L],u,t,i,r,o,e,f,c,s),h.base=u.__e,u.__u&=-161,h.__h.length&&e.push(h),m&&(h.__E=h.__=null);}catch(n){if(u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,u.__e=f;}else for(T=o.length;T--;)_(o[T]);else u.__e=t.__e,u.__k=t.__k;l.__e(n,u,t);}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=N(t.__e,u,t,i,r,o,e,c,s);return (a=l.diffed)&&a(u),128&u.__u?undefined:f}function z$1(n,u,t){for(var i=0;i<t.length;i++)V(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l.__e(n,u.__v);}});}function N(u,t,i,r,o,e,f,c,s){var a,h,v,y,w,g,m,b=i.props,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(a=0;a<e.length;a++)if((w=e[a])&&"setAttribute"in w==!!x&&(x?w.localName==x:3==w.nodeType)){u=w,e[a]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l.__m&&l.__m(t,e),c=false),e=null;}if(null===x)b===k||c&&u.data===k||(u.data=k);else {if(e=e&&n.call(u.childNodes),b=i.props||p,!c&&null!=e)for(b={},a=0;a<u.attributes.length;a++)b[(w=u.attributes[a]).name]=w.value;for(a in b)if(w=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)v=w;else if(!(a in k)){if("value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k)continue;F(u,a,null,w,o);}for(a in k)w=k[a],"children"==a?y=w:"dangerouslySetInnerHTML"==a?h=w:"value"==a?g=w:"checked"==a?m=w:c&&"function"!=typeof w||b[a]===w||F(u,a,w,b[a],o);if(h)c||v&&(h.__html===v.__html||h.__html===u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(v&&(u.innerHTML=""),$(u,d(y)?y:[y],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&C(i,0),c,s),null!=e)for(a=e.length;a--;)_(e[a]);c||(a="value","progress"==x&&null==g?u.removeAttribute("value"):undefined!==g&&(g!==u[a]||"progress"==x&&!g||"option"==x&&g!==b[a])&&F(u,a,g,b[a],o),a="checked",undefined!==m&&m!==u[a]&&F(u,a,m,b[a],o));}return u}function V(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u));}else n.current=u;}catch(n){l.__e(n,t);}}function q(n,u,t){var i,r;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||V(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l.__e(n,u);}i.base=i.__P=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&q(i[r],u,t||"function"!=typeof n.type);t||_(n.__e),n.__c=n.__=n.__e=undefined;}function B(n,l,u){return this.constructor(n,u)}function D(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l.__&&l.__(u,t),o=(r="function"=="undefined")?null:t.__k,e=[],f=[],j(t,u=(t).__k=g(k,null,[u]),o||p,p,t.namespaceURI,o?null:t.firstChild?n.call(t.childNodes):null,e,o?o.__e:t.firstChild,r,f),z$1(e,u,f);}function G(l,u,t){var i,r,o,e,f=w({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)"key"==o?i=u[o]:"ref"==o?r=u[o]:f[o]=undefined===u[o]&&undefined!==e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),m$1(l.type,f,i||l.key,r||l.ref,null)}n=v.slice,l={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},u=0,t$1=function(n){return null!=n&&null==n.constructor},x$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=w({},this.state),"function"==typeof n&&(n=n(w({},u),this.props)),n&&w(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),M(this));},x$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=true,n&&this.__h.push(n),M(this));},x$1.prototype.render=k,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e=function(n,l){return n.__v.__b-l.__v.__b},P.__r=0,f=/(PointerCapture)$|Capture$/i,c$1=0,s=O(false),a$1=O(true);
|
|
6930
|
+
|
|
6929
6931
|
function _arrayLikeToArray$1(r, a) {
|
|
6930
6932
|
(null == a || a > r.length) && (a = r.length);
|
|
6931
6933
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
@@ -6934,6 +6936,14 @@
|
|
|
6934
6936
|
function _arrayWithHoles$1(r) {
|
|
6935
6937
|
if (Array.isArray(r)) return r;
|
|
6936
6938
|
}
|
|
6939
|
+
function _defineProperty(e, r, t) {
|
|
6940
|
+
return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
|
|
6941
|
+
value: t,
|
|
6942
|
+
enumerable: true,
|
|
6943
|
+
configurable: true,
|
|
6944
|
+
writable: true
|
|
6945
|
+
}) : e[r] = t, e;
|
|
6946
|
+
}
|
|
6937
6947
|
function _iterableToArrayLimit$1(r, l) {
|
|
6938
6948
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
6939
6949
|
if (null != t) {
|
|
@@ -6961,9 +6971,44 @@
|
|
|
6961
6971
|
function _nonIterableRest$1() {
|
|
6962
6972
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6963
6973
|
}
|
|
6974
|
+
function ownKeys(e, r) {
|
|
6975
|
+
var t = Object.keys(e);
|
|
6976
|
+
if (Object.getOwnPropertySymbols) {
|
|
6977
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
6978
|
+
r && (o = o.filter(function (r) {
|
|
6979
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
6980
|
+
})), t.push.apply(t, o);
|
|
6981
|
+
}
|
|
6982
|
+
return t;
|
|
6983
|
+
}
|
|
6984
|
+
function _objectSpread2(e) {
|
|
6985
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
6986
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
6987
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
6988
|
+
_defineProperty(e, r, t[r]);
|
|
6989
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
6990
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
6991
|
+
});
|
|
6992
|
+
}
|
|
6993
|
+
return e;
|
|
6994
|
+
}
|
|
6964
6995
|
function _slicedToArray$1(r, e) {
|
|
6965
6996
|
return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest$1();
|
|
6966
6997
|
}
|
|
6998
|
+
function _toPrimitive$1(t, r) {
|
|
6999
|
+
if ("object" != typeof t || !t) return t;
|
|
7000
|
+
var e = t[Symbol.toPrimitive];
|
|
7001
|
+
if (undefined !== e) {
|
|
7002
|
+
var i = e.call(t, r || "default");
|
|
7003
|
+
if ("object" != typeof i) return i;
|
|
7004
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7005
|
+
}
|
|
7006
|
+
return ("string" === r ? String : Number)(t);
|
|
7007
|
+
}
|
|
7008
|
+
function _toPropertyKey$1(t) {
|
|
7009
|
+
var i = _toPrimitive$1(t, "string");
|
|
7010
|
+
return "symbol" == typeof i ? i : i + "";
|
|
7011
|
+
}
|
|
6967
7012
|
function _typeof(o) {
|
|
6968
7013
|
"@babel/helpers - typeof";
|
|
6969
7014
|
|
|
@@ -6981,6 +7026,26 @@
|
|
|
6981
7026
|
}
|
|
6982
7027
|
}
|
|
6983
7028
|
|
|
7029
|
+
var _reactElement2VNode = function reactElement2VNode(el) {
|
|
7030
|
+
// Among other things, react VNodes (and all its children) need to have constructor: undefined attributes in order to be recognised, cloneElement (applied recursively) does the necessary conversion
|
|
7031
|
+
if (!(_typeof(el) === 'object')) return el;
|
|
7032
|
+
var res = G(el);
|
|
7033
|
+
if (res.props) {
|
|
7034
|
+
var _res$props;
|
|
7035
|
+
res.props = _objectSpread2({}, res.props);
|
|
7036
|
+
if (res !== null && res !== undefined && (_res$props = res.props) !== null && _res$props !== undefined && _res$props.children) {
|
|
7037
|
+
res.props.children = Array.isArray(res.props.children) ? res.props.children.map(_reactElement2VNode) : _reactElement2VNode(res.props.children);
|
|
7038
|
+
}
|
|
7039
|
+
}
|
|
7040
|
+
return res;
|
|
7041
|
+
};
|
|
7042
|
+
var isReactRenderable = function isReactRenderable(o) {
|
|
7043
|
+
return t$1(G(o));
|
|
7044
|
+
};
|
|
7045
|
+
var render = function render(jsx, domEl) {
|
|
7046
|
+
return D(_reactElement2VNode(jsx), domEl);
|
|
7047
|
+
};
|
|
7048
|
+
|
|
6984
7049
|
function styleInject(css, ref) {
|
|
6985
7050
|
if (ref === undefined) ref = {};
|
|
6986
7051
|
var insertAt = ref.insertAt;
|
|
@@ -7006,7 +7071,7 @@
|
|
|
7006
7071
|
}
|
|
7007
7072
|
}
|
|
7008
7073
|
|
|
7009
|
-
var css_248z = ".float-tooltip-kap {\n position: absolute;\n width: max-content; /* prevent shrinking near right edge */\n padding: 3px 5px;\n border-radius: 3px;\n font: 12px sans-serif;\n color: #eee;\n background: rgba(0,0,0,0.6);\n pointer-events: none;\n}\n";
|
|
7074
|
+
var css_248z = ".float-tooltip-kap {\n position: absolute;\n width: max-content; /* prevent shrinking near right edge */\n max-width: max(50%, 150px);\n padding: 3px 5px;\n border-radius: 3px;\n font: 12px sans-serif;\n color: #eee;\n background: rgba(0,0,0,0.6);\n pointer-events: none;\n}\n";
|
|
7010
7075
|
styleInject(css_248z);
|
|
7011
7076
|
|
|
7012
7077
|
var index$2 = index$4({
|
|
@@ -7021,6 +7086,9 @@
|
|
|
7021
7086
|
style = _ref$style === undefined ? {} : _ref$style;
|
|
7022
7087
|
var isD3Selection = !!domNode && _typeof(domNode) === 'object' && !!domNode.node && typeof domNode.node === 'function';
|
|
7023
7088
|
var el = d3Select(isD3Selection ? domNode.node() : domNode);
|
|
7089
|
+
|
|
7090
|
+
// make sure container is positioned, to provide anchor for tooltip
|
|
7091
|
+
el.style('position') === 'static' && el.style('position', 'relative');
|
|
7024
7092
|
state.tooltipEl = el.append('div').attr('class', 'float-tooltip-kap');
|
|
7025
7093
|
Object.entries(style).forEach(function (_ref2) {
|
|
7026
7094
|
var _ref3 = _slicedToArray$1(_ref2, 2),
|
|
@@ -7054,7 +7122,22 @@
|
|
|
7054
7122
|
},
|
|
7055
7123
|
update: function update(state) {
|
|
7056
7124
|
state.tooltipEl.style('display', !!state.content && state.mouseInside ? 'inline' : 'none');
|
|
7057
|
-
|
|
7125
|
+
if (!state.content) {
|
|
7126
|
+
state.tooltipEl.text('');
|
|
7127
|
+
} else if (state.content instanceof HTMLElement) {
|
|
7128
|
+
state.tooltipEl.text(''); // empty it
|
|
7129
|
+
state.tooltipEl.append(function () {
|
|
7130
|
+
return state.content;
|
|
7131
|
+
});
|
|
7132
|
+
} else if (typeof state.content === 'string') {
|
|
7133
|
+
state.tooltipEl.html(state.content);
|
|
7134
|
+
} else if (isReactRenderable(state.content)) {
|
|
7135
|
+
state.tooltipEl.text(''); // empty it
|
|
7136
|
+
render(state.content, state.tooltipEl.node());
|
|
7137
|
+
} else {
|
|
7138
|
+
state.tooltipEl.style('display', 'none');
|
|
7139
|
+
console.warn('Tooltip content is invalid, skipping.', state.content, state.content.toString());
|
|
7140
|
+
}
|
|
7058
7141
|
}
|
|
7059
7142
|
});
|
|
7060
7143
|
|
|
@@ -11178,7 +11261,7 @@
|
|
|
11178
11261
|
var _ref7 = _slicedToArray$3(_ref6, 2),
|
|
11179
11262
|
id = _ref7[0],
|
|
11180
11263
|
node = _ref7[1];
|
|
11181
|
-
return _defineProperty({}, id, node.depth);
|
|
11264
|
+
return _defineProperty$1({}, id, node.depth);
|
|
11182
11265
|
}))));
|
|
11183
11266
|
return nodeDepths;
|
|
11184
11267
|
function traverse(nodes) {
|
|
@@ -11896,12 +11979,12 @@
|
|
|
11896
11979
|
var bindFG = linkKapsule('forceGraph', CanvasForceGraph);
|
|
11897
11980
|
var bindBoth = linkKapsule(['forceGraph', 'shadowGraph'], CanvasForceGraph);
|
|
11898
11981
|
var linkedProps = Object.assign.apply(Object, _toConsumableArray$2(['nodeColor', 'nodeAutoColorBy', 'nodeCanvasObject', 'nodeCanvasObjectMode', 'linkColor', 'linkAutoColorBy', 'linkLineDash', 'linkWidth', 'linkCanvasObject', 'linkCanvasObjectMode', 'linkDirectionalArrowLength', 'linkDirectionalArrowColor', 'linkDirectionalArrowRelPos', 'linkDirectionalParticles', 'linkDirectionalParticleSpeed', 'linkDirectionalParticleWidth', 'linkDirectionalParticleColor', 'dagMode', 'dagLevelDistance', 'dagNodeFilter', 'onDagError', 'd3AlphaMin', 'd3AlphaDecay', 'd3VelocityDecay', 'warmupTicks', 'cooldownTicks', 'cooldownTime', 'onEngineTick', 'onEngineStop'].map(function (p) {
|
|
11899
|
-
return _defineProperty({}, p, bindFG.linkProp(p));
|
|
11982
|
+
return _defineProperty$1({}, p, bindFG.linkProp(p));
|
|
11900
11983
|
})).concat(_toConsumableArray$2(['nodeRelSize', 'nodeId', 'nodeVal', 'nodeVisibility', 'linkSource', 'linkTarget', 'linkVisibility', 'linkCurvature'].map(function (p) {
|
|
11901
|
-
return _defineProperty({}, p, bindBoth.linkProp(p));
|
|
11984
|
+
return _defineProperty$1({}, p, bindBoth.linkProp(p));
|
|
11902
11985
|
}))));
|
|
11903
11986
|
var linkedMethods = Object.assign.apply(Object, _toConsumableArray$2(['d3Force', 'd3ReheatSimulation', 'emitParticle'].map(function (p) {
|
|
11904
|
-
return _defineProperty({}, p, bindFG.linkMethod(p));
|
|
11987
|
+
return _defineProperty$1({}, p, bindFG.linkMethod(p));
|
|
11905
11988
|
})));
|
|
11906
11989
|
function adjustCanvasSize(state) {
|
|
11907
11990
|
if (state.canvas) {
|
|
@@ -11951,7 +12034,7 @@
|
|
|
11951
12034
|
//
|
|
11952
12035
|
|
|
11953
12036
|
var forceGraph = index$4({
|
|
11954
|
-
props: _objectSpread2({
|
|
12037
|
+
props: _objectSpread2$1({
|
|
11955
12038
|
width: {
|
|
11956
12039
|
"default": window.innerWidth,
|
|
11957
12040
|
onChange: function onChange(_, state) {
|
|
@@ -12132,7 +12215,7 @@
|
|
|
12132
12215
|
// Prop names supported for backwards compatibility
|
|
12133
12216
|
stopAnimation: 'pauseAnimation'
|
|
12134
12217
|
},
|
|
12135
|
-
methods: _objectSpread2({
|
|
12218
|
+
methods: _objectSpread2$1({
|
|
12136
12219
|
graph2ScreenCoords: function graph2ScreenCoords(state, x, y) {
|
|
12137
12220
|
var t = transform(state.canvas);
|
|
12138
12221
|
return {
|
|
@@ -12426,10 +12509,10 @@
|
|
|
12426
12509
|
c.translate(t.x, t.y);
|
|
12427
12510
|
c.scale(t.k, t.k);
|
|
12428
12511
|
});
|
|
12429
|
-
state.onZoom && state.onZoom(_objectSpread2(_objectSpread2({}, t), _this.centerAt())); // report x,y coordinates relative to canvas center
|
|
12512
|
+
state.onZoom && state.onZoom(_objectSpread2$1(_objectSpread2$1({}, t), _this.centerAt())); // report x,y coordinates relative to canvas center
|
|
12430
12513
|
state.needsRedraw = true;
|
|
12431
12514
|
}).on('end', function (ev) {
|
|
12432
|
-
return state.onZoomEnd && state.onZoomEnd(_objectSpread2(_objectSpread2({}, ev.transform), _this.centerAt()));
|
|
12515
|
+
return state.onZoomEnd && state.onZoomEnd(_objectSpread2$1(_objectSpread2$1({}, ev.transform), _this.centerAt()));
|
|
12433
12516
|
});
|
|
12434
12517
|
adjustCanvasSize(state);
|
|
12435
12518
|
state.forceGraph.onNeedsRedraw(function () {
|