@tscircuit/schematic-trace-solver 0.0.157 → 0.0.159

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 (175) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +269 -58
  3. package/lib/solvers/LongDistancePairSolver/LongDistancePairSolver.ts +15 -8
  4. package/lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver.ts +5 -0
  5. package/lib/solvers/MspConnectionPairSolver/getGroundConnectionPolicy.ts +83 -0
  6. package/lib/solvers/SameNetJunctionAlignmentSolver/SameNetJunctionAlignmentSolver.ts +6 -1
  7. package/lib/solvers/SameNetJunctionAlignmentSolver/alignSameNetJunctions.ts +196 -67
  8. package/lib/solvers/SameNetJunctionAlignmentSolver/placeGroundRailLabelsAtOuterEnd.ts +122 -0
  9. package/package.json +1 -1
  10. package/site/bug-reports/bug-report-20260826T072956Z.page.tsx +4 -0
  11. package/tests/bug-reports/bug-report-20260706T213649Z/__snapshots__/bug-report-20260706T213649Z.snap.svg +2 -2
  12. package/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg +2 -2
  13. package/tests/bug-reports/bug-report-20260707T020342Z/__snapshots__/bug-report-20260707T020342Z.snap.svg +2 -2
  14. package/tests/bug-reports/bug-report-20260707T092615Z/__snapshots__/bug-report-20260707T092615Z.snap.svg +2 -2
  15. package/tests/bug-reports/bug-report-20260707T134549Z/__snapshots__/bug-report-20260707T134549Z.snap.svg +2 -2
  16. package/tests/bug-reports/bug-report-20260707T134722Z/__snapshots__/bug-report-20260707T134722Z.snap.svg +2 -2
  17. package/tests/bug-reports/bug-report-20260707T140410Z/__snapshots__/bug-report-20260707T140410Z.snap.svg +2 -2
  18. package/tests/bug-reports/bug-report-20260707T141025Z/__snapshots__/bug-report-20260707T141025Z.snap.svg +2 -2
  19. package/tests/bug-reports/bug-report-20260707T141421Z/__snapshots__/bug-report-20260707T141421Z.snap.svg +2 -2
  20. package/tests/bug-reports/bug-report-20260707T230831Z/__snapshots__/bug-report-20260707T230831Z.snap.svg +2 -2
  21. package/tests/bug-reports/bug-report-20260708T053736Z/__snapshots__/bug-report-20260708T053736Z.snap.svg +2 -2
  22. package/tests/bug-reports/bug-report-20260708T055430Z/__snapshots__/bug-report-20260708T055430Z.snap.svg +2 -2
  23. package/tests/bug-reports/bug-report-20260708T095725Z/__snapshots__/bug-report-20260708T095725Z.snap.svg +2 -2
  24. package/tests/bug-reports/bug-report-20260716T144856Z/__snapshots__/bug-report-20260716T144856Z.snap.svg +2 -2
  25. package/tests/bug-reports/bug-report-20260717T022934Z/__snapshots__/bug-report-20260717T022934Z.snap.svg +2 -2
  26. package/tests/bug-reports/bug-report-20260717T031704Z/__snapshots__/bug-report-20260717T031704Z.snap.svg +2 -2
  27. package/tests/bug-reports/bug-report-20260717T042845Z/__snapshots__/bug-report-20260717T042845Z.snap.svg +2 -2
  28. package/tests/bug-reports/bug-report-20260721T221026Z/__snapshots__/bug-report-20260721T221026Z.snap.svg +2 -2
  29. package/tests/bug-reports/bug-report-20260724T175257Z/__snapshots__/bug-report-20260724T175257Z.snap.svg +2 -2
  30. package/tests/bug-reports/bug-report-20260728T144234Z/__snapshots__/bug-report-20260728T144234Z.snap.svg +4 -4
  31. package/tests/bug-reports/bug-report-20260728T225606Z/__snapshots__/bug-report-20260728T225606Z.snap.svg +2 -2
  32. package/tests/bug-reports/bug-report-20260730T061837Z/__snapshots__/bug-report-20260730T061837Z.snap.svg +2 -2
  33. package/tests/bug-reports/bug-report-20260731T052229Z/__snapshots__/bug-report-20260731T052229Z.snap.svg +2 -2
  34. package/tests/bug-reports/bug-report-20260804T095800Z/__snapshots__/bug-report-20260804T095800Z.snap.svg +2 -2
  35. package/tests/bug-reports/bug-report-20260804T171919Z/__snapshots__/bug-report-20260804T171919Z.snap.svg +2 -2
  36. package/tests/bug-reports/bug-report-20260804T225912Z/__snapshots__/bug-report-20260804T225912Z.snap.svg +2 -2
  37. package/tests/bug-reports/bug-report-20260805T061316Z/__snapshots__/bug-report-20260805T061316Z.snap.svg +2 -2
  38. package/tests/bug-reports/bug-report-20260806T061548Z/__snapshots__/bug-report-20260806T061548Z.snap.svg +2 -2
  39. package/tests/bug-reports/bug-report-20260806T093501Z/__snapshots__/bug-report-20260806T093501Z.snap.svg +2 -2
  40. package/tests/bug-reports/bug-report-20260811T075142Z/__snapshots__/bug-report-20260811T075142Z.snap.svg +2 -2
  41. package/tests/bug-reports/bug-report-20260815T073240Z/__snapshots__/bug-report-20260815T073240Z.snap.svg +2 -2
  42. package/tests/bug-reports/bug-report-20260819T091818Z/__snapshots__/bug-report-20260819T091818Z.snap.svg +2 -2
  43. package/tests/bug-reports/bug-report-20260825T045913Z/__snapshots__/bug-report-20260825T045913Z.snap.svg +2 -2
  44. package/tests/bug-reports/bug-report-20260825T103621Z/__snapshots__/bug-report-20260825T103621Z.snap.svg +2 -2
  45. package/tests/bug-reports/bug-report-20260826T072956Z/__snapshots__/bug-report-20260826T072956Z.snap.svg +851 -0
  46. package/tests/bug-reports/bug-report-20260826T072956Z/bug-report-20260826T072956Z.json +2452 -0
  47. package/tests/bug-reports/bug-report-20260826T072956Z/bug-report-20260826T072956Z.test.ts +12 -0
  48. package/tests/examples/__snapshots__/example01.snap.svg +2 -2
  49. package/tests/examples/__snapshots__/example02.snap.svg +12 -12
  50. package/tests/examples/__snapshots__/example03.snap.svg +2 -2
  51. package/tests/examples/__snapshots__/example04.snap.svg +2 -2
  52. package/tests/examples/__snapshots__/example05.snap.svg +2 -2
  53. package/tests/examples/__snapshots__/example06.snap.svg +2 -2
  54. package/tests/examples/__snapshots__/example07.snap.svg +2 -2
  55. package/tests/examples/__snapshots__/example08.snap.svg +2 -2
  56. package/tests/examples/__snapshots__/example09.snap.svg +2 -2
  57. package/tests/examples/__snapshots__/example10.snap.svg +2 -2
  58. package/tests/examples/__snapshots__/example11.snap.svg +2 -2
  59. package/tests/examples/__snapshots__/example12.snap.svg +2 -2
  60. package/tests/examples/__snapshots__/example13.snap.svg +2 -2
  61. package/tests/examples/__snapshots__/example14.snap.svg +2 -2
  62. package/tests/examples/__snapshots__/example15.snap.svg +2 -2
  63. package/tests/examples/__snapshots__/example16.snap.svg +2 -2
  64. package/tests/examples/__snapshots__/example17.snap.svg +2 -2
  65. package/tests/examples/__snapshots__/example18.snap.svg +2 -2
  66. package/tests/examples/__snapshots__/example19.snap.svg +2 -2
  67. package/tests/examples/__snapshots__/example20.snap.svg +2 -2
  68. package/tests/examples/__snapshots__/example21.snap.svg +2 -2
  69. package/tests/examples/__snapshots__/example22.snap.svg +2 -2
  70. package/tests/examples/__snapshots__/example23.snap.svg +2 -2
  71. package/tests/examples/__snapshots__/example24.snap.svg +2 -2
  72. package/tests/examples/__snapshots__/example25.snap.svg +2 -2
  73. package/tests/examples/__snapshots__/example26.snap.svg +2 -2
  74. package/tests/examples/__snapshots__/example27.snap.svg +2 -2
  75. package/tests/examples/__snapshots__/example28.snap.svg +2 -2
  76. package/tests/examples/__snapshots__/example29.snap.svg +2 -2
  77. package/tests/examples/__snapshots__/example30.snap.svg +2 -2
  78. package/tests/examples/__snapshots__/example31.snap.svg +2 -2
  79. package/tests/examples/__snapshots__/example32.snap.svg +2 -2
  80. package/tests/examples/__snapshots__/example33.snap.svg +2 -2
  81. package/tests/examples/__snapshots__/example34.snap.svg +2 -2
  82. package/tests/examples/__snapshots__/example35.snap.svg +2 -2
  83. package/tests/examples/__snapshots__/example36.snap.svg +2 -2
  84. package/tests/examples/__snapshots__/example37.snap.svg +2 -2
  85. package/tests/examples/__snapshots__/example38.snap.svg +2 -2
  86. package/tests/examples/__snapshots__/example39.snap.svg +2 -2
  87. package/tests/examples/__snapshots__/example40.snap.svg +2 -2
  88. package/tests/examples/__snapshots__/example41.snap.svg +2 -2
  89. package/tests/examples/__snapshots__/example42.snap.svg +2 -2
  90. package/tests/examples/__snapshots__/example43.snap.svg +2 -2
  91. package/tests/examples/__snapshots__/example44.snap.svg +2 -2
  92. package/tests/examples/__snapshots__/example45.snap.svg +2 -2
  93. package/tests/examples/__snapshots__/example46.snap.svg +2 -2
  94. package/tests/examples/__snapshots__/example47.snap.svg +2 -2
  95. package/tests/examples/__snapshots__/example48.snap.svg +2 -2
  96. package/tests/examples/__snapshots__/example49.snap.svg +2 -2
  97. package/tests/examples/__snapshots__/example50.snap.svg +2 -2
  98. package/tests/examples/__snapshots__/example51.snap.svg +4 -4
  99. package/tests/fixtures/matcher.ts +3 -3
  100. package/tests/fixtures/parallel-ground-rail.ts +53 -0
  101. package/tests/repros/__snapshots__/board-1273-trace-overlap-cycle.snap.svg +4 -4
  102. package/tests/repros/__snapshots__/board-15984-same-net-junction.snap.svg +12 -12
  103. package/tests/repros/__snapshots__/board1096-usb-label-overlap-iteration.snap.svg +5 -5
  104. package/tests/repros/__snapshots__/bugreport-001-gnd-overlap.snap.svg +2 -2
  105. package/tests/repros/__snapshots__/manufacturePartNumber-text-box.snap.svg +2 -2
  106. package/tests/repros/__snapshots__/netlabel-connector-through-rail-label.snap.svg +2 -2
  107. package/tests/repros/__snapshots__/repro-atmega328p-fault-pullup.snap.svg +2 -2
  108. package/tests/repros/__snapshots__/repro-atmega328p-missing-gnd-netlabel.snap.svg +2 -2
  109. package/tests/repros/__snapshots__/repro-board-589-regulator-section.snap.svg +2 -2
  110. package/tests/repros/__snapshots__/repro-board-648-esp12f-section.snap.svg +2 -2
  111. package/tests/repros/__snapshots__/repro-bq24074-battery-charger.snap.svg +2 -2
  112. package/tests/repros/__snapshots__/repro-bq25895-cross-net-trace-overlap.snap.svg +2 -2
  113. package/tests/repros/__snapshots__/repro-cc2340r5.snap.svg +2 -2
  114. package/tests/repros/__snapshots__/repro-core-555-power-cross-net-overlap.snap.svg +2 -2
  115. package/tests/repros/__snapshots__/repro-core-subcircuit-missing-ground.snap.svg +2 -2
  116. package/tests/repros/__snapshots__/repro-core-tb67s579ftg-inline-label-routing.snap.svg +2 -2
  117. package/tests/repros/__snapshots__/repro-dc-power-isolated-routing.snap.svg +2 -2
  118. package/tests/repros/__snapshots__/repro-example35-minimize-trace-crossing.snap.svg +2 -2
  119. package/tests/repros/__snapshots__/repro-ground-label-on-lower-rail-end.snap.svg +2 -2
  120. package/tests/repros/__snapshots__/repro-ina237-current-monitor.snap.svg +2 -2
  121. package/tests/repros/__snapshots__/repro-missing-trace-netlabel.snap.svg +2 -2
  122. package/tests/repros/__snapshots__/repro-mspm0l1306-capacitor-symmetry.snap.svg +200 -0
  123. package/tests/repros/__snapshots__/repro-netlabel-collision-687.snap.svg +2 -2
  124. package/tests/repros/__snapshots__/repro-netlabel-overlap-trace.snap.svg +2 -2
  125. package/tests/repros/__snapshots__/repro-nrf52810-clock-routing.snap.svg +2 -2
  126. package/tests/repros/__snapshots__/repro-pga300-c6-trace-alignment.snap.svg +2 -2
  127. package/tests/repros/__snapshots__/repro-pga300-redundant-ground-traces.snap.svg +288 -0
  128. package/tests/repros/__snapshots__/repro-pmp11282-isolated-dcdc.snap.svg +4 -4
  129. package/tests/repros/__snapshots__/repro-power-group-rail-labels.snap.svg +2 -2
  130. package/tests/repros/__snapshots__/repro-rectifier-trace-overlap.snap.svg +2 -2
  131. package/tests/repros/__snapshots__/repro-rp2040-gamepad-trace-alignment.snap.svg +2 -2
  132. package/tests/repros/__snapshots__/repro-rp2040-usb-cc2-ground-overlap.snap.svg +2 -2
  133. package/tests/repros/__snapshots__/repro-rp2040-v3v3-label-placement.snap.svg +2 -2
  134. package/tests/repros/__snapshots__/repro-rp2040-zero-crystal-fallback-netlabels.snap.svg +2 -2
  135. package/tests/repros/__snapshots__/repro-ti-power-output-section.snap.svg +4 -4
  136. package/tests/repros/__snapshots__/repro-tida00553-j4-cell-divider.snap.svg +2 -2
  137. package/tests/repros/__snapshots__/repro-tida010076-j4-ground-bus.snap.svg +2 -2
  138. package/tests/repros/__snapshots__/repro-tida010076-page02.snap.svg +2 -2
  139. package/tests/repros/__snapshots__/repro-tps61222-trace-intersection.snap.svg +4 -4
  140. package/tests/repros/__snapshots__/repro-type-c-16pin-self-connection.snap.svg +2 -2
  141. package/tests/repros/__snapshots__/repro-type-c-16pin-to-resistor.snap.svg +2 -2
  142. package/tests/repros/__snapshots__/repro-type-c-vbus-led-ground-label.snap.svg +2 -2
  143. package/tests/repros/__snapshots__/repro-usb-power-vbus-label-detour.snap.svg +2 -2
  144. package/tests/repros/__snapshots__/repro-vcc-pin1-detour.snap.svg +2 -2
  145. package/tests/repros/__snapshots__/repro129-host-custom-symbol-passives.snap.svg +2 -2
  146. package/tests/repros/__snapshots__/repro130-bq27441-fuel-gauge-trace-through-c1.snap.svg +2 -2
  147. package/tests/repros/__snapshots__/repro161-power-section-autolayout.snap.svg +4 -4
  148. package/tests/repros/__snapshots__/repro47-endpoint-obstacle-detour.snap.svg +2 -2
  149. package/tests/repros/__snapshots__/repro48-555-timer-vcc-rail-label.snap.svg +2 -2
  150. package/tests/repros/__snapshots__/repro5-escape-padded-text-obstacles.snap.svg +2 -2
  151. package/tests/repros/__snapshots__/repro51-overlap-junction-crossing.snap.svg +2 -2
  152. package/tests/repros/__snapshots__/repro84-stacked-gnd-label-orientation.snap.svg +2 -2
  153. package/tests/repros/__snapshots__/small-variant-resistor-facing-direction.snap.svg +2 -2
  154. package/tests/repros/__snapshots__/trace-overlap-box-resistor.snap.svg +2 -2
  155. package/tests/repros/assets/repro-mspm0l1306-capacitor-symmetry.input.json +537 -0
  156. package/tests/repros/assets/repro-pga300-redundant-ground-traces.input.json +858 -0
  157. package/tests/repros/repro-mspm0l1306-capacitor-symmetry.test.ts +87 -0
  158. package/tests/repros/repro-pga300-redundant-ground-traces.test.ts +33 -0
  159. package/tests/solvers/InlineNetLabelSolver/__snapshots__/anchored-net-label-width.snap.svg +2 -2
  160. package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label-anchored-label-clearance.snap.svg +2 -2
  161. package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label-port-stub.snap.svg +2 -2
  162. package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label-two-pin-net.snap.svg +2 -2
  163. package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label01.snap.svg +2 -2
  164. package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label02.snap.svg +2 -2
  165. package/tests/solvers/InlineNetLabelSolver/__snapshots__/terminal-stub-trace-clearance.snap.svg +2 -2
  166. package/tests/solvers/MspConnectionPairSolver/local-ground-branches.test.ts +105 -0
  167. package/tests/solvers/SameNetJunctionAlignmentSolver/ground-rail-label.test.ts +188 -0
  168. package/tests/solvers/SameNetJunctionAlignmentSolver/parallel-load-rails.test.ts +291 -0
  169. package/tests/solvers/SchematicTraceSingleLineSolver2/__snapshots__/SchematicTraceSingleLineSolver2_01-example17-d1_1-u1_1.snap.svg +2 -2
  170. package/tests/solvers/SchematicTraceSingleLineSolver2/__snapshots__/SchematicTraceSingleLineSolver2_repro47-short-opposing-pins.snap.svg +2 -2
  171. package/tests/solvers/TraceCleanupSolver/__snapshots__/TraceCleanupSolver.snap.svg +2 -2
  172. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/__snapshots__/TraceLabelOverlapAvoidanceSolver.snap.svg +2 -2
  173. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/__snapshots__/MergedNetLabelObstacles.snap.svg +2 -2
  174. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/__snapshots__/OverlapAvoidanceStepSolver.snap.svg +2 -2
  175. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/__snapshots__/SingleOverlapSolver.snap.svg +2 -2
