@tscircuit/core 0.0.2304 → 0.0.2306
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.js +23 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22770,7 +22770,8 @@ function routeSystemBlocks(tree, bounds, initialRoutes) {
|
|
|
22770
22770
|
const labels = /* @__PURE__ */ new Map();
|
|
22771
22771
|
const labelCenters = /* @__PURE__ */ new Map();
|
|
22772
22772
|
const labelAttachments = /* @__PURE__ */ new Map();
|
|
22773
|
-
const portObstacles = [...portsByConnection.values()].flat().map(({ escape }) => ({
|
|
22773
|
+
const portObstacles = [...portsByConnection.values()].flat().map(({ escape, connection }) => ({
|
|
22774
|
+
connection,
|
|
22774
22775
|
left: escape.x - 1,
|
|
22775
22776
|
right: escape.x + 1,
|
|
22776
22777
|
bottom: escape.y - 1,
|
|
@@ -22781,13 +22782,16 @@ function routeSystemBlocks(tree, bounds, initialRoutes) {
|
|
|
22781
22782
|
const center = initialRoutes.get(connection).label_anchor_center;
|
|
22782
22783
|
if (label !== void 0 && center) {
|
|
22783
22784
|
const halfWidth = getSystemConnectionLabelWidth(label) / 2;
|
|
22784
|
-
const occupied = [...obstacles, ...labels.values(), ...portObstacles];
|
|
22785
|
-
const fits = (rectangle) => !occupied.some(
|
|
22786
|
-
(r2) => rectangle.left < r2.right + 1 && rectangle.right > r2.left - 1 && rectangle.bottom < r2.top + 1 && rectangle.top > r2.bottom - 1
|
|
22787
|
-
);
|
|
22788
22785
|
const [start, end] = portsByConnection.get(connection);
|
|
22789
22786
|
const endpoints = tree.endpoints.get(connection);
|
|
22790
22787
|
const selfLoop = endpoints.from === endpoints.to;
|
|
22788
|
+
const occupied = [...obstacles, ...labels.values(), ...portObstacles];
|
|
22789
|
+
const fits = (rectangle, besideOwnLoop = false) => !occupied.some((r2) => {
|
|
22790
|
+
if (besideOwnLoop && "connection" in r2 && r2.connection === connection)
|
|
22791
|
+
return false;
|
|
22792
|
+
const margin = besideOwnLoop && "connection" in r2 ? 0 : 1;
|
|
22793
|
+
return rectangle.left < r2.right + margin && rectangle.right > r2.left - margin && rectangle.bottom < r2.top + margin && rectangle.top > r2.bottom - margin;
|
|
22794
|
+
});
|
|
22791
22795
|
const vertical = start.escape.x === end.escape.x;
|
|
22792
22796
|
const horizontal = start.escape.y === end.escape.y;
|
|
22793
22797
|
const oppositeFaces = (start.side + 2) % 4 === end.side;
|
|
@@ -22804,14 +22808,20 @@ function routeSystemBlocks(tree, bounds, initialRoutes) {
|
|
|
22804
22808
|
};
|
|
22805
22809
|
const signs = selfLoop ? [start.side < 2 ? 1 : -1] : [1, -1];
|
|
22806
22810
|
for (const sign of signs) {
|
|
22807
|
-
const candidate = vertical ? {
|
|
22811
|
+
const candidate = vertical ? {
|
|
22812
|
+
x: attachment.x + sign * (halfWidth + (selfLoop ? 0 : 2)),
|
|
22813
|
+
y: attachment.y
|
|
22814
|
+
} : {
|
|
22815
|
+
x: attachment.x,
|
|
22816
|
+
y: attachment.y + sign * (selfLoop ? 3.5 : 4.5)
|
|
22817
|
+
};
|
|
22808
22818
|
const rectangle = {
|
|
22809
22819
|
left: candidate.x - halfWidth,
|
|
22810
22820
|
right: candidate.x + halfWidth,
|
|
22811
22821
|
bottom: candidate.y - 2.5,
|
|
22812
22822
|
top: candidate.y + 2.5
|
|
22813
22823
|
};
|
|
22814
|
-
if (!fits(rectangle)) continue;
|
|
22824
|
+
if (!fits(rectangle, sameFaceReturn)) continue;
|
|
22815
22825
|
labels.set(connection, rectangle);
|
|
22816
22826
|
labelCenters.set(connection, candidate);
|
|
22817
22827
|
labelAttachments.set(connection, attachment);
|
|
@@ -159360,7 +159370,7 @@ var RoutingPhasePreparationError = class extends Error {
|
|
|
159360
159370
|
var package_default = {
|
|
159361
159371
|
name: "@tscircuit/core",
|
|
159362
159372
|
type: "module",
|
|
159363
|
-
version: "0.0.
|
|
159373
|
+
version: "0.0.2305",
|
|
159364
159374
|
types: "dist/index.d.ts",
|
|
159365
159375
|
main: "dist/index.js",
|
|
159366
159376
|
module: "dist/index.js",
|
|
@@ -161466,6 +161476,7 @@ var Group5 = class extends NormalComponent {
|
|
|
161466
161476
|
});
|
|
161467
161477
|
}
|
|
161468
161478
|
const outputTestPoints = [];
|
|
161479
|
+
let routingError;
|
|
161469
161480
|
const outputTraces = [];
|
|
161470
161481
|
const outputJumpers = [];
|
|
161471
161482
|
const pcbTraceIdsToDelete = /* @__PURE__ */ new Set();
|
|
@@ -161762,6 +161773,7 @@ var Group5 = class extends NormalComponent {
|
|
|
161762
161773
|
debug13(
|
|
161763
161774
|
`[${this.getString()}] local autorouting error: ${event.error.message}`
|
|
161764
161775
|
);
|
|
161776
|
+
routingError = event.error;
|
|
161765
161777
|
reject(event.error);
|
|
161766
161778
|
});
|
|
161767
161779
|
}
|
|
@@ -162077,7 +162089,8 @@ var Group5 = class extends NormalComponent {
|
|
|
162077
162089
|
},
|
|
162078
162090
|
simpleRouteJson
|
|
162079
162091
|
});
|
|
162080
|
-
throw error;
|
|
162092
|
+
if (outputTraces.length === 0 || !routingError) throw error;
|
|
162093
|
+
break;
|
|
162081
162094
|
} finally {
|
|
162082
162095
|
autorouter?.stop();
|
|
162083
162096
|
}
|
|
@@ -162089,6 +162102,7 @@ var Group5 = class extends NormalComponent {
|
|
|
162089
162102
|
pcb_trace_ids_to_be_replaced: [...pcbTraceIdsToDelete]
|
|
162090
162103
|
};
|
|
162091
162104
|
this._markDirty("PcbTraceRender");
|
|
162105
|
+
if (routingError) throw routingError;
|
|
162092
162106
|
}
|
|
162093
162107
|
_startAsyncAutorouting() {
|
|
162094
162108
|
if (this._hasStartedAsyncAutorouting) return;
|