@tscircuit/schematic-trace-solver 0.0.186 → 0.0.188
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.d.ts +40 -23
- package/dist/index.js +1041 -319
- package/lib/solvers/InlineNetLabelSolver/InlineNetLabelSolver.ts +611 -230
- package/lib/solvers/InlineNetLabelSolver/alignPortOnlyInlineNetLabelStubs.ts +2 -6
- package/lib/solvers/InlineNetLabelSolver/getInlineLabelObstacles.ts +64 -0
- package/lib/solvers/InlineNetLabelSolver/getLocalTraceLabelShifts.ts +407 -0
- package/lib/solvers/InlineNetLabelSolver/getOutputLabelCollisions.ts +145 -0
- package/lib/solvers/InlineNetLabelSolver/isLabelRepresentedInline.ts +15 -0
- package/lib/solvers/InlineNetLabelSolver/pushAnchoredNetLabelsAwayFromInlineLabels.ts +61 -31
- package/lib/solvers/NetLabelNetLabelCollisionSolver/NetLabelNetLabelCollisionSolver.ts +83 -14
- package/lib/solvers/NetLabelToTraceSolver/NetLabelToTraceSolver.ts +4 -3
- package/lib/solvers/SameNetJunctionAlignmentSolver/alignSameNetJunctions.ts +14 -11
- package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +3 -0
- package/lib/types/InputProblem.ts +2 -2
- package/package.json +1 -1
- package/site/bug-reports/bug-report-20260907T083336Z.page.tsx +4 -0
- package/site/bug-reports/bug-report-20260907T110144Z.page.tsx +4 -0
- package/site/bug-reports/bug-report-20260907T145640Z.page.tsx +4 -0
- package/tests/bug-reports/bug-report-20260806T093501Z/__snapshots__/bug-report-20260806T093501Z.snap.svg +2 -2
- package/tests/bug-reports/bug-report-20260811T075142Z/__snapshots__/bug-report-20260811T075142Z.snap.svg +18 -18
- package/tests/bug-reports/bug-report-20260819T091818Z/__snapshots__/bug-report-20260819T091818Z.snap.svg +2 -2
- package/tests/bug-reports/bug-report-20260819T091818Z/bug-report-20260819T091818Z.test.ts +21 -0
- package/tests/bug-reports/bug-report-20260825T103621Z/__snapshots__/bug-report-20260825T103621Z.snap.svg +5 -38
- package/tests/bug-reports/bug-report-20260826T072956Z/__snapshots__/bug-report-20260826T072956Z.snap.svg +3 -9
- package/tests/bug-reports/bug-report-20260901T055358Z/__snapshots__/bug-report-20260901T055358Z.snap.svg +18 -30
- package/tests/bug-reports/bug-report-20260901T055358Z/bug-report-20260901T055358Z.test.ts +33 -0
- package/tests/bug-reports/bug-report-20260907T083336Z/__snapshots__/bug-report-20260907T083336Z.snap.svg +520 -0
- package/tests/bug-reports/bug-report-20260907T083336Z/bug-report-20260907T083336Z.json +2031 -0
- package/tests/bug-reports/bug-report-20260907T083336Z/bug-report-20260907T083336Z.test.ts +27 -0
- package/tests/bug-reports/bug-report-20260907T110144Z/__snapshots__/bug-report-20260907T110144Z.snap.svg +282 -0
- package/tests/bug-reports/bug-report-20260907T110144Z/bug-report-20260907T110144Z.json +1073 -0
- package/tests/bug-reports/bug-report-20260907T110144Z/bug-report-20260907T110144Z.test.ts +12 -0
- package/tests/bug-reports/bug-report-20260907T145640Z/__snapshots__/bug-report-20260907T145640Z.snap.svg +1107 -0
- package/tests/bug-reports/bug-report-20260907T145640Z/bug-report-20260907T145640Z.json +3563 -0
- package/tests/bug-reports/bug-report-20260907T145640Z/bug-report-20260907T145640Z.test.ts +117 -0
- package/tests/repros/__snapshots__/board-1273-trace-overlap-cycle.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-battery-management-bq24073.snap.svg +4 -4
- package/tests/repros/__snapshots__/repro-board-648-esp12f-section.snap.svg +2 -2
- package/tests/repros/__snapshots__/repro-core-tb67s579ftg-inline-label-routing.snap.svg +20 -20
- package/tests/repros/__snapshots__/repro-esp12f-section.snap.svg +37 -55
- package/tests/repros/__snapshots__/repro-hub-usb-sheet.snap.svg +44 -68
- package/tests/repros/__snapshots__/repro-mspm0l1306-capacitor-symmetry.snap.svg +3 -9
- package/tests/repros/__snapshots__/repro-usb-power-vbus-label-detour.snap.svg +50 -74
- package/tests/repros/__snapshots__/repro48-555-timer-vcc-rail-label.snap.svg +2 -2
- package/tests/repros/repro-battery-management-bq24073.test.ts +13 -1
- package/tests/repros/repro-hub-usb-sheet.test.ts +25 -0
- package/tests/repros/repro-usb-power-vbus-label-detour.test.ts +59 -13
- package/tests/solvers/InlineNetLabelSolver/local-trace-label-shifts.test.ts +296 -0
- package/tests/solvers/InlineNetLabelSolver/multi-pin-connected-components.test.ts +7 -4
- package/tests/solvers/InlineNetLabelSolver/push-anchored-net-labels-away.test.ts +2 -1
- package/tests/solvers/InlineNetLabelSolver/shared-direct-and-named-connection.test.ts +62 -0
- package/tests/solvers/InlineNetLabelSolver/two-pin-terminal-stubs-atomic.test.ts +9 -3
- package/tests/solvers/SameNetJunctionAlignmentSolver/parallel-load-rails.test.ts +24 -0
package/dist/index.d.ts
CHANGED
|
@@ -161,8 +161,8 @@ interface InputNetConnection {
|
|
|
161
161
|
* When true, a named net may use inline labels. Each routed connected
|
|
162
162
|
* component gets a label along its representative trace, while each
|
|
163
163
|
* disconnected endpoint gets an outward inline-label stub. Conversion is
|
|
164
|
-
* atomic
|
|
165
|
-
*
|
|
164
|
+
* atomic within each routed component. An obstructed component retains its
|
|
165
|
+
* anchored label without preventing inline labels on disconnected components.
|
|
166
166
|
*/
|
|
167
167
|
allowInlineNetLabel?: boolean;
|
|
168
168
|
/** Extent of the inline text along the generated trace stub. */
|
|
@@ -1144,11 +1144,16 @@ type Candidate = {
|
|
|
1144
1144
|
status: CandidateStatus | null;
|
|
1145
1145
|
};
|
|
1146
1146
|
interface NetLabelNetLabelCollisionSolverParams {
|
|
1147
|
+
/** Use the final horizontal tag envelope after inline conversion. */
|
|
1148
|
+
useRenderedLabelBounds?: boolean;
|
|
1149
|
+
/** Already placed labels that are obstacles, but must not be moved. */
|
|
1150
|
+
fixedNetLabelPlacements?: NetLabelPlacement[];
|
|
1147
1151
|
inputProblem: InputProblem;
|
|
1148
1152
|
traces: SolvedTracePath[];
|
|
1149
1153
|
netLabelPlacements: NetLabelPlacement[];
|
|
1150
1154
|
}
|
|
1151
1155
|
declare class NetLabelNetLabelCollisionSolver extends BaseSolver {
|
|
1156
|
+
private params;
|
|
1152
1157
|
inputProblem: InputProblem;
|
|
1153
1158
|
traces: SolvedTracePath[];
|
|
1154
1159
|
netLabelPlacements: NetLabelPlacement[];
|
|
@@ -1175,6 +1180,8 @@ declare class NetLabelNetLabelCollisionSolver extends BaseSolver {
|
|
|
1175
1180
|
private buildCandidatesForLabel;
|
|
1176
1181
|
private checkCandidate;
|
|
1177
1182
|
private beginSearchForLabel;
|
|
1183
|
+
/** Reuse the normal anchor search for a local trace-clearance proposal. */
|
|
1184
|
+
getNearbyValidPlacements(label: NetLabelPlacement, maxDistance: number): NetLabelPlacement[];
|
|
1178
1185
|
private clearActiveSearch;
|
|
1179
1186
|
_step(): void;
|
|
1180
1187
|
visualize(): GraphicsObject;
|
|
@@ -1256,7 +1263,8 @@ declare class TraceElbowTransitionSimplificationSolver extends BaseSolver {
|
|
|
1256
1263
|
|
|
1257
1264
|
declare const DEFAULT_INLINE_NET_LABEL_HEIGHT = 0.18;
|
|
1258
1265
|
/**
|
|
1259
|
-
*
|
|
1266
|
+
* Preferred gap between a trace and its inline text. A tighter parallel-wire
|
|
1267
|
+
* slot may use a smaller, evenly divided gap if the full text still fits.
|
|
1260
1268
|
*/
|
|
1261
1269
|
declare const INLINE_NET_LABEL_TRACE_MARGIN = 0.05;
|
|
1262
1270
|
/** Clearance between a generated terminal stub and an unrelated trace. */
|
|
@@ -1310,17 +1318,22 @@ interface InlineNetLabelPlacement {
|
|
|
1310
1318
|
side: "x+" | "x-" | "y+" | "y-";
|
|
1311
1319
|
}
|
|
1312
1320
|
interface InlineNetLabelSolverInput {
|
|
1321
|
+
/** Exact connector IDs supplied by their producer; IDs are never parsed. */
|
|
1322
|
+
netLabelConnectorTraceIds?: ReadonlySet<string>;
|
|
1323
|
+
resolveTraceCollisions?: boolean;
|
|
1313
1324
|
inputProblem: InputProblem;
|
|
1314
1325
|
traces: SolvedTracePath[];
|
|
1315
1326
|
netLabelPlacements: NetLabelPlacement[];
|
|
1316
1327
|
completedReroutes?: CompletedTraceReroute[];
|
|
1317
1328
|
}
|
|
1318
1329
|
interface InlineNetLabelOutput {
|
|
1330
|
+
netLabelConnectorTraceIds?: ReadonlySet<string>;
|
|
1319
1331
|
inputProblem: InputProblem;
|
|
1320
1332
|
traces: SolvedTracePath[];
|
|
1321
1333
|
netLabelPlacements: NetLabelPlacement[];
|
|
1322
1334
|
inlineNetLabelPlacements: InlineNetLabelPlacement[];
|
|
1323
1335
|
}
|
|
1336
|
+
type InlineOutput = Omit<InlineNetLabelOutput, "inputProblem">;
|
|
1324
1337
|
type QueuedInlineConnection = {
|
|
1325
1338
|
kind: "direct_connection";
|
|
1326
1339
|
connection: InputDirectConnection;
|
|
@@ -1332,10 +1345,11 @@ type QueuedInlineConnection = {
|
|
|
1332
1345
|
* Places "inline net labels" - net names drawn alongside the trace they belong
|
|
1333
1346
|
* to - for connections that opted in via `allowInlineNetLabel`.
|
|
1334
1347
|
*
|
|
1335
|
-
*
|
|
1336
|
-
*
|
|
1348
|
+
* Anchored labels are removed only for the connected components represented
|
|
1349
|
+
* inline. A blocked component keeps its label without undoing clear ones.
|
|
1337
1350
|
*/
|
|
1338
1351
|
declare class InlineNetLabelSolver extends BaseSolver {
|
|
1352
|
+
private readonly input;
|
|
1339
1353
|
inputProblem: InputProblem;
|
|
1340
1354
|
traces: SolvedTracePath[];
|
|
1341
1355
|
inputNetLabelPlacements: NetLabelPlacement[];
|
|
@@ -1343,18 +1357,23 @@ declare class InlineNetLabelSolver extends BaseSolver {
|
|
|
1343
1357
|
inlineNetLabelPlacements: InlineNetLabelPlacement[];
|
|
1344
1358
|
/** Eligible connections still waiting to be processed. */
|
|
1345
1359
|
queuedConnections: QueuedInlineConnection[];
|
|
1360
|
+
private readonly netLabelConnectorTraceIds;
|
|
1346
1361
|
private tracesByPinPairKey;
|
|
1347
1362
|
private globalConnMap;
|
|
1348
|
-
private
|
|
1363
|
+
private inlineConversions;
|
|
1349
1364
|
private hasAlignedPortOnlyStubs;
|
|
1350
1365
|
private postProcessedOutput?;
|
|
1366
|
+
activeSubSolver: InlineNetLabelSolver | null;
|
|
1367
|
+
private refinementComplete;
|
|
1368
|
+
private refinement?;
|
|
1369
|
+
private currentProposal?;
|
|
1351
1370
|
constructor(input: InlineNetLabelSolverInput);
|
|
1352
1371
|
getConstructorParams(): [InlineNetLabelSolverInput];
|
|
1353
1372
|
_step(): void;
|
|
1354
1373
|
/**
|
|
1355
1374
|
* Plans all opted-in multi-pin nets together. Short routed components can
|
|
1356
1375
|
* mutually block the outward endpoint stubs that replace them, so tentative
|
|
1357
|
-
* replacements are ignored as obstacles only while their
|
|
1376
|
+
* replacements are ignored as obstacles only while their connected component still
|
|
1358
1377
|
* converts successfully. Failed conversions retain both their traces and
|
|
1359
1378
|
* their conventional labels, and the remaining conversions are retried.
|
|
1360
1379
|
*/
|
|
@@ -1370,14 +1389,15 @@ declare class InlineNetLabelSolver extends BaseSolver {
|
|
|
1370
1389
|
* Converts every conventional label representation for an opted-in named
|
|
1371
1390
|
* net. Routed connected components become labels on their representative
|
|
1372
1391
|
* trace; disconnected pins become outward terminal stubs. The conversion is
|
|
1373
|
-
* atomic
|
|
1392
|
+
* atomic within each routed component, so replacing its traces cannot strand
|
|
1393
|
+
* a pin. Disconnected components can keep their own label style.
|
|
1374
1394
|
*/
|
|
1375
1395
|
private computeNetConnectionInlinePlacements;
|
|
1396
|
+
/** Prefer the normal gap, then center text in a tighter parallel-wire slot. */
|
|
1397
|
+
private getInlineOffsets;
|
|
1376
1398
|
/**
|
|
1377
|
-
* Converts one conventional endpoint placement into an inline label on
|
|
1378
|
-
*
|
|
1379
|
-
* an anchored label may finish in another direction after an elbow, which is
|
|
1380
|
-
* not the direction a terminal stub should leave the pin.
|
|
1399
|
+
* Converts one conventional endpoint placement into an inline label on an
|
|
1400
|
+
* outward stub that follows the pin's true facing direction.
|
|
1381
1401
|
*/
|
|
1382
1402
|
private computeTerminalInlinePlacement;
|
|
1383
1403
|
private computeInlinePlacement;
|
|
@@ -1393,19 +1413,15 @@ declare class InlineNetLabelSolver extends BaseSolver {
|
|
|
1393
1413
|
* trace belonging to another net.
|
|
1394
1414
|
*/
|
|
1395
1415
|
private isObstructed;
|
|
1396
|
-
/**
|
|
1397
|
-
* Net label placements superseded by an inline label. A net gets one label or
|
|
1398
|
-
* the other, never both.
|
|
1399
|
-
*/
|
|
1400
|
-
private getSupersededNetLabelKeys;
|
|
1401
1416
|
private getOutputTraces;
|
|
1402
|
-
private
|
|
1417
|
+
private getBlockedInlinePlacements;
|
|
1403
1418
|
private buildPostProcessedOutput;
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1419
|
+
/** Enumerate nearby moves in the existing order; collect one proposal per step. */
|
|
1420
|
+
private getTraceRefinementProposals;
|
|
1421
|
+
private createRefinementCandidate;
|
|
1422
|
+
private acceptRefinementCandidate;
|
|
1423
|
+
private stepTraceRefinement;
|
|
1424
|
+
getOutput(): InlineOutput;
|
|
1409
1425
|
visualize(): GraphicsObject;
|
|
1410
1426
|
}
|
|
1411
1427
|
declare const visualizeInlineNetLabelOutput: ({ inputProblem, traces, netLabelPlacements, inlineNetLabelPlacements, }: InlineNetLabelOutput) => GraphicsObject;
|
|
@@ -1420,6 +1436,7 @@ declare class NetLabelToTraceSolver extends BaseSolver {
|
|
|
1420
1436
|
inputProblem: InputProblem;
|
|
1421
1437
|
outputTraces: SolvedTracePath[];
|
|
1422
1438
|
outputNetLabelPlacements: NetLabelPlacement[];
|
|
1439
|
+
private readonly recoveredTraceIds;
|
|
1423
1440
|
private chipMap;
|
|
1424
1441
|
private pinMap;
|
|
1425
1442
|
private queuedCandidates;
|