@tscircuit/internal-dynamic-import 0.0.16 → 0.0.17

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 (30) hide show
  1. package/README.md +112 -14
  2. package/dist/index.d.ts +624 -3
  3. package/dist/index.js +72 -28
  4. package/dist/index.js.map +1 -1
  5. package/lib/create-importer.ts +27 -0
  6. package/lib/dynamic-import-resolver.ts +58 -0
  7. package/lib/dynamic-module-registry.ts +37 -0
  8. package/lib/import-urls.ts +27 -0
  9. package/lib/index.ts +46 -0
  10. package/lib/supported-modules.ts +88 -0
  11. package/lib/type-bundles/@tscircuit/circuit-json-schematic-placement-analysis.d.ts +593 -0
  12. package/lib/type-bundles/circuit-json-to-3d-png.d.ts +48 -0
  13. package/lib/type-bundles/circuit-json-to-bom-csv.d.ts +36 -0
  14. package/lib/type-bundles/circuit-json-to-bpc.d.ts +15 -0
  15. package/lib/type-bundles/circuit-json-to-connectivity-map.d.ts +44 -0
  16. package/lib/type-bundles/circuit-json-to-fdm-component-box.d.ts +160 -0
  17. package/lib/type-bundles/circuit-json-to-gerber.d.ts +672 -0
  18. package/lib/type-bundles/circuit-json-to-gltf.d.ts +273 -0
  19. package/lib/type-bundles/circuit-json-to-kicad.d.ts +392 -0
  20. package/lib/type-bundles/circuit-json-to-lbrn.d.ts +54 -0
  21. package/lib/type-bundles/circuit-json-to-pnp-csv.d.ts +15 -0
  22. package/lib/type-bundles/circuit-json-to-readable-netlist.d.ts +5 -0
  23. package/lib/type-bundles/circuit-json-to-simple-3d.d.ts +41 -0
  24. package/lib/type-bundles/circuit-json-to-spice.d.ts +242 -0
  25. package/lib/type-bundles/circuit-json-to-step.d.ts +28 -0
  26. package/lib/type-bundles/circuit-json-to-tscircuit.d.ts +14 -0
  27. package/lib/type-bundles/circuit-to-canvas.d.ts +646 -0
  28. package/lib/type-bundles/circuit-to-svg.d.ts +399 -0
  29. package/lib/type-bundles/kicad-to-circuit-json.d.ts +375 -0
  30. package/package.json +10 -3
