@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.
@@ -85,7 +85,7 @@
85
85
  this.attachedNodeIds.delete(nodeId);
86
86
  }
87
87
  attachEdge(edgeId) {
88
- const svg = this.graphStore.getEdge(edgeId).payload.shape.svg;
88
+ const svg = this.graphStore.getEdge(edgeId).payload.shape.element;
89
89
  this.edgeIdToElementMap.set(edgeId, svg);
90
90
  this.container.appendChild(svg);
91
91
  this.renderEdge(edgeId);
@@ -125,11 +125,11 @@
125
125
  node.element.style.zIndex = `${node.payload.priority}`;
126
126
  }
127
127
  updateEdgeShape(edgeId) {
128
- const element = this.edgeIdToElementMap.get(edgeId);
129
- this.container.removeChild(element);
130
- const svg = this.graphStore.getEdge(edgeId).payload.shape.svg;
131
- this.edgeIdToElementMap.set(edgeId, svg);
132
- this.container.appendChild(svg);
128
+ const previousElement = this.edgeIdToElementMap.get(edgeId);
129
+ this.container.removeChild(previousElement);
130
+ const { element } = this.graphStore.getEdge(edgeId).payload.shape;
131
+ this.edgeIdToElementMap.set(edgeId, element);
132
+ this.container.appendChild(element);
133
133
  }
134
134
  renderEdge(edgeId) {
135
135
  const edge = this.graphStore.getEdge(edgeId);
@@ -152,7 +152,7 @@
152
152
  }
153
153
  updateEdgePriority(edgeId) {
154
154
  const edge = this.graphStore.getEdge(edgeId);
155
- edge.payload.shape.svg.style.zIndex = `${edge.payload.priority}`;
155
+ edge.payload.shape.element.style.zIndex = `${edge.payload.priority}`;
156
156
  }
157
157
  createEdgeRenderPort(port, rectPort, rectCanvas, scale) {
158
158
  const contentPoint = this.viewportStore.createContentCoords({
@@ -761,7 +761,7 @@
761
761
  if (this.hasEdge(request.id)) throw new CanvasError(canvasErrorText.addEdgeWithExistingId(request.id));
762
762
  if (!this.hasPort(request.from)) throw new CanvasError(canvasErrorText.addEdgeFromNonexistentPort(request.id, request.from));
763
763
  if (!this.hasPort(request.to)) throw new CanvasError(canvasErrorText.addEdgeToNonexistentPort(request.id, request.to));
764
- const useEdgeId = this.findEdgeIdByElement(request.shape.svg);
764
+ const useEdgeId = this.findEdgeIdByElement(request.shape.element);
765
765
  if (useEdgeId !== void 0) throw new CanvasError(canvasErrorText.addEdgeWithElementInUse(request.id, useEdgeId));
766
766
  this.addEdgeInternal(request);
767
767
  this.afterEdgeAddedEmitter.emit(request.id);
@@ -902,7 +902,7 @@
902
902
  priority: request.priority
903
903
  }
904
904
  });
905
- this.edgesElementsMap.set(request.shape.svg, request.id);
905
+ this.edgesElementsMap.set(request.shape.element, request.id);
906
906
  if (request.from !== request.to) {
907
907
  this.portOutgoingEdges.get(request.from).add(request.id);
908
908
  this.portIncomingEdges.get(request.to).add(request.id);
@@ -917,7 +917,7 @@
917
917
  this.portOutgoingEdges.get(from).delete(edgeId);
918
918
  this.portOutgoingEdges.get(to).delete(edgeId);
919
919
  this.edges.delete(edgeId);
920
- this.edgesElementsMap.delete(payload.shape.svg);
920
+ this.edgesElementsMap.delete(payload.shape.element);
921
921
  }
922
922
  };
923
923
  //#endregion
@@ -1667,43 +1667,6 @@
1667
1667
  return createVerticalSourceOrthogonalLine(from, to);
1668
1668
  };
1669
1669
  //#endregion
1670
- //#region src/edges/paths/horizontal-edge-path/horizontal-edge-path.ts
1671
- var HorizontalEdgePath = class {
1672
- path;
1673
- midpoint;
1674
- constructor(params) {
1675
- const { from, to, fromDir, toDir, arrowLength, arrowOffset, roundness, hasSourceArrow, hasTargetArrow } = params;
1676
- const beginArrow = hasSourceArrow ? createRotatedPoint({
1677
- x: from.x + arrowLength,
1678
- y: from.y
1679
- }, fromDir, from) : from;
1680
- const endArrow = hasTargetArrow ? createRotatedPoint({
1681
- x: to.x - arrowLength,
1682
- y: to.y
1683
- }, toDir, to) : to;
1684
- const gap = arrowLength + arrowOffset;
1685
- const beginLine = createRotatedPoint({
1686
- x: from.x + gap,
1687
- y: from.y
1688
- }, fromDir, from);
1689
- const endLine = createRotatedPoint({
1690
- x: to.x - gap,
1691
- y: to.y
1692
- }, toDir, to);
1693
- const line = createHorizontalLine({
1694
- arrowPoint: beginArrow,
1695
- linePoint: beginLine,
1696
- dir: fromDir
1697
- }, {
1698
- arrowPoint: endArrow,
1699
- linePoint: endLine,
1700
- dir: toDir
1701
- });
1702
- this.path = createRoundedPath(line.points, roundness);
1703
- this.midpoint = line.midpoint;
1704
- }
1705
- };
1706
- //#endregion
1707
1670
  //#region src/edges/paths/detour-straight-edge-path/detour-straight-edge-path.ts
