@tscircuit/core 0.0.384 → 0.0.386

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
@@ -212,6 +212,7 @@ declare class RootCircuit {
212
212
  */
213
213
  _getBoard(): PrimitiveComponent & {
214
214
  boardThickness: number;
215
+ _connectedSchematicPortPairs: Set<string>;
215
216
  allLayers: LayerRef[];
216
217
  };
217
218
  _guessRootComponent(): void;
@@ -533,6 +534,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
533
534
  schematic_trace_id: string | null;
534
535
  _portsRoutedOnPcb: Port[];
535
536
  subcircuit_connectivity_map_key: string | null;
537
+ _traceConnectionHash: string | null;
536
538
  constructor(props: z.input<typeof traceProps>);
537
539
  get config(): {
538
540
  zodProps: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
@@ -766,6 +768,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
766
768
  */
767
769
  _isExplicitlyConnectedToNet(net: Net): boolean;
768
770
  doInitialCreateNetsFromProps(): void;
771
+ _computeTraceConnectionHash(): string | null;
769
772
  doInitialSourceTraceRender(): void;
770
773
  _insertErrorIfTraceIsOutsideBoard(mergedRoute: PcbTraceRoutePoint[], ports: Port[]): void;
771
774
  doInitialPcbTraceRender(): void;
@@ -1052,6 +1055,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1052
1055
  declare class Board extends Group<typeof boardProps> {
1053
1056
  pcb_board_id: string | null;
1054
1057
  _drcChecksComplete: boolean;
1058
+ _connectedSchematicPortPairs: Set<string>;
1055
1059
  get isSubcircuit(): boolean;
1056
1060
  get config(): {
1057
1061
  componentName: string;
package/dist/index.js CHANGED
@@ -1663,6 +1663,21 @@ var SmtPad = class extends PrimitiveComponent2 {
1663
1663
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
1664
1664
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
1665
1665
  });
1666
+ if (pcb_smtpad.shape === "rotated_rect")
1667
+ db.pcb_solder_paste.insert({
1668
+ layer: pcb_smtpad.layer,
1669
+ shape: "rotated_rect",
1670
+ // @ts-ignore: no idea why this is triggering
1671
+ width: pcb_smtpad.width * 0.7,
1672
+ height: pcb_smtpad.height * 0.7,
1673
+ x: pcb_smtpad.x,
1674
+ y: pcb_smtpad.y,
1675
+ ccw_rotation: parentRotation,
1676
+ pcb_component_id: pcb_smtpad.pcb_component_id,
1677
+ pcb_smtpad_id: pcb_smtpad.pcb_smtpad_id,
1678
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
1679
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
1680
+ });
1666
1681
  }
1667
1682
  if (pcb_smtpad) {
1668
1683
  this.pcb_smtpad_id = pcb_smtpad.pcb_smtpad_id;
@@ -1896,6 +1911,26 @@ var PlatedHole = class extends PrimitiveComponent2 {
1896
1911
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
1897
1912
  });
1898
1913
  this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
1914
+ db.pcb_solder_paste.insert({
1915
+ layer: "top",
1916
+ shape: "circle",
1917
+ // @ts-ignore: no idea why this is triggering
1918
+ radius: props.outerDiameter / 2,
1919
+ x: position.x,
1920
+ y: position.y,
1921
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
1922
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
1923
+ });
1924
+ db.pcb_solder_paste.insert({
1925
+ layer: "bottom",
1926
+ shape: "circle",
1927
+ // @ts-ignore: no idea why this is triggering
1928
+ radius: props.outerDiameter / 2,
1929
+ x: position.x,
1930
+ y: position.y,
1931
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
1932
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
1933
+ });
1899
1934
  } else if (props.shape === "pill" || props.shape === "oval") {
1900
1935
  const pcb_plated_hole = db.pcb_plated_hole.insert({
1901
1936
  pcb_component_id,
@@ -1914,6 +1949,28 @@ var PlatedHole = class extends PrimitiveComponent2 {
1914
1949
  // NOTE: currently PcbPlatedHoleOval erroneously includes both the shape "pill" and "oval"
1915
1950
  });
1916
1951
  this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
1952
+ db.pcb_solder_paste.insert({
1953
+ layer: "top",
1954
+ shape: props.shape,
1955
+ // @ts-ignore: no idea why this is triggering
1956
+ width: props.outerWidth,
1957
+ height: props.outerHeight,
1958
+ x: position.x,
1959
+ y: position.y,
1960
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
1961
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
1962
+ });
1963
+ db.pcb_solder_paste.insert({
1964
+ layer: "bottom",
1965
+ shape: props.shape,
1966
+ // @ts-ignore: no idea why this is triggering
1967
+ width: props.outerWidth,
1968
+ height: props.outerHeight,
1969
+ x: position.x,
1970
+ y: position.y,
1971
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
1972
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
1973
+ });
1917
1974
  }
1918
1975
  }
1919
1976
  doInitialPcbPortAttachment() {
@@ -3893,6 +3950,7 @@ var Trace2 = class extends PrimitiveComponent2 {
3893
3950
  schematic_trace_id = null;
3894
3951
  _portsRoutedOnPcb;
3895
3952
  subcircuit_connectivity_map_key = null;
3953
+ _traceConnectionHash = null;
3896
3954
  constructor(props) {
3897
3955
  super(props);
3898
3956
  this._portsRoutedOnPcb = [];
@@ -4011,6 +4069,15 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
4011
4069
  doInitialCreateNetsFromProps() {
4012
4070
  createNetsFromProps(this, this.getTracePathNetSelectors());
4013
4071
  }
4072
+ _computeTraceConnectionHash() {
4073
+ const { allPortsFound, ports } = this._findConnectedPorts();
4074
+ if (!allPortsFound || !ports) return null;
4075
+ const sortedPorts = [...ports].sort(
4076
+ (a, b) => (a.pcb_port_id || "").localeCompare(b.pcb_port_id || "")
4077
+ );
4078
+ const allIds = sortedPorts.map((p) => p.pcb_port_id);
4079
+ return allIds.join(",");
4080
+ }
4014
4081
  doInitialSourceTraceRender() {
4015
4082
  const { db } = this.root;
4016
4083
  const { _parsedProps: props, parent } = this;
@@ -4020,6 +4087,15 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
4020
4087
  }
4021
4088
  const { allPortsFound, portsWithSelectors: ports } = this._findConnectedPorts();
4022
4089
  if (!allPortsFound) return;
4090
+ this._traceConnectionHash = this._computeTraceConnectionHash();
4091
+ const existingTraces = db.source_trace.list();
4092
+ const existingTrace = existingTraces.find(
4093
+ (t) => t.subcircuit_connectivity_map_key === this.subcircuit_connectivity_map_key && t.connected_source_port_ids.sort().join(",") === this._traceConnectionHash
4094
+ );
4095
+ if (existingTrace) {
4096
+ this.source_trace_id = existingTrace.source_trace_id;
4097
+ return;
4098
+ }
4023
4099
  const nets = this._findConnectedNets().nets;
4024
4100
  const displayName = getTraceDisplayName({ ports, nets });
4025
4101
  const trace = db.source_trace.insert({
@@ -4476,6 +4552,14 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
4476
4552
  const { allPortsFound, portsWithSelectors: connectedPorts } = this._findConnectedPorts();
4477
4553
  const { netsWithSelectors } = this._findConnectedNets();
4478
4554
  if (!allPortsFound) return;
4555
+ const portIds = connectedPorts.map((p) => p.port.schematic_port_id).sort();
4556
+ const portPairKey = portIds.join(",");
4557
+ const board = this.root?._getBoard();
4558
+ if (board?._connectedSchematicPortPairs) {
4559
+ if (board._connectedSchematicPortPairs.has(portPairKey)) {
4560
+ return;
4561
+ }
4562
+ }
4479
4563
  if (this.props.schDisplayLabel && ("from" in this.props && "to" in this.props || "path" in this.props)) {
4480
4564
  this._doInitialSchematicTraceRenderWithDisplayLabel();
4481
4565
  return;
@@ -4626,6 +4710,8 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
4626
4710
  junctions
4627
4711
  });
4628
4712
  this.schematic_trace_id = trace.schematic_trace_id;
4713
+ if (board?._connectedSchematicPortPairs)
4714
+ board._connectedSchematicPortPairs.add(portPairKey);
4629
4715
  }
4630
4716
  };
4631
4717
 
@@ -6506,6 +6592,7 @@ import { checkEachPcbTraceNonOverlapping as checkEachPcbTraceNonOverlapping2 } f
6506
6592
  var Board = class extends Group {
6507
6593
  pcb_board_id = null;
6508
6594
  _drcChecksComplete = false;
6595
+ _connectedSchematicPortPairs = /* @__PURE__ */ new Set();
6509
6596
  get isSubcircuit() {
6510
6597
  return true;
6511
6598
  }
@@ -7713,7 +7800,7 @@ import { identity as identity4 } from "transformation-matrix";
7713
7800
  var package_default = {
7714
7801
  name: "@tscircuit/core",
7715
7802
  type: "module",
7716
- version: "0.0.383",
7803
+ version: "0.0.385",
7717
7804
  types: "dist/index.d.ts",
7718
7805
  main: "dist/index.js",
7719
7806
  module: "dist/index.js",
@@ -7773,7 +7860,7 @@ var package_default = {
7773
7860
  "@tscircuit/math-utils": "^0.0.14",
7774
7861
  "@tscircuit/props": "^0.0.172",
7775
7862
  "@tscircuit/schematic-autolayout": "^0.0.6",
7776
- "circuit-json": "0.0.159",
7863
+ "circuit-json": "0.0.160",
7777
7864
  "circuit-json-to-connectivity-map": "^0.0.20",
7778
7865
  "css-select": "^5.1.0",
7779
7866
  "format-si-unit": "^0.0.3",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.384",
4
+ "version": "0.0.386",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -61,7 +61,7 @@
61
61
  "@tscircuit/math-utils": "^0.0.14",
62
62
  "@tscircuit/props": "^0.0.172",
63
63
  "@tscircuit/schematic-autolayout": "^0.0.6",
64
- "circuit-json": "0.0.159",
64
+ "circuit-json": "0.0.160",
65
65
  "circuit-json-to-connectivity-map": "^0.0.20",
66
66
  "css-select": "^5.1.0",
67
67
  "format-si-unit": "^0.0.3",