@tscircuit/core 0.0.67 → 0.0.68

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.js CHANGED
@@ -1142,9 +1142,10 @@ var SmtPad = class extends PrimitiveComponent {
1142
1142
  );
1143
1143
  const isRotated90 = Math.abs(decomposedMat.rotation.angle * (180 / Math.PI) - 90) < 0.01;
1144
1144
  let pcb_smtpad = null;
1145
+ const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
1145
1146
  if (props.shape === "circle") {
1146
1147
  pcb_smtpad = db.pcb_smtpad.insert({
1147
- pcb_component_id: this.parent?.pcb_component_id,
1148
+ pcb_component_id,
1148
1149
  pcb_port_id: this.matchedPort?.pcb_port_id,
1149
1150
  // port likely isn't matched
1150
1151
  layer: props.layer ?? "top",
@@ -1157,7 +1158,7 @@ var SmtPad = class extends PrimitiveComponent {
1157
1158
  });
1158
1159
  } else if (props.shape === "rect") {
1159
1160
  pcb_smtpad = db.pcb_smtpad.insert({
1160
- pcb_component_id: this.parent?.pcb_component_id,
1161
+ pcb_component_id,
1161
1162
  pcb_port_id: this.matchedPort?.pcb_port_id,
1162
1163
  // port likely isn't matched
1163
1164
  layer: props.layer ?? "top",
@@ -1330,9 +1331,10 @@ var PlatedHole = class extends PrimitiveComponent {
1330
1331
  const { db } = this.root;
1331
1332
  const { _parsedProps: props } = this;
1332
1333
  const position = this._getGlobalPcbPositionBeforeLayout();
1334
+ const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
1333
1335
  if (props.shape === "circle") {
1334
1336
  const pcb_plated_hole = db.pcb_plated_hole.insert({
1335
- pcb_component_id: this.parent?.pcb_component_id,
1337
+ pcb_component_id,
1336
1338
  pcb_port_id: this.matchedPort?.pcb_port_id,
1337
1339
  // @ts-ignore - some issue with @tscircuit/soup union type
1338
1340
  outer_diameter: props.outerDiameter,
package/lib/Project.ts CHANGED
@@ -18,6 +18,7 @@ export class Circuit {
18
18
  constructor() {
19
19
  this.children = []
20
20
  this.db = su([])
21
+ // TODO rename to rootCircuit
21
22
  this.root = this
22
23
  }
23
24
 
@@ -86,9 +86,12 @@ export class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
86
86
  const { db } = this.root!
87
87
  const { _parsedProps: props } = this
88
88
  const position = this._getGlobalPcbPositionBeforeLayout()
89
+ const pcb_component_id =
90
+ this.parent?.pcb_component_id ??
91
+ this.getPrimitiveContainer()?.pcb_component_id!
89
92
  if (props.shape === "circle") {
90
93
  const pcb_plated_hole = db.pcb_plated_hole.insert({
91
- pcb_component_id: this.parent?.pcb_component_id!,
94
+ pcb_component_id,
92
95
  pcb_port_id: this.matchedPort?.pcb_port_id!,
93
96
  // @ts-ignore - some issue with @tscircuit/soup union type
94
97
  outer_diameter: props.outerDiameter,
@@ -64,9 +64,12 @@ export class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
64
64
  const isRotated90 =
65
65
  Math.abs(decomposedMat.rotation.angle * (180 / Math.PI) - 90) < 0.01
66
66
  let pcb_smtpad: PCBSMTPad | null = null
67
+ const pcb_component_id =
68
+ this.parent?.pcb_component_id ??
69
+ this.getPrimitiveContainer()?.pcb_component_id!
67
70
  if (props.shape === "circle") {
68
71
  pcb_smtpad = db.pcb_smtpad.insert({
69
- pcb_component_id: this.parent?.pcb_component_id!,
72
+ pcb_component_id,
70
73
  pcb_port_id: this.matchedPort?.pcb_port_id!, // port likely isn't matched
71
74
  layer: props.layer ?? "top",
72
75
  shape: "circle",
@@ -81,7 +84,7 @@ export class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
81
84
  })
82
85
  } else if (props.shape === "rect") {
83
86
  pcb_smtpad = db.pcb_smtpad.insert({
84
- pcb_component_id: this.parent?.pcb_component_id!,
87
+ pcb_component_id,
85
88
  pcb_port_id: this.matchedPort?.pcb_port_id!, // port likely isn't matched
86
89
  layer: props.layer ?? "top",
87
90
  shape: "rect",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tscircuit/core",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.0.67",
5
+ "version": "0.0.68",
6
6
  "types": "dist/index.d.ts",
7
7
  "main": "dist/index.js",
8
8
  "files": [