@tscircuit/schematic-trace-solver 0.0.159 → 0.0.161

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 (71) hide show
  1. package/dist/index.d.ts +43 -9
  2. package/dist/index.js +807 -115
  3. package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationSolver.ts +210 -6
  4. package/lib/solvers/InlineNetLabelSolver/InlineNetLabelSolver.ts +536 -94
  5. package/lib/solvers/InlineNetLabelSolver/pushAnchoredNetLabelsAwayFromInlineLabels.ts +9 -7
  6. package/lib/solvers/InlineNetLabelSolver/pushInlineTerminalLabelsAwayFromAnchoredLabels.ts +295 -0
  7. package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +7 -35
  8. package/lib/solvers/SchematicTraceLinesSolver/getTraceConnectedPinComponents.ts +60 -0
  9. package/lib/solvers/TraceCleanupSolver/sameNetRailAlignment/getFixedLabelCoordinate.ts +44 -13
  10. package/lib/types/InputProblem.ts +5 -4
  11. package/package.json +1 -1
  12. package/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg +1 -1
  13. package/tests/bug-reports/bug-report-20260728T144234Z/__snapshots__/bug-report-20260728T144234Z.snap.svg +1 -1
  14. package/tests/bug-reports/bug-report-20260728T225606Z/__snapshots__/bug-report-20260728T225606Z.snap.svg +79 -79
  15. package/tests/bug-reports/bug-report-20260730T061837Z/__snapshots__/bug-report-20260730T061837Z.snap.svg +85 -85
  16. package/tests/bug-reports/bug-report-20260731T052229Z/__snapshots__/bug-report-20260731T052229Z.snap.svg +1 -1
  17. package/tests/bug-reports/bug-report-20260804T095800Z/__snapshots__/bug-report-20260804T095800Z.snap.svg +163 -163
  18. package/tests/bug-reports/bug-report-20260804T171919Z/__snapshots__/bug-report-20260804T171919Z.snap.svg +547 -547
  19. package/tests/bug-reports/bug-report-20260804T225912Z/__snapshots__/bug-report-20260804T225912Z.snap.svg +13 -13
  20. package/tests/bug-reports/bug-report-20260805T061316Z/__snapshots__/bug-report-20260805T061316Z.snap.svg +267 -267
  21. package/tests/bug-reports/bug-report-20260806T061548Z/__snapshots__/bug-report-20260806T061548Z.snap.svg +267 -267
  22. package/tests/bug-reports/bug-report-20260806T093501Z/__snapshots__/bug-report-20260806T093501Z.snap.svg +109 -109
  23. package/tests/bug-reports/bug-report-20260811T075142Z/__snapshots__/bug-report-20260811T075142Z.snap.svg +1 -1
  24. package/tests/bug-reports/bug-report-20260815T073240Z/__snapshots__/bug-report-20260815T073240Z.snap.svg +49 -49
  25. package/tests/bug-reports/bug-report-20260819T091818Z/__snapshots__/bug-report-20260819T091818Z.snap.svg +1 -1
  26. package/tests/bug-reports/bug-report-20260825T045913Z/__snapshots__/bug-report-20260825T045913Z.snap.svg +103 -103
  27. package/tests/bug-reports/bug-report-20260825T103621Z/__snapshots__/bug-report-20260825T103621Z.snap.svg +103 -103
  28. package/tests/bug-reports/bug-report-20260826T072956Z/__snapshots__/bug-report-20260826T072956Z.snap.svg +600 -792
  29. package/tests/bug-reports/bug-report-20260826T072956Z/bug-report-20260826T072956Z.test.ts +66 -1
  30. package/tests/examples/__snapshots__/example51.snap.svg +568 -568
  31. package/tests/fixtures/convertSolverOutputToCircuitJson.test.ts +16 -1
  32. package/tests/fixtures/convertSolverOutputToCircuitJson.ts +23 -12
  33. package/tests/repros/__snapshots__/board-1273-trace-overlap-cycle.snap.svg +736 -736
  34. package/tests/repros/__snapshots__/board-15984-same-net-junction.snap.svg +79 -79
  35. package/tests/repros/__snapshots__/board1096-usb-label-overlap-iteration.snap.svg +127 -127
  36. package/tests/repros/__snapshots__/repro-bluetooth-controller-ground-decoupling-groups.snap.svg +106 -0
  37. package/tests/repros/__snapshots__/repro-board-589-regulator-section.snap.svg +31 -31
  38. package/tests/repros/__snapshots__/repro-board-648-esp12f-section.snap.svg +121 -121
  39. package/tests/repros/__snapshots__/repro-bq25895-cross-net-trace-overlap.snap.svg +43 -43
  40. package/tests/repros/__snapshots__/repro-core-555-power-cross-net-overlap.snap.svg +19 -19
  41. package/tests/repros/__snapshots__/repro-core-ground-inline-label-fallback.snap.svg +277 -0
  42. package/tests/repros/__snapshots__/repro-core-subcircuit-missing-ground.snap.svg +19 -19
  43. package/tests/repros/__snapshots__/repro-core-tb67s579ftg-inline-label-routing.snap.svg +7 -7
  44. package/tests/repros/__snapshots__/repro-dc-power-isolated-routing.snap.svg +37 -37
  45. package/tests/repros/__snapshots__/repro-hdc2080-ground-label-alignment.snap.svg +137 -0
  46. package/tests/repros/__snapshots__/repro-nrf52810-clock-routing.snap.svg +61 -61
  47. package/tests/repros/__snapshots__/repro-pga300-redundant-ground-traces.snap.svg +115 -115
  48. package/tests/repros/__snapshots__/repro-pmp11282-isolated-dcdc.snap.svg +743 -743
  49. package/tests/repros/__snapshots__/repro-rp2040-usb-cc2-ground-overlap.snap.svg +43 -43
  50. package/tests/repros/__snapshots__/repro-ti-power-output-section.snap.svg +1 -1
  51. package/tests/repros/__snapshots__/repro-tida010076-j4-ground-bus.snap.svg +17 -17
  52. package/tests/repros/__snapshots__/repro-tida010076-page02.snap.svg +1131 -1131
  53. package/tests/repros/__snapshots__/repro-type-c-16pin-self-connection.snap.svg +7 -7
  54. package/tests/repros/__snapshots__/repro-type-c-16pin-to-resistor.snap.svg +7 -7
  55. package/tests/repros/__snapshots__/repro-usb-power-vbus-label-detour.snap.svg +666 -666
  56. package/tests/repros/__snapshots__/repro161-power-section-autolayout.snap.svg +73 -73
  57. package/tests/repros/__snapshots__/repro48-555-timer-vcc-rail-label.snap.svg +73 -73
  58. package/tests/repros/assets/repro-bluetooth-controller-ground-decoupling-groups.input.json +214 -0
  59. package/tests/repros/assets/repro-core-ground-inline-label-fallback.input.json +863 -0
  60. package/tests/repros/repro-bluetooth-controller-ground-decoupling-groups.test.ts +18 -0
  61. package/tests/repros/repro-core-ground-inline-label-fallback.test.ts +34 -0
  62. package/tests/repros/repro-hdc2080-ground-label-alignment.test.ts +239 -0
  63. package/tests/repros/repro-tida010076-j4-ground-bus.test.ts +14 -10
  64. package/tests/repros/repro-tida010076-page02.test.ts +2 -2
  65. package/tests/repros/repro-usb-power-vbus-label-detour.test.ts +14 -0
  66. package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label02.snap.svg +1 -1
  67. package/tests/solvers/InlineNetLabelSolver/multi-pin-connected-components.test.ts +252 -0
  68. package/tests/solvers/InlineNetLabelSolver/opposite-side-placement.test.ts +71 -0
  69. package/tests/solvers/InlineNetLabelSolver/push-anchored-net-labels-away.test.ts +8 -2
  70. package/tests/solvers/InlineNetLabelSolver/push-inline-terminal-labels-away.test.ts +91 -0
  71. package/tests/solvers/InlineNetLabelSolver/two-pin-terminal-stubs-atomic.test.ts +7 -1
