@tscircuit/capacity-autorouter 0.0.38 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -503,6 +503,7 @@ type FutureConnection = {
503
503
  points: {
504
504
  x: number;
505
505
  y: number;
506
+ z: number;
506
507
  }[];
507
508
  };
508
509
  declare class SingleHighDensityRouteSolver extends BaseSolver {
@@ -619,9 +620,10 @@ declare class IntraNodeRouteSolver extends BaseSolver {
619
620
  failedSubSolvers: SingleHighDensityRouteSolver[];
620
621
  hyperParameters: Partial<HighDensityHyperParameters>;
621
622
  minDistBetweenEnteringPoints: number;
622
- activeSolver: SingleHighDensityRouteSolver | null;
623
+ activeSubSolver: SingleHighDensityRouteSolver | null;
623
624
  connMap?: ConnectivityMap;
624
625
  get failedSolvers(): SingleHighDensityRouteSolver[];
626
+ get activeSolver(): SingleHighDensityRouteSolver | null;
625
627
  constructor(params: {
626
628
  nodeWithPortPoints: NodeWithPortPoints;
627
629
  colorMap?: Record<string, string>;
package/dist/index.js CHANGED
@@ -2454,7 +2454,7 @@ var SingleHighDensityRouteSolver6_VertHorzLayer_FutureCost = class extends Singl
2454
2454
  let closestPoint = null;
2455
2455
  for (const futureConnection of this.futureConnections) {
2456
2456
  for (const point of futureConnection.points) {
2457
- const dist = distance(node, point);
2457
+ const dist = distance(node, point) + (node.z !== point.z ? this.viaPenaltyDistance : 0);
2458
2458
  if (dist < minDist) {
2459
2459
  minDist = dist;
2460
2460
  closestPoint = point;
@@ -2568,6 +2568,9 @@ var getMinDistBetweenEnteringPoints = (node) => {
2568
2568
  const points = node.portPoints;
2569
2569
  for (let i = 0; i < points.length; i++) {
2570
2570
  for (let j = i + 1; j < points.length; j++) {
2571
+ if (points[i].z !== points[j].z) {
2572
+ continue;
2573
+ }
2571
2574
  const p1 = points[i];
2572
2575
  const p2 = points[j];
2573
2576
  const dist = Math.sqrt((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2);
@@ -2587,12 +2590,16 @@ var IntraNodeRouteSolver = class extends BaseSolver {
2587
2590
  failedSubSolvers;
2588
2591
  hyperParameters;
2589
2592
  minDistBetweenEnteringPoints;
2590
- activeSolver = null;
2593
+ activeSubSolver = null;
2591
2594
  connMap;
2592
2595
  // Legacy compat
2593
2596
  get failedSolvers() {
2594
2597
  return this.failedSubSolvers;
2595
2598
  }
2599
+ // Legacy compat
2600
+ get activeSolver() {
2601
+ return this.activeSubSolver;
2602
+ }
2596
2603
  constructor(params) {
2597
2604
  const { nodeWithPortPoints, colorMap } = params;
2598
2605
  super();
@@ -2651,18 +2658,18 @@ var IntraNodeRouteSolver = class extends BaseSolver {
2651
2658
  // this.unsolvedConnections = []
2652
2659
  // }
2653
2660
  computeProgress() {
2654
- return (this.solvedRoutes.length + (this.activeSolver?.progress || 0)) / this.totalConnections;
2661
+ return (this.solvedRoutes.length + (this.activeSubSolver?.progress || 0)) / this.totalConnections;
2655
2662
  }
2656
2663
  _step() {
2657
- if (this.activeSolver) {
2658
- this.activeSolver.step();
2664
+ if (this.activeSubSolver) {
2665
+ this.activeSubSolver.step();
2659
2666
  this.progress = this.computeProgress();
2660
- if (this.activeSolver.solved) {
2661
- this.solvedRoutes.push(this.activeSolver.solvedPath);
2662
- this.activeSolver = null;
2663
- } else if (this.activeSolver.failed) {
2664
- this.failedSubSolvers.push(this.activeSolver);
2665
- this.activeSolver = null;
2667
+ if (this.activeSubSolver.solved) {
2668
+ this.solvedRoutes.push(this.activeSubSolver.solvedPath);
2669
+ this.activeSubSolver = null;
2670
+ } else if (this.activeSubSolver.failed) {
2671
+ this.failedSubSolvers.push(this.activeSubSolver);
2672
+ this.activeSubSolver = null;
2666
2673
  this.error = this.failedSubSolvers.map((s) => s.error).join("\n");
2667
2674
  this.failed = true;
2668
2675
  }
@@ -2684,7 +2691,7 @@ var IntraNodeRouteSolver = class extends BaseSolver {
2684
2691
  }
2685
2692
  }
2686
2693
  const { connectionName, points } = unsolvedConnection;
2687
- this.activeSolver = new SingleHighDensityRouteSolver6_VertHorzLayer_FutureCost({
2694
+ this.activeSubSolver = new SingleHighDensityRouteSolver6_VertHorzLayer_FutureCost({
2688
2695
  connectionName,
2689
2696
  minDistBetweenEnteringPoints: this.minDistBetweenEnteringPoints,
2690
2697
  bounds: getBoundsFromNodeWithPortPoints(this.nodeWithPortPoints),