3d-force-graph 1.74.7 → 1.75.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/3d-force-graph.d.ts +6 -4
- package/dist/3d-force-graph.js +13 -3
- package/dist/3d-force-graph.js.map +1 -1
- package/dist/3d-force-graph.min.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -107,7 +107,7 @@ new ForceGraph3d(<domElement>, { configOptions })
|
|
|
107
107
|
| --- | --- | :--: |
|
|
108
108
|
| <b>nodeRelSize</b>([<i>num</i>]) | Getter/setter for the ratio of node sphere volume (cubic px) per value unit. | 4 |
|
|
109
109
|
| <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 sphere volume). | `val` |
|
|
110
|
-
| <b>nodeLabel</b>([<i>str</i> or <i>fn</i>]) | Node object accessor function or attribute for name (shown in label). Supports plain text
|
|
110
|
+
| <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` |
|
|
111
111
|
| <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` |
|
|
112
112
|
| <b>nodeColor</b>([<i>str</i> or <i>fn</i>]) | Node object accessor function or attribute for node color (affects sphere color). | `color` |
|
|
113
113
|
| <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. | |
|
|
@@ -120,7 +120,7 @@ new ForceGraph3d(<domElement>, { configOptions })
|
|
|
120
120
|
|
|
121
121
|
| Method | Description | Default |
|
|
122
122
|
| --- | --- | :--: |
|
|
123
|
-
| <b>linkLabel</b>([<i>str</i> or <i>fn</i>]) | Link object accessor function or attribute for name (shown in label). Supports plain text
|
|
123
|
+
| <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` |
|
|
124
124
|
| <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` |
|
|
125
125
|
| <b>linkColor</b>([<i>str</i> or <i>fn</i>]) | Link object accessor function or attribute for line color. | `color` |
|
|
126
126
|
| <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/3d-force-graph.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ interface ConfigOptions {
|
|
|
11
11
|
type Accessor<In, Out> = Out | string | ((obj: In) => Out);
|
|
12
12
|
type ObjAccessor<T, InT = object> = Accessor<InT, T>;
|
|
13
13
|
|
|
14
|
+
type Label = string | HTMLElement;
|
|
15
|
+
|
|
14
16
|
type Coords = { x: number; y: number; z: number; };
|
|
15
17
|
|
|
16
18
|
// don't surface these internal props from inner ThreeForceGraph
|
|
@@ -32,10 +34,10 @@ interface ForceGraph3DGenericInstance<ChainableInstance, N extends NodeObject =
|
|
|
32
34
|
showNavInfo(enabled: boolean): ChainableInstance;
|
|
33
35
|
|
|
34
36
|
// Labels
|
|
35
|
-
nodeLabel(): ObjAccessor<
|
|
36
|
-
nodeLabel(textAccessor: ObjAccessor<
|
|
37
|
-
linkLabel(): ObjAccessor<
|
|
38
|
-
linkLabel(textAccessor: ObjAccessor<
|
|
37
|
+
nodeLabel(): ObjAccessor<Label, N>;
|
|
38
|
+
nodeLabel(textAccessor: ObjAccessor<Label, N>): ChainableInstance;
|
|
39
|
+
linkLabel(): ObjAccessor<Label, L>;
|
|
40
|
+
linkLabel(textAccessor: ObjAccessor<Label, L>): ChainableInstance;
|
|
39
41
|
|
|
40
42
|
// Interaction
|
|
41
43
|
onNodeClick(callback: (node: N, event: MouseEvent) => void): ChainableInstance;
|
package/dist/3d-force-graph.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 1.
|
|
1
|
+
// Version 1.75.0 3d-force-graph - https://github.com/vasturiano/3d-force-graph
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -106522,7 +106522,7 @@ var<${access}> ${name} : ${structName};`;
|
|
|
106522
106522
|
}
|
|
106523
106523
|
}
|
|
106524
106524
|
|
|
106525
|
-
var css_248z$1 = ".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";
|
|
106525
|
+
var css_248z$1 = ".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";
|
|
106526
106526
|
styleInject$1(css_248z$1);
|
|
106527
106527
|
|
|
106528
106528
|
var index = index$2({
|
|
@@ -106537,6 +106537,9 @@ var<${access}> ${name} : ${structName};`;
|
|
|
106537
106537
|
style = _ref$style === undefined ? {} : _ref$style;
|
|
106538
106538
|
var isD3Selection = !!domNode && _typeof(domNode) === 'object' && !!domNode.node && typeof domNode.node === 'function';
|
|
106539
106539
|
var el = select(isD3Selection ? domNode.node() : domNode);
|
|
106540
|
+
|
|
106541
|
+
// make sure container is positioned, to provide anchor for tooltip
|
|
106542
|
+
el.style('position') === 'static' && el.style('position', 'relative');
|
|
106540
106543
|
state.tooltipEl = el.append('div').attr('class', 'float-tooltip-kap');
|
|
106541
106544
|
Object.entries(style).forEach(function (_ref2) {
|
|
106542
106545
|
var _ref3 = _slicedToArray$1(_ref2, 2),
|
|
@@ -106570,7 +106573,14 @@ var<${access}> ${name} : ${structName};`;
|
|
|
106570
106573
|
},
|
|
106571
106574
|
update: function update(state) {
|
|
106572
106575
|
state.tooltipEl.style('display', !!state.content && state.mouseInside ? 'inline' : 'none');
|
|
106573
|
-
|
|
106576
|
+
if (state.content instanceof HTMLElement) {
|
|
106577
|
+
state.tooltipEl.text(''); // empty it
|
|
106578
|
+
state.tooltipEl.append(function () {
|
|
106579
|
+
return state.content;
|
|
106580
|
+
});
|
|
106581
|
+
} else {
|
|
106582
|
+
state.tooltipEl.html(state.content || '');
|
|
106583
|
+
}
|
|
106574
106584
|
}
|
|
106575
106585
|
});
|
|
106576
106586
|
|