@@ -4,7 +4,7 @@ import type { BaseSolver } from "lib/solvers/BaseSolver/BaseSolver"
4
4
  import { colorAvailableNetOrientationLabels } from "lib/solvers/SchematicTracePipelineSolver/colorAvailableNetOrientationLabels"
5
5
  import type { InputProblem } from "lib/types/InputProblem"
6
6
  import { convertCircuitJsonToSchematicSvg } from "circuit-to-svg"
7
- import { stackSvgsHorizontally } from "stack-svgs"
7
+ import { stackSvgsVertically } from "stack-svgs"
8
8
  import {
9
9
  convertSolverOutputToCircuitJson,
10
10
  getInputProblemFromSolver,
@@ -72,14 +72,14 @@ async function toMatchSolverSnapshot(
72
72
  height: 800,
73
73
  }).replace(/[ \t]+$/gm, "")
74
74
  const legacySvg = getLegacySolverSvg(received, inputProblem)
75
- const svg = stackSvgsHorizontally([legacySvg, circuitJsonSvg], {
75
+ const svg = stackSvgsVertically([legacySvg, circuitJsonSvg], {
76
76
  gap: 16,
77
77
  normalizeSize: true,
78
78
  targetSize: 1200,
79
79
  rootAttributes: {
80
80
  role: "img",
81
81
  "aria-label":
82
- "Solver debug visualization on the left and Circuit JSON schematic on the right",
82
+ "Solver debug visualization on top and Circuit JSON schematic on the bottom",
83
83
  },
84
84
  })
85
85
 
@@ -0,0 +1,53 @@
1
+ import type { InputProblem } from "lib/types/InputProblem"
2
+
3
+ export const createParallelGroundRailProblem = (): InputProblem => ({
4
+ chips: [
5
+ ...[
6
+ ["A", 0, 1],
7
+ ["B", 1, 1],
8
+ ["C", 1, -2],
9
+ ["D", -1, -3.5],
10
+ ].map(([id, x, y]) => ({
11
+ chipId: String(id),
12
+ center: { x: Number(x), y: Number(y) + 0.4 },
13
+ width: 0.4,
14
+ height: 0.8,
15
+ pins: [
16
+ {
17
+ pinId: `${id}.1`,
18
+ x: Number(x),
19
+ y: Number(y) + 0.8,
20
+ _facingDirection: "y+" as const,
21
+ },
22
+ {
23
+ pinId: `${id}.2`,
24
+ x: Number(x),
25
+ y: Number(y),
26
+ _facingDirection: "y-" as const,
27
+ },
28
+ ],
29
+ })),
30
+ {
31
+ chipId: "U",
32
+ center: { x: 2.5, y: 1.5 },
33
+ width: 1,
34
+ height: 3,
35
+ pins: [
36
+ { pinId: "U.GND", x: 2, y: 0.6, _facingDirection: "x-" },
37
+ { pinId: "U.VIN", x: 2, y: 2, _facingDirection: "x-" },
38
+ { pinId: "U.IO", x: 2, y: 2.4, _facingDirection: "x-" },
39
+ ],
40
+ },
41
+ ],
42
+ directConnections: [{ pinIds: ["A.2", "B.2"] }, { pinIds: ["A.2", "U.GND"] }],
43
+ netConnections: [
44
+ {
45
+ netId: "GND",
46
+ pinIds: ["U.GND", "A.2", "B.2", "C.2", "D.2"],
47
+ netLabelWidth: 0.42,
48
+ netLabelHeight: 0.48,
49
+ },
50
+ ],
51
+ availableNetLabelOrientations: { GND: ["y-"] },
52
+ maxMspPairDistance: 6,
53
+ })