@tscircuit/core 0.0.1248 → 0.0.1250

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 +39 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19278,17 +19278,26 @@ function getExistingPcbTracesForReroute(group) {
19278
19278
  });
19279
19279
  }
19280
19280
 
19281
+ // lib/components/primitive-components/Group/region-replacement/get-source-trace-ids-from-reroute-name.ts
19282
+ function getSourceTraceIdsFromRerouteName(value) {
19283
+ if (typeof value !== "string" || value.length === 0) return [];
19284
+ return value.split("__").flatMap((connectionNamePart) => {
19285
+ if (connectionNamePart.length === 0) return [];
19286
+ const sourceTraceIds = [connectionNamePart];
19287
+ const rerouteSuffixIndex = connectionNamePart.indexOf("_reroute_");
19288
+ if (rerouteSuffixIndex > 0) {
19289
+ sourceTraceIds.push(connectionNamePart.slice(0, rerouteSuffixIndex));
19290
+ }
19291
+ return sourceTraceIds;
19292
+ });
19293
+ }
19294
+
19281
19295
  // lib/components/primitive-components/Group/region-replacement/delete-existing-pcb-traces-replaced-by.ts
19282
19296
  function addPossibleReplacementSourceTraceId(sourceTraceIds, value) {
19283
19297
  if (typeof value !== "string" || value.length === 0) return;
19284
19298
  sourceTraceIds.add(value);
19285
- for (const connectionNamePart of value.split("__")) {
19286
- if (connectionNamePart.length === 0) continue;
19287
- sourceTraceIds.add(connectionNamePart);
19288
- const rerouteSuffixIndex = connectionNamePart.indexOf("_reroute_");
19289
- if (rerouteSuffixIndex > 0) {
19290
- sourceTraceIds.add(connectionNamePart.slice(0, rerouteSuffixIndex));
19291
- }
19299
+ for (const sourceTraceId of getSourceTraceIdsFromRerouteName(value)) {
19300
+ sourceTraceIds.add(sourceTraceId);
19292
19301
  }
19293
19302
  }
19294
19303
  function deleteExistingPcbTracesReplacedBy({
@@ -19940,10 +19949,12 @@ var Group5 = class extends NormalComponent3 {
19940
19949
  const isLaserPrefabPreset = this._isLaserPrefabAutorouter(autorouterConfig);
19941
19950
  const isAutoJumperPreset = this._isAutoJumperAutorouter(autorouterConfig);
19942
19951
  const isSingleLayerBoard = this._getSubcircuitLayerCount() === 1;
19952
+ const minTraceWidth = Number(props.minTraceWidth ?? 0.15);
19953
+ const nominalTraceWidth = Number(props.nominalTraceWidth ?? 0.15);
19943
19954
  const { simpleRouteJson: baseSimpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
19944
19955
  db,
19945
- minTraceWidth: Number(props.minTraceWidth ?? 0.15),
19946
- nominalTraceWidth: Number(props.nominalTraceWidth),
19956
+ minTraceWidth,
19957
+ nominalTraceWidth,
19947
19958
  subcircuit_id: this.subcircuit_id,
19948
19959
  subcircuitComponent: this
19949
19960
  });
@@ -20224,11 +20235,27 @@ var Group5 = class extends NormalComponent3 {
20224
20235
  });
20225
20236
  for (const pcb_trace of output_pcb_traces) {
20226
20237
  if (pcb_trace.type !== "pcb_trace") continue;
20227
- const sourceTraceId = pcb_trace.source_trace_id ?? pcb_trace.connection_name;
20238
+ const possibleSourceTraceIds = [
20239
+ ...getSourceTraceIdsFromRerouteName(pcb_trace.source_trace_id),
20240
+ ...getSourceTraceIdsFromRerouteName(pcb_trace.connection_name),
20241
+ ...getSourceTraceIdsFromRerouteName(
20242
+ pcb_trace.rootConnectionName
20243
+ )
20244
+ ];
20245
+ const validSourceTraceIds = Array.from(
20246
+ new Set(possibleSourceTraceIds)
20247
+ ).filter(
20248
+ (possibleSourceTraceId) => Boolean(
20249
+ db.source_trace.get(possibleSourceTraceId) ?? db.source_net.get(possibleSourceTraceId)
20250
+ )
20251
+ );
20252
+ const sourceTraceId = validSourceTraceIds.length === 1 ? validSourceTraceIds[0] : void 0;
20228
20253
  if (sourceTraceId) {
20229
20254
  pcb_trace.source_trace_id = sourceTraceId;
20255
+ } else {
20256
+ delete pcb_trace.source_trace_id;
20230
20257
  }
20231
- pcb_trace.subcircuit_id ??= (sourceTraceId ? db.source_trace.get(sourceTraceId)?.subcircuit_id : void 0) ?? this.subcircuit_id;
20258
+ pcb_trace.subcircuit_id ??= (sourceTraceId ? db.source_trace.get(sourceTraceId)?.subcircuit_id ?? db.source_net.get(sourceTraceId)?.subcircuit_id : void 0) ?? this.subcircuit_id;
20232
20259
  let segments = splitPcbTracesOnJumperSegments(pcb_trace.route);
20233
20260
  if (segments === null) {
20234
20261
  segments = [pcb_trace.route];
@@ -21327,7 +21354,7 @@ import { identity as identity5 } from "transformation-matrix";
21327
21354
  var package_default = {
21328
21355
  name: "@tscircuit/core",
21329
21356
  type: "module",
21330
- version: "0.0.1247",
21357
+ version: "0.0.1249",
21331
21358
  types: "dist/index.d.ts",
21332
21359
  main: "dist/index.js",
21333
21360
  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.1248",
4
+ "version": "0.0.1250",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",