@tscircuit/core 0.0.41 → 0.0.42

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
@@ -41,7 +41,7 @@ declare class Circuit {
41
41
  */
42
42
  declare const Project: typeof Circuit;
43
43
 
44
- declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "SourceRender", "SourceParentAttachment", "PortDiscovery", "PortMatching", "SourceTraceRender", "SchematicComponentRender", "SchematicLayout", "SchematicPortRender", "SchematicTraceRender", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbParentAttachment", "PcbLayout", "PcbTraceRender", "PcbRouteNetIslands", "PcbComponentSizeCalculation", "CadModelRender"];
44
+ declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "SourceRender", "SourceParentAttachment", "PortDiscovery", "PortMatching", "SourceTraceRender", "SchematicComponentRender", "SchematicLayout", "SchematicPortRender", "SchematicTraceRender", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbLayout", "PcbTraceRender", "PcbRouteNetIslands", "PcbComponentSizeCalculation", "CadModelRender"];
45
45
  type RenderPhase = (typeof orderedRenderPhases)[number];
46
46
  type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
47
47
  type RenderPhaseStates = Record<RenderPhase, {
@@ -788,6 +788,7 @@ declare class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
788
788
  };
789
789
  doInitialPortMatching(): void;
790
790
  doInitialPcbPrimitiveRender(): void;
791
+ doInitialPcbPortAttachment(): void;
791
792
  _getPcbCircuitJsonBounds(): {
792
793
  center: {
793
794
  x: number;
@@ -3857,6 +3858,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
3857
3858
  }): void;
3858
3859
  doInitialPortMatching(): void;
3859
3860
  doInitialPcbPrimitiveRender(): void;
3861
+ doInitialPcbPortAttachment(): void;
3860
3862
  }
3861
3863
 
3862
3864
  declare const edgeSpecifiers: readonly ["leftedge", "rightedge", "topedge", "bottomedge", "center"];
package/dist/index.js CHANGED
@@ -56,7 +56,7 @@ var orderedRenderPhases = [
56
56
  "PcbPrimitiveRender",
57
57
  "PcbFootprintLayout",
58
58
  "PcbPortRender",
59
- "PcbParentAttachment",
59
+ "PcbPortAttachment",
60
60
  "PcbLayout",
61
61
  "PcbTraceRender",
62
62
  "PcbRouteNetIslands",
@@ -1128,6 +1128,7 @@ var SmtPad = class extends PrimitiveComponent {
1128
1128
  pcb_smtpad = db.pcb_smtpad.insert({
1129
1129
  pcb_component_id: this.parent?.pcb_component_id,
1130
1130
  pcb_port_id: this.matchedPort?.pcb_port_id,
1131
+ // port likely isn't matched
1131
1132
  layer: props.layer ?? "top",
1132
1133
  shape: "circle",
1133
1134
  // @ts-ignore: no idea why this is triggering
@@ -1140,6 +1141,7 @@ var SmtPad = class extends PrimitiveComponent {
1140
1141
  pcb_smtpad = db.pcb_smtpad.insert({
1141
1142
  pcb_component_id: this.parent?.pcb_component_id,
1142
1143
  pcb_port_id: this.matchedPort?.pcb_port_id,
1144
+ // port likely isn't matched
1143
1145
  layer: props.layer ?? "top",
1144
1146
  shape: "rect",
1145
1147
  ...isRotated90 ? { width: props.height, height: props.width } : { width: props.width, height: props.height },
@@ -1152,6 +1154,12 @@ var SmtPad = class extends PrimitiveComponent {
1152
1154
  this.pcb_smtpad_id = pcb_smtpad.pcb_smtpad_id;
1153
1155
  }
1154
1156
  }
1157
+ doInitialPcbPortAttachment() {
1158
+ const { db } = this.root;
1159
+ db.pcb_smtpad.update(this.pcb_smtpad_id, {
1160
+ pcb_port_id: this.matchedPort?.pcb_port_id
1161
+ });
1162
+ }
1155
1163
  _getPcbCircuitJsonBounds() {
1156
1164
  const { db } = this.root;
1157
1165
  const smtpad = db.pcb_smtpad.get(this.pcb_smtpad_id);
@@ -1317,6 +1325,12 @@ var PlatedHole = class extends PrimitiveComponent {
1317
1325
  this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
1318
1326
  }
1319
1327
  }
1328
+ doInitialPcbPortAttachment() {
1329
+ const { db } = this.root;
1330
+ db.pcb_plated_hole.update(this.pcb_plated_hole_id, {
1331
+ pcb_port_id: this.matchedPort?.pcb_port_id
1332
+ });
1333
+ }
1320
1334
  };
1321
1335
 
1322
1336
  // lib/utils/createComponentsFromSoup.ts
@@ -19,7 +19,7 @@ export const orderedRenderPhases = [
19
19
  "PcbPrimitiveRender",
20
20
  "PcbFootprintLayout",
21
21
  "PcbPortRender",
22
- "PcbParentAttachment",
22
+ "PcbPortAttachment",
23
23
  "PcbLayout",
24
24
  "PcbTraceRender",
25
25
  "PcbRouteNetIslands",
@@ -98,4 +98,11 @@ export class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
98
98
  this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id
99
99
  }
100
100
  }
101
+
102
+ doInitialPcbPortAttachment(): void {
103
+ const { db } = this.root!
104
+ db.pcb_plated_hole.update(this.pcb_plated_hole_id!, {
105
+ pcb_port_id: this.matchedPort?.pcb_port_id!,
106
+ })
107
+ }
101
108
  }
@@ -63,7 +63,7 @@ export class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
63
63
  if (props.shape === "circle") {
64
64
  pcb_smtpad = db.pcb_smtpad.insert({
65
65
  pcb_component_id: this.parent?.pcb_component_id!,
66
- pcb_port_id: this.matchedPort?.pcb_port_id!,
66
+ pcb_port_id: this.matchedPort?.pcb_port_id!, // port likely isn't matched
67
67
  layer: props.layer ?? "top",
68
68
  shape: "circle",
69
69
 
@@ -78,7 +78,7 @@ export class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
78
78
  } else if (props.shape === "rect") {
79
79
  pcb_smtpad = db.pcb_smtpad.insert({
80
80
  pcb_component_id: this.parent?.pcb_component_id!,
81
- pcb_port_id: this.matchedPort?.pcb_port_id!,
81
+ pcb_port_id: this.matchedPort?.pcb_port_id!, // port likely isn't matched
82
82
  layer: props.layer ?? "top",
83
83
  shape: "rect",
84
84
 
@@ -97,6 +97,13 @@ export class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
97
97
  }
98
98
  }
99
99
 
100
+ doInitialPcbPortAttachment(): void {
101
+ const { db } = this.root!
102
+ db.pcb_smtpad.update(this.pcb_smtpad_id!, {
103
+ pcb_port_id: this.matchedPort?.pcb_port_id!,
104
+ })
105
+ }
106
+
100
107
  _getPcbCircuitJsonBounds(): {
101
108
  center: { x: number; y: number }
102
109
  bounds: { left: number; top: number; right: number; bottom: number }
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.41",
5
+ "version": "0.0.42",
6
6
  "types": "dist/index.d.ts",
7
7
  "main": "dist/index.js",
8
8
  "files": [