@tscircuit/core 0.0.2306 → 0.0.2308

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