@krainovsd/graph 0.13.0-beta3 → 0.14.0-beta-7.1
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/cjs/index.cjs +1040 -533
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/constants/force-controls.js +4 -2
- package/lib/esm/constants/force-controls.js.map +1 -1
- package/lib/esm/constants/highlight-controls.js +9 -16
- package/lib/esm/constants/highlight-controls.js.map +1 -1
- package/lib/esm/constants/link-controls.js +17 -30
- package/lib/esm/constants/link-controls.js.map +1 -1
- package/lib/esm/constants/node-controls.js +4 -2
- package/lib/esm/constants/node-controls.js.map +1 -1
- package/lib/esm/index.js +8 -7
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/module/GraphCanvas/GraphCanvas.js +305 -81
- package/lib/esm/module/GraphCanvas/GraphCanvas.js.map +1 -1
- package/lib/esm/module/GraphCanvas/constants/force-settings.js +11 -1
- package/lib/esm/module/GraphCanvas/constants/force-settings.js.map +1 -1
- package/lib/esm/module/GraphCanvas/constants/graph-settings.js +17 -5
- package/lib/esm/module/GraphCanvas/constants/graph-settings.js.map +1 -1
- package/lib/esm/module/GraphCanvas/constants/highlight-settings.js +5 -3
- package/lib/esm/module/GraphCanvas/constants/highlight-settings.js.map +1 -1
- package/lib/esm/module/GraphCanvas/constants/index.js +5 -2
- package/lib/esm/module/GraphCanvas/constants/index.js.map +1 -1
- package/lib/esm/module/GraphCanvas/constants/link-settings.js +19 -10
- package/lib/esm/module/GraphCanvas/constants/link-settings.js.map +1 -1
- package/lib/esm/module/GraphCanvas/constants/node-settings.js +13 -3
- package/lib/esm/module/GraphCanvas/constants/node-settings.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/settings/force-settings-getter.js +4 -2
- package/lib/esm/module/GraphCanvas/lib/settings/force-settings-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/settings/graph-settings-getter.js +4 -0
- package/lib/esm/module/GraphCanvas/lib/settings/graph-settings-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/settings/highlight-settings-getter.js +4 -2
- package/lib/esm/module/GraphCanvas/lib/settings/highlight-settings-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/settings/link-settings-getter.js +8 -5
- package/lib/esm/module/GraphCanvas/lib/settings/link-settings-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js +14 -2
- package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-curve-link-position-by-node.js +5 -2
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-curve-link-position-by-node.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js +5 -2
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/compute-graph-bounds.js +26 -0
- package/lib/esm/module/GraphCanvas/lib/utils/compute-graph-bounds.js.map +1 -0
- package/lib/esm/module/GraphCanvas/lib/utils/get-particle-position.js +40 -30
- package/lib/esm/module/GraphCanvas/lib/utils/get-particle-position.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/is-empty-object.js +11 -0
- package/lib/esm/module/GraphCanvas/lib/utils/is-empty-object.js.map +1 -0
- package/lib/esm/module/GraphCanvas/lib/utils/is-node-visible.js +5 -2
- package/lib/esm/module/GraphCanvas/lib/utils/is-node-visible.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js +1 -5
- package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/node-by-pointer-getter.js +1 -5
- package/lib/esm/module/GraphCanvas/lib/utils/node-by-pointer-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/pointer-getter.js +16 -8
- package/lib/esm/module/GraphCanvas/lib/utils/pointer-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/draw-links.js +47 -62
- package/lib/esm/module/GraphCanvas/slices/draw-links.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/draw-nodes.js +9 -4
- package/lib/esm/module/GraphCanvas/slices/draw-nodes.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-area.js +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-area.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-dnd.js +20 -13
- package/lib/esm/module/GraphCanvas/slices/init-dnd.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-draw.js +14 -52
- package/lib/esm/module/GraphCanvas/slices/init-draw.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-pointer.js +45 -72
- package/lib/esm/module/GraphCanvas/slices/init-pointer.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-resize.js +6 -2
- package/lib/esm/module/GraphCanvas/slices/init-resize.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-selection.js +152 -0
- package/lib/esm/module/GraphCanvas/slices/init-selection.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/init-simulation.js +12 -2
- package/lib/esm/module/GraphCanvas/slices/init-simulation.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-zoom.js +88 -16
- package/lib/esm/module/GraphCanvas/slices/init-zoom.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/update-link-cache.js +33 -3
- package/lib/esm/module/GraphCanvas/slices/update-link-cache.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/update-node-cache.js +61 -16
- package/lib/esm/module/GraphCanvas/slices/update-node-cache.js.map +1 -1
- package/lib/index.d.ts +106 -56
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-link-cache.js","sources":["../../../../../src/module/GraphCanvas/slices/update-link-cache.ts"],"sourcesContent":["import type { GraphCanvas } from \"../GraphCanvas\";\nimport { extractLinkPointIds, linkIterationExtractor, linkOptionsGetter } from \"../lib\";\n\nexport function updateLinkCache<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n this.linkOptionsCache = {};\n\n const groupMap: Record<string, number> = {};\n const groupSelfMap: Record<string, number> = {};\n for (let i = 0; i < this.links.length; i++) {\n const link = this.links[i];\n const { sourceId, targetId } = extractLinkPointIds(link);\n\n const linkOptions = linkIterationExtractor(\n link,\n i,\n this.links,\n this,\n this.linkSettings.options ?? {},\n linkOptionsGetter,\n );\n
|
|
1
|
+
{"version":3,"file":"update-link-cache.js","sources":["../../../../../src/module/GraphCanvas/slices/update-link-cache.ts"],"sourcesContent":["import type { GraphCanvas } from \"../GraphCanvas\";\nimport { extractLinkPointIds, linkIterationExtractor, linkOptionsGetter } from \"../lib\";\n\nexport function updateLinkCache<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n if (!this.context) return;\n\n const current = this.areaTransform.k;\n if (\n this.linkSettings.smartCache &&\n this._lastLinkZoomK !== undefined &&\n this.linkOptionsCache.length > 0\n ) {\n const corner = this.linkSettings.linkScaleSwitch;\n const prev = this._lastLinkZoomK;\n this._lastLinkZoomK = current;\n if (!((prev <= corner && current >= corner) || (prev >= corner && current <= corner))) {\n return;\n }\n for (let i = 0; i < this.links.length; i++) {\n const link = this.links[i];\n const linkOptions = linkIterationExtractor(\n link,\n i,\n this.links,\n this,\n this.linkSettings.options ?? {},\n linkOptionsGetter,\n );\n const cache = this.linkOptionsCache[i];\n if (cache) {\n cache.color = linkOptions.color;\n cache.arrowColor = linkOptions.arrowColor;\n cache.width = linkOptions.width;\n }\n }\n return;\n }\n\n this._lastLinkZoomK = current;\n this.linkOptionsCache.length = 0;\n\n const groupMap: Record<string, number> = {};\n const groupSelfMap: Record<string, number> = {};\n for (let i = 0; i < this.links.length; i++) {\n const link = this.links[i];\n const { sourceId, targetId } = extractLinkPointIds(link);\n\n const linkOptions = linkIterationExtractor(\n link,\n i,\n this.links,\n this,\n this.linkSettings.options ?? {},\n linkOptionsGetter,\n );\n this.linkOptionsCache[i] = linkOptions;\n\n if (this.linkSettings.curve) {\n const id = `${targetId}${sourceId}`;\n if (sourceId === targetId) {\n groupSelfMap[id] ??= 0;\n link._groupIndex = ++groupSelfMap[id];\n link._self = true;\n continue;\n }\n const reverseId = `${sourceId}${targetId}`;\n groupMap[reverseId] ??= 0;\n groupMap[reverseId]++;\n groupMap[id] ??= 0;\n link._groupIndex = indexToPosition(++groupMap[id]);\n link._self = false;\n }\n }\n if (this.linkSettings.curve) {\n for (const link of this.links) {\n const { sourceId, targetId } = extractLinkPointIds(link);\n const id = `${targetId}${sourceId}`;\n link._groupSize = link._self ? (groupSelfMap[id] ?? 1) : (groupMap[id] ?? 1);\n }\n }\n}\n\nfunction indexToPosition(n: number): number {\n if (n === 1) return 0;\n\n const index = n >> 1;\n return n & 1 ? -(index * 2) : index * 2;\n\n // return n & 1 ? -(n >> 1) : n >> 1;\n}\n"],"names":[],"mappings":";;;;;;;;;;;SAGgB,eAAe,GAAA;IAI7B,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE;AAEnB,IAAA,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;AACpC,IAAA,IACE,IAAI,CAAC,YAAY,CAAC,UAAU;QAC5B,IAAI,CAAC,cAAc,KAAK,SAAS;AACjC,QAAA,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAChC;AACA,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe;AAChD,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc;AAChC,QAAA,IAAI,CAAC,cAAc,GAAG,OAAO;QAC7B,IAAI,EAAE,CAAC,IAAI,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,MAAM,IAAI,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,CA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,IAAA,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC;AACpB,IAAA,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;;AAGzC;;;;"}
|
|
@@ -1,16 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../constants/force-settings.js';
|
|
2
|
+
import '../constants/graph-settings.js';
|
|
3
|
+
import '../constants/highlight-settings.js';
|
|
4
|
+
import '../constants/link-settings.js';
|
|
5
|
+
import '../constants/node-settings.js';
|
|
2
6
|
import { nodeOptionsGetter, nodeRadiusGetter, nodeSizeGetter } from '../lib/settings/node-settings-getter.js';
|
|
7
|
+
import '@krainovsd/js-helpers';
|
|
3
8
|
import 'd3-array';
|
|
4
9
|
import { nodeIterationExtractor } from '../lib/utils/node-iteration-extractor.js';
|
|
5
10
|
import { getTextLines } from './draw-text.js';
|
|
6
11
|
|
|
7
|
-
function updateNodeCache(
|
|
8
|
-
this.nodeOptionsCache = {};
|
|
12
|
+
function updateNodeCache() {
|
|
9
13
|
if (!this.context)
|
|
10
14
|
return;
|
|
15
|
+
const currentZoom = this.areaTransform.k;
|
|
16
|
+
const options = this.nodeOptionsCache.length === 0;
|
|
17
|
+
const label = this.cachedNodeLabel.length === 0;
|
|
18
|
+
let text = this.cachedNodeText.length === 0;
|
|
19
|
+
if (this.nodeSettings.smartCache &&
|
|
20
|
+
this._lastNodeZoomK !== undefined &&
|
|
21
|
+
!options &&
|
|
22
|
+
!text &&
|
|
23
|
+
!label) {
|
|
24
|
+
const thresholds = this.nodeSettings.textScaleSteps;
|
|
25
|
+
if (thresholds && thresholds.length > 0) {
|
|
26
|
+
const min = Math.min(this._lastNodeZoomK, currentZoom);
|
|
27
|
+
const max = Math.max(this._lastNodeZoomK, currentZoom);
|
|
28
|
+
const crossed = thresholds.some((t) => t >= min && t <= max);
|
|
29
|
+
this._lastNodeZoomK = currentZoom;
|
|
30
|
+
if (!crossed)
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
this.cachedNodeText.length = 0;
|
|
34
|
+
text = true;
|
|
35
|
+
}
|
|
36
|
+
this._lastNodeZoomK = currentZoom;
|
|
11
37
|
for (let i = 0; i < this.nodes.length; i++) {
|
|
12
38
|
const node = this.nodes[i];
|
|
13
|
-
if (
|
|
39
|
+
if (options) {
|
|
14
40
|
const nodeOptions = nodeIterationExtractor(node, i, this.nodes, this, this.nodeSettings.options ?? {}, nodeOptionsGetter);
|
|
15
41
|
const radius = nodeOptions.shape === "circle"
|
|
16
42
|
? nodeRadiusGetter({
|
|
@@ -61,11 +87,19 @@ function updateNodeCache(types) {
|
|
|
61
87
|
nodeOptions.height = node.visible === false ? 0 : height;
|
|
62
88
|
nodeOptions.radius = node.visible === false ? 0 : radius;
|
|
63
89
|
nodeOptions.labelSize = labelSize;
|
|
64
|
-
this.nodeOptionsCache[
|
|
90
|
+
this.nodeOptionsCache[i] = nodeOptions;
|
|
65
91
|
}
|
|
66
|
-
|
|
92
|
+
let nodeOptions = this.nodeOptionsCache[i];
|
|
93
|
+
if (!nodeOptions)
|
|
94
|
+
continue;
|
|
67
95
|
/** label */
|
|
68
|
-
if (
|
|
96
|
+
if (label) {
|
|
97
|
+
if (!options) {
|
|
98
|
+
nodeOptions = nodeIterationExtractor(node, i, this.nodes, this, this.nodeSettings.options ?? {}, nodeOptionsGetter);
|
|
99
|
+
const cache = this.nodeOptionsCache[i];
|
|
100
|
+
if (cache)
|
|
101
|
+
cache.label = nodeOptions.label;
|
|
102
|
+
}
|
|
69
103
|
/** label in not text shape */
|
|
70
104
|
if (nodeOptions.shape !== "text" && nodeOptions.label) {
|
|
71
105
|
this.context.font = `${nodeOptions.labelStyle} normal ${nodeOptions.labelWeight} ${nodeOptions.labelSize}px ${nodeOptions.labelFont}`;
|
|
@@ -73,7 +107,7 @@ function updateNodeCache(types) {
|
|
|
73
107
|
this.context.textAlign = nodeOptions.labelAlign;
|
|
74
108
|
if (nodeOptions.labelWidth == undefined ||
|
|
75
109
|
this.context.measureText(nodeOptions.label).width <= nodeOptions.labelWidth) {
|
|
76
|
-
this.cachedNodeLabel[
|
|
110
|
+
this.cachedNodeLabel[i] = [nodeOptions.label];
|
|
77
111
|
}
|
|
78
112
|
const { lines } = getTextLines({
|
|
79
113
|
context: this.context,
|
|
@@ -86,7 +120,7 @@ function updateNodeCache(types) {
|
|
|
86
120
|
textStyle: nodeOptions.labelStyle,
|
|
87
121
|
textWeight: nodeOptions.labelWeight,
|
|
88
122
|
});
|
|
89
|
-
this.cachedNodeLabel[
|
|
123
|
+
this.cachedNodeLabel[i] = lines;
|
|
90
124
|
/** label in text shape */
|
|
91
125
|
}
|
|
92
126
|
else if (nodeOptions.shape === "text" && nodeOptions.label) {
|
|
@@ -110,18 +144,29 @@ function updateNodeCache(types) {
|
|
|
110
144
|
(lines.length - 1) * nodeOptions.labelGap +
|
|
111
145
|
nodeOptions.labelYPadding;
|
|
112
146
|
nodeOptions.width = maxSize + nodeOptions.labelXPadding;
|
|
113
|
-
this.cachedNodeLabel[
|
|
147
|
+
this.cachedNodeLabel[i] = lines;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
this.cachedNodeLabel[i] = [];
|
|
114
151
|
}
|
|
115
152
|
}
|
|
116
153
|
/** text */
|
|
117
|
-
if (
|
|
154
|
+
if (text) {
|
|
155
|
+
if (!options) {
|
|
156
|
+
nodeOptions = nodeIterationExtractor(node, i, this.nodes, this, this.nodeSettings.options ?? {}, nodeOptionsGetter);
|
|
157
|
+
const cache = this.nodeOptionsCache[i];
|
|
158
|
+
if (cache) {
|
|
159
|
+
cache.text = nodeOptions.text;
|
|
160
|
+
cache.textVisible = nodeOptions.textVisible;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (!nodeOptions.text) {
|
|
164
|
+
this.cachedNodeText[i] = [];
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
118
167
|
this.context.font = `${nodeOptions.textStyle} normal ${nodeOptions.textWeight} ${nodeOptions.textSize}px ${nodeOptions.textFont}`;
|
|
119
168
|
this.context.fillStyle = nodeOptions.textColor;
|
|
120
169
|
this.context.textAlign = nodeOptions.textAlign;
|
|
121
|
-
if (nodeOptions.textWidth == undefined ||
|
|
122
|
-
this.context.measureText(nodeOptions.text).width <= nodeOptions.textWidth) {
|
|
123
|
-
this.cachedNodeText[node.id] = [nodeOptions.text];
|
|
124
|
-
}
|
|
125
170
|
const { lines } = getTextLines({
|
|
126
171
|
context: this.context,
|
|
127
172
|
maxWidth: nodeOptions.textWidth,
|
|
@@ -133,7 +178,7 @@ function updateNodeCache(types) {
|
|
|
133
178
|
textStyle: nodeOptions.textStyle,
|
|
134
179
|
textWeight: nodeOptions.textWeight,
|
|
135
180
|
});
|
|
136
|
-
this.cachedNodeText[
|
|
181
|
+
this.cachedNodeText[i] = lines;
|
|
137
182
|
}
|
|
138
183
|
}
|
|
139
184
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-node-cache.js","sources":["../../../../../src/module/GraphCanvas/slices/update-node-cache.ts"],"sourcesContent":["import { isObject } from \"@krainovsd/js-helpers\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport {\n nodeIterationExtractor,\n nodeOptionsGetter,\n nodeRadiusGetter,\n nodeSizeGetter,\n} from \"../lib\";\nimport { getTextLines } from \"./draw-text\";\n\ntype NodeCache = {\n options: boolean;\n text: boolean;\n label: boolean;\n};\n\nexport function updateNodeCache<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>, types: boolean | NodeCache) {\n this.nodeOptionsCache = {};\n if (!this.context) return;\n\n for (let i = 0; i < this.nodes.length; i++) {\n const node = this.nodes[i];\n if (types === true || (isObject(types) && types.options)) {\n const nodeOptions = nodeIterationExtractor(\n node,\n i,\n this.nodes,\n this,\n this.nodeSettings.options ?? {},\n nodeOptionsGetter,\n );\n const radius =\n nodeOptions.shape === \"circle\"\n ? nodeRadiusGetter({\n radiusFlexible: this.nodeSettings.nodeRadiusFlexible,\n radiusInitial: nodeOptions.radius,\n radiusIncrementByStep: this.nodeSettings.nodeRadiusIncrementByStep,\n radiusLinkCountForStep: this.nodeSettings.nodeRadiusLinkCountForStep,\n radiusMaxLinearSteps: this.nodeSettings.nodeRadiusMaxLinearSteps,\n radiusLogFactor: this.nodeSettings.nodeRadiusLogFactor,\n radiusLinkCountDividerForLog: this.nodeSettings.nodeRadiusLinkCountDividerForLog,\n linkCount: node.linkCount,\n })\n : nodeOptions.radius;\n\n let width = nodeOptions.width;\n let height = nodeOptions.height;\n let labelSize = nodeOptions.labelSize;\n if (nodeOptions.shape === \"square\") {\n const size = nodeSizeGetter({\n heightInitial: nodeOptions.height,\n widthInitial: nodeOptions.width,\n linkCount: node.linkCount,\n sizeFlexible: this.nodeSettings.nodeSizeFlexible,\n sizeIncrementByStep: this.nodeSettings.nodeSizeIncrementByStep,\n sizeLinkCountForStep: this.nodeSettings.nodeSizeLinkCountForStep,\n sizeMaxLinearSteps: this.nodeSettings.nodeSizeMaxLinearSteps,\n sizeLogFactor: this.nodeSettings.nodeSizeLogFactor,\n sizeLinkCountDividerForLog: this.nodeSettings.nodeSizeLinkCountDividerForLog,\n });\n width = size.width;\n height = size.height;\n }\n if (nodeOptions.shape === \"text\") {\n width = nodeOptions.width;\n const size = nodeSizeGetter({\n heightInitial: nodeOptions.height,\n widthInitial: width,\n linkCount: node.linkCount,\n sizeFlexible: this.nodeSettings.nodeSizeFlexible,\n sizeIncrementByStep: this.nodeSettings.nodeSizeIncrementByStep,\n sizeLinkCountForStep: this.nodeSettings.nodeSizeLinkCountForStep,\n sizeMaxLinearSteps: this.nodeSettings.nodeSizeMaxLinearSteps,\n sizeLogFactor: this.nodeSettings.nodeSizeLogFactor,\n sizeLinkCountDividerForLog: this.nodeSettings.nodeSizeLinkCountDividerForLog,\n });\n\n labelSize *= size.additionalSizeCoefficient;\n }\n\n nodeOptions.width = node.visible === false ? 0 : width;\n nodeOptions.height = node.visible === false ? 0 : height;\n nodeOptions.radius = node.visible === false ? 0 : radius;\n nodeOptions.labelSize = labelSize;\n this.nodeOptionsCache[node.id] = nodeOptions;\n }\n\n const nodeOptions = this.nodeOptionsCache[node.id];\n /** label */\n if (types === true || (isObject(types) && types.label)) {\n /** label in not text shape */\n if (nodeOptions.shape !== \"text\" && nodeOptions.label) {\n this.context.font = `${nodeOptions.labelStyle} normal ${nodeOptions.labelWeight} ${nodeOptions.labelSize}px ${nodeOptions.labelFont}`;\n this.context.fillStyle = nodeOptions.labelColor;\n this.context.textAlign = nodeOptions.labelAlign;\n\n if (\n nodeOptions.labelWidth == undefined ||\n this.context.measureText(nodeOptions.label).width <= nodeOptions.labelWidth\n ) {\n this.cachedNodeLabel[node.id] = [nodeOptions.label];\n }\n\n const { lines } = getTextLines({\n context: this.context,\n maxWidth: nodeOptions.labelWidth,\n text: nodeOptions.label,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textSize: nodeOptions.labelSize,\n textStyle: nodeOptions.labelStyle,\n textWeight: nodeOptions.labelWeight,\n });\n this.cachedNodeLabel[node.id] = lines;\n /** label in text shape */\n } else if (nodeOptions.shape === \"text\" && nodeOptions.label) {\n const textInfo = getTextLines({\n context: this.context,\n text: nodeOptions.label,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textSize: nodeOptions.labelSize,\n maxWidth: nodeOptions.labelWidth,\n textStyle: nodeOptions.labelStyle,\n textWeight: nodeOptions.textWeight,\n });\n const textNodeParameters = [textInfo.currentMaxSize, nodeOptions.labelSize];\n const lines = textInfo.lines;\n const textSizeCoefficient = nodeOptions.labelSize / textNodeParameters[1];\n const maxSize = textNodeParameters[0] * textSizeCoefficient;\n\n nodeOptions.height =\n lines.length * nodeOptions.labelSize +\n (lines.length - 1) * nodeOptions.labelGap +\n nodeOptions.labelYPadding;\n\n nodeOptions.width = maxSize + nodeOptions.labelXPadding;\n this.cachedNodeLabel[node.id] = lines;\n }\n }\n\n /** text */\n if (nodeOptions.text && (types === true || (isObject(types) && types.text))) {\n this.context.font = `${nodeOptions.textStyle} normal ${nodeOptions.textWeight} ${nodeOptions.textSize}px ${nodeOptions.textFont}`;\n this.context.fillStyle = nodeOptions.textColor;\n this.context.textAlign = nodeOptions.textAlign;\n\n if (\n nodeOptions.textWidth == undefined ||\n this.context.measureText(nodeOptions.text).width <= nodeOptions.textWidth\n ) {\n this.cachedNodeText[node.id] = [nodeOptions.text];\n }\n\n const { lines } = getTextLines({\n context: this.context,\n maxWidth: nodeOptions.textWidth,\n text: nodeOptions.text,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize: nodeOptions.textSize,\n textStyle: nodeOptions.textStyle,\n textWeight: nodeOptions.textWeight,\n });\n this.cachedNodeText[node.id] = lines;\n }\n }\n}\n"],"names":[],"mappings":";;;;;;AAgBM,SAAU,eAAe,CAGU,KAA0B,EAAA;AACjE,IAAA,IAAI,CAAC,gBAAgB,GAAG,EAAE;IAC1B,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE;AAEnB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1B,QAAA,IAAI,KAAK,KAAK,IAAI,KAAK,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE;YACxD,MAAM,WAAW,GAAG,sBAAsB,CACxC,IAAI,EACJ,CAAC,EACD,IAAI,CAAC,KAAK,EACV,IAAI,EACJ,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,EAAE,EAC/B,iBAAiB,CAClB;AACD,YAAA,MAAM,MAAM,GACV,WAAW,CAAC,KAAK,KA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AA,WAAW,CAAC,SAAS,CAAW,QAAA,EAAA,WAAW,CAAC,UAAU,CAAA,CAAA,EAAI,WAAW,CAAC,QAAQ,MAAM,WAAW,CAAC,QAAQ,CAAA,CAAE;YACjI,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS;YAC9C,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS;AAE9C,YAAA,IACE,WAAW,CAAC,SAAS,IAAI,SAAS;AAClC,gBAAA,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,WAAW,CAAC,SAAS,EACzE;AACA,gBAAA,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC;;AAGnD,YAAA,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC;gBAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,WAAW,CAAC,SAAS;gBAC/B,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,QAAQ,EAAE,WAAW,CAAC,QAAQ;gBAC9B,QAAQ,EAAE,WAAW,CAAC,QAAQ;gBAC9B,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,UAAU,EAAE,WAAW,CAAC,UAAU;AACnC,aAAA,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,KAAK;;;AAG1C;;;;"}
|
|
1
|
+
{"version":3,"file":"update-node-cache.js","sources":["../../../../../src/module/GraphCanvas/slices/update-node-cache.ts"],"sourcesContent":["import type { GraphCanvas } from \"../GraphCanvas\";\nimport {\n nodeIterationExtractor,\n nodeOptionsGetter,\n nodeRadiusGetter,\n nodeSizeGetter,\n} from \"../lib\";\nimport { getTextLines } from \"./draw-text\";\n\nexport function updateNodeCache<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>) {\n if (!this.context) return;\n\n const currentZoom = this.areaTransform.k;\n const options = this.nodeOptionsCache.length === 0;\n const label = this.cachedNodeLabel.length === 0;\n let text = this.cachedNodeText.length === 0;\n\n if (\n this.nodeSettings.smartCache &&\n this._lastNodeZoomK !== undefined &&\n !options &&\n !text &&\n !label\n ) {\n const thresholds = this.nodeSettings.textScaleSteps;\n if (thresholds && thresholds.length > 0) {\n const min = Math.min(this._lastNodeZoomK, currentZoom);\n const max = Math.max(this._lastNodeZoomK, currentZoom);\n const crossed = thresholds.some((t) => t >= min && t <= max);\n this._lastNodeZoomK = currentZoom;\n if (!crossed) return;\n }\n this.cachedNodeText.length = 0;\n text = true;\n }\n this._lastNodeZoomK = currentZoom;\n\n for (let i = 0; i < this.nodes.length; i++) {\n const node = this.nodes[i];\n if (options) {\n const nodeOptions = nodeIterationExtractor(\n node,\n i,\n this.nodes,\n this,\n this.nodeSettings.options ?? {},\n nodeOptionsGetter,\n );\n const radius =\n nodeOptions.shape === \"circle\"\n ? nodeRadiusGetter({\n radiusFlexible: this.nodeSettings.nodeRadiusFlexible,\n radiusInitial: nodeOptions.radius,\n radiusIncrementByStep: this.nodeSettings.nodeRadiusIncrementByStep,\n radiusLinkCountForStep: this.nodeSettings.nodeRadiusLinkCountForStep,\n radiusMaxLinearSteps: this.nodeSettings.nodeRadiusMaxLinearSteps,\n radiusLogFactor: this.nodeSettings.nodeRadiusLogFactor,\n radiusLinkCountDividerForLog: this.nodeSettings.nodeRadiusLinkCountDividerForLog,\n linkCount: node.linkCount,\n })\n : nodeOptions.radius;\n\n let width = nodeOptions.width;\n let height = nodeOptions.height;\n let labelSize = nodeOptions.labelSize;\n if (nodeOptions.shape === \"square\") {\n const size = nodeSizeGetter({\n heightInitial: nodeOptions.height,\n widthInitial: nodeOptions.width,\n linkCount: node.linkCount,\n sizeFlexible: this.nodeSettings.nodeSizeFlexible,\n sizeIncrementByStep: this.nodeSettings.nodeSizeIncrementByStep,\n sizeLinkCountForStep: this.nodeSettings.nodeSizeLinkCountForStep,\n sizeMaxLinearSteps: this.nodeSettings.nodeSizeMaxLinearSteps,\n sizeLogFactor: this.nodeSettings.nodeSizeLogFactor,\n sizeLinkCountDividerForLog: this.nodeSettings.nodeSizeLinkCountDividerForLog,\n });\n width = size.width;\n height = size.height;\n }\n if (nodeOptions.shape === \"text\") {\n width = nodeOptions.width;\n const size = nodeSizeGetter({\n heightInitial: nodeOptions.height,\n widthInitial: width,\n linkCount: node.linkCount,\n sizeFlexible: this.nodeSettings.nodeSizeFlexible,\n sizeIncrementByStep: this.nodeSettings.nodeSizeIncrementByStep,\n sizeLinkCountForStep: this.nodeSettings.nodeSizeLinkCountForStep,\n sizeMaxLinearSteps: this.nodeSettings.nodeSizeMaxLinearSteps,\n sizeLogFactor: this.nodeSettings.nodeSizeLogFactor,\n sizeLinkCountDividerForLog: this.nodeSettings.nodeSizeLinkCountDividerForLog,\n });\n\n labelSize *= size.additionalSizeCoefficient;\n }\n\n nodeOptions.width = node.visible === false ? 0 : width;\n nodeOptions.height = node.visible === false ? 0 : height;\n nodeOptions.radius = node.visible === false ? 0 : radius;\n nodeOptions.labelSize = labelSize;\n this.nodeOptionsCache[i] = nodeOptions;\n }\n\n let nodeOptions = this.nodeOptionsCache[i];\n if (!nodeOptions) continue;\n /** label */\n if (label) {\n if (!options) {\n nodeOptions = nodeIterationExtractor(\n node,\n i,\n this.nodes,\n this,\n this.nodeSettings.options ?? {},\n nodeOptionsGetter,\n );\n const cache = this.nodeOptionsCache[i];\n if (cache) cache.label = nodeOptions.label;\n }\n /** label in not text shape */\n if (nodeOptions.shape !== \"text\" && nodeOptions.label) {\n this.context.font = `${nodeOptions.labelStyle} normal ${nodeOptions.labelWeight} ${nodeOptions.labelSize}px ${nodeOptions.labelFont}`;\n this.context.fillStyle = nodeOptions.labelColor;\n this.context.textAlign = nodeOptions.labelAlign;\n\n if (\n nodeOptions.labelWidth == undefined ||\n this.context.measureText(nodeOptions.label).width <= nodeOptions.labelWidth\n ) {\n this.cachedNodeLabel[i] = [nodeOptions.label];\n }\n\n const { lines } = getTextLines({\n context: this.context,\n maxWidth: nodeOptions.labelWidth,\n text: nodeOptions.label,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textSize: nodeOptions.labelSize,\n textStyle: nodeOptions.labelStyle,\n textWeight: nodeOptions.labelWeight,\n });\n this.cachedNodeLabel[i] = lines;\n /** label in text shape */\n } else if (nodeOptions.shape === \"text\" && nodeOptions.label) {\n const textInfo = getTextLines({\n context: this.context,\n text: nodeOptions.label,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textSize: nodeOptions.labelSize,\n maxWidth: nodeOptions.labelWidth,\n textStyle: nodeOptions.labelStyle,\n textWeight: nodeOptions.textWeight,\n });\n const textNodeParameters = [textInfo.currentMaxSize, nodeOptions.labelSize];\n const lines = textInfo.lines;\n const textSizeCoefficient = nodeOptions.labelSize / textNodeParameters[1];\n const maxSize = textNodeParameters[0] * textSizeCoefficient;\n\n nodeOptions.height =\n lines.length * nodeOptions.labelSize +\n (lines.length - 1) * nodeOptions.labelGap +\n nodeOptions.labelYPadding;\n\n nodeOptions.width = maxSize + nodeOptions.labelXPadding;\n this.cachedNodeLabel[i] = lines;\n } else {\n this.cachedNodeLabel[i] = [];\n }\n }\n\n /** text */\n if (text) {\n if (!options) {\n nodeOptions = nodeIterationExtractor(\n node,\n i,\n this.nodes,\n this,\n this.nodeSettings.options ?? {},\n nodeOptionsGetter,\n );\n const cache = this.nodeOptionsCache[i];\n if (cache) {\n cache.text = nodeOptions.text;\n cache.textVisible = nodeOptions.textVisible;\n }\n }\n if (!nodeOptions.text) {\n this.cachedNodeText[i] = [];\n return;\n }\n this.context.font = `${nodeOptions.textStyle} normal ${nodeOptions.textWeight} ${nodeOptions.textSize}px ${nodeOptions.textFont}`;\n this.context.fillStyle = nodeOptions.textColor;\n this.context.textAlign = nodeOptions.textAlign;\n const { lines } = getTextLines({\n context: this.context,\n maxWidth: nodeOptions.textWidth,\n text: nodeOptions.text,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize: nodeOptions.textSize,\n textStyle: nodeOptions.textStyle,\n textWeight: nodeOptions.textWeight,\n });\n this.cachedNodeText[i] = lines;\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;SASgB,eAAe,GAAA;IAI7B,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE;AAEnB,IAAA,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,KAAK,CAAC;IAClD,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC;IAC/C,IAAI,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC;AAE3C,IAAA,IACE,IAAI,CAAC,YAAY,CAAC,UAAU;QAC5B,IAAI,CAAC,cAAc,KAAK,SAAS;AACjC,QAAA,CAAC,OAAO;AACR,QAAA,CAAC,IAAI;QACL,CAAC,KAAK,EACN;AACA,QAAA,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,cAAc;QACnD,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACvC,YAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC;AACtD,YAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC;AACtD,YAAA,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG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;AACrB,gBAAA,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,EAAE;gBAC3B;;YAEF,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAG,EAAA,WAAW,CAAC,SAAS,CAAW,QAAA,EAAA,WAAW,CAAC,UAAU,CAAA,CAAA,EAAI,WAAW,CAAC,QAAQ,MAAM,WAAW,CAAC,QAAQ,CAAA,CAAE;YACjI,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS;YAC9C,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS;AAC9C,YAAA,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,CAAC;gBAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,WAAW,CAAC,SAAS;gBAC/B,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,QAAQ,EAAE,WAAW,CAAC,QAAQ;gBAC9B,QAAQ,EAAE,WAAW,CAAC,QAAQ;gBAC9B,SAAS,EAAE,WAAW,CAAC,SAAS;gBAChC,UAAU,EAAE,WAAW,CAAC,UAAU;AACnC,aAAA,CAAC;AACF,YAAA,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK;;;AAGpC;;;;"}
|
package/lib/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ interface NodeInterface<NodeData extends Record<string, unknown>> extends Simula
|
|
|
26
26
|
highlight?: boolean;
|
|
27
27
|
visible?: boolean;
|
|
28
28
|
image?: HTMLImageElement;
|
|
29
|
+
_selected?: boolean;
|
|
29
30
|
data?: NodeData;
|
|
30
31
|
}
|
|
31
32
|
type NodeShape = "circle" | "square" | "text";
|
|
@@ -36,6 +37,7 @@ interface LinkInterface<NodeData extends Record<string, unknown>, LinkData exten
|
|
|
36
37
|
data?: LinkData;
|
|
37
38
|
highlight?: boolean;
|
|
38
39
|
visible?: boolean;
|
|
40
|
+
_selected?: boolean;
|
|
39
41
|
_groupIndex?: number;
|
|
40
42
|
_groupSize?: number;
|
|
41
43
|
_self?: boolean;
|
|
@@ -49,14 +51,12 @@ interface LinkInterface<NodeData extends Record<string, unknown>, LinkData exten
|
|
|
49
51
|
_ay?: number;
|
|
50
52
|
}
|
|
51
53
|
type LinkParticle = {
|
|
52
|
-
step: number;
|
|
53
54
|
index: number;
|
|
54
|
-
prev: LinkParticle | undefined;
|
|
55
|
-
next: LinkParticle | undefined;
|
|
56
55
|
x?: number;
|
|
57
56
|
y?: number;
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
_distanceTraveled?: number;
|
|
58
|
+
_lastDistance?: number;
|
|
59
|
+
_lastTime?: number;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
type NodeIterationPropsInterface<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>, Return = number> = (this: GraphCanvas<NodeData, LinkData>, node: NodeInterface<NodeData>, i: number, nodes: NodeInterface<NodeData>[]) => Return;
|
|
@@ -64,6 +64,12 @@ type LinkIterationPropsInterface<NodeData extends Record<string, unknown>, LinkD
|
|
|
64
64
|
type NodeIterationPropsNoThisInterface<NodeData extends Record<string, unknown>, Return = number> = (node: NodeInterface<NodeData>, i: number, nodes: NodeInterface<NodeData>[]) => Return;
|
|
65
65
|
type LinkIterationPropsNoThisInterface<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>, Return = number> = (link: LinkInterface<NodeData, LinkData>, i: number, links: LinkInterface<NodeData, LinkData>[]) => Return;
|
|
66
66
|
|
|
67
|
+
type PrecomputeForceSettingsInterface = {
|
|
68
|
+
precompute?: boolean;
|
|
69
|
+
precomputeMaxTimeMs?: number;
|
|
70
|
+
precomputeMaxTicks?: number;
|
|
71
|
+
precomputeDisableForcesAfter?: boolean;
|
|
72
|
+
};
|
|
67
73
|
type ForceSettingsInterface<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>> = {
|
|
68
74
|
forces?: boolean;
|
|
69
75
|
xForce?: boolean;
|
|
@@ -94,15 +100,21 @@ type ForceSettingsInterface<NodeData extends Record<string, unknown>, LinkData e
|
|
|
94
100
|
xStrength?: NodeIterationPropsNoThisInterface<NodeData> | number;
|
|
95
101
|
yPosition?: NodeIterationPropsNoThisInterface<NodeData> | number;
|
|
96
102
|
yStrength?: NodeIterationPropsNoThisInterface<NodeData> | number;
|
|
97
|
-
};
|
|
103
|
+
} & PrecomputeForceSettingsInterface;
|
|
98
104
|
|
|
99
105
|
declare const FORCE_SETTINGS: Required<ForceSettingsInterface<Record<string, unknown>, Record<string, unknown>>>;
|
|
106
|
+
declare const PERFORMANCE_FORCE_SETTINGS: Required<ForceSettingsInterface<Record<string, unknown>, Record<string, unknown>>>;
|
|
100
107
|
|
|
101
108
|
type GraphSettingsInterface<NodeData extends Record<string, unknown>> = {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
zoomAnimation?: boolean;
|
|
110
|
+
zoomAnimationDuration?: number;
|
|
111
|
+
zoomToNodeScale?: number;
|
|
112
|
+
zoomToFitMargin?: number;
|
|
113
|
+
zoomExtent?: [number, number] | null;
|
|
114
|
+
zoomExtentMargin?: number;
|
|
115
|
+
translateExtent?: [[number?, number?], [number?, number?]] | null;
|
|
116
|
+
translateExtentCoefficient?: number | [number, number] | null;
|
|
117
|
+
translateExtentOverlap?: number;
|
|
106
118
|
zoomInitial?: {
|
|
107
119
|
k?: number;
|
|
108
120
|
x?: number;
|
|
@@ -114,11 +126,11 @@ type GraphSettingsInterface<NodeData extends Record<string, unknown>> = {
|
|
|
114
126
|
};
|
|
115
127
|
|
|
116
128
|
declare const GRAPH_SETTINGS: Required<GraphSettingsInterface<Record<string, unknown>>>;
|
|
129
|
+
declare const PERFORMANCE_GRAPH_SETTINGS: Required<GraphSettingsInterface<Record<string, unknown>>>;
|
|
117
130
|
|
|
118
131
|
type HighlightSettingsInterface = HighlighCommonSettingsInterface & HighlightByNodeForNodeSettingsInterface & HighlightByNodeForLabelSettingsInterface & HighlightByNodeForTextSettingsInterface & HighlightByNodeForLinkSettingsInterface & HighlightByNodeForArrowSettingsInterface & HighlightByLinkForNodeSettingsInterface & HighlightByLinkForTextSettingsInterface & HighlightByLinkForLabelSettingsInterface & HighlightByLinkForLinkSettingsInterface & HighlightByLinkForArrowSettingsInterface;
|
|
119
132
|
type HighlighCommonSettingsInterface = {
|
|
120
|
-
|
|
121
|
-
highlightUpFrames?: number;
|
|
133
|
+
highlightDuration?: number;
|
|
122
134
|
highlightByHoverNode?: boolean;
|
|
123
135
|
highlightByHoverLink?: boolean;
|
|
124
136
|
linkHoverExtraZone?: number;
|
|
@@ -192,15 +204,17 @@ type HighlightByLinkForArrowSettingsInterface = {
|
|
|
192
204
|
};
|
|
193
205
|
|
|
194
206
|
declare const HIGHLIGHT_SETTINGS: Required<HighlightSettingsInterface>;
|
|
207
|
+
declare const PERFORMANCE_HIGHLIGHT_SETTINGS: Required<HighlightSettingsInterface>;
|
|
195
208
|
|
|
196
209
|
type LinkSettingsInterface<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>> = {
|
|
210
|
+
smartCache?: boolean;
|
|
197
211
|
prettyDraw?: boolean;
|
|
198
212
|
curve?: boolean;
|
|
199
213
|
arrow?: boolean;
|
|
200
214
|
arrowByHighlight?: boolean;
|
|
201
215
|
particles?: boolean;
|
|
202
|
-
|
|
203
|
-
|
|
216
|
+
particleCountByDistance?: number;
|
|
217
|
+
particleSpeedByDistance?: number;
|
|
204
218
|
linkScaleSwitch?: number;
|
|
205
219
|
linkWidthBeforeScaleSwitch?: number;
|
|
206
220
|
linkWidthAfterScaleSwitch?: number;
|
|
@@ -228,16 +242,18 @@ type LinkOptionsParticleInterface = {
|
|
|
228
242
|
particleAlpha?: number;
|
|
229
243
|
particleColor?: string;
|
|
230
244
|
particleRadius?: number;
|
|
231
|
-
particleCount?: number;
|
|
232
|
-
particleSteps?: number;
|
|
233
245
|
particleBorderWidth?: number;
|
|
234
246
|
particleBorderColor?: string;
|
|
235
247
|
};
|
|
236
248
|
|
|
237
249
|
declare const LINK_SETTINGS: Omit<Required<LinkSettingsInterface<Record<string, unknown>, Record<string, unknown>>>, "options">;
|
|
238
250
|
declare const LINK_OPTIONS: Omit<Required<LinkOptionsInterface<Record<string, unknown>, Record<string, unknown>>>, "color" | "width" | "drawLink" | "drawExtraLink" | "arrowColor">;
|
|
251
|
+
declare const PERFORMANCE_LINK_SETTINGS: Omit<Required<LinkSettingsInterface<Record<string, unknown>, Record<string, unknown>>>, "options">;
|
|
252
|
+
declare const PERFORMANCE_LINK_OPTIONS: Omit<Required<LinkOptionsInterface<Record<string, unknown>, Record<string, unknown>>>, "color" | "width" | "drawLink" | "drawExtraLink" | "arrowColor">;
|
|
239
253
|
|
|
240
254
|
type NodeSettingsInterface<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>> = {
|
|
255
|
+
smartCache?: boolean;
|
|
256
|
+
textScaleSteps?: number[];
|
|
241
257
|
nodeRadiusFlexible?: boolean;
|
|
242
258
|
nodeRadiusLinkCountForStep?: number;
|
|
243
259
|
nodeRadiusIncrementByStep?: number;
|
|
@@ -309,6 +325,8 @@ type NodeOptionsLabelInterface = {
|
|
|
309
325
|
|
|
310
326
|
declare const NODE_SETTINGS: Omit<Required<NodeSettingsInterface<Record<string, unknown>, Record<string, unknown>>>, "options" | "idGetter">;
|
|
311
327
|
declare const NODE_OPTIONS: Omit<Required<NodeOptionsInterface<Record<string, unknown>, Record<string, unknown>>>, "color" | "text" | "textVisible" | "textSize" | "textShiftY" | "nodeDraw" | "nodeExtraDraw" | "textDraw" | "textExtraDraw">;
|
|
328
|
+
declare const PERFORMANCE_NODE_SETTINGS: Omit<Required<NodeSettingsInterface<Record<string, unknown>, Record<string, unknown>>>, "options" | "idGetter">;
|
|
329
|
+
declare const PERFOMANCE_NODE_OPTIONS: Omit<Required<NodeOptionsInterface<Record<string, unknown>, Record<string, unknown>>>, "color" | "text" | "textVisible" | "textSize" | "textShiftY" | "nodeDraw" | "nodeExtraDraw" | "textDraw" | "textExtraDraw">;
|
|
312
330
|
|
|
313
331
|
declare const GRAPH_CACHE_TYPE: {
|
|
314
332
|
readonly NodeOptions: "nodeOptions";
|
|
@@ -333,6 +351,9 @@ type ListenersInterface<NodeData extends Record<string, unknown>, LinkData exten
|
|
|
333
351
|
onEndDragFinished?: (this: GraphCanvas<NodeData, LinkData>, event: DragEventInterface<NodeData>) => void;
|
|
334
352
|
onDrawFinished?: (this: GraphCanvas<NodeData, LinkData>) => void;
|
|
335
353
|
onSimulationEnd?: (this: GraphCanvas<NodeData, LinkData>) => void;
|
|
354
|
+
onSelectionIn?: (this: GraphCanvas<NodeData, LinkData>, node: NodeInterface<NodeData> | undefined, link: LinkInterface<NodeData, LinkData> | undefined) => void;
|
|
355
|
+
onSelectionOut?: (this: GraphCanvas<NodeData, LinkData>, node: NodeInterface<NodeData> | undefined, link: LinkInterface<NodeData, LinkData> | undefined) => void;
|
|
356
|
+
onSelectionEnd?: (this: GraphCanvas<NodeData, LinkData>, nodes: NodeInterface<NodeData>[], links: LinkInterface<NodeData, LinkData>[]) => void;
|
|
336
357
|
};
|
|
337
358
|
|
|
338
359
|
type GraphCanvasInterface<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>> = {
|
|
@@ -353,7 +374,7 @@ declare class GraphCanvas<NodeData extends Record<string, unknown>, LinkData ext
|
|
|
353
374
|
/** initial data */
|
|
354
375
|
protected nodes: NodeInterface<NodeData>[];
|
|
355
376
|
protected links: LinkInterface<NodeData, LinkData>[];
|
|
356
|
-
protected particles:
|
|
377
|
+
protected particles: (LinkParticle[] | undefined)[];
|
|
357
378
|
protected width: number;
|
|
358
379
|
protected height: number;
|
|
359
380
|
protected root: HTMLElement;
|
|
@@ -370,39 +391,57 @@ declare class GraphCanvas<NodeData extends Record<string, unknown>, LinkData ext
|
|
|
370
391
|
protected context: CanvasRenderingContext2D | null | undefined;
|
|
371
392
|
protected simulation: GraphCanvasSimulation<NodeData, LinkData> | undefined;
|
|
372
393
|
protected areaTransform: ZoomTransform;
|
|
373
|
-
protected
|
|
374
|
-
protected draw: (this: GraphCanvas<NodeData, LinkData
|
|
394
|
+
protected _translateExtent: [[number, number], [number, number]] | undefined;
|
|
395
|
+
protected draw: (this: GraphCanvas<NodeData, LinkData>) => void;
|
|
375
396
|
protected eventAbortController: AbortController;
|
|
376
|
-
protected cachedNodeText:
|
|
377
|
-
protected cachedNodeLabel:
|
|
378
|
-
protected linkOptionsCache:
|
|
379
|
-
protected nodeOptionsCache:
|
|
397
|
+
protected cachedNodeText: (string[] | undefined)[];
|
|
398
|
+
protected cachedNodeLabel: (string[] | undefined)[];
|
|
399
|
+
protected linkOptionsCache: (Required<LinkOptionsInterface<NodeData, LinkData>> | undefined)[];
|
|
400
|
+
protected nodeOptionsCache: (Required<NodeOptionsInterface<NodeData, LinkData>> | undefined)[];
|
|
380
401
|
protected isDragging: boolean;
|
|
381
402
|
protected highlightedNode: NodeInterface<NodeData> | null;
|
|
382
403
|
protected highlightedLink: LinkInterface<NodeData, LinkData> | null;
|
|
383
404
|
protected highlightedNeighbors: Set<string | number> | null;
|
|
384
405
|
protected highlightProgress: number;
|
|
385
|
-
protected
|
|
406
|
+
protected highlightStart: number | null;
|
|
407
|
+
protected highlightPositive: boolean;
|
|
408
|
+
protected highlightController: AbortController | undefined;
|
|
409
|
+
protected _lastNodeZoomK: number | undefined;
|
|
410
|
+
protected _lastLinkZoomK: number | undefined;
|
|
411
|
+
protected _zoomAnimating: boolean;
|
|
412
|
+
protected isSelecting: boolean;
|
|
413
|
+
protected selectionRect: {
|
|
414
|
+
x1: number;
|
|
415
|
+
y1: number;
|
|
416
|
+
x2: number;
|
|
417
|
+
y2: number;
|
|
418
|
+
} | null;
|
|
419
|
+
protected get areaRect(): DOMRect | undefined;
|
|
386
420
|
protected get simulationWorking(): boolean;
|
|
387
421
|
constructor({ links, nodes, root, forceSettings, linkSettings, listeners, nodeSettings, graphSettings, highlightSettings, }: GraphCanvasInterface<NodeData, LinkData>);
|
|
388
422
|
get dpi(): number;
|
|
389
|
-
getData()
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
protected
|
|
404
|
-
protected
|
|
405
|
-
protected
|
|
423
|
+
getData: () => Pick<GraphCanvasInterface<NodeData, LinkData>, "nodes" | "links">;
|
|
424
|
+
fitToView: (margin?: number, duration?: number) => void;
|
|
425
|
+
focusOnNode: (nodeId: string | number, scale?: number, duration?: number) => void;
|
|
426
|
+
changeData: (options: Pick<Partial<GraphCanvasInterface<NodeData, LinkData>>, "links" | "nodes">, alpha?: number, clearCache?: boolean | GraphCanvasCacheKeys[], precompute?: boolean) => void;
|
|
427
|
+
changeSettings: (options: Omit<Partial<GraphCanvasInterface<NodeData, LinkData>>, "links" | "nodes" | "listeners">, clearCache?: boolean | GraphCanvasCacheKeys[], precompute?: boolean) => undefined;
|
|
428
|
+
updateRect: () => void;
|
|
429
|
+
updateSize: () => void;
|
|
430
|
+
clearCache: (keys: boolean | GraphCanvasCacheKeys[]) => void;
|
|
431
|
+
tick: () => void;
|
|
432
|
+
restart: (alpha?: number, options?: Partial<PrecomputeForceSettingsInterface>) => void;
|
|
433
|
+
start: () => void;
|
|
434
|
+
stop: () => void;
|
|
435
|
+
create: () => void;
|
|
436
|
+
destroy: () => void;
|
|
437
|
+
protected getPointerAreaPosition: (event: MouseEvent | TouchEvent) => number[];
|
|
438
|
+
protected clearHTMLElements: () => void;
|
|
439
|
+
protected updateSimulation: (precompute?: boolean) => void;
|
|
440
|
+
protected clearState: () => void;
|
|
441
|
+
protected init: () => void;
|
|
442
|
+
protected updateData: (alpha?: number, clearCache?: boolean | GraphCanvasCacheKeys[], precompute?: boolean) => void;
|
|
443
|
+
protected animateHighlight: (node: NodeInterface<NodeData> | undefined, link: LinkInterface<NodeData, LinkData> | undefined, baseDuration?: number) => void;
|
|
444
|
+
protected animateZoom: (area: HTMLCanvasElement, target: ZoomTransform, start: ZoomTransform, duration: number) => void;
|
|
406
445
|
}
|
|
407
446
|
|
|
408
447
|
declare function forceSettingsGetter<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>>(settings: ForceSettingsInterface<NodeData, LinkData> | undefined, prevSettings?: Required<ForceSettingsInterface<NodeData, LinkData>>): Required<ForceSettingsInterface<NodeData, LinkData>>;
|
|
@@ -451,7 +490,15 @@ declare function nodeIdGetter<NodeData extends Record<string, unknown>>(node: No
|
|
|
451
490
|
|
|
452
491
|
declare function highlightSettingsGetter(settings: HighlightSettingsInterface | undefined, prevSettings?: Required<HighlightSettingsInterface>): Required<HighlightSettingsInterface>;
|
|
453
492
|
|
|
454
|
-
|
|
493
|
+
interface GraphBounds {
|
|
494
|
+
minX: number;
|
|
495
|
+
minY: number;
|
|
496
|
+
maxX: number;
|
|
497
|
+
maxY: number;
|
|
498
|
+
}
|
|
499
|
+
declare function computeGraphBounds<NodeData extends Record<string, unknown>>(nodes: NodeInterface<NodeData>[]): GraphBounds | null;
|
|
500
|
+
|
|
501
|
+
declare function pointerGetter(mouseEvent: MouseEvent | TouchEvent, areaRect: DOMRect | undefined, areaTransform: ZoomTransform): number[];
|
|
455
502
|
|
|
456
503
|
declare function dragPlaceCoefficientGetter<NodeData extends Record<string, unknown>>(node: NodeInterface<NodeData>, pointerX: number, pointerY: number): number | undefined;
|
|
457
504
|
|
|
@@ -461,12 +508,11 @@ declare function linkIterationExtractor<NodeData extends Record<string, unknown>
|
|
|
461
508
|
declare function linkIterationExtractor<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>, Result extends string | number | boolean | Record<string, unknown> | unknown[]>(link: LinkInterface<NodeData, LinkData>, i: number, links: LinkInterface<NodeData, LinkData>[], state: GraphCanvas<NodeData, LinkData>, option: LinkIterationPropsInterface<NodeData, LinkData, Result> | Result, optionConstantGetter: LinkIterationPropsInterface<NodeData, LinkData, Required<Result>> | Required<Result>): Required<Result>;
|
|
462
509
|
|
|
463
510
|
type NodeByPointerGetterOptions<NodeData extends Record<string, unknown>> = {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
areaTransform: ZoomTransform;
|
|
511
|
+
pointerX: number;
|
|
512
|
+
pointerY: number;
|
|
467
513
|
nodes: NodeInterface<NodeData>[];
|
|
468
514
|
};
|
|
469
|
-
declare function nodeByPointerGetter<NodeData extends Record<string, unknown>>({
|
|
515
|
+
declare function nodeByPointerGetter<NodeData extends Record<string, unknown>>({ pointerX, pointerY, nodes, }: NodeByPointerGetterOptions<NodeData>): NodeInterface<NodeData> | undefined;
|
|
470
516
|
|
|
471
517
|
declare function nodeIterationExtractor<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>, Result extends string | number | boolean | Record<string, unknown> | unknown[] | undefined | null>(node: NodeInterface<NodeData>, i: number, nodes: NodeInterface<NodeData>[], state: GraphCanvas<NodeData, LinkData>, option: NodeIterationPropsInterface<NodeData, LinkData, Result> | Result, optionConstantGetter: undefined): Result;
|
|
472
518
|
declare function nodeIterationExtractor<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>, Result extends string | number | boolean | Record<string, unknown> | unknown[] | undefined | null>(node: NodeInterface<NodeData>, i: number, nodes: NodeInterface<NodeData>[], state: GraphCanvas<NodeData, LinkData>, option: NodeIterationPropsInterface<NodeData, LinkData, Result> | Result, optionConstantGetter: NodeIterationPropsInterface<NodeData, LinkData, Result> | Result): Required<Result>;
|
|
@@ -497,21 +543,23 @@ type GetParticlePositionOptions = {
|
|
|
497
543
|
yStart: number;
|
|
498
544
|
xEnd: number;
|
|
499
545
|
yEnd: number;
|
|
500
|
-
|
|
501
|
-
|
|
546
|
+
xControl: number;
|
|
547
|
+
yControl: number;
|
|
502
548
|
distance: number;
|
|
549
|
+
totalCount: number;
|
|
550
|
+
speed: number;
|
|
503
551
|
};
|
|
504
552
|
declare function getParticlePosition(opts: GetParticlePositionOptions): void;
|
|
553
|
+
declare function approximateQuadraticBezierLength(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): number;
|
|
505
554
|
|
|
506
555
|
type LinkByPointerGetterOptions<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>> = {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
areaTransform: ZoomTransform;
|
|
556
|
+
pointerX: number;
|
|
557
|
+
pointerY: number;
|
|
510
558
|
links: LinkInterface<NodeData, LinkData>[];
|
|
511
559
|
linkHoverExtraZone: number;
|
|
512
560
|
curve: boolean;
|
|
513
561
|
};
|
|
514
|
-
declare function linkByPointerGetter<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>>({
|
|
562
|
+
declare function linkByPointerGetter<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>>({ pointerX, pointerY, links, linkHoverExtraZone, curve, }: LinkByPointerGetterOptions<NodeData, LinkData>): LinkInterface<NodeData, LinkData> | undefined;
|
|
515
563
|
|
|
516
564
|
type NodeHighlightOptions<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>> = {
|
|
517
565
|
nodeOptions: Required<NodeOptionsInterface<NodeData, LinkData>>;
|
|
@@ -597,9 +645,11 @@ declare function extractLinkPointIds<NodeData extends Record<string, unknown>, L
|
|
|
597
645
|
targetId: string | number;
|
|
598
646
|
};
|
|
599
647
|
|
|
600
|
-
declare function
|
|
648
|
+
declare function isEmptyObject(obj: Record<string, unknown>): boolean;
|
|
649
|
+
|
|
650
|
+
declare function getDrawLink<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>>(): (this: GraphCanvas<NodeData, LinkData>, link: LinkInterface<NodeData, LinkData>, index: number) => void;
|
|
601
651
|
|
|
602
|
-
declare function getDrawNode<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>>(nodeRenders: (() => void)[], textRenders: (() => void)[]): (this: GraphCanvas<NodeData, LinkData>, node: NodeInterface<NodeData
|
|
652
|
+
declare function getDrawNode<NodeData extends Record<string, unknown>, LinkData extends Record<string, unknown>>(nodeRenders: (() => void)[], textRenders: (() => void)[]): (this: GraphCanvas<NodeData, LinkData>, node: NodeInterface<NodeData>, index: number) => void;
|
|
603
653
|
|
|
604
654
|
type DrawTextOptions = {
|
|
605
655
|
lines: string[];
|
|
@@ -697,5 +747,5 @@ declare const NODE_OPTIONS_NODE_CONTROLS: GraphSettingsInputInterface<keyof Node
|
|
|
697
747
|
declare const NODE_OPTIONS_TEXT_CONTROLS: GraphSettingsInputInterface<keyof NodeOptionsTextInterface>[];
|
|
698
748
|
declare const NODE_OPTIONS_LABEL_CONTROLS: GraphSettingsInputInterface<keyof NodeOptionsLabelInterface>[];
|
|
699
749
|
|
|
700
|
-
export { COMMON_SETTINGS, FORCE_CONTROLS, FORCE_SETTINGS, GRAPH_CACHE_TYPE, GRAPH_SETTINGS, GraphCanvas, HIGHLIGHT_BY_LINK_FOR_ARROW_CONTROLS, HIGHLIGHT_BY_LINK_FOR_LABEL_CONTROLS, HIGHLIGHT_BY_LINK_FOR_LINK_CONTROLS, HIGHLIGHT_BY_LINK_FOR_NODE_CONTROLS, HIGHLIGHT_BY_LINK_FOR_TEXT_CONTROLS, HIGHLIGHT_BY_NODE_FOR_ARROW_CONTROLS, HIGHLIGHT_BY_NODE_FOR_LABEL_CONTROLS, HIGHLIGHT_BY_NODE_FOR_LINK_CONTROLS, HIGHLIGHT_BY_NODE_FOR_NODE_CONTROLS, HIGHLIGHT_BY_NODE_FOR_TEXT_CONTROLS, HIGHLIGHT_COMMON_CONTROLS, HIGHLIGHT_SETTINGS, LINK_OPTIONS, LINK_OPTIONS_ARROW_CONTROLS, LINK_OPTIONS_LINK_CONTROLS, LINK_OPTIONS_PARTICLE_CONTROLS, LINK_SETTINGS, LINK_SETTINGS_CONTROLS, NODE_OPTIONS, NODE_OPTIONS_LABEL_CONTROLS, NODE_OPTIONS_NODE_CONTROLS, NODE_OPTIONS_TEXT_CONTROLS, NODE_SETTINGS, NODE_SETTINGS_CONTROLS, animationByProgress, calculateLinkPositionByNode, colorGetter, colorToRgb, dragPlaceCoefficientGetter, drawText, extractLinkPointIds, extractRgb, fadeRgb, forceSettingsGetter, getDrawLink, getDrawNode, getParticlePosition, graphSettingsGetter, highlightSettingsGetter, isNodeVisible, isOverlapsNode, linkByPointerGetter, linkFade, linkHighlight, linkIterationExtractor, linkOptionsGetter, linkSettingsGetter, listenersGetter, nodeByPointerGetter, nodeFade, nodeHighlight, nodeIdGetter, nodeIterationExtractor, nodeOptionsGetter, nodeRadiusGetter, nodeSettingsGetter, nodeSizeGetter, nodeTextSizeGetter, pointerGetter, rgbAnimationByProgress };
|
|
701
|
-
export type { CachedNodeTextInterface, DragEventInterface, ForceSettingsInterface, GraphCanvasCacheKeys, GraphCanvasInterface, GraphCanvasSimulation, GraphSettingsInputInterface, GraphSettingsInterface, HighlighCommonSettingsInterface, HighlightByLinkForArrowSettingsInterface, HighlightByLinkForLabelSettingsInterface, HighlightByLinkForLinkSettingsInterface, HighlightByLinkForNodeSettingsInterface, HighlightByLinkForTextSettingsInterface, HighlightByNodeForArrowSettingsInterface, HighlightByNodeForLabelSettingsInterface, HighlightByNodeForLinkSettingsInterface, HighlightByNodeForNodeSettingsInterface, HighlightByNodeForTextSettingsInterface, HighlightSettingsInterface, LinkByPointerGetterOptions, LinkInterface, LinkIterationPropsInterface, LinkIterationPropsNoThisInterface, LinkOptionsArrowInterface, LinkOptionsInterface, LinkOptionsLinkInterface, LinkOptionsParticleInterface, LinkParticle, LinkSettingsInterface, ListenersInterface, NodeByPointerGetterOptions, NodeInterface, NodeIterationPropsInterface, NodeIterationPropsNoThisInterface, NodeOptionsInterface, NodeOptionsLabelInterface, NodeOptionsNodeInterface, NodeOptionsTextInterface, NodeRadiusGetterOptions, NodeSettingsInterface, NodeShape, NodeSizeGetterOptions, RGB, TextStyleEnum, ZoomEventInterface };
|
|
750
|
+
export { COMMON_SETTINGS, FORCE_CONTROLS, FORCE_SETTINGS, GRAPH_CACHE_TYPE, GRAPH_SETTINGS, GraphCanvas, HIGHLIGHT_BY_LINK_FOR_ARROW_CONTROLS, HIGHLIGHT_BY_LINK_FOR_LABEL_CONTROLS, HIGHLIGHT_BY_LINK_FOR_LINK_CONTROLS, HIGHLIGHT_BY_LINK_FOR_NODE_CONTROLS, HIGHLIGHT_BY_LINK_FOR_TEXT_CONTROLS, HIGHLIGHT_BY_NODE_FOR_ARROW_CONTROLS, HIGHLIGHT_BY_NODE_FOR_LABEL_CONTROLS, HIGHLIGHT_BY_NODE_FOR_LINK_CONTROLS, HIGHLIGHT_BY_NODE_FOR_NODE_CONTROLS, HIGHLIGHT_BY_NODE_FOR_TEXT_CONTROLS, HIGHLIGHT_COMMON_CONTROLS, HIGHLIGHT_SETTINGS, LINK_OPTIONS, LINK_OPTIONS_ARROW_CONTROLS, LINK_OPTIONS_LINK_CONTROLS, LINK_OPTIONS_PARTICLE_CONTROLS, LINK_SETTINGS, LINK_SETTINGS_CONTROLS, NODE_OPTIONS, NODE_OPTIONS_LABEL_CONTROLS, NODE_OPTIONS_NODE_CONTROLS, NODE_OPTIONS_TEXT_CONTROLS, NODE_SETTINGS, NODE_SETTINGS_CONTROLS, PERFOMANCE_NODE_OPTIONS, PERFORMANCE_FORCE_SETTINGS, PERFORMANCE_GRAPH_SETTINGS, PERFORMANCE_HIGHLIGHT_SETTINGS, PERFORMANCE_LINK_OPTIONS, PERFORMANCE_LINK_SETTINGS, PERFORMANCE_NODE_SETTINGS, animationByProgress, approximateQuadraticBezierLength, calculateLinkPositionByNode, colorGetter, colorToRgb, computeGraphBounds, dragPlaceCoefficientGetter, drawText, extractLinkPointIds, extractRgb, fadeRgb, forceSettingsGetter, getDrawLink, getDrawNode, getParticlePosition, graphSettingsGetter, highlightSettingsGetter, isEmptyObject, isNodeVisible, isOverlapsNode, linkByPointerGetter, linkFade, linkHighlight, linkIterationExtractor, linkOptionsGetter, linkSettingsGetter, listenersGetter, nodeByPointerGetter, nodeFade, nodeHighlight, nodeIdGetter, nodeIterationExtractor, nodeOptionsGetter, nodeRadiusGetter, nodeSettingsGetter, nodeSizeGetter, nodeTextSizeGetter, pointerGetter, rgbAnimationByProgress };
|
|
751
|
+
export type { CachedNodeTextInterface, DragEventInterface, ForceSettingsInterface, GraphBounds, GraphCanvasCacheKeys, GraphCanvasInterface, GraphCanvasSimulation, GraphSettingsInputInterface, GraphSettingsInterface, HighlighCommonSettingsInterface, HighlightByLinkForArrowSettingsInterface, HighlightByLinkForLabelSettingsInterface, HighlightByLinkForLinkSettingsInterface, HighlightByLinkForNodeSettingsInterface, HighlightByLinkForTextSettingsInterface, HighlightByNodeForArrowSettingsInterface, HighlightByNodeForLabelSettingsInterface, HighlightByNodeForLinkSettingsInterface, HighlightByNodeForNodeSettingsInterface, HighlightByNodeForTextSettingsInterface, HighlightSettingsInterface, LinkByPointerGetterOptions, LinkInterface, LinkIterationPropsInterface, LinkIterationPropsNoThisInterface, LinkOptionsArrowInterface, LinkOptionsInterface, LinkOptionsLinkInterface, LinkOptionsParticleInterface, LinkParticle, LinkSettingsInterface, ListenersInterface, NodeByPointerGetterOptions, NodeInterface, NodeIterationPropsInterface, NodeIterationPropsNoThisInterface, NodeOptionsInterface, NodeOptionsLabelInterface, NodeOptionsNodeInterface, NodeOptionsTextInterface, NodeRadiusGetterOptions, NodeSettingsInterface, NodeShape, NodeSizeGetterOptions, PrecomputeForceSettingsInterface, RGB, TextStyleEnum, ZoomEventInterface };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krainovsd/graph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0-beta-7.1",
|
|
4
4
|
"description": "Krainov graph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "KrainovSD <denislosev48@gmail.com>",
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"@vitejs/plugin-vue": "5.2.4",
|
|
63
63
|
"@krainovsd/vue-ui": "0.4.0-beta.23",
|
|
64
64
|
"@krainovsd/vue-icons": "0.1.4",
|
|
65
|
-
"sass-embedded": "1.81.0"
|
|
65
|
+
"sass-embedded": "1.81.0",
|
|
66
|
+
"@fontsource/nunito": "5.2.7"
|
|
66
67
|
},
|
|
67
68
|
"dependencies": {
|
|
68
69
|
"@krainovsd/js-helpers": "^0.16.5",
|