@tscircuit/schematic-trace-solver 0.0.149 → 0.0.151

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 (162) hide show
  1. package/.agents/skills/schematic-trace-visualization/SKILL.md +7 -2
  2. package/README.md +6 -4
  3. package/dist/index.d.ts +64 -3
  4. package/dist/index.js +383 -66
  5. package/lib/solvers/InlineNetLabelSolver/InlineNetLabelSolver.ts +123 -84
  6. package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +17 -1
  7. package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver.ts +2 -0
  8. package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/solvePortOnlyPin.ts +2 -0
  9. package/lib/solvers/NetLabelToTraceSolver/NetLabelToTraceSolver.ts +338 -0
  10. package/lib/solvers/NetLabelTraceRecovery/getTraceRecoveryConnectivityMaps.ts +33 -0
  11. package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +15 -0
  12. package/lib/types/InputProblem.ts +27 -1
  13. package/package.json +8 -1
  14. package/tests/bug-reports/bug-report-20260706T213649Z/__snapshots__/bug-report-20260706T213649Z.snap.svg +751 -5
  15. package/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg +660 -5
  16. package/tests/bug-reports/bug-report-20260707T020342Z/__snapshots__/bug-report-20260707T020342Z.snap.svg +44 -5
  17. package/tests/bug-reports/bug-report-20260707T092615Z/__snapshots__/bug-report-20260707T092615Z.snap.svg +394 -5
  18. package/tests/bug-reports/bug-report-20260707T134549Z/__snapshots__/bug-report-20260707T134549Z.snap.svg +170 -5
  19. package/tests/bug-reports/bug-report-20260707T134722Z/__snapshots__/bug-report-20260707T134722Z.snap.svg +79 -5
  20. package/tests/bug-reports/bug-report-20260707T140410Z/__snapshots__/bug-report-20260707T140410Z.snap.svg +219 -5
  21. package/tests/bug-reports/bug-report-20260707T141025Z/__snapshots__/bug-report-20260707T141025Z.snap.svg +65 -5
  22. package/tests/bug-reports/bug-report-20260707T141421Z/__snapshots__/bug-report-20260707T141421Z.snap.svg +142 -5
  23. package/tests/bug-reports/bug-report-20260707T230831Z/__snapshots__/bug-report-20260707T230831Z.snap.svg +100 -5
  24. package/tests/bug-reports/bug-report-20260708T053736Z/__snapshots__/bug-report-20260708T053736Z.snap.svg +23 -5
  25. package/tests/bug-reports/bug-report-20260708T055430Z/__snapshots__/bug-report-20260708T055430Z.snap.svg +58 -5
  26. package/tests/bug-reports/bug-report-20260708T095725Z/__snapshots__/bug-report-20260708T095725Z.snap.svg +86 -5
  27. package/tests/bug-reports/bug-report-20260716T144856Z/__snapshots__/bug-report-20260716T144856Z.snap.svg +226 -5
  28. package/tests/bug-reports/bug-report-20260717T022934Z/__snapshots__/bug-report-20260717T022934Z.snap.svg +191 -5
  29. package/tests/bug-reports/bug-report-20260717T031704Z/__snapshots__/bug-report-20260717T031704Z.snap.svg +30 -5
  30. package/tests/bug-reports/bug-report-20260717T042845Z/__snapshots__/bug-report-20260717T042845Z.snap.svg +37 -5
  31. package/tests/bug-reports/bug-report-20260721T221026Z/__snapshots__/bug-report-20260721T221026Z.snap.svg +580 -2
  32. package/tests/bug-reports/bug-report-20260724T175257Z/__snapshots__/bug-report-20260724T175257Z.snap.svg +44 -5
  33. package/tests/bug-reports/bug-report-20260728T144234Z/__snapshots__/bug-report-20260728T144234Z.snap.svg +107 -5
  34. package/tests/bug-reports/bug-report-20260728T225606Z/__snapshots__/bug-report-20260728T225606Z.snap.svg +114 -5
  35. package/tests/bug-reports/bug-report-20260730T061837Z/__snapshots__/bug-report-20260730T061837Z.snap.svg +121 -5
  36. package/tests/bug-reports/bug-report-20260731T052229Z/__snapshots__/bug-report-20260731T052229Z.snap.svg +51 -5
  37. package/tests/bug-reports/bug-report-20260804T095800Z/__snapshots__/bug-report-20260804T095800Z.snap.svg +212 -5
  38. package/tests/bug-reports/bug-report-20260804T171919Z/__snapshots__/bug-report-20260804T171919Z.snap.svg +569 -5
  39. package/tests/bug-reports/bug-report-20260804T225912Z/__snapshots__/bug-report-20260804T225912Z.snap.svg +37 -5
  40. package/tests/bug-reports/bug-report-20260805T061316Z/__snapshots__/bug-report-20260805T061316Z.snap.svg +289 -5
  41. package/tests/bug-reports/bug-report-20260806T061548Z/__snapshots__/bug-report-20260806T061548Z.snap.svg +289 -5
  42. package/tests/bug-reports/bug-report-20260806T093501Z/__snapshots__/bug-report-20260806T093501Z.snap.svg +149 -5
  43. package/tests/bug-reports/bug-report-20260811T075142Z/__snapshots__/bug-report-20260811T075142Z.snap.svg +93 -5
  44. package/tests/bug-reports/bug-report-20260815T073240Z/__snapshots__/bug-report-20260815T073240Z.snap.svg +79 -5
  45. package/tests/bug-reports/bug-report-20260819T091818Z/__snapshots__/bug-report-20260819T091818Z.snap.svg +244 -2
  46. package/tests/examples/__snapshots__/example01.snap.svg +44 -5
  47. package/tests/examples/__snapshots__/example02.snap.svg +51 -5
  48. package/tests/examples/__snapshots__/example03.snap.svg +86 -5
  49. package/tests/examples/__snapshots__/example04.snap.svg +30 -5
  50. package/tests/examples/__snapshots__/example05.snap.svg +30 -5
  51. package/tests/examples/__snapshots__/example06.snap.svg +30 -5
  52. package/tests/examples/__snapshots__/example07.snap.svg +58 -5
  53. package/tests/examples/__snapshots__/example08.snap.svg +37 -5
  54. package/tests/examples/__snapshots__/example09.snap.svg +149 -5
  55. package/tests/examples/__snapshots__/example10.snap.svg +65 -5
  56. package/tests/examples/__snapshots__/example11.snap.svg +51 -5
  57. package/tests/examples/__snapshots__/example12.snap.svg +51 -5
  58. package/tests/examples/__snapshots__/example13.snap.svg +72 -5
  59. package/tests/examples/__snapshots__/example14.snap.svg +79 -5
  60. package/tests/examples/__snapshots__/example15.snap.svg +86 -5
  61. package/tests/examples/__snapshots__/example16.snap.svg +51 -5
  62. package/tests/examples/__snapshots__/example17.snap.svg +51 -5
  63. package/tests/examples/__snapshots__/example18.snap.svg +58 -5
  64. package/tests/examples/__snapshots__/example19.snap.svg +44 -5
  65. package/tests/examples/__snapshots__/example20.snap.svg +44 -5
  66. package/tests/examples/__snapshots__/example21.snap.svg +72 -5
  67. package/tests/examples/__snapshots__/example22.snap.svg +51 -5
  68. package/tests/examples/__snapshots__/example23.snap.svg +51 -5
  69. package/tests/examples/__snapshots__/example24.snap.svg +51 -5
  70. package/tests/examples/__snapshots__/example25.snap.svg +86 -5
  71. package/tests/examples/__snapshots__/example26.snap.svg +51 -5
  72. package/tests/examples/__snapshots__/example27.snap.svg +72 -5
  73. package/tests/examples/__snapshots__/example28.snap.svg +44 -5
  74. package/tests/examples/__snapshots__/example29.snap.svg +324 -5
  75. package/tests/examples/__snapshots__/example30.snap.svg +107 -5
  76. package/tests/examples/__snapshots__/example31.snap.svg +37 -5
  77. package/tests/examples/__snapshots__/example32.snap.svg +149 -5
  78. package/tests/examples/__snapshots__/example33.snap.svg +93 -5
  79. package/tests/examples/__snapshots__/example34.snap.svg +51 -5
  80. package/tests/examples/__snapshots__/example35.snap.svg +58 -5
  81. package/tests/examples/__snapshots__/example36.snap.svg +44 -5
  82. package/tests/examples/__snapshots__/example37.snap.svg +72 -5
  83. package/tests/examples/__snapshots__/example38.snap.svg +30 -5
  84. package/tests/examples/__snapshots__/example39.snap.svg +37 -5
  85. package/tests/examples/__snapshots__/example40.snap.svg +100 -5
  86. package/tests/examples/__snapshots__/example41.snap.svg +44 -5
  87. package/tests/examples/__snapshots__/example42.snap.svg +65 -5
  88. package/tests/examples/__snapshots__/example43.snap.svg +58 -5
  89. package/tests/examples/__snapshots__/example44.snap.svg +107 -5
  90. package/tests/examples/__snapshots__/example45.snap.svg +51 -5
  91. package/tests/examples/__snapshots__/example46.snap.svg +93 -5
  92. package/tests/examples/__snapshots__/example47.snap.svg +93 -5
  93. package/tests/examples/__snapshots__/example48.snap.svg +65 -5
  94. package/tests/examples/__snapshots__/example49.snap.svg +177 -5
  95. package/tests/examples/__snapshots__/example50.snap.svg +93 -5
  96. package/tests/examples/__snapshots__/example51.snap.svg +594 -21
  97. package/tests/fixtures/convertSolverOutputToCircuitJson.test.ts +219 -0
  98. package/tests/fixtures/convertSolverOutputToCircuitJson.ts +1058 -0
  99. package/tests/fixtures/matcher.ts +45 -8
  100. package/tests/repros/__snapshots__/board-1273-trace-overlap-cycle.snap.svg +762 -2
  101. package/tests/repros/__snapshots__/board-15984-same-net-junction.snap.svg +111 -2
  102. package/tests/repros/__snapshots__/board1096-usb-label-overlap-iteration.snap.svg +170 -5
  103. package/tests/repros/__snapshots__/bugreport-001-gnd-overlap.snap.svg +65 -5
  104. package/tests/repros/__snapshots__/manufacturePartNumber-text-box.snap.svg +30 -5
  105. package/tests/repros/__snapshots__/netlabel-connector-through-rail-label.snap.svg +79 -5
  106. package/tests/repros/__snapshots__/repro-atmega328p-fault-pullup.snap.svg +65 -5
  107. package/tests/repros/__snapshots__/repro-atmega328p-missing-gnd-netlabel.snap.svg +149 -5
  108. package/tests/repros/__snapshots__/repro-board-589-regulator-section.snap.svg +55 -2
  109. package/tests/repros/__snapshots__/repro-board-648-esp12f-section.snap.svg +160 -2
  110. package/tests/repros/__snapshots__/repro-bq24074-battery-charger.snap.svg +135 -5
  111. package/tests/repros/__snapshots__/repro-bq25895-cross-net-trace-overlap.snap.svg +69 -2
  112. package/tests/repros/__snapshots__/repro-cc2340r5.snap.svg +86 -5
  113. package/tests/repros/__snapshots__/repro-core-555-power-cross-net-overlap.snap.svg +44 -5
  114. package/tests/repros/__snapshots__/repro-core-subcircuit-missing-ground.snap.svg +44 -5
  115. package/tests/repros/__snapshots__/repro-core-tb67s579ftg-inline-label-routing.snap.svg +30 -5
  116. package/tests/repros/__snapshots__/repro-example35-minimize-trace-crossing.snap.svg +335 -2
  117. package/tests/repros/__snapshots__/repro-ground-label-on-lower-rail-end.snap.svg +48 -2
  118. package/tests/repros/__snapshots__/repro-ina237-current-monitor.snap.svg +149 -5
  119. package/tests/repros/__snapshots__/repro-missing-trace-netlabel.snap.svg +72 -5
  120. package/tests/repros/__snapshots__/repro-netlabel-collision-687.snap.svg +100 -5
  121. package/tests/repros/__snapshots__/repro-netlabel-overlap-trace.snap.svg +51 -5
  122. package/tests/repros/__snapshots__/repro-nrf52810-clock-routing.snap.svg +90 -2
  123. package/tests/repros/__snapshots__/repro-power-group-rail-labels.snap.svg +37 -5
  124. package/tests/repros/__snapshots__/repro-rectifier-trace-overlap.snap.svg +44 -5
  125. package/tests/repros/__snapshots__/repro-rp2040-gamepad-trace-alignment.snap.svg +237 -2
  126. package/tests/repros/__snapshots__/repro-rp2040-usb-cc2-ground-overlap.snap.svg +72 -5
  127. package/tests/repros/__snapshots__/repro-rp2040-v3v3-label-placement.snap.svg +51 -5
  128. package/tests/repros/__snapshots__/repro-rp2040-zero-crystal-fallback-netlabels.snap.svg +30 -5
  129. package/tests/repros/__snapshots__/repro-ti-power-output-section.snap.svg +79 -5
  130. package/tests/repros/__snapshots__/repro-tida010076-j4-ground-bus.snap.svg +27 -2
  131. package/tests/repros/__snapshots__/repro-tida010076-page02.snap.svg +1150 -5
  132. package/tests/repros/__snapshots__/repro-tps61222-trace-intersection.snap.svg +51 -5
  133. package/tests/repros/__snapshots__/repro-type-c-16pin-self-connection.snap.svg +30 -5
  134. package/tests/repros/__snapshots__/repro-type-c-16pin-to-resistor.snap.svg +30 -5
  135. package/tests/repros/__snapshots__/repro-type-c-vbus-led-ground-label.snap.svg +44 -5
  136. package/tests/repros/__snapshots__/repro-usb-power-vbus-label-detour.snap.svg +685 -2
  137. package/tests/repros/__snapshots__/repro-vcc-pin1-detour.snap.svg +27 -2
  138. package/tests/repros/__snapshots__/repro129-host-custom-symbol-passives.snap.svg +51 -5
  139. package/tests/repros/__snapshots__/repro130-bq27441-fuel-gauge-trace-through-c1.snap.svg +100 -5
  140. package/tests/repros/__snapshots__/repro161-power-section-autolayout.snap.svg +107 -5
  141. package/tests/repros/__snapshots__/repro47-endpoint-obstacle-detour.snap.svg +51 -5
  142. package/tests/repros/__snapshots__/repro48-555-timer-vcc-rail-label.snap.svg +104 -2
  143. package/tests/repros/__snapshots__/repro5-escape-padded-text-obstacles.snap.svg +30 -5
  144. package/tests/repros/__snapshots__/repro51-overlap-junction-crossing.snap.svg +65 -5
  145. package/tests/repros/__snapshots__/repro84-stacked-gnd-label-orientation.snap.svg +27 -2
  146. package/tests/repros/__snapshots__/small-variant-resistor-facing-direction.snap.svg +58 -5
  147. package/tests/repros/__snapshots__/trace-overlap-box-resistor.snap.svg +37 -5
  148. package/tests/solvers/InlineNetLabelSolver/__snapshots__/fallback-net-label-width.snap.svg +25 -7
  149. package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label-anchored-label-clearance.snap.svg +34 -2
  150. package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label-port-stub.snap.svg +23 -5
  151. package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label-two-pin-net.snap.svg +23 -5
  152. package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label01.snap.svg +23 -5
  153. package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label02.snap.svg +23 -5
  154. package/tests/solvers/InlineNetLabelSolver/__snapshots__/terminal-stub-trace-clearance.snap.svg +23 -5
  155. package/tests/solvers/InlineNetLabelSolver/fallback-net-label-width.test.ts +10 -1
  156. package/tests/solvers/SchematicTraceSingleLineSolver2/__snapshots__/SchematicTraceSingleLineSolver2_01-example17-d1_1-u1_1.snap.svg +23 -5
  157. package/tests/solvers/SchematicTraceSingleLineSolver2/__snapshots__/SchematicTraceSingleLineSolver2_repro47-short-opposing-pins.snap.svg +20 -2
  158. package/tests/solvers/TraceCleanupSolver/__snapshots__/TraceCleanupSolver.snap.svg +44 -5
  159. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/__snapshots__/TraceLabelOverlapAvoidanceSolver.snap.svg +79 -5
  160. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/__snapshots__/MergedNetLabelObstacles.snap.svg +44 -5
  161. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/__snapshots__/OverlapAvoidanceStepSolver.snap.svg +23 -5
  162. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/__snapshots__/SingleOverlapSolver.snap.svg +30 -5
