@tscircuit/core 0.0.1248 → 0.0.1249
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.
- package/dist/index.js +35 -10
- 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
|
|
19286
|
-
|
|
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({
|
|
@@ -20224,11 +20233,27 @@ var Group5 = class extends NormalComponent3 {
|
|
|
20224
20233
|
});
|
|
20225
20234
|
for (const pcb_trace of output_pcb_traces) {
|
|
20226
20235
|
if (pcb_trace.type !== "pcb_trace") continue;
|
|
20227
|
-
const
|
|
20236
|
+
const possibleSourceTraceIds = [
|
|
20237
|
+
...getSourceTraceIdsFromRerouteName(pcb_trace.source_trace_id),
|
|
20238
|
+
...getSourceTraceIdsFromRerouteName(pcb_trace.connection_name),
|
|
20239
|
+
...getSourceTraceIdsFromRerouteName(
|
|
20240
|
+
pcb_trace.rootConnectionName
|
|
20241
|
+
)
|
|
20242
|
+
];
|
|
20243
|
+
const validSourceTraceIds = Array.from(
|
|
20244
|
+
new Set(possibleSourceTraceIds)
|
|
20245
|
+
).filter(
|
|
20246
|
+
(possibleSourceTraceId) => Boolean(
|
|
20247
|
+
db.source_trace.get(possibleSourceTraceId) ?? db.source_net.get(possibleSourceTraceId)
|
|
20248
|
+
)
|
|
20249
|
+
);
|
|
20250
|
+
const sourceTraceId = validSourceTraceIds.length === 1 ? validSourceTraceIds[0] : void 0;
|
|
20228
20251
|
if (sourceTraceId) {
|
|
20229
20252
|
pcb_trace.source_trace_id = sourceTraceId;
|
|
20253
|
+
} else {
|
|
20254
|
+
delete pcb_trace.source_trace_id;
|
|
20230
20255
|
}
|
|
20231
|
-
pcb_trace.subcircuit_id ??= (sourceTraceId ? db.source_trace.get(sourceTraceId)?.subcircuit_id : void 0) ?? this.subcircuit_id;
|
|
20256
|
+
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
20257
|
let segments = splitPcbTracesOnJumperSegments(pcb_trace.route);
|
|
20233
20258
|
if (segments === null) {
|
|
20234
20259
|
segments = [pcb_trace.route];
|
|
@@ -21327,7 +21352,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
21327
21352
|
var package_default = {
|
|
21328
21353
|
name: "@tscircuit/core",
|
|
21329
21354
|
type: "module",
|
|
21330
|
-
version: "0.0.
|
|
21355
|
+
version: "0.0.1248",
|
|
21331
21356
|
types: "dist/index.d.ts",
|
|
21332
21357
|
main: "dist/index.js",
|
|
21333
21358
|
module: "dist/index.js",
|