@tscircuit/schematic-trace-solver 0.0.91 → 0.0.93

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 (22) hide show
  1. package/dist/index.d.ts +7 -1
  2. package/dist/index.js +150 -21
  3. package/lib/solvers/Example28Solver/doesPathRunAlongChipBoundary.ts +18 -0
  4. package/lib/solvers/Example28Solver/reroute.ts +29 -10
  5. package/lib/solvers/Example28Solver/types.ts +7 -0
  6. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2.ts +35 -23
  7. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/calculateDirectShortPath.ts +161 -0
  8. package/package.json +1 -1
  9. package/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg +4 -6
  10. package/tests/bug-reports/bug-report-20260707T230831Z/__snapshots__/bug-report-20260707T230831Z.snap.svg +46 -52
  11. package/tests/examples/__snapshots__/example03.snap.svg +44 -44
  12. package/tests/examples/__snapshots__/example32.snap.svg +3 -3
  13. package/tests/examples/__snapshots__/example42.snap.svg +1 -1
  14. package/tests/repros/__snapshots__/repro-missing-trace-netlabel.snap.svg +60 -0
  15. package/tests/repros/__snapshots__/repro-netlabel-overlap-trace.snap.svg +60 -0
  16. package/tests/repros/__snapshots__/repro-rectifier-trace-overlap.snap.svg +58 -0
  17. package/tests/repros/assets/repro-missing-trace-netlabel.input.json +155 -0
  18. package/tests/repros/assets/repro-netlabel-overlap-trace.input.json +115 -0
  19. package/tests/repros/assets/repro-rectifier-trace-overlap.input.json +137 -0
  20. package/tests/repros/repro-missing-trace-netlabel.test.ts +14 -0
  21. package/tests/repros/repro-netlabel-overlap-trace.test.ts +14 -0
  22. package/tests/repros/repro-rectifier-trace-overlap.test.ts +14 -0
@@ -0,0 +1,137 @@
1
+ {
2
+ "chips": [
3
+ {
4
+ "chipId": "schematic_component_0",
5
+ "center": {
6
+ "x": 0,
7
+ "y": 0
8
+ },
9
+ "width": 1.08,
10
+ "height": 0.818910699999999,
11
+ "pins": [
12
+ {
13
+ "pinId": "V1.1",
14
+ "x": -0.54,
15
+ "y": -0.0050000000000000044,
16
+ "_facingDirection": "x-"
17
+ },
18
+ {
19
+ "pinId": "V1.2",
20
+ "x": 0.54,
21
+ "y": 0.0049999999999999975,
22
+ "_facingDirection": "x+"
23
+ }
24
+ ]
25
+ },
26
+ {
27
+ "chipId": "schematic_component_1",
28
+ "center": {
29
+ "x": 0.019999999999999796,
30
+ "y": 1.4194553499999993
31
+ },
32
+ "width": 1.04,
33
+ "height": 0.6799999999999999,
34
+ "pins": [
35
+ {
36
+ "pinId": "D1.1",
37
+ "x": -0.5000000000000002,
38
+ "y": 1.3494553499999995,
39
+ "_facingDirection": "x-"
40
+ },
41
+ {
42
+ "pinId": "D1.2",
43
+ "x": 0.5399999999999998,
44
+ "y": 1.3494553499999995,
45
+ "_facingDirection": "x+"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "chipId": "schematic_component_2",
51
+ "center": {
52
+ "x": 2.8400000000000003,
53
+ "y": 0.004999999999999449
54
+ },
55
+ "width": 0.5999999999999996,
56
+ "height": 0.6799999999999999,
57
+ "pins": [
58
+ {
59
+ "pinId": "R1.1",
60
+ "x": 3.14,
61
+ "y": 0.004999999999999413,
62
+ "_facingDirection": "x+"
63
+ },
64
+ {
65
+ "pinId": "R1.2",
66
+ "x": 2.5400000000000005,
67
+ "y": 0.004999999999999486,
68
+ "_facingDirection": "x-"
69
+ }
70
+ ]
71
+ },
72
+ {
73
+ "chipId": "schematic_component_3",
74
+ "center": {
75
+ "x": 1.54,
76
+ "y": 0.004999999999999893
77
+ },
78
+ "width": 0.6000000000000001,
79
+ "height": 0.84,
80
+ "pins": [
81
+ {
82
+ "pinId": "C1.1",
83
+ "x": 1.84,
84
+ "y": 0.004999999999999857,
85
+ "_facingDirection": "x+"
86
+ },
87
+ {
88
+ "pinId": "C1.2",
89
+ "x": 1.24,
90
+ "y": 0.00499999999999993,
91
+ "_facingDirection": "x-"
92
+ }
93
+ ]
94
+ }
95
+ ],
96
+ "directConnections": [
97
+ {
98
+ "pinIds": [
99
+ "V1.1",
100
+ "D1.1"
101
+ ],
102
+ "netId": ".V1 > .pin1 to .D1 > .anode"
103
+ },
104
+ {
105
+ "pinIds": [
106
+ "D1.2",
107
+ "R1.1"
108
+ ],
109
+ "netId": ".D1 > .cathode to .R1 > .pin1"
110
+ },
111
+ {
112
+ "pinIds": [
113
+ "D1.2",
114
+ "C1.1"
115
+ ],
116
+ "netId": ".D1 > .cathode to .C1 > .pin1"
117
+ },
118
+ {
119
+ "pinIds": [
120
+ "V1.2",
121
+ "R1.2"
122
+ ],
123
+ "netId": ".V1 > .pin2 to .R1 > .pin2"
124
+ },
125
+ {
126
+ "pinIds": [
127
+ "V1.2",
128
+ "C1.2"
129
+ ],
130
+ "netId": ".V1 > .pin2 to .C1 > .pin2"
131
+ }
132
+ ],
133
+ "netConnections": [],
134
+ "textBoxes": [],
135
+ "availableNetLabelOrientations": {},
136
+ "maxMspPairDistance": 10
137
+ }
@@ -0,0 +1,14 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import inputProblem from "./assets/repro-missing-trace-netlabel.input.json"
4
+ import "tests/fixtures/matcher"
5
+
6
+ // Regression (from @tscircuit/core repro148): the RESET connection between R3 and
7
+ // SW2 used to route as a trace but now falls back to two net labels.
8
+ test("repro148 missing trace becomes net labels", () => {
9
+ const solver = new SchematicTracePipelineSolver(inputProblem as any)
10
+
11
+ solver.solve()
12
+
13
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
14
+ })
@@ -0,0 +1,14 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import inputProblem from "./assets/repro-netlabel-overlap-trace.input.json"
4
+ import "tests/fixtures/matcher"
5
+
6
+ // Regression (from @tscircuit/core repro147): a GND net label ends up overlapping
7
+ // the B1/SW1 junction trace instead of being placed clear of it.
8
+ test("repro147 netlabel overlaps trace", () => {
9
+ const solver = new SchematicTracePipelineSolver(inputProblem as any)
10
+
11
+ solver.solve()
12
+
13
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
14
+ })
@@ -0,0 +1,14 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import inputProblem from "./assets/repro-rectifier-trace-overlap.input.json"
4
+ import "tests/fixtures/matcher"
5
+
6
+ // Regression (from @tscircuit/core half-bridge-rectifier): the R1->C1 connection
7
+ // used to be a simple direct trace but now detours and overlaps another trace.
8
+ test("repro149 rectifier trace overlap", () => {
9
+ const solver = new SchematicTracePipelineSolver(inputProblem as any)
10
+
11
+ solver.solve()
12
+
13
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
14
+ })