1708
1671
  var DetourStraightEdgePath = class {
1709
1672
  path;
@@ -1791,43 +1754,6 @@
1791
1754
  }
1792
1755
  };
1793
1756
  //#endregion
1794
- //#region src/edges/paths/vertical-edge-path/vertical-edge-path.ts
1795
- var VerticalEdgePath = class {
1796
- path;
1797
- midpoint;
1798
- constructor(params) {
1799
- const { from, to, hasSourceArrow, hasTargetArrow, arrowLength, arrowOffset, fromDir, toDir, roundness } = params;
1800
- const beginArrow = hasSourceArrow ? createRotatedPoint({
1801
- x: from.x + arrowLength,
1802
- y: from.y
1803
- }, fromDir, from) : from;
1804
- const endArrow = hasTargetArrow ? createRotatedPoint({
1805
- x: to.x - arrowLength,
1806
- y: to.y
1807
- }, toDir, to) : to;
1808
- const gap = arrowLength + arrowOffset;
1809
- const beginLine = createRotatedPoint({
1810
- x: from.x + gap,
1811
- y: from.y
1812
- }, fromDir, from);
1813
- const endLine = createRotatedPoint({
1814
- x: to.x - gap,
1815
- y: to.y
1816
- }, toDir, to);
1817
- const line = createVerticalLine({
1818
- arrowPoint: beginArrow,
1819
- linePoint: beginLine,
1820
- dir: fromDir
1821
- }, {
1822
- arrowPoint: endArrow,
1823
- linePoint: endLine,
1824
- dir: toDir
1825
- });
1826
- this.path = createRoundedPath(line.points, roundness);
1827
- this.midpoint = line.midpoint;
1828
- }
1829
- };
1830
- //#endregion
1831
1757
  //#region src/edges/paths/orthogonal-edge-path/orthogonal-edge-path.ts
