@plait/graph-viz 0.62.0-next.7 → 0.62.0-next.8
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/esm2022/force-atlas/constants.mjs +11 -5
- package/esm2022/force-atlas/core/node-icon-base.component.mjs +15 -0
- package/esm2022/force-atlas/edge.flavour.mjs +2 -1
- package/esm2022/force-atlas/force-atlas.flavour.mjs +5 -3
- package/esm2022/force-atlas/generators/edge.generator.mjs +2 -1
- package/esm2022/force-atlas/generators/node.generator.mjs +31 -2
- package/esm2022/force-atlas/types.mjs +1 -1
- package/esm2022/force-atlas/utils/draw.mjs +16 -13
- package/esm2022/force-atlas/utils/node.mjs +10 -1
- package/esm2022/force-atlas/with-force-atlas.mjs +3 -2
- package/esm2022/force-atlas/with-node-icon.mjs +8 -0
- package/esm2022/interfaces/element.mjs +1 -1
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/plait-graph-viz.mjs +145 -76
- package/fesm2022/plait-graph-viz.mjs.map +1 -1
- package/force-atlas/constants.d.ts +9 -3
- package/force-atlas/core/node-icon-base.component.d.ts +10 -0
- package/force-atlas/generators/node.generator.d.ts +6 -1
- package/force-atlas/types.d.ts +5 -0
- package/force-atlas/utils/draw.d.ts +1 -0
- package/force-atlas/utils/node.d.ts +5 -0
- package/force-atlas/with-force-atlas.d.ts +1 -1
- package/force-atlas/with-node-icon.d.ts +13 -0
- package/interfaces/element.d.ts +2 -1
- package/package.json +4 -2
- package/public-api.d.ts +2 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cacheSelectedElements, PlaitBoard, normalizePoint, drawCircle, NS, createG, createPath,
|
|
1
|
+
import { cacheSelectedElements, PlaitBoard, normalizePoint, drawCircle, NS, createG, createPath, PlaitElement, PlaitNode, getSelectedElements, RectangleClient, createForeignObject, PlaitPluginKey } from '@plait/core';
|
|
2
2
|
import { CommonElementFlavour, Generator, animate, linear } from '@plait/common';
|
|
3
3
|
import Graph from 'graphology';
|
|
4
4
|
import circular from 'graphology-layout/circular';
|
|
@@ -20,20 +20,26 @@ const DEFAULT_EDGE_STYLES = {
|
|
|
20
20
|
...DEFAULT_STYLES,
|
|
21
21
|
stroke: '#ddd'
|
|
22
22
|
};
|
|
23
|
-
const DEFAULT_NODE_SIZE =
|
|
23
|
+
const DEFAULT_NODE_SIZE = 30;
|
|
24
24
|
const DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER = 1.2;
|
|
25
|
-
const DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER = 1.
|
|
25
|
+
const DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER = 1.5;
|
|
26
26
|
const DEFAULT_NODE_LABEL_MARGIN_TOP = 4;
|
|
27
27
|
const DEFAULT_NODE_LABEL_FONT_SIZE = 12;
|
|
28
28
|
const SECOND_DEPTH_NODE_ALPHA = 0.5;
|
|
29
29
|
const SECOND_DEPTH_LINE_ALPHA = 0.5;
|
|
30
30
|
const ACTIVE_BACKGROUND_NODE_ALPHA = 0.1;
|
|
31
|
+
const NODE_ICON_CLASS_NAME = 'force-atlas-node-icon';
|
|
32
|
+
const ACTIVE_NODE_ICON_CLASS_NAME = 'force-atlas-node-icon-active';
|
|
33
|
+
const NODE_ICON_FONT_SIZE = 16;
|
|
34
|
+
const ACTIVE_NODE_ICON_FONT_SIZE = 18;
|
|
35
|
+
const DEFAULT_NODE_BACKGROUND_COLOR = '#9c9cfb';
|
|
36
|
+
const DEFAULT_NODE_ICON_COLOR = '#fff';
|
|
31
37
|
const DEFAULT_NODE_STYLES = {
|
|
32
38
|
...DEFAULT_STYLES,
|
|
33
|
-
fill:
|
|
39
|
+
fill: DEFAULT_NODE_BACKGROUND_COLOR,
|
|
34
40
|
strokeWidth: 0
|
|
35
41
|
};
|
|
36
|
-
const DEFAULT_NODE_SCALING_RATIO =
|
|
42
|
+
const DEFAULT_NODE_SCALING_RATIO = 20;
|
|
37
43
|
const DEFAULT_LINE_STYLES = {
|
|
38
44
|
color: {
|
|
39
45
|
[EdgeDirection.IN]: '#73D897',
|
|
@@ -76,10 +82,12 @@ class ForceAtlasFlavour extends CommonElementFlavour {
|
|
|
76
82
|
});
|
|
77
83
|
circular.assign(this.graph);
|
|
78
84
|
const settings = forceAtlas2.inferSettings(this.graph);
|
|
85
|
+
settings.strongGravityMode = false;
|
|
86
|
+
settings.linLogMode = true;
|
|
87
|
+
settings.gravity = 2;
|
|
79
88
|
settings.adjustSizes = true;
|
|
80
89
|
settings.scalingRatio = DEFAULT_NODE_SCALING_RATIO;
|
|
81
|
-
|
|
82
|
-
const positions = forceAtlas2(this.graph, { iterations: 500, settings });
|
|
90
|
+
const positions = forceAtlas2(this.graph, { iterations: 1000, settings });
|
|
83
91
|
this.element.children?.forEach(child => {
|
|
84
92
|
if (ForceAtlasElement.isForceAtlasNodeElement(child)) {
|
|
85
93
|
const pos = positions[child.id];
|
|
@@ -301,35 +309,38 @@ function getArrow(x0, y0, x1, y1, options = {}) {
|
|
|
301
309
|
|
|
302
310
|
function drawNode(board, node, point, options) {
|
|
303
311
|
const roughSVG = PlaitBoard.getRoughSVG(board);
|
|
304
|
-
|
|
312
|
+
const nodeStyles = {
|
|
305
313
|
...DEFAULT_NODE_STYLES,
|
|
306
314
|
...(node.styles || {})
|
|
307
315
|
};
|
|
308
316
|
let { x, y } = normalizePoint(point);
|
|
309
|
-
let
|
|
317
|
+
let diameter = node.size ?? DEFAULT_NODE_SIZE;
|
|
310
318
|
if (options.isActive) {
|
|
311
|
-
|
|
319
|
+
diameter = diameter * DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER;
|
|
320
|
+
}
|
|
321
|
+
const nodeG = drawCircle(roughSVG, [x, y], diameter, nodeStyles);
|
|
322
|
+
if (options.iconG) {
|
|
323
|
+
nodeG.append(options.iconG);
|
|
312
324
|
}
|
|
313
|
-
const nodeG = drawCircle(roughSVG, [0, 0], nodeRadius, nodeStyles);
|
|
314
|
-
nodeG.setAttribute('transform', `translate(${x}, ${y})`);
|
|
315
325
|
const text = document.createElementNS(NS, 'text');
|
|
316
326
|
text.textContent = node.label || '';
|
|
317
327
|
text.setAttribute('text-anchor', `middle`);
|
|
318
328
|
text.setAttribute('dominant-baseline', `hanging`);
|
|
319
|
-
text.setAttribute('x', `
|
|
329
|
+
text.setAttribute('x', `${x}`);
|
|
320
330
|
text.setAttribute('font-size', `${DEFAULT_NODE_LABEL_FONT_SIZE}px`);
|
|
331
|
+
text.setAttribute('style', `user-select: none;`);
|
|
321
332
|
if (options.isActive) {
|
|
322
|
-
const
|
|
323
|
-
const waveCircle = drawCircle(roughSVG, [
|
|
333
|
+
const waveDiameter = diameter * DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER;
|
|
334
|
+
const waveCircle = drawCircle(roughSVG, [x, y], waveDiameter, nodeStyles);
|
|
324
335
|
waveCircle.setAttribute('opacity', ACTIVE_BACKGROUND_NODE_ALPHA.toString());
|
|
325
336
|
nodeG.append(waveCircle);
|
|
326
|
-
text.setAttribute('y', `${
|
|
337
|
+
text.setAttribute('y', `${y + waveDiameter / 2 + DEFAULT_NODE_LABEL_MARGIN_TOP}`);
|
|
327
338
|
}
|
|
328
339
|
else {
|
|
329
340
|
if (!options.isFirstDepth) {
|
|
330
341
|
nodeG.setAttribute('opacity', SECOND_DEPTH_NODE_ALPHA.toString());
|
|
331
342
|
}
|
|
332
|
-
text.setAttribute('y', `${
|
|
343
|
+
text.setAttribute('y', `${y + diameter / 2 + DEFAULT_NODE_LABEL_MARGIN_TOP}`);
|
|
333
344
|
}
|
|
334
345
|
nodeG.append(text);
|
|
335
346
|
return nodeG;
|
|
@@ -338,8 +349,8 @@ function drawEdge(startPoint, endPoint, direction, isMutual) {
|
|
|
338
349
|
const arrow = getArrow(startPoint[0], startPoint[1], endPoint[0], endPoint[1], {
|
|
339
350
|
stretch: 0.4,
|
|
340
351
|
flip: direction === EdgeDirection.NONE ? false : isMutual,
|
|
341
|
-
padEnd: DEFAULT_NODE_SIZE /
|
|
342
|
-
padStart: DEFAULT_NODE_SIZE /
|
|
352
|
+
padEnd: DEFAULT_NODE_SIZE / 2,
|
|
353
|
+
padStart: DEFAULT_NODE_SIZE / 2
|
|
343
354
|
});
|
|
344
355
|
const [sx, sy, cx, cy, ex, ey, ae, as, ec] = arrow;
|
|
345
356
|
const g = createG();
|
|
@@ -364,19 +375,6 @@ function drawParticle(board, startPoint, direction) {
|
|
|
364
375
|
return pointG;
|
|
365
376
|
}
|
|
366
377
|
|
|
367
|
-
class ForceAtlasNodeGenerator extends Generator {
|
|
368
|
-
static { this.key = 'force-atlas-node'; }
|
|
369
|
-
constructor(board) {
|
|
370
|
-
super(board);
|
|
371
|
-
}
|
|
372
|
-
canDraw(element) {
|
|
373
|
-
return true;
|
|
374
|
-
}
|
|
375
|
-
draw(element, data) {
|
|
376
|
-
return drawNode(this.board, element, element?.points?.[0] || [0, 0], data);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
378
|
class ForceAtlasEdgeGenerator extends Generator {
|
|
381
379
|
static { this.key = 'force-atlas-edge'; }
|
|
382
380
|
constructor(board) {
|
|
@@ -397,52 +395,11 @@ class ForceAtlasEdgeGenerator extends Generator {
|
|
|
397
395
|
return edgeG;
|
|
398
396
|
}
|
|
399
397
|
destroy() {
|
|
398
|
+
super.destroy();
|
|
400
399
|
this.particleAnimation?.stop();
|
|
401
400
|
}
|
|
402
401
|
}
|
|
403
402
|
|
|
404
|
-
function getNodes(forceAtlasElement, andBack) {
|
|
405
|
-
return forceAtlasElement.children?.filter(f => ForceAtlasElement.isForceAtlasNodeElement(f) && (andBack?.(f) ?? true));
|
|
406
|
-
}
|
|
407
|
-
function getNodeById(id, forceAtlasElement) {
|
|
408
|
-
const node = getNodes(forceAtlasElement, node => node.id === id)?.[0];
|
|
409
|
-
if (!node) {
|
|
410
|
-
throw new Error('can not find node.');
|
|
411
|
-
}
|
|
412
|
-
return node;
|
|
413
|
-
}
|
|
414
|
-
function getIsNodeActive(id, selectElements) {
|
|
415
|
-
return selectElements.some(node => node.id === id);
|
|
416
|
-
}
|
|
417
|
-
function isHitNode(node, point) {
|
|
418
|
-
const { x, y } = normalizePoint(node.points[0]);
|
|
419
|
-
const size = node.size;
|
|
420
|
-
const hitFlowNode = RectangleClient.isHit(RectangleClient.getRectangleByPoints(point), {
|
|
421
|
-
x: x - size / 2,
|
|
422
|
-
y: y - size / 2,
|
|
423
|
-
width: size,
|
|
424
|
-
height: size
|
|
425
|
-
});
|
|
426
|
-
return hitFlowNode;
|
|
427
|
-
}
|
|
428
|
-
function getAssociatedNodesById(id, forceAtlasElement) {
|
|
429
|
-
const edges = getEdgesInSourceOrTarget(id, forceAtlasElement);
|
|
430
|
-
const nodes = [];
|
|
431
|
-
edges.forEach(edge => {
|
|
432
|
-
nodes.push(getNodeById(edge.source, forceAtlasElement));
|
|
433
|
-
nodes.push(getNodeById(edge.target, forceAtlasElement));
|
|
434
|
-
});
|
|
435
|
-
return nodes;
|
|
436
|
-
}
|
|
437
|
-
function getNodeGenerator(node) {
|
|
438
|
-
const edgeRef = PlaitElement.getElementRef(node);
|
|
439
|
-
return edgeRef.getGenerator(ForceAtlasNodeGenerator.key);
|
|
440
|
-
}
|
|
441
|
-
function isFirstDepthNode(currentNodeId, activeNodeId, forceAtlasElement) {
|
|
442
|
-
const edges = getEdges(forceAtlasElement);
|
|
443
|
-
return edges.some(s => (s.source === activeNodeId && s.target === currentNodeId) || (s.target === activeNodeId && s.source === currentNodeId));
|
|
444
|
-
}
|
|
445
|
-
|
|
446
403
|
function getEdges(forceAtlasElement, andCallBack) {
|
|
447
404
|
return forceAtlasElement.children?.filter(f => ForceAtlasElement.isForceAtlasEdgeElement(f) && (andCallBack?.(f) ?? true));
|
|
448
405
|
}
|
|
@@ -509,6 +466,95 @@ function playEdgeParticleAnimate(path, pointG) {
|
|
|
509
466
|
};
|
|
510
467
|
}
|
|
511
468
|
|
|
469
|
+
function getNodes(forceAtlasElement, andBack) {
|
|
470
|
+
return forceAtlasElement.children?.filter(f => ForceAtlasElement.isForceAtlasNodeElement(f) && (andBack?.(f) ?? true));
|
|
471
|
+
}
|
|
472
|
+
function getNodeById(id, forceAtlasElement) {
|
|
473
|
+
const node = getNodes(forceAtlasElement, node => node.id === id)?.[0];
|
|
474
|
+
if (!node) {
|
|
475
|
+
throw new Error('can not find node.');
|
|
476
|
+
}
|
|
477
|
+
return node;
|
|
478
|
+
}
|
|
479
|
+
function getIsNodeActive(id, selectElements) {
|
|
480
|
+
return selectElements.some(node => node.id === id);
|
|
481
|
+
}
|
|
482
|
+
function isHitNode(node, point) {
|
|
483
|
+
const { x, y } = normalizePoint(node.points[0]);
|
|
484
|
+
const size = node.size;
|
|
485
|
+
const hitFlowNode = RectangleClient.isHit(RectangleClient.getRectangleByPoints(point), {
|
|
486
|
+
x: x - size / 2,
|
|
487
|
+
y: y - size / 2,
|
|
488
|
+
width: size,
|
|
489
|
+
height: size
|
|
490
|
+
});
|
|
491
|
+
return hitFlowNode;
|
|
492
|
+
}
|
|
493
|
+
function getAssociatedNodesById(id, forceAtlasElement) {
|
|
494
|
+
const edges = getEdgesInSourceOrTarget(id, forceAtlasElement);
|
|
495
|
+
const nodes = [];
|
|
496
|
+
edges.forEach(edge => {
|
|
497
|
+
nodes.push(getNodeById(edge.source, forceAtlasElement));
|
|
498
|
+
nodes.push(getNodeById(edge.target, forceAtlasElement));
|
|
499
|
+
});
|
|
500
|
+
return nodes;
|
|
501
|
+
}
|
|
502
|
+
function getNodeGenerator(node) {
|
|
503
|
+
const edgeRef = PlaitElement.getElementRef(node);
|
|
504
|
+
return edgeRef.getGenerator(ForceAtlasNodeGenerator.key);
|
|
505
|
+
}
|
|
506
|
+
function isFirstDepthNode(currentNodeId, activeNodeId, forceAtlasElement) {
|
|
507
|
+
const edges = getEdges(forceAtlasElement);
|
|
508
|
+
return edges.some(s => (s.source === activeNodeId && s.target === currentNodeId) || (s.target === activeNodeId && s.source === currentNodeId));
|
|
509
|
+
}
|
|
510
|
+
function getNodeIcon(node) {
|
|
511
|
+
const iconItem = typeof node.icon === 'object' && node.icon.name ? node.icon : null;
|
|
512
|
+
return {
|
|
513
|
+
name: iconItem ? iconItem.name : node.icon,
|
|
514
|
+
fontSize: (iconItem && iconItem.fontSize) || NODE_ICON_FONT_SIZE,
|
|
515
|
+
color: (iconItem && iconItem.color) || DEFAULT_NODE_ICON_COLOR
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
class ForceAtlasNodeGenerator extends Generator {
|
|
520
|
+
static { this.key = 'force-atlas-node'; }
|
|
521
|
+
constructor(board) {
|
|
522
|
+
super(board);
|
|
523
|
+
}
|
|
524
|
+
canDraw(element) {
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
draw(element, data) {
|
|
528
|
+
const iconRef = this.drawIcon(element, data);
|
|
529
|
+
return drawNode(this.board, element, element?.points?.[0] || [0, 0], { ...data, iconG: iconRef.iconG });
|
|
530
|
+
}
|
|
531
|
+
drawIcon(element, data) {
|
|
532
|
+
const iconG = createG();
|
|
533
|
+
let { x, y } = normalizePoint(element.points?.[0] || [0, 0]);
|
|
534
|
+
const size = element.size;
|
|
535
|
+
const foreignObject = createForeignObject(x - size / 2, y - size / 2, size, size);
|
|
536
|
+
iconG.append(foreignObject);
|
|
537
|
+
const container = document.createElement('div');
|
|
538
|
+
container.classList.add(NODE_ICON_CLASS_NAME);
|
|
539
|
+
if (data.isActive) {
|
|
540
|
+
container.classList.add(ACTIVE_NODE_ICON_CLASS_NAME);
|
|
541
|
+
}
|
|
542
|
+
foreignObject.append(container);
|
|
543
|
+
const nodeIcon = getNodeIcon(element);
|
|
544
|
+
const props = {
|
|
545
|
+
iconItem: {
|
|
546
|
+
name: nodeIcon.name,
|
|
547
|
+
fontSize: data.isActive ? ACTIVE_NODE_ICON_FONT_SIZE : nodeIcon.fontSize,
|
|
548
|
+
color: nodeIcon.color
|
|
549
|
+
},
|
|
550
|
+
board: this.board,
|
|
551
|
+
element: element
|
|
552
|
+
};
|
|
553
|
+
const ref = this.board.renderNodeIcon(container, props);
|
|
554
|
+
return { ref, iconG };
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
512
558
|
class ForceAtlasNodeFlavour extends CommonElementFlavour {
|
|
513
559
|
constructor() {
|
|
514
560
|
super();
|
|
@@ -576,9 +622,18 @@ class ForceAtlasEdgeFlavour extends CommonElementFlavour {
|
|
|
576
622
|
updateText(previousElement, currentElement) { }
|
|
577
623
|
destroy() {
|
|
578
624
|
super.destroy();
|
|
625
|
+
this.edgeGenerator.destroy();
|
|
579
626
|
}
|
|
580
627
|
}
|
|
581
628
|
|
|
629
|
+
const withNodeIcon = (board) => {
|
|
630
|
+
const newBoard = board;
|
|
631
|
+
newBoard.renderNodeIcon = (container, props) => {
|
|
632
|
+
throw new Error('No implementation for renderLabeIcon method.');
|
|
633
|
+
};
|
|
634
|
+
return newBoard;
|
|
635
|
+
};
|
|
636
|
+
|
|
582
637
|
const withForceAtlas = (board) => {
|
|
583
638
|
const { drawElement, getRectangle, isRectangleHit, isHit, isInsidePoint, isMovable, isAlign, getRelatedFragment } = board;
|
|
584
639
|
board.drawElement = (context) => {
|
|
@@ -640,9 +695,23 @@ const withForceAtlas = (board) => {
|
|
|
640
695
|
return isMovable(element);
|
|
641
696
|
};
|
|
642
697
|
board.setPluginOptions(PlaitPluginKey.withSelection, { isMultiple: false });
|
|
643
|
-
return board;
|
|
698
|
+
return withNodeIcon(board);
|
|
644
699
|
};
|
|
645
700
|
|
|
701
|
+
class ForceAtlasNodeIconBaseComponent {
|
|
702
|
+
initialize() {
|
|
703
|
+
if (!this.iconItem.fontSize) {
|
|
704
|
+
this.iconItem.fontSize = NODE_ICON_FONT_SIZE;
|
|
705
|
+
}
|
|
706
|
+
if (!this.iconItem.color) {
|
|
707
|
+
this.iconItem.color = DEFAULT_NODE_ICON_COLOR;
|
|
708
|
+
}
|
|
709
|
+
this.nativeElement().style.fontSize = `${this.iconItem.fontSize}px`;
|
|
710
|
+
this.nativeElement().style.color = `${this.iconItem.color}`;
|
|
711
|
+
this.nativeElement().classList.add(NODE_ICON_CLASS_NAME);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
646
715
|
/*
|
|
647
716
|
* Public API Surface of utils
|
|
648
717
|
*/
|
|
@@ -651,5 +720,5 @@ const withForceAtlas = (board) => {
|
|
|
651
720
|
* Generated bundle index. Do not edit.
|
|
652
721
|
*/
|
|
653
722
|
|
|
654
|
-
export { ACTIVE_BACKGROUND_NODE_ALPHA, DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER, DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER, DEFAULT_EDGE_STYLES, DEFAULT_LINE_STYLES, DEFAULT_NODE_LABEL_FONT_SIZE, DEFAULT_NODE_LABEL_MARGIN_TOP, DEFAULT_NODE_SCALING_RATIO, DEFAULT_NODE_SIZE, DEFAULT_NODE_STYLES, EdgeDirection, ForceAtlasElement, SECOND_DEPTH_LINE_ALPHA, SECOND_DEPTH_NODE_ALPHA, withForceAtlas };
|
|
723
|
+
export { ACTIVE_BACKGROUND_NODE_ALPHA, ACTIVE_NODE_ICON_CLASS_NAME, ACTIVE_NODE_ICON_FONT_SIZE, DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER, DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER, DEFAULT_EDGE_STYLES, DEFAULT_LINE_STYLES, DEFAULT_NODE_BACKGROUND_COLOR, DEFAULT_NODE_ICON_COLOR, DEFAULT_NODE_LABEL_FONT_SIZE, DEFAULT_NODE_LABEL_MARGIN_TOP, DEFAULT_NODE_SCALING_RATIO, DEFAULT_NODE_SIZE, DEFAULT_NODE_STYLES, EdgeDirection, ForceAtlasElement, ForceAtlasNodeIconBaseComponent, NODE_ICON_CLASS_NAME, NODE_ICON_FONT_SIZE, SECOND_DEPTH_LINE_ALPHA, SECOND_DEPTH_NODE_ALPHA, withForceAtlas, withNodeIcon };
|
|
655
724
|
//# sourceMappingURL=plait-graph-viz.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plait-graph-viz.mjs","sources":["../../../packages/graph-viz/src/constants/default.ts","../../../packages/graph-viz/src/force-atlas/types.ts","../../../packages/graph-viz/src/force-atlas/constants.ts","../../../packages/graph-viz/src/interfaces/element.ts","../../../packages/graph-viz/src/force-atlas/force-atlas.flavour.ts","../../../packages/graph-viz/src/perfect-arrows/utils.ts","../../../packages/graph-viz/src/perfect-arrows/get-arrow.ts","../../../packages/graph-viz/src/force-atlas/utils/draw.ts","../../../packages/graph-viz/src/force-atlas/generators/node.generator.ts","../../../packages/graph-viz/src/force-atlas/generators/edge.generator.ts","../../../packages/graph-viz/src/force-atlas/utils/node.ts","../../../packages/graph-viz/src/force-atlas/utils/edge.ts","../../../packages/graph-viz/src/force-atlas/node.flavour.ts","../../../packages/graph-viz/src/force-atlas/edge.flavour.ts","../../../packages/graph-viz/src/force-atlas/with-force-atlas.ts","../../../packages/graph-viz/src/public-api.ts","../../../packages/graph-viz/src/plait-graph-viz.ts"],"sourcesContent":["import { Options } from 'roughjs/bin/core';\n\nexport const DEFAULT_STYLES: Options = {\n fillStyle: 'solid',\n strokeWidth: 1\n};\n","import { GeneratorExtraData } from '@plait/common';\nimport { Point } from '@plait/core';\n\nexport enum EdgeDirection {\n IN,\n OUT,\n NONE\n}\n\nexport interface NodeStyles {\n stroke?: string;\n strokeWidth?: number;\n fill?: string;\n fillStyle?: string;\n activeStroke?: string;\n activeFill?: string;\n borderRadius?: number;\n hoverStroke?: string;\n}\n\nexport interface EdgeGeneratorData extends GeneratorExtraData {\n startPoint: Point;\n endPoint: Point;\n isSourceActive: boolean;\n isTargetActive: boolean;\n direction: EdgeDirection;\n}\n\nexport interface NodeGeneratorData extends GeneratorExtraData {\n isActive: boolean;\n isFirstDepth: boolean;\n}\n","import { Options } from 'roughjs/bin/core';\nimport { DEFAULT_STYLES } from '../constants/default';\nimport { EdgeDirection } from './types';\n\nexport const DEFAULT_EDGE_STYLES: Options = {\n ...DEFAULT_STYLES,\n stroke: '#ddd'\n};\n\nexport const DEFAULT_NODE_SIZE = 60;\nexport const DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER = 1.2;\nexport const DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER = 1.6;\nexport const DEFAULT_NODE_LABEL_MARGIN_TOP = 4;\nexport const DEFAULT_NODE_LABEL_FONT_SIZE = 12;\n\nexport const SECOND_DEPTH_NODE_ALPHA = 0.5;\nexport const SECOND_DEPTH_LINE_ALPHA = 0.5;\nexport const ACTIVE_BACKGROUND_NODE_ALPHA = 0.1;\n\nexport const DEFAULT_NODE_STYLES: Options = {\n ...DEFAULT_STYLES,\n fill: '#6698FF',\n strokeWidth: 0\n};\n\nexport const DEFAULT_NODE_SCALING_RATIO = 600;\n\nexport const DEFAULT_LINE_STYLES = {\n color: {\n [EdgeDirection.IN]: '#73D897',\n [EdgeDirection.OUT]: '#6698FF',\n [EdgeDirection.NONE]: `#ddd`\n }\n};\n","import { PlaitElement } from '@plait/core';\nexport interface ForceAtlasNodeElement extends PlaitElement {\n label: string;\n icon: string;\n size?: number;\n isActive?: boolean;\n}\n\nexport interface ForceAtlasEdgeElement extends PlaitElement {\n source: string;\n target: string;\n}\n\nexport interface ForceAtlasElement extends PlaitElement {\n children: (ForceAtlasNodeElement | ForceAtlasEdgeElement)[];\n}\n\nexport const ForceAtlasElement = {\n isForceAtlas: (value: any) => {\n return value?.type === 'force-atlas';\n },\n isForceAtlasNodeElement: (value: any): value is ForceAtlasNodeElement => {\n return value && value.label && value.icon;\n },\n isForceAtlasEdgeElement: (value: any): value is ForceAtlasEdgeElement => {\n return value && value.source && value.target;\n }\n};\n","import { CommonElementFlavour } from '@plait/common';\nimport { OnContextChanged, PlaitBoard, PlaitPluginElementContext, cacheSelectedElements } from '@plait/core';\nimport Graph from 'graphology';\nimport circular from 'graphology-layout/circular';\nimport forceAtlas2 from 'graphology-layout-forceatlas2';\nimport { ForceAtlasElement, ForceAtlasNodeElement } from '../interfaces';\nimport { DEFAULT_NODE_SCALING_RATIO, DEFAULT_NODE_SIZE } from './constants';\n\nexport class ForceAtlasFlavour extends CommonElementFlavour<ForceAtlasElement, PlaitBoard>\n implements OnContextChanged<ForceAtlasElement, PlaitBoard> {\n graph!: Graph<ForceAtlasNodeElement>;\n\n constructor() {\n super();\n }\n\n initializeGraph() {\n this.graph = new Graph<ForceAtlasNodeElement>();\n this.element.children?.forEach(child => {\n if (ForceAtlasElement.isForceAtlasNodeElement(child)) {\n if (typeof child?.size === 'undefined') {\n child.size = DEFAULT_NODE_SIZE;\n }\n if (child.isActive) {\n cacheSelectedElements(this.board, [child]);\n }\n this.graph.addNode(child.id, child);\n } else if (ForceAtlasElement.isForceAtlasEdgeElement(child)) {\n this.graph.addEdge(child.source, child.target);\n }\n });\n circular.assign(this.graph);\n const settings = forceAtlas2.inferSettings(this.graph);\n settings.adjustSizes = true;\n settings.scalingRatio = DEFAULT_NODE_SCALING_RATIO;\n settings.barnesHutOptimize = true;\n const positions = forceAtlas2(this.graph, { iterations: 500, settings });\n this.element.children?.forEach(child => {\n if (ForceAtlasElement.isForceAtlasNodeElement(child)) {\n const pos = positions[child.id];\n child.points = [[pos.x, pos.y]];\n }\n });\n }\n\n initialize(): void {\n super.initialize();\n this.initializeGraph();\n }\n\n onContextChanged(\n value: PlaitPluginElementContext<ForceAtlasElement, PlaitBoard>,\n previous: PlaitPluginElementContext<ForceAtlasElement, PlaitBoard>\n ) {}\n\n updateText(previousElement: ForceAtlasElement, currentElement: ForceAtlasElement) {}\n\n destroy(): void {\n super.destroy();\n }\n}\n","// Credits to perfect-arrows\n// https://github.com/steveruizok/perfect-arrows/blob/master/src/lib/utils.ts\n\nconst PI = Math.PI;\n\n/**\n * Modulate a value between two ranges.\n * @param value\n * @param rangeA from [low, high]\n * @param rangeB to [low, high]\n * @param clamp\n */\nexport function modulate(value: number, rangeA: number[], rangeB: number[], clamp = false) {\n const [fromLow, fromHigh] = rangeA;\n const [toLow, toHigh] = rangeB;\n const result = toLow + ((value - fromLow) / (fromHigh - fromLow)) * (toHigh - toLow);\n if (clamp === true) {\n if (toLow < toHigh) {\n if (result < toLow) {\n return toLow;\n }\n if (result > toHigh) {\n return toHigh;\n }\n } else {\n if (result > toLow) {\n return toLow;\n }\n if (result < toHigh) {\n return toHigh;\n }\n }\n }\n return result;\n}\n\n/**\n * Rotate a point around a center.\n * @param x The x-axis coordinate of the point.\n * @param y The y-axis coordinate of the point.\n * @param cx The x-axis coordinate of the point to rotate round.\n * @param cy The y-axis coordinate of the point to rotate round.\n * @param angle The distance (in radians) to rotate.\n */\nexport function rotatePoint(x: number, y: number, cx: number, cy: number, angle: number) {\n const s = Math.sin(angle);\n const c = Math.cos(angle);\n\n const px = x - cx;\n const py = y - cy;\n\n const nx = px * c - py * s;\n const ny = px * s + py * c;\n\n return [nx + cx, ny + cy];\n}\n\n/**\n * Get the distance between two points.\n * @param x0 The x-axis coordinate of the first point.\n * @param y0 The y-axis coordinate of the first point.\n * @param x1 The x-axis coordinate of the second point.\n * @param y1 The y-axis coordinate of the second point.\n */\nexport function getDistance(x0: number, y0: number, x1: number, y1: number) {\n return Math.hypot(y1 - y0, x1 - x0);\n}\n\n/**\n * Get an angle (radians) between two points.\n * @param x0 The x-axis coordinate of the first point.\n * @param y0 The y-axis coordinate of the first point.\n * @param x1 The x-axis coordinate of the second point.\n * @param y1 The y-axis coordinate of the second point.\n */\nexport function getAngle(x0: number, y0: number, x1: number, y1: number) {\n return Math.atan2(y1 - y0, x1 - x0);\n}\n\n/**\n * Move a point in an angle by a distance.\n * @param x0\n * @param y0\n * @param a angle (radians)\n * @param d distance\n */\nexport function projectPoint(x0: number, y0: number, a: number, d: number) {\n return [Math.cos(a) * d + x0, Math.sin(a) * d + y0];\n}\n\n/**\n * Get a point between two points.\n * @param x0 The x-axis coordinate of the first point.\n * @param y0 The y-axis coordinate of the first point.\n * @param x1 The x-axis coordinate of the second point.\n * @param y1 The y-axis coordinate of the second point.\n * @param d Normalized\n */\nexport function getPointBetween(x0: number, y0: number, x1: number, y1: number, d = 0.5) {\n return [x0 + (x1 - x0) * d, y0 + (y1 - y0) * d];\n}\n\n/**\n * Get the sector of an angle (e.g. quadrant, octant)\n * @param a The angle to check.\n * @param s The number of sectors to check.\n */\nexport function getSector(a: number, s = 8) {\n return Math.floor(s * (0.5 + ((a / (PI * 2)) % s)));\n}\n\n/**\n * Get a normal value representing how close two points are from being at a 45 degree angle.\n * @param x0 The x-axis coordinate of the first point.\n * @param y0 The y-axis coordinate of the first point.\n * @param x1 The x-axis coordinate of the second point.\n * @param y1 The y-axis coordinate of the second point.\n */\nexport function getAngliness(x0: number, y0: number, x1: number, y1: number) {\n return Math.abs((x1 - x0) / 2 / ((y1 - y0) / 2));\n}\n","// Credits to perfect-arrows\n// https://github.com/steveruizok/perfect-arrows/blob/master/src/lib/getArrow.ts\n\nimport { getAngle, getDistance, getAngliness, projectPoint, getPointBetween, getSector, rotatePoint, modulate } from './utils';\n\nexport type ArrowOptions = {\n bow?: number;\n stretchMin?: number;\n stretchMax?: number;\n stretch?: number;\n padStart?: number;\n padEnd?: number;\n flip?: boolean;\n straights?: boolean;\n};\n\n/**\n * getArrow\n * Get the points for a linking line between two points.\n * @description Draw an arrow between two points.\n * @param x0 The x position of the \"from\" point.\n * @param y0 The y position of the \"from\" point.\n * @param x1 The x position of the \"to\" point.\n * @param y1 The y position of the \"to\" point.\n * @param options Additional options for computing the line.\n * @returns [sx, sy, cx, cy, e1, e2, ae, as, ac]\n * @example\n * const arrow = getArrow(0, 0, 100, 200, {\n bow: 0\n stretch: .5\n stretchMin: 0\n stretchMax: 420\n padStart: 0\n padEnd: 0\n flip: false\n straights: true\n * })\n * \n * const [\n * startX, startY, \n * controlX, controlY, \n * endX, endY, \n * endAngle, \n * startAngle,\n * controlAngle\n * ] = arrow\n */\nexport default function getArrow(x0: number, y0: number, x1: number, y1: number, options: ArrowOptions = {} as ArrowOptions): number[] {\n const { bow = 0, stretch = 0.5, stretchMin = 0, stretchMax = 420, padStart = 0, padEnd = 0, flip = false, straights = true } = options;\n\n const angle = getAngle(x0, y0, x1, y1);\n const dist = getDistance(x0, y0, x1, y1);\n const angliness = getAngliness(x0, y0, x1, y1);\n\n // Step 0 ⤜⤏ Should the arrow be straight?\n\n if (\n dist < (padStart + padEnd) * 2 || // Too short\n (bow === 0 && stretch === 0) || // No bow, no stretch\n (straights && [0, 1, Infinity].includes(angliness)) // 45 degree angle\n ) {\n // ⤜⤏ Arrow is straight! Just pad start and end points.\n\n // Padding distances\n const ps = Math.max(0, Math.min(dist - padStart, padStart));\n const pe = Math.max(0, Math.min(dist - ps, padEnd));\n\n // Move start point toward end point\n let [px0, py0] = projectPoint(x0, y0, angle, ps);\n\n // Move end point toward start point\n let [px1, py1] = projectPoint(x1, y1, angle + Math.PI, pe);\n\n // Get midpoint between new points\n const [mx, my] = getPointBetween(px0, py0, px1, py1, 0.5);\n\n return [px0, py0, mx, my, px1, py1, angle, angle, angle];\n }\n\n // ⤜⤏ Arrow is an arc!\n\n // Is the arc clockwise or counterclockwise?\n let rot = (getSector(angle) % 2 === 0 ? 1 : -1) * (flip ? -1 : 1);\n\n // Calculate how much the line should \"bow\" away from center\n const arc = bow + modulate(dist, [stretchMin, stretchMax], [1, 0], true) * stretch;\n\n // Step 1 ⤜⤏ Find padded points.\n\n // Get midpoint.\n const [mx, my] = getPointBetween(x0, y0, x1, y1, 0.5);\n\n // Get control point.\n let [cx, cy] = getPointBetween(x0, y0, x1, y1, 0.5 - arc);\n\n // Rotate control point (clockwise or counterclockwise).\n [cx, cy] = rotatePoint(cx, cy, mx, my, (Math.PI / 2) * rot);\n\n // Get padded start point.\n const a0 = getAngle(x0, y0, cx, cy);\n const [px0, py0] = projectPoint(x0, y0, a0, padStart);\n\n // Get padded end point.\n const a1 = getAngle(x1, y1, cx, cy);\n const [px1, py1] = projectPoint(x1, y1, a1, padEnd);\n\n // Step 2 ⤜⤏ Find start and end angles.\n\n // Start angle\n const as = getAngle(cx, cy, x0, y0);\n\n // End angle\n const ae = getAngle(cx, cy, x1, y1);\n\n // Step 3 ⤜⤏ Find control point for padded points.\n\n // Get midpoint between padded start / end points.\n const [mx1, my1] = getPointBetween(px0, py0, px1, py1, 0.5);\n\n // Get control point for padded start / end points.\n let [cx1, cy1] = getPointBetween(px0, py0, px1, py1, 0.5 - arc);\n\n // Rotate control point (clockwise or counterclockwise).\n [cx1, cy1] = rotatePoint(cx1, cy1, mx1, my1, (Math.PI / 2) * rot);\n\n // Finally, average the two control points.\n let [cx2, cy2] = getPointBetween(cx, cy, cx1, cy1, 0.5);\n\n return [px0, py0, cx2, cy2, px1, py1, ae, as, angle];\n}\n","import { EdgeDirection, NodeStyles } from '../types';\nimport { NS, PlaitBoard, Point, createG, createPath, drawCircle, normalizePoint } from '@plait/core';\nimport getArrow from '../../perfect-arrows/get-arrow';\nimport {\n ACTIVE_BACKGROUND_NODE_ALPHA,\n DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER,\n DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER,\n DEFAULT_LINE_STYLES,\n DEFAULT_NODE_LABEL_FONT_SIZE,\n DEFAULT_NODE_LABEL_MARGIN_TOP,\n DEFAULT_NODE_SIZE,\n DEFAULT_NODE_STYLES,\n SECOND_DEPTH_NODE_ALPHA\n} from '../constants';\nimport { DEFAULT_STYLES } from '../../constants/default';\nimport { ForceAtlasNodeElement } from '../../interfaces';\n\nexport function drawNode(\n board: PlaitBoard,\n node: ForceAtlasNodeElement,\n point: Point,\n options: { isActive: boolean; isFirstDepth: boolean }\n) {\n const roughSVG = PlaitBoard.getRoughSVG(board);\n let nodeStyles: NodeStyles = {\n ...DEFAULT_NODE_STYLES,\n ...(node.styles || {})\n };\n let { x, y } = normalizePoint(point);\n let nodeRadius = (node.size ?? DEFAULT_NODE_SIZE) / 2;\n if (options.isActive) {\n nodeRadius = nodeRadius * DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER;\n }\n const nodeG = drawCircle(roughSVG, [0, 0], nodeRadius, nodeStyles);\n nodeG.setAttribute('transform', `translate(${x}, ${y})`);\n const text = document.createElementNS(NS, 'text');\n text.textContent = node.label || '';\n text.setAttribute('text-anchor', `middle`);\n text.setAttribute('dominant-baseline', `hanging`);\n text.setAttribute('x', `0`);\n text.setAttribute('font-size', `${DEFAULT_NODE_LABEL_FONT_SIZE}px`);\n if (options.isActive) {\n const waveRadius = nodeRadius * DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER;\n const waveCircle = drawCircle(roughSVG, [0, 0], waveRadius, DEFAULT_NODE_STYLES);\n waveCircle.setAttribute('opacity', ACTIVE_BACKGROUND_NODE_ALPHA.toString());\n nodeG.append(waveCircle);\n text.setAttribute('y', `${waveRadius / 2 + DEFAULT_NODE_LABEL_MARGIN_TOP}`);\n } else {\n if (!options.isFirstDepth) {\n nodeG.setAttribute('opacity', SECOND_DEPTH_NODE_ALPHA.toString());\n }\n text.setAttribute('y', `${nodeRadius / 2 + DEFAULT_NODE_LABEL_MARGIN_TOP}`);\n }\n nodeG.append(text);\n return nodeG;\n}\n\nexport function drawEdge(startPoint: Point, endPoint: Point, direction: EdgeDirection, isMutual: boolean) {\n const arrow = getArrow(startPoint[0], startPoint[1], endPoint[0], endPoint[1], {\n stretch: 0.4,\n flip: direction === EdgeDirection.NONE ? false : isMutual,\n padEnd: DEFAULT_NODE_SIZE / 4,\n padStart: DEFAULT_NODE_SIZE / 4\n });\n const [sx, sy, cx, cy, ex, ey, ae, as, ec] = arrow;\n const g = createG();\n const path = createPath();\n path.setAttribute('d', `M${sx},${sy} Q${cx},${cy} ${ex},${ey}`);\n path.setAttribute('fill', 'none');\n path.setAttribute('stroke', DEFAULT_LINE_STYLES.color[direction]);\n g.append(path);\n return {\n g,\n path\n };\n}\n\nexport function drawParticle(board: PlaitBoard, startPoint: Point, direction: EdgeDirection) {\n const roughSVG = PlaitBoard.getRoughSVG(board);\n const pointG = drawCircle(roughSVG, [0, 0], 5, {\n ...DEFAULT_STYLES,\n strokeWidth: 0,\n fill: DEFAULT_LINE_STYLES.color[direction]\n });\n pointG.setAttribute('transform', `translate(${startPoint[0]}, ${startPoint[1]})`);\n return pointG;\n}\n","import { PlaitBoard } from '@plait/core';\nimport { Generator } from '@plait/common';\nimport { ForceAtlasNodeElement } from '../../interfaces';\nimport { drawNode } from '../utils/draw';\nimport { NodeGeneratorData } from '../types';\n\nexport class ForceAtlasNodeGenerator extends Generator<ForceAtlasNodeElement, NodeGeneratorData> {\n static key = 'force-atlas-node';\n constructor(board: PlaitBoard) {\n super(board);\n }\n\n canDraw(element: ForceAtlasNodeElement): boolean {\n return true;\n }\n\n draw(element: ForceAtlasNodeElement, data: NodeGeneratorData) {\n return drawNode(this.board, element, element?.points?.[0] || [0, 0], data);\n }\n}\n","import { PlaitBoard, createG } from '@plait/core';\nimport { Generator } from '@plait/common';\nimport { ForceAtlasEdgeElement } from '../../interfaces';\nimport { EdgeDirection, EdgeGeneratorData } from '../types';\nimport { drawEdge, drawParticle } from '../utils/draw';\nimport { playEdgeParticleAnimate } from '../utils/edge';\n\nexport class ForceAtlasEdgeGenerator extends Generator<ForceAtlasEdgeElement, EdgeGeneratorData> {\n static key = 'force-atlas-edge';\n particleAnimation?: { stop: () => void; start: () => void };\n constructor(board: PlaitBoard) {\n super(board);\n }\n\n canDraw(element: ForceAtlasEdgeElement): boolean {\n return true;\n }\n\n draw(element: ForceAtlasEdgeElement, data: EdgeGeneratorData) {\n const edgeG = createG();\n const edgeElement = drawEdge(data.startPoint, data.endPoint, data.direction, data.isSourceActive && data.isTargetActive);\n edgeG.append(edgeElement.g);\n if (data.direction !== EdgeDirection.NONE) {\n const particle = drawParticle(this.board, data.startPoint, data.direction);\n edgeElement.g.append(particle);\n this.particleAnimation = playEdgeParticleAnimate(edgeElement.path, particle);\n }\n return edgeG;\n }\n\n destroy(): void {\n this.particleAnimation?.stop();\n }\n}\n","import { PlaitElement, Point, RectangleClient, normalizePoint } from '@plait/core';\nimport { ForceAtlasElement, ForceAtlasNodeElement } from '../../interfaces';\nimport { getEdges, getEdgesInSourceOrTarget } from './edge';\nimport { PlaitCommonElementRef } from '@plait/common';\nimport { ForceAtlasNodeGenerator } from '../generators/node.generator';\n\nexport function getNodes(forceAtlasElement: ForceAtlasElement, andBack?: (edge: ForceAtlasNodeElement) => boolean) {\n return forceAtlasElement.children?.filter(\n f => ForceAtlasElement.isForceAtlasNodeElement(f) && (andBack?.(f) ?? true)\n ) as ForceAtlasNodeElement[];\n}\n\nexport function getNodeById(id: string, forceAtlasElement: ForceAtlasElement) {\n const node = getNodes(forceAtlasElement, node => node.id === id)?.[0];\n if (!node) {\n throw new Error('can not find node.');\n }\n return node;\n}\n\nexport function getIsNodeActive(id: string, selectElements: ForceAtlasNodeElement[]) {\n return selectElements.some(node => node.id === id);\n}\n\nexport function isHitNode(node: ForceAtlasNodeElement, point: [Point, Point]) {\n const { x, y } = normalizePoint(node.points![0]);\n const size = node.size!;\n const hitFlowNode = RectangleClient.isHit(RectangleClient.getRectangleByPoints(point), {\n x: x - size / 2,\n y: y - size / 2,\n width: size,\n height: size\n });\n return hitFlowNode;\n}\n\nexport function getAssociatedNodesById(id: string, forceAtlasElement: ForceAtlasElement) {\n const edges = getEdgesInSourceOrTarget(id, forceAtlasElement);\n const nodes: ForceAtlasNodeElement[] = [];\n edges.forEach(edge => {\n nodes.push(getNodeById(edge.source, forceAtlasElement));\n nodes.push(getNodeById(edge.target, forceAtlasElement));\n });\n return nodes;\n}\n\nexport function getNodeGenerator(node: ForceAtlasNodeElement) {\n const edgeRef = PlaitElement.getElementRef<PlaitCommonElementRef>(node);\n return edgeRef.getGenerator<ForceAtlasNodeGenerator>(ForceAtlasNodeGenerator.key);\n}\n\nexport function isFirstDepthNode(currentNodeId: string, activeNodeId: string, forceAtlasElement: ForceAtlasElement) {\n const edges = getEdges(forceAtlasElement);\n return edges.some(\n s => (s.source === activeNodeId && s.target === currentNodeId) || (s.target === activeNodeId && s.source === currentNodeId)\n );\n}\n","import { PlaitBoard, PlaitElement, PlaitNode, getSelectedElements } from '@plait/core';\nimport { ForceAtlasEdgeElement, ForceAtlasElement, ForceAtlasNodeElement } from '../../interfaces';\nimport { EdgeDirection, EdgeGeneratorData } from '../types';\nimport { PlaitCommonElementRef, animate, linear } from '@plait/common';\nimport { ForceAtlasEdgeGenerator } from '../generators/edge.generator';\nimport { getIsNodeActive, getNodeById } from './node';\n\nexport function getEdges(forceAtlasElement: ForceAtlasElement, andCallBack?: (edge: ForceAtlasEdgeElement) => boolean) {\n return forceAtlasElement.children?.filter(\n f => ForceAtlasElement.isForceAtlasEdgeElement(f) && (andCallBack?.(f) ?? true)\n ) as ForceAtlasEdgeElement[];\n}\n\nexport function getEdgeById(id: string, forceAtlasElement: ForceAtlasElement) {\n const edge = getEdges(forceAtlasElement, e => e.id === id)?.[0];\n if (!edge) {\n throw new Error('can not find edge.');\n }\n return edge;\n}\n\nexport function getEdgesInSourceOrTarget(id: string, forceAtlasElement: ForceAtlasElement) {\n const edges = getEdges(forceAtlasElement, edge => edge.source === id || edge.target === id);\n return edges;\n}\n\nexport function getEdgeGenerator(edge: ForceAtlasEdgeElement) {\n const edgeRef = PlaitElement.getElementRef<PlaitCommonElementRef>(edge);\n return edgeRef.getGenerator<ForceAtlasEdgeGenerator>(ForceAtlasEdgeGenerator.key);\n}\n\nexport function getEdgeDirection(isSourceActive: boolean, isTargetActive: boolean) {\n if (isSourceActive) {\n return EdgeDirection.OUT;\n } else if (isTargetActive) {\n return EdgeDirection.IN;\n }\n return EdgeDirection.NONE;\n}\n\nexport function getEdgeGeneratorData(edge: ForceAtlasEdgeElement, board: PlaitBoard): EdgeGeneratorData {\n const forceAtlasElement = PlaitNode.parent(board, PlaitBoard.findPath(board, edge)) as ForceAtlasElement;\n const sourceNode = getNodeById(edge.source, forceAtlasElement);\n const targetNode = getNodeById(edge.target, forceAtlasElement);\n if (!sourceNode?.points || !targetNode?.points) {\n throw new Error(\"Source or target node doesn't have points\");\n }\n const startPoint = sourceNode.points[0];\n const endPoint = targetNode.points[0];\n const selectElements = getSelectedElements(board) as ForceAtlasNodeElement[];\n const isSourceActive = getIsNodeActive(sourceNode.id, selectElements);\n const isTargetActive = getIsNodeActive(targetNode.id, selectElements);\n const direction = getEdgeDirection(isSourceActive, isTargetActive);\n return {\n startPoint,\n endPoint,\n direction,\n isSourceActive,\n isTargetActive\n };\n}\n\nexport function playEdgeParticleAnimate(path: SVGPathElement, pointG: SVGGElement) {\n const pathLength = path.getTotalLength();\n let anim = animate(\n (t: number) => {\n const point = path.getPointAtLength(t * pathLength);\n pointG.setAttribute('transform', `translate(${point.x}, ${point.y})`);\n },\n 1000,\n linear,\n () => {\n anim = playEdgeParticleAnimate(path, pointG);\n }\n );\n return {\n stop: () => {\n anim.stop();\n },\n start: () => {\n anim.start();\n }\n };\n}\n","import { CommonElementFlavour } from '@plait/common';\nimport {\n OnContextChanged,\n PlaitBoard,\n PlaitNode,\n PlaitPluginElementContext,\n cacheSelectedElements,\n getSelectedElements\n} from '@plait/core';\nimport Graph from 'graphology';\nimport { ForceAtlasElement, ForceAtlasNodeElement } from '../interfaces';\nimport { ForceAtlasNodeGenerator } from './generators/node.generator';\nimport { getEdgeGenerator, getEdgeGeneratorData, getEdgesInSourceOrTarget } from './utils/edge';\nimport { getAssociatedNodesById, getNodeGenerator, isFirstDepthNode } from './utils/node';\n\nexport class ForceAtlasNodeFlavour extends CommonElementFlavour<ForceAtlasNodeElement, PlaitBoard>\n implements OnContextChanged<ForceAtlasNodeElement, PlaitBoard> {\n graph!: Graph<Node>;\n nodeGenerator!: ForceAtlasNodeGenerator;\n\n constructor() {\n super();\n }\n\n initializeGenerator() {\n this.nodeGenerator = new ForceAtlasNodeGenerator(this.board);\n this.getRef().addGenerator(ForceAtlasNodeGenerator.key, this.nodeGenerator);\n }\n\n initialize(): void {\n super.initialize();\n this.initializeGenerator();\n const parent = PlaitNode.parent(this.board, PlaitBoard.findPath(this.board, this.element)) as ForceAtlasElement;\n const selectElements = getSelectedElements(this.board);\n const activeNodeId = selectElements[0]?.id;\n const isActive = activeNodeId === this.element.id;\n this.nodeGenerator.processDrawing(this.element, isActive ? PlaitBoard.getElementActiveHost(this.board) : this.getElementG(), {\n isActive,\n isFirstDepth: isFirstDepthNode(this.element.id, activeNodeId, parent)\n });\n }\n\n onContextChanged(\n value: PlaitPluginElementContext<ForceAtlasNodeElement, PlaitBoard>,\n previous: PlaitPluginElementContext<ForceAtlasNodeElement, PlaitBoard>\n ) {\n if (value !== previous && value.selected !== previous.selected) {\n const parent = value.parent as any;\n if (value.selected) {\n cacheSelectedElements(this.board, [value.element]);\n }\n const selectElements = getSelectedElements(this.board);\n const associatedNodes = getAssociatedNodesById(value.element.id, parent);\n associatedNodes.forEach(node => {\n const nodeGenerator = getNodeGenerator(node);\n nodeGenerator.destroy();\n nodeGenerator.processDrawing(node, this.getElementG(), {\n isActive: selectElements?.[0]?.id === node.id,\n isFirstDepth: selectElements.length > 0 && isFirstDepthNode(node.id, selectElements[0].id, parent)\n });\n });\n\n const associatedEdges = getEdgesInSourceOrTarget(value.element.id, parent);\n associatedEdges.forEach(edge => {\n const edgeGenerator = getEdgeGenerator(edge);\n edgeGenerator.destroy();\n edgeGenerator.processDrawing(edge, PlaitBoard.getElementLowerHost(this.board), getEdgeGeneratorData(edge, this.board));\n });\n }\n }\n\n updateText(previousElement: ForceAtlasNodeElement, currentElement: ForceAtlasNodeElement) {}\n\n destroy(): void {\n super.destroy();\n }\n}\n","import { CommonElementFlavour } from '@plait/common';\nimport { OnContextChanged, PlaitBoard, PlaitPluginElementContext } from '@plait/core';\nimport Graph from 'graphology';\nimport { ForceAtlasEdgeElement } from '../interfaces';\nimport { ForceAtlasEdgeGenerator } from './generators/edge.generator';\nimport { getEdgeGeneratorData } from './utils/edge';\n\nexport class ForceAtlasEdgeFlavour extends CommonElementFlavour<ForceAtlasEdgeElement, PlaitBoard>\n implements OnContextChanged<ForceAtlasEdgeElement, PlaitBoard> {\n graph!: Graph<Node>;\n edgeGenerator!: ForceAtlasEdgeGenerator;\n\n constructor() {\n super();\n }\n\n initializeGenerator() {\n this.edgeGenerator = new ForceAtlasEdgeGenerator(this.board);\n this.getRef().addGenerator(ForceAtlasEdgeGenerator.key, this.edgeGenerator);\n }\n\n initialize(): void {\n super.initialize();\n this.initializeGenerator();\n this.edgeGenerator.processDrawing(\n this.element,\n PlaitBoard.getElementLowerHost(this.board),\n getEdgeGeneratorData(this.element, this.board)\n );\n }\n\n onContextChanged(\n value: PlaitPluginElementContext<ForceAtlasEdgeElement, PlaitBoard>,\n previous: PlaitPluginElementContext<ForceAtlasEdgeElement, PlaitBoard>\n ) {}\n\n updateText(previousElement: ForceAtlasEdgeElement, currentElement: ForceAtlasEdgeElement) {}\n\n destroy(): void {\n super.destroy();\n }\n}\n","import {\n PlaitBoard,\n PlaitElement,\n PlaitOptionsBoard,\n PlaitPluginElementContext,\n PlaitPluginKey,\n Point,\n RectangleClient,\n Selection,\n WithPluginOptions\n} from '@plait/core';\nimport { ForceAtlasFlavour } from './force-atlas.flavour';\nimport { ForceAtlasNodeFlavour } from './node.flavour';\nimport { ForceAtlasEdgeFlavour } from './edge.flavour';\nimport { ForceAtlasElement } from '../interfaces';\nimport { isHitNode } from './utils/node';\n\nexport const withForceAtlas = (board: PlaitBoard) => {\n const { drawElement, getRectangle, isRectangleHit, isHit, isInsidePoint, isMovable, isAlign, getRelatedFragment } = board;\n\n board.drawElement = (context: PlaitPluginElementContext) => {\n if (ForceAtlasElement.isForceAtlas(context.element)) {\n return ForceAtlasFlavour;\n } else if (ForceAtlasElement.isForceAtlasNodeElement(context.element)) {\n return ForceAtlasNodeFlavour;\n } else if (ForceAtlasElement.isForceAtlasEdgeElement(context.element)) {\n return ForceAtlasEdgeFlavour;\n }\n return drawElement(context);\n };\n\n board.getRectangle = (element: PlaitElement) => {\n if (element.type === 'force-atlas') {\n return {\n width: 0,\n height: 0,\n x: 0,\n y: 0\n };\n } else if (ForceAtlasElement.isForceAtlasNodeElement(element)) {\n return RectangleClient.getRectangleByPoints(element.points || []);\n } else if (ForceAtlasElement.isForceAtlasEdgeElement(element)) {\n return {\n width: 0,\n height: 0,\n x: 0,\n y: 0\n };\n }\n return getRectangle(element);\n };\n\n board.isRectangleHit = (element: PlaitElement, selection: Selection) => {\n return isRectangleHit(element, selection);\n };\n board.isRectangleHit = (element, range) => {\n if (ForceAtlasElement.isForceAtlasNodeElement(element)) {\n return isHitNode(element, [range.anchor, range.focus]);\n }\n return isRectangleHit(element, range);\n };\n\n board.isHit = (element, point) => {\n if (ForceAtlasElement.isForceAtlasNodeElement(element)) {\n return isHitNode(element, [point, point]);\n }\n return isHit(element, point);\n };\n\n board.isInsidePoint = (element: PlaitElement, point: Point) => {\n return isInsidePoint(element, point);\n };\n\n board.isMovable = element => {\n if (ForceAtlasElement.isForceAtlasNodeElement(element)) {\n return true;\n }\n return isMovable(element);\n };\n\n (board as PlaitOptionsBoard).setPluginOptions<WithPluginOptions>(PlaitPluginKey.withSelection, { isMultiple: false });\n\n return board;\n};\n","/*\n * Public API Surface of utils\n */\n\nexport * from './force-atlas/constants';\nexport * from './force-atlas/types';\nexport * from './force-atlas/with-force-atlas';\nexport * from './interfaces/index';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAEO,MAAM,cAAc,GAAY;AACnC,IAAA,SAAS,EAAE,OAAO;AAClB,IAAA,WAAW,EAAE,CAAC;CACjB;;ICFW,cAIX;AAJD,CAAA,UAAY,aAAa,EAAA;AACrB,IAAA,aAAA,CAAA,aAAA,CAAA,IAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAE,CAAA;AACF,IAAA,aAAA,CAAA,aAAA,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA,GAAA,KAAG,CAAA;AACH,IAAA,aAAA,CAAA,aAAA,CAAA,MAAA,CAAA,GA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F,IAAA,KAAK,CAAC,SAAS,GAAG,OAAO,IAAG;AACxB,QAAA,IAAI,iBAAiB,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE;AACpD,YAAA,OAAO,IAAI,CAAC;SACf;AACD,QAAA,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;AAC9B,KAAC,CAAC;AAED,IAAA,KAA2B,CAAC,gBAAgB,CAAoB,cAAc,CAAC,aAAa,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;AAEtH,IAAA,OAAO,KAAK,CAAC;AACjB;;ACnFA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"plait-graph-viz.mjs","sources":["../../../packages/graph-viz/src/constants/default.ts","../../../packages/graph-viz/src/force-atlas/types.ts","../../../packages/graph-viz/src/force-atlas/constants.ts","../../../packages/graph-viz/src/interfaces/element.ts","../../../packages/graph-viz/src/force-atlas/force-atlas.flavour.ts","../../../packages/graph-viz/src/perfect-arrows/utils.ts","../../../packages/graph-viz/src/perfect-arrows/get-arrow.ts","../../../packages/graph-viz/src/force-atlas/utils/draw.ts","../../../packages/graph-viz/src/force-atlas/generators/edge.generator.ts","../../../packages/graph-viz/src/force-atlas/utils/edge.ts","../../../packages/graph-viz/src/force-atlas/utils/node.ts","../../../packages/graph-viz/src/force-atlas/generators/node.generator.ts","../../../packages/graph-viz/src/force-atlas/node.flavour.ts","../../../packages/graph-viz/src/force-atlas/edge.flavour.ts","../../../packages/graph-viz/src/force-atlas/with-node-icon.ts","../../../packages/graph-viz/src/force-atlas/with-force-atlas.ts","../../../packages/graph-viz/src/force-atlas/core/node-icon-base.component.ts","../../../packages/graph-viz/src/public-api.ts","../../../packages/graph-viz/src/plait-graph-viz.ts"],"sourcesContent":["import { Options } from 'roughjs/bin/core';\n\nexport const DEFAULT_STYLES: Options = {\n fillStyle: 'solid',\n strokeWidth: 1\n};\n","import { GeneratorExtraData } from '@plait/common';\nimport { Point } from '@plait/core';\n\nexport enum EdgeDirection {\n IN,\n OUT,\n NONE\n}\n\nexport interface NodeStyles {\n stroke?: string;\n strokeWidth?: number;\n fill?: string;\n fillStyle?: string;\n activeStroke?: string;\n activeFill?: string;\n borderRadius?: number;\n hoverStroke?: string;\n}\n\nexport interface EdgeGeneratorData extends GeneratorExtraData {\n startPoint: Point;\n endPoint: Point;\n isSourceActive: boolean;\n isTargetActive: boolean;\n direction: EdgeDirection;\n}\n\nexport interface NodeGeneratorData extends GeneratorExtraData {\n isActive: boolean;\n isFirstDepth: boolean;\n}\n\nexport interface NodeIconItem {\n name: string;\n fontSize?: number;\n color?: string;\n}\n","import { Options } from 'roughjs/bin/core';\nimport { DEFAULT_STYLES } from '../constants/default';\nimport { EdgeDirection } from './types';\n\nexport const DEFAULT_EDGE_STYLES: Options = {\n ...DEFAULT_STYLES,\n stroke: '#ddd'\n};\n\nexport const DEFAULT_NODE_SIZE = 30;\n\nexport const DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER = 1.2;\n\nexport const DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER = 1.5;\n\nexport const DEFAULT_NODE_LABEL_MARGIN_TOP = 4;\n\nexport const DEFAULT_NODE_LABEL_FONT_SIZE = 12;\n\nexport const SECOND_DEPTH_NODE_ALPHA = 0.5;\n\nexport const SECOND_DEPTH_LINE_ALPHA = 0.5;\n\nexport const ACTIVE_BACKGROUND_NODE_ALPHA = 0.1;\n\nexport const NODE_ICON_CLASS_NAME = 'force-atlas-node-icon';\n\nexport const ACTIVE_NODE_ICON_CLASS_NAME = 'force-atlas-node-icon-active';\n\nexport const NODE_ICON_FONT_SIZE = 16;\n\nexport const ACTIVE_NODE_ICON_FONT_SIZE = 18;\n\nexport const DEFAULT_NODE_BACKGROUND_COLOR = '#9c9cfb';\n\nexport const DEFAULT_NODE_ICON_COLOR = '#fff';\n\nexport const DEFAULT_NODE_STYLES: Options = {\n ...DEFAULT_STYLES,\n fill: DEFAULT_NODE_BACKGROUND_COLOR,\n strokeWidth: 0\n};\n\nexport const DEFAULT_NODE_SCALING_RATIO = 20;\n\nexport const DEFAULT_LINE_STYLES = {\n color: {\n [EdgeDirection.IN]: '#73D897',\n [EdgeDirection.OUT]: '#6698FF',\n [EdgeDirection.NONE]: `#ddd`\n }\n};\n","import { PlaitElement } from '@plait/core';\nimport { NodeIconItem } from '../force-atlas/types';\nexport interface ForceAtlasNodeElement extends PlaitElement {\n label: string;\n icon: string | NodeIconItem;\n size?: number;\n isActive?: boolean;\n}\n\nexport interface ForceAtlasEdgeElement extends PlaitElement {\n source: string;\n target: string;\n}\n\nexport interface ForceAtlasElement extends PlaitElement {\n children: (ForceAtlasNodeElement | ForceAtlasEdgeElement)[];\n}\n\nexport const ForceAtlasElement = {\n isForceAtlas: (value: any) => {\n return value?.type === 'force-atlas';\n },\n isForceAtlasNodeElement: (value: any): value is ForceAtlasNodeElement => {\n return value && value.label && value.icon;\n },\n isForceAtlasEdgeElement: (value: any): value is ForceAtlasEdgeElement => {\n return value && value.source && value.target;\n }\n};\n","import { CommonElementFlavour } from '@plait/common';\nimport { OnContextChanged, PlaitBoard, PlaitPluginElementContext, cacheSelectedElements } from '@plait/core';\nimport Graph from 'graphology';\nimport circular from 'graphology-layout/circular';\nimport forceAtlas2 from 'graphology-layout-forceatlas2';\nimport { ForceAtlasElement, ForceAtlasNodeElement } from '../interfaces';\nimport { DEFAULT_NODE_SCALING_RATIO, DEFAULT_NODE_SIZE } from './constants';\n\nexport class ForceAtlasFlavour extends CommonElementFlavour<ForceAtlasElement, PlaitBoard>\n implements OnContextChanged<ForceAtlasElement, PlaitBoard> {\n graph!: Graph<ForceAtlasNodeElement>;\n\n constructor() {\n super();\n }\n\n initializeGraph() {\n this.graph = new Graph<ForceAtlasNodeElement>();\n this.element.children?.forEach(child => {\n if (ForceAtlasElement.isForceAtlasNodeElement(child)) {\n if (typeof child?.size === 'undefined') {\n child.size = DEFAULT_NODE_SIZE;\n }\n if (child.isActive) {\n cacheSelectedElements(this.board, [child]);\n }\n this.graph.addNode(child.id, child);\n } else if (ForceAtlasElement.isForceAtlasEdgeElement(child)) {\n this.graph.addEdge(child.source, child.target);\n }\n });\n circular.assign(this.graph);\n const settings = forceAtlas2.inferSettings(this.graph);\n settings.strongGravityMode = false;\n settings.linLogMode = true;\n settings.gravity = 2;\n settings.adjustSizes = true;\n settings.scalingRatio = DEFAULT_NODE_SCALING_RATIO;\n const positions = forceAtlas2(this.graph, { iterations: 1000, settings });\n this.element.children?.forEach(child => {\n if (ForceAtlasElement.isForceAtlasNodeElement(child)) {\n const pos = positions[child.id];\n child.points = [[pos.x, pos.y]];\n }\n });\n }\n\n initialize(): void {\n super.initialize();\n this.initializeGraph();\n }\n\n onContextChanged(\n value: PlaitPluginElementContext<ForceAtlasElement, PlaitBoard>,\n previous: PlaitPluginElementContext<ForceAtlasElement, PlaitBoard>\n ) {}\n\n updateText(previousElement: ForceAtlasElement, currentElement: ForceAtlasElement) {}\n\n destroy(): void {\n super.destroy();\n }\n}\n","// Credits to perfect-arrows\n// https://github.com/steveruizok/perfect-arrows/blob/master/src/lib/utils.ts\n\nconst PI = Math.PI;\n\n/**\n * Modulate a value between two ranges.\n * @param value\n * @param rangeA from [low, high]\n * @param rangeB to [low, high]\n * @param clamp\n */\nexport function modulate(value: number, rangeA: number[], rangeB: number[], clamp = false) {\n const [fromLow, fromHigh] = rangeA;\n const [toLow, toHigh] = rangeB;\n const result = toLow + ((value - fromLow) / (fromHigh - fromLow)) * (toHigh - toLow);\n if (clamp === true) {\n if (toLow < toHigh) {\n if (result < toLow) {\n return toLow;\n }\n if (result > toHigh) {\n return toHigh;\n }\n } else {\n if (result > toLow) {\n return toLow;\n }\n if (result < toHigh) {\n return toHigh;\n }\n }\n }\n return result;\n}\n\n/**\n * Rotate a point around a center.\n * @param x The x-axis coordinate of the point.\n * @param y The y-axis coordinate of the point.\n * @param cx The x-axis coordinate of the point to rotate round.\n * @param cy The y-axis coordinate of the point to rotate round.\n * @param angle The distance (in radians) to rotate.\n */\nexport function rotatePoint(x: number, y: number, cx: number, cy: number, angle: number) {\n const s = Math.sin(angle);\n const c = Math.cos(angle);\n\n const px = x - cx;\n const py = y - cy;\n\n const nx = px * c - py * s;\n const ny = px * s + py * c;\n\n return [nx + cx, ny + cy];\n}\n\n/**\n * Get the distance between two points.\n * @param x0 The x-axis coordinate of the first point.\n * @param y0 The y-axis coordinate of the first point.\n * @param x1 The x-axis coordinate of the second point.\n * @param y1 The y-axis coordinate of the second point.\n */\nexport function getDistance(x0: number, y0: number, x1: number, y1: number) {\n return Math.hypot(y1 - y0, x1 - x0);\n}\n\n/**\n * Get an angle (radians) between two points.\n * @param x0 The x-axis coordinate of the first point.\n * @param y0 The y-axis coordinate of the first point.\n * @param x1 The x-axis coordinate of the second point.\n * @param y1 The y-axis coordinate of the second point.\n */\nexport function getAngle(x0: number, y0: number, x1: number, y1: number) {\n return Math.atan2(y1 - y0, x1 - x0);\n}\n\n/**\n * Move a point in an angle by a distance.\n * @param x0\n * @param y0\n * @param a angle (radians)\n * @param d distance\n */\nexport function projectPoint(x0: number, y0: number, a: number, d: number) {\n return [Math.cos(a) * d + x0, Math.sin(a) * d + y0];\n}\n\n/**\n * Get a point between two points.\n * @param x0 The x-axis coordinate of the first point.\n * @param y0 The y-axis coordinate of the first point.\n * @param x1 The x-axis coordinate of the second point.\n * @param y1 The y-axis coordinate of the second point.\n * @param d Normalized\n */\nexport function getPointBetween(x0: number, y0: number, x1: number, y1: number, d = 0.5) {\n return [x0 + (x1 - x0) * d, y0 + (y1 - y0) * d];\n}\n\n/**\n * Get the sector of an angle (e.g. quadrant, octant)\n * @param a The angle to check.\n * @param s The number of sectors to check.\n */\nexport function getSector(a: number, s = 8) {\n return Math.floor(s * (0.5 + ((a / (PI * 2)) % s)));\n}\n\n/**\n * Get a normal value representing how close two points are from being at a 45 degree angle.\n * @param x0 The x-axis coordinate of the first point.\n * @param y0 The y-axis coordinate of the first point.\n * @param x1 The x-axis coordinate of the second point.\n * @param y1 The y-axis coordinate of the second point.\n */\nexport function getAngliness(x0: number, y0: number, x1: number, y1: number) {\n return Math.abs((x1 - x0) / 2 / ((y1 - y0) / 2));\n}\n","// Credits to perfect-arrows\n// https://github.com/steveruizok/perfect-arrows/blob/master/src/lib/getArrow.ts\n\nimport { getAngle, getDistance, getAngliness, projectPoint, getPointBetween, getSector, rotatePoint, modulate } from './utils';\n\nexport type ArrowOptions = {\n bow?: number;\n stretchMin?: number;\n stretchMax?: number;\n stretch?: number;\n padStart?: number;\n padEnd?: number;\n flip?: boolean;\n straights?: boolean;\n};\n\n/**\n * getArrow\n * Get the points for a linking line between two points.\n * @description Draw an arrow between two points.\n * @param x0 The x position of the \"from\" point.\n * @param y0 The y position of the \"from\" point.\n * @param x1 The x position of the \"to\" point.\n * @param y1 The y position of the \"to\" point.\n * @param options Additional options for computing the line.\n * @returns [sx, sy, cx, cy, e1, e2, ae, as, ac]\n * @example\n * const arrow = getArrow(0, 0, 100, 200, {\n bow: 0\n stretch: .5\n stretchMin: 0\n stretchMax: 420\n padStart: 0\n padEnd: 0\n flip: false\n straights: true\n * })\n * \n * const [\n * startX, startY, \n * controlX, controlY, \n * endX, endY, \n * endAngle, \n * startAngle,\n * controlAngle\n * ] = arrow\n */\nexport default function getArrow(x0: number, y0: number, x1: number, y1: number, options: ArrowOptions = {} as ArrowOptions): number[] {\n const { bow = 0, stretch = 0.5, stretchMin = 0, stretchMax = 420, padStart = 0, padEnd = 0, flip = false, straights = true } = options;\n\n const angle = getAngle(x0, y0, x1, y1);\n const dist = getDistance(x0, y0, x1, y1);\n const angliness = getAngliness(x0, y0, x1, y1);\n\n // Step 0 ⤜⤏ Should the arrow be straight?\n\n if (\n dist < (padStart + padEnd) * 2 || // Too short\n (bow === 0 && stretch === 0) || // No bow, no stretch\n (straights && [0, 1, Infinity].includes(angliness)) // 45 degree angle\n ) {\n // ⤜⤏ Arrow is straight! Just pad start and end points.\n\n // Padding distances\n const ps = Math.max(0, Math.min(dist - padStart, padStart));\n const pe = Math.max(0, Math.min(dist - ps, padEnd));\n\n // Move start point toward end point\n let [px0, py0] = projectPoint(x0, y0, angle, ps);\n\n // Move end point toward start point\n let [px1, py1] = projectPoint(x1, y1, angle + Math.PI, pe);\n\n // Get midpoint between new points\n const [mx, my] = getPointBetween(px0, py0, px1, py1, 0.5);\n\n return [px0, py0, mx, my, px1, py1, angle, angle, angle];\n }\n\n // ⤜⤏ Arrow is an arc!\n\n // Is the arc clockwise or counterclockwise?\n let rot = (getSector(angle) % 2 === 0 ? 1 : -1) * (flip ? -1 : 1);\n\n // Calculate how much the line should \"bow\" away from center\n const arc = bow + modulate(dist, [stretchMin, stretchMax], [1, 0], true) * stretch;\n\n // Step 1 ⤜⤏ Find padded points.\n\n // Get midpoint.\n const [mx, my] = getPointBetween(x0, y0, x1, y1, 0.5);\n\n // Get control point.\n let [cx, cy] = getPointBetween(x0, y0, x1, y1, 0.5 - arc);\n\n // Rotate control point (clockwise or counterclockwise).\n [cx, cy] = rotatePoint(cx, cy, mx, my, (Math.PI / 2) * rot);\n\n // Get padded start point.\n const a0 = getAngle(x0, y0, cx, cy);\n const [px0, py0] = projectPoint(x0, y0, a0, padStart);\n\n // Get padded end point.\n const a1 = getAngle(x1, y1, cx, cy);\n const [px1, py1] = projectPoint(x1, y1, a1, padEnd);\n\n // Step 2 ⤜⤏ Find start and end angles.\n\n // Start angle\n const as = getAngle(cx, cy, x0, y0);\n\n // End angle\n const ae = getAngle(cx, cy, x1, y1);\n\n // Step 3 ⤜⤏ Find control point for padded points.\n\n // Get midpoint between padded start / end points.\n const [mx1, my1] = getPointBetween(px0, py0, px1, py1, 0.5);\n\n // Get control point for padded start / end points.\n let [cx1, cy1] = getPointBetween(px0, py0, px1, py1, 0.5 - arc);\n\n // Rotate control point (clockwise or counterclockwise).\n [cx1, cy1] = rotatePoint(cx1, cy1, mx1, my1, (Math.PI / 2) * rot);\n\n // Finally, average the two control points.\n let [cx2, cy2] = getPointBetween(cx, cy, cx1, cy1, 0.5);\n\n return [px0, py0, cx2, cy2, px1, py1, ae, as, angle];\n}\n","import { EdgeDirection, NodeStyles } from '../types';\nimport { NS, PlaitBoard, Point, createForeignObject, createG, createPath, drawCircle, normalizePoint } from '@plait/core';\nimport getArrow from '../../perfect-arrows/get-arrow';\nimport {\n ACTIVE_BACKGROUND_NODE_ALPHA,\n DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER,\n DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER,\n DEFAULT_LINE_STYLES,\n DEFAULT_NODE_LABEL_FONT_SIZE,\n DEFAULT_NODE_LABEL_MARGIN_TOP,\n DEFAULT_NODE_SIZE,\n DEFAULT_NODE_STYLES,\n SECOND_DEPTH_NODE_ALPHA\n} from '../constants';\nimport { DEFAULT_STYLES } from '../../constants/default';\nimport { ForceAtlasNodeElement } from '../../interfaces';\n\nexport function drawNode(\n board: PlaitBoard,\n node: ForceAtlasNodeElement,\n point: Point,\n options: { iconG?: SVGGElement; isActive: boolean; isFirstDepth: boolean }\n) {\n const roughSVG = PlaitBoard.getRoughSVG(board);\n const nodeStyles: NodeStyles = {\n ...DEFAULT_NODE_STYLES,\n ...(node.styles || {})\n };\n let { x, y } = normalizePoint(point);\n let diameter = node.size ?? DEFAULT_NODE_SIZE;\n if (options.isActive) {\n diameter = diameter * DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER;\n }\n const nodeG = drawCircle(roughSVG, [x, y], diameter, nodeStyles);\n if (options.iconG) {\n nodeG.append(options.iconG);\n }\n const text = document.createElementNS(NS, 'text');\n text.textContent = node.label || '';\n text.setAttribute('text-anchor', `middle`);\n text.setAttribute('dominant-baseline', `hanging`);\n text.setAttribute('x', `${x}`);\n text.setAttribute('font-size', `${DEFAULT_NODE_LABEL_FONT_SIZE}px`);\n text.setAttribute('style', `user-select: none;`);\n if (options.isActive) {\n const waveDiameter = diameter * DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER;\n const waveCircle = drawCircle(roughSVG, [x, y], waveDiameter, nodeStyles);\n waveCircle.setAttribute('opacity', ACTIVE_BACKGROUND_NODE_ALPHA.toString());\n nodeG.append(waveCircle);\n text.setAttribute('y', `${y + waveDiameter / 2 + DEFAULT_NODE_LABEL_MARGIN_TOP}`);\n } else {\n if (!options.isFirstDepth) {\n nodeG.setAttribute('opacity', SECOND_DEPTH_NODE_ALPHA.toString());\n }\n text.setAttribute('y', `${y + diameter / 2 + DEFAULT_NODE_LABEL_MARGIN_TOP}`);\n }\n nodeG.append(text);\n return nodeG;\n}\n\nexport function drawEdge(startPoint: Point, endPoint: Point, direction: EdgeDirection, isMutual: boolean) {\n const arrow = getArrow(startPoint[0], startPoint[1], endPoint[0], endPoint[1], {\n stretch: 0.4,\n flip: direction === EdgeDirection.NONE ? false : isMutual,\n padEnd: DEFAULT_NODE_SIZE / 2,\n padStart: DEFAULT_NODE_SIZE / 2\n });\n const [sx, sy, cx, cy, ex, ey, ae, as, ec] = arrow;\n const g = createG();\n const path = createPath();\n path.setAttribute('d', `M${sx},${sy} Q${cx},${cy} ${ex},${ey}`);\n path.setAttribute('fill', 'none');\n path.setAttribute('stroke', DEFAULT_LINE_STYLES.color[direction]);\n g.append(path);\n return {\n g,\n path\n };\n}\n\nexport function drawParticle(board: PlaitBoard, startPoint: Point, direction: EdgeDirection) {\n const roughSVG = PlaitBoard.getRoughSVG(board);\n const pointG = drawCircle(roughSVG, [0, 0], 5, {\n ...DEFAULT_STYLES,\n strokeWidth: 0,\n fill: DEFAULT_LINE_STYLES.color[direction]\n });\n pointG.setAttribute('transform', `translate(${startPoint[0]}, ${startPoint[1]})`);\n return pointG;\n}\n","import { PlaitBoard, createG } from '@plait/core';\nimport { Generator } from '@plait/common';\nimport { ForceAtlasEdgeElement } from '../../interfaces';\nimport { EdgeDirection, EdgeGeneratorData } from '../types';\nimport { drawEdge, drawParticle } from '../utils/draw';\nimport { playEdgeParticleAnimate } from '../utils/edge';\n\nexport class ForceAtlasEdgeGenerator extends Generator<ForceAtlasEdgeElement, EdgeGeneratorData> {\n static key = 'force-atlas-edge';\n particleAnimation?: { stop: () => void; start: () => void };\n constructor(board: PlaitBoard) {\n super(board);\n }\n\n canDraw(element: ForceAtlasEdgeElement): boolean {\n return true;\n }\n\n draw(element: ForceAtlasEdgeElement, data: EdgeGeneratorData) {\n const edgeG = createG();\n const edgeElement = drawEdge(data.startPoint, data.endPoint, data.direction, data.isSourceActive && data.isTargetActive);\n edgeG.append(edgeElement.g);\n if (data.direction !== EdgeDirection.NONE) {\n const particle = drawParticle(this.board, data.startPoint, data.direction);\n edgeElement.g.append(particle);\n this.particleAnimation = playEdgeParticleAnimate(edgeElement.path, particle);\n }\n return edgeG;\n }\n\n destroy(): void {\n super.destroy();\n this.particleAnimation?.stop();\n }\n}\n","import { PlaitBoard, PlaitElement, PlaitNode, getSelectedElements } from '@plait/core';\nimport { ForceAtlasEdgeElement, ForceAtlasElement, ForceAtlasNodeElement } from '../../interfaces';\nimport { EdgeDirection, EdgeGeneratorData } from '../types';\nimport { PlaitCommonElementRef, animate, linear } from '@plait/common';\nimport { ForceAtlasEdgeGenerator } from '../generators/edge.generator';\nimport { getIsNodeActive, getNodeById } from './node';\n\nexport function getEdges(forceAtlasElement: ForceAtlasElement, andCallBack?: (edge: ForceAtlasEdgeElement) => boolean) {\n return forceAtlasElement.children?.filter(\n f => ForceAtlasElement.isForceAtlasEdgeElement(f) && (andCallBack?.(f) ?? true)\n ) as ForceAtlasEdgeElement[];\n}\n\nexport function getEdgeById(id: string, forceAtlasElement: ForceAtlasElement) {\n const edge = getEdges(forceAtlasElement, e => e.id === id)?.[0];\n if (!edge) {\n throw new Error('can not find edge.');\n }\n return edge;\n}\n\nexport function getEdgesInSourceOrTarget(id: string, forceAtlasElement: ForceAtlasElement) {\n const edges = getEdges(forceAtlasElement, edge => edge.source === id || edge.target === id);\n return edges;\n}\n\nexport function getEdgeGenerator(edge: ForceAtlasEdgeElement) {\n const edgeRef = PlaitElement.getElementRef<PlaitCommonElementRef>(edge);\n return edgeRef.getGenerator<ForceAtlasEdgeGenerator>(ForceAtlasEdgeGenerator.key);\n}\n\nexport function getEdgeDirection(isSourceActive: boolean, isTargetActive: boolean) {\n if (isSourceActive) {\n return EdgeDirection.OUT;\n } else if (isTargetActive) {\n return EdgeDirection.IN;\n }\n return EdgeDirection.NONE;\n}\n\nexport function getEdgeGeneratorData(edge: ForceAtlasEdgeElement, board: PlaitBoard): EdgeGeneratorData {\n const forceAtlasElement = PlaitNode.parent(board, PlaitBoard.findPath(board, edge)) as ForceAtlasElement;\n const sourceNode = getNodeById(edge.source, forceAtlasElement);\n const targetNode = getNodeById(edge.target, forceAtlasElement);\n if (!sourceNode?.points || !targetNode?.points) {\n throw new Error(\"Source or target node doesn't have points\");\n }\n const startPoint = sourceNode.points[0];\n const endPoint = targetNode.points[0];\n const selectElements = getSelectedElements(board) as ForceAtlasNodeElement[];\n const isSourceActive = getIsNodeActive(sourceNode.id, selectElements);\n const isTargetActive = getIsNodeActive(targetNode.id, selectElements);\n const direction = getEdgeDirection(isSourceActive, isTargetActive);\n return {\n startPoint,\n endPoint,\n direction,\n isSourceActive,\n isTargetActive\n };\n}\n\nexport function playEdgeParticleAnimate(path: SVGPathElement, pointG: SVGGElement) {\n const pathLength = path.getTotalLength();\n let anim = animate(\n (t: number) => {\n const point = path.getPointAtLength(t * pathLength);\n pointG.setAttribute('transform', `translate(${point.x}, ${point.y})`);\n },\n 1000,\n linear,\n () => {\n anim = playEdgeParticleAnimate(path, pointG);\n }\n );\n return {\n stop: () => {\n anim.stop();\n },\n start: () => {\n anim.start();\n }\n };\n}\n","import { PlaitElement, Point, RectangleClient, normalizePoint } from '@plait/core';\nimport { ForceAtlasElement, ForceAtlasNodeElement } from '../../interfaces';\nimport { getEdges, getEdgesInSourceOrTarget } from './edge';\nimport { PlaitCommonElementRef } from '@plait/common';\nimport { ForceAtlasNodeGenerator } from '../generators/node.generator';\nimport { DEFAULT_NODE_ICON_COLOR, NODE_ICON_FONT_SIZE } from '../constants';\n\nexport function getNodes(forceAtlasElement: ForceAtlasElement, andBack?: (edge: ForceAtlasNodeElement) => boolean) {\n return forceAtlasElement.children?.filter(\n f => ForceAtlasElement.isForceAtlasNodeElement(f) && (andBack?.(f) ?? true)\n ) as ForceAtlasNodeElement[];\n}\n\nexport function getNodeById(id: string, forceAtlasElement: ForceAtlasElement) {\n const node = getNodes(forceAtlasElement, node => node.id === id)?.[0];\n if (!node) {\n throw new Error('can not find node.');\n }\n return node;\n}\n\nexport function getIsNodeActive(id: string, selectElements: ForceAtlasNodeElement[]) {\n return selectElements.some(node => node.id === id);\n}\n\nexport function isHitNode(node: ForceAtlasNodeElement, point: [Point, Point]) {\n const { x, y } = normalizePoint(node.points![0]);\n const size = node.size!;\n const hitFlowNode = RectangleClient.isHit(RectangleClient.getRectangleByPoints(point), {\n x: x - size / 2,\n y: y - size / 2,\n width: size,\n height: size\n });\n return hitFlowNode;\n}\n\nexport function getAssociatedNodesById(id: string, forceAtlasElement: ForceAtlasElement) {\n const edges = getEdgesInSourceOrTarget(id, forceAtlasElement);\n const nodes: ForceAtlasNodeElement[] = [];\n edges.forEach(edge => {\n nodes.push(getNodeById(edge.source, forceAtlasElement));\n nodes.push(getNodeById(edge.target, forceAtlasElement));\n });\n return nodes;\n}\n\nexport function getNodeGenerator(node: ForceAtlasNodeElement) {\n const edgeRef = PlaitElement.getElementRef<PlaitCommonElementRef>(node);\n return edgeRef.getGenerator<ForceAtlasNodeGenerator>(ForceAtlasNodeGenerator.key);\n}\n\nexport function isFirstDepthNode(currentNodeId: string, activeNodeId: string, forceAtlasElement: ForceAtlasElement) {\n const edges = getEdges(forceAtlasElement);\n return edges.some(\n s => (s.source === activeNodeId && s.target === currentNodeId) || (s.target === activeNodeId && s.source === currentNodeId)\n );\n}\n\nexport function getNodeIcon(node: ForceAtlasNodeElement) {\n const iconItem = typeof node.icon === 'object' && node.icon.name ? node.icon : null;\n return {\n name: iconItem ? iconItem.name : (node.icon as string),\n fontSize: (iconItem && iconItem.fontSize) || NODE_ICON_FONT_SIZE,\n color: (iconItem && iconItem.color) || DEFAULT_NODE_ICON_COLOR\n };\n}\n","import { PlaitBoard, createForeignObject, createG, normalizePoint } from '@plait/core';\nimport { Generator, RenderComponentRef } from '@plait/common';\nimport { ForceAtlasNodeElement } from '../../interfaces';\nimport { drawNode } from '../utils/draw';\nimport { NodeGeneratorData } from '../types';\nimport { ForceAtlasNodeIconBoard, NodeIconProps } from '../with-node-icon';\nimport { ACTIVE_NODE_ICON_CLASS_NAME, ACTIVE_NODE_ICON_FONT_SIZE, NODE_ICON_CLASS_NAME } from '../constants';\nimport { getNodeIcon } from '../utils/node';\n\nexport class ForceAtlasNodeGenerator extends Generator<ForceAtlasNodeElement, NodeGeneratorData> {\n static key = 'force-atlas-node';\n\n constructor(board: PlaitBoard) {\n super(board);\n }\n\n canDraw(element: ForceAtlasNodeElement): boolean {\n return true;\n }\n\n draw(element: ForceAtlasNodeElement, data: NodeGeneratorData) {\n const iconRef = this.drawIcon(element, data);\n return drawNode(this.board, element, element?.points?.[0] || [0, 0], { ...data, iconG: iconRef.iconG });\n }\n\n drawIcon(element: ForceAtlasNodeElement, data: NodeGeneratorData) {\n const iconG = createG();\n let { x, y } = normalizePoint(element.points?.[0] || [0, 0]);\n const size = element.size!;\n const foreignObject = createForeignObject(x - size / 2, y - size / 2, size, size);\n iconG.append(foreignObject);\n const container = document.createElement('div');\n container.classList.add(NODE_ICON_CLASS_NAME);\n if (data.isActive) {\n container.classList.add(ACTIVE_NODE_ICON_CLASS_NAME);\n }\n foreignObject.append(container);\n const nodeIcon = getNodeIcon(element);\n const props: NodeIconProps = {\n iconItem: {\n name: nodeIcon.name,\n fontSize: data.isActive ? ACTIVE_NODE_ICON_FONT_SIZE : nodeIcon.fontSize,\n color: nodeIcon.color\n },\n board: this.board,\n element: element\n };\n const ref = ((this.board as unknown) as ForceAtlasNodeIconBoard).renderNodeIcon(container, props);\n return { ref, iconG };\n }\n}\n","import { CommonElementFlavour } from '@plait/common';\nimport {\n OnContextChanged,\n PlaitBoard,\n PlaitNode,\n PlaitPluginElementContext,\n cacheSelectedElements,\n getSelectedElements\n} from '@plait/core';\nimport Graph from 'graphology';\nimport { ForceAtlasElement, ForceAtlasNodeElement } from '../interfaces';\nimport { ForceAtlasNodeGenerator } from './generators/node.generator';\nimport { getEdgeGenerator, getEdgeGeneratorData, getEdgesInSourceOrTarget } from './utils/edge';\nimport { getAssociatedNodesById, getNodeGenerator, isFirstDepthNode } from './utils/node';\n\nexport class ForceAtlasNodeFlavour extends CommonElementFlavour<ForceAtlasNodeElement, PlaitBoard>\n implements OnContextChanged<ForceAtlasNodeElement, PlaitBoard> {\n graph!: Graph<Node>;\n nodeGenerator!: ForceAtlasNodeGenerator;\n\n constructor() {\n super();\n }\n\n initializeGenerator() {\n this.nodeGenerator = new ForceAtlasNodeGenerator(this.board);\n this.getRef().addGenerator(ForceAtlasNodeGenerator.key, this.nodeGenerator);\n }\n\n initialize(): void {\n super.initialize();\n this.initializeGenerator();\n const parent = PlaitNode.parent(this.board, PlaitBoard.findPath(this.board, this.element)) as ForceAtlasElement;\n const selectElements = getSelectedElements(this.board);\n const activeNodeId = selectElements[0]?.id;\n const isActive = activeNodeId === this.element.id;\n this.nodeGenerator.processDrawing(this.element, isActive ? PlaitBoard.getElementActiveHost(this.board) : this.getElementG(), {\n isActive,\n isFirstDepth: isFirstDepthNode(this.element.id, activeNodeId, parent)\n });\n }\n\n onContextChanged(\n value: PlaitPluginElementContext<ForceAtlasNodeElement, PlaitBoard>,\n previous: PlaitPluginElementContext<ForceAtlasNodeElement, PlaitBoard>\n ) {\n if (value !== previous && value.selected !== previous.selected) {\n const parent = value.parent as any;\n if (value.selected) {\n cacheSelectedElements(this.board, [value.element]);\n }\n const selectElements = getSelectedElements(this.board);\n const associatedNodes = getAssociatedNodesById(value.element.id, parent);\n associatedNodes.forEach(node => {\n const nodeGenerator = getNodeGenerator(node);\n nodeGenerator.destroy();\n nodeGenerator.processDrawing(node, this.getElementG(), {\n isActive: selectElements?.[0]?.id === node.id,\n isFirstDepth: selectElements.length > 0 && isFirstDepthNode(node.id, selectElements[0].id, parent)\n });\n });\n\n const associatedEdges = getEdgesInSourceOrTarget(value.element.id, parent);\n associatedEdges.forEach(edge => {\n const edgeGenerator = getEdgeGenerator(edge);\n edgeGenerator.destroy();\n edgeGenerator.processDrawing(edge, PlaitBoard.getElementLowerHost(this.board), getEdgeGeneratorData(edge, this.board));\n });\n }\n }\n\n updateText(previousElement: ForceAtlasNodeElement, currentElement: ForceAtlasNodeElement) {}\n\n destroy(): void {\n super.destroy();\n }\n}\n","import { CommonElementFlavour } from '@plait/common';\nimport { OnContextChanged, PlaitBoard, PlaitPluginElementContext } from '@plait/core';\nimport Graph from 'graphology';\nimport { ForceAtlasEdgeElement } from '../interfaces';\nimport { ForceAtlasEdgeGenerator } from './generators/edge.generator';\nimport { getEdgeGeneratorData } from './utils/edge';\n\nexport class ForceAtlasEdgeFlavour extends CommonElementFlavour<ForceAtlasEdgeElement, PlaitBoard>\n implements OnContextChanged<ForceAtlasEdgeElement, PlaitBoard> {\n graph!: Graph<Node>;\n edgeGenerator!: ForceAtlasEdgeGenerator;\n\n constructor() {\n super();\n }\n\n initializeGenerator() {\n this.edgeGenerator = new ForceAtlasEdgeGenerator(this.board);\n this.getRef().addGenerator(ForceAtlasEdgeGenerator.key, this.edgeGenerator);\n }\n\n initialize(): void {\n super.initialize();\n this.initializeGenerator();\n this.edgeGenerator.processDrawing(\n this.element,\n PlaitBoard.getElementLowerHost(this.board),\n getEdgeGeneratorData(this.element, this.board)\n );\n }\n\n onContextChanged(\n value: PlaitPluginElementContext<ForceAtlasEdgeElement, PlaitBoard>,\n previous: PlaitPluginElementContext<ForceAtlasEdgeElement, PlaitBoard>\n ) {}\n\n updateText(previousElement: ForceAtlasEdgeElement, currentElement: ForceAtlasEdgeElement) {}\n\n destroy(): void {\n super.destroy();\n this.edgeGenerator.destroy();\n }\n}\n","import { PlaitBoard } from '@plait/core';\nimport { ForceAtlasNodeElement } from '../interfaces/element';\nimport { RenderComponentRef } from '@plait/common';\nimport { NodeIconItem } from './types';\n\nexport interface ForceAtlasNodeIconBoard {\n renderNodeIcon: (container: Element | DocumentFragment, props: NodeIconProps) => RenderComponentRef<NodeIconProps>;\n}\n\nexport const withNodeIcon = <T extends PlaitBoard = PlaitBoard>(board: T) => {\n const newBoard = board as T & ForceAtlasNodeIconBoard;\n\n newBoard.renderNodeIcon = (container: Element | DocumentFragment, props: NodeIconProps) => {\n throw new Error('No implementation for renderLabeIcon method.');\n };\n return newBoard;\n};\n\nexport interface NodeIconProps {\n board: PlaitBoard;\n iconItem: NodeIconItem;\n element: ForceAtlasNodeElement;\n}\n","import {\n PlaitBoard,\n PlaitElement,\n PlaitOptionsBoard,\n PlaitPluginElementContext,\n PlaitPluginKey,\n Point,\n RectangleClient,\n Selection,\n WithPluginOptions\n} from '@plait/core';\nimport { ForceAtlasFlavour } from './force-atlas.flavour';\nimport { ForceAtlasNodeFlavour } from './node.flavour';\nimport { ForceAtlasEdgeFlavour } from './edge.flavour';\nimport { ForceAtlasElement } from '../interfaces';\nimport { isHitNode } from './utils/node';\nimport { withNodeIcon } from './with-node-icon';\n\nexport const withForceAtlas = (board: PlaitBoard) => {\n const { drawElement, getRectangle, isRectangleHit, isHit, isInsidePoint, isMovable, isAlign, getRelatedFragment } = board;\n\n board.drawElement = (context: PlaitPluginElementContext) => {\n if (ForceAtlasElement.isForceAtlas(context.element)) {\n return ForceAtlasFlavour;\n } else if (ForceAtlasElement.isForceAtlasNodeElement(context.element)) {\n return ForceAtlasNodeFlavour;\n } else if (ForceAtlasElement.isForceAtlasEdgeElement(context.element)) {\n return ForceAtlasEdgeFlavour;\n }\n return drawElement(context);\n };\n\n board.getRectangle = (element: PlaitElement) => {\n if (element.type === 'force-atlas') {\n return {\n width: 0,\n height: 0,\n x: 0,\n y: 0\n };\n } else if (ForceAtlasElement.isForceAtlasNodeElement(element)) {\n return RectangleClient.getRectangleByPoints(element.points || []);\n } else if (ForceAtlasElement.isForceAtlasEdgeElement(element)) {\n return {\n width: 0,\n height: 0,\n x: 0,\n y: 0\n };\n }\n return getRectangle(element);\n };\n\n board.isRectangleHit = (element: PlaitElement, selection: Selection) => {\n return isRectangleHit(element, selection);\n };\n board.isRectangleHit = (element, range) => {\n if (ForceAtlasElement.isForceAtlasNodeElement(element)) {\n return isHitNode(element, [range.anchor, range.focus]);\n }\n return isRectangleHit(element, range);\n };\n\n board.isHit = (element, point) => {\n if (ForceAtlasElement.isForceAtlasNodeElement(element)) {\n return isHitNode(element, [point, point]);\n }\n return isHit(element, point);\n };\n\n board.isInsidePoint = (element: PlaitElement, point: Point) => {\n return isInsidePoint(element, point);\n };\n\n board.isMovable = element => {\n if (ForceAtlasElement.isForceAtlasNodeElement(element)) {\n return true;\n }\n return isMovable(element);\n };\n\n (board as PlaitOptionsBoard).setPluginOptions<WithPluginOptions>(PlaitPluginKey.withSelection, { isMultiple: false });\n\n return withNodeIcon(board);\n};\n","import { PlaitBoard } from '@plait/core';\nimport { ForceAtlasNodeElement } from '../../interfaces/element';\nimport { DEFAULT_NODE_ICON_COLOR, NODE_ICON_CLASS_NAME, NODE_ICON_FONT_SIZE } from '../constants';\nimport { NodeIconItem } from '../types';\n\nexport abstract class ForceAtlasNodeIconBaseComponent {\n iconItem!: NodeIconItem;\n\n board!: PlaitBoard;\n\n element!: ForceAtlasNodeElement;\n\n abstract nativeElement(): HTMLElement;\n\n initialize() {\n if (!this.iconItem.fontSize) {\n this.iconItem.fontSize = NODE_ICON_FONT_SIZE;\n }\n if (!this.iconItem.color) {\n this.iconItem.color = DEFAULT_NODE_ICON_COLOR;\n }\n this.nativeElement().style.fontSize = `${this.iconItem.fontSize}px`;\n this.nativeElement().style.color = `${this.iconItem.color}`;\n this.nativeElement().classList.add(NODE_ICON_CLASS_NAME);\n }\n}\n","/*\n * Public API Surface of utils\n */\n\nexport * from './force-atlas/constants';\nexport * from './force-atlas/types';\nexport * from './force-atlas/with-force-atlas';\nexport * from './force-atlas/with-node-icon';\nexport * from './interfaces/index';\nexport * from './force-atlas/core/node-icon-base.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAEO,MAAM,cAAc,GAAY;AACnC,IAAA,SAAS,EAAE,OAAO;AAClB,IAAA,WAAW,EAAE,CAAC;CACjB;;ICFW,cAIX;AAJD,CAAA,UAAY,aAAa,EAAA;AACrB,IAAA,aAAA,CAAA,aAAA,CAAA,IAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAE,CAAA;AACF,IAAA,aAAA,CAAA,aAAA,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA,GAAA,KAAG,CAAA;AACH,IAAA,aAAA,CAAA,aAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;AACR,CAAC,EAJW,aAAa,KAAb,aAAa,GAIxB,EAAA,CAAA,CAAA;;ACHY,MAAA,mBAAmB,GAAY;AACxC,IAAA,GAAG,cAAc;AACjB,IAAA,MAAM,EAAE,MAAM;EAChB;AAEK,MAAM,iBAAiB,GAAG,GAAG;AAE7B,MAAM,mCAAmC,GAAG,IAAI;AAEhD,MAAM,wCAAwC,GAAG,IAAI;AAErD,MAAM,6BAA6B,GAAG,EAAE;AAExC,MAAM,4BAA4B,GAAG,GAAG;AAExC,MAAM,uBAAuB,GAAG,IAAI;AAEpC,MAAM,uBAAuB,GAAG,IAAI;AAEpC,MAAM,4BAA4B,GAAG,IAAI;AAEzC,MAAM,oBAAoB,GAAG,wBAAwB;AAErD,MAAM,2BAA2B,GAAG,+BAA+B;AAEnE,MAAM,mBAAmB,GAAG,GAAG;AAE/B,MAAM,0BAA0B,GAAG,GAAG;AAEtC,MAAM,6BAA6B,GAAG,UAAU;AAEhD,MAAM,uBAAuB,GAAG,OAAO;AAEjC,MAAA,mBAAmB,GAAY;AACxC,IAAA,GAAG,cAAc;AACjB,IAAA,IAAI,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