@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.
@@ -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.element;
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);
@@ -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;
@@ -2136,7 +2062,6 @@
2136
2062
  var PathEdgeShape = class {
2137
2063
  params;
2138
2064
  element;
2139
- svg;
2140
2065
  group = document.createElementNS("http://www.w3.org/2000/svg", "g");
2141
2066
  line;
2142
2067
  sourceArrow = null;
@@ -2149,7 +2074,6 @@
2149
2074
  [this.afterRenderEmitter, this.onAfterRender] = createPair();
2150
2075
  this.arrowRenderer = this.params.arrowRenderer;
2151
2076
  this.element = createEdgeSvg(params.color);
2152
- this.svg = this.element;
2153
2077
  this.element.appendChild(this.group);
2154
2078
  this.line = createEdgePath(params.width);
2155
2079
  this.group.appendChild(this.line);
@@ -2323,7 +2247,6 @@
2323
2247
  //#region src/edges/shapes/bezier-edge-shape/bezier-edge-shape.ts
2324
2248
  var BezierEdgeShape = class {
2325
2249
  element;
2326
- svg;
2327
2250
  group;
2328
2251
  line;
2329
2252
  sourceArrow;
@@ -2390,7 +2313,6 @@
2390
2313
  padding: 50
2391
2314
  });
2392
2315
  this.element = this.pathShape.element;
2393
- this.svg = this.element;
2394
2316
  this.group = this.pathShape.group;
2395
2317
  this.line = this.pathShape.line;
2396
2318
  this.sourceArrow = this.pathShape.sourceArrow;
@@ -2402,113 +2324,9 @@
2402
2324
  }
2403
2325
  };
2404
2326
  //#endregion
2405
- //#region src/edges/shapes/horizontal-edge-shape/horizontalize-directions/horizontalize-direction.ts
2406
- var horizontalizeDirection = (direction) => {
2407
- return Math.cos(direction) > 0 ? 0 : Math.PI;
2408
- };
2409
- //#endregion
2410
- //#region src/edges/shapes/horizontal-edge-shape/horizontal-edge-shape.ts
2411
- /**
2412
- * @deprecated
2413
- * use OrthogonalEdgeShape instead
2414
- */
2415
- var HorizontalEdgeShape = class {
2416
- element;
2417
- svg;
2418
- group;
2419
- line;
2420
- sourceArrow;
2421
- targetArrow;
2422
- onAfterRender;
2423
- arrowLength;
2424
- arrowOffset;
2425
- roundness;
2426
- cycleSquareSide;
2427
- detourDistance;
2428
- hasSourceArrow;
2429
- hasTargetArrow;
2430
- pathShape;
2431
- createCyclePath = (from, _to, fromDir) => new CycleSquareEdgePath({
2432
- origin: from,
2433
- dir: fromDir,
2434
- arrowLength: this.arrowLength,
2435
- side: this.cycleSquareSide,
2436
- arrowOffset: this.arrowOffset,
2437
- roundness: this.roundness,
2438
- hasArrow: this.hasSourceArrow || this.hasTargetArrow
2439
- });
2440
- createDetourPath = (from, to, fromDir, toDir) => new DetourHorizontalEdgePath({
2441
- from,
2442
- to,
2443
- fromDir,
2444
- toDir,
2445
- arrowLength: this.arrowLength,
2446
- arrowOffset: this.arrowOffset,
2447
- roundness: this.roundness,
2448
- detourDistance: this.detourDistance,
2449
- hasSourceArrow: this.hasSourceArrow,
2450
- hasTargetArrow: this.hasTargetArrow
2451
- });
2452
- createLinePath = (from, to, fromDir, toDir) => new HorizontalEdgePath({
2453
- from,
2454
- to,
2455
- fromDir,
2456
- toDir,
2457
- arrowLength: this.arrowLength,
2458
- arrowOffset: this.arrowOffset,
2459
- roundness: this.roundness,
2460
- hasSourceArrow: this.hasSourceArrow,
2461
- hasTargetArrow: this.hasTargetArrow
2462
- });
2463
- constructor(params) {
2464
- this.arrowLength = params?.arrowLength ?? edgeConstants.arrowLength;
2465
- this.arrowOffset = params?.arrowOffset ?? edgeConstants.arrowOffset;
2466
- this.cycleSquareSide = params?.cycleSquareSide ?? edgeConstants.cycleSquareSide;
2467
- const roundness = params?.roundness ?? edgeConstants.roundness;
2468
- this.roundness = Math.min(roundness, this.arrowOffset, this.cycleSquareSide / 2);
2469
- this.detourDistance = params?.detourDistance ?? edgeConstants.detourDistance;
2470
- this.hasSourceArrow = params?.hasSourceArrow ?? edgeConstants.hasSourceArrow;
2471
- this.hasTargetArrow = params?.hasTargetArrow ?? edgeConstants.hasTargetArrow;
2472
- this.pathShape = new PathEdgeShape({
2473
- color: params?.color ?? edgeConstants.color,
2474
- width: params?.width ?? edgeConstants.width,
2475
- arrowRenderer: resolveArrowRenderer(params?.arrowRenderer ?? {}),
2476
- arrowLength: this.arrowLength,
2477
- hasSourceArrow: this.hasSourceArrow,
2478
- hasTargetArrow: this.hasTargetArrow,
2479
- createCyclePath: this.createCyclePath,
2480
- createDetourPath: this.createDetourPath,
2481
- createLinePath: this.createLinePath,
2482
- padding: 50
2483
- });
2484
- this.element = this.pathShape.element;
2485
- this.svg = this.element;
2486
- this.group = this.pathShape.group;
2487
- this.line = this.pathShape.line;
2488
- this.sourceArrow = this.pathShape.sourceArrow;
2489
- this.targetArrow = this.pathShape.targetArrow;
2490
- this.onAfterRender = this.pathShape.onAfterRender;
2491
- }
2492
- render(params) {
2493
- const { from, to, category } = params;
2494
- this.pathShape.render({
2495
- category,
2496
- from: {
2497
- ...from,
2498
- direction: horizontalizeDirection(from.direction)
2499
- },
2500
- to: {
2501
- ...to,
2502
- direction: horizontalizeDirection(to.direction)
2503
- }
2504
- });
2505
- }
2506
- };
2507
- //#endregion
2508
2327
  //#region src/edges/shapes/straight-edge-shape/straight-edge-shape.ts
