@krainovsd/graph 0.13.0-beta3 → 0.14.0-beta.2

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.
Files changed (68) hide show
  1. package/lib/cjs/index.cjs +772 -466
  2. package/lib/cjs/index.cjs.map +1 -1
  3. package/lib/esm/constants/force-controls.js +4 -2
  4. package/lib/esm/constants/force-controls.js.map +1 -1
  5. package/lib/esm/constants/highlight-controls.js +9 -16
  6. package/lib/esm/constants/highlight-controls.js.map +1 -1
  7. package/lib/esm/constants/link-controls.js +17 -30
  8. package/lib/esm/constants/link-controls.js.map +1 -1
  9. package/lib/esm/constants/node-controls.js +4 -2
  10. package/lib/esm/constants/node-controls.js.map +1 -1
  11. package/lib/esm/index.js +8 -7
  12. package/lib/esm/index.js.map +1 -1
  13. package/lib/esm/module/GraphCanvas/GraphCanvas.js +265 -74
  14. package/lib/esm/module/GraphCanvas/GraphCanvas.js.map +1 -1
  15. package/lib/esm/module/GraphCanvas/constants/force-settings.js +11 -1
  16. package/lib/esm/module/GraphCanvas/constants/force-settings.js.map +1 -1
  17. package/lib/esm/module/GraphCanvas/constants/graph-settings.js +17 -5
  18. package/lib/esm/module/GraphCanvas/constants/graph-settings.js.map +1 -1
  19. package/lib/esm/module/GraphCanvas/constants/highlight-settings.js +5 -3
  20. package/lib/esm/module/GraphCanvas/constants/highlight-settings.js.map +1 -1
  21. package/lib/esm/module/GraphCanvas/constants/index.js +5 -2
  22. package/lib/esm/module/GraphCanvas/constants/index.js.map +1 -1
  23. package/lib/esm/module/GraphCanvas/constants/link-settings.js +19 -10
  24. package/lib/esm/module/GraphCanvas/constants/link-settings.js.map +1 -1
  25. package/lib/esm/module/GraphCanvas/constants/node-settings.js +13 -3
  26. package/lib/esm/module/GraphCanvas/constants/node-settings.js.map +1 -1
  27. package/lib/esm/module/GraphCanvas/lib/settings/force-settings-getter.js +4 -2
  28. package/lib/esm/module/GraphCanvas/lib/settings/force-settings-getter.js.map +1 -1
  29. package/lib/esm/module/GraphCanvas/lib/settings/graph-settings-getter.js +4 -0
  30. package/lib/esm/module/GraphCanvas/lib/settings/graph-settings-getter.js.map +1 -1
  31. package/lib/esm/module/GraphCanvas/lib/settings/highlight-settings-getter.js +4 -2
  32. package/lib/esm/module/GraphCanvas/lib/settings/highlight-settings-getter.js.map +1 -1
  33. package/lib/esm/module/GraphCanvas/lib/settings/link-settings-getter.js +8 -5
  34. package/lib/esm/module/GraphCanvas/lib/settings/link-settings-getter.js.map +1 -1
  35. package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js +14 -2
  36. package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js.map +1 -1
  37. package/lib/esm/module/GraphCanvas/lib/utils/calculate-curve-link-position-by-node.js +5 -2
  38. package/lib/esm/module/GraphCanvas/lib/utils/calculate-curve-link-position-by-node.js.map +1 -1
  39. package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js +5 -2
  40. package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js.map +1 -1
  41. package/lib/esm/module/GraphCanvas/lib/utils/compute-graph-bounds.js +26 -0
  42. package/lib/esm/module/GraphCanvas/lib/utils/compute-graph-bounds.js.map +1 -0
  43. package/lib/esm/module/GraphCanvas/lib/utils/get-particle-position.js +40 -30
  44. package/lib/esm/module/GraphCanvas/lib/utils/get-particle-position.js.map +1 -1
  45. package/lib/esm/module/GraphCanvas/lib/utils/is-empty-object.js +11 -0
  46. package/lib/esm/module/GraphCanvas/lib/utils/is-empty-object.js.map +1 -0
  47. package/lib/esm/module/GraphCanvas/lib/utils/is-node-visible.js +5 -2
  48. package/lib/esm/module/GraphCanvas/lib/utils/is-node-visible.js.map +1 -1
  49. package/lib/esm/module/GraphCanvas/slices/draw-links.js +47 -62
  50. package/lib/esm/module/GraphCanvas/slices/draw-links.js.map +1 -1
  51. package/lib/esm/module/GraphCanvas/slices/draw-nodes.js +9 -4
  52. package/lib/esm/module/GraphCanvas/slices/draw-nodes.js.map +1 -1
  53. package/lib/esm/module/GraphCanvas/slices/init-dnd.js +21 -4
  54. package/lib/esm/module/GraphCanvas/slices/init-dnd.js.map +1 -1
  55. package/lib/esm/module/GraphCanvas/slices/init-draw.js +1 -52
  56. package/lib/esm/module/GraphCanvas/slices/init-draw.js.map +1 -1
  57. package/lib/esm/module/GraphCanvas/slices/init-pointer.js +6 -34
  58. package/lib/esm/module/GraphCanvas/slices/init-pointer.js.map +1 -1
  59. package/lib/esm/module/GraphCanvas/slices/init-simulation.js +12 -2
  60. package/lib/esm/module/GraphCanvas/slices/init-simulation.js.map +1 -1
  61. package/lib/esm/module/GraphCanvas/slices/init-zoom.js +85 -16
  62. package/lib/esm/module/GraphCanvas/slices/init-zoom.js.map +1 -1
  63. package/lib/esm/module/GraphCanvas/slices/update-link-cache.js +33 -3
  64. package/lib/esm/module/GraphCanvas/slices/update-link-cache.js.map +1 -1
  65. package/lib/esm/module/GraphCanvas/slices/update-node-cache.js +61 -16
  66. package/lib/esm/module/GraphCanvas/slices/update-node-cache.js.map +1 -1
  67. package/lib/index.d.ts +85 -46
  68. package/package.json +3 -2
@@ -1,6 +1,7 @@
1
1
  import { isArray } from '@krainovsd/js-helpers';
2
2
  import { forceLink } from 'd3-force';
3
- import { zoomIdentity } from 'd3-zoom';
3
+ import { select } from 'd3-selection';
4
+ import { zoomIdentity, zoom, ZoomTransform } from 'd3-zoom';
4
5
  import { GRAPH_CACHE_TYPE } from './constants/index.js';
5
6
  import { forceSettingsGetter } from './lib/settings/force-settings-getter.js';
6
7
  import { graphSettingsGetter } from './lib/settings/graph-settings-getter.js';
@@ -8,7 +9,9 @@ import { linkSettingsGetter } from './lib/settings/link-settings-getter.js';
8
9
  import { listenersGetter } from './lib/settings/listeners-getter.js';
9
10
  import { nodeSettingsGetter } from './lib/settings/node-settings-getter.js';
10
11
  import { highlightSettingsGetter } from './lib/settings/highlight-settings-getter.js';
12
+ import { computeGraphBounds } from './lib/utils/compute-graph-bounds.js';
11
13
  import 'd3-array';
14
+ import { extractLinkPointIds } from './lib/utils/extract-link-point-ids.js';
12
15
  import { initArea } from './slices/init-area.js';
13
16
  import { initDnd } from './slices/init-dnd.js';
14
17
  import { initDraw } from './slices/init-draw.js';
