@tscircuit/core 0.0.864 → 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 +60 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -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.863",
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.864",
4
+ "version": "0.0.865",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",