@tscircuit/core 0.0.1371 → 0.0.1372

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 +33 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16044,8 +16044,24 @@ var getSimpleRouteJsonFromCircuitJson = ({
16044
16044
  }).filter((c) => c !== null);
16045
16045
  const source_nets = db.source_net.list().filter((e) => !subcircuit_id || e.subcircuit_id === subcircuit_id);
16046
16046
  const connectionsFromNets = [];
16047
+ const connectionFromNetId = /* @__PURE__ */ new Map();
16048
+ const handledNetConnectivityKeys = /* @__PURE__ */ new Set();
16049
+ const sourceTraces = db.source_trace.list();
16050
+ const getSourceConnectivityKey = (id) => id ? connMap.getNetConnectedToId(id) ?? id : null;
16047
16051
  for (const net of source_nets) {
16048
- const connectedSourceTraces = db.source_trace.list().filter((st) => st.connected_source_net_ids?.includes(net.source_net_id));
16052
+ const netConnectivityKey = getSourceConnectivityKey(net.source_net_id);
16053
+ if (!netConnectivityKey || handledNetConnectivityKeys.has(netConnectivityKey)) {
16054
+ continue;
16055
+ }
16056
+ handledNetConnectivityKeys.add(netConnectivityKey);
16057
+ const connectedSourceNetIds = source_nets.filter(
16058
+ (sourceNet) => getSourceConnectivityKey(sourceNet.source_net_id) === netConnectivityKey
16059
+ ).map((sourceNet) => sourceNet.source_net_id);
16060
+ const connectedSourceTraces = sourceTraces.filter(
16061
+ (st) => [st.source_trace_id, ...st.connected_source_net_ids ?? []].some(
16062
+ (id) => getSourceConnectivityKey(id) === netConnectivityKey
16063
+ )
16064
+ );
16049
16065
  let nominalTraceWidthFromConnectedTraces;
16050
16066
  for (const sourceTrace of connectedSourceTraces) {
16051
16067
  if (sourceTrace.min_trace_thickness === void 0) continue;
@@ -16070,12 +16086,16 @@ var getSimpleRouteJsonFromCircuitJson = ({
16070
16086
  });
16071
16087
  }
16072
16088
  }
16073
- connectionsFromNets.push({
16089
+ const connection = {
16074
16090
  name: net.source_net_id ?? connMap.getNetConnectedToId(net.source_net_id),
16075
16091
  nominalTraceWidth: nominalTraceWidthFromConnectedTraces,
16076
16092
  width: nominalTraceWidthFromConnectedTraces,
16077
16093
  pointsToConnect
16078
- });
16094
+ };
16095
+ connectionsFromNets.push(connection);
16096
+ for (const sourceNetId of connectedSourceNetIds) {
16097
+ connectionFromNetId.set(sourceNetId, connection);
16098
+ }
16079
16099
  }
16080
16100
  const connectionsFromBreakoutPoints = [];
16081
16101
  for (const bp of breakoutPoints) {
@@ -16110,7 +16130,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
16110
16130
  continue;
16111
16131
  }
16112
16132
  if (bp.source_net_id) {
16113
- const conn = connectionsFromNets.find((c) => c.name === bp.source_net_id);
16133
+ const conn = connectionFromNetId.get(bp.source_net_id);
16114
16134
  if (conn) {
16115
16135
  conn.pointsToConnect.push(pt);
16116
16136
  } else {
@@ -23528,6 +23548,7 @@ var Group5 = class extends NormalComponent3 {
23528
23548
  const subcircuitComponentsByName = /* @__PURE__ */ new Map();
23529
23549
  for (const child of this.children) {
23530
23550
  if (child.isSubcircuit) continue;
23551
+ if (child instanceof Trace3) continue;
23531
23552
  if (child._parsedProps.name) {
23532
23553
  const components = subcircuitComponentsByName.get(child._parsedProps.name) || [];
23533
23554
  components.push(child);
@@ -24660,7 +24681,7 @@ import { identity as identity5 } from "transformation-matrix";
24660
24681
  var package_default = {
24661
24682
  name: "@tscircuit/core",
24662
24683
  type: "module",
24663
- version: "0.0.1370",
24684
+ version: "0.0.1371",
24664
24685
  types: "dist/index.d.ts",
24665
24686
  main: "dist/index.js",
24666
24687
  module: "dist/index.js",
@@ -25767,15 +25788,17 @@ var Subcircuit = class extends Group5 {
25767
25788
  const parentNetSelector = `> net.${netName}`;
25768
25789
  const childNetSelector = `.${this.name} > net.${netName}`;
25769
25790
  const traceName = `exposed_net.${netName}`;
25770
- const parentHasDirectNet = parentSubcircuit.children.some(
25791
+ const parentNet = parentSubcircuit.children.find(
25771
25792
  (child) => child instanceof Net && child._parsedProps.name === netName
25772
25793
  );
25773
- if (!parentHasDirectNet) {
25794
+ if (!parentNet) {
25774
25795
  parentSubcircuit.add(new Net({ name: netName }));
25775
25796
  }
25776
- const existingTrace = parentSubcircuit.children.find(
25777
- (child) => child instanceof Trace3 && child._parsedProps.name === traceName
25778
- );
25797
+ const existingTrace = parentSubcircuit.children.find((child) => {
25798
+ if (!(child instanceof Trace3)) return false;
25799
+ const childProps = child._parsedProps;
25800
+ return childProps.name === traceName && childProps.from === childNetSelector && childProps.to === parentNetSelector;
25801
+ });
25779
25802
  if (existingTrace) continue;
25780
25803
  parentSubcircuit.add(
25781
25804
  new Trace3({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1371",
4
+ "version": "0.0.1372",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",