2509
2328
  var StraightEdgeShape = class {
2510
2329
  element;
2511
- svg;
2512
2330
  group;
2513
2331
  line;
2514
2332
  sourceArrow;
@@ -2579,7 +2397,6 @@
2579
2397
  padding: 50
2580
2398
  });
2581
2399
  this.element = this.pathShape.element;
2582
- this.svg = this.element;
2583
2400
  this.group = this.pathShape.group;
2584
2401
  this.line = this.pathShape.line;
2585
2402
  this.sourceArrow = this.pathShape.sourceArrow;
@@ -2591,110 +2408,6 @@
2591
2408
  }
2592
2409
  };
2593
2410
  //#endregion
2594
- //#region src/edges/shapes/vertical-edge-shape/verticalize-directions/verticalize-direction.ts
2595
- var pi2 = Math.PI / 2;
2596
- var verticalizeDirection = (direction) => {
2597
- return Math.sin(direction) > 0 ? pi2 : -pi2;
2598
- };
2599
- //#endregion
2600
- //#region src/edges/shapes/vertical-edge-shape/vertical-edge-shape.ts
2601
- /**
2602
- * @deprecated
2603
- * use OrthogonalEdgeShape instead
2604
- */
2605
- var VerticalEdgeShape = class {
2606
- element;
2607
- svg;
2608
- group;
2609
- line;
2610
- sourceArrow;
2611
- targetArrow;
2612
- onAfterRender;
2613
- arrowLength;
2614
- arrowOffset;
2615
- roundness;
2616
- cycleSquareSide;
2617
- detourDistance;
2618
- hasSourceArrow;
2619
- hasTargetArrow;
2620
- pathShape;
2621
- createCyclePath = (from, _to, fromDir) => new CycleSquareEdgePath({
2622
- origin: from,
2623
- dir: fromDir,
2624
- arrowLength: this.arrowLength,
2625
- side: this.cycleSquareSide,
2626
- arrowOffset: this.arrowOffset,
2627
- roundness: this.roundness,
2628
- hasArrow: this.hasSourceArrow || this.hasTargetArrow
2629
- });
2630
- createDetourPath = (from, to, fromDir, toDir) => new DetourVerticalEdgePath({
2631
- from,
2632
- to,
2633
- fromDir,
2634
- toDir,
2635
- arrowLength: this.arrowLength,
2636
- arrowOffset: this.arrowOffset,
2637
- roundness: this.roundness,
2638
- detourDistance: this.detourDistance,
2639
- hasSourceArrow: this.hasSourceArrow,
2640
- hasTargetArrow: this.hasTargetArrow
2641
- });
2642
- createLinePath = (from, to, fromDir, toDir) => new VerticalEdgePath({
2643
- from,
2644
- to,
2645
- fromDir,
2646
- toDir,
2647
- arrowLength: this.arrowLength,
2648
- arrowOffset: this.arrowOffset,
2649
- roundness: this.roundness,
2650
- hasSourceArrow: this.hasSourceArrow,
2651
- hasTargetArrow: this.hasTargetArrow
2652
- });
2653
- constructor(params) {
2654
- this.arrowLength = params?.arrowLength ?? edgeConstants.arrowLength;
2655
- this.arrowOffset = params?.arrowOffset ?? edgeConstants.arrowOffset;
2656
- this.cycleSquareSide = params?.cycleSquareSide ?? edgeConstants.cycleSquareSide;
2657
- const roundness = params?.roundness ?? edgeConstants.roundness;
2658
- this.roundness = Math.min(roundness, this.arrowOffset, this.cycleSquareSide / 2);
2659
- this.detourDistance = params?.detourDistance ?? edgeConstants.detourDistance;
2660
- this.hasSourceArrow = params?.hasSourceArrow ?? edgeConstants.hasSourceArrow;
2661
- this.hasTargetArrow = params?.hasTargetArrow ?? edgeConstants.hasTargetArrow;
2662
- this.pathShape = new PathEdgeShape({
2663
- color: params?.color ?? edgeConstants.color,
2664
- width: params?.width ?? edgeConstants.width,
2665
- arrowRenderer: resolveArrowRenderer(params?.arrowRenderer ?? {}),
2666
- arrowLength: this.arrowLength,
2667
- hasSourceArrow: this.hasSourceArrow,
2668
- hasTargetArrow: this.hasTargetArrow,
2669
- createCyclePath: this.createCyclePath,
2670
- createDetourPath: this.createDetourPath,
2671
- createLinePath: this.createLinePath,
2672
- padding: 50
2673
- });
2674
- this.element = this.pathShape.element;
2675
- this.svg = this.element;
2676
- this.group = this.pathShape.group;
2677
- this.line = this.pathShape.line;
2678
- this.sourceArrow = this.pathShape.sourceArrow;
2679
- this.targetArrow = this.pathShape.targetArrow;
2680
- this.onAfterRender = this.pathShape.onAfterRender;
2681
- }
2682
- render(params) {
2683
- const { from, to, category } = params;
2684
- this.pathShape.render({
2685
- category,
2686
- from: {
2687
- ...from,
2688
- direction: verticalizeDirection(from.direction)
2689
- },
2690
- to: {
2691
- ...to,
2692
- direction: verticalizeDirection(to.direction)
2693
- }
2694
- });
2695
- }
2696
- };
2697
- //#endregion
2698
2411
  //#region src/edges/shapes/orthogonal-edge-shape/orthogonalize-direction/orthogonalize-direction.ts
