@tscircuit/core 0.0.534 → 0.0.536

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
@@ -145,7 +145,10 @@ interface SimpleRouteConnection {
145
145
  x: number;
146
146
  y: number;
147
147
  layer: string;
148
+ pointId?: string;
149
+ pcb_port_id?: string;
148
150
  }>;
151
+ externallyConnectedPointIds?: string[][];
149
152
  }
150
153
  interface SimpleRouteJson {
151
154
  layerCount: number;
package/dist/index.js CHANGED
@@ -7022,13 +7022,17 @@ var getSimpleRouteJsonFromCircuitJson = ({
7022
7022
  {
7023
7023
  x: portA.x,
7024
7024
  y: portA.y,
7025
- layer: layerA
7025
+ layer: layerA,
7026
+ pointId: portA.pcb_port_id,
7027
+ pcb_port_id: portA.pcb_port_id
7026
7028
  },
7027
7029
  ...hintPoints,
7028
7030
  {
7029
7031
  x: portB.x,
7030
7032
  y: portB.y,
7031
- layer: layerB
7033
+ layer: layerB,
7034
+ pointId: portB.pcb_port_id,
7035
+ pcb_port_id: portB.pcb_port_id
7032
7036
  }
7033
7037
  ]
7034
7038
  };
@@ -7052,6 +7056,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
7052
7056
  x: p.x,
7053
7057
  y: p.y,
7054
7058
  layer: p.layers?.[0] ?? "top",
7059
+ pointId: p.pcb_port_id,
7055
7060
  pcb_port_id: p.pcb_port_id
7056
7061
  }));
7057
7062
  })
@@ -7101,6 +7106,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
7101
7106
  x: pcb_port.x,
7102
7107
  y: pcb_port.y,
7103
7108
  layer: pcb_port.layers?.[0] ?? "top",
7109
+ pointId: pcb_port.pcb_port_id,
7104
7110
  // @ts-ignore
7105
7111
  pcb_port_id: pcb_port.pcb_port_id
7106
7112
  },
@@ -7110,15 +7116,41 @@ var getSimpleRouteJsonFromCircuitJson = ({
7110
7116
  }
7111
7117
  }
7112
7118
  }
7119
+ const allConns = [
7120
+ ...directTraceConnections,
7121
+ ...connectionsFromNets,
7122
+ ...connectionsFromBreakoutPoints
7123
+ ];
7124
+ const pointIdToConn = /* @__PURE__ */ new Map();
7125
+ for (const conn of allConns) {
7126
+ for (const pt of conn.pointsToConnect) {
7127
+ if (pt.pointId) pointIdToConn.set(pt.pointId, conn);
7128
+ }
7129
+ }
7130
+ const existingTraces = db.pcb_trace.list().filter(
7131
+ (t) => !subcircuit_id || relevantSubcircuitIds?.has(t.subcircuit_id)
7132
+ );
7133
+ for (const tr of existingTraces) {
7134
+ const tracePortIds = /* @__PURE__ */ new Set();
7135
+ for (const seg of tr.route) {
7136
+ if (seg.start_pcb_port_id) tracePortIds.add(seg.start_pcb_port_id);
7137
+ if (seg.end_pcb_port_id) tracePortIds.add(seg.end_pcb_port_id);
7138
+ }
7139
+ if (tracePortIds.size < 2) continue;
7140
+ const firstId = tracePortIds.values().next().value;
7141
+ if (!firstId) continue;
7142
+ const conn = pointIdToConn.get(firstId);
7143
+ if (!conn) continue;
7144
+ if (![...tracePortIds].every((pid) => pointIdToConn.get(pid) === conn))
7145
+ continue;
7146
+ conn.externallyConnectedPointIds ??= [];
7147
+ conn.externallyConnectedPointIds.push([...tracePortIds]);
7148
+ }
7113
7149
  return {
7114
7150
  simpleRouteJson: {
7115
7151
  bounds,
7116
7152
  obstacles,
7117
- connections: [
7118
- ...directTraceConnections,
7119
- ...connectionsFromNets,
7120
- ...connectionsFromBreakoutPoints
7121
- ],
7153
+ connections: allConns,
7122
7154
  // TODO add traces so that we don't run into things routed by another
7123
7155
  // subcircuit
7124
7156
  layerCount: 2,
@@ -7983,15 +8015,11 @@ var Group = class extends NormalComponent {
7983
8015
  const debug4 = Debug5("tscircuit:core:_runLocalAutorouting");
7984
8016
  debug4(`[${this.getString()}] starting local autorouting`);
7985
8017
  const autorouterConfig = this._getAutorouterConfig();
7986
- const sourceTraceIdsToRoute = this.selectAll("trace").filter((t) => !t.pcb_trace_id).map((t) => t.source_trace_id);
7987
8018
  const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
7988
8019
  db,
7989
8020
  minTraceWidth: this.props.autorouter?.minTraceWidth ?? 0.15,
7990
8021
  subcircuit_id: this.subcircuit_id
7991
8022
  });
7992
- simpleRouteJson.connections = simpleRouteJson.connections.filter(
7993
- (conn) => sourceTraceIdsToRoute.includes(conn.name)
7994
- );
7995
8023
  this.root?.emit("autorouting:start", {
7996
8024
  subcircuit_id: this.subcircuit_id,
7997
8025
  componentDisplayName: this.getString(),
@@ -10670,7 +10698,7 @@ import { identity as identity4 } from "transformation-matrix";
10670
10698
  var package_default = {
10671
10699
  name: "@tscircuit/core",
10672
10700
  type: "module",
10673
- version: "0.0.533",
10701
+ version: "0.0.535",
10674
10702
  types: "dist/index.d.ts",
10675
10703
  main: "dist/index.js",
10676
10704
  module: "dist/index.js",
@@ -10693,7 +10721,7 @@ var package_default = {
10693
10721
  },
10694
10722
  devDependencies: {
10695
10723
  "@biomejs/biome": "^1.8.3",
10696
- "@tscircuit/capacity-autorouter": "^0.0.75",
10724
+ "@tscircuit/capacity-autorouter": "^0.0.89",
10697
10725
  "@tscircuit/checks": "^0.0.52",
10698
10726
  "@tscircuit/circuit-json-util": "^0.0.50",
10699
10727
  "@tscircuit/footprinter": "^0.0.186",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.534",
4
+ "version": "0.0.536",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@biomejs/biome": "^1.8.3",
27
- "@tscircuit/capacity-autorouter": "^0.0.75",
27
+ "@tscircuit/capacity-autorouter": "^0.0.89",
28
28
  "@tscircuit/checks": "^0.0.52",
29
29
  "@tscircuit/circuit-json-util": "^0.0.50",
30
30
  "@tscircuit/footprinter": "^0.0.186",