@@ -23,7 +26,7 @@ class GraphCanvas {
23
26
  /** initial data */
24
27
  nodes;
25
28
  links;
26
- particles = {};
29
+ particles = [];
27
30
  width;
28
31
  height;
29
32
  root;
@@ -40,19 +43,25 @@ class GraphCanvas {
40
43
  context;
41
44
  simulation;
42
45
  areaTransform = zoomIdentity;
46
+ _translateExtent;
43
47
  areaRect;
44
48
  draw;
45
49
  eventAbortController;
46
- cachedNodeText = {};
47
- cachedNodeLabel = {};
48
- linkOptionsCache = {};
49
- nodeOptionsCache = {};
50
+ cachedNodeText = [];
51
+ cachedNodeLabel = [];
52
+ linkOptionsCache = [];
53
+ nodeOptionsCache = [];
50
54
  isDragging = false;
51
55
  highlightedNode = null;
52
56
  highlightedLink = null;
53
57
  highlightedNeighbors = null;
54
58
  highlightProgress = 1;
55
- highlightWorking = false;
59
+ highlightStart = null;
60
+ highlightPositive = false;
61
+ highlightController;
62
+ _lastNodeZoomK;
63
+ _lastLinkZoomK;
64
+ _zoomAnimating = false;
56
65
  get simulationWorking() {
57
66
  const simulationAlpha = this.simulation?.alpha?.() ?? 0;
58
67
  const simulationAlphaMin = this.simulation?.alphaMin?.() ?? 0;
@@ -81,21 +90,72 @@ class GraphCanvas {
81
90
  get dpi() {
82
91
  return devicePixelRatio;
83
92
  }
84
- getData() {
93
+ getData = () => {
85
94
  return {
86
95
  links: this.links,
87
96
  nodes: this.nodes,
88
97
  };
89
- }
90
- changeData(options, alpha = 0.5, clearCache = true) {
98
+ };
99
+ fitToView = (margin = this.graphSettings.zoomToFitMargin, duration = this.graphSettings.zoomAnimationDuration) => {
100
+ const area = this.area;
101
+ if (!area)
102
+ return;
103
+ const bounds = computeGraphBounds(this.nodes);
104
+ if (!bounds)
105
+ return;
106
+ const graphWidth = bounds.maxX - bounds.minX;
107
+ const graphHeight = bounds.maxY - bounds.minY;
108
+ if (graphWidth === 0 || graphHeight === 0)
109
+ return;
110
+ const graphCenterX = bounds.minX + graphWidth / 2;
111
+ const graphCenterY = bounds.minY + graphHeight / 2;
112
+ const scale = (1 - margin) / Math.max(graphWidth / this.width, graphHeight / this.height);
113
+ const clampedScale = Math.min(scale, this.graphSettings.zoomExtent?.[1] ?? scale);
114
+ const target = zoomIdentity
115
+ .translate(this.width / 2, this.height / 2)
116
+ .scale(clampedScale)
117
+ .translate(-graphCenterX, -graphCenterY);
118
+ if (!this.graphSettings.zoomAnimation) {
119
+ this.areaTransform = target;
120
+ zoom().transform(select(area), target);
121
+ this.clearCache(true);
122
+ this.tick();
123
+ return;
124
+ }
125
+ this.animateZoom(area, target, this.areaTransform, duration);
126
+ };
127
+ focusOnNode = (nodeId, scale = this.graphSettings.zoomToNodeScale, duration = this.graphSettings.zoomAnimationDuration) => {
128
+ const area = this.area;
129
+ if (!area)
130
+ return;
131
+ const node = this.nodes.find((n) => n.id === nodeId);
132
+ if (!node)
133
+ return;
134
+ if (node.x == undefined || node.y == undefined)
135
+ return;
136
+ const target = zoomIdentity
137
+ .translate(this.width / 2, this.height / 2)
138
+ .scale(scale)
139
+ .translate(-node.x, -node.y);
140
+ if (!this.graphSettings.zoomAnimation) {
141
+ this.areaTransform = target;
142
+ zoom().transform(select(area), target);
143
+ this.clearCache(true);
144
+ this.tick();
145
+ return;
146
+ }
147
+ this.animateZoom(area, target, this.areaTransform, duration);
148
+ };
149
+ changeData = (options, alpha = 0.5, clearCache = true) => {
91
150
  if (options.links != undefined)
92
151
  this.links = options.links;
93
152
  if (options.nodes != undefined)
94
153
  this.nodes = options.nodes;
95
- if (options.nodes != undefined || options.links != undefined)
154
+ if (options.nodes != undefined || options.links != undefined) {
96
155
  this.updateData(alpha, clearCache);
97
- }
98
- changeSettings(options, clearCache = true) {
156
+ }
157
+ };
158
+ changeSettings = (options, clearCache = true) => {
99
159
  if (options.graphSettings) {
100
160
  this.graphSettings = graphSettingsGetter(options.graphSettings, this.graphSettings);
101
161
  this.draw = initDraw.call(this);
@@ -145,13 +205,13 @@ class GraphCanvas {
145
205
  return void this.updateSimulation();
146
206
  }
147
207
  this.tick();
148
- }
149
- updateRect() {
208
+ };
209
+ updateRect = () => {
150
210
  if (!this.area)
151
211
  return;
152
212
  this.areaRect = this.area.getBoundingClientRect();
153
- }
154
- updateSize() {
213
+ };
214
+ updateSize = () => {
155
215
  if (!this.area)
156
216
  return;
157
217
  const { width, height } = this.root.getBoundingClientRect();
@@ -165,51 +225,96 @@ class GraphCanvas {
165
225
  throw new Error("couldn't create canvas context");
166
226
  this.context.scale(this.dpi, this.dpi);
167
227
  this.draw();
168
- }
169
- clearCache(keys) {
228
+ };
229
+ clearCache = (keys) => {
170
230
  if (keys === true) {
171
- updateNodeCache.call(this, true);
172
- updateLinkCache.call(this);
231
+ this.nodeOptionsCache.length = 0;
232
+ this.linkOptionsCache.length = 0;
233
+ this.cachedNodeLabel.length = 0;
234
+ this.cachedNodeText.length = 0;
173
235
  }
174
236
  else if (isArray(keys)) {
175
- if (keys.some((k) => k === GRAPH_CACHE_TYPE.NodeText ||
176
- k === GRAPH_CACHE_TYPE.NodeLabel ||
177
- k === GRAPH_CACHE_TYPE.NodeOptions)) {
178
- updateNodeCache.call(this, {
179
- label: keys.includes(GRAPH_CACHE_TYPE.NodeLabel),
180
- options: keys.includes(GRAPH_CACHE_TYPE.NodeOptions),
181
- text: keys.includes(GRAPH_CACHE_TYPE.NodeOptions),
182
- });
183
- }
184
- if (keys.includes(GRAPH_CACHE_TYPE.LinkOptions)) {
185
- updateLinkCache.call(this);
237
+ for (const key of keys) {
238
+ switch (key) {
239
+ case GRAPH_CACHE_TYPE.NodeText: {
240
+ this.cachedNodeText.length = 0;
241
+ break;
242
+ }
243
+ case GRAPH_CACHE_TYPE.NodeLabel: {
244
+ this.cachedNodeLabel.length = 0;
245
+ break;
246
+ }
247
+ case GRAPH_CACHE_TYPE.NodeOptions: {
248
+ this.nodeOptionsCache.length = 0;
249
+ break;
250
+ }
251
+ case GRAPH_CACHE_TYPE.LinkOptions: {
252
+ this.linkOptionsCache.length = 0;
253
+ break;
254
+ }
255
+ }
186
256
  }
187
257
  }
188
- }
189
- tick() {
190
- if (!this.simulationWorking && !this.highlightWorking)
258
+ updateNodeCache.call(this);
259
+ updateLinkCache.call(this);
260
+ };
261
+ tick = () => {
262
+ if (!this.simulationWorking)
191
263
  this.draw();
192
- }
193
- restart(alpha) {
194
- if (this.simulation)
264
+ };
265
+ restart = (alpha, options) => {
266
+ if (!this.simulation)
267
+ return;
268
+ const settings = {
269
+ precompute: options?.precompute ?? this.forceSettings.precompute,
270
+ precomputeMaxTimeMs: options?.precomputeMaxTimeMs ?? this.forceSettings?.precomputeMaxTimeMs,
271
+ precomputeMaxTicks: options?.precomputeMaxTicks ?? this.forceSettings?.precomputeMaxTicks ?? 300,
272
+ precomputeDisableForcesAfter: options?.precomputeDisableForcesAfter ??
273
+ this.forceSettings?.precomputeDisableForcesAfter ??
274
+ false,
275
+ };
276
+ if (!settings.precompute) {
195
277
  this.simulation.alpha(alpha ?? 1).restart();
196
- }
197
- start() {
278
+ return;
279
+ }
280
+ if (settings.precomputeDisableForcesAfter) {
281
+ this.forceSettings = forceSettingsGetter({ forces: true }, this.forceSettings);
282
+ }
283
+ initSimulationForces.call(this);
284
+ this.simulation.stop();
285
+ this.simulation.alpha(alpha ?? 1);
286
+ const startTime = performance.now();
287
+ let ticks = 0;
288
+ while (performance.now() - startTime < settings.precomputeMaxTimeMs &&
289
+ ticks < settings.precomputeMaxTicks) {
290
+ this.simulation.tick(1);
291
+ ticks++;
292
+ if (this.simulation.alpha() <= this.simulation.alphaMin())
293
+ break;
294
+ }
295
+ if (settings.precomputeDisableForcesAfter) {
296
+ this.forceSettings = forceSettingsGetter({ forces: false }, this.forceSettings);
297
+ }
298
+ initSimulationForces.call(this);
299
+ this.simulation.restart();
300
+ this.tick();
301
+ };
302
+ start = () => {
198
303
  if (this.simulation)
199
304
  this.simulation.alpha(1).restart();
200
305
  if (this.container)
201
306
  this.container.style.display = "block";
202
- }
203
- stop() {
307
+ };
308
+ stop = () => {
204
309
  if (this.simulation)
205
310
  this.simulation.stop();
206
311
  if (this.container)
207
312
  this.container.style.display = "none";
208
- }
209
- create() {
313
+ };
314
+ create = () => {
210
315
  this.init();
211
- }
212
- destroy() {
316
+ };
317
+ destroy = () => {
213
318
  if (this.simulation) {
214
319
  this.simulation.stop();
215
320
  this.simulation = undefined;
@@ -217,39 +322,51 @@ class GraphCanvas {
217
322
  this.clearHTMLElements();
218
323
  this.clearState();
219
324
  this.clearCache(true);
220
- }
221
- clearHTMLElements() {
325
+ };
326
+ clearHTMLElements = () => {
222
327
  this.root.replaceChildren();
223
328
  this.area = undefined;
224
329
  this.context = undefined;
225
330
  this.container = undefined;
226
331
  this.eventAbortController.abort();
227
332
  this.eventAbortController = new AbortController();
228
- }
229
- updateSimulation() {
333
+ };
334
+ updateSimulation = () => {
230
335
  if (this.simulation) {
231
336
  initSimulationForces.call(this);
232
- this.simulation.alpha(1);
233
- this.simulation.restart();
337
+ this.restart(1);
234
338
  }
235
- }
236
- clearState() {
339
+ };
340
+ clearState = () => {
237
341
  this.isDragging = false;
238
342
  this.highlightedNode = null;
239
343
  this.highlightedLink = null;
240
344
  this.highlightedNeighbors = null;
241
345
  this.highlightProgress = 0;
242
- this.highlightWorking = false;
243
- }
244
- updateData(alpha = 0.5, clearCache = true) {
346
+ this.highlightStart = null;
347
+ this.highlightPositive = false;
348
+ };
349
+ init = () => {
350
+ initArea.call(this);
351
+ updateNodeCache.call(this);
352
+ updateLinkCache.call(this);
353
+ initSimulation.call(this);
354
+ this.restart(1);
355
+ initDnd.call(this);
356
+ initZoom.call(this);
357
+ initResize.call(this);
358
+ initPointer.call(this);
359
+ updateNodeCache.call(this);
360
+ updateLinkCache.call(this);
361
+ this.tick();
362
+ };
363
+ updateData = (alpha = 0.5, clearCache = true) => {
245
364
  if (clearCache) {
246
365
  this.clearCache(clearCache);
247
366
  }
248
367
  if (this.simulation) {
249
368
  initCollideForce.call(this, false);
250
- this.simulation
251
- .nodes(this.nodes)
252
- .force("link", forceLink(this.links)
369
+ this.simulation.nodes(this.nodes).force("link", forceLink(this.links)
253
370
  .id(this.nodeSettings.idGetter.bind(this))
254
371
  .distance(this.forceSettings.forces && this.forceSettings.linkForce
255
372
  ? this.forceSettings.linkDistance
@@ -259,21 +376,95 @@ class GraphCanvas {
259
376
  : 0)
260
377
  .iterations(this.forceSettings.forces && this.forceSettings.linkForce
261
378
  ? this.forceSettings.linkIterations
262
- : 0))
263
- .alpha(alpha)
264
- .restart();
379
+ : 0));
380
+ this.restart(alpha);
381
+ initZoom.call(this, this.areaTransform);
265
382
  }
266
- }
267
- init() {
268
- initArea.call(this);
269
- updateNodeCache.call(this, true);
270
- updateLinkCache.call(this);
271
- initSimulation.call(this);
272
- initDnd.call(this);
273
- initZoom.call(this);
274
- initResize.call(this);
275
- initPointer.call(this);
276
- }
383
+ };
384
+ animateHighlight = (node, link, baseDuration = this.highlightSettings.highlightDuration) => {
385
+ let positive = true;
386
+ if (node && (this.highlightedNode !== node || !this.highlightPositive)) {
387
+ this.highlightedNode = node;
388
+ this.highlightedNeighbors = new Set(node.neighbors);
389
+ this.particles = [];
390
+ this.highlightedLink = null;
391
+ this.highlightStart = performance.now();
392
+ }
393
+ else if (link && (this.highlightedLink !== link || !this.highlightPositive)) {
394
+ const { sourceId, targetId } = extractLinkPointIds(link);
395
+ this.highlightProgress = 0;
396
+ this.highlightedLink = link;
397
+ this.highlightedNeighbors = new Set([sourceId, targetId]);
398
+ this.particles = [];
399
+ this.highlightedNode = null;
400
+ this.highlightStart = performance.now();
401
+ }
402
+ else if (!node && !link && this.highlightPositive) {
403
+ positive = false;
404
+ }
405
+ else {
406
+ return;
407
+ }
408
+ if (this.highlightController) {
409
+ this.highlightController.abort();
410
+ }
411
+ const controller = new AbortController();
412
+ this.highlightPositive = positive;
413
+ this.highlightController = controller;
414
+ const startTime = performance.now();
415
+ const startProgress = this.highlightProgress;
416
+ const targetProgress = positive ? 1 : 0;
417
+ const delta = targetProgress - startProgress;
418
+ const duration = baseDuration * Math.abs(delta);
419
+ const animate = () => {
420
+ if (controller.signal.aborted)
421
+ return;
422
+ const elapsed = performance.now() - startTime;
423
+ const t = Math.min(elapsed / duration, 1);
424
+ const current = startProgress + delta * t;
425
+ const eased = current < 0.5 ? 4 * current * current * current : 1 - (-2 * current + 2) ** 3 / 2;
426
+ this.highlightProgress = eased;
427
+ if (t < 1 || positive) {
428
+ requestAnimationFrame(animate);
429
+ this.draw();
430
+ }
431
+ else {
432
+ this.highlightedNode = null;
433
+ this.highlightedLink = null;
434
+ this.highlightedNeighbors = null;
435
+ this.highlightStart = null;
436
+ this.particles = [];
437
+ this.tick();
438
+ }
439
+ };
440
+ requestAnimationFrame(animate);
441
+ };
442
+ animateZoom = (area, target, start, duration) => {
443
+ this._zoomAnimating = true;
444
+ const startTime = performance.now();
445
+ const animate = () => {
446
+ const elapsed = performance.now() - startTime;
447
+ const t = Math.min(elapsed / duration, 1);
448
+ const eased = t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2;
449
+ const x = start.x + (target.x - start.x) * eased;
450
+ const y = start.y + (target.y - start.y) * eased;
451
+ const k = start.k + (target.k - start.k) * eased;
452
+ this.areaTransform = new ZoomTransform(k, x, y);
453
+ zoom().transform(select(area), this.areaTransform);
454
+ updateLinkCache.call(this);
455
+ updateNodeCache.call(this);
456
+ this.tick();
457
+ if (t < 1) {
458
+ requestAnimationFrame(animate);
459
+ }
460
+ else {
461
+ this._zoomAnimating = false;
462
+ this.clearCache(true);
463
+ this.tick();
464
+ }
465
+ };
466
+ requestAnimationFrame(animate);
467
+ };
277
468
  }
278
469
 
279
470
  export { GraphCanvas };
@@ -1 +1 @@
1
- {"version":3,"file":"GraphCanvas.js","sources":["../../../../src/module/GraphCanvas/GraphCanvas.ts"],"sourcesContent":["import { isArray } from \"@krainovsd/js-helpers\";\nimport { forceLink } from \"d3-force\";\nimport { type ZoomTransform, zoomIdentity } from \"d3-zoom\";\nimport { GRAPH_CACHE_TYPE } from \"./constants\";\nimport {\n forceSettingsGetter,\n graphSettingsGetter,\n highlightSettingsGetter,\n linkSettingsGetter,\n listenersGetter,\n nodeSettingsGetter,\n} from \"./lib\";\nimport {\n initArea,\n initCollideForce,\n initDnd,\n initDraw,\n initPointer,\n initResize,\n initSimulation,\n initSimulationForces,\n initZoom,\n updateLinkCache,\n updateNodeCache,\n} from \"./slices\";\nimport type {\n CachedNodeTextInterface,\n ForceSettingsInterface,\n GraphCanvasCacheKeys,\n GraphCanvasInterface,\n GraphCanvasSimulation,\n GraphSettingsInterface,\n HighlightSettingsInterface,\n LinkInterface,\n LinkOptionsInterface,\n LinkParticle,\n LinkSettingsInterface,\n ListenersInterface,\n NodeInterface,\n NodeOptionsInterface,\n NodeSettingsInterface,\n} from \"./types\";\n\nexport class GraphCanvas<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n> {\n /** initial data */\n\n protected nodes: NodeInterface<NodeData>[];\n\n protected links: LinkInterface<NodeData, LinkData>[];\n\n protected particles: Record<string, LinkParticle[]> = {};\n\n protected width: number;\n\n protected height: number;\n\n protected root: HTMLElement;\n\n protected container: HTMLDivElement | undefined | null;\n\n protected area: HTMLCanvasElement | null | undefined;\n\n /** settings */\n\n protected graphSettings: Required<GraphSettingsInterface<NodeData>>;\n\n protected forceSettings: Required<ForceSettingsInterface<NodeData, LinkData>>;\n\n protected highlightSettings: Required<HighlightSettingsInterface>;\n\n protected nodeSettings: Required<Omit<NodeSettingsInterface<NodeData, LinkData>, \"options\">> &\n Pick<NodeSettingsInterface<NodeData, LinkData>, \"options\">;\n\n protected linkSettings: Required<Omit<LinkSettingsInterface<NodeData, LinkData>, \"options\">> &\n Pick<LinkSettingsInterface<NodeData, LinkData>, \"options\">;\n\n protected listeners: ListenersInterface<NodeData, LinkData>;\n\n /** service */\n\n protected context: CanvasRenderingContext2D | null | undefined;\n\n protected simulation: GraphCanvasSimulation<NodeData, LinkData> | undefined;\n\n protected areaTransform: ZoomTransform = zoomIdentity;\n\n protected areaRect: DOMRect | undefined;\n\n protected draw: (this: GraphCanvas<NodeData, LinkData>, recursive?: boolean) => void;\n\n protected eventAbortController: AbortController;\n\n protected cachedNodeText: CachedNodeTextInterface = {};\n\n protected cachedNodeLabel: CachedNodeTextInterface = {};\n\n protected linkOptionsCache: Record<string, Required<LinkOptionsInterface<NodeData, LinkData>>> =\n {};\n\n protected nodeOptionsCache: Record<string, Required<NodeOptionsInterface<NodeData, LinkData>>> =\n {};\n\n protected isDragging: boolean = false;\n\n protected highlightedNode: NodeInterface<NodeData> | null = null;\n\n protected highlightedLink: LinkInterface<NodeData, LinkData> | null = null;\n\n protected highlightedNeighbors: Set<string | number> | null = null;\n\n protected highlightProgress: number = 1;\n\n protected highlightWorking: boolean = false;\n\n protected get simulationWorking() {\n const simulationAlpha = this.simulation?.alpha?.() ?? 0;\n const simulationAlphaMin = this.simulation?.alphaMin?.() ?? 0;\n const simulationAlphaDecay = this.simulation?.alphaDecay?.() ?? 0;\n const force = (simulationAlpha - simulationAlphaMin) / simulationAlphaDecay;\n\n return force > 0;\n }\n\n constructor({\n links,\n nodes,\n root,\n forceSettings,\n linkSettings,\n listeners,\n nodeSettings,\n graphSettings,\n highlightSettings,\n }: GraphCanvasInterface<NodeData, LinkData>) {\n // root.style.position = \"relative\";\n root.style.overflow = \"hidden\";\n\n this.root = root;\n\n this.forceSettings = forceSettingsGetter(forceSettings);\n this.linkSettings = linkSettingsGetter(linkSettings);\n this.nodeSettings = nodeSettingsGetter(nodeSettings);\n this.listeners = listenersGetter(listeners);\n this.graphSettings = graphSettingsGetter(graphSettings);\n this.highlightSettings = highlightSettingsGetter(highlightSettings);\n\n this.eventAbortController = new AbortController();\n\n this.nodes = nodes;\n this.links = links;\n this.height = 0;\n this.width = 0;\n\n this.draw = initDraw.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initDraw>,\n ReturnType<typeof initDraw>\n >(this);\n\n this.init();\n }\n\n get dpi() {\n return devicePixelRatio;\n }\n\n getData(): Pick<GraphCanvasInterface<NodeData, LinkData>, \"nodes\" | \"links\"> {\n return {\n links: this.links,\n nodes: this.nodes,\n };\n }\n\n changeData(\n options: Pick<Partial<GraphCanvasInterface<NodeData, LinkData>>, \"links\" | \"nodes\">,\n alpha: number = 0.5,\n clearCache: boolean | GraphCanvasCacheKeys[] = true,\n ) {\n if (options.links != undefined) this.links = options.links;\n if (options.nodes != undefined) this.nodes = options.nodes;\n if (options.nodes != undefined || options.links != undefined)\n this.updateData(alpha, clearCache);\n }\n\n changeSettings(\n options: Omit<\n Partial<GraphCanvasInterface<NodeData, LinkData>>,\n \"links\" | \"nodes\" | \"listeners\"\n >,\n clearCache: boolean | GraphCanvasCacheKeys[] = true,\n ) {\n if (options.graphSettings) {\n this.graphSettings = graphSettingsGetter(options.graphSettings, this.graphSettings);\n\n this.draw = initDraw.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initDraw>,\n ReturnType<typeof initDraw>\n >(this);\n initZoom.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initZoom>,\n ReturnType<typeof initZoom>\n >(this, this.areaTransform);\n }\n if (options.forceSettings) {\n this.forceSettings = forceSettingsGetter(options.forceSettings, this.forceSettings);\n }\n if (options.highlightSettings) {\n this.highlightSettings = highlightSettingsGetter(\n options.highlightSettings,\n this.highlightSettings,\n );\n\n if (clearCache === true) {\n this.clearCache([\n GRAPH_CACHE_TYPE.NodeOptions,\n GRAPH_CACHE_TYPE.NodeText,\n GRAPH_CACHE_TYPE.NodeLabel,\n GRAPH_CACHE_TYPE.LinkOptions,\n ]);\n } else {\n this.clearCache(clearCache);\n }\n }\n if (options.linkSettings) {\n this.linkSettings = linkSettingsGetter(options.linkSettings, this.linkSettings);\n\n if (clearCache) {\n this.clearCache([GRAPH_CACHE_TYPE.LinkOptions]);\n } else {\n this.clearCache(clearCache);\n }\n }\n if (options.nodeSettings) {\n this.nodeSettings = nodeSettingsGetter(options.nodeSettings, this.nodeSettings);\n\n if (clearCache) {\n this.clearCache([\n GRAPH_CACHE_TYPE.NodeOptions,\n GRAPH_CACHE_TYPE.NodeText,\n GRAPH_CACHE_TYPE.NodeLabel,\n ]);\n } else {\n this.clearCache(clearCache);\n }\n\n initCollideForce.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initCollideForce>,\n ReturnType<typeof initCollideForce>\n >(this, true);\n }\n\n if (options.forceSettings) {\n return void this.updateSimulation();\n }\n\n this.tick();\n }\n\n updateRect() {\n if (!this.area) return;\n\n this.areaRect = this.area.getBoundingClientRect();\n }\n\n updateSize() {\n if (!this.area) return;\n\n const { width, height } = this.root.getBoundingClientRect();\n this.width = width;\n this.height = height;\n this.area.width = this.dpi * this.width;\n this.area.height = this.dpi * this.height;\n this.areaRect = this.area.getBoundingClientRect();\n\n this.context = this.area.getContext(\"2d\");\n if (!this.context) throw new Error(\"couldn't create canvas context\");\n this.context.scale(this.dpi, this.dpi);\n this.draw();\n }\n\n clearCache(keys: boolean | GraphCanvasCacheKeys[]) {\n if (keys === true) {\n updateNodeCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateNodeCache>,\n ReturnType<typeof updateNodeCache>\n >(this, true);\n updateLinkCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateLinkCache>,\n ReturnType<typeof updateLinkCache>\n >(this);\n } else if (isArray(keys)) {\n if (\n keys.some(\n (k) =>\n k === GRAPH_CACHE_TYPE.NodeText ||\n k === GRAPH_CACHE_TYPE.NodeLabel ||\n k === GRAPH_CACHE_TYPE.NodeOptions,\n )\n ) {\n updateNodeCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateNodeCache>,\n ReturnType<typeof updateNodeCache>\n >(this, {\n label: keys.includes(GRAPH_CACHE_TYPE.NodeLabel),\n options: keys.includes(GRAPH_CACHE_TYPE.NodeOptions),\n text: keys.includes(GRAPH_CACHE_TYPE.NodeOptions),\n });\n }\n\n if (keys.includes(GRAPH_CACHE_TYPE.LinkOptions)) {\n updateLinkCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateLinkCache>,\n ReturnType<typeof updateLinkCache>\n >(this);\n }\n }\n }\n\n tick() {\n if (!this.simulationWorking && !this.highlightWorking) this.draw();\n }\n\n restart(alpha?: number) {\n if (this.simulation) this.simulation.alpha(alpha ?? 1).restart();\n }\n\n start() {\n if (this.simulation) this.simulation.alpha(1).restart();\n if (this.container) this.container.style.display = \"block\";\n }\n\n stop() {\n if (this.simulation) this.simulation.stop();\n if (this.container) this.container.style.display = \"none\";\n }\n\n create() {\n this.init();\n }\n\n destroy() {\n if (this.simulation) {\n this.simulation.stop();\n this.simulation = undefined;\n }\n\n this.clearHTMLElements();\n this.clearState();\n this.clearCache(true);\n }\n\n protected clearHTMLElements() {\n this.root.replaceChildren();\n this.area = undefined;\n this.context = undefined;\n this.container = undefined;\n this.eventAbortController.abort();\n this.eventAbortController = new AbortController();\n }\n\n protected updateSimulation() {\n if (this.simulation) {\n initSimulationForces.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initSimulationForces>,\n ReturnType<typeof initSimulationForces>\n >(this);\n this.simulation.alpha(1);\n this.simulation.restart();\n }\n }\n\n protected clearState() {\n this.isDragging = false;\n this.highlightedNode = null;\n this.highlightedLink = null;\n this.highlightedNeighbors = null;\n this.highlightProgress = 0;\n this.highlightWorking = false;\n }\n\n protected updateData(alpha: number = 0.5, clearCache: boolean | GraphCanvasCacheKeys[] = true) {\n if (clearCache) {\n this.clearCache(clearCache);\n }\n\n if (this.simulation) {\n initCollideForce.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initCollideForce>,\n ReturnType<typeof initCollideForce>\n >(this, false);\n\n this.simulation\n .nodes(this.nodes)\n .force(\n \"link\",\n forceLink<NodeInterface<NodeData>, LinkInterface<NodeData, LinkData>>(this.links)\n .id(this.nodeSettings.idGetter.bind(this))\n .distance(\n this.forceSettings.forces && this.forceSettings.linkForce\n ? this.forceSettings.linkDistance\n : 0,\n )\n .strength(\n this.forceSettings.forces && this.forceSettings.linkForce\n ? this.forceSettings.linkStrength\n : 0,\n )\n .iterations(\n this.forceSettings.forces && this.forceSettings.linkForce\n ? this.forceSettings.linkIterations\n : 0,\n ),\n )\n .alpha(alpha)\n .restart();\n }\n }\n\n protected init() {\n initArea.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initArea>,\n ReturnType<typeof initArea>\n >(this);\n updateNodeCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateNodeCache>,\n ReturnType<typeof updateNodeCache>\n >(this, true);\n updateLinkCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateLinkCache>,\n ReturnType<typeof updateLinkCache>\n >(this);\n initSimulation.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initSimulation>,\n ReturnType<typeof initSimulation>\n >(this);\n initDnd.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initDnd>,\n ReturnType<typeof initDnd>\n >(this);\n initZoom.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initZoom>,\n ReturnType<typeof initZoom>\n >(this);\n initResize.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initResize>,\n ReturnType<typeof initResize>\n >(this);\n initPointer.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initPointer>,\n ReturnType<typeof initPointer>\n >(this);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;MA2Ca,WAAW,CAAA;;AAMZ,IAAA,KAAK;AAEL,IAAA,KAAK;IAEL,SAAS,GAAmC,EAAE;AAE9C,IAAA,KAAK;AAEL,IAAA,MAAM;AAEN,IAAA,IAAI;AAEJ,IAAA,SAAS;AAET,IAAA,IAAI;;AAIJ,IAAA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AO,EAAE;;;IAIN,IAAI,GAAA;AACZ,QAAA,QAAQ,CAAC,IAAI,CAIX,IAAI,CAAC;AACP,QAAA,eAAe,CAAC,IAAI,CAIlB,IAAI,EAAE,IAAI,CAAC;AACb,QAAA,eAAe,CAAC,IAAI,CAIlB,IAAI,CAAC;AACP,QAAA,cAAc,CAAC,IAAI,CAIjB,IAAI,CAAC;AACP,QAAA,OAAO,CAAC,IAAI,CAIV,IAAI,CAAC;AACP,QAAA,QAAQ,CAAC,IAAI,CAIX,IAAI,CAAC;AACP,QAAA,UAAU,CAAC,IAAI,CAIb,IAAI,CAAC;AACP,QAAA,WAAW,CAAC,IAAI,CAId,IAAI,CAAC;;AAEV;;;;"}
1
+ {"version":3,"file":"GraphCanvas.js","sources":["../../../../src/module/GraphCanvas/GraphCanvas.ts"],"sourcesContent":["import { isArray } from \"@krainovsd/js-helpers\";\nimport { forceLink } from \"d3-force\";\nimport { select as d3Select } from \"d3-selection\";\nimport { ZoomTransform, zoom, zoomIdentity } from \"d3-zoom\";\nimport { GRAPH_CACHE_TYPE } from \"./constants\";\nimport {\n computeGraphBounds,\n extractLinkPointIds,\n forceSettingsGetter,\n graphSettingsGetter,\n highlightSettingsGetter,\n linkSettingsGetter,\n listenersGetter,\n nodeSettingsGetter,\n} from \"./lib\";\nimport {\n initArea,\n initCollideForce,\n initDnd,\n initDraw,\n initPointer,\n initResize,\n initSimulation,\n initSimulationForces,\n initZoom,\n updateLinkCache,\n updateNodeCache,\n} from \"./slices\";\nimport type {\n ForceSettingsInterface,\n GraphCanvasCacheKeys,\n GraphCanvasInterface,\n GraphCanvasSimulation,\n GraphSettingsInterface,\n HighlightSettingsInterface,\n LinkInterface,\n LinkOptionsInterface,\n LinkParticle,\n LinkSettingsInterface,\n ListenersInterface,\n NodeInterface,\n NodeOptionsInterface,\n NodeSettingsInterface,\n PrecomputeForceSettingsInterface,\n} from \"./types\";\n\nexport class GraphCanvas<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n> {\n /** initial data */\n\n protected nodes: NodeInterface<NodeData>[];\n\n protected links: LinkInterface<NodeData, LinkData>[];\n\n protected particles: (LinkParticle[] | undefined)[] = [];\n\n protected width: number;\n\n protected height: number;\n\n protected root: HTMLElement;\n\n protected container: HTMLDivElement | undefined | null;\n\n protected area: HTMLCanvasElement | null | undefined;\n\n /** settings */\n\n protected graphSettings: Required<GraphSettingsInterface<NodeData>>;\n\n protected forceSettings: Required<ForceSettingsInterface<NodeData, LinkData>>;\n\n protected highlightSettings: Required<HighlightSettingsInterface>;\n\n protected nodeSettings: Required<Omit<NodeSettingsInterface<NodeData, LinkData>, \"options\">> &\n Pick<NodeSettingsInterface<NodeData, LinkData>, \"options\">;\n\n protected linkSettings: Required<Omit<LinkSettingsInterface<NodeData, LinkData>, \"options\">> &\n Pick<LinkSettingsInterface<NodeData, LinkData>, \"options\">;\n\n protected listeners: ListenersInterface<NodeData, LinkData>;\n\n /** service */\n\n protected context: CanvasRenderingContext2D | null | undefined;\n\n protected simulation: GraphCanvasSimulation<NodeData, LinkData> | undefined;\n\n protected areaTransform: ZoomTransform = zoomIdentity;\n\n protected _translateExtent: [[number, number], [number, number]] | undefined;\n\n protected areaRect: DOMRect | undefined;\n\n protected draw: (this: GraphCanvas<NodeData, LinkData>) => void;\n\n protected eventAbortController: AbortController;\n\n protected cachedNodeText: (string[] | undefined)[] = [];\n\n protected cachedNodeLabel: (string[] | undefined)[] = [];\n\n protected linkOptionsCache: (Required<LinkOptionsInterface<NodeData, LinkData>> | undefined)[] =\n [];\n\n protected nodeOptionsCache: (Required<NodeOptionsInterface<NodeData, LinkData>> | undefined)[] =\n [];\n\n protected isDragging: boolean = false;\n\n protected highlightedNode: NodeInterface<NodeData> | null = null;\n\n protected highlightedLink: LinkInterface<NodeData, LinkData> | null = null;\n\n protected highlightedNeighbors: Set<string | number> | null = null;\n\n protected highlightProgress: number = 1;\n\n protected highlightStart: number | null = null;\n\n protected highlightPositive: boolean = false;\n\n protected highlightController: AbortController | undefined;\n\n protected _lastNodeZoomK: number | undefined;\n\n protected _lastLinkZoomK: number | undefined;\n\n protected _zoomAnimating: boolean = false;\n\n protected get simulationWorking() {\n const simulationAlpha = this.simulation?.alpha?.() ?? 0;\n const simulationAlphaMin = this.simulation?.alphaMin?.() ?? 0;\n const simulationAlphaDecay = this.simulation?.alphaDecay?.() ?? 0;\n const force = (simulationAlpha - simulationAlphaMin) / simulationAlphaDecay;\n\n return force > 0;\n }\n\n constructor({\n links,\n nodes,\n root,\n forceSettings,\n linkSettings,\n listeners,\n nodeSettings,\n graphSettings,\n highlightSettings,\n }: GraphCanvasInterface<NodeData, LinkData>) {\n // root.style.position = \"relative\";\n root.style.overflow = \"hidden\";\n\n this.root = root;\n\n this.forceSettings = forceSettingsGetter(forceSettings);\n this.linkSettings = linkSettingsGetter(linkSettings);\n this.nodeSettings = nodeSettingsGetter(nodeSettings);\n this.listeners = listenersGetter(listeners);\n this.graphSettings = graphSettingsGetter(graphSettings);\n this.highlightSettings = highlightSettingsGetter(highlightSettings);\n\n this.eventAbortController = new AbortController();\n\n this.nodes = nodes;\n this.links = links;\n this.height = 0;\n this.width = 0;\n\n this.draw = initDraw.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initDraw>,\n ReturnType<typeof initDraw>\n >(this);\n\n this.init();\n }\n\n get dpi() {\n return devicePixelRatio;\n }\n\n getData = (): Pick<GraphCanvasInterface<NodeData, LinkData>, \"nodes\" | \"links\"> => {\n return {\n links: this.links,\n nodes: this.nodes,\n };\n };\n\n fitToView = (\n margin: number = this.graphSettings.zoomToFitMargin,\n duration: number = this.graphSettings.zoomAnimationDuration,\n ) => {\n const area = this.area;\n if (!area) return;\n\n const bounds = computeGraphBounds(this.nodes);\n if (!bounds) return;\n\n const graphWidth = bounds.maxX - bounds.minX;\n const graphHeight = bounds.maxY - bounds.minY;\n if (graphWidth === 0 || graphHeight === 0) return;\n const graphCenterX = bounds.minX + graphWidth / 2;\n const graphCenterY = bounds.minY + graphHeight / 2;\n const scale = (1 - margin) / Math.max(graphWidth / this.width, graphHeight / this.height);\n\n const clampedScale = Math.min(scale, this.graphSettings.zoomExtent?.[1] ?? scale);\n const target = zoomIdentity\n .translate(this.width / 2, this.height / 2)\n .scale(clampedScale)\n .translate(-graphCenterX, -graphCenterY);\n if (!this.graphSettings.zoomAnimation) {\n this.areaTransform = target;\n zoom<HTMLCanvasElement, unknown>().transform(d3Select(area), target);\n this.clearCache(true);\n this.tick();\n return;\n }\n this.animateZoom(area, target, this.areaTransform, duration);\n };\n\n focusOnNode = (\n nodeId: string | number,\n scale: number = this.graphSettings.zoomToNodeScale,\n duration: number = this.graphSettings.zoomAnimationDuration,\n ) => {\n const area = this.area;\n if (!area) return;\n\n const node = this.nodes.find((n) => n.id === nodeId);\n if (!node) return;\n if (node.x == undefined || node.y == undefined) return;\n\n const target = zoomIdentity\n .translate(this.width / 2, this.height / 2)\n .scale(scale)\n .translate(-node.x, -node.y);\n if (!this.graphSettings.zoomAnimation) {\n this.areaTransform = target;\n zoom<HTMLCanvasElement, unknown>().transform(d3Select(area), target);\n this.clearCache(true);\n this.tick();\n return;\n }\n this.animateZoom(area, target, this.areaTransform, duration);\n };\n changeData = (\n options: Pick<Partial<GraphCanvasInterface<NodeData, LinkData>>, \"links\" | \"nodes\">,\n alpha: number = 0.5,\n clearCache: boolean | GraphCanvasCacheKeys[] = true,\n ) => {\n if (options.links != undefined) this.links = options.links;\n if (options.nodes != undefined) this.nodes = options.nodes;\n if (options.nodes != undefined || options.links != undefined) {\n this.updateData(alpha, clearCache);\n }\n };\n\n changeSettings = (\n options: Omit<\n Partial<GraphCanvasInterface<NodeData, LinkData>>,\n \"links\" | \"nodes\" | \"listeners\"\n >,\n clearCache: boolean | GraphCanvasCacheKeys[] = true,\n ) => {\n if (options.graphSettings) {\n this.graphSettings = graphSettingsGetter(options.graphSettings, this.graphSettings);\n\n this.draw = initDraw.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initDraw>,\n ReturnType<typeof initDraw>\n >(this);\n initZoom.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initZoom>,\n ReturnType<typeof initZoom>\n >(this, this.areaTransform);\n }\n if (options.forceSettings) {\n this.forceSettings = forceSettingsGetter(options.forceSettings, this.forceSettings);\n }\n if (options.highlightSettings) {\n this.highlightSettings = highlightSettingsGetter(\n options.highlightSettings,\n this.highlightSettings,\n );\n\n if (clearCache === true) {\n this.clearCache([\n GRAPH_CACHE_TYPE.NodeOptions,\n GRAPH_CACHE_TYPE.NodeText,\n GRAPH_CACHE_TYPE.NodeLabel,\n GRAPH_CACHE_TYPE.LinkOptions,\n ]);\n } else {\n this.clearCache(clearCache);\n }\n }\n if (options.linkSettings) {\n this.linkSettings = linkSettingsGetter(options.linkSettings, this.linkSettings);\n\n if (clearCache) {\n this.clearCache([GRAPH_CACHE_TYPE.LinkOptions]);\n } else {\n this.clearCache(clearCache);\n }\n }\n if (options.nodeSettings) {\n this.nodeSettings = nodeSettingsGetter(options.nodeSettings, this.nodeSettings);\n\n if (clearCache) {\n this.clearCache([\n GRAPH_CACHE_TYPE.NodeOptions,\n GRAPH_CACHE_TYPE.NodeText,\n GRAPH_CACHE_TYPE.NodeLabel,\n ]);\n } else {\n this.clearCache(clearCache);\n }\n\n initCollideForce.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initCollideForce>,\n ReturnType<typeof initCollideForce>\n >(this, true);\n }\n\n if (options.forceSettings) {\n return void this.updateSimulation();\n }\n\n this.tick();\n };\n\n updateRect = () => {\n if (!this.area) return;\n\n this.areaRect = this.area.getBoundingClientRect();\n };\n\n updateSize = () => {\n if (!this.area) return;\n\n const { width, height } = this.root.getBoundingClientRect();\n this.width = width;\n this.height = height;\n this.area.width = this.dpi * this.width;\n this.area.height = this.dpi * this.height;\n this.areaRect = this.area.getBoundingClientRect();\n\n this.context = this.area.getContext(\"2d\");\n if (!this.context) throw new Error(\"couldn't create canvas context\");\n this.context.scale(this.dpi, this.dpi);\n this.draw();\n };\n\n clearCache = (keys: boolean | GraphCanvasCacheKeys[]) => {\n if (keys === true) {\n this.nodeOptionsCache.length = 0;\n this.linkOptionsCache.length = 0;\n this.cachedNodeLabel.length = 0;\n this.cachedNodeText.length = 0;\n } else if (isArray(keys)) {\n for (const key of keys) {\n switch (key) {\n case GRAPH_CACHE_TYPE.NodeText: {\n this.cachedNodeText.length = 0;\n break;\n }\n case GRAPH_CACHE_TYPE.NodeLabel: {\n this.cachedNodeLabel.length = 0;\n break;\n }\n case GRAPH_CACHE_TYPE.NodeOptions: {\n this.nodeOptionsCache.length = 0;\n break;\n }\n case GRAPH_CACHE_TYPE.LinkOptions: {\n this.linkOptionsCache.length = 0;\n break;\n }\n default: {\n break;\n }\n }\n }\n }\n\n updateNodeCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateNodeCache>,\n ReturnType<typeof updateNodeCache>\n >(this);\n updateLinkCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateLinkCache>,\n ReturnType<typeof updateLinkCache>\n >(this);\n };\n\n tick = () => {\n if (!this.simulationWorking) this.draw();\n };\n\n restart = (alpha?: number, options?: Partial<PrecomputeForceSettingsInterface>) => {\n if (!this.simulation) return;\n\n const settings: Required<PrecomputeForceSettingsInterface> = {\n precompute: options?.precompute ?? this.forceSettings.precompute,\n precomputeMaxTimeMs: options?.precomputeMaxTimeMs ?? this.forceSettings?.precomputeMaxTimeMs,\n precomputeMaxTicks:\n options?.precomputeMaxTicks ?? this.forceSettings?.precomputeMaxTicks ?? 300,\n precomputeDisableForcesAfter:\n options?.precomputeDisableForcesAfter ??\n this.forceSettings?.precomputeDisableForcesAfter ??\n false,\n };\n if (!settings.precompute) {\n this.simulation.alpha(alpha ?? 1).restart();\n return;\n }\n if (settings.precomputeDisableForcesAfter) {\n this.forceSettings = forceSettingsGetter({ forces: true }, this.forceSettings);\n }\n initSimulationForces.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initSimulationForces>,\n ReturnType<typeof initSimulationForces>\n >(this);\n this.simulation.stop();\n this.simulation.alpha(alpha ?? 1);\n\n const startTime = performance.now();\n let ticks = 0;\n while (\n performance.now() - startTime < settings.precomputeMaxTimeMs &&\n ticks < settings.precomputeMaxTicks\n ) {\n this.simulation.tick(1);\n ticks++;\n if (this.simulation.alpha() <= this.simulation.alphaMin()) break;\n }\n if (settings.precomputeDisableForcesAfter) {\n this.forceSettings = forceSettingsGetter({ forces: false }, this.forceSettings);\n }\n initSimulationForces.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initSimulationForces>,\n ReturnType<typeof initSimulationForces>\n >(this);\n this.simulation.restart();\n this.tick();\n };\n\n start = () => {\n if (this.simulation) this.simulation.alpha(1).restart();\n if (this.container) this.container.style.display = \"block\";\n };\n\n stop = () => {\n if (this.simulation) this.simulation.stop();\n if (this.container) this.container.style.display = \"none\";\n };\n\n create = () => {\n this.init();\n };\n\n destroy = () => {\n if (this.simulation) {\n this.simulation.stop();\n this.simulation = undefined;\n }\n\n this.clearHTMLElements();\n this.clearState();\n this.clearCache(true);\n };\n\n protected clearHTMLElements = () => {\n this.root.replaceChildren();\n this.area = undefined;\n this.context = undefined;\n this.container = undefined;\n this.eventAbortController.abort();\n this.eventAbortController = new AbortController();\n };\n\n protected updateSimulation = () => {\n if (this.simulation) {\n initSimulationForces.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initSimulationForces>,\n ReturnType<typeof initSimulationForces>\n >(this);\n this.restart(1);\n }\n };\n\n protected clearState = () => {\n this.isDragging = false;\n this.highlightedNode = null;\n this.highlightedLink = null;\n this.highlightedNeighbors = null;\n this.highlightProgress = 0;\n this.highlightStart = null;\n this.highlightPositive = false;\n };\n\n protected init = () => {\n initArea.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initArea>,\n ReturnType<typeof initArea>\n >(this);\n updateNodeCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateNodeCache>,\n ReturnType<typeof updateNodeCache>\n >(this);\n updateLinkCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateLinkCache>,\n ReturnType<typeof updateLinkCache>\n >(this);\n initSimulation.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initSimulation>,\n ReturnType<typeof initSimulation>\n >(this);\n this.restart(1);\n initDnd.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initDnd>,\n ReturnType<typeof initDnd>\n >(this);\n initZoom.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initZoom>,\n ReturnType<typeof initZoom>\n >(this);\n initResize.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initResize>,\n ReturnType<typeof initResize>\n >(this);\n initPointer.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initPointer>,\n ReturnType<typeof initPointer>\n >(this);\n updateNodeCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateNodeCache>,\n ReturnType<typeof updateNodeCache>\n >(this);\n updateLinkCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateLinkCache>,\n ReturnType<typeof updateLinkCache>\n >(this);\n this.tick();\n };\n\n protected updateData = (\n alpha: number = 0.5,\n clearCache: boolean | GraphCanvasCacheKeys[] = true,\n ) => {\n if (clearCache) {\n this.clearCache(clearCache);\n }\n\n if (this.simulation) {\n initCollideForce.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initCollideForce>,\n ReturnType<typeof initCollideForce>\n >(this, false);\n\n this.simulation.nodes(this.nodes).force(\n \"link\",\n forceLink<NodeInterface<NodeData>, LinkInterface<NodeData, LinkData>>(this.links)\n .id(this.nodeSettings.idGetter.bind(this))\n .distance(\n this.forceSettings.forces && this.forceSettings.linkForce\n ? this.forceSettings.linkDistance\n : 0,\n )\n .strength(\n this.forceSettings.forces && this.forceSettings.linkForce\n ? this.forceSettings.linkStrength\n : 0,\n )\n .iterations(\n this.forceSettings.forces && this.forceSettings.linkForce\n ? this.forceSettings.linkIterations\n : 0,\n ),\n );\n this.restart(alpha);\n initZoom.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initZoom>,\n ReturnType<typeof initZoom>\n >(this, this.areaTransform);\n }\n };\n\n protected animateHighlight = (\n node: NodeInterface<NodeData> | undefined,\n link: LinkInterface<NodeData, LinkData> | undefined,\n baseDuration: number = this.highlightSettings.highlightDuration,\n ) => {\n let positive = true;\n if (node && (this.highlightedNode !== node || !this.highlightPositive)) {\n this.highlightedNode = node;\n this.highlightedNeighbors = new Set(node.neighbors);\n this.particles = [];\n this.highlightedLink = null;\n this.highlightStart = performance.now();\n } else if (link && (this.highlightedLink !== link || !this.highlightPositive)) {\n const { sourceId, targetId } = extractLinkPointIds(link);\n this.highlightProgress = 0;\n this.highlightedLink = link;\n this.highlightedNeighbors = new Set([sourceId, targetId]);\n this.particles = [];\n this.highlightedNode = null;\n this.highlightStart = performance.now();\n } else if (!node && !link && this.highlightPositive) {\n positive = false;\n } else {\n return;\n }\n if (this.highlightController) {\n this.highlightController.abort();\n }\n const controller = new AbortController();\n this.highlightPositive = positive;\n this.highlightController = controller;\n const startTime = performance.now();\n const startProgress = this.highlightProgress;\n const targetProgress = positive ? 1 : 0;\n const delta = targetProgress - startProgress;\n const duration = baseDuration * Math.abs(delta);\n\n const animate = () => {\n if (controller.signal.aborted) return;\n const elapsed = performance.now() - startTime;\n const t = Math.min(elapsed / duration, 1);\n const current = startProgress + delta * t;\n const eased =\n current < 0.5 ? 4 * current * current * current : 1 - (-2 * current + 2) ** 3 / 2;\n this.highlightProgress = eased;\n\n if (t < 1 || positive) {\n requestAnimationFrame(animate);\n this.draw();\n } else {\n this.highlightedNode = null;\n this.highlightedLink = null;\n this.highlightedNeighbors = null;\n this.highlightStart = null;\n this.particles = [];\n this.tick();\n }\n };\n requestAnimationFrame(animate);\n };\n\n protected animateZoom = (\n area: HTMLCanvasElement,\n target: ZoomTransform,\n start: ZoomTransform,\n duration: number,\n ) => {\n this._zoomAnimating = true;\n const startTime = performance.now();\n const animate = () => {\n const elapsed = performance.now() - startTime;\n const t = Math.min(elapsed / duration, 1);\n const eased = t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2;\n const x = start.x + (target.x - start.x) * eased;\n const y = start.y + (target.y - start.y) * eased;\n const k = start.k + (target.k - start.k) * eased;\n\n this.areaTransform = new ZoomTransform(k, x, y);\n zoom<HTMLCanvasElement, unknown>().transform(d3Select(area), this.areaTransform);\n updateLinkCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateLinkCache>,\n ReturnType<typeof updateLinkCache>\n >(this);\n updateNodeCache.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof updateNodeCache>,\n ReturnType<typeof updateNodeCache>\n >(this);\n this.tick();\n\n if (t < 1) {\n requestAnimationFrame(animate);\n } else {\n this._zoomAnimating = false;\n this.clearCache(true);\n this.tick();\n }\n };\n requestAnimationFrame(animate);\n };\n}\n"],"names":["d3Select"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;MA8Ca,WAAW,CAAA;;AAMZ,IAAA,KAAK;AAEL,IAAA,KAAK;IAEL,SAAS,GAAmC,EAAE;AAE9C,IAAA,KAAK;AAEL,IAAA,MAAM;AAEN,IAAA,IAAI;AAEJ,IAAA,SAAS;AAET,IAAA,IAAI;;AAIJ,IAAA,aAAa;AAEb,IAAA,aAAa;AAEb,IAAA,iBAAiB;AAEjB,IAAA,YAAY;AAGZ,IAAA,YAAY;AAGZ,IAAA,SAAS;;AAIT,IAAA,OAAO;AAEP,IAAA,UAAU;IAEV,aAAa,GAAkB,YAAY;AAE3C,IAAA,gBAAgB;AAEhB,IAAA,QAAQ;AAER,IAAA,IAAI;AAEJ,IAAA,oBAAoB;IAEpB,cAAc,GAA6B,EAAE;IAE7C,eAAe,GAA6B,EAAE;IAE9C,gBAAgB,GACxB,EAAE;IAEM,gBAAgB,GACxB,EAAE;IAEM,UAAU,GAAY,KAAK;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A,IAAI,CAAC,GAAG,CAAC,EAAE;gBACT,qBAAqB,CAAC,OAAO,CAAC;;iBACzB;AACL,gBAAA,IAAI,CAAC,cAAc,GAAG,KAAK;AAC3B,gBAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;gBACrB,IAAI,CAAC,IAAI,EAAE;;AAEf,SAAC;QACD,qBAAqB,CAAC,OAAO,CAAC;AAChC,KAAC;AACF;;;;"}
@@ -6,6 +6,10 @@ const FORCE_SETTINGS = {
6
6
  xForce: true,
7
7
  yForce: true,
8
8
  collideForce: true,
9
+ precompute: true,
10
+ precomputeMaxTicks: 300,
11
+ precomputeMaxTimeMs: 200,
12
+ precomputeDisableForcesAfter: false,
9
13
  centerPosition: {},
10
14
  centerStrength: 1,
11
15
  collideStrength: 0.1,
@@ -23,6 +27,12 @@ const FORCE_SETTINGS = {
23
27
  linkStrength: 1,
24
28
  collideRadius: null,
25
29
  };
30
+ const PERFORMANCE_FORCE_SETTINGS = {
31
+ ...FORCE_SETTINGS,
32
+ collideIterations: 1,
33
+ precomputeMaxTimeMs: 350,
34
+ precomputeDisableForcesAfter: true,
35
+ };
26
36
 
27
- export { FORCE_SETTINGS };
37
+ export { FORCE_SETTINGS, PERFORMANCE_FORCE_SETTINGS };
28
38
  //# sourceMappingURL=force-settings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"force-settings.js","sources":["../../../../../src/module/GraphCanvas/constants/force-settings.ts"],"sourcesContent":["import type { ForceSettingsInterface } from \"../types/force-settings\";\n\nexport const FORCE_SETTINGS: Required<\n ForceSettingsInterface<Record<string, unknown>, Record<string, unknown>>\n> = {\n forces: true,\n centerForce: true,\n chargeForce: true,\n linkForce: true,\n xForce: true,\n yForce: true,\n collideForce: true,\n centerPosition: {},\n centerStrength: 1,\n collideStrength: 0.1,\n collideAdditionalRadius: 4,\n collideIterations: 2,\n collideOffMax: { links: 0, nodes: 0 },\n chargeStrength: -40,\n chargeDistanceMin: 1,\n xPosition: 0,\n xStrength: 0.1,\n yPosition: 0,\n yStrength: 0.1,\n linkDistance: 30,\n linkIterations: 1,\n linkStrength: 1,\n collideRadius: null,\n};\n"],"names":[],"mappings":"AAEa,MAAA,cAAc,GAEvB;AACF,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,YAAY,EAAE,IAAI;AAClB,IAAA,cAAc,EAAE,EAAE;AAClB,IAAA,cAAc,EAAE,CAAC;AACjB,IAAA,eAAe,EAAE,GAAG;AACpB,IAAA,uBAAuB,EAAE,CAAC;AAC1B,IAAA,iBAAiB,EAAE,CAAC;IACpB,aAAa,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;IACrC,cAAc,EAAE,GAAG;AACnB,IAAA,iBAAiB,EAAE,CAAC;AACpB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAAS,EAAE,GAAG;AACd,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAAS,EAAE,GAAG;AACd,IAAA,YAAY,EAAE,EAAE;AAChB,IAAA,cAAc,EAAE,CAAC;AACjB,IAAA,YAAY,EAAE,CAAC;AACf,IAAA,aAAa,EAAE,IAAI;;;;;"}
1
+ {"version":3,"file":"force-settings.js","sources":["../../../../../src/module/GraphCanvas/constants/force-settings.ts"],"sourcesContent":["import type { ForceSettingsInterface } from \"../types/force-settings\";\n\nexport const FORCE_SETTINGS: Required<\n ForceSettingsInterface<Record<string, unknown>, Record<string, unknown>>\n> = {\n forces: true,\n centerForce: true,\n chargeForce: true,\n linkForce: true,\n xForce: true,\n yForce: true,\n collideForce: true,\n precompute: true,\n precomputeMaxTicks: 300,\n precomputeMaxTimeMs: 200,\n precomputeDisableForcesAfter: false,\n centerPosition: {},\n centerStrength: 1,\n collideStrength: 0.1,\n collideAdditionalRadius: 4,\n collideIterations: 2,\n collideOffMax: { links: 0, nodes: 0 },\n chargeStrength: -40,\n chargeDistanceMin: 1,\n xPosition: 0,\n xStrength: 0.1,\n yPosition: 0,\n yStrength: 0.1,\n linkDistance: 30,\n linkIterations: 1,\n linkStrength: 1,\n collideRadius: null,\n};\n\nexport const PERFORMANCE_FORCE_SETTINGS: Required<\n ForceSettingsInterface<Record<string, unknown>, Record<string, unknown>>\n> = {\n ...FORCE_SETTINGS,\n collideIterations: 1,\n precomputeMaxTimeMs: 350,\n precomputeDisableForcesAfter: true,\n};\n"],"names":[],"mappings":"AAEa,MAAA,cAAc,GAEvB;AACF,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,MAAM,EAAE,IAAI;AACZ,IAAA,YAAY,EAAE,IAAI;AAClB,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,kBAAkB,EAAE,GAAG;AACvB,IAAA,mBAAmB,EAAE,GAAG;AACxB,IAAA,4BAA4B,EAAE,KAAK;AACnC,IAAA,cAAc,EAAE,EAAE;AAClB,IAAA,cAAc,EAAE,CAAC;AACjB,IAAA,eAAe,EAAE,GAAG;AACpB,IAAA,uBAAuB,EAAE,CAAC;AAC1B,IAAA,iBAAiB,EAAE,CAAC;IACpB,aAAa,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;IACrC,cAAc,EAAE,GAAG;AACnB,IAAA,iBAAiB,EAAE,CAAC;AACpB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAAS,EAAE,GAAG;AACd,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAAS,EAAE,GAAG;AACd,IAAA,YAAY,EAAE,EAAE;AAChB,IAAA,cAAc,EAAE,CAAC;AACjB,IAAA,YAAY,EAAE,CAAC;AACf,IAAA,aAAa,EAAE,IAAI;;AAGR,MAAA,0BAA0B,GAEnC;AACF,IAAA,GAAG,cAAc;AACjB,IAAA,iBAAiB,EAAE,CAAC;AACpB,IAAA,mBAAmB,EAAE,GAAG;AACxB,IAAA,4BAA4B,EAAE,IAAI;;;;;"}