@tscircuit/core 0.0.129 → 0.0.131

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.
Files changed (2) hide show
  1. package/dist/index.js +46 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1672,6 +1672,17 @@ var Port = class extends PrimitiveComponent {
1672
1672
  center.x += containerCenter.x;
1673
1673
  center.y += containerCenter.y;
1674
1674
  }
1675
+ if (this.getSubcircuit().props._schDebugObjectsEnabled) {
1676
+ db.schematic_debug_object.insert({
1677
+ shape: "rect",
1678
+ center,
1679
+ size: {
1680
+ width: 0.1,
1681
+ height: 0.1
1682
+ },
1683
+ label: "obstacle"
1684
+ });
1685
+ }
1675
1686
  this.facingDirection = getRelativeDirection(containerCenter, center);
1676
1687
  const schematic_port = db.schematic_port.insert({
1677
1688
  schematic_component_id: this.parent?.schematic_component_id,
@@ -2558,6 +2569,22 @@ var computeObstacleBounds = (obstacles) => {
2558
2569
  return { minX, maxX, minY, maxY };
2559
2570
  };
2560
2571
 
2572
+ // lib/utils/projectPointInDirection.ts
2573
+ var projectPointInDirection = (point, direction, distance) => {
2574
+ switch (direction) {
2575
+ case "up":
2576
+ return { x: point.x, y: point.y - distance };
2577
+ case "down":
2578
+ return { x: point.x, y: point.y + distance };
2579
+ case "left":
2580
+ return { x: point.x - distance, y: point.y };
2581
+ case "right":
2582
+ return { x: point.x + distance, y: point.y };
2583
+ default:
2584
+ throw new Error(`Unknown direction "${direction}"`);
2585
+ }
2586
+ };
2587
+
2561
2588
  // lib/utils/autorouting/findPossibleTraceLayerCombinations.ts
2562
2589
  var LAYER_SELECTION_PREFERENCE = ["top", "bottom", "inner1", "inner2"];
2563
2590
  var findPossibleTraceLayerCombinations = (hints, layer_path = []) => {
@@ -3166,15 +3193,25 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
3166
3193
  connectedTo: []
3167
3194
  });
3168
3195
  }
3196
+ if (elm.type === "schematic_port") {
3197
+ obstacles.push({
3198
+ type: "rect",
3199
+ layers: ["top"],
3200
+ center: elm.center,
3201
+ width: 0.1,
3202
+ height: 0.1,
3203
+ connectedTo: []
3204
+ });
3205
+ }
3169
3206
  }
3170
3207
  for (const { port } of ports) {
3171
3208
  connection.pointsToConnect.push({
3172
3209
  ...port._getGlobalSchematicPositionAfterLayout(),
3173
- // ...projectPointInDirection(
3174
- // port._getGlobalSchematicPositionAfterLayout(),
3175
- // port.facingDirection!,
3176
- // 0.1501,
3177
- // ),
3210
+ ...projectPointInDirection(
3211
+ port._getGlobalSchematicPositionAfterLayout(),
3212
+ port.facingDirection,
3213
+ 0.1501
3214
+ ),
3178
3215
  layer: "top"
3179
3216
  });
3180
3217
  }
@@ -3523,10 +3560,10 @@ var getAllDimensionsForSchematicBox = (params) => {
3523
3560
  processSide("bottom", bottomSide, "left-to-right");
3524
3561
  }
3525
3562
  const trueEdgePositions = {
3526
- left: { x: -schWidth / 2, y: schHeight / 2 },
3527
- bottom: { x: -schWidth / 2, y: schHeight / 2 },
3528
- right: { x: schWidth / 2, y: -schHeight / 2 },
3529
- top: { x: schWidth / 2, y: -schHeight / 2 }
3563
+ left: { x: -schWidth / 2 - 0.2, y: schHeight / 2 },
3564
+ bottom: { x: -schWidth / 2, y: schHeight / 2 + 0.2 },
3565
+ right: { x: schWidth / 2 + 0.2, y: -schHeight / 2 },
3566
+ top: { x: schWidth / 2, y: -schHeight / 2 - 0.2 }
3530
3567
  };
3531
3568
  const trueEdgeTraversalDirections = {
3532
3569
  left: { x: 0, y: -1 },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.129",
4
+ "version": "0.0.131",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -44,7 +44,7 @@
44
44
  "@tscircuit/soup-util": "^0.0.33",
45
45
  "circuit-json": "^0.0.91",
46
46
  "circuit-json-to-connectivity-map": "^0.0.17",
47
- "circuit-to-svg": "^0.0.52",
47
+ "circuit-to-svg": "^0.0.54",
48
48
  "nanoid": "^5.0.7",
49
49
  "performance-now": "^2.1.0",
50
50
  "react": "^18.3.1",