@@ -1,12 +1,77 @@
1
1
  import { expect, test } from "bun:test"
2
+ import { estimateInlineNetLabelWidth } from "lib/solvers/InlineNetLabelSolver/InlineNetLabelSolver"
2
3
  import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
4
+ import type { InputProblem } from "lib/types/InputProblem"
3
5
  import inputProblem from "./bug-report-20260826T072956Z.json"
4
6
  import "tests/fixtures/matcher"
5
7
 
8
+ const multiPinSignalNetIds = [
9
+ "ISNS_A",
10
+ "ISNS_B",
11
+ "ISNS_C",
12
+ "MOT_A",
13
+ "MOT_B",
14
+ "MOT_C",
15
+ "S1_N",
16
+ "S1_P",
17
+ "S2_N",
18
+ "S2_P",
19
+ "S3_N",
20
+ "S3_P",
21
+ "SL_A",
22
+ "SL_B",
23
+ "SL_C",
24
+ ]
25
+
6
26
  test("bug-report-20260826T072956Z", () => {
7
- const solver = new SchematicTracePipelineSolver(inputProblem as any)
27
+ const problem = structuredClone(inputProblem) as unknown as InputProblem
28
+ for (const connection of problem.netConnections) {
29
+ if (!multiPinSignalNetIds.includes(connection.netId)) continue
30
+ connection.allowInlineNetLabel = true
31
+ connection.inlineNetLabelHeight = 0.12
32
+ connection.inlineNetLabelWidth = estimateInlineNetLabelWidth(
33
+ connection.netId,
34
+ connection.inlineNetLabelHeight,
35
+ )
36
+ }
37
+
38
+ const solver = new SchematicTracePipelineSolver(problem, {
39
+ hideRatsNet: true,
40
+ })
8
41
 
9
42
  solver.solve()
10
43
 
44
+ const output = solver.inlineNetLabelSolver!.getOutput()
45
+ const expectedInlineNetIds = ["GH_B", ...multiPinSignalNetIds]
46
+ expect(
47
+ new Set(
48
+ output.inlineNetLabelPlacements
49
+ .filter((placement) =>
50
+ expectedInlineNetIds.includes(placement.netId ?? ""),
51
+ )
52
+ .map((placement) => placement.netId),
53
+ ),
54
+ ).toEqual(new Set(expectedInlineNetIds))
55
+ expect(
56
+ output.netLabelPlacements.filter((placement) =>
57
+ expectedInlineNetIds.includes(placement.netId ?? ""),
58
+ ),
59
+ ).toHaveLength(0)
60
+ expect(
61
+ output.inlineNetLabelPlacements.some(
62
+ (placement) => placement.netId === "GH_B" && placement.side === "y-",
63
+ ),
64
+ ).toBe(true)
65
+ for (const supersededConnectorTraceId of [
66
+ "schematic_port_152-schematic_port_150",
67
+ "schematic_port_151-schematic_port_148",
68
+ "schematic_port_149-schematic_port_147",
69
+ ]) {
70
+ expect(
71
+ output.traces.some(
72
+ (trace) => trace.mspPairId === supersededConnectorTraceId,
73
+ ),
74
+ ).toBe(false)
75
+ }
11
76
  expect(solver).toMatchSolverSnapshot(import.meta.path)
12
77
  })