@tscircuit/core 0.0.267 → 0.0.269

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
@@ -4189,10 +4189,10 @@ var getOtherSchematicTraces = ({
4189
4189
  // lib/components/primitive-components/Trace/create-schematic-trace-crossing-segments.ts
4190
4190
  import { getUnitVectorFromPointAToB } from "@tscircuit/math-utils";
4191
4191
  var createSchematicTraceCrossingSegments = ({
4192
- edges,
4192
+ edges: inputEdges,
4193
4193
  otherEdges
4194
4194
  }) => {
4195
- edges = [...edges];
4195
+ const edges = [...inputEdges];
4196
4196
  for (let i = 0; i < edges.length; i++) {
4197
4197
  if (i > 2e3) {
4198
4198
  throw new Error(
@@ -4200,11 +4200,16 @@ var createSchematicTraceCrossingSegments = ({
4200
4200
  );
4201
4201
  }
4202
4202
  const edge = edges[i];
4203
- const edgeOrientation = Math.abs(edge.from.x - edge.to.x) < 0.01 ? "vertical" : "horizontal";
4203
+ const edgeOrientation = Math.abs(edge.from.x - edge.to.x) < 0.01 ? "vertical" : edge.from.y === edge.to.y ? "horizontal" : "not-orthogonal";
4204
+ if (edgeOrientation === "not-orthogonal") {
4205
+ continue;
4206
+ }
4204
4207
  const otherEdgesIntersections = [];
4205
4208
  for (const otherEdge of otherEdges) {
4206
- const otherOrientation = otherEdge.from.x === otherEdge.to.x ? "vertical" : "horizontal";
4207
- if (edgeOrientation === otherOrientation) continue;
4209
+ const otherOrientation = otherEdge.from.x === otherEdge.to.x ? "vertical" : otherEdge.from.y === otherEdge.to.y ? "horizontal" : "not-orthogonal";
4210
+ if (otherOrientation === "not-orthogonal") continue;
4211
+ if (edgeOrientation === otherOrientation)
4212
+ continue;
4208
4213
  const hasIntersection = doesLineIntersectLine(
4209
4214
  [edge.from, edge.to],
4210
4215
  [otherEdge.from, otherEdge.to],
@@ -5119,6 +5124,15 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5119
5124
  const isPort2Symbol = !port2.parent.config.shouldRenderAsSchematicBox;
5120
5125
  return isPort1Symbol && isPort2Symbol;
5121
5126
  }
5127
+ _isChipToChipConnection() {
5128
+ const { allPortsFound, ports } = this._findConnectedPorts();
5129
+ if (!allPortsFound || ports.length !== 2) return false;
5130
+ const [port1, port2] = ports;
5131
+ if (!port1?.parent || !port2?.parent) return false;
5132
+ const isPort1Chip = port1.parent.config.shouldRenderAsSchematicBox;
5133
+ const isPort2Chip = port2.parent.config.shouldRenderAsSchematicBox;
5134
+ return isPort1Chip && isPort2Chip;
5135
+ }
5122
5136
  doInitialSchematicTraceRender() {
5123
5137
  if (this.root?.schematicDisabled) return;
5124
5138
  const { db } = this.root;
@@ -5214,7 +5228,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5214
5228
  });
5215
5229
  let results = autorouter.solveAndMapToTraces();
5216
5230
  if (results.length === 0) {
5217
- if (this._isSymbolToChipConnection() || this._isSymbolToSymbolConnection()) {
5231
+ if (this._isSymbolToChipConnection() || this._isSymbolToSymbolConnection() || this._isChipToChipConnection()) {
5218
5232
  this._doInitialSchematicTraceRenderWithDisplayLabel();
5219
5233
  return;
5220
5234
  }
@@ -5267,7 +5281,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
5267
5281
  if (!this.source_trace_id) {
5268
5282
  throw new Error("Missing source_trace_id for schematic trace insertion.");
5269
5283
  }
5270
- if (this.getSubcircuit()._parsedProps.schTraceAutoLabelEnabled && countComplexElements(junctions, edges) >= 5 && (this._isSymbolToChipConnection() || this._isSymbolToSymbolConnection())) {
5284
+ if (this.getSubcircuit()._parsedProps.schTraceAutoLabelEnabled && countComplexElements(junctions, edges) >= 5 && (this._isSymbolToChipConnection() || this._isSymbolToSymbolConnection() || this._isChipToChipConnection())) {
5271
5285
  this._doInitialSchematicTraceRenderWithDisplayLabel();
5272
5286
  return;
5273
5287
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.267",
4
+ "version": "0.0.269",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -20,6 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@biomejs/biome": "^1.8.3",
23
+ "@tscircuit/import-snippet": "^0.0.4",
23
24
  "@tscircuit/layout": "^0.0.28",
24
25
  "@tscircuit/log-soup": "^1.0.2",
25
26
  "@types/bun": "latest",