@tscircuit/schematic-trace-solver 0.0.191 → 0.0.192
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 +9 -6
- package/lib/solvers/SameNetJunctionAlignmentSolver/collapseRedundantSharedEndpointStubs.ts +12 -6
- package/package.json +1 -1
- package/tests/bug-reports/bug-report-20260721T221026Z/__snapshots__/bug-report-20260721T221026Z.snap.svg +2 -2
- package/tests/bug-reports/bug-report-20260724T175257Z/__snapshots__/bug-report-20260724T175257Z.snap.svg +2 -2
- package/tests/bug-reports/bug-report-20260728T144234Z/__snapshots__/bug-report-20260728T144234Z.snap.svg +2 -2
- package/tests/bug-reports/bug-report-20260804T171919Z/__snapshots__/bug-report-20260804T171919Z.snap.svg +2 -2
- package/tests/bug-reports/bug-report-20260815T073240Z/__snapshots__/bug-report-20260815T073240Z.snap.svg +2 -2
- package/tests/bug-reports/bug-report-20260901T055358Z/__snapshots__/bug-report-20260901T055358Z.snap.svg +2 -2
- package/tests/bug-reports/bug-report-20260907T083336Z/__snapshots__/bug-report-20260907T083336Z.snap.svg +2 -2
- package/tests/examples/__snapshots__/example13.snap.svg +2 -2
- package/tests/examples/__snapshots__/example15.snap.svg +2 -2
- package/tests/examples/__snapshots__/example51.snap.svg +2 -2
- package/tests/repros/__snapshots__/board-1273-trace-overlap-cycle.snap.svg +2 -2
- package/tests/repros/__snapshots__/board-15984-same-net-junction.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-bq25895-cross-net-trace-overlap.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-cc2340r5.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-esp12f-section.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-example35-minimize-trace-crossing.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-hub-usb-sheet.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-isolated-rs485-isow7841.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-pga300-redundant-ground-traces.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-pmp11282-isolated-dcdc.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-powerbank-3v-system-power.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-repeated-power-rail-junctions.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-rp2040-gamepad-trace-alignment.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-tida00553-j4-cell-divider.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-tida010076-page02.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-type-c-vbus-led-ground-label.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-usb-power-vbus-label-detour.snap.svg +2 -2
- 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 +2 -2
- package/tests/solvers/SameNetJunctionAlignmentSolver/collapse-redundant-shared-endpoint-stubs.test.ts +45 -0
package/dist/index.js
CHANGED
|
@@ -13613,8 +13613,10 @@ var getPathFromSharedPin = ({
|
|
|
13613
13613
|
sharedPinId
|
|
13614
13614
|
}) => {
|
|
13615
13615
|
const tracePath = simplifyPath(trace.tracePath);
|
|
13616
|
-
|
|
13617
|
-
|
|
13616
|
+
const sharedPin = trace.pins.find((pin) => pin.pinId === sharedPinId);
|
|
13617
|
+
if (!sharedPin) return null;
|
|
13618
|
+
const pathFromSharedPin = trace.pins[0]?.pinId === sharedPinId ? tracePath : tracePath.reverse();
|
|
13619
|
+
return pointsEqual2(pathFromSharedPin[0], sharedPin) ? pathFromSharedPin : null;
|
|
13618
13620
|
};
|
|
13619
13621
|
var traceCanLoseSharedPrefix = ({
|
|
13620
13622
|
trace,
|
|
@@ -13655,9 +13657,10 @@ var collapseRedundantSharedEndpointStubs = ({
|
|
|
13655
13657
|
}) => {
|
|
13656
13658
|
const outputTraces = [...traces];
|
|
13657
13659
|
for (let firstIndex = 0; firstIndex < outputTraces.length; firstIndex++) {
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
+
if (netLabelConnectorTraceIds.has(outputTraces[firstIndex].mspPairId))
|
|
13661
|
+
continue;
|
|
13660
13662
|
for (let secondIndex = firstIndex + 1; secondIndex < outputTraces.length; secondIndex++) {
|
|
13663
|
+
const firstTrace = outputTraces[firstIndex];
|
|
13661
13664
|
const secondTrace = outputTraces[secondIndex];
|
|
13662
13665
|
if (netLabelConnectorTraceIds.has(secondTrace.mspPairId) || firstTrace.globalConnNetId !== secondTrace.globalConnNetId) {
|
|
13663
13666
|
continue;
|
|
@@ -13675,6 +13678,7 @@ var collapseRedundantSharedEndpointStubs = ({
|
|
|
13675
13678
|
trace: secondTrace,
|
|
13676
13679
|
sharedPinId: sharedPin.pinId
|
|
13677
13680
|
});
|
|
13681
|
+
if (!firstPath || !secondPath) continue;
|
|
13678
13682
|
if (firstPath.length < 2 || secondPath.length < 2) continue;
|
|
13679
13683
|
const departureAxis = getSegmentAxis3(firstPath[0], firstPath[1]);
|
|
13680
13684
|
const secondDepartureAxis = getSegmentAxis3(secondPath[0], secondPath[1]);
|
|
@@ -13721,7 +13725,7 @@ var collapseRedundantSharedEndpointStubs = ({
|
|
|
13721
13725
|
});
|
|
13722
13726
|
if (!collapsedTrace2) continue;
|
|
13723
13727
|
outputTraces[traceIndexToCollapse2] = collapsedTrace2;
|
|
13724
|
-
|
|
13728
|
+
continue;
|
|
13725
13729
|
}
|
|
13726
13730
|
if (firstPath.length < 3 || secondPath.length < 3) continue;
|
|
13727
13731
|
if (!pointsEqual2(firstPath[1], secondPath[1])) continue;
|
|
@@ -13785,7 +13789,6 @@ var collapseRedundantSharedEndpointStubs = ({
|
|
|
13785
13789
|
});
|
|
13786
13790
|
if (!collapsedTrace) continue;
|
|
13787
13791
|
outputTraces[traceIndexToCollapse] = collapsedTrace;
|
|
13788
|
-
break;
|
|
13789
13792
|
}
|
|
13790
13793
|
}
|
|
13791
13794
|
return outputTraces;
|
|
@@ -25,8 +25,13 @@ const getPathFromSharedPin = ({
|
|
|
25
25
|
sharedPinId: PinId
|
|
26
26
|
}) => {
|
|
27
27
|
const tracePath = simplifyPath(trace.tracePath)
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const sharedPin = trace.pins.find((pin) => pin.pinId === sharedPinId)
|
|
29
|
+
if (!sharedPin) return null
|
|
30
|
+
const pathFromSharedPin =
|
|
31
|
+
trace.pins[0]?.pinId === sharedPinId ? tracePath : tracePath.reverse()
|
|
32
|
+
return pointsEqual(pathFromSharedPin[0]!, sharedPin)
|
|
33
|
+
? pathFromSharedPin
|
|
34
|
+
: null
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
const traceCanLoseSharedPrefix = ({
|
|
@@ -87,13 +92,14 @@ export const collapseRedundantSharedEndpointStubs = ({
|
|
|
87
92
|
const outputTraces = [...traces]
|
|
88
93
|
|
|
89
94
|
for (let firstIndex = 0; firstIndex < outputTraces.length; firstIndex++) {
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
if (netLabelConnectorTraceIds.has(outputTraces[firstIndex]!.mspPairId))
|
|
96
|
+
continue
|
|
92
97
|
for (
|
|
93
98
|
let secondIndex = firstIndex + 1;
|
|
94
99
|
secondIndex < outputTraces.length;
|
|
95
100
|
secondIndex++
|
|
96
101
|
) {
|
|
102
|
+
const firstTrace = outputTraces[firstIndex]!
|
|
97
103
|
const secondTrace = outputTraces[secondIndex]!
|
|
98
104
|
if (
|
|
99
105
|
netLabelConnectorTraceIds.has(secondTrace.mspPairId) ||
|
|
@@ -114,6 +120,7 @@ export const collapseRedundantSharedEndpointStubs = ({
|
|
|
114
120
|
trace: secondTrace,
|
|
115
121
|
sharedPinId: sharedPin.pinId,
|
|
116
122
|
})
|
|
123
|
+
if (!firstPath || !secondPath) continue
|
|
117
124
|
if (firstPath.length < 2 || secondPath.length < 2) continue
|
|
118
125
|
|
|
119
126
|
const departureAxis = getSegmentAxis(firstPath[0]!, firstPath[1]!)
|
|
@@ -174,7 +181,7 @@ export const collapseRedundantSharedEndpointStubs = ({
|
|
|
174
181
|
})
|
|
175
182
|
if (!collapsedTrace) continue
|
|
176
183
|
outputTraces[traceIndexToCollapse] = collapsedTrace
|
|
177
|
-
|
|
184
|
+
continue
|
|
178
185
|
}
|
|
179
186
|
if (firstPath.length < 3 || secondPath.length < 3) continue
|
|
180
187
|
if (!pointsEqual(firstPath[1]!, secondPath[1]!)) continue
|
|
@@ -259,7 +266,6 @@ export const collapseRedundantSharedEndpointStubs = ({
|
|
|
259
266
|
})
|
|
260
267
|
if (!collapsedTrace) continue
|
|
261
268
|
outputTraces[traceIndexToCollapse] = collapsedTrace
|
|
262
|
-
break
|
|
263
269
|
}
|
|
264
270
|
}
|
|
265
271
|
|