@tscircuit/core 0.0.266 → 0.0.268

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
@@ -648,6 +648,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
648
648
  _doInitialSchematicTraceRenderWithDisplayLabel(): void;
649
649
  private _isSymbolToChipConnection;
650
650
  private _isSymbolToSymbolConnection;
651
+ private _isChipToChipConnection;
651
652
  doInitialSchematicTraceRender(): void;
652
653
  }
653
654
 
package/dist/index.js CHANGED
@@ -5119,6 +5119,15 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5119
5119
  const isPort2Symbol = !port2.parent.config.shouldRenderAsSchematicBox;
5120
5120
  return isPort1Symbol && isPort2Symbol;
5121
5121
  }
5122
+ _isChipToChipConnection() {
5123
+ const { allPortsFound, ports } = this._findConnectedPorts();
5124
+ if (!allPortsFound || ports.length !== 2) return false;
5125
+ const [port1, port2] = ports;
5126
+ if (!port1?.parent || !port2?.parent) return false;
5127
+ const isPort1Chip = port1.parent.config.shouldRenderAsSchematicBox;
5128
+ const isPort2Chip = port2.parent.config.shouldRenderAsSchematicBox;
5129
+ return isPort1Chip && isPort2Chip;
5130
+ }
5122
5131
  doInitialSchematicTraceRender() {
5123
5132
  if (this.root?.schematicDisabled) return;
5124
5133
  const { db } = this.root;
@@ -5214,7 +5223,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5214
5223
  });
5215
5224
  let results = autorouter.solveAndMapToTraces();
5216
5225
  if (results.length === 0) {
5217
- if (this._isSymbolToChipConnection() || this._isSymbolToSymbolConnection()) {
5226
+ if (this._isSymbolToChipConnection() || this._isSymbolToSymbolConnection() || this._isChipToChipConnection()) {
5218
5227
  this._doInitialSchematicTraceRenderWithDisplayLabel();
5219
5228
  return;
5220
5229
  }
@@ -5267,7 +5276,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5267
5276
  if (!this.source_trace_id) {
5268
5277
  throw new Error("Missing source_trace_id for schematic trace insertion.");
5269
5278
  }
5270
- if (this.getSubcircuit()._parsedProps.schTraceAutoLabelEnabled && countComplexElements(junctions, edges) >= 5 && (this._isSymbolToChipConnection() || this._isSymbolToSymbolConnection())) {
5279
+ if (this.getSubcircuit()._parsedProps.schTraceAutoLabelEnabled && countComplexElements(junctions, edges) >= 5 && (this._isSymbolToChipConnection() || this._isSymbolToSymbolConnection() || this._isChipToChipConnection())) {
5271
5280
  this._doInitialSchematicTraceRenderWithDisplayLabel();
5272
5281
  return;
5273
5282
  }
@@ -6565,16 +6574,21 @@ var applyEditEventsToManualEditsFile = ({
6565
6574
  // lib/utils/autorouting/getSimpleRouteJsonFromCircuitJson.ts
6566
6575
  import { getObstaclesFromSoup as getObstaclesFromSoup4 } from "@tscircuit/infgrid-ijump-astar";
6567
6576
  import { su as su3 } from "@tscircuit/soup-util";
6577
+ import { getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson2 } from "circuit-json-to-connectivity-map";
6568
6578
  var getSimpleRouteJsonFromCircuitJson = ({
6569
6579
  circuitJson,
6570
6580
  minTraceWidth = 0.1
6571
6581
  }) => {
6572
6582
  const db = su3(circuitJson);
6573
- const obstacles = getObstaclesFromSoup4([
6574
- ...db.pcb_component.list(),
6575
- ...db.pcb_smtpad.list(),
6576
- ...db.pcb_plated_hole.list()
6577
- ]);
6583
+ const connMap = getFullConnectivityMapFromCircuitJson2(circuitJson);
6584
+ const obstacles = getObstaclesFromSoup4(
6585
+ [
6586
+ ...db.pcb_component.list(),
6587
+ ...db.pcb_smtpad.list(),
6588
+ ...db.pcb_plated_hole.list()
6589
+ ],
6590
+ connMap
6591
+ );
6578
6592
  const allPoints = obstacles.flatMap((o) => [
6579
6593
  {
6580
6594
  x: o.center.x - o.width / 2,
@@ -6602,7 +6616,8 @@ var getSimpleRouteJsonFromCircuitJson = ({
6602
6616
  });
6603
6617
  if (connectedPorts.length < 2) return null;
6604
6618
  return {
6605
- name: trace.source_trace_id ?? "",
6619
+ name: connMap.getNetConnectedToId(trace.source_trace_id) ?? trace.source_trace_id ?? "",
6620
+ source_trace_id: trace.source_trace_id,
6606
6621
  pointsToConnect: connectedPorts.map((port) => {
6607
6622
  return {
6608
6623
  x: port.x,
@@ -6614,7 +6629,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
6614
6629
  }).filter((c) => c !== null);
6615
6630
  return {
6616
6631
  bounds,
6617
- obstacles: [],
6632
+ obstacles,
6618
6633
  connections,
6619
6634
  layerCount: 2,
6620
6635
  minTraceWidth
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.266",
4
+ "version": "0.0.268",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",