@tscircuit/schematic-trace-solver 0.0.94 → 0.0.96

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 (38) hide show
  1. package/dist/index.d.ts +19 -12
  2. package/dist/index.js +78 -57
  3. package/lib/solvers/{VccNetLabelCornerPlacementSolver/VccNetLabelCornerPlacementSolver.ts → RailNetLabelCornerPlacementSolver/RailNetLabelCornerPlacementSolver.ts} +27 -9
  4. package/lib/solvers/{VccNetLabelCornerPlacementSolver → RailNetLabelCornerPlacementSolver}/types.ts +7 -1
  5. package/lib/solvers/{VccNetLabelCornerPlacementSolver → RailNetLabelCornerPlacementSolver}/visualize.ts +1 -1
  6. package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +17 -12
  7. package/lib/solvers/SchematicTracePipelineSolver/visualizeInputProblem.ts +47 -40
  8. package/lib/types/InputProblem.ts +1 -0
  9. package/package.json +1 -1
  10. package/tests/bug-reports/bug-report-20260706T213649Z/__snapshots__/bug-report-20260706T213649Z.snap.svg +1 -1
  11. package/tests/bug-reports/bug-report-20260706T213649Z/bug-report-20260706T213649Z.test.ts +3 -1
  12. package/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg +314 -314
  13. package/tests/bug-reports/bug-report-20260707T092615Z/__snapshots__/bug-report-20260707T092615Z.snap.svg +5 -5
  14. package/tests/bug-reports/bug-report-20260707T092615Z/bug-report-20260707T092615Z.test.ts +3 -1
  15. package/tests/bug-reports/bug-report-20260707T134722Z/__snapshots__/bug-report-20260707T134722Z.snap.svg +2 -2
  16. package/tests/bug-reports/bug-report-20260707T140410Z/__snapshots__/bug-report-20260707T140410Z.snap.svg +8 -8
  17. package/tests/bug-reports/bug-report-20260707T141421Z/__snapshots__/bug-report-20260707T141421Z.snap.svg +4 -4
  18. package/tests/bug-reports/bug-report-20260707T230831Z/__snapshots__/bug-report-20260707T230831Z.snap.svg +2 -2
  19. package/tests/bug-reports/bug-report-20260708T095725Z/__snapshots__/bug-report-20260708T095725Z.snap.svg +2 -2
  20. package/tests/examples/__snapshots__/example01.snap.svg +2 -2
  21. package/tests/examples/__snapshots__/example02.snap.svg +4 -4
  22. package/tests/examples/__snapshots__/example07.snap.svg +2 -2
  23. package/tests/examples/__snapshots__/example12.snap.svg +2 -2
  24. package/tests/examples/__snapshots__/example14.snap.svg +36 -36
  25. package/tests/examples/__snapshots__/example15.snap.svg +2 -2
  26. package/tests/examples/__snapshots__/example18.snap.svg +4 -4
  27. package/tests/examples/__snapshots__/example19.snap.svg +22 -22
  28. package/tests/examples/__snapshots__/example21.snap.svg +4 -4
  29. package/tests/examples/__snapshots__/example25.snap.svg +35 -35
  30. package/tests/examples/__snapshots__/example29.snap.svg +10 -10
  31. package/tests/examples/__snapshots__/example31.snap.svg +6 -6
  32. package/tests/examples/__snapshots__/example32.snap.svg +2 -2
  33. package/tests/examples/__snapshots__/example46.snap.svg +2 -2
  34. package/tests/examples/__snapshots__/example47.snap.svg +2 -2
  35. package/tests/repros/__snapshots__/repro-ina237-current-monitor.snap.svg +4 -4
  36. package/tests/repros/__snapshots__/repro-netlabel-overlap-trace.snap.svg +2 -2
  37. package/tests/repros/__snapshots__/trace-overlap-box-resistor.snap.svg +2 -2
  38. /package/lib/solvers/{VccNetLabelCornerPlacementSolver → RailNetLabelCornerPlacementSolver}/geometry.ts +0 -0
