@tscircuit/core 0.0.2020 → 0.0.2022

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 +28 -23
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -14695,7 +14695,7 @@ var getUnrotatedLocalPcbElements = ({
14695
14695
  var getSupplierPartOrientationCacheKey = ({
14696
14696
  supplierName,
14697
14697
  supplierPartNumber
14698
- }) => `part-orientation-analysis:v3:${supplierName}:${supplierPartNumber}`;
14698
+ }) => `part-orientation-analysis:v4:${supplierName}:${supplierPartNumber}`;
14699
14699
  var readCachedSupplierPartOrientationAnalysis = async ({
14700
14700
  cacheKey,
14701
14701
  component
@@ -55517,6 +55517,21 @@ var getUnbrokenCopperPourObstacles = ({
55517
55517
  };
55518
55518
 
55519
55519
  // lib/utils/autorouting/getSimpleRouteJsonFromCircuitJson.ts
55520
+ var getSrjConnectionPointsFromPcbTraceHints = (connectedPcbPorts, pcbTraceHints) => {
55521
+ const connectedPcbPortById = new Map(
55522
+ connectedPcbPorts.map((pcbPort) => [pcbPort.pcb_port_id, pcbPort])
55523
+ );
55524
+ return pcbTraceHints.flatMap((pcbTraceHint) => {
55525
+ const pcbPort = connectedPcbPortById.get(pcbTraceHint.pcb_port_id);
55526
+ if (!pcbPort) return [];
55527
+ const layer = pcbPort.layers?.[0] ?? "top";
55528
+ return pcbTraceHint.route.map((routePoint) => ({
55529
+ x: routePoint.x,
55530
+ y: routePoint.y,
55531
+ layer
55532
+ }));
55533
+ });
55534
+ };
55520
55535
  var getOwningPcbBoardForSubcircuit = (db, subcircuitId) => {
55521
55536
  const visitedSubcircuitIds = /* @__PURE__ */ new Set();
55522
55537
  let currentSubcircuitId = subcircuitId;
@@ -55821,6 +55836,8 @@ var getSimpleRouteJsonFromCircuitJson = ({
55821
55836
  (trace) => !sourceTraceIdsAlreadyPreservedAsSrjTraces.has(trace.source_trace_id)
55822
55837
  ).filter(
55823
55838
  (trace) => !subcircuit_id || trace.subcircuit_id === subcircuit_id
55839
+ ).filter(
55840
+ (sourceTrace) => sourceTrace.connected_source_net_ids.length === 0 || planeTerminatedSourceTraceLayers.has(sourceTrace.source_trace_id)
55824
55841
  ).map((trace) => {
55825
55842
  const connectedPcbPorts = trace.connected_source_port_ids.map(
55826
55843
  (sourcePortId) => db.pcb_port.getWhere({ source_port_id: sourcePortId })
@@ -55839,24 +55856,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
55839
55856
  return null;
55840
55857
  }
55841
55858
  }
55842
- const connectedPcbPortIds = new Set(
55843
- connectedPcbPorts.map((port) => port.pcb_port_id)
55844
- );
55845
- const matchingHints = traceHints.filter(
55846
- (hint) => connectedPcbPortIds.has(hint.pcb_port_id)
55847
- );
55848
- const hintPoints = [];
55849
- for (const hint of matchingHints) {
55850
- const port = db.pcb_port.get(hint.pcb_port_id);
55851
- const layer = port?.layers?.[0] ?? "top";
55852
- for (const pt of hint.route) {
55853
- hintPoints.push({
55854
- x: pt.x,
55855
- y: pt.y,
55856
- layer
55857
- });
55858
- }
55859
- }
55859
+ const srjTraceHintConnectionPoints = getSrjConnectionPointsFromPcbTraceHints(connectedPcbPorts, traceHints);
55860
55860
  const connectedPortRoutePoints = connectedPcbPorts.map(
55861
55861
  (port) => getPcbPortRoutePoint(port)
55862
55862
  );
@@ -55870,7 +55870,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
55870
55870
  // source trace endpoint in the autorouter input.
55871
55871
  pointsToConnect: [
55872
55872
  firstConnectedPortRoutePoint,
55873
- ...hintPoints,
55873
+ ...srjTraceHintConnectionPoints,
55874
55874
  ...remainingPortRoutePoints
55875
55875
  ]
55876
55876
  };
@@ -55953,15 +55953,20 @@ var getSimpleRouteJsonFromCircuitJson = ({
55953
55953
  }
55954
55954
  const pointsToConnect = [];
55955
55955
  const addedPointIds = /* @__PURE__ */ new Set();
55956
+ const connectedPcbPorts = [];
55956
55957
  for (const st of connectedSourceTraces) {
55957
55958
  const pcb_ports = db.pcb_port.list().filter((p) => st.connected_source_port_ids.includes(p.source_port_id));
55958
55959
  for (const p of pcb_ports) {
55959
55960
  const routePoint = getPcbPortRoutePoint(p);
55960
55961
  if (addedPointIds.has(routePoint.pointId)) continue;
55961
55962
  addedPointIds.add(routePoint.pointId);
55963
+ connectedPcbPorts.push(p);
55962
55964
  pointsToConnect.push(routePoint);
55963
55965
  }
55964
55966
  }
55967
+ pointsToConnect.push(
55968
+ ...getSrjConnectionPointsFromPcbTraceHints(connectedPcbPorts, traceHints)
55969
+ );
55965
55970
  const connection = {
55966
55971
  name: net.source_net_id ?? sharedConnMap.getNetConnectedToId(net.source_net_id),
55967
55972
  nominalTraceWidth: nominalTraceWidthForConnection,
@@ -64561,7 +64566,7 @@ function Group_getRoutingPhasePlans(group) {
64561
64566
  var package_default = {
64562
64567
  name: "@tscircuit/core",
64563
64568
  type: "module",
64564
- version: "0.0.2019",
64569
+ version: "0.0.2021",
64565
64570
  types: "dist/index.d.ts",
64566
64571
  main: "dist/index.js",
64567
64572
  module: "dist/index.js",
@@ -64598,7 +64603,7 @@ var package_default = {
64598
64603
  "@tscircuit/bus-lanes-solver": "github:tscircuit/bus-lanes-solver#0bc8d071241b18a3e7465a878881abe4998f6384",
64599
64604
  "@tscircuit/capacity-autorouter": "^0.0.941",
64600
64605
  "@tscircuit/checks": "^0.0.230",
64601
- "@tscircuit/circuit-json-util": "^0.0.116",
64606
+ "@tscircuit/circuit-json-util": "^0.0.117",
64602
64607
  "@tscircuit/common": "^0.0.20",
64603
64608
  "@tscircuit/copper-pour-solver": "^0.0.62",
64604
64609
  "@tscircuit/create-fdm-enclosure": "0.0.4",
@@ -64694,7 +64699,7 @@ var package_default = {
64694
64699
  zod: "^3.25.67"
64695
64700
  },
64696
64701
  overrides: {
64697
- "@tscircuit/circuit-json-util": "^0.0.116",
64702
+ "@tscircuit/circuit-json-util": "^0.0.117",
64698
64703
  "@tscircuit/props": "^0.0.672",
64699
64704
  "circuit-json": "^0.0.507"
64700
64705
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.2020",
4
+ "version": "0.0.2022",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "@tscircuit/bus-lanes-solver": "github:tscircuit/bus-lanes-solver#0bc8d071241b18a3e7465a878881abe4998f6384",
39
39
  "@tscircuit/capacity-autorouter": "^0.0.941",
40
40
  "@tscircuit/checks": "^0.0.230",
41
- "@tscircuit/circuit-json-util": "^0.0.116",
41
+ "@tscircuit/circuit-json-util": "^0.0.117",
42
42
  "@tscircuit/common": "^0.0.20",
43
43
  "@tscircuit/copper-pour-solver": "^0.0.62",
44
44
  "@tscircuit/create-fdm-enclosure": "0.0.4",
@@ -134,7 +134,7 @@
134
134
  "zod": "^3.25.67"
135
135
  },
136
136
  "overrides": {
137
- "@tscircuit/circuit-json-util": "^0.0.116",
137
+ "@tscircuit/circuit-json-util": "^0.0.117",
138
138
  "@tscircuit/props": "^0.0.672",
139
139
  "circuit-json": "^0.0.507"
140
140
  }