1832
1758
  var OrthogonalEdgePath = class {
1833
1759
  path;
@@ -2135,7 +2061,7 @@
2135
2061
  //#region src/edges/shapes/path-edge-shape/path-edge-shape.ts
2136
2062
  var PathEdgeShape = class {
2137
2063
  params;
2138
- svg;
2064
+ element;
2139
2065
  group = document.createElementNS("http://www.w3.org/2000/svg", "g");
2140
2066
  line;
2141
2067
  sourceArrow = null;
@@ -2147,8 +2073,8 @@
2147
2073
  this.params = params;
2148
2074
  [this.afterRenderEmitter, this.onAfterRender] = createPair();
2149
2075
  this.arrowRenderer = this.params.arrowRenderer;
2150
- this.svg = createEdgeSvg(params.color);
2151
- this.svg.appendChild(this.group);
2076
+ this.element = createEdgeSvg(params.color);
2077
+ this.element.appendChild(this.group);
2152
2078
  this.line = createEdgePath(params.width);
2153
2079
  this.group.appendChild(this.line);
2154
2080
  if (params.hasSourceArrow) {
@@ -2162,7 +2088,7 @@
2162
2088
  }
2163
2089
  render(params) {
2164
2090
  const { x, y, width, height, from, to } = createEdgeRectangle(params.from, params.to, this.params.padding);
2165
- setSvgRectangle(this.svg, {
2091
+ setSvgRectangle(this.element, {
2166
2092
  x,
2167
2093
  y,
2168
2094
  width,
@@ -2320,7 +2246,7 @@
2320
2246
  //#endregion
2321
2247
  //#region src/edges/shapes/bezier-edge-shape/bezier-edge-shape.ts
2322
2248
  var BezierEdgeShape = class {
2323
- svg;
2249
+ element;
2324
2250
  group;
2325
2251
  line;
2326
2252
  sourceArrow;
@@ -2386,7 +2312,7 @@
2386
2312
  createLinePath: this.createLinePath,
2387
2313
  padding: 50
2388
2314
  });
2389
- this.svg = this.pathShape.svg;
2315
+ this.element = this.pathShape.element;
2390
2316
  this.group = this.pathShape.group;
2391
2317
  this.line = this.pathShape.line;
2392
2318
  this.sourceArrow = this.pathShape.sourceArrow;
@@ -2398,110 +2324,9 @@
2398
2324
  }
2399
2325
  };
2400
2326
  //#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
- svg;
2413
- group;
2414
- line;
2415
- sourceArrow;
2416
- targetArrow;
2417
- onAfterRender;
2418
- arrowLength;
2419
- arrowOffset;
2420
- roundness;
2421
- cycleSquareSide;
2422
- detourDistance;
2423
- hasSourceArrow;
2424
- hasTargetArrow;
2425
- pathShape;
2426
- createCyclePath = (from, _to, fromDir) => new CycleSquareEdgePath({
2427
- origin: from,
2428
- dir: fromDir,
2429
- arrowLength: this.arrowLength,
2430
- side: this.cycleSquareSide,
2431
- arrowOffset: this.arrowOffset,
2432
- roundness: this.roundness,
2433
- hasArrow: this.hasSourceArrow || this.hasTargetArrow
2434
- });
2435
- createDetourPath = (from, to, fromDir, toDir) => new DetourHorizontalEdgePath({
2436
- from,
2437
- to,
2438
- fromDir,
2439
- toDir,
2440
- arrowLength: this.arrowLength,
2441
- arrowOffset: this.arrowOffset,
2442
- roundness: this.roundness,
2443
- detourDistance: this.detourDistance,
2444
- hasSourceArrow: this.hasSourceArrow,
2445
- hasTargetArrow: this.hasTargetArrow
2446
- });
2447
- createLinePath = (from, to, fromDir, toDir) => new HorizontalEdgePath({
2448
- from,
2449
- to,
2450
- fromDir,
2451
- toDir,
2452
- arrowLength: this.arrowLength,
2453
- arrowOffset: this.arrowOffset,
2454
- roundness: this.roundness,
2455
- hasSourceArrow: this.hasSourceArrow,
2456
- hasTargetArrow: this.hasTargetArrow
2457
- });
2458
- constructor(params) {
2459
- this.arrowLength = params?.arrowLength ?? edgeConstants.arrowLength;
2460
- this.arrowOffset = params?.arrowOffset ?? edgeConstants.arrowOffset;
2461
- this.cycleSquareSide = params?.cycleSquareSide ?? edgeConstants.cycleSquareSide;
2462
- const roundness = params?.roundness ?? edgeConstants.roundness;
2463
- this.roundness = Math.min(roundness, this.arrowOffset, this.cycleSquareSide / 2);
2464
- this.detourDistance = params?.detourDistance ?? edgeConstants.detourDistance;
2465
- this.hasSourceArrow = params?.hasSourceArrow ?? edgeConstants.hasSourceArrow;
2466
- this.hasTargetArrow = params?.hasTargetArrow ?? edgeConstants.hasTargetArrow;
2467
- this.pathShape = new PathEdgeShape({
2468
- color: params?.color ?? edgeConstants.color,
2469
- width: params?.width ?? edgeConstants.width,
2470
- arrowRenderer: resolveArrowRenderer(params?.arrowRenderer ?? {}),
2471
- arrowLength: this.arrowLength,
2472
- hasSourceArrow: this.hasSourceArrow,
2473
- hasTargetArrow: this.hasTargetArrow,
2474
- createCyclePath: this.createCyclePath,
2475
- createDetourPath: this.createDetourPath,
2476
- createLinePath: this.createLinePath,
2477
- padding: 50
2478
- });
2479
- this.svg = this.pathShape.svg;
2480
- this.group = this.pathShape.group;
2481
- this.line = this.pathShape.line;
2482
- this.sourceArrow = this.pathShape.sourceArrow;
2483
- this.targetArrow = this.pathShape.targetArrow;
2484
- this.onAfterRender = this.pathShape.onAfterRender;
2485
- }
2486
- render(params) {
2487
- const { from, to, category } = params;
2488
- this.pathShape.render({
2489
- category,
2490
- from: {
2491
- ...from,
2492
- direction: horizontalizeDirection(from.direction)
2493
- },
2494
- to: {
2495
- ...to,
2496
- direction: horizontalizeDirection(to.direction)
2497
- }
2498
- });
2499
- }
2500
- };
2501
- //#endregion
2502
2327
  //#region src/edges/shapes/straight-edge-shape/straight-edge-shape.ts
2503
2328
  var StraightEdgeShape = class {
2504
- svg;
2329
+ element;
2505
2330
  group;
2506
2331
  line;
2507
2332
  sourceArrow;
@@ -2571,7 +2396,7 @@
2571
2396
  createLinePath: this.createLinePath,
2572
2397
  padding: 50
2573
2398
  });
2574
- this.svg = this.pathShape.svg;
2399
+ this.element = this.pathShape.element;
2575
2400
  this.group = this.pathShape.group;
2576
2401
  this.line = this.pathShape.line;
2577
2402
  this.sourceArrow = this.pathShape.sourceArrow;
@@ -2583,108 +2408,6 @@
2583
2408
  }
2584
2409
  };
2585
2410
  //#endregion