@@ -9,9 +9,14 @@ export const visualizeInputProblem = (
9
9
  opts: {
10
10
  chipAlpha?: number
11
11
  connectionAlpha?: number
12
+ hideRatsNet?: boolean
12
13
  } = {},
13
14
  ): GraphicsObject => {
14
- const { connectionAlpha = 0.8, chipAlpha = 0.8 } = opts
15
+ const {
16
+ connectionAlpha = 0.8,
17
+ chipAlpha = 0.8,
18
+ hideRatsNet = inputProblem._hideRatsNet ?? false,
19
+ } = opts
15
20
  const graphics: Pick<
16
21
  Required<GraphicsObject>,
17
22
  "lines" | "points" | "rects"
@@ -58,48 +63,50 @@ export const visualizeInputProblem = (
58
63
  } as any)
59
64
  }
60
65
 
61
- for (const directConn of inputProblem.directConnections) {
62
- const [pinId1, pinId2] = directConn.pinIds
63
- const pin1 = pinIdMap.get(pinId1)!
64
- const pin2 = pinIdMap.get(pinId2)!
65
- if (arePinsInDifferentSchematicSections(inputProblem, pin1, pin2)) {
66
- continue
66
+ if (!hideRatsNet) {
67
+ for (const directConn of inputProblem.directConnections) {
68
+ const [pinId1, pinId2] = directConn.pinIds
69
+ const pin1 = pinIdMap.get(pinId1)!
70
+ const pin2 = pinIdMap.get(pinId2)!
71
+ if (arePinsInDifferentSchematicSections(inputProblem, pin1, pin2)) {
72
+ continue
73
+ }
74
+ graphics.lines.push({
75
+ points: [
76
+ {
77
+ x: pin1.x,
78
+ y: pin1.y,
79
+ },
80
+ {
81
+ x: pin2.x,
82
+ y: pin2.y,
83
+ },
84
+ ],
85
+ strokeColor: getColorFromString(
86
+ directConn.netId ?? `${pinId1}-${pinId2}`,
87
+ connectionAlpha,
88
+ ),
89
+ })
67
90
  }
68
- graphics.lines.push({
69
- points: [
70
- {
71
- x: pin1.x,
72
- y: pin1.y,
73
- },
74
- {
75
- x: pin2.x,
76
- y: pin2.y,
77
- },
78
- ],
79
- strokeColor: getColorFromString(
80
- directConn.netId ?? `${pinId1}-${pinId2}`,
81
- connectionAlpha,
82
- ),
83
- })
84
- }
85
91
 
86
- for (const netConn of inputProblem.netConnections) {
87
- const pins = netConn.pinIds.map((pinId) => pinIdMap.get(pinId)!)
88
- for (let i = 0; i < pins.length - 1; i++) {
89
- for (let j = i + 1; j < pins.length; j++) {
90
- const pin1 = pins[i]!
91
- const pin2 = pins[j]!
92
- if (arePinsInDifferentSchematicSections(inputProblem, pin1, pin2)) {
93
- continue
92
+ for (const netConn of inputProblem.netConnections) {
93
+ const pins = netConn.pinIds.map((pinId) => pinIdMap.get(pinId)!)
94
+ for (let i = 0; i < pins.length - 1; i++) {
95
+ for (let j = i + 1; j < pins.length; j++) {
96
+ const pin1 = pins[i]!
97
+ const pin2 = pins[j]!
98
+ if (arePinsInDifferentSchematicSections(inputProblem, pin1, pin2)) {
99
+ continue
100
+ }
101
+ graphics.lines.push({
102
+ points: [
103
+ { x: pin1.x, y: pin1.y },
104
+ { x: pin2.x, y: pin2.y },
105
+ ],
106
+ strokeColor: getColorFromString(netConn.netId, connectionAlpha),
107
+ strokeDash: "4 2",
108
+ })
94
109
  }
95
- graphics.lines.push({
96
- points: [
97
- { x: pin1.x, y: pin1.y },
98
- { x: pin2.x, y: pin2.y },
99
- ],
100
- strokeColor: getColorFromString(netConn.netId, connectionAlpha),
101
- strokeDash: "4 2",
102
- })
103
110
  }
104
111
  }
105
112
  }
@@ -53,4 +53,5 @@ export interface InputProblem {
53
53
  maxMspPairDistance?: number
54
54
 
55
55
  _chipObstacleSpatialIndex?: ChipObstacleSpatialIndex
56
+ _hideRatsNet?: boolean
56
57
  }
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.94",
4
+ "version": "0.0.96",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "cosmos",