2699
2412
  var orthogonalizeDirection = (direction) => {
2700
2413
  const adjDir = direction + Math.PI / 4;
@@ -2711,7 +2424,6 @@
2711
2424
  //#region src/edges/shapes/orthogonal-edge-shape/orthogonal-edge-shape.ts
2712
2425
  var OrthogonalEdgeShape = class {
2713
2426
  element;
2714
- svg;
2715
2427
  group;
2716
2428
  line;
2717
2429
  sourceArrow;
@@ -2779,7 +2491,6 @@
2779
2491
  padding: 50
2780
2492
  });
2781
2493
  this.element = this.pathShape.element;
2782
- this.svg = this.element;
2783
2494
  this.group = this.pathShape.group;
2784
2495
  this.line = this.pathShape.line;
2785
2496
  this.sourceArrow = this.pathShape.sourceArrow;
@@ -2826,7 +2537,6 @@
2826
2537
  var defaultPortOffset = edgeConstants.portOffset;
2827
2538
  var DirectEdgeShape = class {
2828
2539
  element;
2829
- svg;
2830
2540
  group = document.createElementNS("http://www.w3.org/2000/svg", "g");
2831
2541
  line;
2832
2542
  sourceArrow = null;
@@ -2848,7 +2558,6 @@
2848
2558
  this.sourceOffsetFn = resolvePortOffsetFn(params?.sourceOffset ?? defaultPortOffset);
2849
2559
  this.targetOffsetFn = resolvePortOffsetFn(params?.targetOffset ?? defaultPortOffset);
2850
2560
  this.element = createEdgeSvg(this.color);
2851
- this.svg = this.element;
2852
2561
  this.element.appendChild(this.group);
2853
2562
  this.line = createEdgePath(this.width);
2854
2563
  this.group.appendChild(this.line);
@@ -3029,15 +2738,10 @@
3029
2738
  var InteractiveEdgeShape = class InteractiveEdgeShape {
3030
2739
  baseEdge;
3031
2740
  element;
3032
- svg;
3033
2741
  group;
3034
2742
  line;
3035
2743
  sourceArrow;
3036
2744
  targetArrow;
3037
- /**
3038
- * @deprecated
3039
- * use shape.svg instead
3040
- */
3041
2745
  handle = createEdgeGroup();
3042
2746
  onAfterRender;
3043
2747
  interactiveLine;
@@ -3047,7 +2751,6 @@
3047
2751
  this.baseEdge = baseEdge;
3048
2752
  if (baseEdge instanceof InteractiveEdgeShape) throw new InteractiveEdgeError("interactive edge can be configured only once");
3049
2753
  this.element = this.baseEdge.element;
3050
- this.svg = this.element;
3051
2754
  this.group = this.baseEdge.group;
3052
2755
  this.line = this.baseEdge.line;
3053
2756
  this.sourceArrow = this.baseEdge.sourceArrow;
@@ -3086,12 +2789,10 @@
3086
2789
  targetArrow;
3087
2790
  onAfterRender;
3088
2791
  element;
3089
- svg;
3090
2792
  constructor(baseShape, midpointElement) {
3091
2793
  this.baseShape = baseShape;
3092
2794
  this.midpointElement = midpointElement;
3093
2795
  this.element = this.baseShape.element;
3094
- this.svg = this.element;
3095
2796
  this.group = this.baseShape.group;
3096
2797
  this.line = this.baseShape.line;
3097
2798
  this.sourceArrow = this.baseShape.sourceArrow;
@@ -3391,17 +3092,6 @@
3391
3092
  }
3392
3093
  };
3393
3094
  //#endregion
3394
- //#region src/schedule-fn/macrotask-schedule-fn/macrotask-schedule-fn.ts
3395
- /**
3396
- * @deprecated
3397
- * use macrotaskScheduleFn instead
3398
- */
3399
- var macrotaskScheduleFn = (callback) => {
3400
- setTimeout(() => {
3401
- callback();
3402
- });
3403
- };
3404
- //#endregion
3405
3095
  //#region src/schedule-fn/microtask-schedule-fn/microtask-schedule-fn.ts
3406
3096
  var microtaskScheduleFn = (callback) => {
3407
3097
  queueMicrotask(() => {
@@ -3453,7 +3143,7 @@
3453
3143
  } : {
3454
3144
  minContentScale: config.minContentScale ?? controllerParams.focus.minContentScale,
3455
3145
  nodes: config.nodes ?? [],
3456
- contentPadding: config.contentPadding ?? config.contentOffset ?? controllerParams.focus.contentPadding,
3146
+ contentPadding: config.contentPadding ?? controllerParams.focus.contentPadding,
3457
3147
  animationDuration: config.animationDuration ?? controllerParams.focus.animationDuration
3458
3148
  };
3459
3149
  };
@@ -4005,12 +3695,7 @@
4005
3695
  const element = event.currentTarget;
4006
3696
  const nodeId = this.canvas.graph.findNodeIdByElement(element);
4007
3697
  const node = this.graph.getNode(nodeId);
4008
- if (!this.params.nodeDragVerifier({
4009
- nodeId,
4010
- element: node.element,
4011
- x: node.x,
4012
- y: node.y
4013
- })) return;
3698
+ if (!this.params.nodeDragVerifier(nodeId)) return;
4014
3699
  this.eventTagger.tag(event, dragEventHandledTag);
4015
3700
  const cursorContent = this.calculateContentPoint({
4016
3701
  x: touch.clientX,
@@ -4295,8 +3980,10 @@
4295
3980
  const transform = this.params.transformPreprocessor({
4296
3981
  prevTransform,
4297
3982
  nextTransform,
4298
- canvasWidth: width,
4299
- canvasHeight: height
3983
+ viewport: {
3984
+ width,
3985
+ height
3986
+ }
4300
3987
  });
4301
3988
  this.performTransform(transform);
4302
3989
  }
@@ -4307,8 +3994,10 @@
4307
3994
  const transform = this.params.transformPreprocessor({
4308
3995
  prevTransform,
4309
3996
  nextTransform,
4310
- canvasWidth: width,
4311
- canvasHeight: height
3997
+ viewport: {
3998
+ width,
3999
+ height
4000
+ }
4312
4001
  });
4313
4002
  this.performTransform(transform);
4314
4003
  }
@@ -4350,8 +4039,10 @@
4350
4039
  const transform = this.params.transformPreprocessor({
4351
4040
  prevTransform,
4352
4041
  nextTransform: prevTransform,
4353
- canvasWidth: width,
4354
- canvasHeight: height
4042
+ viewport: {
4043
+ width,
4044
+ height
4045
+ }
4355
4046
  });
4356
4047
  this.params.onResizeTransformStarted();
4357
4048
  this.canvas.patchViewportMatrix(transform);
@@ -5254,9 +4945,9 @@
5254
4945
  //#endregion
5255
4946
  //#region src/canvas-builder/shared/resolve-dragging-port-direction-resolver/resolve-dragging-port-direction-resolver.ts
5256
4947
  var resolveDraggingPortDirectionResolver = (config, graph, connectionAllowedVerifier) => {
5257
- if (config === "closest-connectable-port") return new NearestConnectablePortDraggingPortDirectionResolver(graph, connectionAllowedVerifier);
5258
4948
  if (config === "nearest-connectable-port") return new NearestConnectablePortDraggingPortDirectionResolver(graph, connectionAllowedVerifier);
5259
- return new ConstantDraggingPortDirectionResolver(config);
4949
+ if (typeof config === "number") return new ConstantDraggingPortDirectionResolver(config);
4950
+ return new ConstantDraggingPortDirectionResolver(void 0);
5260
4951
  };
5261
4952
  //#endregion
5262
4953
  //#region src/canvas-builder/shared/resolve-edge-shape-factory/resolve-edge-shape-factory.ts
@@ -5276,30 +4967,6 @@
5276
4967
  detourDistance: config.detourDistance,
5277
4968
  detourDirection: config.detourDirection
5278
4969
  });