2586
- //#region src/edges/shapes/vertical-edge-shape/verticalize-directions/verticalize-direction.ts
2587
- var pi2 = Math.PI / 2;
2588
- var verticalizeDirection = (direction) => {
2589
- return Math.sin(direction) > 0 ? pi2 : -pi2;
2590
- };
2591
- //#endregion
2592
- //#region src/edges/shapes/vertical-edge-shape/vertical-edge-shape.ts
2593
- /**
2594
- * @deprecated
2595
- * use OrthogonalEdgeShape instead
2596
- */
2597
- var VerticalEdgeShape = class {
2598
- svg;
2599
- group;
2600
- line;
2601
- sourceArrow;
2602
- targetArrow;
2603
- onAfterRender;
2604
- arrowLength;
2605
- arrowOffset;
2606
- roundness;
2607
- cycleSquareSide;
2608
- detourDistance;
2609
- hasSourceArrow;
2610
- hasTargetArrow;
2611
- pathShape;
2612
- createCyclePath = (from, _to, fromDir) => new CycleSquareEdgePath({
2613
- origin: from,
2614
- dir: fromDir,
2615
- arrowLength: this.arrowLength,
2616
- side: this.cycleSquareSide,
2617
- arrowOffset: this.arrowOffset,
2618
- roundness: this.roundness,
2619
- hasArrow: this.hasSourceArrow || this.hasTargetArrow
2620
- });
2621
- createDetourPath = (from, to, fromDir, toDir) => new DetourVerticalEdgePath({
2622
- from,
2623
- to,
2624
- fromDir,
2625
- toDir,
2626
- arrowLength: this.arrowLength,
2627
- arrowOffset: this.arrowOffset,
2628
- roundness: this.roundness,
2629
- detourDistance: this.detourDistance,
2630
- hasSourceArrow: this.hasSourceArrow,
2631
- hasTargetArrow: this.hasTargetArrow
2632
- });
2633
- createLinePath = (from, to, fromDir, toDir) => new VerticalEdgePath({
2634
- from,
2635
- to,
2636
- fromDir,
2637
- toDir,
2638
- arrowLength: this.arrowLength,
2639
- arrowOffset: this.arrowOffset,
2640
- roundness: this.roundness,
2641
- hasSourceArrow: this.hasSourceArrow,
2642
- hasTargetArrow: this.hasTargetArrow
2643
- });
2644
- constructor(params) {
2645
- this.arrowLength = params?.arrowLength ?? edgeConstants.arrowLength;
2646
- this.arrowOffset = params?.arrowOffset ?? edgeConstants.arrowOffset;
2647
- this.cycleSquareSide = params?.cycleSquareSide ?? edgeConstants.cycleSquareSide;
2648
- const roundness = params?.roundness ?? edgeConstants.roundness;
2649
- this.roundness = Math.min(roundness, this.arrowOffset, this.cycleSquareSide / 2);
2650
- this.detourDistance = params?.detourDistance ?? edgeConstants.detourDistance;
2651
- this.hasSourceArrow = params?.hasSourceArrow ?? edgeConstants.hasSourceArrow;
2652
- this.hasTargetArrow = params?.hasTargetArrow ?? edgeConstants.hasTargetArrow;
2653
- this.pathShape = new PathEdgeShape({
2654
- color: params?.color ?? edgeConstants.color,
2655
- width: params?.width ?? edgeConstants.width,
2656
- arrowRenderer: resolveArrowRenderer(params?.arrowRenderer ?? {}),
2657
- arrowLength: this.arrowLength,
2658
- hasSourceArrow: this.hasSourceArrow,
2659
- hasTargetArrow: this.hasTargetArrow,
2660
- createCyclePath: this.createCyclePath,
2661
- createDetourPath: this.createDetourPath,
2662
- createLinePath: this.createLinePath,
2663
- padding: 50
2664
- });
2665
- this.svg = this.pathShape.svg;
2666
- this.group = this.pathShape.group;
2667
- this.line = this.pathShape.line;
2668
- this.sourceArrow = this.pathShape.sourceArrow;
2669
- this.targetArrow = this.pathShape.targetArrow;
2670
- this.onAfterRender = this.pathShape.onAfterRender;
2671
- }
2672
- render(params) {
2673
- const { from, to, category } = params;
2674
- this.pathShape.render({
2675
- category,
2676
- from: {
2677
- ...from,
2678
- direction: verticalizeDirection(from.direction)
2679
- },
2680
- to: {
2681
- ...to,
2682
- direction: verticalizeDirection(to.direction)
2683
- }
2684
- });
2685
- }
2686
- };
2687
- //#endregion
2688
2411
  //#region src/edges/shapes/orthogonal-edge-shape/orthogonalize-direction/orthogonalize-direction.ts
2689
2412
  var orthogonalizeDirection = (direction) => {
2690
2413
  const adjDir = direction + Math.PI / 4;
@@ -2700,7 +2423,7 @@
2700
2423
  //#endregion
2701
2424
  //#region src/edges/shapes/orthogonal-edge-shape/orthogonal-edge-shape.ts
2702
2425
  var OrthogonalEdgeShape = class {
2703
- svg;
2426
+ element;
2704
2427
  group;
2705
2428
  line;
2706
2429
  sourceArrow;
@@ -2767,7 +2490,7 @@
2767
2490
  createLinePath: this.createLinePath,
2768
2491
  padding: 50
2769
2492
  });
2770
- this.svg = this.pathShape.svg;
2493
+ this.element = this.pathShape.element;
2771
2494
  this.group = this.pathShape.group;
