@tscircuit/core 0.0.2306 → 0.0.2307
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 +105 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -149717,6 +149717,71 @@ var getDifferentialPairsForSimpleRouteJson = ({
|
|
|
149717
149717
|
return srjDifferentialPairs.length > 0 ? srjDifferentialPairs : void 0;
|
|
149718
149718
|
};
|
|
149719
149719
|
|
|
149720
|
+
// lib/utils/autorouting/getDifferentialPairSourceTraceIds.ts
|
|
149721
|
+
var getDifferentialPairSourceTraceIds = ({
|
|
149722
|
+
differentialPairs,
|
|
149723
|
+
sourceTraces,
|
|
149724
|
+
subcircuitId
|
|
149725
|
+
}) => {
|
|
149726
|
+
const sourceTraceIds = /* @__PURE__ */ new Set();
|
|
149727
|
+
for (const differentialPair of differentialPairs) {
|
|
149728
|
+
const pairSubcircuitId = differentialPair.getSubcircuit().subcircuit_id;
|
|
149729
|
+
if (subcircuitId && pairSubcircuitId !== subcircuitId) continue;
|
|
149730
|
+
const differentialPairSourceTraces = sourceTraces.filter(
|
|
149731
|
+
(trace) => trace.subcircuit_id === pairSubcircuitId
|
|
149732
|
+
);
|
|
149733
|
+
for (const traceNameOrPortSelector of [
|
|
149734
|
+
differentialPair._parsedProps.positiveConnection,
|
|
149735
|
+
differentialPair._parsedProps.negativeConnection
|
|
149736
|
+
]) {
|
|
149737
|
+
sourceTraceIds.add(
|
|
149738
|
+
getDifferentialPairSourceTraceOrThrow({
|
|
149739
|
+
differentialPair,
|
|
149740
|
+
differentialPairSourceTraces,
|
|
149741
|
+
traceNameOrPortSelector
|
|
149742
|
+
}).sourceTraceId
|
|
149743
|
+
);
|
|
149744
|
+
}
|
|
149745
|
+
}
|
|
149746
|
+
return sourceTraceIds;
|
|
149747
|
+
};
|
|
149748
|
+
|
|
149749
|
+
// lib/utils/autorouting/reduceNetConnectionPointsForDifferentialPairPaths.ts
|
|
149750
|
+
var reduceNetConnectionPointsForDifferentialPairPaths = ({
|
|
149751
|
+
netConnections,
|
|
149752
|
+
differentialPairConnections
|
|
149753
|
+
}) => {
|
|
149754
|
+
if (differentialPairConnections.length === 0) return;
|
|
149755
|
+
const parentPointId = /* @__PURE__ */ new Map();
|
|
149756
|
+
const root = (pointId) => {
|
|
149757
|
+
const parent = parentPointId.get(pointId);
|
|
149758
|
+
if (parent === void 0 || parent === pointId) return pointId;
|
|
149759
|
+
const representative = root(parent);
|
|
149760
|
+
parentPointId.set(pointId, representative);
|
|
149761
|
+
return representative;
|
|
149762
|
+
};
|
|
149763
|
+
for (const connection of differentialPairConnections) {
|
|
149764
|
+
const pointIds = connection.pointsToConnect.flatMap(
|
|
149765
|
+
(point8) => point8.pointId ? [point8.pointId] : []
|
|
149766
|
+
);
|
|
149767
|
+
for (const pointId of pointIds.slice(1)) {
|
|
149768
|
+
parentPointId.set(root(pointId), root(pointIds[0]));
|
|
149769
|
+
}
|
|
149770
|
+
}
|
|
149771
|
+
for (const netConnection of netConnections) {
|
|
149772
|
+
const representedPointIds = /* @__PURE__ */ new Set();
|
|
149773
|
+
netConnection.pointsToConnect = netConnection.pointsToConnect.filter(
|
|
149774
|
+
(point8) => {
|
|
149775
|
+
if (!point8.pointId) return true;
|
|
149776
|
+
const representative = root(point8.pointId);
|
|
149777
|
+
if (representedPointIds.has(representative)) return false;
|
|
149778
|
+
representedPointIds.add(representative);
|
|
149779
|
+
return true;
|
|
149780
|
+
}
|
|
149781
|
+
);
|
|
149782
|
+
}
|
|
149783
|
+
};
|
|
149784
|
+
|
|
149720
149785
|
// lib/utils/autorouting/getPreservedRoutedSubcircuitTraces.ts
|
|
149721
149786
|
var getLayerName = (layer) => typeof layer === "string" ? layer : layer.name;
|
|
149722
149787
|
var getPreservedTraceConnectionName = (trace) => trace.source_trace_id ?? trace.connection_name ?? trace.pcb_trace_id;
|
|
@@ -150232,6 +150297,17 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
150232
150297
|
};
|
|
150233
150298
|
};
|
|
150234
150299
|
const sourceTraces = db2.source_trace.list();
|
|
150300
|
+
const differentialPairs = subcircuitComponent?.selectAll("differentialpair") ?? [];
|
|
150301
|
+
const differentialPairSourceTraceIds = getDifferentialPairSourceTraceIds({
|
|
150302
|
+
differentialPairs,
|
|
150303
|
+
sourceTraces,
|
|
150304
|
+
subcircuitId: subcircuit_id
|
|
150305
|
+
});
|
|
150306
|
+
const differentialPairPathSourceTraceIds = new Set(
|
|
150307
|
+
sourceTraces.filter(
|
|
150308
|
+
(trace) => differentialPairSourceTraceIds.has(trace.source_trace_id) && trace.connected_source_port_ids.length === 2
|
|
150309
|
+
).map((trace) => trace.source_trace_id)
|
|
150310
|
+
);
|
|
150235
150311
|
const planeTerminatedSourceTraceLayers = getPlaneTerminatedSourceTraceLayers({
|
|
150236
150312
|
fanoutPourNetMap,
|
|
150237
150313
|
sourceNets: db2.source_net.list(),
|
|
@@ -150249,7 +150325,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
150249
150325
|
).filter(
|
|
150250
150326
|
(trace) => !subcircuit_id || trace.subcircuit_id === subcircuit_id
|
|
150251
150327
|
).filter(
|
|
150252
|
-
(sourceTrace) => sourceTrace.connected_source_net_ids.length === 0 || planeTerminatedSourceTraceLayers.has(sourceTrace.source_trace_id)
|
|
150328
|
+
(sourceTrace) => sourceTrace.connected_source_net_ids.length === 0 || differentialPairPathSourceTraceIds.has(sourceTrace.source_trace_id) || planeTerminatedSourceTraceLayers.has(sourceTrace.source_trace_id)
|
|
150253
150329
|
).map((trace) => {
|
|
150254
150330
|
const connectedPcbPorts = trace.connected_source_port_ids.map(
|
|
150255
150331
|
(sourcePortId) => db2.pcb_port.getWhere({ source_port_id: sourcePortId })
|
|
@@ -150287,6 +150363,14 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
150287
150363
|
]
|
|
150288
150364
|
};
|
|
150289
150365
|
}).filter((c2) => c2 !== null);
|
|
150366
|
+
const differentialPairPathConnections = directTraceConnections.filter(
|
|
150367
|
+
(connection) => connection.source_trace_id !== void 0 && differentialPairPathSourceTraceIds.has(connection.source_trace_id)
|
|
150368
|
+
);
|
|
150369
|
+
const differentialPairPathSourcePortIds = new Set(
|
|
150370
|
+
differentialPairPathConnections.flatMap(
|
|
150371
|
+
(connection) => sourceTraceById.get(connection.source_trace_id).connected_source_port_ids
|
|
150372
|
+
)
|
|
150373
|
+
);
|
|
150290
150374
|
const source_nets = db2.source_net.list().filter((e2) => !subcircuit_id || e2.subcircuit_id === subcircuit_id);
|
|
150291
150375
|
const connectionsFromNets = [];
|
|
150292
150376
|
const connectionFromNetId = /* @__PURE__ */ new Map();
|
|
@@ -150363,6 +150447,15 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
150363
150447
|
sourceTrace.min_trace_thickness
|
|
150364
150448
|
);
|
|
150365
150449
|
}
|
|
150450
|
+
const connectedSourceTraceIds = new Set(
|
|
150451
|
+
connectedSourceTraces.map((trace) => trace.source_trace_id)
|
|
150452
|
+
);
|
|
150453
|
+
for (const connection2 of differentialPairPathConnections) {
|
|
150454
|
+
if (!connectedSourceTraceIds.has(connection2.source_trace_id)) continue;
|
|
150455
|
+
connection2.netConnectionName = net.source_net_id;
|
|
150456
|
+
connection2.nominalTraceWidth = nominalTraceWidthForConnection;
|
|
150457
|
+
connection2.width = nominalTraceWidthForConnection;
|
|
150458
|
+
}
|
|
150366
150459
|
const pointsToConnect = [];
|
|
150367
150460
|
const addedPointIds = /* @__PURE__ */ new Set();
|
|
150368
150461
|
const connectedPcbPorts = [];
|
|
@@ -150377,7 +150470,12 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
150377
150470
|
}
|
|
150378
150471
|
}
|
|
150379
150472
|
pointsToConnect.push(
|
|
150380
|
-
...getSrjConnectionPointsFromPcbTraceHints(
|
|
150473
|
+
...getSrjConnectionPointsFromPcbTraceHints(
|
|
150474
|
+
connectedPcbPorts.filter(
|
|
150475
|
+
(port) => !differentialPairPathSourcePortIds.has(port.source_port_id)
|
|
150476
|
+
),
|
|
150477
|
+
traceHints
|
|
150478
|
+
)
|
|
150381
150479
|
);
|
|
150382
150480
|
const connection = {
|
|
150383
150481
|
name: net.source_net_id ?? sharedConnMap.getNetConnectedToId(net.source_net_id),
|
|
@@ -150446,6 +150544,10 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
150446
150544
|
}
|
|
150447
150545
|
}
|
|
150448
150546
|
}
|
|
150547
|
+
reduceNetConnectionPointsForDifferentialPairPaths({
|
|
150548
|
+
netConnections: connectionsFromNets,
|
|
150549
|
+
differentialPairConnections: differentialPairPathConnections
|
|
150550
|
+
});
|
|
150449
150551
|
const routableConnectionsFromNets = connectionsFromNets.filter(
|
|
150450
150552
|
(connection) => connection.pointsToConnect.length >= 2
|
|
150451
150553
|
);
|
|
@@ -150490,7 +150592,6 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
150490
150592
|
bounds,
|
|
150491
150593
|
connections: allConns
|
|
150492
150594
|
});
|
|
150493
|
-
const differentialPairs = subcircuitComponent?.selectAll("differentialpair") ?? [];
|
|
150494
150595
|
const buses = subcircuitComponent?.selectAll("bus") ?? [];
|
|
150495
150596
|
const srjDifferentialPairs = getDifferentialPairsForSimpleRouteJson({
|
|
150496
150597
|
srjConnections: allConns,
|
|
@@ -159370,7 +159471,7 @@ var RoutingPhasePreparationError = class extends Error {
|
|
|
159370
159471
|
var package_default = {
|
|
159371
159472
|
name: "@tscircuit/core",
|
|
159372
159473
|
type: "module",
|
|
159373
|
-
version: "0.0.
|
|
159474
|
+
version: "0.0.2306",
|
|
159374
159475
|
types: "dist/index.d.ts",
|
|
159375
159476
|
main: "dist/index.js",
|
|
159376
159477
|
module: "dist/index.js",
|