@@ -48,7 +48,8 @@ const png = await getPngBufferFromGraphicsObject(graphics, {
48
48
 
49
49
  ## Existing Repo Helpers
50
50
 
51
- - `tests/fixtures/matcher.ts`: `expect(solver).toMatchSolverSnapshot(import.meta.path)` converts `solver.visualize()` to SVG and snapshots it.
51
+ - `tests/fixtures/matcher.ts`: `expect(solver).toMatchSolverSnapshot(import.meta.path)` converts the solver's semantic output to Circuit JSON and renders it with `circuit-to-svg`. These snapshots hide the input rats nest by default.
52
+ - `tests/fixtures/convertSolverOutputToCircuitJson.ts`: builds snapshot Circuit JSON with schematic components/symbols, ports, routed traces, net labels, text, and boxes.
52
53
  - `tests/fixtures/getLastStepGraphicsObject.ts`: filters a `GraphicsObject` to its highest numbered `step`.
53
54
  - `tests/fixtures/getLastStepSvg.ts`: converts only the last step to SVG.
54
55
  - `lib/testing/PipelineStageDebugRunner.ts`: runs `SchematicTracePipelineSolver` and writes per-stage PNG/SVG/graphics JSON artifacts.
@@ -56,7 +57,8 @@ const png = await getPngBufferFromGraphicsObject(graphics, {
56
57
 
57
58
  ## Minimal SVG Tests
58
59
 
59
- Prefer focused solver SVG snapshots over broad dumps:
60
+ Prefer focused solver SVG snapshots over broad dumps. Solver snapshots use the
61
+ semantic Circuit JSON renderer by default:
60
62
 
61
63
  ```ts
62
64
  const solver = new SchematicTracePipelineSolver(inputProblem as any)
@@ -64,6 +66,9 @@ solver.solve()
64
66
  expect(solver).toMatchSolverSnapshot(import.meta.path)
65
67
  ```
66
68
 
69
+ Use `solver.visualize()` with `getSvgFromGraphicsObject` directly when a test is
70
+ specifically about internal candidates, failed geometry, or staged debug state.
71
+
67
72
  For multi-step graphics where only the final stage matters:
68
73
 
69
74
  ```ts
package/README.md CHANGED
@@ -48,10 +48,12 @@ decides which connections deserve one; the solver only honors the request when
48
48
  the connection actually got routed, since there is nothing to run parallel to
49
49
  otherwise.
50
50
 
51
- The `InlineNetLabelSolver` runs last in the pipeline and exposes
52
- `inlineNetLabelPlacements`. A net that receives an inline label has its anchored
53
- `NetLabelPlacement` removed from `getOutput().netLabelPlacements`, so a net is
54
- never labeled twice.
51
+ The `InlineNetLabelSolver` exposes `inlineNetLabelPlacements`. A net that
52
+ receives an inline label has its anchored `NetLabelPlacement` removed from
53
+ `getOutput().netLabelPlacements`, so a net is never labeled twice.
54
+ `NetLabelToTraceSolver` then replaces pairs of port-only fallback labels with
55
+ real traces whenever the router finds a clear path. Its `getOutput()` is the
56
+ pipeline's final output.
55
57
 
56
58
  ```tsx
57
59
  directConnections: [
package/dist/index.d.ts CHANGED
@@ -75,6 +75,13 @@ interface TextBoxes {
75
75
  }
76
76
  interface InputChip {
77
77
  chipId: ChipId;
78
+ /**
79
+ * Exact directional/oriented schematic-symbol name when the caller has it.
80
+ * `center`, `width`, and `height` describe the solver obstacle and may be
81
+ * expanded to include reference/value or manufacturer-part-number text, so
82
+ * renderers should use this symbol's geometry for the component body.
83
+ */
84
+ symbolName?: string;
78
85
  center: {
79
86
  x: number;
80
87
  y: number;
@@ -87,6 +94,13 @@ interface InputChip {
87
94
  interface InputDirectConnection {
88
95
  pinIds: [PinId, PinId];
89
96
  netId?: string;
97
+ /**
98
+ * User-facing text to render for this net label. `netId` remains the stable
99
+ * connectivity identifier and may be an internal id. When this is omitted
100
+ * but a label width is provided, renderers should use a width-preserving
101
+ * placeholder instead of exposing `netId` as label text.
102
+ */
103
+ netLabelText?: string;
90
104
  netLabelWidth?: number;
91
105
  /**
92
106
  * Width of the conventional anchored label to use only when an inline label
@@ -109,7 +123,8 @@ interface InputDirectConnection {
109
123
  allowInlineNetLabel?: boolean;
110
124
  /**
111
125
  * Extent of the inline net label along the trace. Falls back to
112
- * `netLabelWidth`, then to an estimate from the netId text.
126
+ * `netLabelWidth`, then to an estimate from `netLabelText` (or `netId` for
127
+ * backwards compatibility).
113
128
  */
114
129
  inlineNetLabelWidth?: number;
115
130
  /**
@@ -121,6 +136,13 @@ interface InputDirectConnection {
121
136
  interface InputNetConnection {
122
137
  netId: string;
123
138
  pinIds: Array<PinId>;
139
+ /**
140
+ * User-facing text to render for this net label. `netId` remains the stable
141
+ * connectivity identifier and may be an internal id. When this is omitted
142
+ * but a label width is provided, renderers should use a width-preserving
143
+ * placeholder instead of exposing `netId` as label text.
144
+ */
145
+ netLabelText?: string;
124
146
  netLabelWidth?: number;
125
147
  fallbackNetLabelWidth?: number;
126
148
  netLabelHeight?: number;
@@ -425,6 +447,7 @@ declare class SingleNetLabelPlacementSolver extends BaseSolver {
425
447
  type OverlappingSameNetTraceGroup = {
426
448
  globalConnNetId: string;
427
449
  netId?: string;
450
+ netLabelText?: string;
428
451
  overlappingTraces?: SolvedTracePath;
429
452
  portOnlyPinId?: string;
430
453
  mspConnectionPairIds?: MspConnectionPairId[];
@@ -436,6 +459,8 @@ interface NetLabelPlacement {
436
459
  * Optional user-provided net identifier (if present in the input problem).
437
460
  */
438
461
  netId?: string;
462
+ /** User-facing label content, separate from the connectivity identifier. */
463
+ netLabelText?: string;
439
464
  /**
440
465
  * MSP pair ids that the label is associated with. Port-only labels use [].
441
466
  */
@@ -1209,6 +1234,8 @@ declare const INLINE_NET_LABEL_MAX_SPAN_JOG = 0.4;
1209
1234
  interface InlineNetLabelPlacement {
1210
1235
  globalConnNetId: string;
1211
1236
  netId?: string;
1237
+ /** User-facing label content, separate from the connectivity identifier. */
1238
+ netLabelText?: string;
1212
1239
  mspPairId?: string;
1213
1240
  pinIds: PinId[];
1214
1241
  /**
@@ -1239,6 +1266,12 @@ interface InlineNetLabelSolverInput {
1239
1266
  traces: SolvedTracePath[];
1240
1267
  netLabelPlacements: NetLabelPlacement[];
1241
1268
  }
1269
+ interface InlineNetLabelOutput {
1270
+ inputProblem: InputProblem;
1271
+ traces: SolvedTracePath[];
1272
+ netLabelPlacements: NetLabelPlacement[];
1273
+ inlineNetLabelPlacements: InlineNetLabelPlacement[];
1274
+ }
1242
1275
  type InlineEligibleConnection = InputDirectConnection | InputNetConnection;
1243
1276
  /**
1244
1277
  * Places "inline net labels" - net names drawn alongside the trace they belong
@@ -1295,12 +1328,39 @@ declare class InlineNetLabelSolver extends BaseSolver {
1295
1328
  };
1296
1329
  visualize(): GraphicsObject;
1297
1330
  }
1331
+ declare const visualizeInlineNetLabelOutput: ({ inputProblem, traces, netLabelPlacements, inlineNetLabelPlacements, }: InlineNetLabelOutput) => GraphicsObject;
1298
1332
  /**
1299
1333
  * Mirrors the net label text width used by @tscircuit/core so a label that core
1300
1334
  * did not measure for us still reserves a sane amount of space.
1301
1335
  */
1302
1336
  declare const estimateInlineNetLabelWidth: (text: string, fontSize?: number) => number;
1303
1337
 
1338
+ declare class NetLabelToTraceSolver extends BaseSolver {
1339
+ private input;
1340
+ inputProblem: InputProblem;
1341
+ outputTraces: SolvedTracePath[];
1342
+ outputNetLabelPlacements: NetLabelPlacement[];
1343
+ private chipMap;
1344
+ private pinMap;
1345
+ private queuedCandidates;
1346
+ private currentCandidate;
1347
+ activeSubSolver: SchematicTraceSingleLineSolver2 | null;
1348
+ constructor(input: InlineNetLabelOutput);
1349
+ getConstructorParams(): [InlineNetLabelOutput];
1350
+ private isEligiblePortOnlyDirectConnectionLabel;
1351
+ private buildCandidatePairs;
1352
+ private isSupersededConnectorTrace;
1353
+ private routeIntersectsRemainingLabels;
1354
+ private tryAcceptCurrentRoute;
1355
+ _step(): void;
1356
+ getOutput(): {
1357
+ traces: SolvedTracePath[];
1358
+ netLabelPlacements: NetLabelPlacement[];
1359
+ inlineNetLabelPlacements: InlineNetLabelPlacement[];
1360
+ };
1361
+ visualize(): GraphicsObject;
1362
+ }
1363
+
1304
1364
  /**
1305
1365
  * Pipeline solver that runs a series of solvers to find the best schematic layout.
1306
1366
  * Coordinates the entire layout process from chip partitioning through final packing.
@@ -1341,13 +1401,14 @@ declare class SchematicTracePipelineSolver extends BaseSolver {
1341
1401
  finalTraceElbowTransitionSimplificationSolver?: TraceElbowTransitionSimplificationSolver;
1342
1402
  sameNetJunctionAlignmentSolver?: SameNetJunctionAlignmentSolver;
1343
1403
  inlineNetLabelSolver?: InlineNetLabelSolver;
1404
+ netLabelToTraceSolver?: NetLabelToTraceSolver;
1344
1405
  startTimeOfPhase: Record<string, number>;
1345
1406
  endTimeOfPhase: Record<string, number>;
1346
1407
  timeSpentOnPhase: Record<string, number>;
1347
1408
  firstIterationOfPhase: Record<string, number>;
1348
1409
  inputProblem: InputProblem;
1349
1410
  hideRatsNet: boolean;
1350
- pipelineDef: (PipelineStep<typeof MspConnectionPairSolver> | PipelineStep<typeof SchematicTraceLinesSolver> | PipelineStep<typeof LongDistancePairSolver> | PipelineStep<typeof UnroutedTraceRecoverySolver> | PipelineStep<typeof TraceOverlapShiftSolver> | PipelineStep<typeof NetLabelPlacementSolver> | PipelineStep<typeof TraceLabelOverlapAvoidanceSolver> | PipelineStep<typeof TraceElbowTransitionSimplificationSolver> | PipelineStep<typeof TraceCleanupSolver> | PipelineStep<typeof Example28Solver> | PipelineStep<typeof AvailableNetOrientationSolver> | PipelineStep<typeof RailNetLabelCornerPlacementSolver> | PipelineStep<typeof TraceAnchoredNetLabelOverlapSolver> | PipelineStep<typeof NetLabelTraceCollisionSolver> | PipelineStep<typeof NetLabelNetLabelCollisionSolver> | PipelineStep<typeof SameNetJunctionAlignmentSolver> | PipelineStep<typeof InlineNetLabelSolver>)[];
1411
+ pipelineDef: (PipelineStep<typeof MspConnectionPairSolver> | PipelineStep<typeof SchematicTraceLinesSolver> | PipelineStep<typeof LongDistancePairSolver> | PipelineStep<typeof UnroutedTraceRecoverySolver> | PipelineStep<typeof TraceOverlapShiftSolver> | PipelineStep<typeof NetLabelPlacementSolver> | PipelineStep<typeof TraceLabelOverlapAvoidanceSolver> | PipelineStep<typeof TraceElbowTransitionSimplificationSolver> | PipelineStep<typeof TraceCleanupSolver> | PipelineStep<typeof Example28Solver> | PipelineStep<typeof AvailableNetOrientationSolver> | PipelineStep<typeof RailNetLabelCornerPlacementSolver> | PipelineStep<typeof TraceAnchoredNetLabelOverlapSolver> | PipelineStep<typeof NetLabelTraceCollisionSolver> | PipelineStep<typeof NetLabelNetLabelCollisionSolver> | PipelineStep<typeof SameNetJunctionAlignmentSolver> | PipelineStep<typeof InlineNetLabelSolver> | PipelineStep<typeof NetLabelToTraceSolver>)[];
1351
1412
  constructor(inputProblem: InputProblem, opts?: Options);
1352
1413
  getConstructorParams(): ConstructorParameters<typeof SchematicTracePipelineSolver>;
1353
1414
  currentPipelineStepIndex: number;
@@ -1363,4 +1424,4 @@ declare class SchematicTracePipelineSolver extends BaseSolver {
1363
1424
  preview(): GraphicsObject;
1364
1425
  }
1365
1426
 
1366
- export { type ChipId, DEFAULT_INLINE_NET_LABEL_HEIGHT, INLINE_NET_LABEL_MAX_SPAN_JOG, INLINE_NET_LABEL_STUB_TRACE_CLEARANCE, INLINE_NET_LABEL_TRACE_MARGIN, type InlineNetLabelPlacement, InlineNetLabelSolver, type InputChip, type InputDirectConnection, type InputNetConnection, type InputPin, type InputProblem, type NetId, type NetLabelPlacement, type PinId, SchematicTracePipelineSolver, SchematicTraceSingleLineSolver2, type SectionId, type TextBoxes, estimateInlineNetLabelWidth };
1427
+ export { type ChipId, DEFAULT_INLINE_NET_LABEL_HEIGHT, INLINE_NET_LABEL_MAX_SPAN_JOG, INLINE_NET_LABEL_STUB_TRACE_CLEARANCE, INLINE_NET_LABEL_TRACE_MARGIN, type InlineNetLabelOutput, type InlineNetLabelPlacement, InlineNetLabelSolver, type InputChip, type InputDirectConnection, type InputNetConnection, type InputPin, type InputProblem, type NetId, type NetLabelPlacement, type PinId, SchematicTracePipelineSolver, SchematicTraceSingleLineSolver2, type SectionId, type TextBoxes, estimateInlineNetLabelWidth, visualizeInlineNetLabelOutput };