@tscircuit/capacity-autorouter 0.0.40 → 0.0.41
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 +9 -3
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -259,6 +259,7 @@ declare class CapacityPathingSolver extends BaseSolver {
|
|
|
259
259
|
connection: SimpleRouteConnection;
|
|
260
260
|
nodes: CapacityMeshNode[];
|
|
261
261
|
path?: CapacityMeshNode[];
|
|
262
|
+
straightLineDistance: number;
|
|
262
263
|
}>;
|
|
263
264
|
usedNodeCapacityMap: Map<CapacityMeshNodeId, number>;
|
|
264
265
|
simpleRouteJson: SimpleRouteJson;
|
|
@@ -291,6 +292,7 @@ declare class CapacityPathingSolver extends BaseSolver {
|
|
|
291
292
|
connection: SimpleRouteConnection;
|
|
292
293
|
nodes: CapacityMeshNode[];
|
|
293
294
|
pathFound: boolean;
|
|
295
|
+
straightLineDistance: number;
|
|
294
296
|
}[];
|
|
295
297
|
connectionNameToGoalNodeIds: Map<string, string[]>;
|
|
296
298
|
};
|
|
@@ -1420,10 +1422,10 @@ interface CapacityMeshSolverOptions {
|
|
|
1420
1422
|
type PipelineStep<T extends new (...args: any[]) => BaseSolver> = {
|
|
1421
1423
|
solverName: string;
|
|
1422
1424
|
solverClass: T;
|
|
1423
|
-
getConstructorParams: (instance:
|
|
1424
|
-
onSolved?: (instance:
|
|
1425
|
+
getConstructorParams: (instance: AutoroutingPipelineSolver) => ConstructorParameters<T>;
|
|
1426
|
+
onSolved?: (instance: AutoroutingPipelineSolver) => void;
|
|
1425
1427
|
};
|
|
1426
|
-
declare class
|
|
1428
|
+
declare class AutoroutingPipelineSolver extends BaseSolver {
|
|
1427
1429
|
srj: SimpleRouteJson;
|
|
1428
1430
|
opts: CapacityMeshSolverOptions;
|
|
1429
1431
|
netToPointPairsSolver?: NetToPointPairsSolver;
|
|
@@ -1452,6 +1454,7 @@ declare class CapacityMeshSolver extends BaseSolver {
|
|
|
1452
1454
|
constructor(srj: SimpleRouteJson, opts?: CapacityMeshSolverOptions);
|
|
1453
1455
|
currentPipelineStepIndex: number;
|
|
1454
1456
|
_step(): void;
|
|
1457
|
+
solveUntilPhase(phase: string): void;
|
|
1455
1458
|
getCurrentPhase(): string;
|
|
1456
1459
|
visualize(): GraphicsObject;
|
|
1457
1460
|
/**
|
|
@@ -1477,6 +1480,9 @@ declare class CapacityMeshSolver extends BaseSolver {
|
|
|
1477
1480
|
getOutputSimplifiedPcbTraces(): SimplifiedPcbTraces;
|
|
1478
1481
|
getOutputSimpleRouteJson(): SimpleRouteJson;
|
|
1479
1482
|
}
|
|
1483
|
+
/** @deprecated Use AutoroutingPipelineSolver instead */
|
|
1484
|
+
declare const CapacityMeshSolver: typeof AutoroutingPipelineSolver;
|
|
1485
|
+
type CapacityMeshSolver = AutoroutingPipelineSolver;
|
|
1480
1486
|
|
|
1481
1487
|
/**
|
|
1482
1488
|
* Calculate the capacity of a node based on its width
|
package/dist/index.js
CHANGED
|
@@ -5968,9 +5968,16 @@ var CapacityPathingSolver = class extends BaseSolver {
|
|
|
5968
5968
|
connectionsWithNodes.push({
|
|
5969
5969
|
connection,
|
|
5970
5970
|
nodes: nodesForConnection,
|
|
5971
|
-
pathFound: false
|
|
5971
|
+
pathFound: false,
|
|
5972
|
+
straightLineDistance: distance(
|
|
5973
|
+
nodesForConnection[0].center,
|
|
5974
|
+
nodesForConnection[nodesForConnection.length - 1].center
|
|
5975
|
+
)
|
|
5972
5976
|
});
|
|
5973
5977
|
}
|
|
5978
|
+
connectionsWithNodes.sort(
|
|
5979
|
+
(a, b) => a.straightLineDistance - b.straightLineDistance
|
|
5980
|
+
);
|
|
5974
5981
|
return { connectionsWithNodes, connectionNameToGoalNodeIds };
|
|
5975
5982
|
}
|
|
5976
5983
|
currentConnectionIndex = 0;
|
|
@@ -7840,7 +7847,7 @@ function definePipelineStep(solverName, solverClass, getConstructorParams, opts
|
|
|
7840
7847
|
onSolved: opts.onSolved
|
|
7841
7848
|
};
|
|
7842
7849
|
}
|
|
7843
|
-
var
|
|
7850
|
+
var AutoroutingPipelineSolver = class extends BaseSolver {
|
|
7844
7851
|
constructor(srj, opts = {}) {
|
|
7845
7852
|
super();
|
|
7846
7853
|
this.srj = srj;
|
|
@@ -8072,6 +8079,11 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
8072
8079
|
this.timeSpentOnPhase[pipelineStepDef.solverName] = 0;
|
|
8073
8080
|
this.startTimeOfPhase[pipelineStepDef.solverName] = performance.now();
|
|
8074
8081
|
}
|
|
8082
|
+
solveUntilPhase(phase) {
|
|
8083
|
+
while (this.getCurrentPhase() !== phase) {
|
|
8084
|
+
this.step();
|
|
8085
|
+
}
|
|
8086
|
+
}
|
|
8075
8087
|
getCurrentPhase() {
|
|
8076
8088
|
return this.pipelineDef[this.currentPipelineStepIndex]?.solverName ?? "none";
|
|
8077
8089
|
}
|
|
@@ -8242,6 +8254,7 @@ var CapacityMeshSolver = class extends BaseSolver {
|
|
|
8242
8254
|
};
|
|
8243
8255
|
}
|
|
8244
8256
|
};
|
|
8257
|
+
var CapacityMeshSolver = AutoroutingPipelineSolver;
|
|
8245
8258
|
export {
|
|
8246
8259
|
CapacityMeshSolver,
|
|
8247
8260
|
calculateOptimalCapacityDepth,
|