@tscircuit/core 0.0.1313 → 0.0.1315
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 +64 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15718,7 +15718,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
15718
15718
|
};
|
|
15719
15719
|
}
|
|
15720
15720
|
const routedTraceIds = new Set(
|
|
15721
|
-
db.pcb_trace.list().filter((t) =>
|
|
15721
|
+
subcircuit_id ? db.pcb_trace.list().filter((t) => t.subcircuit_id === subcircuit_id).map((t) => t.source_trace_id).filter((id) => Boolean(id)) : []
|
|
15722
15722
|
);
|
|
15723
15723
|
const sourcePortIdToBreakoutPoint = /* @__PURE__ */ new Map();
|
|
15724
15724
|
for (const bp of breakoutPoints) {
|
|
@@ -15814,22 +15814,27 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
15814
15814
|
sourceTrace.min_trace_thickness
|
|
15815
15815
|
);
|
|
15816
15816
|
}
|
|
15817
|
-
|
|
15818
|
-
|
|
15819
|
-
|
|
15820
|
-
|
|
15821
|
-
|
|
15822
|
-
|
|
15823
|
-
|
|
15824
|
-
|
|
15825
|
-
return pcb_ports.map((p) => ({
|
|
15817
|
+
const pointsToConnect = [];
|
|
15818
|
+
const addedPointIds = /* @__PURE__ */ new Set();
|
|
15819
|
+
for (const st of connectedSourceTraces) {
|
|
15820
|
+
const pcb_ports = db.pcb_port.list().filter((p) => st.connected_source_port_ids.includes(p.source_port_id));
|
|
15821
|
+
for (const p of pcb_ports) {
|
|
15822
|
+
if (addedPointIds.has(p.pcb_port_id)) continue;
|
|
15823
|
+
addedPointIds.add(p.pcb_port_id);
|
|
15824
|
+
pointsToConnect.push({
|
|
15826
15825
|
x: p.x,
|
|
15827
15826
|
y: p.y,
|
|
15828
15827
|
layer: p.layers?.[0] ?? "top",
|
|
15829
15828
|
pointId: p.pcb_port_id,
|
|
15830
15829
|
pcb_port_id: p.pcb_port_id
|
|
15831
|
-
})
|
|
15832
|
-
}
|
|
15830
|
+
});
|
|
15831
|
+
}
|
|
15832
|
+
}
|
|
15833
|
+
connectionsFromNets.push({
|
|
15834
|
+
name: net.source_net_id ?? connMap.getNetConnectedToId(net.source_net_id),
|
|
15835
|
+
nominalTraceWidth: nominalTraceWidthFromConnectedTraces,
|
|
15836
|
+
width: nominalTraceWidthFromConnectedTraces,
|
|
15837
|
+
pointsToConnect
|
|
15833
15838
|
});
|
|
15834
15839
|
}
|
|
15835
15840
|
const connectionsFromBreakoutPoints = [];
|
|
@@ -15881,31 +15886,34 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
15881
15886
|
...connectionsFromNets,
|
|
15882
15887
|
...connectionsFromBreakoutPoints
|
|
15883
15888
|
];
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
for (const
|
|
15887
|
-
|
|
15889
|
+
if (subcircuit_id) {
|
|
15890
|
+
const pointIdToConn = /* @__PURE__ */ new Map();
|
|
15891
|
+
for (const conn of allConns) {
|
|
15892
|
+
for (const pt of conn.pointsToConnect) {
|
|
15893
|
+
if (pt.pointId) pointIdToConn.set(pt.pointId, conn);
|
|
15894
|
+
}
|
|
15895
|
+
}
|
|
15896
|
+
const existingTraces = db.pcb_trace.list().filter((t) => {
|
|
15897
|
+
return relevantSubcircuitIds?.has(t.subcircuit_id);
|
|
15898
|
+
});
|
|
15899
|
+
for (const tr of existingTraces) {
|
|
15900
|
+
const tracePortIds = /* @__PURE__ */ new Set();
|
|
15901
|
+
for (const seg of tr.route) {
|
|
15902
|
+
if (seg.start_pcb_port_id) tracePortIds.add(seg.start_pcb_port_id);
|
|
15903
|
+
if (seg.end_pcb_port_id) tracePortIds.add(seg.end_pcb_port_id);
|
|
15904
|
+
}
|
|
15905
|
+
if (tracePortIds.size < 2) continue;
|
|
15906
|
+
const firstId = tracePortIds.values().next().value;
|
|
15907
|
+
if (!firstId) continue;
|
|
15908
|
+
const conn = pointIdToConn.get(firstId);
|
|
15909
|
+
if (!conn) continue;
|
|
15910
|
+
if (![...tracePortIds].every((pid) => pointIdToConn.get(pid) === conn)) {
|
|
15911
|
+
continue;
|
|
15912
|
+
}
|
|
15913
|
+
conn.externallyConnectedPointIds ??= [];
|
|
15914
|
+
conn.externallyConnectedPointIds.push([...tracePortIds]);
|
|
15888
15915
|
}
|
|
15889
15916
|
}
|
|
15890
|
-
const existingTraces = db.pcb_trace.list().filter(
|
|
15891
|
-
(t) => !subcircuit_id || relevantSubcircuitIds?.has(t.subcircuit_id)
|
|
15892
|
-
);
|
|
15893
|
-
for (const tr of existingTraces) {
|
|
15894
|
-
const tracePortIds = /* @__PURE__ */ new Set();
|
|
15895
|
-
for (const seg of tr.route) {
|
|
15896
|
-
if (seg.start_pcb_port_id) tracePortIds.add(seg.start_pcb_port_id);
|
|
15897
|
-
if (seg.end_pcb_port_id) tracePortIds.add(seg.end_pcb_port_id);
|
|
15898
|
-
}
|
|
15899
|
-
if (tracePortIds.size < 2) continue;
|
|
15900
|
-
const firstId = tracePortIds.values().next().value;
|
|
15901
|
-
if (!firstId) continue;
|
|
15902
|
-
const conn = pointIdToConn.get(firstId);
|
|
15903
|
-
if (!conn) continue;
|
|
15904
|
-
if (![...tracePortIds].every((pid) => pointIdToConn.get(pid) === conn))
|
|
15905
|
-
continue;
|
|
15906
|
-
conn.externallyConnectedPointIds ??= [];
|
|
15907
|
-
conn.externallyConnectedPointIds.push([...tracePortIds]);
|
|
15908
|
-
}
|
|
15909
15917
|
const resolvedMinViaHoleDiameter = minViaHoleDiameter ?? board?.min_via_hole_diameter;
|
|
15910
15918
|
const resolvedMinViaPadDiameter = minViaPadDiameter ?? board?.min_via_pad_diameter;
|
|
15911
15919
|
const resolvedMinTraceToPadEdgeClearance = minTraceToPadEdgeClearance ?? board?.min_trace_to_pad_edge_clearance;
|
|
@@ -19724,6 +19732,24 @@ var getSourcePortNetLabelText = (db, sourcePortId) => {
|
|
|
19724
19732
|
if (!sourceComponent?.name || !sourcePort.name) return void 0;
|
|
19725
19733
|
return `${sourceComponent.name}_${sourcePort.name}`;
|
|
19726
19734
|
};
|
|
19735
|
+
var getDirectCrossSubcircuitConnectionLabelText = (db, sourcePortId) => {
|
|
19736
|
+
const sourcePort = db.source_port.get(sourcePortId);
|
|
19737
|
+
if (!sourcePort) return void 0;
|
|
19738
|
+
for (const sourceTrace of db.source_trace.list()) {
|
|
19739
|
+
const connectedSourcePortIds = sourceTrace.connected_source_port_ids ?? [];
|
|
19740
|
+
if (connectedSourcePortIds.length !== 2) continue;
|
|
19741
|
+
if ((sourceTrace.connected_source_net_ids ?? []).length > 0) continue;
|
|
19742
|
+
if (!connectedSourcePortIds.includes(sourcePortId)) continue;
|
|
19743
|
+
const otherSourcePortId = connectedSourcePortIds.find(
|
|
19744
|
+
(portId) => portId !== sourcePortId
|
|
19745
|
+
);
|
|
19746
|
+
if (!otherSourcePortId) continue;
|
|
19747
|
+
const otherSourcePort = db.source_port.get(otherSourcePortId);
|
|
19748
|
+
if (!otherSourcePort) continue;
|
|
19749
|
+
if (otherSourcePort.subcircuit_id === sourcePort.subcircuit_id) continue;
|
|
19750
|
+
return getSourcePortNetLabelText(db, otherSourcePortId);
|
|
19751
|
+
}
|
|
19752
|
+
};
|
|
19727
19753
|
var insertNetLabelsForPortsMissingTrace = ({
|
|
19728
19754
|
allSourceAndSchematicPortIdsInScope,
|
|
19729
19755
|
group,
|
|
@@ -19750,7 +19776,8 @@ var insertNetLabelsForPortsMissingTrace = ({
|
|
|
19750
19776
|
return db.source_port.get(sourcePortId)?.subcircuit_connectivity_map_key === connKey;
|
|
19751
19777
|
});
|
|
19752
19778
|
const implicitPortLabelText = connectedSourcePortIdsForKey.map((sourcePortId) => getSourcePortNetLabelText(db, sourcePortId)).filter((label) => Boolean(label)).join("/");
|
|
19753
|
-
const
|
|
19779
|
+
const directCrossSubcircuitConnectionLabelText = getDirectCrossSubcircuitConnectionLabelText(db, srcPortId);
|
|
19780
|
+
const text = sourceNet?.name || sourceNet?.source_net_id || directCrossSubcircuitConnectionLabelText || implicitPortLabelText || connKey;
|
|
19754
19781
|
const connectedPortCountForKey = Array.from(
|
|
19755
19782
|
allSourceAndSchematicPortIdsInScope
|
|
19756
19783
|
).filter((portId) => {
|
|
@@ -23490,7 +23517,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
23490
23517
|
var package_default = {
|
|
23491
23518
|
name: "@tscircuit/core",
|
|
23492
23519
|
type: "module",
|
|
23493
|
-
version: "0.0.
|
|
23520
|
+
version: "0.0.1314",
|
|
23494
23521
|
types: "dist/index.d.ts",
|
|
23495
23522
|
main: "dist/index.js",
|
|
23496
23523
|
module: "dist/index.js",
|