2772
2495
  this.line = this.pathShape.line;
2773
2496
  this.sourceArrow = this.pathShape.sourceArrow;
@@ -2813,7 +2536,7 @@
2813
2536
  //#region src/edges/shapes/direct-edge-shape/direct-edge-shape.ts
2814
2537
  var defaultPortOffset = edgeConstants.portOffset;
2815
2538
  var DirectEdgeShape = class {
2816
- svg;
2539
+ element;
2817
2540
  group = document.createElementNS("http://www.w3.org/2000/svg", "g");
2818
2541
  line;
2819
2542
  sourceArrow = null;
@@ -2834,8 +2557,8 @@
2834
2557
  this.arrowRenderer = resolveArrowRenderer(params?.arrowRenderer ?? {});
2835
2558
  this.sourceOffsetFn = resolvePortOffsetFn(params?.sourceOffset ?? defaultPortOffset);
2836
2559
  this.targetOffsetFn = resolvePortOffsetFn(params?.targetOffset ?? defaultPortOffset);
2837
- this.svg = createEdgeSvg(this.color);
2838
- this.svg.appendChild(this.group);
2560
+ this.element = createEdgeSvg(this.color);
2561
+ this.element.appendChild(this.group);
2839
2562
  this.line = createEdgePath(this.width);
2840
2563
  this.group.appendChild(this.line);
2841
2564
  if (params?.hasSourceArrow) {
@@ -2849,7 +2572,7 @@
2849
2572
  }
2850
2573
  render(params) {
2851
2574
  const { x, y, width, height, from, to } = createEdgeRectangle(params.from, params.to, 50);
2852
- setSvgRectangle(this.svg, {
2575
+ setSvgRectangle(this.element, {
2853
2576
  x,
2854
2577
  y,
2855
2578
  width,
@@ -3014,15 +2737,11 @@
3014
2737
  //#region src/edges/shapes/interactive-edge-shape/interactive-edge-shape.ts
3015
2738
  var InteractiveEdgeShape = class InteractiveEdgeShape {
3016
2739
  baseEdge;
3017
- svg;
2740
+ element;
3018
2741
  group;
3019
2742
  line;
3020
2743
  sourceArrow;
3021
2744
  targetArrow;
3022
- /**
3023
- * @deprecated
3024
- * use shape.svg instead
3025
- */
3026
2745
  handle = createEdgeGroup();
3027
2746
  onAfterRender;
3028
2747
  interactiveLine;
@@ -3031,7 +2750,7 @@
3031
2750
  constructor(baseEdge, params) {
3032
2751
  this.baseEdge = baseEdge;
3033
2752
  if (baseEdge instanceof InteractiveEdgeShape) throw new InteractiveEdgeError("interactive edge can be configured only once");
3034
- this.svg = this.baseEdge.svg;
2753
+ this.element = this.baseEdge.element;
3035
2754
  this.group = this.baseEdge.group;
3036
2755
  this.line = this.baseEdge.line;
3037
2756
  this.sourceArrow = this.baseEdge.sourceArrow;
@@ -3069,17 +2788,17 @@
3069
2788
  sourceArrow;
3070
2789
  targetArrow;
3071
2790
  onAfterRender;
3072
- svg;
2791
+ element;
3073
2792
  constructor(baseShape, midpointElement) {
3074
2793
  this.baseShape = baseShape;
3075
2794
  this.midpointElement = midpointElement;
3076
- this.svg = this.baseShape.svg;
2795
+ this.element = this.baseShape.element;
3077
2796
  this.group = this.baseShape.group;
3078
2797
  this.line = this.baseShape.line;
3079
2798
  this.sourceArrow = this.baseShape.sourceArrow;
3080
2799
  this.targetArrow = this.baseShape.targetArrow;
3081
2800
  this.onAfterRender = this.baseShape.onAfterRender;
3082
- this.svg.append(this.midpointElement);
2801
+ this.element.append(this.midpointElement);
3083
2802
  this.baseShape.onAfterRender.subscribe((model) => {
3084
2803
  const midpoint = model.edgePath.midpoint;
3085
2804
  const transform = `translate(${midpoint.x}px, ${midpoint.y}px)`;
@@ -3373,17 +3092,6 @@
3373
3092
  }
3374
3093
  };
3375
3094
  //#endregion
3376
- //#region src/schedule-fn/macrotask-schedule-fn/macrotask-schedule-fn.ts
3377
- /**
3378
- * @deprecated
3379
- * use macrotaskScheduleFn instead
3380
- */
3381
- var macrotaskScheduleFn = (callback) => {
3382
- setTimeout(() => {
3383
- callback();
3384
- });
3385
- };
3386
- //#endregion
3387
3095
  //#region src/schedule-fn/microtask-schedule-fn/microtask-schedule-fn.ts
3388
3096
  var microtaskScheduleFn = (callback) => {
3389
3097
  queueMicrotask(() => {
@@ -3435,7 +3143,7 @@
3435
3143
  } : {
3436
3144
  minContentScale: config.minContentScale ?? controllerParams.focus.minContentScale,
3437
3145
  nodes: config.nodes ?? [],
3438
- contentPadding: config.contentPadding ?? config.contentOffset ?? controllerParams.focus.contentPadding,
3146
+ contentPadding: config.contentPadding ?? controllerParams.focus.contentPadding,
3439
3147
  animationDuration: config.animationDuration ?? controllerParams.focus.animationDuration
3440
3148
  };
3441
3149
  };
@@ -3987,12 +3695,7 @@
3987
3695
  const element = event.currentTarget;
3988
3696
  const nodeId = this.canvas.graph.findNodeIdByElement(element);
3989
3697
  const node = this.graph.getNode(nodeId);
3990
- if (!this.params.nodeDragVerifier({
3991
- nodeId,
3992
- element: node.element,
3993
- x: node.x,
3994
- y: node.y
3995
- })) return;
3698
+ if (!this.params.nodeDragVerifier(nodeId)) return;
3996
3699
  this.eventTagger.tag(event, dragEventHandledTag);
3997
3700
  const cursorContent = this.calculateContentPoint({
3998
3701
  x: touch.clientX,
@@ -4277,8 +3980,10 @@
4277
3980
  const transform = this.params.transformPreprocessor({
4278
3981
  prevTransform,
4279
3982
  nextTransform,
4280
- canvasWidth: width,
4281
- canvasHeight: height
3983
+ viewport: {
3984
+ width,
3985
+ height
3986
+ }
4282
3987
  });
4283
3988
  this.performTransform(transform);
4284
3989
  }
@@ -4289,8 +3994,10 @@
4289
3994
  const transform = this.params.transformPreprocessor({
4290
3995
  prevTransform,
4291
3996
  nextTransform,
4292
- canvasWidth: width,
4293
- canvasHeight: height
3997
+ viewport: {
3998
+ width,
3999
+ height
4000
+ }
4294
4001
  });
4295
4002
  this.performTransform(transform);
4296
4003
  }
@@ -4332,8 +4039,10 @@
4332
4039
  const transform = this.params.transformPreprocessor({
4333
4040
  prevTransform,
4334
4041
  nextTransform: prevTransform,
4335
- canvasWidth: width,
4336
- canvasHeight: height
4042
+ viewport: {
4043
+ width,
4044
+ height
4045
+ }
4337
4046
  });
4338
4047
  this.params.onResizeTransformStarted();
4339
4048
  this.canvas.patchViewportMatrix(transform);
@@ -5085,16 +4794,16 @@
5085
4794
  onEdgeSelected;
5086
4795
  onAfterEdgeAdded = (edgeId) => {
5087
4796
  const { shape } = this.canvas.graph.getEdge(edgeId);
5088
- this.configurator.enable(shape.svg);
4797
+ this.configurator.enable(shape.element);
5089
4798
  };
5090
4799
  onBeforeEdgeRemoved = (edgeId) => {
5091
4800
  const { shape } = this.canvas.graph.getEdge(edgeId);
5092
- this.configurator.disable(shape.svg);
4801
+ this.configurator.disable(shape.element);
5093
4802
  };
5094
4803
  reset = () => {
5095
4804
  this.canvas.graph.getAllEdgeIds().forEach((edgeId) => {
5096
4805
  const { shape } = this.canvas.graph.getEdge(edgeId);
5097
- this.configurator.disable(shape.svg);
4806
+ this.configurator.disable(shape.element);
5098
4807
  });
5099
4808
  };
5100
4809
  constructor(canvas, window, pointInsideVerifier, eventTagger, params) {
@@ -5236,9 +4945,9 @@
5236
4945
  //#endregion
5237
4946
  //#region src/canvas-builder/shared/resolve-dragging-port-direction-resolver/resolve-dragging-port-direction-resolver.ts
5238
4947
  var resolveDraggingPortDirectionResolver = (config, graph, connectionAllowedVerifier) => {
5239
- if (config === "closest-connectable-port") return new NearestConnectablePortDraggingPortDirectionResolver(graph, connectionAllowedVerifier);
5240
4948
  if (config === "nearest-connectable-port") return new NearestConnectablePortDraggingPortDirectionResolver(graph, connectionAllowedVerifier);
5241
- return new ConstantDraggingPortDirectionResolver(config);
4949
+ if (typeof config === "number") return new ConstantDraggingPortDirectionResolver(config);
4950
+ return new ConstantDraggingPortDirectionResolver(void 0);
5242
4951
  };
5243
4952
  //#endregion
5244
4953
  //#region src/canvas-builder/shared/resolve-edge-shape-factory/resolve-edge-shape-factory.ts
@@ -5258,30 +4967,6 @@
5258
4967
  detourDistance: config.detourDistance,
5259
4968
  detourDirection: config.detourDirection
5260
4969
  });
5261
- case "horizontal": return () => new HorizontalEdgeShape({
5262
- color: config.color,
5263
- width: config.width,
5264
- arrowLength: config.arrowLength,
5265
- arrowOffset: config.arrowOffset,
5266
- arrowRenderer: config.arrowRenderer,
5267
- hasSourceArrow: config.hasSourceArrow,
5268
- hasTargetArrow: config.hasTargetArrow,
5269
- cycleSquareSide: config.cycleSquareSide,
5270
- roundness: config.roundness,
5271
- detourDistance: config.detourDistance
5272
- });
5273
- case "vertical": return () => new VerticalEdgeShape({
5274
- color: config.color,
5275
- width: config.width,
5276
- arrowLength: config.arrowLength,
5277
- arrowOffset: config.arrowOffset,
5278
- arrowRenderer: config.arrowRenderer,
5279
- hasSourceArrow: config.hasSourceArrow,
5280
- hasTargetArrow: config.hasTargetArrow,
5281
- cycleSquareSide: config.cycleSquareSide,
5282
- roundness: config.roundness,
5283
- detourDistance: config.detourDistance
5284
- });
5285
4970
  case "orthogonal": return () => new OrthogonalEdgeShape({
5286
4971
  color: config.color,
5287
4972
  width: config.width,
@@ -5355,10 +5040,10 @@
5355
5040
  let dx = params.nextTransform.x;
5356
5041
  let dy = params.nextTransform.y;
5357
5042
  if (dx < minX && dx < params.prevTransform.x) dx = Math.min(params.prevTransform.x, minX);
5358
- const maxScreenX = maxX - params.canvasWidth * params.prevTransform.scale;
5043
+ const maxScreenX = maxX - params.viewport.width * params.prevTransform.scale;
5359
5044
  if (dx > maxScreenX && dx > params.prevTransform.x) dx = Math.max(params.prevTransform.x, maxScreenX);
5360
5045
  if (dy < minY && dy < params.prevTransform.y) dy = Math.min(params.prevTransform.y, minY);
5361
- const maxScreenY = maxY - params.canvasHeight * params.prevTransform.scale;
5046
+ const maxScreenY = maxY - params.viewport.height * params.prevTransform.scale;
5362
5047
  if (dy > maxScreenY && dy > params.prevTransform.y) dy = Math.max(params.prevTransform.y, maxScreenY);
5363
5048
  return {
5364
5049
  scale: params.nextTransform.scale,
@@ -5406,8 +5091,7 @@
5406
5091
  return preprocessors.reduce((acc, cur) => cur({
5407
5092
  prevTransform: params.prevTransform,
5408
5093
  nextTransform: acc,
5409
- canvasWidth: params.canvasWidth,
5410
- canvasHeight: params.canvasHeight
5094
+ viewport: params.viewport
5411
5095
  }), params.nextTransform);
5412
5096
  };
5413
5097
  };
@@ -5440,10 +5124,10 @@
5440
5124
  else transformPreprocessor = (params) => {
5441
5125
  return params.nextTransform;
5442
5126
  };
5443
- const shiftCursor = transformConfig?.shift?.cursor !== void 0 ? transformConfig.shift.cursor : "grab";
5444
- const defaultMouseDownEventVerifier = transformConfig?.shift?.mouseDownEventVerifier;
5127
+ const shiftCursor = transformConfig?.pan?.cursor !== void 0 ? transformConfig.pan.cursor : "grab";
5128
+ const defaultMouseDownEventVerifier = transformConfig?.pan?.mouseDownEventVerifier;
5445
5129
  const mouseDownEventVerifier = defaultMouseDownEventVerifier !== void 0 ? defaultMouseDownEventVerifier : (event) => event.button === 0;
5446
- const defaultMouseUpEventVerifier = transformConfig?.shift?.mouseUpEventVerifier;
5130
+ const defaultMouseUpEventVerifier = transformConfig?.pan?.mouseUpEventVerifier;
5447
5131
  const mouseUpEventVerifier = defaultMouseUpEventVerifier !== void 0 ? defaultMouseUpEventVerifier : (event) => event.button === 0;
5448
5132
  const defaultMouseWheelEventVerifier = transformConfig?.scale?.mouseWheelEventVerifier;
5449
5133
  const mouseWheelEventVerifier = defaultMouseWheelEventVerifier !== void 0 ? defaultMouseWheelEventVerifier : () => true;
@@ -5520,7 +5204,7 @@
5520
5204
  var defaults$2 = Object.freeze({
5521
5205
  connectionAllowedVerifier: () => true,
5522
5206
  connectionPreprocessor: (request) => request,
5523
- mouseDownEventVerifier: (event) => event.button === 0 && event.ctrlKey,
5207
+ mouseDownEventVerifier: (event) => event.button === 0,
5524
5208
  mouseUpEventVerifier: (event) => event.button === 0
5525
5209
  });
5526
5210
  //#endregion
@@ -6207,7 +5891,7 @@
6207
5891
  this.nodeMass = params.nodeMass;
6208
5892
  this.edgeEquilibriumLength = params.edgeEquilibriumLength;
6209
5893
  this.edgeStiffness = params.edgeStiffness;
6210
- this.convergenceVelocity = params.convergenceVelocity;
5894
+ this.convergenceVelocity = params.stopVelocity;
6211
5895
  this.distanceVectorGenerator = new DistanceVectorGenerator(params.rand);
6212
5896
  this.nodeForcesApplicationStrategy = resolveNodeForcesApplicationStrategy({
6213
5897
  distanceVectorGenerator: this.distanceVectorGenerator,
@@ -6463,7 +6147,7 @@
6463
6147
  edgeStiffness;
6464
6148
  fillerLayoutAlgorithm;
6465
6149
  constructor(params) {
6466
- this.convergenceVelocity = params.convergenceVelocity;
6150
+ this.convergenceVelocity = params.stopVelocity;
6467
6151
  this.maxTimeDeltaSec = params.maxTimeDeltaSec;
6468
6152
  this.nodeMass = params.nodeMass;
6469
6153
  this.edgeEquilibriumLength = params.edgeEquilibriumLength;
@@ -6562,7 +6246,7 @@
6562
6246
  nodeMass: config?.nodeMass ?? forceDirectedDefaults.nodeMass,
6563
6247
  edgeEquilibriumLength: config?.edgeEquilibriumLength ?? forceDirectedDefaults.edgeEquilibriumLength,
6564
6248
  edgeStiffness: config?.edgeStiffness ?? forceDirectedDefaults.edgeStiffness,
6565
- convergenceVelocity: config?.convergenceVelocity ?? forceDirectedDefaults.convergenceVelocity,
6249
+ stopVelocity: config?.stopVelocity ?? forceDirectedDefaults.convergenceVelocity,
6566
6250
  maxForce: config?.maxForce ?? forceDirectedDefaults.maxForce,
6567
6251
  nodeForceCoefficient: config?.nodeForceCoefficient ?? forceDirectedDefaults.nodeForceCoefficient,
6568
6252
  barnesHutTheta: config?.barnesHut?.theta ?? forceDirectedDefaults.barnesHutTheta,
@@ -6591,14 +6275,6 @@
6591
6275
  type: "trigger",
6592
6276
  trigger: applyOn
6593
6277
  };
6594
- if (applyOn === "topologyChangeMicrotask") return {
6595
- type: "topologyChangeSchedule",
6596
- schedule: microtaskScheduleFn
6597
- };
6598
- if (applyOn?.type === "topologyChangeMacrotask") return {
6599
- type: "topologyChangeSchedule",
6600
- schedule: macrotaskScheduleFn
6601
- };
6602
6278
  return {
6603
6279
  type: "topologyChangeSchedule",
6604
6280
  schedule: microtaskScheduleFn
@@ -6794,7 +6470,7 @@
6794
6470
  nodeMass: config?.nodeMass ?? forceDirectedDefaults.nodeMass,
6795
6471
  edgeEquilibriumLength: config?.edgeEquilibriumLength ?? forceDirectedDefaults.edgeEquilibriumLength,
6796
6472
  edgeStiffness: config?.edgeStiffness ?? forceDirectedDefaults.edgeStiffness,
6797
- convergenceVelocity: config?.convergenceVelocity ?? forceDirectedDefaults.convergenceVelocity,
6473
+ stopVelocity: config?.stopVelocity ?? forceDirectedDefaults.convergenceVelocity,
6798
6474
  maxForce: config?.maxForce ?? forceDirectedDefaults.maxForce,
6799
6475
  nodeForceCoefficient: config?.nodeForceCoefficient ?? forceDirectedDefaults.nodeForceCoefficient,
6800
6476
  barnesHutTheta: config?.barnesHut?.theta ?? forceDirectedDefaults.barnesHutTheta,
@@ -6909,7 +6585,7 @@
6909
6585
  const { canvasDefaults } = params;
6910
6586
  const schedule = params.hasLayout ? resolveLayoutFocusSchedule(params.layoutParams) : immediateScheduleFn;
6911
6587
  return { focus: {
6912
- contentPadding: canvasDefaults.focus?.contentPadding ?? canvasDefaults.focus?.contentOffset ?? 100,
6588
+ contentPadding: canvasDefaults.focus?.contentPadding ?? 100,
6913
6589
  minContentScale: canvasDefaults.focus?.minContentScale ?? 0,
6914
6590
  schedule,
6915
6591
  animationDuration: canvasDefaults.focus?.animationDuration ?? 0
@@ -7115,12 +6791,9 @@
7115
6791
  exports.ConnectionCategory = ConnectionCategory;
7116
6792
  exports.DirectEdgeShape = DirectEdgeShape;
7117
6793
  exports.EventSubject = EventSubject;
7118
- exports.HorizontalEdgeShape = HorizontalEdgeShape;
7119
6794
  exports.InteractiveEdgeError = InteractiveEdgeError;
7120
6795
  exports.InteractiveEdgeShape = InteractiveEdgeShape;
7121
6796
  exports.MidpointEdgeShape = MidpointEdgeShape;
7122
6797
  exports.OrthogonalEdgeShape = OrthogonalEdgeShape;
7123
6798
  exports.StraightEdgeShape = StraightEdgeShape;
7124
- exports.VerticalEdgeShape = VerticalEdgeShape;
7125
- exports.boxPortOffsetFn = boxPortOffsetFn;
7126
6799
  });