@tscircuit/core 0.0.204 → 0.0.205

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
@@ -939,7 +939,7 @@ declare class Board extends Group<typeof boardProps> {
939
939
  serverUrl?: string | undefined;
940
940
  inputFormat?: "simplified" | "circuit-json" | undefined;
941
941
  cache?: _tscircuit_props.PcbRouteCache | undefined;
942
- }>, z.ZodLiteral<"auto">, z.ZodLiteral<"auto-local">, z.ZodLiteral<"auto-cloud">]>>;
942
+ }>, z.ZodLiteral<"sequential-trace">, z.ZodLiteral<"subcircuit">, z.ZodLiteral<"auto">, z.ZodLiteral<"auto-local">, z.ZodLiteral<"auto-cloud">]>>;
943
943
  }>, {
944
944
  width: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
945
945
  height: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
@@ -972,7 +972,7 @@ declare class Board extends Group<typeof boardProps> {
972
972
  defaultTraceWidth?: number | undefined;
973
973
  minTraceWidth?: number | undefined;
974
974
  pcbRouteCache?: _tscircuit_props.PcbRouteCache | undefined;
975
- autorouter?: "auto" | "auto-local" | "auto-cloud" | {
975
+ autorouter?: "sequential-trace" | "subcircuit" | "auto" | "auto-local" | "auto-cloud" | {
976
976
  serverUrl?: string | undefined;
977
977
  inputFormat?: "simplified" | "circuit-json" | undefined;
978
978
  cache?: _tscircuit_props.PcbRouteCache | undefined;
@@ -1004,7 +1004,7 @@ declare class Board extends Group<typeof boardProps> {
1004
1004
  defaultTraceWidth?: string | number | undefined;
1005
1005
  minTraceWidth?: string | number | undefined;
1006
1006
  pcbRouteCache?: _tscircuit_props.PcbRouteCache | undefined;
1007
- autorouter?: "auto" | "auto-local" | "auto-cloud" | {
1007
+ autorouter?: "sequential-trace" | "subcircuit" | "auto" | "auto-local" | "auto-cloud" | {
1008
1008
  serverUrl?: string | undefined;
1009
1009
  inputFormat?: "simplified" | "circuit-json" | undefined;
1010
1010
  cache?: _tscircuit_props.PcbRouteCache | undefined;
package/dist/index.js CHANGED
@@ -1267,6 +1267,7 @@ var SmtPad = class extends PrimitiveComponent {
1267
1267
  );
1268
1268
  const isRotated90 = Math.abs(decomposedMat.rotation.angle * (180 / Math.PI) - 90) % 180 < 0.01;
1269
1269
  const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
1270
+ const parentRotation = container?._parsedProps.pcbRotation ?? 0;
1270
1271
  let pcb_smtpad = null;
1271
1272
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
1272
1273
  if (props.shape === "circle") {
@@ -1293,16 +1294,28 @@ var SmtPad = class extends PrimitiveComponent {
1293
1294
  pcb_smtpad_id: pcb_smtpad.pcb_smtpad_id
1294
1295
  });
1295
1296
  } else if (props.shape === "rect") {
1296
- pcb_smtpad = db.pcb_smtpad.insert({
1297
+ pcb_smtpad = parentRotation === 0 ? db.pcb_smtpad.insert({
1297
1298
  pcb_component_id,
1298
1299
  pcb_port_id: this.matchedPort?.pcb_port_id,
1299
1300
  // port likely isn't matched
1300
1301
  layer: maybeFlipLayer(props.layer ?? "top"),
1301
1302
  shape: "rect",
1302
- ...isRotated90 ? { width: props.height, height: props.width } : { width: props.width, height: props.height },
1303
+ ...{
1304
+ width: isRotated90 ? props.height : props.width,
1305
+ height: isRotated90 ? props.width : props.height
1306
+ },
1303
1307
  port_hints: props.portHints.map((ph) => ph.toString()),
1304
1308
  x: position.x,
1305
1309
  y: position.y
1310
+ }) : db.pcb_smtpad.insert({
1311
+ pcb_component_id,
1312
+ layer: props.layer ?? "top",
1313
+ shape: "rotated_rect",
1314
+ ...{ width: props.width, height: props.height },
1315
+ x: position.x,
1316
+ y: position.y,
1317
+ ccw_rotation: parentRotation,
1318
+ port_hints: props.portHints.map((ph) => ph.toString())
1306
1319
  });
1307
1320
  if (pcb_smtpad.shape === "rect")
1308
1321
  db.pcb_solder_paste.insert({
@@ -1343,6 +1356,26 @@ var SmtPad = class extends PrimitiveComponent {
1343
1356
  height: smtpad.height
1344
1357
  };
1345
1358
  }
1359
+ if (smtpad.shape === "rotated_rect") {
1360
+ const angleRad = smtpad.ccw_rotation * Math.PI / 180;
1361
+ const cosAngle = Math.cos(angleRad);
1362
+ const sinAngle = Math.sin(angleRad);
1363
+ const w2 = smtpad.width / 2;
1364
+ const h2 = smtpad.height / 2;
1365
+ const xExtent = Math.abs(w2 * cosAngle) + Math.abs(h2 * sinAngle);
1366
+ const yExtent = Math.abs(w2 * sinAngle) + Math.abs(h2 * cosAngle);
1367
+ return {
1368
+ center: { x: smtpad.x, y: smtpad.y },
1369
+ bounds: {
1370
+ left: smtpad.x - xExtent,
1371
+ right: smtpad.x + xExtent,
1372
+ top: smtpad.y - yExtent,
1373
+ bottom: smtpad.y + yExtent
1374
+ },
1375
+ width: xExtent * 2,
1376
+ height: yExtent * 2
1377
+ };
1378
+ }
1346
1379
  if (smtpad.shape === "circle") {
1347
1380
  return {
1348
1381
  center: { x: smtpad.x, y: smtpad.y },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.204",
4
+ "version": "0.0.205",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -41,11 +41,12 @@
41
41
  "@tscircuit/footprinter": "^0.0.89",
42
42
  "@tscircuit/infgrid-ijump-astar": "^0.0.24",
43
43
  "@tscircuit/math-utils": "^0.0.5",
44
- "@tscircuit/props": "^0.0.105",
45
- "@tscircuit/schematic-autolayout": "^0.0.6",
46
- "@tscircuit/soup-util": "^0.0.40",
47
44
  "circuit-json": "^0.0.108",
48
45
  "circuit-json-to-connectivity-map": "^0.0.17",
46
+ "@tscircuit/props": "^0.0.106",
47
+ "@tscircuit/schematic-autolayout": "^0.0.6",
48
+ "@tscircuit/soup-util": "^0.0.41",
49
+ "circuit-to-svg": "0.0.84",
49
50
  "format-si-unit": "^0.0.2",
50
51
  "nanoid": "^5.0.7",
51
52
  "performance-now": "^2.1.0",