@html-graph/html-graph 8.23.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.
@@ -81,7 +81,7 @@ var CoreHtmlView = class {
81
81
  this.attachedNodeIds.delete(nodeId);
82
82
  }
83
83
  attachEdge(edgeId) {
84
- const svg = this.graphStore.getEdge(edgeId).payload.shape.svg;
84
+ const svg = this.graphStore.getEdge(edgeId).payload.shape.element;
85
85
  this.edgeIdToElementMap.set(edgeId, svg);
86
86
  this.container.appendChild(svg);
87
87
  this.renderEdge(edgeId);
@@ -121,11 +121,11 @@ var CoreHtmlView = class {
121
121
  node.element.style.zIndex = `${node.payload.priority}`;
122
122
  }
123
123
  updateEdgeShape(edgeId) {
124
- const element = this.edgeIdToElementMap.get(edgeId);
125
- this.container.removeChild(element);
126
- const svg = this.graphStore.getEdge(edgeId).payload.shape.svg;
127
- this.edgeIdToElementMap.set(edgeId, svg);
128
- this.container.appendChild(svg);
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);
@@ -148,7 +148,7 @@ var CoreHtmlView = class {
148
148
  }
149
149
  updateEdgePriority(edgeId) {
150
150
  const edge = this.graphStore.getEdge(edgeId);
151
- edge.payload.shape.svg.style.zIndex = `${edge.payload.priority}`;
151
+ edge.payload.shape.element.style.zIndex = `${edge.payload.priority}`;
152
152
  }
153
153
  createEdgeRenderPort(port, rectPort, rectCanvas, scale) {
154
154
  const contentPoint = this.viewportStore.createContentCoords({
@@ -757,7 +757,7 @@ var GraphStore = class {
757
757
  if (this.hasEdge(request.id)) throw new CanvasError(canvasErrorText.addEdgeWithExistingId(request.id));
758
758
  if (!this.hasPort(request.from)) throw new CanvasError(canvasErrorText.addEdgeFromNonexistentPort(request.id, request.from));
759
759
  if (!this.hasPort(request.to)) throw new CanvasError(canvasErrorText.addEdgeToNonexistentPort(request.id, request.to));
760
- const useEdgeId = this.findEdgeIdByElement(request.shape.svg);
760
+ const useEdgeId = this.findEdgeIdByElement(request.shape.element);
761
761
  if (useEdgeId !== void 0) throw new CanvasError(canvasErrorText.addEdgeWithElementInUse(request.id, useEdgeId));
762
762
  this.addEdgeInternal(request);
763
763
  this.afterEdgeAddedEmitter.emit(request.id);
@@ -898,7 +898,7 @@ var GraphStore = class {
898
898
  priority: request.priority
899
899
  }
900
900
  });
901
- this.edgesElementsMap.set(request.shape.svg, request.id);
901
+ this.edgesElementsMap.set(request.shape.element, request.id);
902
902
  if (request.from !== request.to) {
903
903
  this.portOutgoingEdges.get(request.from).add(request.id);
904
904
  this.portIncomingEdges.get(request.to).add(request.id);
@@ -913,7 +913,7 @@ var GraphStore = class {
913
913
  this.portOutgoingEdges.get(from).delete(edgeId);
914
914
  this.portOutgoingEdges.get(to).delete(edgeId);
915
915
  this.edges.delete(edgeId);
916
- this.edgesElementsMap.delete(payload.shape.svg);
916
+ this.edgesElementsMap.delete(payload.shape.element);
917
917
  }
918
918
  };
919
919
  //#endregion
@@ -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;
@@ -2131,7 +2057,7 @@ var createDirectionVector = (dir) => {
2131
2057
  //#region src/edges/shapes/path-edge-shape/path-edge-shape.ts
2132
2058
  var PathEdgeShape = class {
2133
2059
  params;
2134
- svg;
2060
+ element;
2135
2061
  group = document.createElementNS("http://www.w3.org/2000/svg", "g");
2136
2062
  line;
2137
2063
  sourceArrow = null;
@@ -2143,8 +2069,8 @@ var PathEdgeShape = class {
2143
2069
  this.params = params;
2144
2070
  [this.afterRenderEmitter, this.onAfterRender] = createPair();
2145
2071
  this.arrowRenderer = this.params.arrowRenderer;
2146
- this.svg = createEdgeSvg(params.color);
2147
- this.svg.appendChild(this.group);
2072
+ this.element = createEdgeSvg(params.color);
2073
+ this.element.appendChild(this.group);
2148
2074
  this.line = createEdgePath(params.width);
2149
2075
  this.group.appendChild(this.line);
2150
2076
  if (params.hasSourceArrow) {
@@ -2158,7 +2084,7 @@ var PathEdgeShape = class {
2158
2084
  }
2159
2085
  render(params) {
2160
2086
  const { x, y, width, height, from, to } = createEdgeRectangle(params.from, params.to, this.params.padding);
2161
- setSvgRectangle(this.svg, {
2087
+ setSvgRectangle(this.element, {
2162
2088
  x,
2163
2089
  y,
2164
2090
  width,
@@ -2316,7 +2242,7 @@ var resolveArrowRenderer = (config) => {
2316
2242
  //#endregion
2317
2243
  //#region src/edges/shapes/bezier-edge-shape/bezier-edge-shape.ts
2318
2244
  var BezierEdgeShape = class {
2319
- svg;
2245
+ element;
2320
2246
  group;
2321
2247
  line;
2322
2248
  sourceArrow;
@@ -2382,7 +2308,7 @@ var BezierEdgeShape = class {
2382
2308
  createLinePath: this.createLinePath,
2383
2309
  padding: 50
2384
2310
  });
2385
- this.svg = this.pathShape.svg;
2311
+ this.element = this.pathShape.element;
2386
2312
  this.group = this.pathShape.group;
2387
2313
  this.line = this.pathShape.line;
2388
2314
  this.sourceArrow = this.pathShape.sourceArrow;
@@ -2394,110 +2320,9 @@ var BezierEdgeShape = class {
2394
2320
  }
2395
2321
  };
2396
2322
  //#endregion
2397
- //#region src/edges/shapes/horizontal-edge-shape/horizontalize-directions/horizontalize-direction.ts
2398
- var horizontalizeDirection = (direction) => {
2399
- return Math.cos(direction) > 0 ? 0 : Math.PI;
2400
- };
2401
- //#endregion
2402
- //#region src/edges/shapes/horizontal-edge-shape/horizontal-edge-shape.ts
2403
- /**
2404
- * @deprecated
2405
- * use OrthogonalEdgeShape instead
2406
- */
2407
- var HorizontalEdgeShape = class {
2408
- svg;
2409
- group;
2410
- line;
2411
- sourceArrow;
2412
- targetArrow;
2413
- onAfterRender;
2414
- arrowLength;
2415
- arrowOffset;
2416
- roundness;
2417
- cycleSquareSide;
2418
- detourDistance;
2419
- hasSourceArrow;
2420
- hasTargetArrow;
2421
- pathShape;
2422
- createCyclePath = (from, _to, fromDir) => new CycleSquareEdgePath({
2423
- origin: from,
2424
- dir: fromDir,
2425
- arrowLength: this.arrowLength,
2426
- side: this.cycleSquareSide,
2427
- arrowOffset: this.arrowOffset,
2428
- roundness: this.roundness,
2429
- hasArrow: this.hasSourceArrow || this.hasTargetArrow
2430
- });
2431
- createDetourPath = (from, to, fromDir, toDir) => new DetourHorizontalEdgePath({
2432
- from,
2433
- to,
2434
- fromDir,
2435
- toDir,
2436
- arrowLength: this.arrowLength,
2437
- arrowOffset: this.arrowOffset,
2438
- roundness: this.roundness,
2439
- detourDistance: this.detourDistance,
2440
- hasSourceArrow: this.hasSourceArrow,
2441
- hasTargetArrow: this.hasTargetArrow
2442
- });
2443
- createLinePath = (from, to, fromDir, toDir) => new HorizontalEdgePath({
2444
- from,
2445
- to,
2446
- fromDir,
2447
- toDir,
2448
- arrowLength: this.arrowLength,
2449
- arrowOffset: this.arrowOffset,
2450
- roundness: this.roundness,
2451
- hasSourceArrow: this.hasSourceArrow,
2452
- hasTargetArrow: this.hasTargetArrow
2453
- });
2454
- constructor(params) {
2455
- this.arrowLength = params?.arrowLength ?? edgeConstants.arrowLength;
2456
- this.arrowOffset = params?.arrowOffset ?? edgeConstants.arrowOffset;
2457
- this.cycleSquareSide = params?.cycleSquareSide ?? edgeConstants.cycleSquareSide;
2458
- const roundness = params?.roundness ?? edgeConstants.roundness;
2459
- this.roundness = Math.min(roundness, this.arrowOffset, this.cycleSquareSide / 2);
2460
- this.detourDistance = params?.detourDistance ?? edgeConstants.detourDistance;
2461
- this.hasSourceArrow = params?.hasSourceArrow ?? edgeConstants.hasSourceArrow;
2462
- this.hasTargetArrow = params?.hasTargetArrow ?? edgeConstants.hasTargetArrow;
2463
- this.pathShape = new PathEdgeShape({
2464
- color: params?.color ?? edgeConstants.color,
2465
- width: params?.width ?? edgeConstants.width,
2466
- arrowRenderer: resolveArrowRenderer(params?.arrowRenderer ?? {}),
2467
- arrowLength: this.arrowLength,
2468
- hasSourceArrow: this.hasSourceArrow,
2469
- hasTargetArrow: this.hasTargetArrow,
2470
- createCyclePath: this.createCyclePath,
2471
- createDetourPath: this.createDetourPath,
2472
- createLinePath: this.createLinePath,
2473
- padding: 50
2474
- });
2475
- this.svg = this.pathShape.svg;
2476
- this.group = this.pathShape.group;
2477
- this.line = this.pathShape.line;
2478
- this.sourceArrow = this.pathShape.sourceArrow;
2479
- this.targetArrow = this.pathShape.targetArrow;
2480
- this.onAfterRender = this.pathShape.onAfterRender;
2481
- }
2482
- render(params) {
2483
- const { from, to, category } = params;
2484
- this.pathShape.render({
2485
- category,
2486
- from: {
2487
- ...from,
2488
- direction: horizontalizeDirection(from.direction)
2489
- },
2490
- to: {
2491
- ...to,
2492
- direction: horizontalizeDirection(to.direction)
2493
- }
2494
- });
2495
- }
2496
- };
2497
- //#endregion
2498
2323
  //#region src/edges/shapes/straight-edge-shape/straight-edge-shape.ts
2499
2324
  var StraightEdgeShape = class {
2500
- svg;
2325
+ element;
2501
2326
  group;
2502
2327
  line;
2503
2328
  sourceArrow;
@@ -2567,7 +2392,7 @@ var StraightEdgeShape = class {
2567
2392
  createLinePath: this.createLinePath,
2568
2393
  padding: 50
2569
2394
  });
2570
- this.svg = this.pathShape.svg;
2395
+ this.element = this.pathShape.element;
2571
2396
  this.group = this.pathShape.group;
2572
2397
  this.line = this.pathShape.line;
2573
2398
  this.sourceArrow = this.pathShape.sourceArrow;
@@ -2579,108 +2404,6 @@ var StraightEdgeShape = class {
2579
2404
  }
2580
2405
  };
2581
2406
  //#endregion
2582
- //#region src/edges/shapes/vertical-edge-shape/verticalize-directions/verticalize-direction.ts
2583
- var pi2 = Math.PI / 2;
2584
- var verticalizeDirection = (direction) => {
2585
- return Math.sin(direction) > 0 ? pi2 : -pi2;
2586
- };
2587
- //#endregion
2588
- //#region src/edges/shapes/vertical-edge-shape/vertical-edge-shape.ts
2589
- /**
2590
- * @deprecated
2591
- * use OrthogonalEdgeShape instead
2592
- */
2593
- var VerticalEdgeShape = class {
2594
- svg;
2595
- group;
2596
- line;
2597
- sourceArrow;
2598
- targetArrow;
2599
- onAfterRender;
2600
- arrowLength;
2601
- arrowOffset;
2602
- roundness;
2603
- cycleSquareSide;
2604
- detourDistance;
2605
- hasSourceArrow;
2606
- hasTargetArrow;
2607
- pathShape;
2608
- createCyclePath = (from, _to, fromDir) => new CycleSquareEdgePath({
2609
- origin: from,
2610
- dir: fromDir,
2611
- arrowLength: this.arrowLength,
2612
- side: this.cycleSquareSide,
2613
- arrowOffset: this.arrowOffset,
2614
- roundness: this.roundness,
2615
- hasArrow: this.hasSourceArrow || this.hasTargetArrow
2616
- });
2617
- createDetourPath = (from, to, fromDir, toDir) => new DetourVerticalEdgePath({
2618
- from,
2619
- to,
2620
- fromDir,
2621
- toDir,
2622
- arrowLength: this.arrowLength,
2623
- arrowOffset: this.arrowOffset,
2624
- roundness: this.roundness,
2625
- detourDistance: this.detourDistance,
2626
- hasSourceArrow: this.hasSourceArrow,
2627
- hasTargetArrow: this.hasTargetArrow
2628
- });
2629
- createLinePath = (from, to, fromDir, toDir) => new VerticalEdgePath({
2630
- from,
2631
- to,
2632
- fromDir,
2633
- toDir,
2634
- arrowLength: this.arrowLength,
2635
- arrowOffset: this.arrowOffset,
2636
- roundness: this.roundness,
2637
- hasSourceArrow: this.hasSourceArrow,
2638
- hasTargetArrow: this.hasTargetArrow
2639
- });
2640
- constructor(params) {
2641
- this.arrowLength = params?.arrowLength ?? edgeConstants.arrowLength;
2642
- this.arrowOffset = params?.arrowOffset ?? edgeConstants.arrowOffset;
2643
- this.cycleSquareSide = params?.cycleSquareSide ?? edgeConstants.cycleSquareSide;
2644
- const roundness = params?.roundness ?? edgeConstants.roundness;
2645
- this.roundness = Math.min(roundness, this.arrowOffset, this.cycleSquareSide / 2);
2646
- this.detourDistance = params?.detourDistance ?? edgeConstants.detourDistance;
2647
- this.hasSourceArrow = params?.hasSourceArrow ?? edgeConstants.hasSourceArrow;
2648
- this.hasTargetArrow = params?.hasTargetArrow ?? edgeConstants.hasTargetArrow;
2649
- this.pathShape = new PathEdgeShape({
2650
- color: params?.color ?? edgeConstants.color,
2651
- width: params?.width ?? edgeConstants.width,
2652
- arrowRenderer: resolveArrowRenderer(params?.arrowRenderer ?? {}),
2653
- arrowLength: this.arrowLength,
2654
- hasSourceArrow: this.hasSourceArrow,
2655
- hasTargetArrow: this.hasTargetArrow,
2656
- createCyclePath: this.createCyclePath,
2657
- createDetourPath: this.createDetourPath,
2658
- createLinePath: this.createLinePath,
2659
- padding: 50
2660
- });
2661
- this.svg = this.pathShape.svg;
2662
- this.group = this.pathShape.group;
2663
- this.line = this.pathShape.line;
2664
- this.sourceArrow = this.pathShape.sourceArrow;
2665
- this.targetArrow = this.pathShape.targetArrow;
2666
- this.onAfterRender = this.pathShape.onAfterRender;
2667
- }
2668
- render(params) {
2669
- const { from, to, category } = params;
2670
- this.pathShape.render({
2671
- category,
2672
- from: {
2673
- ...from,
2674
- direction: verticalizeDirection(from.direction)
2675
- },
2676
- to: {
2677
- ...to,
2678
- direction: verticalizeDirection(to.direction)
2679
- }
2680
- });
2681
- }
2682
- };
2683
- //#endregion
2684
2407
  //#region src/edges/shapes/orthogonal-edge-shape/orthogonalize-direction/orthogonalize-direction.ts
2685
2408
  var orthogonalizeDirection = (direction) => {
2686
2409
  const adjDir = direction + Math.PI / 4;
@@ -2696,7 +2419,7 @@ var orthogonalizeDirection = (direction) => {
2696
2419
  //#endregion
2697
2420
  //#region src/edges/shapes/orthogonal-edge-shape/orthogonal-edge-shape.ts
2698
2421
  var OrthogonalEdgeShape = class {
2699
- svg;
2422
+ element;
2700
2423
  group;
2701
2424
  line;
2702
2425
  sourceArrow;
@@ -2763,7 +2486,7 @@ var OrthogonalEdgeShape = class {
2763
2486
  createLinePath: this.createLinePath,
2764
2487
  padding: 50
2765
2488
  });
2766
- this.svg = this.pathShape.svg;
2489
+ this.element = this.pathShape.element;
2767
2490
  this.group = this.pathShape.group;
2768
2491
  this.line = this.pathShape.line;
2769
2492
  this.sourceArrow = this.pathShape.sourceArrow;
@@ -2809,7 +2532,7 @@ var resolvePortOffsetFn = (offset) => {
2809
2532
  //#region src/edges/shapes/direct-edge-shape/direct-edge-shape.ts
2810
2533
  var defaultPortOffset = edgeConstants.portOffset;
2811
2534
  var DirectEdgeShape = class {
2812
- svg;
2535
+ element;
2813
2536
  group = document.createElementNS("http://www.w3.org/2000/svg", "g");
2814
2537
  line;
2815
2538
  sourceArrow = null;
@@ -2830,8 +2553,8 @@ var DirectEdgeShape = class {
2830
2553
  this.arrowRenderer = resolveArrowRenderer(params?.arrowRenderer ?? {});
2831
2554
  this.sourceOffsetFn = resolvePortOffsetFn(params?.sourceOffset ?? defaultPortOffset);
2832
2555
  this.targetOffsetFn = resolvePortOffsetFn(params?.targetOffset ?? defaultPortOffset);
2833
- this.svg = createEdgeSvg(this.color);
2834
- this.svg.appendChild(this.group);
2556
+ this.element = createEdgeSvg(this.color);
2557
+ this.element.appendChild(this.group);
2835
2558
  this.line = createEdgePath(this.width);
2836
2559
  this.group.appendChild(this.line);
2837
2560
  if (params?.hasSourceArrow) {
@@ -2845,7 +2568,7 @@ var DirectEdgeShape = class {
2845
2568
  }
2846
2569
  render(params) {
2847
2570
  const { x, y, width, height, from, to } = createEdgeRectangle(params.from, params.to, 50);
2848
- setSvgRectangle(this.svg, {
2571
+ setSvgRectangle(this.element, {
2849
2572
  x,
2850
2573
  y,
2851
2574
  width,
@@ -3010,15 +2733,11 @@ var InteractiveEdgeError = class extends Error {
3010
2733
  //#region src/edges/shapes/interactive-edge-shape/interactive-edge-shape.ts
3011
2734
  var InteractiveEdgeShape = class InteractiveEdgeShape {
3012
2735
  baseEdge;
3013
- svg;
2736
+ element;
3014
2737
  group;
3015
2738
  line;
3016
2739
  sourceArrow;
3017
2740
  targetArrow;
3018
- /**
3019
- * @deprecated
3020
- * use shape.svg instead
3021
- */
3022
2741
  handle = createEdgeGroup();
3023
2742
  onAfterRender;
3024
2743
  interactiveLine;
@@ -3027,7 +2746,7 @@ var InteractiveEdgeShape = class InteractiveEdgeShape {
3027
2746
  constructor(baseEdge, params) {
3028
2747
  this.baseEdge = baseEdge;
3029
2748
  if (baseEdge instanceof InteractiveEdgeShape) throw new InteractiveEdgeError("interactive edge can be configured only once");
3030
- this.svg = this.baseEdge.svg;
2749
+ this.element = this.baseEdge.element;
3031
2750
  this.group = this.baseEdge.group;
3032
2751
  this.line = this.baseEdge.line;
3033
2752
  this.sourceArrow = this.baseEdge.sourceArrow;
@@ -3065,17 +2784,17 @@ var MidpointEdgeShape = class {
3065
2784
  sourceArrow;
3066
2785
  targetArrow;
3067
2786
  onAfterRender;
3068
- svg;
2787
+ element;
3069
2788
  constructor(baseShape, midpointElement) {
3070
2789
  this.baseShape = baseShape;
3071
2790
  this.midpointElement = midpointElement;
3072
- this.svg = this.baseShape.svg;
2791
+ this.element = this.baseShape.element;
3073
2792
  this.group = this.baseShape.group;
3074
2793
  this.line = this.baseShape.line;
3075
2794
  this.sourceArrow = this.baseShape.sourceArrow;
3076
2795
  this.targetArrow = this.baseShape.targetArrow;
3077
2796
  this.onAfterRender = this.baseShape.onAfterRender;
3078
- this.svg.append(this.midpointElement);
2797
+ this.element.append(this.midpointElement);
3079
2798
  this.baseShape.onAfterRender.subscribe((model) => {
3080
2799
  const midpoint = model.edgePath.midpoint;
3081
2800
  const transform = `translate(${midpoint.x}px, ${midpoint.y}px)`;
@@ -3369,17 +3088,6 @@ var GraphController = class {
3369
3088
  }
3370
3089
  };
3371
3090
  //#endregion
3372
- //#region src/schedule-fn/macrotask-schedule-fn/macrotask-schedule-fn.ts
3373
- /**
3374
- * @deprecated
3375
- * use macrotaskScheduleFn instead
3376
- */
3377
- var macrotaskScheduleFn = (callback) => {
3378
- setTimeout(() => {
3379
- callback();
3380
- });
3381
- };
3382
- //#endregion
3383
3091
  //#region src/schedule-fn/microtask-schedule-fn/microtask-schedule-fn.ts
3384
3092
  var microtaskScheduleFn = (callback) => {
3385
3093
  queueMicrotask(() => {
@@ -3431,7 +3139,7 @@ var createFocusParams = (config, controllerParams) => {
3431
3139
  } : {
3432
3140
  minContentScale: config.minContentScale ?? controllerParams.focus.minContentScale,
3433
3141
  nodes: config.nodes ?? [],
3434
- contentPadding: config.contentPadding ?? config.contentOffset ?? controllerParams.focus.contentPadding,
3142
+ contentPadding: config.contentPadding ?? controllerParams.focus.contentPadding,
3435
3143
  animationDuration: config.animationDuration ?? controllerParams.focus.animationDuration
3436
3144
  };
3437
3145
  };
@@ -3983,12 +3691,7 @@ var UserDraggableNodesConfigurator = class UserDraggableNodesConfigurator {
3983
3691
  const element = event.currentTarget;
3984
3692
  const nodeId = this.canvas.graph.findNodeIdByElement(element);
3985
3693
  const node = this.graph.getNode(nodeId);
3986
- if (!this.params.nodeDragVerifier({
3987
- nodeId,
3988
- element: node.element,
3989
- x: node.x,
3990
- y: node.y
3991
- })) return;
3694
+ if (!this.params.nodeDragVerifier(nodeId)) return;
3992
3695
  this.eventTagger.tag(event, dragEventHandledTag);
3993
3696
  const cursorContent = this.calculateContentPoint({
3994
3697
  x: touch.clientX,
@@ -4273,8 +3976,10 @@ var UserTransformableViewportConfigurator = class UserTransformableViewportConfi
4273
3976
  const transform = this.params.transformPreprocessor({
4274
3977
  prevTransform,
4275
3978
  nextTransform,
4276
- canvasWidth: width,
4277
- canvasHeight: height
3979
+ viewport: {
3980
+ width,
3981
+ height
3982
+ }
4278
3983
  });
4279
3984
  this.performTransform(transform);
4280
3985
  }
@@ -4285,8 +3990,10 @@ var UserTransformableViewportConfigurator = class UserTransformableViewportConfi
4285
3990
  const transform = this.params.transformPreprocessor({
4286
3991
  prevTransform,
4287
3992
  nextTransform,
4288
- canvasWidth: width,
4289
- canvasHeight: height
3993
+ viewport: {
3994
+ width,
3995
+ height
3996
+ }
4290
3997
  });
4291
3998
  this.performTransform(transform);
4292
3999
  }
@@ -4328,8 +4035,10 @@ var UserTransformableViewportConfigurator = class UserTransformableViewportConfi
4328
4035
  const transform = this.params.transformPreprocessor({
4329
4036
  prevTransform,
4330
4037
  nextTransform: prevTransform,
4331
- canvasWidth: width,
4332
- canvasHeight: height
4038
+ viewport: {
4039
+ width,
4040
+ height
4041
+ }
4333
4042
  });
4334
4043
  this.params.onResizeTransformStarted();
4335
4044
  this.canvas.patchViewportMatrix(transform);
@@ -5081,16 +4790,16 @@ var UserSelectableEdgesConfigurator = class UserSelectableEdgesConfigurator {
5081
4790
  onEdgeSelected;
5082
4791
  onAfterEdgeAdded = (edgeId) => {
5083
4792
  const { shape } = this.canvas.graph.getEdge(edgeId);
5084
- this.configurator.enable(shape.svg);
4793
+ this.configurator.enable(shape.element);
5085
4794
  };
5086
4795
  onBeforeEdgeRemoved = (edgeId) => {
5087
4796
  const { shape } = this.canvas.graph.getEdge(edgeId);
5088
- this.configurator.disable(shape.svg);
4797
+ this.configurator.disable(shape.element);
5089
4798
  };
5090
4799
  reset = () => {
5091
4800
  this.canvas.graph.getAllEdgeIds().forEach((edgeId) => {
5092
4801
  const { shape } = this.canvas.graph.getEdge(edgeId);
5093
- this.configurator.disable(shape.svg);
4802
+ this.configurator.disable(shape.element);
5094
4803
  });
5095
4804
  };
5096
4805
  constructor(canvas, window, pointInsideVerifier, eventTagger, params) {
@@ -5232,9 +4941,9 @@ var noopFn = () => {};
5232
4941
  //#endregion
5233
4942
  //#region src/canvas-builder/shared/resolve-dragging-port-direction-resolver/resolve-dragging-port-direction-resolver.ts
5234
4943
  var resolveDraggingPortDirectionResolver = (config, graph, connectionAllowedVerifier) => {
5235
- if (config === "closest-connectable-port") return new NearestConnectablePortDraggingPortDirectionResolver(graph, connectionAllowedVerifier);
5236
4944
  if (config === "nearest-connectable-port") return new NearestConnectablePortDraggingPortDirectionResolver(graph, connectionAllowedVerifier);
5237
- return new ConstantDraggingPortDirectionResolver(config);
4945
+ if (typeof config === "number") return new ConstantDraggingPortDirectionResolver(config);
4946
+ return new ConstantDraggingPortDirectionResolver(void 0);
5238
4947
  };
5239
4948
  //#endregion
5240
4949
  //#region src/canvas-builder/shared/resolve-edge-shape-factory/resolve-edge-shape-factory.ts
@@ -5254,30 +4963,6 @@ var resolveEdgeShapeFactory = (config) => {
5254
4963
  detourDistance: config.detourDistance,
5255
4964
  detourDirection: config.detourDirection
5256
4965
  });
5257
- case "horizontal": return () => new HorizontalEdgeShape({
5258
- color: config.color,
5259
- width: config.width,
5260
- arrowLength: config.arrowLength,
5261
- arrowOffset: config.arrowOffset,
5262
- arrowRenderer: config.arrowRenderer,
5263
- hasSourceArrow: config.hasSourceArrow,
5264
- hasTargetArrow: config.hasTargetArrow,
5265
- cycleSquareSide: config.cycleSquareSide,
5266
- roundness: config.roundness,
5267
- detourDistance: config.detourDistance
5268
- });
5269
- case "vertical": return () => new VerticalEdgeShape({
5270
- color: config.color,
5271
- width: config.width,
5272
- arrowLength: config.arrowLength,
5273
- arrowOffset: config.arrowOffset,
5274
- arrowRenderer: config.arrowRenderer,
5275
- hasSourceArrow: config.hasSourceArrow,
5276
- hasTargetArrow: config.hasTargetArrow,
5277
- cycleSquareSide: config.cycleSquareSide,
5278
- roundness: config.roundness,
5279
- detourDistance: config.detourDistance
5280
- });
5281
4966
  case "orthogonal": return () => new OrthogonalEdgeShape({
5282
4967
  color: config.color,
5283
4968
  width: config.width,
@@ -5351,10 +5036,10 @@ var createShiftLimitTransformPreprocessor = (preprocessorParams) => {
5351
5036
  let dx = params.nextTransform.x;
5352
5037
  let dy = params.nextTransform.y;
5353
5038
  if (dx < minX && dx < params.prevTransform.x) dx = Math.min(params.prevTransform.x, minX);
5354
- const maxScreenX = maxX - params.canvasWidth * params.prevTransform.scale;
5039
+ const maxScreenX = maxX - params.viewport.width * params.prevTransform.scale;
5355
5040
  if (dx > maxScreenX && dx > params.prevTransform.x) dx = Math.max(params.prevTransform.x, maxScreenX);
5356
5041
  if (dy < minY && dy < params.prevTransform.y) dy = Math.min(params.prevTransform.y, minY);
5357
- const maxScreenY = maxY - params.canvasHeight * params.prevTransform.scale;
5042
+ const maxScreenY = maxY - params.viewport.height * params.prevTransform.scale;
5358
5043
  if (dy > maxScreenY && dy > params.prevTransform.y) dy = Math.max(params.prevTransform.y, maxScreenY);
5359
5044
  return {
5360
5045
  scale: params.nextTransform.scale,
@@ -5402,8 +5087,7 @@ var createCombinedTransformPreprocessor = (preprocessors) => {
5402
5087
  return preprocessors.reduce((acc, cur) => cur({
5403
5088
  prevTransform: params.prevTransform,
5404
5089
  nextTransform: acc,
5405
- canvasWidth: params.canvasWidth,
5406
- canvasHeight: params.canvasHeight
5090
+ viewport: params.viewport
5407
5091
  }), params.nextTransform);
5408
5092
  };
5409
5093
  };
@@ -5436,10 +5120,10 @@ var createTransformableViewportParams = (transformConfig) => {
5436
5120
  else transformPreprocessor = (params) => {
5437
5121
  return params.nextTransform;
5438
5122
  };
5439
- const shiftCursor = transformConfig?.shift?.cursor !== void 0 ? transformConfig.shift.cursor : "grab";
5440
- const defaultMouseDownEventVerifier = transformConfig?.shift?.mouseDownEventVerifier;
5123
+ const shiftCursor = transformConfig?.pan?.cursor !== void 0 ? transformConfig.pan.cursor : "grab";
5124
+ const defaultMouseDownEventVerifier = transformConfig?.pan?.mouseDownEventVerifier;
5441
5125
  const mouseDownEventVerifier = defaultMouseDownEventVerifier !== void 0 ? defaultMouseDownEventVerifier : (event) => event.button === 0;
5442
- const defaultMouseUpEventVerifier = transformConfig?.shift?.mouseUpEventVerifier;
5126
+ const defaultMouseUpEventVerifier = transformConfig?.pan?.mouseUpEventVerifier;
5443
5127
  const mouseUpEventVerifier = defaultMouseUpEventVerifier !== void 0 ? defaultMouseUpEventVerifier : (event) => event.button === 0;
5444
5128
  const defaultMouseWheelEventVerifier = transformConfig?.scale?.mouseWheelEventVerifier;
5445
5129
  const mouseWheelEventVerifier = defaultMouseWheelEventVerifier !== void 0 ? defaultMouseWheelEventVerifier : () => true;
@@ -5516,7 +5200,7 @@ var createConnectablePortsParams = (config, defaultEdgeShapeFactory, graph) => {
5516
5200
  var defaults$2 = Object.freeze({
5517
5201
  connectionAllowedVerifier: () => true,
5518
5202
  connectionPreprocessor: (request) => request,
5519
- mouseDownEventVerifier: (event) => event.button === 0 && event.ctrlKey,
5203
+ mouseDownEventVerifier: (event) => event.button === 0,
5520
5204
  mouseUpEventVerifier: (event) => event.button === 0
5521
5205
  });
5522
5206
  //#endregion
@@ -6203,7 +5887,7 @@ var ForceDirectedLayoutAlgorithm = class {
6203
5887
  this.nodeMass = params.nodeMass;
6204
5888
  this.edgeEquilibriumLength = params.edgeEquilibriumLength;
6205
5889
  this.edgeStiffness = params.edgeStiffness;
6206
- this.convergenceVelocity = params.convergenceVelocity;
5890
+ this.convergenceVelocity = params.stopVelocity;
6207
5891
  this.distanceVectorGenerator = new DistanceVectorGenerator(params.rand);
6208
5892
  this.nodeForcesApplicationStrategy = resolveNodeForcesApplicationStrategy({
6209
5893
  distanceVectorGenerator: this.distanceVectorGenerator,
@@ -6459,7 +6143,7 @@ var ForceDirectedAnimatedLayoutAlgorithm = class {
6459
6143
  edgeStiffness;
6460
6144
  fillerLayoutAlgorithm;
6461
6145
  constructor(params) {
6462
- this.convergenceVelocity = params.convergenceVelocity;
6146
+ this.convergenceVelocity = params.stopVelocity;
6463
6147
  this.maxTimeDeltaSec = params.maxTimeDeltaSec;
6464
6148
  this.nodeMass = params.nodeMass;
6465
6149
  this.edgeEquilibriumLength = params.edgeEquilibriumLength;
@@ -6558,7 +6242,7 @@ var resolveAnimatedLayoutAlgorithm = (config) => {
6558
6242
  nodeMass: config?.nodeMass ?? forceDirectedDefaults.nodeMass,
6559
6243
  edgeEquilibriumLength: config?.edgeEquilibriumLength ?? forceDirectedDefaults.edgeEquilibriumLength,
6560
6244
  edgeStiffness: config?.edgeStiffness ?? forceDirectedDefaults.edgeStiffness,
6561
- convergenceVelocity: config?.convergenceVelocity ?? forceDirectedDefaults.convergenceVelocity,
6245
+ stopVelocity: config?.stopVelocity ?? forceDirectedDefaults.convergenceVelocity,
6562
6246
  maxForce: config?.maxForce ?? forceDirectedDefaults.maxForce,
6563
6247
  nodeForceCoefficient: config?.nodeForceCoefficient ?? forceDirectedDefaults.nodeForceCoefficient,
6564
6248
  barnesHutTheta: config?.barnesHut?.theta ?? forceDirectedDefaults.barnesHutTheta,
@@ -6587,14 +6271,6 @@ var resolveLayoutApplyOn = (applyOn) => {
6587
6271
  type: "trigger",
6588
6272
  trigger: applyOn
6589
6273
  };
6590
- if (applyOn === "topologyChangeMicrotask") return {
6591
- type: "topologyChangeSchedule",
6592
- schedule: microtaskScheduleFn
6593
- };
6594
- if (applyOn?.type === "topologyChangeMacrotask") return {
6595
- type: "topologyChangeSchedule",
6596
- schedule: macrotaskScheduleFn
6597
- };
6598
6274
  return {
6599
6275
  type: "topologyChangeSchedule",
6600
6276
  schedule: microtaskScheduleFn
@@ -6790,7 +6466,7 @@ var resolveLayoutAlgorithm = (config) => {
6790
6466
  nodeMass: config?.nodeMass ?? forceDirectedDefaults.nodeMass,
6791
6467
  edgeEquilibriumLength: config?.edgeEquilibriumLength ?? forceDirectedDefaults.edgeEquilibriumLength,
6792
6468
  edgeStiffness: config?.edgeStiffness ?? forceDirectedDefaults.edgeStiffness,
6793
- convergenceVelocity: config?.convergenceVelocity ?? forceDirectedDefaults.convergenceVelocity,
6469
+ stopVelocity: config?.stopVelocity ?? forceDirectedDefaults.convergenceVelocity,
6794
6470
  maxForce: config?.maxForce ?? forceDirectedDefaults.maxForce,
6795
6471
  nodeForceCoefficient: config?.nodeForceCoefficient ?? forceDirectedDefaults.nodeForceCoefficient,
6796
6472
  barnesHutTheta: config?.barnesHut?.theta ?? forceDirectedDefaults.barnesHutTheta,
@@ -6905,7 +6581,7 @@ var createViewportControllerParams = (params) => {
6905
6581
  const { canvasDefaults } = params;
6906
6582
  const schedule = params.hasLayout ? resolveLayoutFocusSchedule(params.layoutParams) : immediateScheduleFn;
6907
6583
  return { focus: {
6908
- contentPadding: canvasDefaults.focus?.contentPadding ?? canvasDefaults.focus?.contentOffset ?? 100,
6584
+ contentPadding: canvasDefaults.focus?.contentPadding ?? 100,
6909
6585
  minContentScale: canvasDefaults.focus?.minContentScale ?? 0,
6910
6586
  schedule,
6911
6587
  animationDuration: canvasDefaults.focus?.animationDuration ?? 0
@@ -7104,4 +6780,4 @@ var CanvasBuilder = class {
7104
6780
  }
7105
6781
  };
7106
6782
  //#endregion
7107
- export { BezierEdgeShape, CanvasBuilder, CanvasBuilderError, CanvasError, ConnectionCategory, DirectEdgeShape, EventSubject, HorizontalEdgeShape, InteractiveEdgeError, InteractiveEdgeShape, MidpointEdgeShape, OrthogonalEdgeShape, StraightEdgeShape, VerticalEdgeShape, boxPortOffsetFn };
6783
+ export { BezierEdgeShape, CanvasBuilder, CanvasBuilderError, CanvasError, ConnectionCategory, DirectEdgeShape, EventSubject, InteractiveEdgeError, InteractiveEdgeShape, MidpointEdgeShape, OrthogonalEdgeShape, StraightEdgeShape };