@@ -0,0 +1,593 @@
1
+ import { CircuitJson } from 'circuit-json';
2
+
3
+ interface SchematicBoxPlacement {
4
+ positionAnchor: "center";
5
+ schX: number;
6
+ schY: number;
7
+ width: number;
8
+ height: number;
9
+ schematicSheetId?: string;
10
+ schematicSheetName?: string;
11
+ sourceComponentId?: string;
12
+ sourceComponentName?: string;
13
+ schematicComponentId?: string;
14
+ schematicSymbolId?: string;
15
+ subcircuitId?: string;
16
+ }
17
+ interface SchematicBoxPlacementLineItem extends SchematicBoxPlacement {
18
+ lineItemType: "SchematicBoxPlacement";
19
+ }
20
+ interface ComponentOverlap {
21
+ lineItemType: "ComponentOverlap";
22
+ firstComponent: SchematicBoxPlacement;
23
+ secondComponent: SchematicBoxPlacement;
24
+ overlapWidth: number;
25
+ overlapHeight: number;
26
+ correctionSuggestions: OverlapCorrectionSuggestion[];
27
+ }
28
+ interface OverlapCorrectionSuggestion {
29
+ targetComponentName?: string;
30
+ deltaSchX: number;
31
+ deltaSchY: number;
32
+ newSchX: number;
33
+ newSchY: number;
34
+ }
35
+ interface SchematicBoxHasALotOfSurroundingWhitespace {
36
+ lineItemType: "SchematicBoxHasALotOfSurroundingWhitespace";
37
+ schematicBox: SchematicBoxPlacement;
38
+ whitespaceLeft: number;
39
+ whitespaceRight: number;
40
+ whitespaceTop: number;
41
+ whitespaceBottom: number;
42
+ }
43
+ interface CapacitorSymbolHorizontal {
44
+ lineItemType: "CapacitorSymbolHorizontal";
45
+ schematicBox: SchematicBoxPlacement;
46
+ message: string;
47
+ }
48
+ /** A power-to-ground capacitor bank is spread out within one schematic block. */
49
+ interface DecouplingCapacitorsNotCloseTogether {
50
+ lineItemType: "DecouplingCapacitorsNotCloseTogether";
51
+ railName: string;
52
+ groundName: string;
53
+ /** All capacitors in this bank, sharing supply, return, and schematic scope. */
54
+ capacitorSchematicBoxes: SchematicBoxPlacement[];
55
+ /** Largest body gap required to connect the bank through neighboring capacitors. */
56
+ maxBodyGap: number;
57
+ maxRecommendedBodyGap: number;
58
+ message: string;
59
+ }
60
+ interface VerboseSchematicNetLabel {
61
+ lineItemType: "VerboseSchematicNetLabel";
62
+ schematicNetLabelId?: string;
63
+ sourceNetId?: string;
64
+ schematicSheetId?: string;
65
+ schematicSheetName?: string;
66
+ text: string;
67
+ involvedPins: string[];
68
+ schX: number;
69
+ schY: number;
70
+ message: string;
71
+ }
72
+ interface BaseSchematicBoxTooWide {
73
+ schematicBox: SchematicBoxPlacement;
74
+ measuredInnerLabelHorizontalEmptySpace: number;
75
+ maxAllowedInnerLabelHorizontalEmptySpace: number;
76
+ suggestedSchWidth: number;
77
+ message: string;
78
+ }
79
+ interface PinHeaderSchematicBoxTooWide extends BaseSchematicBoxTooWide {
80
+ lineItemType: "PinHeaderSchematicBoxTooWide";
81
+ }
82
+ interface GenericSchematicBoxTooWide extends BaseSchematicBoxTooWide {
83
+ lineItemType: "GenericSchematicBoxTooWide";
84
+ }
85
+ type SchematicBoxTooWideIssue = PinHeaderSchematicBoxTooWide | GenericSchematicBoxTooWide;
86
+ interface SchematicBoxInnerLabelCollision {
87
+ lineItemType: "SchematicBoxInnerLabelCollision";
88
+ schematicBox: SchematicBoxPlacement;
89
+ overlappingSides: SchematicSide[];
90
+ message: string;
91
+ }
92
+ type SchematicSide = "left" | "right" | "top" | "bottom";
93
+ type SchematicPortFacingDirection = "left" | "right" | "up" | "down";
94
+ interface SchematicPinPaddingToEdgeTooLarge {
95
+ lineItemType: "SchematicPinPaddingToEdgeTooLarge";
96
+ pinSide: SchematicSide;
97
+ edgeSide: SchematicSide;
98
+ pinName?: string;
99
+ schematicBox: SchematicBoxPlacement;
100
+ measuredPadding: number;
101
+ maxAllowedPadding: number;
102
+ excessPadding: number;
103
+ /** All excessive gaps for this box; scalar gap fields identify the worst gap. */
104
+ paddingDetails?: Array<{
105
+ pinSide: SchematicSide;
106
+ edgeSide: SchematicSide;
107
+ pinName?: string;
108
+ measuredPadding: number;
109
+ maxAllowedPadding: number;
110
+ excessPadding: number;
111
+ }>;
112
+ suggestedSchWidth?: number;
113
+ suggestedSchHeight?: number;
114
+ message: string;
115
+ }
116
+ interface DiodeResistorNotAligned {
117
+ lineItemType: "DiodeResistorNotAligned";
118
+ diodeSchematicBox: SchematicBoxPlacement;
119
+ resistorSchematicBox: SchematicBoxPlacement;
120
+ diodePin?: string;
121
+ resistorPin?: string;
122
+ diodePinFacingDirection?: string;
123
+ resistorPinFacingDirection?: string;
124
+ message: string;
125
+ }
126
+ /** Readability advisory for a local diode/resistor pair across the same two nets. */
127
+ interface ParallelDiodeResistorNotAligned {
128
+ lineItemType: "ParallelDiodeResistorNotAligned";
129
+ diodeSchematicBox: SchematicBoxPlacement;
130
+ resistorSchematicBox: SchematicBoxPlacement;
131
+ reason: "different_axes" | "crossed_connections" | "staggered";
132
+ message: string;
133
+ }
134
+ interface ComponentPinsWouldAlignWithVerticalShift {
135
+ lineItemType: "ComponentPinsWouldAlignWithVerticalShift";
136
+ firstComponent: SchematicBoxPlacement;
137
+ secondComponent: SchematicBoxPlacement;
138
+ targetComponent: SchematicBoxPlacement;
139
+ deltaSchY: number;
140
+ newSchY: number;
141
+ currentlyAlignedPinCount: number;
142
+ alignedPinCount: number;
143
+ alignedPinPairs: Array<{
144
+ firstPin?: string;
145
+ secondPin?: string;
146
+ }>;
147
+ message: string;
148
+ }
149
+ interface TraceCanBeSimplifiedByMovingComponent {
150
+ lineItemType: "TraceCanBeSimplifiedByMovingComponent";
151
+ schematicTraceId: string;
152
+ traceName?: string;
153
+ targetComponent: SchematicBoxPlacement;
154
+ deltaSchX: number;
155
+ deltaSchY: number;
156
+ newSchX: number;
157
+ newSchY: number;
158
+ currentTurnCount: number;
159
+ suggestedTurnCount: number;
160
+ /** Collision-checked calculate-elbow routes after applying this move. */
161
+ suggestedTraces?: Array<{
162
+ schematicTraceId: string;
163
+ points: Array<{
164
+ x: number;
165
+ y: number;
166
+ }>;
167
+ }>;
168
+ message: string;
169
+ }
170
+ interface CrystalNotCenteredOverLoadCapacitors {
171
+ lineItemType: "CrystalNotCenteredOverLoadCapacitors";
172
+ crystalSchematicBox: SchematicBoxPlacement;
173
+ firstLoadCapacitorSchematicBox: SchematicBoxPlacement;
174
+ secondLoadCapacitorSchematicBox: SchematicBoxPlacement;
175
+ deltaSchX: number;
176
+ deltaSchY: number;
177
+ newSchX: number;
178
+ newSchY: number;
179
+ message: string;
180
+ }
181
+ interface TwoPinComponentCouldBeFlipped {
182
+ lineItemType: "TwoPinComponentCouldBeFlipped";
183
+ schematicTraceId: string;
184
+ traceName?: string;
185
+ targetComponent: SchematicBoxPlacement;
186
+ connectedComponent: SchematicBoxPlacement;
187
+ targetPin?: string;
188
+ currentFacingDirection: SchematicPortFacingDirection;
189
+ suggestedFacingDirection: SchematicPortFacingDirection;
190
+ deltaSchRotation: 180;
191
+ currentTurnCount: number;
192
+ suggestedTurnCount: number;
193
+ message: string;
194
+ }
195
+ /** Advisory: a direct negative-feedback R/C network is far from its amplifier. */
196
+ interface FeedbackNetworkNotCompact {
197
+ lineItemType: "FeedbackNetworkNotCompact";
198
+ amplifierSchematicBox: SchematicBoxPlacement;
199
+ feedbackComponents: SchematicBoxPlacement[];
200
+ distantComponents: Array<{
201
+ schematicBox: SchematicBoxPlacement;
202
+ bodyGap: number;
203
+ maxRecommendedBodyGap: number;
204
+ }>;
205
+ outputSourcePortId: string;
206
+ invertingInputSourcePortId: string;
207
+ message: string;
208
+ }
209
+ /** Advisory: an explicitly identified pull resistor is far on the unconventional side. */
210
+ interface PullResistorOnWrongSide {
211
+ lineItemType: "PullResistorOnWrongSide";
212
+ resistorSchematicBox: SchematicBoxPlacement;
213
+ hostSchematicBox: SchematicBoxPlacement;
214
+ signalSourcePortId: string;
215
+ signalPinName: string;
216
+ signalSchY: number;
217
+ pullDirection: "up" | "down";
218
+ preferredSide: "above" | "below";
219
+ wrongSideGap: number;
220
+ maxRecommendedWrongSideGap: number;
221
+ message: string;
222
+ }
223
+ interface TwoPinComponentRailOrientation {
224
+ schematicBox: SchematicBoxPlacement;
225
+ railSourcePortId: string;
226
+ railPinName: string;
227
+ railType: "power" | "ground";
228
+ suggestedRailFacingDirection: "up" | "down";
229
+ message: string;
230
+ }
231
+ interface TwoPinComponentShouldBeVertical extends TwoPinComponentRailOrientation {
232
+ lineItemType: "TwoPinComponentShouldBeVertical";
233
+ deltaSchRotation: -90 | 90;
234
+ }
235
+ /** A vertical component has a positive supply below its ground pin or a resistor's signal pin. */
236
+ interface TwoPinComponentHasInvertedRails extends TwoPinComponentRailOrientation {
237
+ lineItemType: "TwoPinComponentHasInvertedRails";
238
+ railType: "power";
239
+ deltaSchRotation: 180;
240
+ suggestedRailFacingDirection: "up";
241
+ }
242
+ interface ComponentNetLabelCollision {
243
+ lineItemType: "ComponentNetLabelCollision";
244
+ firstComponent: SchematicBoxPlacement;
245
+ secondComponent: SchematicBoxPlacement;
246
+ message: string;
247
+ overlappingLabel1Bounds: {
248
+ left: number;
249
+ right: number;
250
+ top: number;
251
+ bottom: number;
252
+ };
253
+ overlappingLabel2Bounds: {
254
+ left: number;
255
+ right: number;
256
+ top: number;
257
+ bottom: number;
258
+ };
259
+ suggestion?: {
260
+ componentName: string;
261
+ newSchX: number;
262
+ newSchY: number;
263
+ };
264
+ }
265
+ interface ComponentBoxNetLabelCollision {
266
+ lineItemType: "ComponentBoxNetLabelCollision";
267
+ boxComponent: SchematicBoxPlacement;
268
+ labelComponent: SchematicBoxPlacement;
269
+ message: string;
270
+ boxBounds: {
271
+ left: number;
272
+ right: number;
273
+ top: number;
274
+ bottom: number;
275
+ };
276
+ labelBounds: {
277
+ left: number;
278
+ right: number;
279
+ top: number;
280
+ bottom: number;
281
+ };
282
+ suggestion?: {
283
+ componentName: string;
284
+ newSchX: number;
285
+ newSchY: number;
286
+ };
287
+ }
288
+ interface SchematicIssueBounds {
289
+ left: number;
290
+ right: number;
291
+ top: number;
292
+ bottom: number;
293
+ }
294
+ interface NetLabelCollision {
295
+ lineItemType: "NetLabelCollision";
296
+ schematicSheetId?: string;
297
+ schematicSheetName?: string;
298
+ /** Actual intersection regions in schematic coordinates (Y up).
299
+ * Optional for compatibility with previously serialized reports. */
300
+ collisionBounds?: SchematicIssueBounds[];
301
+ pairs: Array<{
302
+ comp1Name: string;
303
+ comp2Name: string;
304
+ }>;
305
+ moves: Array<{
306
+ componentName: string;
307
+ newSchX: number;
308
+ newSchY: number;
309
+ }>;
310
+ }
311
+ interface SchematicTextCollisionObject {
312
+ type: "text" | "trace" | "component";
313
+ id: string;
314
+ text?: string;
315
+ componentName?: string;
316
+ schematicComponentId?: string;
317
+ }
318
+ interface SchematicTextCollision {
319
+ lineItemType: "SchematicTextCollision";
320
+ schematicSheetId?: string;
321
+ schematicSheetName?: string;
322
+ schematicTextId: string;
323
+ text: string;
324
+ collidingObject: SchematicTextCollisionObject;
325
+ textBounds: {
326
+ left: number;
327
+ right: number;
328
+ top: number;
329
+ bottom: number;
330
+ };
331
+ collidingObjectBounds: {
332
+ left: number;
333
+ right: number;
334
+ top: number;
335
+ bottom: number;
336
+ };
337
+ /** A clear text-anchor position for this issue; reanalyze after applying it. */
338
+ suggestedMove?: {
339
+ newSchX: number;
340
+ newSchY: number;
341
+ };
342
+ message: string;
343
+ }
344
+ interface ResetNetworkNotGrouped {
345
+ lineItemType: "ResetNetworkNotGrouped";
346
+ /** The component whose reset pin is served by this network. */
347
+ hostSchematicBox: SchematicBoxPlacement;
348
+ resetSourcePortId: string;
349
+ resetPinName: string;
350
+ /** Reset pull-up, capacitor, and any associated test points; excludes the host. */
351
+ supportNetworkComponents: SchematicBoxPlacement[];
352
+ maxDistanceFromResetPin: number;
353
+ maxRecommendedDistance: number;
354
+ message: string;
355
+ }
356
+ interface ConnectorPositionCausesTraceDetours {
357
+ lineItemType: "ConnectorPositionCausesTraceDetours";
358
+ connectorSchematicBox: SchematicBoxPlacement;
359
+ connectedComponents: SchematicBoxPlacement[];
360
+ /** Existing routed signal connections that demonstrate the detours. */
361
+ schematicTraceIds: string[];
362
+ evaluatedSignalCount: number;
363
+ newSchX: number;
364
+ newSchY: number;
365
+ deltaSchX: number;
366
+ deltaSchY: number;
367
+ /** Sum of Manhattan distances between the evaluated signal pins. */
368
+ currentTotalSignalDistance: number;
369
+ /** Sum of Manhattan pin distances after moving; not a promised routed length. */
370
+ suggestedTotalSignalDistance: number;
371
+ message: string;
372
+ }
373
+ /** Advisory for a grounded-emitter NPN switch; no automatic move is implied. */
374
+ interface LowSideTransistorNotAlignedWithLoad {
375
+ lineItemType: "LowSideTransistorNotAlignedWithLoad";
376
+ transistorSchematicBox: SchematicBoxPlacement;
377
+ loadSchematicBox: SchematicBoxPlacement;
378
+ baseResistorSchematicBox: SchematicBoxPlacement;
379
+ clampDiodeSchematicBox: SchematicBoxPlacement;
380
+ collectorSourcePortId: string;
381
+ emitterSourcePortId: string;
382
+ collectorFacingDirection: SchematicPortFacingDirection;
383
+ emitterFacingDirection: SchematicPortFacingDirection;
384
+ placementProblems: Array<"transistor_not_below_load" | "collector_not_up" | "emitter_not_down">;
385
+ message: string;
386
+ }
387
+ /** Advisory for an electrically identified USB series pair drawn end-to-end. */
388
+ interface UsbSeriesResistorsNotAligned {
389
+ lineItemType: "UsbSeriesResistorsNotAligned";
390
+ positiveResistorSchematicBox: SchematicBoxPlacement;
391
+ negativeResistorSchematicBox: SchematicBoxPlacement;
392
+ hostSourceComponentId: string;
393
+ positiveSourcePortId: string;
394
+ negativeSourcePortId: string;
395
+ signalAxis: "horizontal" | "vertical";
396
+ message: string;
397
+ }
398
+ /** Advisory for a regulator's local input/output capacitor pair on reversed sides. */
399
+ interface RegulatorCapacitorsOnWrongSides {
400
+ lineItemType: "RegulatorCapacitorsOnWrongSides";
401
+ regulatorSchematicBox: SchematicBoxPlacement;
402
+ inputCapacitorSchematicBox: SchematicBoxPlacement;
403
+ outputCapacitorSchematicBox: SchematicBoxPlacement;
404
+ inputSourcePortId: string;
405
+ outputSourcePortId: string;
406
+ message: string;
407
+ }
408
+ /** Advisory: a vertical divider's supply resistor lies clearly below its ground resistor. */
409
+ interface VoltageDividerSupplyResistorBelowGroundResistor {
410
+ lineItemType: "VoltageDividerSupplyResistorBelowGroundResistor";
411
+ supplyResistorSchematicBox: SchematicBoxPlacement;
412
+ groundResistorSchematicBox: SchematicBoxPlacement;
413
+ supplyTapSourcePortId: string;
414
+ groundTapSourcePortId: string;
415
+ reversedBodyGap: number;
416
+ message: string;
417
+ }
418
+ /** Series gate and gate-source resistors scattered away from their MOSFET. */
419
+ interface MosfetGateNetworkNotGrouped {
420
+ lineItemType: "MosfetGateNetworkNotGrouped";
421
+ mosfetSchematicBox: SchematicBoxPlacement;
422
+ seriesGateResistorSchematicBox: SchematicBoxPlacement;
423
+ gateSourceResistorSchematicBox: SchematicBoxPlacement;
424
+ /** Largest body-to-body gap from either resistor to the MOSFET. */
425
+ maxBodyGap: number;
426
+ maxRecommendedBodyGap: number;
427
+ message: string;
428
+ }
429
+ /** A local flyback diode separated from the relay coil it protects. */
430
+ interface FlybackDiodeSeparatedFromRelayCoil {
431
+ lineItemType: "FlybackDiodeSeparatedFromRelayCoil";
432
+ relaySchematicBox: SchematicBoxPlacement;
433
+ diodeSchematicBox: SchematicBoxPlacement;
434
+ coilSourcePortIds: [string, string];
435
+ distanceFromCoilPins: number;
436
+ message: string;
437
+ }
438
+ /** Advisory for a displaced local shunt with one sense branch split by labels. */
439
+ interface CurrentSenseShuntSeparatedFromInputs {
440
+ lineItemType: "CurrentSenseShuntSeparatedFromInputs";
441
+ amplifierSchematicBox: SchematicBoxPlacement;
442
+ shuntSchematicBox: SchematicBoxPlacement;
443
+ positiveInputSourcePortId: string;
444
+ negativeInputSourcePortId: string;
445
+ /** Gap from the shunt body to the band spanned by the two input pins. */
446
+ inputBandGap: number;
447
+ message: string;
448
+ }
449
+ /** A capacitor placed far across its host chip from its two connected pins. */
450
+ interface CapacitorSeparatedFromChipPins {
451
+ lineItemType: "CapacitorSeparatedFromChipPins";
452
+ hostSchematicBox: SchematicBoxPlacement;
453
+ capacitorSchematicBox: SchematicBoxPlacement;
454
+ /** Connected chip pins, in the order of the capacitor's source ports. */
455
+ chipSourcePortIds: [string, string];
456
+ maxPinDistance: number;
457
+ maxRecommendedPinDistance: number;
458
+ message: string;
459
+ }
460
+ /** The series element and grounded shunt branches of a signal pi filter are separated. */
461
+ interface PiFilterComponentsNotGrouped {
462
+ lineItemType: "PiFilterComponentsNotGrouped";
463
+ inductorSchematicBox: SchematicBoxPlacement;
464
+ firstCapacitorSchematicBox: SchematicBoxPlacement;
465
+ secondCapacitorSchematicBox: SchematicBoxPlacement;
466
+ /** Longest direct distance between electrically connected inductor/capacitor pins. */
467
+ maxSignalPinDistance: number;
468
+ maxRecommendedSignalPinDistance: number;
469
+ message: string;
470
+ }
471
+ /** Readability advisory for a physically continuous local path to an explicit rail. */
472
+ interface RailPathTooSpreadOut {
473
+ lineItemType: "RailPathTooSpreadOut";
474
+ hostSchematicBox: SchematicBoxPlacement;
475
+ sourcePortId: string;
476
+ /** Display name for user-facing diagnostics; identity remains sourcePortId. */
477
+ sourcePortName?: string;
478
+ railType: "power" | "ground";
479
+ supportSchematicBoxes: SchematicBoxPlacement[];
480
+ schematicTraceIds: string[];
481
+ pathPoints: Array<{
482
+ x: number;
483
+ y: number;
484
+ }>;
485
+ pathBounds: SchematicIssueBounds;
486
+ pathLength: number;
487
+ pathSpan: number;
488
+ maxRecommendedSpan: number;
489
+ maxRecommendedPathLength: number;
490
+ message: string;
491
+ }
492
+ type SchematicPlacementIssue = RailPathTooSpreadOut | CapacitorSeparatedFromChipPins | PiFilterComponentsNotGrouped | MosfetGateNetworkNotGrouped | FlybackDiodeSeparatedFromRelayCoil | CurrentSenseShuntSeparatedFromInputs | VoltageDividerSupplyResistorBelowGroundResistor | RegulatorCapacitorsOnWrongSides | UsbSeriesResistorsNotAligned | LowSideTransistorNotAlignedWithLoad | ComponentOverlap | SchematicBoxHasALotOfSurroundingWhitespace | CapacitorSymbolHorizontal | DecouplingCapacitorsNotCloseTogether | VerboseSchematicNetLabel | SchematicBoxTooWideIssue | SchematicBoxInnerLabelCollision | SchematicPinPaddingToEdgeTooLarge | DiodeResistorNotAligned | ParallelDiodeResistorNotAligned | ComponentPinsWouldAlignWithVerticalShift | TraceCanBeSimplifiedByMovingComponent | CrystalNotCenteredOverLoadCapacitors | TwoPinComponentCouldBeFlipped | FeedbackNetworkNotCompact | PullResistorOnWrongSide | TwoPinComponentShouldBeVertical | TwoPinComponentHasInvertedRails | ComponentNetLabelCollision | ComponentBoxNetLabelCollision | NetLabelCollision | SchematicTextCollision | ResetNetworkNotGrouped | ConnectorPositionCausesTraceDetours;
493
+ interface SchematicPlacementIssues {
494
+ lineItemType: "SchematicPlacementIssues";
495
+ issues: SchematicPlacementIssue[];
496
+ }
497
+ type SchematicPlacementLineItem = SchematicBoxPlacementLineItem | SchematicPlacementIssues;
498
+ /** Select issue types to execute; omitted runs all checks, [] runs none. */
499
+ interface SchematicPlacementAnalysisOptions {
500
+ /** Schematic drawing units, not PCB dimensions. Defaults: span 8, length 16. */
501
+ railPathVisibility?: {
502
+ maxSpan?: number;
503
+ maxPathLength?: number;
504
+ };
505
+ issueTypes?: readonly SchematicPlacementIssue["lineItemType"][];
506
+ }
507
+
508
+ declare class SchematicPlacementAnalysis {
509
+ private readonly lineItems;
510
+ private readonly groupBySchematicSheet;
511
+ constructor(lineItems: SchematicPlacementLineItem[], groupBySchematicSheet?: boolean);
512
+ getLineItems(): SchematicPlacementLineItem[];
513
+ /** Filter emitted issues without rerunning or changing the solvers. */
514
+ getIssues(filter?: {
515
+ issueTypes?: readonly SchematicPlacementIssue["lineItemType"][];
516
+ schematicSheetId?: string;
517
+ }): SchematicPlacementIssue[];
518
+ /** Counts emitted issue objects, including zero counts for known types. */
519
+ getIssueCounts(filter?: {
520
+ schematicSheetId?: string;
521
+ }): {
522
+ FlybackDiodeSeparatedFromRelayCoil: number;
523
+ ComponentOverlap: number;
524
+ SchematicBoxHasALotOfSurroundingWhitespace: number;
525
+ CapacitorSymbolHorizontal: number;
526
+ VerboseSchematicNetLabel: number;
527
+ PinHeaderSchematicBoxTooWide: number;
528
+ GenericSchematicBoxTooWide: number;
529
+ SchematicBoxInnerLabelCollision: number;
530
+ SchematicPinPaddingToEdgeTooLarge: number;
531
+ DiodeResistorNotAligned: number;
532
+ ParallelDiodeResistorNotAligned: number;
533
+ ComponentPinsWouldAlignWithVerticalShift: number;
534
+ TraceCanBeSimplifiedByMovingComponent: number;
535
+ CrystalNotCenteredOverLoadCapacitors: number;
536
+ ComponentNetLabelCollision: number;
537
+ ComponentBoxNetLabelCollision: number;
538
+ NetLabelCollision: number;
539
+ FeedbackNetworkNotCompact: number;
540
+ PullResistorOnWrongSide: number;
541
+ SchematicTextCollision: number;
542
+ ResetNetworkNotGrouped: number;
543
+ TwoPinComponentCouldBeFlipped: number;
544
+ TwoPinComponentShouldBeVertical: number;
545
+ TwoPinComponentHasInvertedRails: number;
546
+ DecouplingCapacitorsNotCloseTogether: number;
547
+ ConnectorPositionCausesTraceDetours: number;
548
+ LowSideTransistorNotAlignedWithLoad: number;
549
+ UsbSeriesResistorsNotAligned: number;
550
+ RegulatorCapacitorsOnWrongSides: number;
551
+ VoltageDividerSupplyResistorBelowGroundResistor: number;
552
+ CurrentSenseShuntSeparatedFromInputs: number;
553
+ PiFilterComponentsNotGrouped: number;
554
+ MosfetGateNetworkNotGrouped: number;
555
+ CapacitorSeparatedFromChipPins: number;
556
+ RailPathTooSpreadOut: number;
557
+ };
558
+ getString(): string;
559
+ schematicBoxPlacementsToString(lineItem: SchematicBoxPlacementLineItem): string;
560
+ schematicIssuesToString(issue: SchematicPlacementIssue): string;
561
+ toString(): string;
562
+ private issueContextToLines;
563
+ }
564
+ declare const analyzeSchematicPlacement: (circuitJson: CircuitJson, options?: SchematicPlacementAnalysisOptions) => SchematicPlacementAnalysis;
565
+
566
+ interface SchematicPlacementIssueArtifact {
567
+ /** Stable within this analysis, even when filtering the returned artifacts. */
568
+ issueIndex: number;
569
+ issue: SchematicPlacementIssue;
570
+ schematicSheetId?: string;
571
+ /** Unpadded issue geometry and involved component bounds; schematic units, Y up. */
572
+ bounds?: SchematicIssueBounds;
573
+ descriptionXml: string;
574
+ fileName: string;
575
+ contentType: "image/svg+xml";
576
+ /** A cropped schematic with just this issue's overlay and its XML underneath. */
577
+ content: string;
578
+ }
579
+ interface SchematicPlacementIssueArtifactOptions {
580
+ /** Reuse an analysis of the same circuit to avoid running the solvers again. */
581
+ analysis?: SchematicPlacementAnalysis;
582
+ issueTypes?: readonly SchematicPlacementIssue["lineItemType"][];
583
+ schematicSheetId?: string;
584
+ /** Width and height of the schematic panel; the XML panel adds to total height. */
585
+ width?: number;
586
+ height?: number;
587
+ }
588
+ /** Create one self-contained SVG per emitted issue, without filesystem access.
589
+ * No issues (or no filter matches) returns []. Other issues' overlays, counts,
590
+ * and XML are excluded; surrounding schematic elements remain as context. */
591
+ declare function createSchematicPlacementIssueArtifacts(circuitJson: CircuitJson, options?: SchematicPlacementIssueArtifactOptions): SchematicPlacementIssueArtifact[];
592
+
593
+ export { SchematicPlacementAnalysis, type SchematicPlacementIssueArtifact, analyzeSchematicPlacement, createSchematicPlacementIssueArtifacts };
@@ -0,0 +1,48 @@
1
+ import * as circuit_json_to_gltf from 'circuit-json-to-gltf';
2
+ import { AnyCircuitElement } from 'circuit-json';
3
+
4
+ type CameraOptions = {
5
+ camPos: readonly [number, number, number];
6
+ lookAt: readonly [number, number, number];
7
+ fov: number;
8
+ };
9
+ declare const CAMERA_PRESETS: {
10
+ readonly "top-down": (cam: CameraOptions) => CameraOptions;
11
+ readonly "top-down-ortho": (cam: CameraOptions) => CameraOptions;
12
+ readonly "top-left-corner": (cam: CameraOptions) => CameraOptions;
13
+ readonly "top-left": (cam: CameraOptions) => CameraOptions;
14
+ readonly "top-right-corner": (cam: CameraOptions) => CameraOptions;
15
+ readonly "top-right": (cam: CameraOptions) => CameraOptions;
16
+ readonly "left-sideview": (cam: CameraOptions) => CameraOptions;
17
+ readonly "right-sideview": (cam: CameraOptions) => CameraOptions;
18
+ readonly front: (cam: CameraOptions) => CameraOptions;
19
+ readonly "top-center-angled": (cam: CameraOptions) => CameraOptions;
20
+ };
21
+ type CameraPreset = keyof typeof CAMERA_PRESETS;
22
+ declare const CAMERA_PRESET_NAMES: CameraPreset[];
23
+ declare function applyCameraPreset(preset: CameraPreset, cam: CameraOptions): CameraOptions;
24
+
25
+ type ConvertCircuitJsonTo3dGltfResult = Awaited<ReturnType<typeof circuit_json_to_gltf["convertCircuitJsonToGltf"]>>;
26
+ type CircuitJson3dBaseOptions = {
27
+ modelPathBaseDir?: string;
28
+ projectBaseUrl?: string;
29
+ authHeaders?: {
30
+ Authorization: string;
31
+ };
32
+ boardTextureResolution?: number;
33
+ };
34
+ type RenderCircuitJsonTo3dPngOptions = CircuitJson3dBaseOptions & {
35
+ camera?: CameraOptions;
36
+ cameraPreset?: CameraPreset;
37
+ width?: number;
38
+ height?: number;
39
+ backgroundColor?: string | readonly [number, number, number] | null;
40
+ showInfiniteGrid?: boolean;
41
+ supersampling?: number;
42
+ };
43
+ declare const getDefaultCameraForCircuitJson: (circuitJson: AnyCircuitElement[]) => Promise<CameraOptions>;
44
+ declare const convertCircuitJsonTo3dGltf: (circuitJson: AnyCircuitElement[], options?: CircuitJson3dBaseOptions) => Promise<ConvertCircuitJsonTo3dGltfResult>;
45
+ declare const convertCircuitJsonTo3dGlb: (circuitJson: AnyCircuitElement[], options?: CircuitJson3dBaseOptions) => Promise<Uint8Array>;
46
+ declare const renderCircuitJsonTo3dPng: (circuitJson: AnyCircuitElement[], options?: RenderCircuitJsonTo3dPngOptions) => Promise<Uint8Array>;
47
+
48
+ export { CAMERA_PRESET_NAMES, type CameraOptions, type CameraPreset, type CircuitJson3dBaseOptions, type ConvertCircuitJsonTo3dGltfResult, type RenderCircuitJsonTo3dPngOptions, applyCameraPreset, convertCircuitJsonTo3dGlb, convertCircuitJsonTo3dGltf, getDefaultCameraForCircuitJson, renderCircuitJsonTo3dPng };
@@ -0,0 +1,36 @@
1
+ import { AnyCircuitElement, SourceComponentBase, PcbComponent } from 'circuit-json';
2
+
3
+ type SupplierPartNumberColumn = "JLCPCB Part #";
4
+ interface BomRow {
5
+ designator: string;
6
+ comment: string;
7
+ value: string;
8
+ footprint: string;
9
+ supplier_part_number_columns?: Partial<Record<SupplierPartNumberColumn, string>>;
10
+ manufacturer_mpn_pairs?: Array<{
11
+ manufacturer: string;
12
+ mpn: string;
13
+ }>;
14
+ extra_columns?: Record<string, string>;
15
+ }
16
+ interface ResolvedPart {
17
+ part_number?: string;
18
+ footprint?: string;
19
+ comment?: string;
20
+ supplier_part_number_columns?: Record<SupplierPartNumberColumn, string>;
21
+ manufacturer_mpn_pairs?: Array<{
22
+ manufacturer: string;
23
+ mpn: string;
24
+ }>;
25
+ extra_columns?: Record<string, string>;
26
+ }
27
+ declare const convertCircuitJsonToBomRows: ({ circuitJson, resolvePart, }: {
28
+ circuitJson: AnyCircuitElement[];
29
+ resolvePart?: (part_info: {
30
+ source_component: SourceComponentBase;
31
+ pcb_component: PcbComponent;
32
+ }) => Promise<ResolvedPart | null>;
33
+ }) => Promise<BomRow[]>;
34
+ declare const convertBomRowsToCsv: (bom_rows: BomRow[]) => string;
35
+
36
+ export { convertBomRowsToCsv, convertCircuitJsonToBomRows };
@@ -0,0 +1,15 @@
1
+ import { CircuitJson, SchematicNetLabel } from 'circuit-json';
2
+ import { BpcGraph } from 'bpc-graph';
3
+
4
+ declare const convertCircuitJsonToBpc: (circuitJson: CircuitJson, opts?: {
5
+ inferNetLabels?: boolean;
6
+ useReadableIds?: boolean;
7
+ }) => BpcGraph;
8
+
9
+ /**
10
+ * Generate implicit net labels for schematic ports that belong to a net but
11
+ * are not connected via a trace. Existing labels are not duplicated.
12
+ */
13
+ declare const generateImplicitNetLabels: (circuitJson: CircuitJson) => SchematicNetLabel[];
14
+
15
+ export { convertCircuitJsonToBpc, generateImplicitNetLabels };