@tscircuit/schematic-trace-solver 0.0.109 → 0.0.110

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 CHANGED
@@ -3259,11 +3259,18 @@ var groupLabelsByChipAndOrientation = ({
3259
3259
  chips
3260
3260
  }) => {
3261
3261
  const groupedLabels = {};
3262
+ const chipIdByPinId = new Map(
3263
+ chips.flatMap(
3264
+ (chip) => chip.pins.map((pin) => [pin.pinId, chip.chipId])
3265
+ )
3266
+ );
3262
3267
  for (const label of labels) {
3263
3268
  if (label.pinIds.length === 0) {
3264
3269
  continue;
3265
3270
  }
3266
- const chipId = label.pinIds[0].split(".")[0];
3271
+ const pinId = label.pinIds[0];
3272
+ const legacyChipId = pinId.includes(".") ? pinId.split(".")[0] : void 0;
3273
+ const chipId = legacyChipId ?? chipIdByPinId.get(pinId);
3267
3274
  if (!chipId) {
3268
3275
  continue;
3269
3276
  }
@@ -7,7 +7,8 @@ import type { InputProblem } from "lib/types/InputProblem"
7
7
  * with the same orientation relative to that chip.
8
8
  *
9
9
  * @param labels An array of NetLabelPlacement objects to be grouped.
10
- * @param chips An array of Chip objects from the InputProblem. (Currently not directly used for grouping logic, but part of the signature).
10
+ * @param chips Chips from the input problem, used to resolve opaque pin IDs to
11
+ * their owning component.
11
12
  * @returns A record where keys are in the format "chipId-orientation" (e.g., "U1-left")
12
13
  * and values are arrays of NetLabelPlacement objects belonging to that group.
13
14
  */
@@ -19,6 +20,11 @@ export const groupLabelsByChipAndOrientation = ({
19
20
  chips: InputProblem["chips"]
20
21
  }): Record<string, NetLabelPlacement[]> => {
21
22
  const groupedLabels: Record<string, NetLabelPlacement[]> = {}
23
+ const chipIdByPinId = new Map(
24
+ chips.flatMap((chip) =>
25
+ chip.pins.map((pin) => [pin.pinId, chip.chipId] as const),
26
+ ),
27
+ )
22
28
 
23
29
  for (const label of labels) {
24
30
  if (label.pinIds.length === 0) {
@@ -26,10 +32,12 @@ export const groupLabelsByChipAndOrientation = ({
26
32
  continue
27
33
  }
28
34
 
29
- // Extract chipId from the first pinId (e.g., "U1.1" -> "U1")
30
- const chipId = label.pinIds[0].split(".")[0]
35
+ const pinId = label.pinIds[0]!
36
+ // Preserve historical group IDs for component-qualified pins while using
37
+ // the input's pin ownership for opaque IDs such as schematic_port_123.
38
+ const legacyChipId = pinId.includes(".") ? pinId.split(".")[0] : undefined
39
+ const chipId = legacyChipId ?? chipIdByPinId.get(pinId)
31
40
  if (!chipId) {
32
- // Should not happen if pinIds are well-formed, but good to guard
33
41
  continue
34
42
  }
35
43
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/schematic-trace-solver",
3
3
  "main": "dist/index.js",
4
- "version": "0.0.109",
4
+ "version": "0.0.110",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "cosmos",