@html-graph/html-graph 8.18.1 → 8.19.1

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.
@@ -413,7 +413,12 @@ export declare interface DraggableNodesConfig {
413
413
 
414
414
  export declare type DraggingEdgeResolver = (portId: Identifier) => Identifier | null;
415
415
 
416
- export declare type DraggingPortDirectionConfig = number | undefined | "closest-connectable-port";
416
+ export declare type DraggingPortDirectionConfig = number | undefined
417
+ /**
418
+ * @deprecated
419
+ * use "nearest-connectable-port" instead
420
+ */
421
+ | "closest-connectable-port" | "nearest-connectable-port";
417
422
 
418
423
  export declare interface EdgeCreationInProgressParams {
419
424
  readonly staticPortId: Identifier;
@@ -729,7 +734,7 @@ export declare class InteractiveEdgeShape implements StructuredEdgeShape {
729
734
  readonly targetArrow: SVGPathElement | null;
730
735
  /**
731
736
  * @deprecated
732
- * do use shape.svg instead
737
+ * use shape.svg instead
733
738
  */
734
739
  readonly handle: SVGGElement;
735
740
  readonly onAfterRender: EventHandler<StructuredEdgeRenderModel>;
@@ -776,7 +781,7 @@ export declare interface LayoutAlgorithmParams {
776
781
  readonly viewport: Viewport;
777
782
  }
778
783
 
779
- export declare type LayoutApplyOn = TopologyChangeMacrotask | TopologyChangeMicrotask | EventSubject<void>;
784
+ export declare type LayoutApplyOn = TopologyChangeMacrotask | TopologyChangeMicrotask | "topologyChangeMicrotask" | EventSubject<void>;
780
785
 
781
786
  export declare interface LayoutConfig {
782
787
  readonly algorithm?: LayoutAlgorithmConfig | undefined;
@@ -949,7 +954,7 @@ export declare interface StructuredEdgeShape extends EdgeShape {
949
954
 
950
955
  /**
951
956
  * @deprecated
952
- * use topologyChangeMicrotask instead
957
+ * use "topologyChangeMicrotask" instead
953
958
  */
954
959
  declare type TopologyChangeMacrotask = {
955
960
  type: "topologyChangeMacrotask";
@@ -2620,8 +2620,8 @@ class DirectEdgeShape {
2620
2620
  };
2621
2621
  if (this.sourceArrow) {
2622
2622
  const sourceOffset = {
2623
- x: direction.x * this.sourceOffset,
2624
- y: direction.y * this.sourceOffset
2623
+ x: direction.x * this.sourceOffset + from.x,
2624
+ y: direction.y * this.sourceOffset + from.y
2625
2625
  };
2626
2626
  sourceArrowPath = this.arrowRenderer({
2627
2627
  direction,
@@ -2691,7 +2691,7 @@ class InteractiveEdgeShape {
2691
2691
  // TODO: make private
2692
2692
  /**
2693
2693
  * @deprecated
2694
- * do use shape.svg instead
2694
+ * use shape.svg instead
2695
2695
  */
2696
2696
  __publicField(this, "handle", createEdgeGroup());
2697
2697
  __publicField(this, "onAfterRender");
@@ -3590,7 +3590,7 @@ const resolveCreateEdgeRequest = (params, targetPortId) => {
3590
3590
  to: params.isDirect ? targetPortId : params.staticPortId
3591
3591
  };
3592
3592
  };
3593
- class ClosestConnectablePortDraggingPortDirectionResolver {
3593
+ class NearestConnectablePortDraggingPortDirectionResolver {
3594
3594
  constructor(graph, connectionAllowedVerifier) {
3595
3595
  this.graph = graph;
3596
3596
  this.connectionAllowedVerifier = connectionAllowedVerifier;
@@ -5050,7 +5050,13 @@ const noopFn = () => {
5050
5050
  };
5051
5051
  const resolveDraggingPortDirectionResolver = (config, graph, connectionAllowedVerifier) => {
5052
5052
  if (config === "closest-connectable-port") {
5053
- return new ClosestConnectablePortDraggingPortDirectionResolver(
5053
+ return new NearestConnectablePortDraggingPortDirectionResolver(
5054
+ graph,
5055
+ connectionAllowedVerifier
5056
+ );
5057
+ }
5058
+ if (config === "nearest-connectable-port") {
5059
+ return new NearestConnectablePortDraggingPortDirectionResolver(
5054
5060
  graph,
5055
5061
  connectionAllowedVerifier
5056
5062
  );
@@ -6421,6 +6427,7 @@ const resolveAnimatedLayoutAlgorithm = (config) => {
6421
6427
  nodeMass: (config == null ? void 0 : config.nodeMass) ?? forceDirectedDefaults.nodeMass,
6422
6428
  edgeEquilibriumLength: (config == null ? void 0 : config.edgeEquilibriumLength) ?? forceDirectedDefaults.edgeEquilibriumLength,
6423
6429
  edgeStiffness: (config == null ? void 0 : config.edgeStiffness) ?? forceDirectedDefaults.edgeStiffness,
6430
+ // TODO: rename no `minVelocity`
6424
6431
  convergenceVelocity: (config == null ? void 0 : config.convergenceVelocity) ?? forceDirectedDefaults.convergenceVelocity,
6425
6432
  maxForce: (config == null ? void 0 : config.maxForce) ?? forceDirectedDefaults.maxForce,
6426
6433
  nodeForceCoefficient: (config == null ? void 0 : config.nodeForceCoefficient) ?? forceDirectedDefaults.nodeForceCoefficient,
@@ -6450,6 +6457,12 @@ const resolveLayoutApplyOn = (applyOn) => {
6450
6457
  trigger: applyOn
6451
6458
  };
6452
6459
  }
6460
+ if (applyOn === "topologyChangeMicrotask") {
6461
+ return {
6462
+ type: "topologyChangeSchedule",
6463
+ schedule: microtaskScheduleFn
6464
+ };
6465
+ }
6453
6466
  if ((applyOn == null ? void 0 : applyOn.type) === "topologyChangeMacrotask") {
6454
6467
  return {
6455
6468
  type: "topologyChangeSchedule",