@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,399 @@
1
+ import { AnyCircuitElement, PcbPort, SimulationExperiment, SimulationTransientVoltageGraph, SimulationVoltageProbe, SchematicComponent } from 'circuit-json';
2
+ import { Matrix } from 'transformation-matrix';
3
+ import { INode } from 'svgson';
4
+
5
+ interface PcbGridOptions {
6
+ cellSize: number;
7
+ lineColor?: string;
8
+ majorCellSize?: number;
9
+ majorLineColor?: string;
10
+ }
11
+
12
+ type CopperLayerName = "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
13
+ type CopperColorMap = Record<CopperLayerName, string> & {
14
+ [layer: string]: string;
15
+ };
16
+ interface PcbColorMap {
17
+ copper: CopperColorMap;
18
+ drill: string;
19
+ silkscreen: {
20
+ top: string;
21
+ bottom: string;
22
+ };
23
+ boardOutline: string;
24
+ soldermask: {
25
+ top: string;
26
+ bottom: string;
27
+ };
28
+ soldermaskWithCopperUnderneath: {
29
+ top: string;
30
+ bottom: string;
31
+ };
32
+ soldermaskOverCopper: {
33
+ top: string;
34
+ bottom: string;
35
+ };
36
+ substrate: string;
37
+ courtyard: {
38
+ top: string;
39
+ bottom: string;
40
+ };
41
+ keepout?: string;
42
+ debugComponent: {
43
+ fill: string | null;
44
+ stroke: string | null;
45
+ };
46
+ }
47
+ interface PcbColorOverrides {
48
+ copper?: Partial<PcbColorMap["copper"]>;
49
+ drill?: string;
50
+ silkscreen?: Partial<PcbColorMap["silkscreen"]>;
51
+ boardOutline?: string;
52
+ soldermask?: Partial<PcbColorMap["soldermask"]>;
53
+ soldermaskWithCopperUnderneath?: Partial<PcbColorMap["soldermaskWithCopperUnderneath"]>;
54
+ soldermaskOverCopper?: Partial<PcbColorMap["soldermaskOverCopper"]>;
55
+ substrate?: string;
56
+ courtyard?: Partial<PcbColorMap["courtyard"]>;
57
+ keepout?: string;
58
+ debugComponent?: Partial<PcbColorMap["debugComponent"]>;
59
+ }
60
+
61
+ interface PcbSvgOptions {
62
+ colorOverrides?: PcbColorOverrides;
63
+ width?: number;
64
+ height?: number;
65
+ shouldDrawErrors?: boolean;
66
+ showErrorsInTextOverlay?: boolean;
67
+ shouldDrawRatsNest?: boolean;
68
+ showCourtyards?: boolean;
69
+ showPcbGroups?: boolean;
70
+ layer?: "top" | "bottom";
71
+ matchBoardAspectRatio?: boolean;
72
+ backgroundColor?: string;
73
+ drawPaddingOutsideBoard?: boolean;
74
+ includeVersion?: boolean;
75
+ showSolderMask?: boolean;
76
+ showPcbNotes?: boolean;
77
+ grid?: PcbGridOptions;
78
+ showAnchorOffsets?: boolean;
79
+ viewport?: {
80
+ minX: number;
81
+ minY: number;
82
+ maxX: number;
83
+ maxY: number;
84
+ };
85
+ viewportTarget?: {
86
+ pcb_panel_id?: string;
87
+ pcb_board_id?: string;
88
+ };
89
+ }
90
+ interface PcbContext {
91
+ transform: Matrix;
92
+ layer?: "top" | "bottom";
93
+ shouldDrawErrors?: boolean;
94
+ showCourtyards?: boolean;
95
+ showPcbGroups?: boolean;
96
+ drawPaddingOutsideBoard?: boolean;
97
+ colorMap: PcbColorMap;
98
+ showSolderMask?: boolean;
99
+ showPcbNotes?: boolean;
100
+ showAnchorOffsets?: boolean;
101
+ circuitJson?: AnyCircuitElement[];
102
+ }
103
+ declare function convertCircuitJsonToPcbSvg(circuitJson: AnyCircuitElement[], options?: PcbSvgOptions): string;
104
+ /**
105
+ * @deprecated use `convertCircuitJsonToPcbSvg` instead
106
+ */
107
+ declare const circuitJsonToPcbSvg: typeof convertCircuitJsonToPcbSvg;
108
+
109
+ interface Options$3 {
110
+ width?: number;
111
+ height?: number;
112
+ includeVersion?: boolean;
113
+ showErrorsInTextOverlay?: boolean;
114
+ }
115
+ interface AssemblySvgContext {
116
+ transform: Matrix;
117
+ }
118
+ declare function convertCircuitJsonToAssemblySvg(soup: AnyCircuitElement[], options?: Options$3): string;
119
+
120
+ type LabelPosition = {
121
+ text: string;
122
+ aliases: string[];
123
+ elbow_end: {
124
+ x: number;
125
+ y: number;
126
+ };
127
+ label_pos: {
128
+ x: number;
129
+ y: number;
130
+ };
131
+ edge: "left" | "right" | "top" | "bottom";
132
+ };
133
+
134
+ interface Options$2 {
135
+ width?: number;
136
+ height?: number;
137
+ includeVersion?: boolean;
138
+ showErrorsInTextOverlay?: boolean;
139
+ }
140
+ interface PinoutLabel {
141
+ pcb_port: PcbPort;
142
+ aliases: string[];
143
+ edge: "left" | "right" | "top" | "bottom";
144
+ }
145
+ interface PinoutSvgContext {
146
+ transform: Matrix;
147
+ soup: AnyCircuitElement[];
148
+ board_bounds: {
149
+ minX: number;
150
+ minY: number;
151
+ maxX: number;
152
+ maxY: number;
153
+ };
154
+ styleScale: number;
155
+ label_positions: Map<string, LabelPosition>;
156
+ svgWidth: number;
157
+ svgHeight: number;
158
+ }
159
+ declare function convertCircuitJsonToPinoutSvg(soup: AnyCircuitElement[], options?: Options$2): string;
160
+
161
+ declare const colorMap: {
162
+ "3d_viewer": {
163
+ background_bottom: string;
164
+ background_top: string;
165
+ board: string;
166
+ copper: string;
167
+ silkscreen_bottom: string;
168
+ silkscreen_top: string;
169
+ soldermask: string;
170
+ solderpaste: string;
171
+ };
172
+ board: {
173
+ anchor: string;
174
+ aux_items: string;
175
+ b_adhes: string;
176
+ b_crtyd: string;
177
+ b_fab: string;
178
+ b_mask: string;
179
+ b_paste: string;
180
+ b_silks: string;
181
+ background: string;
182
+ cmts_user: string;
183
+ copper: {
184
+ b: string;
185
+ f: string;
186
+ in1: string;
187
+ in10: string;
188
+ in11: string;
189
+ in12: string;
190
+ in13: string;
191
+ in14: string;
192
+ in15: string;
193
+ in16: string;
194
+ in17: string;
195
+ in18: string;
196
+ in19: string;
197
+ in2: string;
198
+ in20: string;
199
+ in21: string;
200
+ in22: string;
201
+ in23: string;
202
+ in24: string;
203
+ in25: string;
204
+ in26: string;
205
+ in27: string;
206
+ in28: string;
207
+ in29: string;
208
+ in3: string;
209
+ in30: string;
210
+ in4: string;
211
+ in5: string;
212
+ in6: string;
213
+ in7: string;
214
+ in8: string;
215
+ in9: string;
216
+ };
217
+ cursor: string;
218
+ drc: string;
219
+ drc_error: string;
220
+ drc_exclusion: string;
221
+ drc_warning: string;
222
+ dwgs_user: string;
223
+ eco1_user: string;
224
+ eco2_user: string;
225
+ edge_cuts: string;
226
+ f_adhes: string;
227
+ f_crtyd: string;
228
+ f_fab: string;
229
+ f_mask: string;
230
+ f_paste: string;
231
+ f_silks: string;
232
+ footprint_text_back: string;
233
+ footprint_text_front: string;
234
+ footprint_text_invisible: string;
235
+ grid: string;
236
+ grid_axes: string;
237
+ margin: string;
238
+ microvia: string;
239
+ no_connect: string;
240
+ pad_back: string;
241
+ pad_front: string;
242
+ pad_plated_hole: string;
243
+ pad_through_hole: string;
244
+ plated_hole: string;
245
+ ratsnest: string;
246
+ select_overlay: string;
247
+ through_via: string;
248
+ user_1: string;
249
+ user_2: string;
250
+ user_3: string;
251
+ user_4: string;
252
+ user_5: string;
253
+ user_6: string;
254
+ user_7: string;
255
+ user_8: string;
256
+ user_9: string;
257
+ via_blind_buried: string;
258
+ via_hole: string;
259
+ via_micro: string;
260
+ via_through: string;
261
+ worksheet: string;
262
+ };
263
+ gerbview: {
264
+ axes: string;
265
+ background: string;
266
+ dcodes: string;
267
+ grid: string;
268
+ layers: string[];
269
+ negative_objects: string;
270
+ worksheet: string;
271
+ };
272
+ meta: {
273
+ filename: string;
274
+ name: string;
275
+ version: number;
276
+ };
277
+ palette: string[];
278
+ schematic: {
279
+ aux_items: string;
280
+ background: string;
281
+ brightened: string;
282
+ bus: string;
283
+ bus_junction: string;
284
+ component_body: string;
285
+ component_outline: string;
286
+ cursor: string;
287
+ erc_error: string;
288
+ erc_warning: string;
289
+ fields: string;
290
+ grid: string;
291
+ grid_axes: string;
292
+ hidden: string;
293
+ junction: string;
294
+ label_global: string;
295
+ label_background: string;
296
+ label_hier: string;
297
+ label_local: string;
298
+ net_name: string;
299
+ no_connect: string;
300
+ note: string;
301
+ override_item_colors: boolean;
302
+ pin: string;
303
+ pin_name: string;
304
+ pin_number: string;
305
+ reference: string;
306
+ shadow: string;
307
+ sheet: string;
308
+ sheet_background: string;
309
+ sheet_fields: string;
310
+ sheet_filename: string;
311
+ sheet_label: string;
312
+ sheet_name: string;
313
+ table: string;
314
+ value: string;
315
+ wire: string;
316
+ wire_crossing: string;
317
+ worksheet: string;
318
+ };
319
+ };
320
+ type ColorMap = typeof colorMap;
321
+
322
+ type ColorOverrides = {
323
+ schematic?: Partial<ColorMap["schematic"]>;
324
+ };
325
+ interface Options$1 {
326
+ colorOverrides?: ColorOverrides;
327
+ width?: number;
328
+ height?: number;
329
+ grid?: boolean | {
330
+ cellSize?: number;
331
+ labelCells?: boolean;
332
+ };
333
+ labeledPoints?: Array<{
334
+ x: number;
335
+ y: number;
336
+ label: string;
337
+ }>;
338
+ includeVersion?: boolean;
339
+ showErrorsInTextOverlay?: boolean;
340
+ drawPorts?: boolean;
341
+ }
342
+ declare function convertCircuitJsonToSchematicSvg(circuitJson: AnyCircuitElement[], options?: Options$1): string;
343
+ /**
344
+ * @deprecated use `convertCircuitJsonToSchematicSvg` instead
345
+ */
346
+ declare const circuitJsonToSchematicSvg: typeof convertCircuitJsonToSchematicSvg;
347
+
348
+ type CircuitJsonWithSimulation = AnyCircuitElement | SimulationExperiment | SimulationTransientVoltageGraph | SimulationVoltageProbe;
349
+ declare function isSimulationTransientVoltageGraph(value: CircuitJsonWithSimulation): value is SimulationTransientVoltageGraph;
350
+ declare function isSimulationExperiment(value: CircuitJsonWithSimulation): value is SimulationExperiment;
351
+ declare function isSimulationVoltageProbe(value: CircuitJsonWithSimulation): value is SimulationVoltageProbe;
352
+
353
+ interface ConvertSchematicSimulationParams {
354
+ circuitJson: CircuitJsonWithSimulation[];
355
+ simulation_experiment_id: string;
356
+ simulation_transient_voltage_graph_ids?: string[];
357
+ width?: number;
358
+ height?: number;
359
+ schematicHeightRatio?: number;
360
+ schematicOptions?: Omit<Parameters<typeof convertCircuitJsonToSchematicSvg>[1], "width" | "height" | "includeVersion">;
361
+ includeVersion?: boolean;
362
+ /** When true, place the simulation graph above the schematic instead of below (defaults to false). */
363
+ graphAboveSchematic?: boolean;
364
+ showErrorsInTextOverlay?: boolean;
365
+ }
366
+ declare function convertCircuitJsonToSchematicSimulationSvg({ circuitJson, simulation_experiment_id, simulation_transient_voltage_graph_ids, width, height, schematicHeightRatio, schematicOptions, includeVersion, graphAboveSchematic, showErrorsInTextOverlay, }: ConvertSchematicSimulationParams): string;
367
+
368
+ interface Options {
369
+ layer: "top" | "bottom";
370
+ width?: number;
371
+ height?: number;
372
+ includeVersion?: boolean;
373
+ showErrorsInTextOverlay?: boolean;
374
+ }
375
+ declare function convertCircuitJsonToSolderPasteMask(circuitJson: AnyCircuitElement[], options: Options): string;
376
+
377
+ interface ConvertSimulationGraphParams {
378
+ circuitJson: CircuitJsonWithSimulation[];
379
+ simulation_experiment_id: string;
380
+ simulation_transient_voltage_graph_ids?: string[];
381
+ width?: number;
382
+ height?: number;
383
+ includeVersion?: boolean;
384
+ }
385
+ declare function convertCircuitJsonToSimulationGraphSvg({ circuitJson, simulation_experiment_id, simulation_transient_voltage_graph_ids, width, height, includeVersion, }: ConvertSimulationGraphParams): string;
386
+
387
+ declare function getSoftwareUsedString(circuitJson: AnyCircuitElement[]): string | undefined;
388
+
389
+ declare const CIRCUIT_TO_SVG_VERSION: string;
390
+
391
+ declare const createSvgObjectsForSchComponentPortHovers: ({ component, transform, circuitJson, }: {
392
+ component: SchematicComponent;
393
+ transform: Matrix;
394
+ circuitJson: AnyCircuitElement[];
395
+ }) => INode[];
396
+
397
+ declare function createErrorTextOverlay(circuitJson: AnyCircuitElement[], dataType?: string): INode | null;
398
+
399
+ export { type AssemblySvgContext, CIRCUIT_TO_SVG_VERSION, type CircuitJsonWithSimulation, type ColorMap, type ColorOverrides, type PcbColorMap, type PcbColorOverrides, type PcbContext, type PcbSvgOptions, type PinoutLabel, type PinoutSvgContext, circuitJsonToPcbSvg, circuitJsonToSchematicSvg, convertCircuitJsonToAssemblySvg, convertCircuitJsonToPcbSvg, convertCircuitJsonToPinoutSvg, convertCircuitJsonToSchematicSimulationSvg, convertCircuitJsonToSchematicSvg, convertCircuitJsonToSimulationGraphSvg, convertCircuitJsonToSolderPasteMask, createErrorTextOverlay, createSvgObjectsForSchComponentPortHovers, getSoftwareUsedString, isSimulationExperiment, isSimulationTransientVoltageGraph, isSimulationVoltageProbe };