@tscircuit/core 0.0.863 → 0.0.865

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 +67 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1932,7 +1932,6 @@ var SmtPad = class extends PrimitiveComponent2 {
1932
1932
  const { _parsedProps: props } = this;
1933
1933
  const isCoveredWithSolderMask = props.coveredWithSolderMask ?? false;
1934
1934
  const shouldCreateSolderPaste = !isCoveredWithSolderMask;
1935
- if (!props.portHints) return;
1936
1935
  const subcircuit = this.getSubcircuit();
1937
1936
  const position = this._getGlobalPcbPositionBeforeLayout();
1938
1937
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
@@ -1950,6 +1949,7 @@ var SmtPad = class extends PrimitiveComponent2 {
1950
1949
  if (isFlipped) {
1951
1950
  finalRotationDegrees = (360 - finalRotationDegrees + 360) % 360;
1952
1951
  }
1952
+ const portHints = props.portHints?.map((ph) => ph.toString()) ?? [];
1953
1953
  let pcb_smtpad = null;
1954
1954
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
1955
1955
  if (props.shape === "circle") {
@@ -1960,7 +1960,7 @@ var SmtPad = class extends PrimitiveComponent2 {
1960
1960
  layer: maybeFlipLayer(props.layer ?? "top"),
1961
1961
  shape: "circle",
1962
1962
  radius: props.radius,
1963
- port_hints: props.portHints.map((ph) => ph.toString()),
1963
+ port_hints: portHints,
1964
1964
  is_covered_with_solder_mask: isCoveredWithSolderMask,
1965
1965
  x: position.x,
1966
1966
  y: position.y,
@@ -1992,7 +1992,7 @@ var SmtPad = class extends PrimitiveComponent2 {
1992
1992
  x: position.x,
1993
1993
  y: position.y,
1994
1994
  ccw_rotation: finalRotationDegrees,
1995
- port_hints: props.portHints.map((ph) => ph.toString()),
1995
+ port_hints: portHints,
1996
1996
  is_covered_with_solder_mask: isCoveredWithSolderMask,
1997
1997
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
1998
1998
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
@@ -2006,7 +2006,7 @@ var SmtPad = class extends PrimitiveComponent2 {
2006
2006
  width: isRotated90Degrees ? props.height : props.width,
2007
2007
  height: isRotated90Degrees ? props.width : props.height,
2008
2008
  corner_radius: props.cornerRadius ?? void 0,
2009
- port_hints: props.portHints.map((ph) => ph.toString()),
2009
+ port_hints: portHints,
2010
2010
  is_covered_with_solder_mask: isCoveredWithSolderMask,
2011
2011
  x: position.x,
2012
2012
  y: position.y,
@@ -2059,7 +2059,7 @@ var SmtPad = class extends PrimitiveComponent2 {
2059
2059
  x: position.x,
2060
2060
  y: position.y,
2061
2061
  ccw_rotation: padRotation,
2062
- port_hints: props.portHints.map((ph) => ph.toString()),
2062
+ port_hints: portHints,
2063
2063
  is_covered_with_solder_mask: isCoveredWithSolderMask,
2064
2064
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
2065
2065
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
@@ -2096,7 +2096,7 @@ var SmtPad = class extends PrimitiveComponent2 {
2096
2096
  layer: maybeFlipLayer(props.layer ?? "top"),
2097
2097
  shape: "polygon",
2098
2098
  points: transformedPoints,
2099
- port_hints: props.portHints.map((ph) => ph.toString()),
2099
+ port_hints: portHints,
2100
2100
  is_covered_with_solder_mask: isCoveredWithSolderMask,
2101
2101
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
2102
2102
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
@@ -2113,7 +2113,7 @@ var SmtPad = class extends PrimitiveComponent2 {
2113
2113
  radius: props.radius,
2114
2114
  height: props.height,
2115
2115
  width: props.width,
2116
- port_hints: props.portHints.map((ph) => ph.toString()),
2116
+ port_hints: portHints,
2117
2117
  is_covered_with_solder_mask: isCoveredWithSolderMask,
2118
2118
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
2119
2119
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
@@ -15923,6 +15923,61 @@ function inflateSourceDiode(sourceElm, inflatorContext) {
15923
15923
  }
15924
15924
  }
15925
15925
 
15926
+ // lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceTrace.ts
15927
+ var getSelectorPath = (component, db) => {
15928
+ const path_parts = [];
15929
+ let currentGroupId = component.source_group_id;
15930
+ while (currentGroupId) {
15931
+ const group = db.source_group.get(currentGroupId);
15932
+ if (!group) break;
15933
+ path_parts.unshift(`.${group.name}`);
15934
+ currentGroupId = group.parent_source_group_id;
15935
+ }
15936
+ path_parts.push(`.${component.name}`);
15937
+ return path_parts.join(" > ");
15938
+ };
15939
+ function inflateSourceTrace(sourceTrace, inflatorContext) {
15940
+ const { injectionDb, subcircuit } = inflatorContext;
15941
+ const connectedSelectors = [];
15942
+ for (const sourcePortId of sourceTrace.connected_source_port_ids) {
15943
+ const sourcePort = injectionDb.source_port.get(sourcePortId);
15944
+ if (!sourcePort) continue;
15945
+ let selector;
15946
+ if (sourcePort.source_component_id) {
15947
+ const sourceComponent = injectionDb.source_component.get(
15948
+ sourcePort.source_component_id
15949
+ );
15950
+ if (sourceComponent) {
15951
+ const path = getSelectorPath(
15952
+ {
15953
+ name: sourceComponent.name,
15954
+ source_group_id: sourceComponent.source_group_id
15955
+ },
15956
+ injectionDb
15957
+ );
15958
+ selector = `${path} > .${sourcePort.name}`;
15959
+ }
15960
+ } else {
15961
+ selector = `.${sourcePort.name}`;
15962
+ }
15963
+ if (selector) {
15964
+ connectedSelectors.push(selector);
15965
+ }
15966
+ }
15967
+ for (const sourceNetId of sourceTrace.connected_source_net_ids) {
15968
+ const sourceNet = injectionDb.source_net.get(sourceNetId);
15969
+ if (sourceNet) {
15970
+ connectedSelectors.push(`net.${sourceNet.name}`);
15971
+ }
15972
+ }
15973
+ if (connectedSelectors.length < 2) return;
15974
+ const trace = new Trace3({
15975
+ path: connectedSelectors
15976
+ });
15977
+ trace.source_trace_id = sourceTrace.source_trace_id;
15978
+ subcircuit.add(trace);
15979
+ }
15980
+
15926
15981
  // lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
15927
15982
  var Subcircuit = class extends Group6 {
15928
15983
  constructor(props) {
@@ -15990,6 +16045,10 @@ var Subcircuit = class extends Group6 {
15990
16045
  for (const sourcePort of sourcePorts) {
15991
16046
  inflateSourcePort(sourcePort, inflationCtx);
15992
16047
  }
16048
+ const sourceTraces = injectionDb.source_trace.list();
16049
+ for (const sourceTrace of sourceTraces) {
16050
+ inflateSourceTrace(sourceTrace, inflationCtx);
16051
+ }
15993
16052
  }
15994
16053
  };
15995
16054
 
@@ -17839,7 +17898,7 @@ import { identity as identity6 } from "transformation-matrix";
17839
17898
  var package_default = {
17840
17899
  name: "@tscircuit/core",
17841
17900
  type: "module",
17842
- version: "0.0.862",
17901
+ version: "0.0.864",
17843
17902
  types: "dist/index.d.ts",
17844
17903
  main: "dist/index.js",
17845
17904
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.863",
4
+ "version": "0.0.865",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",