@tscircuit/schematic-trace-solver 0.0.180 → 0.0.182
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 +31 -10
- package/lib/solvers/InlineNetLabelSolver/pushAnchoredNetLabelsAwayFromInlineLabels.ts +10 -0
- package/lib/solvers/SameNetJunctionAlignmentSolver/alignSameNetJunctions.ts +29 -11
- package/package.json +1 -1
- package/tests/bug-reports/bug-report-20260706T213649Z/__snapshots__/bug-report-20260706T213649Z.snap.svg +2 -114
- package/tests/bug-reports/bug-report-20260706T213649Z/bug-report-20260706T213649Z.json +1 -0
- package/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg +3 -94
- package/tests/bug-reports/bug-report-20260706T220324Z/bug-report-20260706T220324Z.json +1 -0
- package/tests/bug-reports/bug-report-20260707T092615Z/__snapshots__/bug-report-20260707T092615Z.snap.svg +533 -578
- package/tests/bug-reports/bug-report-20260707T092615Z/bug-report-20260707T092615Z.json +1 -0
- package/tests/bug-reports/bug-report-20260707T134549Z/__snapshots__/bug-report-20260707T134549Z.snap.svg +2 -37
- package/tests/bug-reports/bug-report-20260707T134549Z/bug-report-20260707T134549Z.json +1 -0
- package/tests/bug-reports/bug-report-20260707T134722Z/__snapshots__/bug-report-20260707T134722Z.snap.svg +4 -25
- package/tests/bug-reports/bug-report-20260707T134722Z/bug-report-20260707T134722Z.json +1 -0
- package/tests/bug-reports/bug-report-20260707T140410Z/__snapshots__/bug-report-20260707T140410Z.snap.svg +1 -50
- package/tests/bug-reports/bug-report-20260707T140410Z/bug-report-20260707T140410Z.json +1 -0
- package/tests/bug-reports/bug-report-20260707T141025Z/__snapshots__/bug-report-20260707T141025Z.snap.svg +1 -15
- package/tests/bug-reports/bug-report-20260707T141025Z/bug-report-20260707T141025Z.json +1 -0
- package/tests/bug-reports/bug-report-20260707T141421Z/__snapshots__/bug-report-20260707T141421Z.snap.svg +5 -33
- package/tests/bug-reports/bug-report-20260707T141421Z/bug-report-20260707T141421Z.json +1 -0
- package/tests/bug-reports/bug-report-20260707T230831Z/__snapshots__/bug-report-20260707T230831Z.snap.svg +1 -15
- package/tests/bug-reports/bug-report-20260707T230831Z/bug-report-20260707T230831Z.json +1 -0
- package/tests/bug-reports/bug-report-20260708T055430Z/__snapshots__/bug-report-20260708T055430Z.snap.svg +65 -79
- package/tests/bug-reports/bug-report-20260708T055430Z/bug-report-20260708T055430Z.json +1 -0
- package/tests/bug-reports/bug-report-20260708T095725Z/__snapshots__/bug-report-20260708T095725Z.snap.svg +1 -15
- package/tests/bug-reports/bug-report-20260708T095725Z/bug-report-20260708T095725Z.json +1 -0
- package/tests/bug-reports/bug-report-20260716T144856Z/__snapshots__/bug-report-20260716T144856Z.snap.svg +1 -43
- package/tests/bug-reports/bug-report-20260716T144856Z/bug-report-20260716T144856Z.json +1 -0
- package/tests/bug-reports/bug-report-20260717T022934Z/__snapshots__/bug-report-20260717T022934Z.snap.svg +2 -30
- package/tests/bug-reports/bug-report-20260717T022934Z/bug-report-20260717T022934Z.json +1 -0
- package/tests/bug-reports/bug-report-20260717T031704Z/__snapshots__/bug-report-20260717T031704Z.snap.svg +1 -8
- package/tests/bug-reports/bug-report-20260717T031704Z/bug-report-20260717T031704Z.json +1 -0
- package/tests/bug-reports/bug-report-20260721T221026Z/__snapshots__/bug-report-20260721T221026Z.snap.svg +1 -92
- package/tests/bug-reports/bug-report-20260721T221026Z/bug-report-20260721T221026Z.json +1 -0
- package/tests/bug-reports/bug-report-20260728T144234Z/__snapshots__/bug-report-20260728T144234Z.snap.svg +1 -29
- package/tests/bug-reports/bug-report-20260728T144234Z/bug-report-20260728T144234Z.json +1 -0
- package/tests/bug-reports/bug-report-20260728T225606Z/__snapshots__/bug-report-20260728T225606Z.snap.svg +1 -22
- package/tests/bug-reports/bug-report-20260728T225606Z/bug-report-20260728T225606Z.json +1 -0
- package/tests/bug-reports/bug-report-20260730T061837Z/__snapshots__/bug-report-20260730T061837Z.snap.svg +1 -8
- package/tests/bug-reports/bug-report-20260730T061837Z/bug-report-20260730T061837Z.json +1 -0
- package/tests/bug-reports/bug-report-20260804T095800Z/__snapshots__/bug-report-20260804T095800Z.snap.svg +1 -36
- package/tests/bug-reports/bug-report-20260804T095800Z/bug-report-20260804T095800Z.json +1 -0
- package/tests/bug-reports/bug-report-20260804T171919Z/__snapshots__/bug-report-20260804T171919Z.snap.svg +2 -121
- package/tests/bug-reports/bug-report-20260804T171919Z/bug-report-20260804T171919Z.json +1 -0
- package/tests/bug-reports/bug-report-20260804T225912Z/__snapshots__/bug-report-20260804T225912Z.snap.svg +1 -8
- package/tests/bug-reports/bug-report-20260804T225912Z/bug-report-20260804T225912Z.json +1 -0
- package/tests/bug-reports/bug-report-20260805T061316Z/__snapshots__/bug-report-20260805T061316Z.snap.svg +1 -15
- package/tests/bug-reports/bug-report-20260805T061316Z/bug-report-20260805T061316Z.json +1 -0
- package/tests/bug-reports/bug-report-20260806T061548Z/__snapshots__/bug-report-20260806T061548Z.snap.svg +1 -15
- package/tests/bug-reports/bug-report-20260806T061548Z/bug-report-20260806T061548Z.json +1 -0
- package/tests/bug-reports/bug-report-20260806T093501Z/__snapshots__/bug-report-20260806T093501Z.snap.svg +1 -22
- package/tests/bug-reports/bug-report-20260806T093501Z/bug-report-20260806T093501Z.json +1 -0
- package/tests/bug-reports/bug-report-20260811T075142Z/__snapshots__/bug-report-20260811T075142Z.snap.svg +1 -8
- package/tests/bug-reports/bug-report-20260811T075142Z/bug-report-20260811T075142Z.json +1 -0
- package/tests/bug-reports/bug-report-20260815T073240Z/__snapshots__/bug-report-20260815T073240Z.snap.svg +1 -22
- package/tests/bug-reports/bug-report-20260815T073240Z/bug-report-20260815T073240Z.json +1 -0
- package/tests/bug-reports/bug-report-20260819T091818Z/__snapshots__/bug-report-20260819T091818Z.snap.svg +1 -15
- package/tests/bug-reports/bug-report-20260819T091818Z/bug-report-20260819T091818Z.json +1 -0
- package/tests/bug-reports/bug-report-20260825T103621Z/__snapshots__/bug-report-20260825T103621Z.snap.svg +1 -29
- package/tests/bug-reports/bug-report-20260825T103621Z/bug-report-20260825T103621Z.json +1 -0
- package/tests/bug-reports/bug-report-20260826T072956Z/__snapshots__/bug-report-20260826T072956Z.snap.svg +31 -95
- package/tests/bug-reports/bug-report-20260826T072956Z/bug-report-20260826T072956Z.json +1 -0
- package/tests/bug-reports/bug-report-20260901T055358Z/__snapshots__/bug-report-20260901T055358Z.snap.svg +10 -10
- package/tests/repros/__snapshots__/board-1273-trace-overlap-cycle.snap.svg +1 -113
- package/tests/repros/__snapshots__/board-15984-same-net-junction.snap.svg +1 -29
- package/tests/repros/__snapshots__/board1096-usb-label-overlap-iteration.snap.svg +64 -56
- package/tests/repros/__snapshots__/bugreport-001-gnd-overlap.snap.svg +1 -15
- package/tests/repros/__snapshots__/netlabel-connector-through-rail-label.snap.svg +1 -22
- package/tests/repros/__snapshots__/repro-atmega328p-missing-gnd-netlabel.snap.svg +185 -186
- package/tests/repros/__snapshots__/repro-board-589-regulator-section.snap.svg +1 -15
- package/tests/repros/__snapshots__/repro-board-648-esp12f-section.snap.svg +1 -15
- package/tests/repros/__snapshots__/repro-board-8090-power-section.snap.svg +126 -0
- package/tests/repros/__snapshots__/repro-bq24074-battery-charger.snap.svg +1 -29
- package/tests/repros/__snapshots__/repro-bq25895-cross-net-trace-overlap.snap.svg +1 -8
- package/tests/repros/__snapshots__/repro-cc2340r5.snap.svg +1 -15
- package/tests/repros/__snapshots__/repro-core-tb67s579ftg-inline-label-routing.snap.svg +181 -181
- package/tests/repros/__snapshots__/repro-example35-minimize-trace-crossing.snap.svg +1 -8
- package/tests/repros/__snapshots__/repro-ina237-current-monitor.snap.svg +1 -22
- package/tests/repros/__snapshots__/repro-isolated-rs485-isow7841.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-mcp73831-charger-traces.snap.svg +131 -0
- package/tests/repros/__snapshots__/repro-missing-trace-netlabel.snap.svg +1 -15
- package/tests/repros/__snapshots__/repro-mouse-switch-ground-unnecessary-jog.snap.svg +83 -0
- package/tests/repros/__snapshots__/repro-mspm0l1306-capacitor-symmetry.snap.svg +1 -29
- package/tests/repros/__snapshots__/repro-netlabel-overlap-trace.snap.svg +1 -8
- package/tests/repros/__snapshots__/repro-nrf52810-clock-routing.snap.svg +1 -29
- package/tests/repros/__snapshots__/repro-pmp11282-isolated-dcdc.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-powerbank-3v-system-power.snap.svg +1 -29
- package/tests/repros/__snapshots__/repro-rf1-unnecessary-dogleg.snap.svg +72 -0
- package/tests/repros/__snapshots__/repro-rp2040-gamepad-trace-alignment.snap.svg +1 -8
- package/tests/repros/__snapshots__/repro-rp2040-usb-cc2-ground-overlap.snap.svg +1 -8
- package/tests/repros/__snapshots__/repro-tps61222-trace-intersection.snap.svg +1 -8
- package/tests/repros/__snapshots__/repro-usb-power-vbus-label-detour.snap.svg +991 -1091
- package/tests/repros/__snapshots__/repro130-bq27441-fuel-gauge-trace-through-c1.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro161-power-section-autolayout.snap.svg +1 -15
- package/tests/repros/__snapshots__/repro48-555-timer-vcc-rail-label.snap.svg +1 -22
- package/tests/repros/__snapshots__/repro51-overlap-junction-crossing.snap.svg +1 -15
- package/tests/repros/__snapshots__/small-variant-resistor-facing-direction.snap.svg +65 -79
- package/tests/repros/__snapshots__/trace-overlap-box-resistor.snap.svg +1 -8
- package/tests/repros/assets/board-1273-trace-overlap-cycle.input.json +1 -0
- package/tests/repros/assets/board-15984-schematic-trace-input.json +1 -0
- package/tests/repros/assets/bugreport-001-gnd-overlap.input.json +1 -0
- package/tests/repros/assets/repro-atmega328p-fault-pullup.input.json +1 -0
- package/tests/repros/assets/repro-atmega328p-missing-gnd-netlabel.input.json +1 -0
- package/tests/repros/assets/repro-board-589-regulator-section.input.json +1 -0
- package/tests/repros/assets/repro-board-648-esp12f-section.input.json +1 -0
- package/tests/repros/assets/repro-board-8090-power-section.input.json +322 -0
- package/tests/repros/assets/repro-bq24074-battery-charger.input.json +1 -0
- package/tests/repros/assets/repro-bq25895-cross-net-trace-overlap.input.json +1 -0
- package/tests/repros/assets/repro-cc2340r5.input.json +1 -0
- package/tests/repros/assets/repro-example35-minimize-trace-crossing.input.json +1 -0
- package/tests/repros/assets/repro-ina237-current-monitor.input.json +1 -0
- package/tests/repros/assets/repro-mcp73831-charger-traces.input.json +256 -0
- package/tests/repros/assets/repro-missing-trace-netlabel.input.json +1 -0
- package/tests/repros/assets/repro-mouse-switch-ground-unnecessary-jog.input.json +158 -0
- package/tests/repros/assets/repro-mspm0l1306-capacitor-symmetry.input.json +1 -0
- package/tests/repros/assets/repro-netlabel-connector-through-label.input.json +1 -0
- package/tests/repros/assets/repro-netlabel-overlap-trace.input.json +1 -0
- package/tests/repros/assets/repro-nrf52810-clock-routing.input.json +1 -0
- package/tests/repros/assets/repro-powerbank-3v-system-power.input.json +1 -0
- package/tests/repros/assets/repro-rf1-unnecessary-dogleg.input.json +90 -0
- package/tests/repros/assets/repro-rp2040-gamepad-trace-alignment.input.json +1 -0
- package/tests/repros/assets/repro-rp2040-usb-cc2-ground-overlap.input.json +1 -0
- package/tests/repros/assets/repro-tps61222-trace-intersection.input.json +1 -0
- package/tests/repros/assets/repro-usb-power-vbus-label-detour.input.json +1 -0
- package/tests/repros/assets/repro126-trace-overlap-box-resistor.input.json +1 -0
- package/tests/repros/assets/repro161-power-section-autolayout.input.json +1 -0
- package/tests/repros/assets/repro48-555-timer-vcc-rail-label.input.json +1 -0
- package/tests/repros/assets/repro51-overlap-junction-crossing.input.json +1 -0
- package/tests/repros/assets/small-variant-resistor-facing-direction.input.json +1 -0
- package/tests/repros/board1096-usb-label-overlap-iteration.json +1 -0
- package/tests/repros/board1096-usb-label-overlap-iteration.test.ts +1 -1
- package/tests/repros/repro-board-8090-power-section.test.ts +18 -0
- package/tests/repros/repro-mcp73831-charger-traces.test.ts +16 -0
- package/tests/repros/repro-mouse-switch-ground-unnecessary-jog.test.ts +15 -0
- package/tests/repros/repro-rf1-unnecessary-dogleg.test.ts +15 -0
- package/tests/solvers/InlineNetLabelSolver/push-anchored-net-labels-away.test.ts +62 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import "tests/fixtures/matcher"
|
|
4
|
+
import inputProblem from "./assets/repro-mcp73831-charger-traces.input.json"
|
|
5
|
+
|
|
6
|
+
// Captured from @tscircuit/core 0.0.1829 at commit b761dc8.
|
|
7
|
+
// The source circuit contains only the MCP73831 charger, its programming and
|
|
8
|
+
// LED resistors, VBAT capacitor, and LED. This preserves the long CHG_STAT path
|
|
9
|
+
// needed to reproduce the VBAT label crossing it.
|
|
10
|
+
test("repro VBAT label crossing the MCP73831 CHG_STAT trace", () => {
|
|
11
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
12
|
+
|
|
13
|
+
solver.solve()
|
|
14
|
+
|
|
15
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
16
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import "tests/fixtures/matcher"
|
|
4
|
+
import inputProblem from "./assets/repro-mouse-switch-ground-unnecessary-jog.input.json"
|
|
5
|
+
|
|
6
|
+
// Captured from @tscircuit/core 0.0.1829 at commit b761dc8.
|
|
7
|
+
// The GND route should use one straight vertical trunk between its terminal
|
|
8
|
+
// stubs instead of adding the unnecessary horizontal step near the midpoint.
|
|
9
|
+
test("repro unnecessary jog in mouse switch ground trunk", () => {
|
|
10
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
11
|
+
|
|
12
|
+
solver.solve()
|
|
13
|
+
|
|
14
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
15
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import "tests/fixtures/matcher"
|
|
4
|
+
import inputProblem from "./assets/repro-rf1-unnecessary-dogleg.input.json"
|
|
5
|
+
|
|
6
|
+
// Captured from @tscircuit/core 0.0.1829 at commit b761dc8.
|
|
7
|
+
// The nearly level RF1 endpoints should produce an effectively straight trace,
|
|
8
|
+
// rather than a clearance-sized dogleg between the two inductors.
|
|
9
|
+
test("repro RF1 unnecessary dogleg between aligned inductors", () => {
|
|
10
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
11
|
+
|
|
12
|
+
solver.solve()
|
|
13
|
+
|
|
14
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
15
|
+
})
|
|
@@ -126,6 +126,68 @@ test("leaves a label without a movable connector in place", () => {
|
|
|
126
126
|
expect(output.netLabelPlacements[0]).toEqual(label)
|
|
127
127
|
})
|
|
128
128
|
|
|
129
|
+
test("leaves a label in place when its new connector would cross another net", () => {
|
|
130
|
+
const inputProblem: InputProblem = {
|
|
131
|
+
chips: [
|
|
132
|
+
{
|
|
133
|
+
chipId: "U1",
|
|
134
|
+
center: { x: 0, y: 0 },
|
|
135
|
+
width: 2,
|
|
136
|
+
height: 1,
|
|
137
|
+
pins: [{ pinId: "U1.1", x: -0.5, y: 0.2, _facingDirection: "x-" }],
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
directConnections: [],
|
|
141
|
+
netConnections: [],
|
|
142
|
+
availableNetLabelOrientations: {},
|
|
143
|
+
}
|
|
144
|
+
const label: NetLabelPlacement = {
|
|
145
|
+
globalConnNetId: "regular-net",
|
|
146
|
+
netId: "D_PLUS",
|
|
147
|
+
mspConnectionPairIds: [],
|
|
148
|
+
pinIds: ["U1.1"],
|
|
149
|
+
orientation: "x-",
|
|
150
|
+
anchorPoint: { x: -0.5, y: 0.2 },
|
|
151
|
+
center: { x: -0.6, y: 0.2 },
|
|
152
|
+
width: 0.2,
|
|
153
|
+
height: 0.2,
|
|
154
|
+
}
|
|
155
|
+
const crossingTrace: SolvedTracePath = {
|
|
156
|
+
mspPairId: "crossing-trace",
|
|
157
|
+
dcConnNetId: "crossing-net",
|
|
158
|
+
globalConnNetId: "crossing-net",
|
|
159
|
+
pins: [] as any,
|
|
160
|
+
tracePath: [
|
|
161
|
+
{ x: -1.2, y: -0.2 },
|
|
162
|
+
{ x: -1.2, y: 0.4 },
|
|
163
|
+
],
|
|
164
|
+
mspConnectionPairIds: ["crossing-trace"],
|
|
165
|
+
pinIds: [],
|
|
166
|
+
}
|
|
167
|
+
const inlineLabel: InlineNetLabelPlacement = {
|
|
168
|
+
globalConnNetId: "inline-net",
|
|
169
|
+
netId: "SWCLK",
|
|
170
|
+
pinIds: ["U1.2"],
|
|
171
|
+
axis: "x",
|
|
172
|
+
anchorPoint: { x: -1.1, y: 0 },
|
|
173
|
+
center: { x: -1.1, y: 0.11 },
|
|
174
|
+
width: 1.2,
|
|
175
|
+
height: 0.12,
|
|
176
|
+
side: "y+",
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const output = pushAnchoredNetLabelsAwayFromInlineLabels({
|
|
180
|
+
inputProblem,
|
|
181
|
+
traces: [crossingTrace],
|
|
182
|
+
netLabelPlacements: [label],
|
|
183
|
+
inlineNetLabelPlacements: [inlineLabel],
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
expect(output.movedLabelCount).toBe(0)
|
|
187
|
+
expect(output.netLabelPlacements[0]).toEqual(label)
|
|
188
|
+
expect(output.traces).toEqual([crossingTrace])
|
|
189
|
+
})
|
|
190
|
+
|
|
129
191
|
test("moves a contiguous label row together and shoves an anchored obstacle", () => {
|
|
130
192
|
const inputProblem: InputProblem = {
|
|
131
193
|
chips: [
|