5279
- case "horizontal": return () => new HorizontalEdgeShape({
5280
- color: config.color,
5281
- width: config.width,
5282
- arrowLength: config.arrowLength,
5283
- arrowOffset: config.arrowOffset,
5284
- arrowRenderer: config.arrowRenderer,
5285
- hasSourceArrow: config.hasSourceArrow,
5286
- hasTargetArrow: config.hasTargetArrow,
5287
- cycleSquareSide: config.cycleSquareSide,
5288
- roundness: config.roundness,
5289
- detourDistance: config.detourDistance
5290
- });
5291
- case "vertical": return () => new VerticalEdgeShape({
5292
- color: config.color,
5293
- width: config.width,
5294
- arrowLength: config.arrowLength,
5295
- arrowOffset: config.arrowOffset,
5296
- arrowRenderer: config.arrowRenderer,
5297
- hasSourceArrow: config.hasSourceArrow,
5298
- hasTargetArrow: config.hasTargetArrow,
5299
- cycleSquareSide: config.cycleSquareSide,
5300
- roundness: config.roundness,
5301
- detourDistance: config.detourDistance
5302
- });
5303
4970
  case "orthogonal": return () => new OrthogonalEdgeShape({
5304
4971
  color: config.color,
5305
4972
  width: config.width,
@@ -5373,10 +5040,10 @@
5373
5040
  let dx = params.nextTransform.x;
5374
5041
  let dy = params.nextTransform.y;
5375
5042
  if (dx < minX && dx < params.prevTransform.x) dx = Math.min(params.prevTransform.x, minX);
5376
- const maxScreenX = maxX - params.canvasWidth * params.prevTransform.scale;
5043
+ const maxScreenX = maxX - params.viewport.width * params.prevTransform.scale;
5377
5044
  if (dx > maxScreenX && dx > params.prevTransform.x) dx = Math.max(params.prevTransform.x, maxScreenX);
5378
5045
  if (dy < minY && dy < params.prevTransform.y) dy = Math.min(params.prevTransform.y, minY);
5379
- const maxScreenY = maxY - params.canvasHeight * params.prevTransform.scale;
5046
+ const maxScreenY = maxY - params.viewport.height * params.prevTransform.scale;
5380
5047
  if (dy > maxScreenY && dy > params.prevTransform.y) dy = Math.max(params.prevTransform.y, maxScreenY);
5381
5048
  return {
5382
5049
  scale: params.nextTransform.scale,
@@ -5424,8 +5091,7 @@
5424
5091
  return preprocessors.reduce((acc, cur) => cur({
5425
5092
  prevTransform: params.prevTransform,
5426
5093
  nextTransform: acc,
5427
- canvasWidth: params.canvasWidth,
5428
- canvasHeight: params.canvasHeight
5094
+ viewport: params.viewport
5429
5095
  }), params.nextTransform);
5430
5096
  };
5431
5097
  };
@@ -5458,10 +5124,10 @@
5458
5124
  else transformPreprocessor = (params) => {
5459
5125
  return params.nextTransform;
5460
5126
  };
5461
- const shiftCursor = transformConfig?.shift?.cursor !== void 0 ? transformConfig.shift.cursor : "grab";
5462
- const defaultMouseDownEventVerifier = transformConfig?.shift?.mouseDownEventVerifier;
5127
+ const shiftCursor = transformConfig?.pan?.cursor !== void 0 ? transformConfig.pan.cursor : "grab";
5128
+ const defaultMouseDownEventVerifier = transformConfig?.pan?.mouseDownEventVerifier;
5463
5129
  const mouseDownEventVerifier = defaultMouseDownEventVerifier !== void 0 ? defaultMouseDownEventVerifier : (event) => event.button === 0;
5464
- const defaultMouseUpEventVerifier = transformConfig?.shift?.mouseUpEventVerifier;
5130
+ const defaultMouseUpEventVerifier = transformConfig?.pan?.mouseUpEventVerifier;
5465
5131
  const mouseUpEventVerifier = defaultMouseUpEventVerifier !== void 0 ? defaultMouseUpEventVerifier : (event) => event.button === 0;
5466
5132
  const defaultMouseWheelEventVerifier = transformConfig?.scale?.mouseWheelEventVerifier;
5467
5133
  const mouseWheelEventVerifier = defaultMouseWheelEventVerifier !== void 0 ? defaultMouseWheelEventVerifier : () => true;
@@ -5538,7 +5204,7 @@
5538
5204
  var defaults$2 = Object.freeze({
5539
5205
  connectionAllowedVerifier: () => true,
5540
5206
  connectionPreprocessor: (request) => request,
5541
- mouseDownEventVerifier: (event) => event.button === 0 && event.ctrlKey,
5207
+ mouseDownEventVerifier: (event) => event.button === 0,
5542
5208
  mouseUpEventVerifier: (event) => event.button === 0
5543
5209
  });
5544
5210
  //#endregion
@@ -6225,7 +5891,7 @@
6225
5891
  this.nodeMass = params.nodeMass;
6226
5892
  this.edgeEquilibriumLength = params.edgeEquilibriumLength;
6227
5893
  this.edgeStiffness = params.edgeStiffness;
6228
- this.convergenceVelocity = params.convergenceVelocity;
5894
+ this.convergenceVelocity = params.stopVelocity;
6229
5895
  this.distanceVectorGenerator = new DistanceVectorGenerator(params.rand);
6230
5896
  this.nodeForcesApplicationStrategy = resolveNodeForcesApplicationStrategy({
6231
5897
  distanceVectorGenerator: this.distanceVectorGenerator,
@@ -6481,7 +6147,7 @@
6481
6147
  edgeStiffness;
6482
6148
  fillerLayoutAlgorithm;
6483
6149
  constructor(params) {
6484
- this.convergenceVelocity = params.convergenceVelocity;
6150
+ this.convergenceVelocity = params.stopVelocity;
6485
6151
  this.maxTimeDeltaSec = params.maxTimeDeltaSec;
6486
6152
  this.nodeMass = params.nodeMass;
6487
6153
  this.edgeEquilibriumLength = params.edgeEquilibriumLength;
@@ -6580,7 +6246,7 @@
6580
6246
  nodeMass: config?.nodeMass ?? forceDirectedDefaults.nodeMass,
6581
6247
  edgeEquilibriumLength: config?.edgeEquilibriumLength ?? forceDirectedDefaults.edgeEquilibriumLength,
6582
6248
  edgeStiffness: config?.edgeStiffness ?? forceDirectedDefaults.edgeStiffness,
6583
- convergenceVelocity: config?.convergenceVelocity ?? forceDirectedDefaults.convergenceVelocity,
6249
+ stopVelocity: config?.stopVelocity ?? forceDirectedDefaults.convergenceVelocity,
6584
6250
  maxForce: config?.maxForce ?? forceDirectedDefaults.maxForce,
6585
6251
  nodeForceCoefficient: config?.nodeForceCoefficient ?? forceDirectedDefaults.nodeForceCoefficient,
6586
6252
  barnesHutTheta: config?.barnesHut?.theta ?? forceDirectedDefaults.barnesHutTheta,
@@ -6609,14 +6275,6 @@
6609
6275
  type: "trigger",
6610
6276
  trigger: applyOn
6611
6277
  };
6612
- if (applyOn === "topologyChangeMicrotask") return {
6613
- type: "topologyChangeSchedule",
6614
- schedule: microtaskScheduleFn
6615
- };
6616
- if (applyOn?.type === "topologyChangeMacrotask") return {
6617
- type: "topologyChangeSchedule",
6618
- schedule: macrotaskScheduleFn
6619
- };
6620
6278
  return {
6621
6279
  type: "topologyChangeSchedule",
6622
6280
  schedule: microtaskScheduleFn
@@ -6812,7 +6470,7 @@
6812
6470
  nodeMass: config?.nodeMass ?? forceDirectedDefaults.nodeMass,
6813
6471
  edgeEquilibriumLength: config?.edgeEquilibriumLength ?? forceDirectedDefaults.edgeEquilibriumLength,
6814
6472
  edgeStiffness: config?.edgeStiffness ?? forceDirectedDefaults.edgeStiffness,
6815
- convergenceVelocity: config?.convergenceVelocity ?? forceDirectedDefaults.convergenceVelocity,
6473
+ stopVelocity: config?.stopVelocity ?? forceDirectedDefaults.convergenceVelocity,
6816
6474
  maxForce: config?.maxForce ?? forceDirectedDefaults.maxForce,
6817
6475
  nodeForceCoefficient: config?.nodeForceCoefficient ?? forceDirectedDefaults.nodeForceCoefficient,
6818
6476
  barnesHutTheta: config?.barnesHut?.theta ?? forceDirectedDefaults.barnesHutTheta,
@@ -6927,7 +6585,7 @@
6927
6585
  const { canvasDefaults } = params;
6928
6586
  const schedule = params.hasLayout ? resolveLayoutFocusSchedule(params.layoutParams) : immediateScheduleFn;
6929
6587
  return { focus: {
6930
- contentPadding: canvasDefaults.focus?.contentPadding ?? canvasDefaults.focus?.contentOffset ?? 100,
6588
+ contentPadding: canvasDefaults.focus?.contentPadding ?? 100,
6931
6589
  minContentScale: canvasDefaults.focus?.minContentScale ?? 0,
6932
6590
  schedule,
6933
6591
  animationDuration: canvasDefaults.focus?.animationDuration ?? 0
@@ -7133,12 +6791,9 @@
7133
6791
  exports.ConnectionCategory = ConnectionCategory;
7134
6792
  exports.DirectEdgeShape = DirectEdgeShape;
7135
6793
  exports.EventSubject = EventSubject;
7136
- exports.HorizontalEdgeShape = HorizontalEdgeShape;
7137
6794
  exports.InteractiveEdgeError = InteractiveEdgeError;
7138
6795
  exports.InteractiveEdgeShape = InteractiveEdgeShape;
7139
6796
  exports.MidpointEdgeShape = MidpointEdgeShape;
7140
6797
  exports.OrthogonalEdgeShape = OrthogonalEdgeShape;
7141
6798
  exports.StraightEdgeShape = StraightEdgeShape;
7142
- exports.VerticalEdgeShape = VerticalEdgeShape;
7143
- exports.boxPortOffsetFn = boxPortOffsetFn;
7144
6799
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@html-graph/html-graph",
3
3
  "author": "Dmitry Marov <d.marov94@gmail.com>",
4
4
  "private": false,
5
- "version": "8.24.0",
5
+ "version": "9.0.0",
6
6
  "type": "module",
7
7
  "main": "dist/html-graph.js",
8
8
  "types": "dist/html-graph.d.ts",