@html-graph/html-graph 8.24.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html-graph.d.ts +13 -192
- package/dist/html-graph.js +34 -376
- package/dist/html-graph.min.js +464 -715
- package/dist/html-graph.min.umd.cjs +1 -1
- package/dist/html-graph.umd.cjs +33 -378
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -121,11 +121,11 @@ var CoreHtmlView = class {
|
|
|
121
121
|
node.element.style.zIndex = `${node.payload.priority}`;
|
|
122
122
|
}
|
|
123
123
|
updateEdgeShape(edgeId) {
|
|
124
|
-
const
|
|
125
|
-
this.container.removeChild(
|
|
126
|
-
const
|
|
127
|
-
this.edgeIdToElementMap.set(edgeId,
|
|
128
|
-
this.container.appendChild(
|
|
124
|
+
const previousElement = this.edgeIdToElementMap.get(edgeId);
|
|
125
|
+
this.container.removeChild(previousElement);
|
|
126
|
+
const { element } = this.graphStore.getEdge(edgeId).payload.shape;
|
|
127
|
+
this.edgeIdToElementMap.set(edgeId, element);
|
|
128
|
+
this.container.appendChild(element);
|
|
129
129
|
}
|
|
130
130
|
renderEdge(edgeId) {
|
|
131
131
|
const edge = this.graphStore.getEdge(edgeId);
|
|
@@ -1663,43 +1663,6 @@ var createOrthogonalLine = (from, to) => {
|
|
|
1663
1663
|
return createVerticalSourceOrthogonalLine(from, to);
|
|
1664
1664
|
};
|
|
1665
1665
|
//#endregion
|
|
1666
|
-
//#region src/edges/paths/horizontal-edge-path/horizontal-edge-path.ts
|
|
1667
|
-
var HorizontalEdgePath = class {
|
|
1668
|
-
path;
|
|
1669
|
-
midpoint;
|
|
1670
|
-
constructor(params) {
|
|
1671
|
-
const { from, to, fromDir, toDir, arrowLength, arrowOffset, roundness, hasSourceArrow, hasTargetArrow } = params;
|
|
1672
|
-
const beginArrow = hasSourceArrow ? createRotatedPoint({
|
|
1673
|
-
x: from.x + arrowLength,
|
|
1674
|
-
y: from.y
|
|
1675
|
-
}, fromDir, from) : from;
|
|
1676
|
-
const endArrow = hasTargetArrow ? createRotatedPoint({
|
|
1677
|
-
x: to.x - arrowLength,
|
|
1678
|
-
y: to.y
|
|
1679
|
-
}, toDir, to) : to;
|
|
1680
|
-
const gap = arrowLength + arrowOffset;
|
|
1681
|
-
const beginLine = createRotatedPoint({
|
|
1682
|
-
x: from.x + gap,
|
|
1683
|
-
y: from.y
|
|
1684
|
-
}, fromDir, from);
|
|
1685
|
-
const endLine = createRotatedPoint({
|
|
1686
|
-
x: to.x - gap,
|
|
1687
|
-
y: to.y
|
|
1688
|
-
}, toDir, to);
|
|
1689
|
-
const line = createHorizontalLine({
|
|
1690
|
-
arrowPoint: beginArrow,
|
|
1691
|
-
linePoint: beginLine,
|
|
1692
|
-
dir: fromDir
|
|
1693
|
-
}, {
|
|
1694
|
-
arrowPoint: endArrow,
|
|
1695
|
-
linePoint: endLine,
|
|
1696
|
-
dir: toDir
|
|
1697
|
-
});
|
|
1698
|
-
this.path = createRoundedPath(line.points, roundness);
|
|
1699
|
-
this.midpoint = line.midpoint;
|
|
1700
|
-
}
|
|
1701
|
-
};
|
|
1702
|
-
//#endregion
|
|
1703
1666
|
//#region src/edges/paths/detour-straight-edge-path/detour-straight-edge-path.ts
|
|
1704
1667
|
var DetourStraightEdgePath = class {
|
|
1705
1668
|
path;
|
|
@@ -1787,43 +1750,6 @@ var StraightEdgePath = class {
|
|
|
1787
1750
|
}
|
|
1788
1751
|
};
|
|
1789
1752
|
//#endregion
|
|
1790
|
-
//#region src/edges/paths/vertical-edge-path/vertical-edge-path.ts
|
|
1791
|
-
var VerticalEdgePath = class {
|
|
1792
|
-
path;
|
|
1793
|
-
midpoint;
|
|
1794
|
-
constructor(params) {
|
|
1795
|
-
const { from, to, hasSourceArrow, hasTargetArrow, arrowLength, arrowOffset, fromDir, toDir, roundness } = params;
|
|
1796
|
-
const beginArrow = hasSourceArrow ? createRotatedPoint({
|
|
1797
|
-
x: from.x + arrowLength,
|
|
1798
|
-
y: from.y
|
|
1799
|
-
}, fromDir, from) : from;
|
|
1800
|
-
const endArrow = hasTargetArrow ? createRotatedPoint({
|
|
1801
|
-
x: to.x - arrowLength,
|
|
1802
|
-
y: to.y
|
|
1803
|
-
}, toDir, to) : to;
|
|
1804
|
-
const gap = arrowLength + arrowOffset;
|
|
1805
|
-
const beginLine = createRotatedPoint({
|
|
1806
|
-
x: from.x + gap,
|
|
1807
|
-
y: from.y
|
|
1808
|
-
}, fromDir, from);
|
|
1809
|
-
const endLine = createRotatedPoint({
|
|
1810
|
-
x: to.x - gap,
|
|
1811
|
-
y: to.y
|
|
1812
|
-
}, toDir, to);
|
|
1813
|
-
const line = createVerticalLine({
|
|
1814
|
-
arrowPoint: beginArrow,
|
|
1815
|
-
linePoint: beginLine,
|
|
1816
|
-
dir: fromDir
|
|
1817
|
-
}, {
|
|
1818
|
-
arrowPoint: endArrow,
|
|
1819
|
-
linePoint: endLine,
|
|
1820
|
-
dir: toDir
|
|
1821
|
-
});
|
|
1822
|
-
this.path = createRoundedPath(line.points, roundness);
|
|
1823
|
-
this.midpoint = line.midpoint;
|
|
1824
|
-
}
|
|
1825
|
-
};
|
|
1826
|
-
//#endregion
|
|
1827
1753
|
//#region src/edges/paths/orthogonal-edge-path/orthogonal-edge-path.ts
|
|
1828
1754
|
var OrthogonalEdgePath = class {
|
|
1829
1755
|
path;
|
|
@@ -2132,7 +2058,6 @@ var createDirectionVector = (dir) => {
|
|
|
2132
2058
|
var PathEdgeShape = class {
|
|
2133
2059
|
params;
|
|
2134
2060
|
element;
|
|
2135
|
-
svg;
|
|
2136
2061
|
group = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2137
2062
|
line;
|
|
2138
2063
|
sourceArrow = null;
|
|
@@ -2145,7 +2070,6 @@ var PathEdgeShape = class {
|
|
|
2145
2070
|
[this.afterRenderEmitter, this.onAfterRender] = createPair();
|
|
2146
2071
|
this.arrowRenderer = this.params.arrowRenderer;
|
|
2147
2072
|
this.element = createEdgeSvg(params.color);
|
|
2148
|
-
this.svg = this.element;
|
|
2149
2073
|
this.element.appendChild(this.group);
|
|
2150
2074
|
this.line = createEdgePath(params.width);
|
|
2151
2075
|
this.group.appendChild(this.line);
|
|
@@ -2319,7 +2243,6 @@ var resolveArrowRenderer = (config) => {
|
|
|
2319
2243
|
//#region src/edges/shapes/bezier-edge-shape/bezier-edge-shape.ts
|
|
2320
2244
|
var BezierEdgeShape = class {
|
|
2321
2245
|
element;
|
|
2322
|
-
svg;
|
|
2323
2246
|
group;
|
|
2324
2247
|
line;
|
|
2325
2248
|
sourceArrow;
|
|
@@ -2386,7 +2309,6 @@ var BezierEdgeShape = class {
|
|
|
2386
2309
|
padding: 50
|
|
2387
2310
|
});
|
|
2388
2311
|
this.element = this.pathShape.element;
|
|
2389
|
-
this.svg = this.element;
|
|
2390
2312
|
this.group = this.pathShape.group;
|
|
2391
2313
|
this.line = this.pathShape.line;
|
|
2392
2314
|
this.sourceArrow = this.pathShape.sourceArrow;
|
|
@@ -2398,113 +2320,9 @@ var BezierEdgeShape = class {
|
|
|
2398
2320
|
}
|
|
2399
2321
|
};
|
|
2400
2322
|
//#endregion
|
|
2401
|
-
//#region src/edges/shapes/horizontal-edge-shape/horizontalize-directions/horizontalize-direction.ts
|
|
2402
|
-
var horizontalizeDirection = (direction) => {
|
|
2403
|
-
return Math.cos(direction) > 0 ? 0 : Math.PI;
|
|
2404
|
-
};
|
|
2405
|
-
//#endregion
|
|
2406
|
-
//#region src/edges/shapes/horizontal-edge-shape/horizontal-edge-shape.ts
|
|
2407
|
-
/**
|
|
2408
|
-
* @deprecated
|
|
2409
|
-
* use OrthogonalEdgeShape instead
|
|
2410
|
-
*/
|
|
2411
|
-
var HorizontalEdgeShape = class {
|
|
2412
|
-
element;
|
|
2413
|
-
svg;
|
|
2414
|
-
group;
|
|
2415
|
-
line;
|
|
2416
|
-
sourceArrow;
|
|
2417
|
-
targetArrow;
|
|
2418
|
-
onAfterRender;
|
|
2419
|
-
arrowLength;
|
|
2420
|
-
arrowOffset;
|
|
2421
|
-
roundness;
|
|
2422
|
-
cycleSquareSide;
|
|
2423
|
-
detourDistance;
|
|
2424
|
-
hasSourceArrow;
|
|
2425
|
-
hasTargetArrow;
|
|
2426
|
-
pathShape;
|
|
2427
|
-
createCyclePath = (from, _to, fromDir) => new CycleSquareEdgePath({
|
|
2428
|
-
origin: from,
|
|
2429
|
-
dir: fromDir,
|
|
2430
|
-
arrowLength: this.arrowLength,
|
|
2431
|
-
side: this.cycleSquareSide,
|
|
2432
|
-
arrowOffset: this.arrowOffset,
|
|
2433
|
-
roundness: this.roundness,
|
|
2434
|
-
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
2435
|
-
});
|
|
2436
|
-
createDetourPath = (from, to, fromDir, toDir) => new DetourHorizontalEdgePath({
|
|
2437
|
-
from,
|
|
2438
|
-
to,
|
|
2439
|
-
fromDir,
|
|
2440
|
-
toDir,
|
|
2441
|
-
arrowLength: this.arrowLength,
|
|
2442
|
-
arrowOffset: this.arrowOffset,
|
|
2443
|
-
roundness: this.roundness,
|
|
2444
|
-
detourDistance: this.detourDistance,
|
|
2445
|
-
hasSourceArrow: this.hasSourceArrow,
|
|
2446
|
-
hasTargetArrow: this.hasTargetArrow
|
|
2447
|
-
});
|
|
2448
|
-
createLinePath = (from, to, fromDir, toDir) => new HorizontalEdgePath({
|
|
2449
|
-
from,
|
|
2450
|
-
to,
|
|
2451
|
-
fromDir,
|
|
2452
|
-
toDir,
|
|
2453
|
-
arrowLength: this.arrowLength,
|
|
2454
|
-
arrowOffset: this.arrowOffset,
|
|
2455
|
-
roundness: this.roundness,
|
|
2456
|
-
hasSourceArrow: this.hasSourceArrow,
|
|
2457
|
-
hasTargetArrow: this.hasTargetArrow
|
|
2458
|
-
});
|
|
2459
|
-
constructor(params) {
|
|
2460
|
-
this.arrowLength = params?.arrowLength ?? edgeConstants.arrowLength;
|
|
2461
|
-
this.arrowOffset = params?.arrowOffset ?? edgeConstants.arrowOffset;
|
|
2462
|
-
this.cycleSquareSide = params?.cycleSquareSide ?? edgeConstants.cycleSquareSide;
|
|
2463
|
-
const roundness = params?.roundness ?? edgeConstants.roundness;
|
|
2464
|
-
this.roundness = Math.min(roundness, this.arrowOffset, this.cycleSquareSide / 2);
|
|
2465
|
-
this.detourDistance = params?.detourDistance ?? edgeConstants.detourDistance;
|
|
2466
|
-
this.hasSourceArrow = params?.hasSourceArrow ?? edgeConstants.hasSourceArrow;
|
|
2467
|
-
this.hasTargetArrow = params?.hasTargetArrow ?? edgeConstants.hasTargetArrow;
|
|
2468
|
-
this.pathShape = new PathEdgeShape({
|
|
2469
|
-
color: params?.color ?? edgeConstants.color,
|
|
2470
|
-
width: params?.width ?? edgeConstants.width,
|
|
2471
|
-
arrowRenderer: resolveArrowRenderer(params?.arrowRenderer ?? {}),
|
|
2472
|
-
arrowLength: this.arrowLength,
|
|
2473
|
-
hasSourceArrow: this.hasSourceArrow,
|
|
2474
|
-
hasTargetArrow: this.hasTargetArrow,
|
|
2475
|
-
createCyclePath: this.createCyclePath,
|
|
2476
|
-
createDetourPath: this.createDetourPath,
|
|
2477
|
-
createLinePath: this.createLinePath,
|
|
2478
|
-
padding: 50
|
|
2479
|
-
});
|
|
2480
|
-
this.element = this.pathShape.element;
|
|
2481
|
-
this.svg = this.element;
|
|
2482
|
-
this.group = this.pathShape.group;
|
|
2483
|
-
this.line = this.pathShape.line;
|
|
2484
|
-
this.sourceArrow = this.pathShape.sourceArrow;
|
|
2485
|
-
this.targetArrow = this.pathShape.targetArrow;
|
|
2486
|
-
this.onAfterRender = this.pathShape.onAfterRender;
|
|
2487
|
-
}
|
|
2488
|
-
render(params) {
|
|
2489
|
-
const { from, to, category } = params;
|
|
2490
|
-
this.pathShape.render({
|
|
2491
|
-
category,
|
|
2492
|
-
from: {
|
|
2493
|
-
...from,
|
|
2494
|
-
direction: horizontalizeDirection(from.direction)
|
|
2495
|
-
},
|
|
2496
|
-
to: {
|
|
2497
|
-
...to,
|
|
2498
|
-
direction: horizontalizeDirection(to.direction)
|
|
2499
|
-
}
|
|
2500
|
-
});
|
|
2501
|
-
}
|
|
2502
|
-
};
|
|
2503
|
-
//#endregion
|
|
2504
2323
|
//#region src/edges/shapes/straight-edge-shape/straight-edge-shape.ts
|
|
2505
2324
|
var StraightEdgeShape = class {
|
|
2506
2325
|
element;
|
|
2507
|
-
svg;
|
|
2508
2326
|
group;
|
|
2509
2327
|
line;
|
|
2510
2328
|
sourceArrow;
|
|
@@ -2575,7 +2393,6 @@ var StraightEdgeShape = class {
|
|
|
2575
2393
|
padding: 50
|
|
2576
2394
|
});
|
|
2577
2395
|
this.element = this.pathShape.element;
|
|
2578
|
-
this.svg = this.element;
|
|
2579
2396
|
this.group = this.pathShape.group;
|
|
2580
2397
|
this.line = this.pathShape.line;
|
|
2581
2398
|
this.sourceArrow = this.pathShape.sourceArrow;
|
|
@@ -2587,110 +2404,6 @@ var StraightEdgeShape = class {
|
|
|
2587
2404
|
}
|
|
2588
2405
|
};
|
|
2589
2406
|
//#endregion
|
|
2590
|
-
//#region src/edges/shapes/vertical-edge-shape/verticalize-directions/verticalize-direction.ts
|
|
2591
|
-
var pi2 = Math.PI / 2;
|
|
2592
|
-
var verticalizeDirection = (direction) => {
|
|
2593
|
-
return Math.sin(direction) > 0 ? pi2 : -pi2;
|
|
2594
|
-
};
|
|
2595
|
-
//#endregion
|
|
2596
|
-
//#region src/edges/shapes/vertical-edge-shape/vertical-edge-shape.ts
|
|
2597
|
-
/**
|
|
2598
|
-
* @deprecated
|
|
2599
|
-
* use OrthogonalEdgeShape instead
|
|
2600
|
-
*/
|
|
2601
|
-
var VerticalEdgeShape = class {
|
|
2602
|
-
element;
|
|
2603
|
-
svg;
|
|
2604
|
-
group;
|
|
2605
|
-
line;
|
|
2606
|
-
sourceArrow;
|
|
2607
|
-
targetArrow;
|
|
2608
|
-
onAfterRender;
|
|
2609
|
-
arrowLength;
|
|
2610
|
-
arrowOffset;
|
|
2611
|
-
roundness;
|
|
2612
|
-
cycleSquareSide;
|
|
2613
|
-
detourDistance;
|
|
2614
|
-
hasSourceArrow;
|
|
2615
|
-
hasTargetArrow;
|
|
2616
|
-
pathShape;
|
|
2617
|
-
createCyclePath = (from, _to, fromDir) => new CycleSquareEdgePath({
|
|
2618
|
-
origin: from,
|
|
2619
|
-
dir: fromDir,
|
|
2620
|
-
arrowLength: this.arrowLength,
|
|
2621
|
-
side: this.cycleSquareSide,
|
|
2622
|
-
arrowOffset: this.arrowOffset,
|
|
2623
|
-
roundness: this.roundness,
|
|
2624
|
-
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
2625
|
-
});
|
|
2626
|
-
createDetourPath = (from, to, fromDir, toDir) => new DetourVerticalEdgePath({
|
|
2627
|
-
from,
|
|
2628
|
-
to,
|
|
2629
|
-
fromDir,
|
|
2630
|
-
toDir,
|
|
2631
|
-
arrowLength: this.arrowLength,
|
|
2632
|
-
arrowOffset: this.arrowOffset,
|
|
2633
|
-
roundness: this.roundness,
|
|
2634
|
-
detourDistance: this.detourDistance,
|
|
2635
|
-
hasSourceArrow: this.hasSourceArrow,
|
|
2636
|
-
hasTargetArrow: this.hasTargetArrow
|
|
2637
|
-
});
|
|
2638
|
-
createLinePath = (from, to, fromDir, toDir) => new VerticalEdgePath({
|
|
2639
|
-
from,
|
|
2640
|
-
to,
|
|
2641
|
-
fromDir,
|
|
2642
|
-
toDir,
|
|
2643
|
-
arrowLength: this.arrowLength,
|
|
2644
|
-
arrowOffset: this.arrowOffset,
|
|
2645
|
-
roundness: this.roundness,
|
|
2646
|
-
hasSourceArrow: this.hasSourceArrow,
|
|
2647
|
-
hasTargetArrow: this.hasTargetArrow
|
|
2648
|
-
});
|
|
2649
|
-
constructor(params) {
|
|
2650
|
-
this.arrowLength = params?.arrowLength ?? edgeConstants.arrowLength;
|
|
2651
|
-
this.arrowOffset = params?.arrowOffset ?? edgeConstants.arrowOffset;
|
|
2652
|
-
this.cycleSquareSide = params?.cycleSquareSide ?? edgeConstants.cycleSquareSide;
|
|
2653
|
-
const roundness = params?.roundness ?? edgeConstants.roundness;
|
|
2654
|
-
this.roundness = Math.min(roundness, this.arrowOffset, this.cycleSquareSide / 2);
|
|
2655
|
-
this.detourDistance = params?.detourDistance ?? edgeConstants.detourDistance;
|
|
2656
|
-
this.hasSourceArrow = params?.hasSourceArrow ?? edgeConstants.hasSourceArrow;
|
|
2657
|
-
this.hasTargetArrow = params?.hasTargetArrow ?? edgeConstants.hasTargetArrow;
|
|
2658
|
-
this.pathShape = new PathEdgeShape({
|
|
2659
|
-
color: params?.color ?? edgeConstants.color,
|
|
2660
|
-
width: params?.width ?? edgeConstants.width,
|
|
2661
|
-
arrowRenderer: resolveArrowRenderer(params?.arrowRenderer ?? {}),
|
|
2662
|
-
arrowLength: this.arrowLength,
|
|
2663
|
-
hasSourceArrow: this.hasSourceArrow,
|
|
2664
|
-
hasTargetArrow: this.hasTargetArrow,
|
|
2665
|
-
createCyclePath: this.createCyclePath,
|
|
2666
|
-
createDetourPath: this.createDetourPath,
|
|
2667
|
-
createLinePath: this.createLinePath,
|
|
2668
|
-
padding: 50
|
|
2669
|
-
});
|
|
2670
|
-
this.element = this.pathShape.element;
|
|
2671
|
-
this.svg = this.element;
|
|
2672
|
-
this.group = this.pathShape.group;
|
|
2673
|
-
this.line = this.pathShape.line;
|
|
2674
|
-
this.sourceArrow = this.pathShape.sourceArrow;
|
|
2675
|
-
this.targetArrow = this.pathShape.targetArrow;
|
|
2676
|
-
this.onAfterRender = this.pathShape.onAfterRender;
|
|
2677
|
-
}
|
|
2678
|
-
render(params) {
|
|
2679
|
-
const { from, to, category } = params;
|
|
2680
|
-
this.pathShape.render({
|
|
2681
|
-
category,
|
|
2682
|
-
from: {
|
|
2683
|
-
...from,
|
|
2684
|
-
direction: verticalizeDirection(from.direction)
|
|
2685
|
-
},
|
|
2686
|
-
to: {
|
|
2687
|
-
...to,
|
|
2688
|
-
direction: verticalizeDirection(to.direction)
|
|
2689
|
-
}
|
|
2690
|
-
});
|
|
2691
|
-
}
|
|
2692
|
-
};
|
|
2693
|
-
//#endregion
|
|
2694
2407
|
//#region src/edges/shapes/orthogonal-edge-shape/orthogonalize-direction/orthogonalize-direction.ts
|
|
2695
2408
|
var orthogonalizeDirection = (direction) => {
|
|
2696
2409
|
const adjDir = direction + Math.PI / 4;
|
|
@@ -2707,7 +2420,6 @@ var orthogonalizeDirection = (direction) => {
|
|
|
2707
2420
|
//#region src/edges/shapes/orthogonal-edge-shape/orthogonal-edge-shape.ts
|
|
2708
2421
|
var OrthogonalEdgeShape = class {
|
|
2709
2422
|
element;
|
|
2710
|
-
svg;
|
|
2711
2423
|
group;
|
|
2712
2424
|
line;
|
|
2713
2425
|
sourceArrow;
|
|
@@ -2775,7 +2487,6 @@ var OrthogonalEdgeShape = class {
|
|
|
2775
2487
|
padding: 50
|
|
2776
2488
|
});
|
|
2777
2489
|
this.element = this.pathShape.element;
|
|
2778
|
-
this.svg = this.element;
|
|
2779
2490
|
this.group = this.pathShape.group;
|
|
2780
2491
|
this.line = this.pathShape.line;
|
|
2781
2492
|
this.sourceArrow = this.pathShape.sourceArrow;
|
|
@@ -2822,7 +2533,6 @@ var resolvePortOffsetFn = (offset) => {
|
|
|
2822
2533
|
var defaultPortOffset = edgeConstants.portOffset;
|
|
2823
2534
|
var DirectEdgeShape = class {
|
|
2824
2535
|
element;
|
|
2825
|
-
svg;
|
|
2826
2536
|
group = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
2827
2537
|
line;
|
|
2828
2538
|
sourceArrow = null;
|
|
@@ -2844,7 +2554,6 @@ var DirectEdgeShape = class {
|
|
|
2844
2554
|
this.sourceOffsetFn = resolvePortOffsetFn(params?.sourceOffset ?? defaultPortOffset);
|
|
2845
2555
|
this.targetOffsetFn = resolvePortOffsetFn(params?.targetOffset ?? defaultPortOffset);
|
|
2846
2556
|
this.element = createEdgeSvg(this.color);
|
|
2847
|
-
this.svg = this.element;
|
|
2848
2557
|
this.element.appendChild(this.group);
|
|
2849
2558
|
this.line = createEdgePath(this.width);
|
|
2850
2559
|
this.group.appendChild(this.line);
|
|
@@ -3025,15 +2734,10 @@ var InteractiveEdgeError = class extends Error {
|
|
|
3025
2734
|
var InteractiveEdgeShape = class InteractiveEdgeShape {
|
|
3026
2735
|
baseEdge;
|
|
3027
2736
|
element;
|
|
3028
|
-
svg;
|
|
3029
2737
|
group;
|
|
3030
2738
|
line;
|
|
3031
2739
|
sourceArrow;
|
|
3032
2740
|
targetArrow;
|
|
3033
|
-
/**
|
|
3034
|
-
* @deprecated
|
|
3035
|
-
* use shape.svg instead
|
|
3036
|
-
*/
|
|
3037
2741
|
handle = createEdgeGroup();
|
|
3038
2742
|
onAfterRender;
|
|
3039
2743
|
interactiveLine;
|
|
@@ -3043,7 +2747,6 @@ var InteractiveEdgeShape = class InteractiveEdgeShape {
|
|
|
3043
2747
|
this.baseEdge = baseEdge;
|
|
3044
2748
|
if (baseEdge instanceof InteractiveEdgeShape) throw new InteractiveEdgeError("interactive edge can be configured only once");
|
|
3045
2749
|
this.element = this.baseEdge.element;
|
|
3046
|
-
this.svg = this.element;
|
|
3047
2750
|
this.group = this.baseEdge.group;
|
|
3048
2751
|
this.line = this.baseEdge.line;
|
|
3049
2752
|
this.sourceArrow = this.baseEdge.sourceArrow;
|
|
@@ -3082,12 +2785,10 @@ var MidpointEdgeShape = class {
|
|
|
3082
2785
|
targetArrow;
|
|
3083
2786
|
onAfterRender;
|
|
3084
2787
|
element;
|
|
3085
|
-
svg;
|
|
3086
2788
|
constructor(baseShape, midpointElement) {
|
|
3087
2789
|
this.baseShape = baseShape;
|
|
3088
2790
|
this.midpointElement = midpointElement;
|
|
3089
2791
|
this.element = this.baseShape.element;
|
|
3090
|
-
this.svg = this.element;
|
|
3091
2792
|
this.group = this.baseShape.group;
|
|
3092
2793
|
this.line = this.baseShape.line;
|
|
3093
2794
|
this.sourceArrow = this.baseShape.sourceArrow;
|
|
@@ -3387,17 +3088,6 @@ var GraphController = class {
|
|
|
3387
3088
|
}
|
|
3388
3089
|
};
|
|
3389
3090
|
//#endregion
|
|
3390
|
-
//#region src/schedule-fn/macrotask-schedule-fn/macrotask-schedule-fn.ts
|
|
3391
|
-
/**
|
|
3392
|
-
* @deprecated
|
|
3393
|
-
* use macrotaskScheduleFn instead
|
|
3394
|
-
*/
|
|
3395
|
-
var macrotaskScheduleFn = (callback) => {
|
|
3396
|
-
setTimeout(() => {
|
|
3397
|
-
callback();
|
|
3398
|
-
});
|
|
3399
|
-
};
|
|
3400
|
-
//#endregion
|
|
3401
3091
|
//#region src/schedule-fn/microtask-schedule-fn/microtask-schedule-fn.ts
|
|
3402
3092
|
var microtaskScheduleFn = (callback) => {
|
|
3403
3093
|
queueMicrotask(() => {
|
|
@@ -3449,7 +3139,7 @@ var createFocusParams = (config, controllerParams) => {
|
|
|
3449
3139
|
} : {
|
|
3450
3140
|
minContentScale: config.minContentScale ?? controllerParams.focus.minContentScale,
|
|
3451
3141
|
nodes: config.nodes ?? [],
|
|
3452
|
-
contentPadding: config.contentPadding ??
|
|
3142
|
+
contentPadding: config.contentPadding ?? controllerParams.focus.contentPadding,
|
|
3453
3143
|
animationDuration: config.animationDuration ?? controllerParams.focus.animationDuration
|
|
3454
3144
|
};
|
|
3455
3145
|
};
|
|
@@ -4001,12 +3691,7 @@ var UserDraggableNodesConfigurator = class UserDraggableNodesConfigurator {
|
|
|
4001
3691
|
const element = event.currentTarget;
|
|
4002
3692
|
const nodeId = this.canvas.graph.findNodeIdByElement(element);
|
|
4003
3693
|
const node = this.graph.getNode(nodeId);
|
|
4004
|
-
if (!this.params.nodeDragVerifier(
|
|
4005
|
-
nodeId,
|
|
4006
|
-
element: node.element,
|
|
4007
|
-
x: node.x,
|
|
4008
|
-
y: node.y
|
|
4009
|
-
})) return;
|
|
3694
|
+
if (!this.params.nodeDragVerifier(nodeId)) return;
|
|
4010
3695
|
this.eventTagger.tag(event, dragEventHandledTag);
|
|
4011
3696
|
const cursorContent = this.calculateContentPoint({
|
|
4012
3697
|
x: touch.clientX,
|
|
@@ -4291,8 +3976,10 @@ var UserTransformableViewportConfigurator = class UserTransformableViewportConfi
|
|
|
4291
3976
|
const transform = this.params.transformPreprocessor({
|
|
4292
3977
|
prevTransform,
|
|
4293
3978
|
nextTransform,
|
|
4294
|
-
|
|
4295
|
-
|
|
3979
|
+
viewport: {
|
|
3980
|
+
width,
|
|
3981
|
+
height
|
|
3982
|
+
}
|
|
4296
3983
|
});
|
|
4297
3984
|
this.performTransform(transform);
|
|
4298
3985
|
}
|
|
@@ -4303,8 +3990,10 @@ var UserTransformableViewportConfigurator = class UserTransformableViewportConfi
|
|
|
4303
3990
|
const transform = this.params.transformPreprocessor({
|
|
4304
3991
|
prevTransform,
|
|
4305
3992
|
nextTransform,
|
|
4306
|
-
|
|
4307
|
-
|
|
3993
|
+
viewport: {
|
|
3994
|
+
width,
|
|
3995
|
+
height
|
|
3996
|
+
}
|
|
4308
3997
|
});
|
|
4309
3998
|
this.performTransform(transform);
|
|
4310
3999
|
}
|
|
@@ -4346,8 +4035,10 @@ var UserTransformableViewportConfigurator = class UserTransformableViewportConfi
|
|
|
4346
4035
|
const transform = this.params.transformPreprocessor({
|
|
4347
4036
|
prevTransform,
|
|
4348
4037
|
nextTransform: prevTransform,
|
|
4349
|
-
|
|
4350
|
-
|
|
4038
|
+
viewport: {
|
|
4039
|
+
width,
|
|
4040
|
+
height
|
|
4041
|
+
}
|
|
4351
4042
|
});
|
|
4352
4043
|
this.params.onResizeTransformStarted();
|
|
4353
4044
|
this.canvas.patchViewportMatrix(transform);
|
|
@@ -5250,9 +4941,9 @@ var noopFn = () => {};
|
|
|
5250
4941
|
//#endregion
|
|
5251
4942
|
//#region src/canvas-builder/shared/resolve-dragging-port-direction-resolver/resolve-dragging-port-direction-resolver.ts
|
|
5252
4943
|
var resolveDraggingPortDirectionResolver = (config, graph, connectionAllowedVerifier) => {
|
|
5253
|
-
if (config === "closest-connectable-port") return new NearestConnectablePortDraggingPortDirectionResolver(graph, connectionAllowedVerifier);
|
|
5254
4944
|
if (config === "nearest-connectable-port") return new NearestConnectablePortDraggingPortDirectionResolver(graph, connectionAllowedVerifier);
|
|
5255
|
-
return new ConstantDraggingPortDirectionResolver(config);
|
|
4945
|
+
if (typeof config === "number") return new ConstantDraggingPortDirectionResolver(config);
|
|
4946
|
+
return new ConstantDraggingPortDirectionResolver(void 0);
|
|
5256
4947
|
};
|
|
5257
4948
|
//#endregion
|
|
5258
4949
|
//#region src/canvas-builder/shared/resolve-edge-shape-factory/resolve-edge-shape-factory.ts
|
|
@@ -5272,30 +4963,6 @@ var resolveEdgeShapeFactory = (config) => {
|
|
|
5272
4963
|
detourDistance: config.detourDistance,
|
|
5273
4964
|
detourDirection: config.detourDirection
|
|
5274
4965
|
});
|
|
5275
|
-
case "horizontal": return () => new HorizontalEdgeShape({
|
|
5276
|
-
color: config.color,
|
|
5277
|
-
width: config.width,
|
|
5278
|
-
arrowLength: config.arrowLength,
|
|
5279
|
-
arrowOffset: config.arrowOffset,
|
|
5280
|
-
arrowRenderer: config.arrowRenderer,
|
|
5281
|
-
hasSourceArrow: config.hasSourceArrow,
|
|
5282
|
-
hasTargetArrow: config.hasTargetArrow,
|
|
5283
|
-
cycleSquareSide: config.cycleSquareSide,
|
|
5284
|
-
roundness: config.roundness,
|
|
5285
|
-
detourDistance: config.detourDistance
|
|
5286
|
-
});
|
|
5287
|
-
case "vertical": return () => new VerticalEdgeShape({
|
|
5288
|
-
color: config.color,
|
|
5289
|
-
width: config.width,
|
|
5290
|
-
arrowLength: config.arrowLength,
|
|
5291
|
-
arrowOffset: config.arrowOffset,
|
|
5292
|
-
arrowRenderer: config.arrowRenderer,
|
|
5293
|
-
hasSourceArrow: config.hasSourceArrow,
|
|
5294
|
-
hasTargetArrow: config.hasTargetArrow,
|
|
5295
|
-
cycleSquareSide: config.cycleSquareSide,
|
|
5296
|
-
roundness: config.roundness,
|
|
5297
|
-
detourDistance: config.detourDistance
|
|
5298
|
-
});
|
|
5299
4966
|
case "orthogonal": return () => new OrthogonalEdgeShape({
|
|
5300
4967
|
color: config.color,
|
|
5301
4968
|
width: config.width,
|
|
@@ -5369,10 +5036,10 @@ var createShiftLimitTransformPreprocessor = (preprocessorParams) => {
|
|
|
5369
5036
|
let dx = params.nextTransform.x;
|
|
5370
5037
|
let dy = params.nextTransform.y;
|
|
5371
5038
|
if (dx < minX && dx < params.prevTransform.x) dx = Math.min(params.prevTransform.x, minX);
|
|
5372
|
-
const maxScreenX = maxX - params.
|
|
5039
|
+
const maxScreenX = maxX - params.viewport.width * params.prevTransform.scale;
|
|
5373
5040
|
if (dx > maxScreenX && dx > params.prevTransform.x) dx = Math.max(params.prevTransform.x, maxScreenX);
|
|
5374
5041
|
if (dy < minY && dy < params.prevTransform.y) dy = Math.min(params.prevTransform.y, minY);
|
|
5375
|
-
const maxScreenY = maxY - params.
|
|
5042
|
+
const maxScreenY = maxY - params.viewport.height * params.prevTransform.scale;
|
|
5376
5043
|
if (dy > maxScreenY && dy > params.prevTransform.y) dy = Math.max(params.prevTransform.y, maxScreenY);
|
|
5377
5044
|
return {
|
|
5378
5045
|
scale: params.nextTransform.scale,
|
|
@@ -5420,8 +5087,7 @@ var createCombinedTransformPreprocessor = (preprocessors) => {
|
|
|
5420
5087
|
return preprocessors.reduce((acc, cur) => cur({
|
|
5421
5088
|
prevTransform: params.prevTransform,
|
|
5422
5089
|
nextTransform: acc,
|
|
5423
|
-
|
|
5424
|
-
canvasHeight: params.canvasHeight
|
|
5090
|
+
viewport: params.viewport
|
|
5425
5091
|
}), params.nextTransform);
|
|
5426
5092
|
};
|
|
5427
5093
|
};
|
|
@@ -5454,10 +5120,10 @@ var createTransformableViewportParams = (transformConfig) => {
|
|
|
5454
5120
|
else transformPreprocessor = (params) => {
|
|
5455
5121
|
return params.nextTransform;
|
|
5456
5122
|
};
|
|
5457
|
-
const shiftCursor = transformConfig?.
|
|
5458
|
-
const defaultMouseDownEventVerifier = transformConfig?.
|
|
5123
|
+
const shiftCursor = transformConfig?.pan?.cursor !== void 0 ? transformConfig.pan.cursor : "grab";
|
|
5124
|
+
const defaultMouseDownEventVerifier = transformConfig?.pan?.mouseDownEventVerifier;
|
|
5459
5125
|
const mouseDownEventVerifier = defaultMouseDownEventVerifier !== void 0 ? defaultMouseDownEventVerifier : (event) => event.button === 0;
|
|
5460
|
-
const defaultMouseUpEventVerifier = transformConfig?.
|
|
5126
|
+
const defaultMouseUpEventVerifier = transformConfig?.pan?.mouseUpEventVerifier;
|
|
5461
5127
|
const mouseUpEventVerifier = defaultMouseUpEventVerifier !== void 0 ? defaultMouseUpEventVerifier : (event) => event.button === 0;
|
|
5462
5128
|
const defaultMouseWheelEventVerifier = transformConfig?.scale?.mouseWheelEventVerifier;
|
|
5463
5129
|
const mouseWheelEventVerifier = defaultMouseWheelEventVerifier !== void 0 ? defaultMouseWheelEventVerifier : () => true;
|
|
@@ -5534,7 +5200,7 @@ var createConnectablePortsParams = (config, defaultEdgeShapeFactory, graph) => {
|
|
|
5534
5200
|
var defaults$2 = Object.freeze({
|
|
5535
5201
|
connectionAllowedVerifier: () => true,
|
|
5536
5202
|
connectionPreprocessor: (request) => request,
|
|
5537
|
-
mouseDownEventVerifier: (event) => event.button === 0
|
|
5203
|
+
mouseDownEventVerifier: (event) => event.button === 0,
|
|
5538
5204
|
mouseUpEventVerifier: (event) => event.button === 0
|
|
5539
5205
|
});
|
|
5540
5206
|
//#endregion
|
|
@@ -6221,7 +5887,7 @@ var ForceDirectedLayoutAlgorithm = class {
|
|
|
6221
5887
|
this.nodeMass = params.nodeMass;
|
|
6222
5888
|
this.edgeEquilibriumLength = params.edgeEquilibriumLength;
|
|
6223
5889
|
this.edgeStiffness = params.edgeStiffness;
|
|
6224
|
-
this.convergenceVelocity = params.
|
|
5890
|
+
this.convergenceVelocity = params.stopVelocity;
|
|
6225
5891
|
this.distanceVectorGenerator = new DistanceVectorGenerator(params.rand);
|
|
6226
5892
|
this.nodeForcesApplicationStrategy = resolveNodeForcesApplicationStrategy({
|
|
6227
5893
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
@@ -6477,7 +6143,7 @@ var ForceDirectedAnimatedLayoutAlgorithm = class {
|
|
|
6477
6143
|
edgeStiffness;
|
|
6478
6144
|
fillerLayoutAlgorithm;
|
|
6479
6145
|
constructor(params) {
|
|
6480
|
-
this.convergenceVelocity = params.
|
|
6146
|
+
this.convergenceVelocity = params.stopVelocity;
|
|
6481
6147
|
this.maxTimeDeltaSec = params.maxTimeDeltaSec;
|
|
6482
6148
|
this.nodeMass = params.nodeMass;
|
|
6483
6149
|
this.edgeEquilibriumLength = params.edgeEquilibriumLength;
|
|
@@ -6576,7 +6242,7 @@ var resolveAnimatedLayoutAlgorithm = (config) => {
|
|
|
6576
6242
|
nodeMass: config?.nodeMass ?? forceDirectedDefaults.nodeMass,
|
|
6577
6243
|
edgeEquilibriumLength: config?.edgeEquilibriumLength ?? forceDirectedDefaults.edgeEquilibriumLength,
|
|
6578
6244
|
edgeStiffness: config?.edgeStiffness ?? forceDirectedDefaults.edgeStiffness,
|
|
6579
|
-
|
|
6245
|
+
stopVelocity: config?.stopVelocity ?? forceDirectedDefaults.convergenceVelocity,
|
|
6580
6246
|
maxForce: config?.maxForce ?? forceDirectedDefaults.maxForce,
|
|
6581
6247
|
nodeForceCoefficient: config?.nodeForceCoefficient ?? forceDirectedDefaults.nodeForceCoefficient,
|
|
6582
6248
|
barnesHutTheta: config?.barnesHut?.theta ?? forceDirectedDefaults.barnesHutTheta,
|
|
@@ -6605,14 +6271,6 @@ var resolveLayoutApplyOn = (applyOn) => {
|
|
|
6605
6271
|
type: "trigger",
|
|
6606
6272
|
trigger: applyOn
|
|
6607
6273
|
};
|
|
6608
|
-
if (applyOn === "topologyChangeMicrotask") return {
|
|
6609
|
-
type: "topologyChangeSchedule",
|
|
6610
|
-
schedule: microtaskScheduleFn
|
|
6611
|
-
};
|
|
6612
|
-
if (applyOn?.type === "topologyChangeMacrotask") return {
|
|
6613
|
-
type: "topologyChangeSchedule",
|
|
6614
|
-
schedule: macrotaskScheduleFn
|
|
6615
|
-
};
|
|
6616
6274
|
return {
|
|
6617
6275
|
type: "topologyChangeSchedule",
|
|
6618
6276
|
schedule: microtaskScheduleFn
|
|
@@ -6808,7 +6466,7 @@ var resolveLayoutAlgorithm = (config) => {
|
|
|
6808
6466
|
nodeMass: config?.nodeMass ?? forceDirectedDefaults.nodeMass,
|
|
6809
6467
|
edgeEquilibriumLength: config?.edgeEquilibriumLength ?? forceDirectedDefaults.edgeEquilibriumLength,
|
|
6810
6468
|
edgeStiffness: config?.edgeStiffness ?? forceDirectedDefaults.edgeStiffness,
|
|
6811
|
-
|
|
6469
|
+
stopVelocity: config?.stopVelocity ?? forceDirectedDefaults.convergenceVelocity,
|
|
6812
6470
|
maxForce: config?.maxForce ?? forceDirectedDefaults.maxForce,
|
|
6813
6471
|
nodeForceCoefficient: config?.nodeForceCoefficient ?? forceDirectedDefaults.nodeForceCoefficient,
|
|
6814
6472
|
barnesHutTheta: config?.barnesHut?.theta ?? forceDirectedDefaults.barnesHutTheta,
|
|
@@ -6923,7 +6581,7 @@ var createViewportControllerParams = (params) => {
|
|
|
6923
6581
|
const { canvasDefaults } = params;
|
|
6924
6582
|
const schedule = params.hasLayout ? resolveLayoutFocusSchedule(params.layoutParams) : immediateScheduleFn;
|
|
6925
6583
|
return { focus: {
|
|
6926
|
-
contentPadding: canvasDefaults.focus?.contentPadding ??
|
|
6584
|
+
contentPadding: canvasDefaults.focus?.contentPadding ?? 100,
|
|
6927
6585
|
minContentScale: canvasDefaults.focus?.minContentScale ?? 0,
|
|
6928
6586
|
schedule,
|
|
6929
6587
|
animationDuration: canvasDefaults.focus?.animationDuration ?? 0
|
|
@@ -7122,4 +6780,4 @@ var CanvasBuilder = class {
|
|
|
7122
6780
|
}
|
|
7123
6781
|
};
|
|
7124
6782
|
//#endregion
|
|
7125
|
-
export { BezierEdgeShape, CanvasBuilder, CanvasBuilderError, CanvasError, ConnectionCategory, DirectEdgeShape, EventSubject,
|
|
6783
|
+
export { BezierEdgeShape, CanvasBuilder, CanvasBuilderError, CanvasError, ConnectionCategory, DirectEdgeShape, EventSubject, InteractiveEdgeError, InteractiveEdgeShape, MidpointEdgeShape, OrthogonalEdgeShape, StraightEdgeShape };
|