@tscircuit/internal-dynamic-import 0.0.13 → 0.0.15

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as circuit_json_to_gltf from 'circuit-json-to-gltf';
2
- import { AnyCircuitElement, SourceComponentBase, PcbComponent, CircuitJson, SchematicNetLabel, PCBTrace, PCBPort, LayerRef as LayerRef$1, NinePointAnchor, PcbRenderLayer, PcbBoard, PcbCopperPour, PcbCopperText, PcbCourtyardCircle, PcbCutout, PcbFabricationNoteDimension, PcbFabricationNotePath, PcbFabricationNoteRect, PcbFabricationNoteText, PcbHole, PCBKeepout, PcbNoteDimension, PcbNotePath, PcbNoteRect, PcbNoteText, PcbPanel, PcbPlatedHole, PcbSilkscreenCircle, PcbSilkscreenLine, PcbSilkscreenOval, PcbSilkscreenPath, PcbSilkscreenPill, PcbSilkscreenRect, PcbSilkscreenText, PcbSmtPad, PcbTrace, PcbVia, PCBVia, SimulationExperiment, SimulationTransientVoltageGraph, SimulationVoltageProbe, PcbPort, SchematicComponent } from 'circuit-json';
2
+ import { AnyCircuitElement, SourceComponentBase, PcbComponent, CircuitJson, SchematicNetLabel, PCBTrace, PCBPort, LayerRef as LayerRef$1, Ring, NinePointAnchor, PcbRenderLayer, PcbBoard, PcbCopperPour, PcbCopperText, PcbCourtyardCircle, PcbCutout, PcbFabricationNoteDimension, PcbFabricationNotePath, PcbFabricationNoteRect, PcbFabricationNoteText, PcbHole, PCBKeepout, PcbNoteDimension, PcbNotePath, PcbNoteRect, PcbNoteText, PcbPanel, PcbPlatedHole, PcbSilkscreenCircle, PcbSilkscreenGraphic, PcbSilkscreenLine, PcbSilkscreenOval, PcbSilkscreenPath, PcbSilkscreenPill, PcbSilkscreenRect, PcbSilkscreenText, PcbSmtPad, PcbVia, PcbSolderPaste, PcbTrace, PCBVia, SimulationExperiment, SimulationTransientVoltageGraph, SimulationVoltageProbe, PcbPort, SchematicComponent } from 'circuit-json';
3
3
  import { BpcGraph } from 'bpc-graph';
4
+ import { RenderOptionsInput } from 'poppygl';
4
5
  import { z, AnyZodObject } from 'zod';
5
6
  import { CircuitJsonUtilObjects, cju } from '@tscircuit/circuit-json-util';
6
7
  import { KicadSch, KicadPcb, SchematicSymbol, KicadSym } from 'kicadts';
@@ -175,6 +176,182 @@ declare namespace CircuitJsonToConnectivityMapModule {
175
176
  export { CircuitJsonToConnectivityMapModule_ConnectivityMap as ConnectivityMap, CircuitJsonToConnectivityMapModule_PcbConnectivityMap as PcbConnectivityMap, CircuitJsonToConnectivityMapModule_findConnectedNetworks as findConnectedNetworks, CircuitJsonToConnectivityMapModule_getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson, CircuitJsonToConnectivityMapModule_getSourcePortConnectivityMapFromCircuitJson as getSourcePortConnectivityMapFromCircuitJson };
176
177
  }
177
178
 
179
+ interface FdmComponentBoxOptions {
180
+ /** Number of compartments per row. Defaults to a near-square layout. */
181
+ columns?: number;
182
+ /** Clear X dimension of each compartment, in millimetres. */
183
+ compartmentWidth?: number;
184
+ /** Clear Y dimension of each compartment, in millimetres. */
185
+ compartmentDepth?: number;
186
+ /** Clear Z depth from the floor to the rim, in millimetres. */
187
+ compartmentHeight?: number;
188
+ /** Thickness of outside and divider walls, in millimetres. */
189
+ wallThickness?: number;
190
+ /** Thickness beneath each compartment, in millimetres. */
191
+ floorThickness?: number;
192
+ /** Solid Y-depth behind each compartment that carries its label. */
193
+ labelBandDepth?: number;
194
+ /** Height of the raised label above the box rim, in millimetres. */
195
+ labelThickness?: number;
196
+ /** Empty margin around each label, in millimetres. */
197
+ labelPadding?: number;
198
+ /** Smallest allowed text stroke, in millimetres. */
199
+ minimumLabelStrokeWidth?: number;
200
+ /** Include source components that do not have a pcb_component record. */
201
+ includeUnplacedComponents?: boolean;
202
+ /** Include test points, which are excluded from assembly compartments by default. */
203
+ includeTestPoints?: boolean;
204
+ /** Group confidently identical BOM parts into one compartment. Defaults to true. */
205
+ groupByComponent?: boolean;
206
+ /** Core 3MF display color for the box material, as #RRGGBB or #RRGGBBAA. */
207
+ boxColor?: string;
208
+ /** Core 3MF display color for the label material, as #RRGGBB or #RRGGBBAA. */
209
+ labelColor?: string;
210
+ /** Title stored in the 3MF model metadata. */
211
+ title?: string;
212
+ }
213
+ interface ComponentGroup {
214
+ /** Stable description of the BOM identity used for this group. */
215
+ componentKey: string;
216
+ /** Every refdes whose physical parts belong in this compartment. */
217
+ referenceDesignators: string[];
218
+ quantity: number;
219
+ componentType?: string;
220
+ manufacturerPartNumber?: string;
221
+ supplierPartNumbers?: Record<string, string[]>;
222
+ footprint?: string;
223
+ }
224
+ interface FdmComponentBoxDimensions {
225
+ /** Overall X dimension, in millimetres. */
226
+ width: number;
227
+ /** Overall Y dimension, in millimetres. */
228
+ depth: number;
229
+ /** Overall Z dimension excluding raised text, in millimetres. */
230
+ height: number;
231
+ columns: number;
232
+ rows: number;
233
+ }
234
+ interface CompartmentPlacement {
235
+ /** Primary refdes, retained for compatibility with one-component compartments. */
236
+ refdes: string;
237
+ /** All refdes values assigned to this compartment. */
238
+ referenceDesignators: string[];
239
+ /** Text physically embossed above the compartment. */
240
+ label: string;
241
+ componentKey: string;
242
+ quantity: number;
243
+ row: number;
244
+ column: number;
245
+ /** Cavity center in the box coordinate frame, in millimetres. */
246
+ center: {
247
+ x: number;
248
+ y: number;
249
+ };
250
+ /** Center of the solid label band behind this cavity, in millimetres. */
251
+ labelCenter: {
252
+ x: number;
253
+ y: number;
254
+ };
255
+ width: number;
256
+ depth: number;
257
+ }
258
+ interface FdmComponentBoxMeshStats {
259
+ boxTriangles: number;
260
+ labelTriangles: number;
261
+ totalTriangles: number;
262
+ }
263
+ interface FdmComponentBoxResult {
264
+ /** Ready-to-write 3MF package bytes. */
265
+ threeMf: Uint8Array;
266
+ /** Naturally sorted refdes values represented by all compartments. */
267
+ componentRefdes: string[];
268
+ /** BOM-aware groups, one per generated compartment. */
269
+ componentGroups: ComponentGroup[];
270
+ dimensions: FdmComponentBoxDimensions;
271
+ compartments: CompartmentPlacement[];
272
+ meshStats: FdmComponentBoxMeshStats;
273
+ }
274
+ interface ResolvedFdmComponentBoxOptions {
275
+ columns: number;
276
+ compartmentWidth: number;
277
+ compartmentDepth: number;
278
+ compartmentHeight: number;
279
+ wallThickness: number;
280
+ floorThickness: number;
281
+ labelBandDepth: number;
282
+ labelThickness: number;
283
+ labelPadding: number;
284
+ minimumLabelStrokeWidth: number;
285
+ includeUnplacedComponents: boolean;
286
+ includeTestPoints: boolean;
287
+ groupByComponent: boolean;
288
+ boxColor: string;
289
+ labelColor: string;
290
+ title: string;
291
+ }
292
+ declare const DEFAULT_FDM_COMPONENT_BOX_OPTIONS: {
293
+ readonly compartmentWidth: 26;
294
+ readonly compartmentDepth: 22;
295
+ readonly compartmentHeight: 12;
296
+ readonly wallThickness: 1.6;
297
+ readonly floorThickness: 1.6;
298
+ readonly labelBandDepth: 6.5;
299
+ readonly labelThickness: 0.6;
300
+ readonly labelPadding: 0.75;
301
+ readonly minimumLabelStrokeWidth: 0.45;
302
+ readonly includeUnplacedComponents: false;
303
+ readonly includeTestPoints: false;
304
+ readonly groupByComponent: true;
305
+ readonly boxColor: "#D9D9D9FF";
306
+ readonly labelColor: "#151515FF";
307
+ };
308
+
309
+ declare const createFdmComponentBox: (circuitJson: CircuitJson, options?: FdmComponentBoxOptions) => Promise<FdmComponentBoxResult>;
310
+ /** Convert Circuit JSON directly to a ready-to-write 3MF byte array. */
311
+ declare const circuitJsonToFdmComponentBox: (circuitJson: CircuitJson, options?: FdmComponentBoxOptions) => Promise<Uint8Array>;
312
+
313
+ interface ExtractComponentGroupsOptions {
314
+ includeUnplacedComponents?: boolean;
315
+ includeTestPoints?: boolean;
316
+ groupByComponent?: boolean;
317
+ }
318
+ declare const naturalRefdesCollator: Intl.Collator;
319
+ declare const extractComponentGroups: (circuitJson: CircuitJson, options?: ExtractComponentGroupsOptions) => ComponentGroup[];
320
+
321
+ /**
322
+ * Returns the physical component refdes values that should receive pockets.
323
+ *
324
+ * When the document contains pcb_component records, unplaced source components
325
+ * are omitted by default. Source-only Circuit JSON falls back to all source
326
+ * components so partially rendered documents remain useful.
327
+ */
328
+ declare const extractComponentRefdes: (circuitJson: CircuitJson, options?: Omit<ExtractComponentGroupsOptions, "groupByComponent">) => string[];
329
+
330
+ type FdmComponentBoxPngOptions = RenderOptionsInput;
331
+ /** Render a deterministic, pure-JavaScript PNG preview directly from Circuit JSON. */
332
+ declare const renderFdmComponentBoxPng: (circuitJson: CircuitJson, boxOptions?: FdmComponentBoxOptions, renderOptions?: FdmComponentBoxPngOptions) => Promise<Uint8Array>;
333
+
334
+ declare const CircuitJsonToFdmComponentBoxModule_CircuitJson: typeof CircuitJson;
335
+ type CircuitJsonToFdmComponentBoxModule_CompartmentPlacement = CompartmentPlacement;
336
+ type CircuitJsonToFdmComponentBoxModule_ComponentGroup = ComponentGroup;
337
+ declare const CircuitJsonToFdmComponentBoxModule_DEFAULT_FDM_COMPONENT_BOX_OPTIONS: typeof DEFAULT_FDM_COMPONENT_BOX_OPTIONS;
338
+ type CircuitJsonToFdmComponentBoxModule_ExtractComponentGroupsOptions = ExtractComponentGroupsOptions;
339
+ type CircuitJsonToFdmComponentBoxModule_FdmComponentBoxDimensions = FdmComponentBoxDimensions;
340
+ type CircuitJsonToFdmComponentBoxModule_FdmComponentBoxMeshStats = FdmComponentBoxMeshStats;
341
+ type CircuitJsonToFdmComponentBoxModule_FdmComponentBoxOptions = FdmComponentBoxOptions;
342
+ type CircuitJsonToFdmComponentBoxModule_FdmComponentBoxPngOptions = FdmComponentBoxPngOptions;
343
+ type CircuitJsonToFdmComponentBoxModule_FdmComponentBoxResult = FdmComponentBoxResult;
344
+ type CircuitJsonToFdmComponentBoxModule_ResolvedFdmComponentBoxOptions = ResolvedFdmComponentBoxOptions;
345
+ declare const CircuitJsonToFdmComponentBoxModule_circuitJsonToFdmComponentBox: typeof circuitJsonToFdmComponentBox;
346
+ declare const CircuitJsonToFdmComponentBoxModule_createFdmComponentBox: typeof createFdmComponentBox;
347
+ declare const CircuitJsonToFdmComponentBoxModule_extractComponentGroups: typeof extractComponentGroups;
348
+ declare const CircuitJsonToFdmComponentBoxModule_extractComponentRefdes: typeof extractComponentRefdes;
349
+ declare const CircuitJsonToFdmComponentBoxModule_naturalRefdesCollator: typeof naturalRefdesCollator;
350
+ declare const CircuitJsonToFdmComponentBoxModule_renderFdmComponentBoxPng: typeof renderFdmComponentBoxPng;
351
+ declare namespace CircuitJsonToFdmComponentBoxModule {
352
+ export { CircuitJsonToFdmComponentBoxModule_CircuitJson as CircuitJson, type CircuitJsonToFdmComponentBoxModule_CompartmentPlacement as CompartmentPlacement, type CircuitJsonToFdmComponentBoxModule_ComponentGroup as ComponentGroup, CircuitJsonToFdmComponentBoxModule_DEFAULT_FDM_COMPONENT_BOX_OPTIONS as DEFAULT_FDM_COMPONENT_BOX_OPTIONS, type CircuitJsonToFdmComponentBoxModule_ExtractComponentGroupsOptions as ExtractComponentGroupsOptions, type CircuitJsonToFdmComponentBoxModule_FdmComponentBoxDimensions as FdmComponentBoxDimensions, type CircuitJsonToFdmComponentBoxModule_FdmComponentBoxMeshStats as FdmComponentBoxMeshStats, type CircuitJsonToFdmComponentBoxModule_FdmComponentBoxOptions as FdmComponentBoxOptions, type CircuitJsonToFdmComponentBoxModule_FdmComponentBoxPngOptions as FdmComponentBoxPngOptions, type CircuitJsonToFdmComponentBoxModule_FdmComponentBoxResult as FdmComponentBoxResult, type CircuitJsonToFdmComponentBoxModule_ResolvedFdmComponentBoxOptions as ResolvedFdmComponentBoxOptions, CircuitJsonToFdmComponentBoxModule_circuitJsonToFdmComponentBox as circuitJsonToFdmComponentBox, CircuitJsonToFdmComponentBoxModule_createFdmComponentBox as createFdmComponentBox, CircuitJsonToFdmComponentBoxModule_extractComponentGroups as extractComponentGroups, CircuitJsonToFdmComponentBoxModule_extractComponentRefdes as extractComponentRefdes, CircuitJsonToFdmComponentBoxModule_naturalRefdesCollator as naturalRefdesCollator, CircuitJsonToFdmComponentBoxModule_renderFdmComponentBoxPng as renderFdmComponentBoxPng };
353
+ }
354
+
178
355
  interface ExcellonDrillCommandDef<K extends string, T extends AnyZodObject | z.ZodIntersection<any, any>> {
179
356
  command_code: K;
180
357
  schema: T;
@@ -2060,7 +2237,7 @@ interface CanvasContext {
2060
2237
  moveTo(x: number, y: number): void;
2061
2238
  save(): void;
2062
2239
  restore(): void;
2063
- clip(): void;
2240
+ clip(fillRule?: "nonzero" | "evenodd"): void;
2064
2241
  translate(x: number, y: number): void;
2065
2242
  rotate(angle: number): void;
2066
2243
  scale(x: number, y: number): void;
@@ -2086,7 +2263,7 @@ interface CanvasContext {
2086
2263
  font: string;
2087
2264
  textAlign: "start" | "end" | "left" | "right" | "center";
2088
2265
  }
2089
- type CopperLayerName$1 = "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
2266
+ type CopperLayerName$1 = LayerRef$1;
2090
2267
  type CopperColorMap$1 = Record<CopperLayerName$1, string> & {
2091
2268
  [layer: string]: string;
2092
2269
  };
@@ -2119,7 +2296,10 @@ interface PcbColorMap$1 {
2119
2296
  top: string;
2120
2297
  bottom: string;
2121
2298
  };
2122
- keepout: string;
2299
+ keepout: {
2300
+ top: string;
2301
+ bottom: string;
2302
+ };
2123
2303
  fabricationNote: string;
2124
2304
  }
2125
2305
  declare const DEFAULT_PCB_COLOR_MAP: PcbColorMap$1;
@@ -2140,8 +2320,20 @@ interface DrawContext {
2140
2320
 
2141
2321
  interface DrawElementsOptions {
2142
2322
  layers?: PcbRenderLayer[];
2323
+ /**
2324
+ * Elements used only to find copper pours when clipping traces. This is
2325
+ * useful when `elements` is a filtered subset, such as a trace-only render
2326
+ * pass in an interactive viewer. Defaults to `elements`.
2327
+ */
2328
+ clipContextElements?: AnyCircuitElement[];
2143
2329
  /** Whether to render the soldermask layer. Defaults to false. */
2144
2330
  drawSoldermask?: boolean;
2331
+ /** Whether to render pcb_solder_paste elements. Defaults to false. */
2332
+ drawSolderPaste?: boolean;
2333
+ /** Render top solder-paste elements when drawSolderPaste is enabled. Defaults to true if both layer flags are unset. */
2334
+ drawSolderPasteTop?: boolean;
2335
+ /** Render bottom solder-paste elements when drawSolderPaste is enabled. */
2336
+ drawSolderPasteBottom?: boolean;
2145
2337
  /** Render top soldermask layer when drawSoldermask is enabled. Defaults to true if both layer flags are unset. */
2146
2338
  drawSoldermaskTop?: boolean;
2147
2339
  /** Render bottom soldermask layer when drawSoldermask is enabled. */
@@ -2152,6 +2344,8 @@ interface DrawElementsOptions {
2152
2344
  minBoardOutlineStrokePx?: number;
2153
2345
  /** Whether to render pcb_note elements. Defaults to true. */
2154
2346
  showPcbNotes?: boolean;
2347
+ /** Clear drill holes and cutouts from the canvas instead of painting them with the drill color. Defaults to false. */
2348
+ clearDrillHoles?: boolean;
2155
2349
  }
2156
2350
  interface CanvasLike {
2157
2351
  getContext(contextId: "2d"): CanvasContext | null;
@@ -2164,7 +2358,39 @@ declare class CircuitToCanvasDrawer {
2164
2358
  configure(config: DrawerConfig): void;
2165
2359
  setCameraBounds(bounds: CameraBounds): void;
2166
2360
  drawElements(elements: AnyCircuitElement[], options?: DrawElementsOptions): void;
2361
+ private clearDrillHoles;
2362
+ }
2363
+
2364
+ interface DrawArrowParams {
2365
+ ctx: CanvasContext;
2366
+ x: number;
2367
+ y: number;
2368
+ angle: number;
2369
+ arrowSize: number;
2370
+ color: string;
2371
+ strokeWidth: number;
2372
+ }
2373
+ /**
2374
+ * Draw an arrow at a point along a line
2375
+ */
2376
+ declare function drawArrow(params: DrawArrowParams): void;
2377
+
2378
+ interface BrepShape {
2379
+ outer_ring: Ring;
2380
+ inner_rings?: Ring[];
2381
+ }
2382
+ interface AddBrepRingToPathParams {
2383
+ ctx: CanvasContext;
2384
+ ring: Ring;
2385
+ realToCanvasMat: Matrix;
2167
2386
  }
2387
+ declare function addBrepRingToPath({ ctx, ring, realToCanvasMat, }: AddBrepRingToPathParams): void;
2388
+ interface AddBrepShapeToPathParams {
2389
+ ctx: CanvasContext;
2390
+ shape: BrepShape;
2391
+ realToCanvasMat: Matrix;
2392
+ }
2393
+ declare function addBrepShapeToPath({ ctx, shape, realToCanvasMat, }: AddBrepShapeToPathParams): void;
2168
2394
 
2169
2395
  interface DrawCircleParams {
2170
2396
  ctx: CanvasContext;
@@ -2181,23 +2407,49 @@ interface DrawCircleParams {
2181
2407
  }
2182
2408
  declare function drawCircle(params: DrawCircleParams): void;
2183
2409
 
2184
- interface DrawRectParams {
2410
+ interface DrawDimensionLineParams {
2185
2411
  ctx: CanvasContext;
2186
- center: {
2412
+ from: {
2413
+ x: number;
2414
+ y: number;
2415
+ };
2416
+ to: {
2187
2417
  x: number;
2188
2418
  y: number;
2189
2419
  };
2190
- width: number;
2191
- height: number;
2192
- fill?: string;
2193
2420
  realToCanvasMat: Matrix;
2194
- borderRadius?: number;
2195
- ccwRotationDegrees?: number;
2196
- stroke?: string;
2421
+ color: string;
2422
+ fontSize: number;
2423
+ arrowSize?: number;
2197
2424
  strokeWidth?: number;
2198
- isStrokeDashed?: boolean;
2425
+ text?: string;
2426
+ textRotation?: number;
2427
+ offset?: {
2428
+ distance: number;
2429
+ direction: {
2430
+ x: number;
2431
+ y: number;
2432
+ };
2433
+ };
2199
2434
  }
2200
- declare function drawRect(params: DrawRectParams): void;
2435
+ declare function drawDimensionLine(params: DrawDimensionLineParams): void;
2436
+
2437
+ interface DrawLineParams {
2438
+ ctx: CanvasContext;
2439
+ start: {
2440
+ x: number;
2441
+ y: number;
2442
+ };
2443
+ end: {
2444
+ x: number;
2445
+ y: number;
2446
+ };
2447
+ strokeWidth: number;
2448
+ stroke: string;
2449
+ realToCanvasMat: Matrix;
2450
+ lineCap?: "butt" | "round" | "square";
2451
+ }
2452
+ declare function drawLine(params: DrawLineParams): void;
2201
2453
 
2202
2454
  interface DrawOvalParams {
2203
2455
  ctx: CanvasContext;
@@ -2215,6 +2467,21 @@ interface DrawOvalParams {
2215
2467
  }
2216
2468
  declare function drawOval(params: DrawOvalParams): void;
2217
2469
 
2470
+ interface DrawPathParams {
2471
+ ctx: CanvasContext;
2472
+ points: Array<{
2473
+ x: number;
2474
+ y: number;
2475
+ }>;
2476
+ fill?: string;
2477
+ stroke?: string;
2478
+ strokeWidth?: number;
2479
+ minStrokePx?: number;
2480
+ realToCanvasMat: Matrix;
2481
+ closePath?: boolean;
2482
+ }
2483
+ declare function drawPath(params: DrawPathParams): void;
2484
+
2218
2485
  interface DrawPillParams {
2219
2486
  ctx: CanvasContext;
2220
2487
  center: {
@@ -2242,78 +2509,24 @@ interface DrawPolygonParams {
2242
2509
  }
2243
2510
  declare function drawPolygon(params: DrawPolygonParams): void;
2244
2511
 
2245
- interface DrawLineParams {
2512
+ interface DrawRectParams {
2246
2513
  ctx: CanvasContext;
2247
- start: {
2248
- x: number;
2249
- y: number;
2250
- };
2251
- end: {
2514
+ center: {
2252
2515
  x: number;
2253
2516
  y: number;
2254
2517
  };
2255
- strokeWidth: number;
2256
- stroke: string;
2257
- realToCanvasMat: Matrix;
2258
- lineCap?: "butt" | "round" | "square";
2259
- }
2260
- declare function drawLine(params: DrawLineParams): void;
2261
-
2262
- interface DrawPathParams {
2263
- ctx: CanvasContext;
2264
- points: Array<{
2265
- x: number;
2266
- y: number;
2267
- }>;
2518
+ width: number;
2519
+ height: number;
2268
2520
  fill?: string;
2269
- stroke?: string;
2270
- strokeWidth?: number;
2271
- minStrokePx?: number;
2272
- realToCanvasMat: Matrix;
2273
- closePath?: boolean;
2274
- }
2275
- declare function drawPath(params: DrawPathParams): void;
2276
-
2277
- interface DrawArrowParams {
2278
- ctx: CanvasContext;
2279
- x: number;
2280
- y: number;
2281
- angle: number;
2282
- arrowSize: number;
2283
- color: string;
2284
- strokeWidth: number;
2285
- }
2286
- /**
2287
- * Draw an arrow at a point along a line
2288
- */
2289
- declare function drawArrow(params: DrawArrowParams): void;
2290
-
2291
- interface DrawDimensionLineParams {
2292
- ctx: CanvasContext;
2293
- from: {
2294
- x: number;
2295
- y: number;
2296
- };
2297
- to: {
2298
- x: number;
2299
- y: number;
2300
- };
2301
2521
  realToCanvasMat: Matrix;
2302
- color: string;
2303
- fontSize: number;
2304
- arrowSize?: number;
2522
+ borderRadius?: number;
2523
+ ccwRotationDegrees?: number;
2524
+ stroke?: string;
2305
2525
  strokeWidth?: number;
2306
- text?: string;
2307
- textRotation?: number;
2308
- offset?: {
2309
- distance: number;
2310
- direction: {
2311
- x: number;
2312
- y: number;
2313
- };
2314
- };
2526
+ isStrokeDashed?: boolean;
2527
+ lineJoin?: CanvasLineJoin;
2315
2528
  }
2316
- declare function drawDimensionLine(params: DrawDimensionLineParams): void;
2529
+ declare function drawRect(params: DrawRectParams): void;
2317
2530
 
2318
2531
  type AlphabetLayout = {
2319
2532
  width: number;
@@ -2359,7 +2572,7 @@ interface DrawTextParams {
2359
2572
  declare function drawText(params: DrawTextParams): void;
2360
2573
 
2361
2574
  type AnchorAlignment = NinePointAnchor;
2362
- declare function getTextStartPosition(alignment: NinePointAnchor, layout: AlphabetLayout): {
2575
+ declare function getTextStartPosition(alignment: NinePointAnchor, layout: AlphabetLayout, fontSize: number): {
2363
2576
  x: number;
2364
2577
  y: number;
2365
2578
  };
@@ -2371,7 +2584,7 @@ interface DrawPcbPlatedHoleParams {
2371
2584
  colorMap: PcbColorMap$1;
2372
2585
  soldermaskMargin?: number;
2373
2586
  drawSoldermask?: boolean;
2374
- layer?: "top" | "bottom";
2587
+ layer?: LayerRef$1;
2375
2588
  }
2376
2589
  declare function drawPcbPlatedHole(params: DrawPcbPlatedHoleParams): void;
2377
2590
 
@@ -2380,7 +2593,7 @@ interface DrawPcbViaParams {
2380
2593
  via: PCBVia;
2381
2594
  realToCanvasMat: Matrix;
2382
2595
  colorMap: PcbColorMap$1;
2383
- layer?: "top" | "bottom";
2596
+ layer?: LayerRef$1;
2384
2597
  }
2385
2598
  declare function drawPcbVia(params: DrawPcbViaParams): void;
2386
2599
 
@@ -2399,9 +2612,20 @@ interface DrawPcbSmtPadParams {
2399
2612
  pad: PcbSmtPad;
2400
2613
  realToCanvasMat: Matrix;
2401
2614
  colorMap: PcbColorMap$1;
2615
+ holes?: PcbHole[];
2616
+ platedHoles?: PcbPlatedHole[];
2617
+ vias?: PcbVia[];
2618
+ cutouts?: PcbCutout[];
2402
2619
  }
2403
2620
  declare function drawPcbSmtPad(params: DrawPcbSmtPadParams): void;
2404
2621
 
2622
+ interface DrawPcbSolderPasteParams {
2623
+ ctx: CanvasContext;
2624
+ solderPaste: PcbSolderPaste;
2625
+ realToCanvasMat: Matrix;
2626
+ }
2627
+ declare function drawPcbSolderPaste(params: DrawPcbSolderPasteParams): void;
2628
+
2405
2629
  /**
2406
2630
  * Draws a soldermask ring for rectangular shapes with negative margin
2407
2631
  * (soldermask appears inside the pad boundary)
@@ -2447,6 +2671,7 @@ interface DrawPcbTraceParams {
2447
2671
  colorMap: PcbColorMap$1;
2448
2672
  vias?: PcbVia[];
2449
2673
  platedHoles?: PcbPlatedHole[];
2674
+ layer?: LayerRef$1;
2450
2675
  }
2451
2676
  declare function drawPcbTrace(params: DrawPcbTraceParams): void;
2452
2677
 
@@ -2493,6 +2718,14 @@ interface DrawPcbSilkscreenCircleParams {
2493
2718
  }
2494
2719
  declare function drawPcbSilkscreenCircle(params: DrawPcbSilkscreenCircleParams): void;
2495
2720
 
2721
+ interface DrawPcbSilkscreenGraphicParams {
2722
+ ctx: CanvasContext;
2723
+ graphic: PcbSilkscreenGraphic;
2724
+ realToCanvasMat: Matrix;
2725
+ colorMap: PcbColorMap$1;
2726
+ }
2727
+ declare function drawPcbSilkscreenGraphic(params: DrawPcbSilkscreenGraphicParams): void;
2728
+
2496
2729
  interface DrawPcbSilkscreenLineParams {
2497
2730
  ctx: CanvasContext;
2498
2731
  line: PcbSilkscreenLine;
@@ -2629,8 +2862,11 @@ interface DrawPcbCourtyardCircleParams {
2629
2862
  }
2630
2863
  declare function drawPcbCourtyardCircle(params: DrawPcbCourtyardCircleParams): void;
2631
2864
 
2865
+ type CircuitToCanvasModule_AddBrepRingToPathParams = AddBrepRingToPathParams;
2866
+ type CircuitToCanvasModule_AddBrepShapeToPathParams = AddBrepShapeToPathParams;
2632
2867
  type CircuitToCanvasModule_AlphabetLayout = AlphabetLayout;
2633
2868
  type CircuitToCanvasModule_AnchorAlignment = AnchorAlignment;
2869
+ type CircuitToCanvasModule_BrepShape = BrepShape;
2634
2870
  type CircuitToCanvasModule_CameraBounds = CameraBounds;
2635
2871
  type CircuitToCanvasModule_CanvasContext = CanvasContext;
2636
2872
  type CircuitToCanvasModule_CircuitToCanvasDrawer = CircuitToCanvasDrawer;
@@ -2662,6 +2898,7 @@ type CircuitToCanvasModule_DrawPcbNoteTextParams = DrawPcbNoteTextParams;
2662
2898
  type CircuitToCanvasModule_DrawPcbPanelParams = DrawPcbPanelParams;
2663
2899
  type CircuitToCanvasModule_DrawPcbPlatedHoleParams = DrawPcbPlatedHoleParams;
2664
2900
  type CircuitToCanvasModule_DrawPcbSilkscreenCircleParams = DrawPcbSilkscreenCircleParams;
2901
+ type CircuitToCanvasModule_DrawPcbSilkscreenGraphicParams = DrawPcbSilkscreenGraphicParams;
2665
2902
  type CircuitToCanvasModule_DrawPcbSilkscreenLineParams = DrawPcbSilkscreenLineParams;
2666
2903
  type CircuitToCanvasModule_DrawPcbSilkscreenOvalParams = DrawPcbSilkscreenOvalParams;
2667
2904
  type CircuitToCanvasModule_DrawPcbSilkscreenPathParams = DrawPcbSilkscreenPathParams;
@@ -2669,6 +2906,7 @@ type CircuitToCanvasModule_DrawPcbSilkscreenPillParams = DrawPcbSilkscreenPillPa
2669
2906
  type CircuitToCanvasModule_DrawPcbSilkscreenRectParams = DrawPcbSilkscreenRectParams;
2670
2907
  type CircuitToCanvasModule_DrawPcbSilkscreenTextParams = DrawPcbSilkscreenTextParams;
2671
2908
  type CircuitToCanvasModule_DrawPcbSmtPadParams = DrawPcbSmtPadParams;
2909
+ type CircuitToCanvasModule_DrawPcbSolderPasteParams = DrawPcbSolderPasteParams;
2672
2910
  type CircuitToCanvasModule_DrawPcbTraceParams = DrawPcbTraceParams;
2673
2911
  type CircuitToCanvasModule_DrawPcbViaParams = DrawPcbViaParams;
2674
2912
  type CircuitToCanvasModule_DrawPillParams = DrawPillParams;
@@ -2676,6 +2914,8 @@ type CircuitToCanvasModule_DrawPolygonParams = DrawPolygonParams;
2676
2914
  type CircuitToCanvasModule_DrawRectParams = DrawRectParams;
2677
2915
  type CircuitToCanvasModule_DrawTextParams = DrawTextParams;
2678
2916
  type CircuitToCanvasModule_DrawerConfig = DrawerConfig;
2917
+ declare const CircuitToCanvasModule_addBrepRingToPath: typeof addBrepRingToPath;
2918
+ declare const CircuitToCanvasModule_addBrepShapeToPath: typeof addBrepShapeToPath;
2679
2919
  declare const CircuitToCanvasModule_drawArrow: typeof drawArrow;
2680
2920
  declare const CircuitToCanvasModule_drawCircle: typeof drawCircle;
2681
2921
  declare const CircuitToCanvasModule_drawDimensionLine: typeof drawDimensionLine;
@@ -2700,6 +2940,7 @@ declare const CircuitToCanvasModule_drawPcbNoteText: typeof drawPcbNoteText;
2700
2940
  declare const CircuitToCanvasModule_drawPcbPanelElement: typeof drawPcbPanelElement;
2701
2941
  declare const CircuitToCanvasModule_drawPcbPlatedHole: typeof drawPcbPlatedHole;
2702
2942
  declare const CircuitToCanvasModule_drawPcbSilkscreenCircle: typeof drawPcbSilkscreenCircle;
2943
+ declare const CircuitToCanvasModule_drawPcbSilkscreenGraphic: typeof drawPcbSilkscreenGraphic;
2703
2944
  declare const CircuitToCanvasModule_drawPcbSilkscreenLine: typeof drawPcbSilkscreenLine;
2704
2945
  declare const CircuitToCanvasModule_drawPcbSilkscreenOval: typeof drawPcbSilkscreenOval;
2705
2946
  declare const CircuitToCanvasModule_drawPcbSilkscreenPath: typeof drawPcbSilkscreenPath;
@@ -2707,6 +2948,7 @@ declare const CircuitToCanvasModule_drawPcbSilkscreenPill: typeof drawPcbSilkscr
2707
2948
  declare const CircuitToCanvasModule_drawPcbSilkscreenRect: typeof drawPcbSilkscreenRect;
2708
2949
  declare const CircuitToCanvasModule_drawPcbSilkscreenText: typeof drawPcbSilkscreenText;
2709
2950
  declare const CircuitToCanvasModule_drawPcbSmtPad: typeof drawPcbSmtPad;
2951
+ declare const CircuitToCanvasModule_drawPcbSolderPaste: typeof drawPcbSolderPaste;
2710
2952
  declare const CircuitToCanvasModule_drawPcbTrace: typeof drawPcbTrace;
2711
2953
  declare const CircuitToCanvasModule_drawPcbVia: typeof drawPcbVia;
2712
2954
  declare const CircuitToCanvasModule_drawPill: typeof drawPill;
@@ -2721,7 +2963,7 @@ declare const CircuitToCanvasModule_getAlphabetLayout: typeof getAlphabetLayout;
2721
2963
  declare const CircuitToCanvasModule_getTextStartPosition: typeof getTextStartPosition;
2722
2964
  declare const CircuitToCanvasModule_strokeAlphabetText: typeof strokeAlphabetText;
2723
2965
  declare namespace CircuitToCanvasModule {
2724
- export { type CircuitToCanvasModule_AlphabetLayout as AlphabetLayout, type CircuitToCanvasModule_AnchorAlignment as AnchorAlignment, type CircuitToCanvasModule_CameraBounds as CameraBounds, type CircuitToCanvasModule_CanvasContext as CanvasContext, CircuitToCanvasModule_CircuitToCanvasDrawer as CircuitToCanvasDrawer, type CopperColorMap$1 as CopperColorMap, type CopperLayerName$1 as CopperLayerName, CircuitToCanvasModule_DEFAULT_PCB_COLOR_MAP as DEFAULT_PCB_COLOR_MAP, type CircuitToCanvasModule_DrawArrowParams as DrawArrowParams, type CircuitToCanvasModule_DrawCircleParams as DrawCircleParams, type CircuitToCanvasModule_DrawContext as DrawContext, type CircuitToCanvasModule_DrawDimensionLineParams as DrawDimensionLineParams, type CircuitToCanvasModule_DrawElementsOptions as DrawElementsOptions, type CircuitToCanvasModule_DrawLineParams as DrawLineParams, type CircuitToCanvasModule_DrawOvalParams as DrawOvalParams, type CircuitToCanvasModule_DrawPathParams as DrawPathParams, type CircuitToCanvasModule_DrawPcbBoardParams as DrawPcbBoardParams, type CircuitToCanvasModule_DrawPcbCopperPourParams as DrawPcbCopperPourParams, type CircuitToCanvasModule_DrawPcbCopperTextParams as DrawPcbCopperTextParams, type CircuitToCanvasModule_DrawPcbCourtyardCircleParams as DrawPcbCourtyardCircleParams, type CircuitToCanvasModule_DrawPcbCutoutParams as DrawPcbCutoutParams, type CircuitToCanvasModule_DrawPcbFabricationNoteDimensionParams as DrawPcbFabricationNoteDimensionParams, type CircuitToCanvasModule_DrawPcbFabricationNotePathParams as DrawPcbFabricationNotePathParams, type CircuitToCanvasModule_DrawPcbFabricationNoteRectParams as DrawPcbFabricationNoteRectParams, type CircuitToCanvasModule_DrawPcbFabricationNoteTextParams as DrawPcbFabricationNoteTextParams, type CircuitToCanvasModule_DrawPcbHoleParams as DrawPcbHoleParams, type CircuitToCanvasModule_DrawPcbKeepoutParams as DrawPcbKeepoutParams, type CircuitToCanvasModule_DrawPcbNoteDimensionParams as DrawPcbNoteDimensionParams, type CircuitToCanvasModule_DrawPcbNotePathParams as DrawPcbNotePathParams, type CircuitToCanvasModule_DrawPcbNoteRectParams as DrawPcbNoteRectParams, type CircuitToCanvasModule_DrawPcbNoteTextParams as DrawPcbNoteTextParams, type CircuitToCanvasModule_DrawPcbPanelParams as DrawPcbPanelParams, type CircuitToCanvasModule_DrawPcbPlatedHoleParams as DrawPcbPlatedHoleParams, type CircuitToCanvasModule_DrawPcbSilkscreenCircleParams as DrawPcbSilkscreenCircleParams, type CircuitToCanvasModule_DrawPcbSilkscreenLineParams as DrawPcbSilkscreenLineParams, type CircuitToCanvasModule_DrawPcbSilkscreenOvalParams as DrawPcbSilkscreenOvalParams, type CircuitToCanvasModule_DrawPcbSilkscreenPathParams as DrawPcbSilkscreenPathParams, type CircuitToCanvasModule_DrawPcbSilkscreenPillParams as DrawPcbSilkscreenPillParams, type CircuitToCanvasModule_DrawPcbSilkscreenRectParams as DrawPcbSilkscreenRectParams, type CircuitToCanvasModule_DrawPcbSilkscreenTextParams as DrawPcbSilkscreenTextParams, type CircuitToCanvasModule_DrawPcbSmtPadParams as DrawPcbSmtPadParams, type CircuitToCanvasModule_DrawPcbTraceParams as DrawPcbTraceParams, type CircuitToCanvasModule_DrawPcbViaParams as DrawPcbViaParams, type CircuitToCanvasModule_DrawPillParams as DrawPillParams, type CircuitToCanvasModule_DrawPolygonParams as DrawPolygonParams, type CircuitToCanvasModule_DrawRectParams as DrawRectParams, type CircuitToCanvasModule_DrawTextParams as DrawTextParams, type CircuitToCanvasModule_DrawerConfig as DrawerConfig, type PcbColorMap$1 as PcbColorMap, CircuitToCanvasModule_drawArrow as drawArrow, CircuitToCanvasModule_drawCircle as drawCircle, CircuitToCanvasModule_drawDimensionLine as drawDimensionLine, CircuitToCanvasModule_drawLine as drawLine, CircuitToCanvasModule_drawOval as drawOval, CircuitToCanvasModule_drawPath as drawPath, CircuitToCanvasModule_drawPcbBoard as drawPcbBoard, CircuitToCanvasModule_drawPcbCopperPour as drawPcbCopperPour, CircuitToCanvasModule_drawPcbCopperText as drawPcbCopperText, CircuitToCanvasModule_drawPcbCourtyardCircle as drawPcbCourtyardCircle, CircuitToCanvasModule_drawPcbCutout as drawPcbCutout, CircuitToCanvasModule_drawPcbFabricationNoteDimension as drawPcbFabricationNoteDimension, CircuitToCanvasModule_drawPcbFabricationNotePath as drawPcbFabricationNotePath, CircuitToCanvasModule_drawPcbFabricationNoteRect as drawPcbFabricationNoteRect, CircuitToCanvasModule_drawPcbFabricationNoteText as drawPcbFabricationNoteText, CircuitToCanvasModule_drawPcbHole as drawPcbHole, CircuitToCanvasModule_drawPcbKeepout as drawPcbKeepout, CircuitToCanvasModule_drawPcbNoteDimension as drawPcbNoteDimension, CircuitToCanvasModule_drawPcbNotePath as drawPcbNotePath, CircuitToCanvasModule_drawPcbNoteRect as drawPcbNoteRect, CircuitToCanvasModule_drawPcbNoteText as drawPcbNoteText, CircuitToCanvasModule_drawPcbPanelElement as drawPcbPanelElement, CircuitToCanvasModule_drawPcbPlatedHole as drawPcbPlatedHole, CircuitToCanvasModule_drawPcbSilkscreenCircle as drawPcbSilkscreenCircle, CircuitToCanvasModule_drawPcbSilkscreenLine as drawPcbSilkscreenLine, CircuitToCanvasModule_drawPcbSilkscreenOval as drawPcbSilkscreenOval, CircuitToCanvasModule_drawPcbSilkscreenPath as drawPcbSilkscreenPath, CircuitToCanvasModule_drawPcbSilkscreenPill as drawPcbSilkscreenPill, CircuitToCanvasModule_drawPcbSilkscreenRect as drawPcbSilkscreenRect, CircuitToCanvasModule_drawPcbSilkscreenText as drawPcbSilkscreenText, CircuitToCanvasModule_drawPcbSmtPad as drawPcbSmtPad, CircuitToCanvasModule_drawPcbTrace as drawPcbTrace, CircuitToCanvasModule_drawPcbVia as drawPcbVia, CircuitToCanvasModule_drawPill as drawPill, CircuitToCanvasModule_drawPolygon as drawPolygon, CircuitToCanvasModule_drawRect as drawRect, CircuitToCanvasModule_drawSoldermaskRingForCircle as drawSoldermaskRingForCircle, CircuitToCanvasModule_drawSoldermaskRingForOval as drawSoldermaskRingForOval, CircuitToCanvasModule_drawSoldermaskRingForPill as drawSoldermaskRingForPill, CircuitToCanvasModule_drawSoldermaskRingForRect as drawSoldermaskRingForRect, CircuitToCanvasModule_drawText as drawText, CircuitToCanvasModule_getAlphabetLayout as getAlphabetLayout, CircuitToCanvasModule_getTextStartPosition as getTextStartPosition, CircuitToCanvasModule_strokeAlphabetText as strokeAlphabetText };
2966
+ export { type CircuitToCanvasModule_AddBrepRingToPathParams as AddBrepRingToPathParams, type CircuitToCanvasModule_AddBrepShapeToPathParams as AddBrepShapeToPathParams, type CircuitToCanvasModule_AlphabetLayout as AlphabetLayout, type CircuitToCanvasModule_AnchorAlignment as AnchorAlignment, type CircuitToCanvasModule_BrepShape as BrepShape, type CircuitToCanvasModule_CameraBounds as CameraBounds, type CircuitToCanvasModule_CanvasContext as CanvasContext, CircuitToCanvasModule_CircuitToCanvasDrawer as CircuitToCanvasDrawer, type CopperColorMap$1 as CopperColorMap, type CopperLayerName$1 as CopperLayerName, CircuitToCanvasModule_DEFAULT_PCB_COLOR_MAP as DEFAULT_PCB_COLOR_MAP, type CircuitToCanvasModule_DrawArrowParams as DrawArrowParams, type CircuitToCanvasModule_DrawCircleParams as DrawCircleParams, type CircuitToCanvasModule_DrawContext as DrawContext, type CircuitToCanvasModule_DrawDimensionLineParams as DrawDimensionLineParams, type CircuitToCanvasModule_DrawElementsOptions as DrawElementsOptions, type CircuitToCanvasModule_DrawLineParams as DrawLineParams, type CircuitToCanvasModule_DrawOvalParams as DrawOvalParams, type CircuitToCanvasModule_DrawPathParams as DrawPathParams, type CircuitToCanvasModule_DrawPcbBoardParams as DrawPcbBoardParams, type CircuitToCanvasModule_DrawPcbCopperPourParams as DrawPcbCopperPourParams, type CircuitToCanvasModule_DrawPcbCopperTextParams as DrawPcbCopperTextParams, type CircuitToCanvasModule_DrawPcbCourtyardCircleParams as DrawPcbCourtyardCircleParams, type CircuitToCanvasModule_DrawPcbCutoutParams as DrawPcbCutoutParams, type CircuitToCanvasModule_DrawPcbFabricationNoteDimensionParams as DrawPcbFabricationNoteDimensionParams, type CircuitToCanvasModule_DrawPcbFabricationNotePathParams as DrawPcbFabricationNotePathParams, type CircuitToCanvasModule_DrawPcbFabricationNoteRectParams as DrawPcbFabricationNoteRectParams, type CircuitToCanvasModule_DrawPcbFabricationNoteTextParams as DrawPcbFabricationNoteTextParams, type CircuitToCanvasModule_DrawPcbHoleParams as DrawPcbHoleParams, type CircuitToCanvasModule_DrawPcbKeepoutParams as DrawPcbKeepoutParams, type CircuitToCanvasModule_DrawPcbNoteDimensionParams as DrawPcbNoteDimensionParams, type CircuitToCanvasModule_DrawPcbNotePathParams as DrawPcbNotePathParams, type CircuitToCanvasModule_DrawPcbNoteRectParams as DrawPcbNoteRectParams, type CircuitToCanvasModule_DrawPcbNoteTextParams as DrawPcbNoteTextParams, type CircuitToCanvasModule_DrawPcbPanelParams as DrawPcbPanelParams, type CircuitToCanvasModule_DrawPcbPlatedHoleParams as DrawPcbPlatedHoleParams, type CircuitToCanvasModule_DrawPcbSilkscreenCircleParams as DrawPcbSilkscreenCircleParams, type CircuitToCanvasModule_DrawPcbSilkscreenGraphicParams as DrawPcbSilkscreenGraphicParams, type CircuitToCanvasModule_DrawPcbSilkscreenLineParams as DrawPcbSilkscreenLineParams, type CircuitToCanvasModule_DrawPcbSilkscreenOvalParams as DrawPcbSilkscreenOvalParams, type CircuitToCanvasModule_DrawPcbSilkscreenPathParams as DrawPcbSilkscreenPathParams, type CircuitToCanvasModule_DrawPcbSilkscreenPillParams as DrawPcbSilkscreenPillParams, type CircuitToCanvasModule_DrawPcbSilkscreenRectParams as DrawPcbSilkscreenRectParams, type CircuitToCanvasModule_DrawPcbSilkscreenTextParams as DrawPcbSilkscreenTextParams, type CircuitToCanvasModule_DrawPcbSmtPadParams as DrawPcbSmtPadParams, type CircuitToCanvasModule_DrawPcbSolderPasteParams as DrawPcbSolderPasteParams, type CircuitToCanvasModule_DrawPcbTraceParams as DrawPcbTraceParams, type CircuitToCanvasModule_DrawPcbViaParams as DrawPcbViaParams, type CircuitToCanvasModule_DrawPillParams as DrawPillParams, type CircuitToCanvasModule_DrawPolygonParams as DrawPolygonParams, type CircuitToCanvasModule_DrawRectParams as DrawRectParams, type CircuitToCanvasModule_DrawTextParams as DrawTextParams, type CircuitToCanvasModule_DrawerConfig as DrawerConfig, type PcbColorMap$1 as PcbColorMap, CircuitToCanvasModule_addBrepRingToPath as addBrepRingToPath, CircuitToCanvasModule_addBrepShapeToPath as addBrepShapeToPath, CircuitToCanvasModule_drawArrow as drawArrow, CircuitToCanvasModule_drawCircle as drawCircle, CircuitToCanvasModule_drawDimensionLine as drawDimensionLine, CircuitToCanvasModule_drawLine as drawLine, CircuitToCanvasModule_drawOval as drawOval, CircuitToCanvasModule_drawPath as drawPath, CircuitToCanvasModule_drawPcbBoard as drawPcbBoard, CircuitToCanvasModule_drawPcbCopperPour as drawPcbCopperPour, CircuitToCanvasModule_drawPcbCopperText as drawPcbCopperText, CircuitToCanvasModule_drawPcbCourtyardCircle as drawPcbCourtyardCircle, CircuitToCanvasModule_drawPcbCutout as drawPcbCutout, CircuitToCanvasModule_drawPcbFabricationNoteDimension as drawPcbFabricationNoteDimension, CircuitToCanvasModule_drawPcbFabricationNotePath as drawPcbFabricationNotePath, CircuitToCanvasModule_drawPcbFabricationNoteRect as drawPcbFabricationNoteRect, CircuitToCanvasModule_drawPcbFabricationNoteText as drawPcbFabricationNoteText, CircuitToCanvasModule_drawPcbHole as drawPcbHole, CircuitToCanvasModule_drawPcbKeepout as drawPcbKeepout, CircuitToCanvasModule_drawPcbNoteDimension as drawPcbNoteDimension, CircuitToCanvasModule_drawPcbNotePath as drawPcbNotePath, CircuitToCanvasModule_drawPcbNoteRect as drawPcbNoteRect, CircuitToCanvasModule_drawPcbNoteText as drawPcbNoteText, CircuitToCanvasModule_drawPcbPanelElement as drawPcbPanelElement, CircuitToCanvasModule_drawPcbPlatedHole as drawPcbPlatedHole, CircuitToCanvasModule_drawPcbSilkscreenCircle as drawPcbSilkscreenCircle, CircuitToCanvasModule_drawPcbSilkscreenGraphic as drawPcbSilkscreenGraphic, CircuitToCanvasModule_drawPcbSilkscreenLine as drawPcbSilkscreenLine, CircuitToCanvasModule_drawPcbSilkscreenOval as drawPcbSilkscreenOval, CircuitToCanvasModule_drawPcbSilkscreenPath as drawPcbSilkscreenPath, CircuitToCanvasModule_drawPcbSilkscreenPill as drawPcbSilkscreenPill, CircuitToCanvasModule_drawPcbSilkscreenRect as drawPcbSilkscreenRect, CircuitToCanvasModule_drawPcbSilkscreenText as drawPcbSilkscreenText, CircuitToCanvasModule_drawPcbSmtPad as drawPcbSmtPad, CircuitToCanvasModule_drawPcbSolderPaste as drawPcbSolderPaste, CircuitToCanvasModule_drawPcbTrace as drawPcbTrace, CircuitToCanvasModule_drawPcbVia as drawPcbVia, CircuitToCanvasModule_drawPill as drawPill, CircuitToCanvasModule_drawPolygon as drawPolygon, CircuitToCanvasModule_drawRect as drawRect, CircuitToCanvasModule_drawSoldermaskRingForCircle as drawSoldermaskRingForCircle, CircuitToCanvasModule_drawSoldermaskRingForOval as drawSoldermaskRingForOval, CircuitToCanvasModule_drawSoldermaskRingForPill as drawSoldermaskRingForPill, CircuitToCanvasModule_drawSoldermaskRingForRect as drawSoldermaskRingForRect, CircuitToCanvasModule_drawText as drawText, CircuitToCanvasModule_getAlphabetLayout as getAlphabetLayout, CircuitToCanvasModule_getTextStartPosition as getTextStartPosition, CircuitToCanvasModule_strokeAlphabetText as strokeAlphabetText };
2725
2967
  }
2726
2968
 
2727
2969
  interface PcbGridOptions {
@@ -3556,7 +3798,7 @@ declare namespace KicadToCircuitJsonModule {
3556
3798
  export { KicadToCircuitJsonModule_CollectFootprintsStage as CollectFootprintsStage, KicadToCircuitJsonModule_CollectGraphicsStage as CollectGraphicsStage, KicadToCircuitJsonModule_CollectLibrarySymbolsStage as CollectLibrarySymbolsStage, KicadToCircuitJsonModule_CollectNetsStage as CollectNetsStage, KicadToCircuitJsonModule_CollectSchematicTracesStage as CollectSchematicTracesStage, KicadToCircuitJsonModule_CollectSourceTracesStage as CollectSourceTracesStage, KicadToCircuitJsonModule_CollectSymbolLibrarySymbolsStage as CollectSymbolLibrarySymbolsStage, KicadToCircuitJsonModule_CollectTracesStage as CollectTracesStage, KicadToCircuitJsonModule_CollectViasStage as CollectViasStage, KicadToCircuitJsonModule_CollectZonesStage as CollectZonesStage, type KicadToCircuitJsonModule_ConverterContext as ConverterContext, KicadToCircuitJsonModule_ConverterStage as ConverterStage, KicadToCircuitJsonModule_InitializePcbContextStage as InitializePcbContextStage, KicadToCircuitJsonModule_InitializeSchematicContextStage as InitializeSchematicContextStage, KicadToCircuitJsonModule_InitializeSymbolLibraryContextStage as InitializeSymbolLibraryContextStage, KicadToCircuitJsonModule_KicadFootprintToCircuitJsonConverter as KicadFootprintToCircuitJsonConverter, KicadToCircuitJsonModule_KicadSymbolToCircuitJsonConverter as KicadSymbolToCircuitJsonConverter, KicadToCircuitJsonModule_KicadToCircuitJsonConverter as KicadToCircuitJsonConverter };
3557
3799
  }
3558
3800
 
3559
- declare const supportedModules: readonly ["circuit-json-to-3d-png", "circuit-json-to-bom-csv", "circuit-json-to-bpc", "circuit-json-to-connectivity-map", "circuit-json-to-gerber", "circuit-json-to-gltf", "circuit-json-to-kicad", "circuit-json-to-lbrn", "circuit-json-to-pnp-csv", "circuit-json-to-readable-netlist", "circuit-json-to-simple-3d", "circuit-json-to-spice", "circuit-json-to-step", "circuit-json-to-tscircuit", "circuit-to-canvas", "circuit-to-svg", "kicad-to-circuit-json"];
3801
+ declare const supportedModules: readonly ["circuit-json-to-3d-png", "circuit-json-to-bom-csv", "circuit-json-to-bpc", "circuit-json-to-connectivity-map", "circuit-json-to-fdm-component-box", "circuit-json-to-gerber", "circuit-json-to-gltf", "circuit-json-to-kicad", "circuit-json-to-lbrn", "circuit-json-to-pnp-csv", "circuit-json-to-readable-netlist", "circuit-json-to-simple-3d", "circuit-json-to-spice", "circuit-json-to-step", "circuit-json-to-tscircuit", "circuit-to-canvas", "circuit-to-svg", "kicad-to-circuit-json"];
3560
3802
  type SupportedModuleName = (typeof supportedModules)[number];
3561
3803
  type SupportedModuleSpecifier = SupportedModuleName | `${SupportedModuleName}@${string}`;
3562
3804
  interface SupportedModuleMap {
@@ -3564,6 +3806,7 @@ interface SupportedModuleMap {
3564
3806
  "circuit-json-to-bom-csv": typeof CircuitJsonToBomCsvModule;
3565
3807
  "circuit-json-to-bpc": typeof CircuitJsonToBpcModule;
3566
3808
  "circuit-json-to-connectivity-map": typeof CircuitJsonToConnectivityMapModule;
3809
+ "circuit-json-to-fdm-component-box": typeof CircuitJsonToFdmComponentBoxModule;
3567
3810
  "circuit-json-to-gerber": typeof CircuitJsonToGerberModule;
3568
3811
  "circuit-json-to-gltf": typeof CircuitJsonToGltfModule;
3569
3812
  "circuit-json-to-kicad": typeof CircuitJsonToKicadModule;
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ var supportedModules = [
18
18
  "circuit-json-to-bom-csv",
19
19
  "circuit-json-to-bpc",
20
20
  "circuit-json-to-connectivity-map",
21
+ "circuit-json-to-fdm-component-box",
21
22
  "circuit-json-to-gerber",
22
23
  "circuit-json-to-gltf",
23
24
  "circuit-json-to-kicad",
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../lib/dynamic-module-registry.ts","../lib/supported-modules.ts","../lib/index.ts"],"names":[],"mappings":";AAYO,IAAM,2BAA2B,MAA6B;AACnE,EAAA,IAAI,WAAW,uBAAA,EAAyB;AACtC,IAAA,OAAO,UAAA,CAAW,uBAAA;AAAA,EACpB;AAEA,EAAA,MAAM,WAAkC,EAAC;AACzC,EAAA,UAAA,CAAW,uBAAA,GAA0B,QAAA;AACrC,EAAA,OAAO,QAAA;AACT;AAUO,SAAS,qBAAA,CACd,MACA,GAAA,EACS;AACT,EAAA,wBAAA,EAAyB,CAAE,IAAI,CAAA,GAAI,GAAA;AACnC,EAAA,OAAO,GAAA;AACT;;;AClBO,IAAM,gBAAA,GAAmB;AAAA,EAC9B,wBAAA;AAAA,EACA,yBAAA;AAAA,EACA,qBAAA;AAAA,EACA,kCAAA;AAAA,EACA,wBAAA;AAAA,EACA,sBAAA;AAAA,EACA,uBAAA;AAAA,EACA,sBAAA;AAAA,EACA,yBAAA;AAAA,EACA,kCAAA;AAAA,EACA,2BAAA;AAAA,EACA,uBAAA;AAAA,EACA,sBAAA;AAAA,EACA,2BAAA;AAAA,EACA,mBAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF;AAoCO,IAAM,aAAA,GAAgB,CAAC,SAAA,KAA8B;AAC1D,EAAA,MAAM,qBAAA,GAAwB,SAAA,CAAU,OAAA,CAAQ,GAAG,CAAA;AACnD,EAAA,OAAO,0BAA0B,EAAA,GAC7B,SAAA,GACA,SAAA,CAAU,KAAA,CAAM,GAAG,qBAAqB,CAAA;AAC9C;;;ACpDA,IAAM,kBAAA,GAAqB,IAAI,GAAA,CAAY,gBAAgB,CAAA;AAEpD,IAAM,YAAA,GAAe,CAAC,SAAA,KAA8B;AACzD,EAAA,qBAAA,CAAsB,SAAS,CAAA;AAE/B,EAAA,OAAO,kBAAkB,SAAS,CAAA;AACpC;AAEO,IAAM,aAAA,GAAgB,CAAC,SAAA,KAAgC;AAC5D,EAAA,qBAAA,CAAsB,SAAS,CAAA;AAE/B,EAAA,OAAO,CAAC,iBAAA,CAAkB,SAAS,CAAA,EAAG,CAAA,gBAAA,EAAmB,SAAS,CAAA,CAAE,CAAA;AACtE;AAEA,SAAS,kBAAkB,SAAA,EAA2B;AACpD,EAAA,MAAM,UAAA,GAAa,cAAc,SAAS,CAAA;AAC1C,EAAA,MAAM,OAAA,GACJ,SAAA,CAAU,MAAA,KAAW,UAAA,CAAW,MAAA,GAC5B,WACA,SAAA,CAAU,KAAA,CAAM,UAAA,CAAW,MAAA,GAAS,CAAC,CAAA;AAE3C,EAAA,OAAO,CAAA,4BAAA,EAA+B,UAAU,CAAA,CAAA,EAAI,OAAO,CAAA,KAAA,CAAA;AAC7D;AAEA,SAAS,sBAAsB,SAAA,EAAmB;AAChD,EAAA,MAAM,UAAA,GAAa,cAAc,SAAS,CAAA;AAE1C,EAAA,IAAI,CAAC,kBAAA,CAAmB,GAAA,CAAI,UAAU,CAAA,EAAG;AACvC,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,oBAAA,EAAuB,SAAS,CAAA,CAAE,CAAA;AAAA,EACpD;AACF;AAMA,eAAe,SAAS,SAAA,EAAqC;AAC3D,EAAA,IAAI,SAAA;AAEJ,EAAA,KAAA,MAAW,SAAA,IAAa,aAAA,CAAc,SAAS,CAAA,EAAG;AAChD,IAAA,IAAI;AACF,MAAA,MAAM,MAAM,MAAM;AAAA;AAAA,QAA0B;AAAA,OAAA;AAC5C,MAAA,OAAO,qBAAA,CAAsB,aAAA,CAAc,SAAS,CAAA,EAAG,GAAG,CAAA;AAAA,IAC5D,SAAS,KAAA,EAAO;AACd,MAAA,SAAA,GAAY,KAAA;AAAA,IACd;AAAA,EACF;AAEA,EAAA,MAAM,SAAA;AACR;AAEA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["import type {\n SupportedModuleMap,\n SupportedModuleName,\n} from \"./supported-modules\"\n\nexport type DynamicModuleRegistry = Partial<SupportedModuleMap> &\n Record<string, unknown>\n\ndeclare global {\n var tscircuitDynamicModules: DynamicModuleRegistry | undefined\n}\n\nexport const getDynamicModuleRegistry = (): DynamicModuleRegistry => {\n if (globalThis.tscircuitDynamicModules) {\n return globalThis.tscircuitDynamicModules\n }\n\n const registry: DynamicModuleRegistry = {}\n globalThis.tscircuitDynamicModules = registry\n return registry\n}\n\nexport function registerDynamicModule<TSpecifier extends SupportedModuleName>(\n name: TSpecifier,\n mod: SupportedModuleMap[TSpecifier],\n): SupportedModuleMap[TSpecifier]\nexport function registerDynamicModule<TModule>(\n name: string,\n mod: TModule,\n): TModule\nexport function registerDynamicModule<TModule>(\n name: string,\n mod: TModule,\n): TModule {\n getDynamicModuleRegistry()[name] = mod\n return mod\n}\n","import type * as CircuitJsonTo3dPngModule from \"./type-bundles/circuit-json-to-3d-png\"\nimport type * as CircuitJsonToBomCsvModule from \"./type-bundles/circuit-json-to-bom-csv\"\nimport type * as CircuitJsonToBpcModule from \"./type-bundles/circuit-json-to-bpc\"\nimport type * as CircuitJsonToConnectivityMapModule from \"./type-bundles/circuit-json-to-connectivity-map\"\nimport type * as CircuitJsonToGerberModule from \"./type-bundles/circuit-json-to-gerber\"\nimport type * as CircuitJsonToGltfModule from \"./type-bundles/circuit-json-to-gltf\"\nimport type * as CircuitJsonToKicadModule from \"./type-bundles/circuit-json-to-kicad\"\nimport type * as CircuitJsonToLbrnModule from \"./type-bundles/circuit-json-to-lbrn\"\nimport type * as CircuitJsonToPnpCsvModule from \"./type-bundles/circuit-json-to-pnp-csv\"\nimport type * as CircuitJsonToReadableNetlistModule from \"./type-bundles/circuit-json-to-readable-netlist\"\nimport type * as CircuitJsonToSimple3dModule from \"./type-bundles/circuit-json-to-simple-3d\"\nimport type * as CircuitJsonToSpiceModule from \"./type-bundles/circuit-json-to-spice\"\nimport type * as CircuitJsonToStepModule from \"./type-bundles/circuit-json-to-step\"\nimport type * as CircuitJsonToTscircuitModule from \"./type-bundles/circuit-json-to-tscircuit\"\nimport type * as CircuitToCanvasModule from \"./type-bundles/circuit-to-canvas\"\nimport type * as CircuitToSvgModule from \"./type-bundles/circuit-to-svg\"\nimport type * as KicadToCircuitJsonModule from \"./type-bundles/kicad-to-circuit-json\"\n\nexport const supportedModules = [\n \"circuit-json-to-3d-png\",\n \"circuit-json-to-bom-csv\",\n \"circuit-json-to-bpc\",\n \"circuit-json-to-connectivity-map\",\n \"circuit-json-to-gerber\",\n \"circuit-json-to-gltf\",\n \"circuit-json-to-kicad\",\n \"circuit-json-to-lbrn\",\n \"circuit-json-to-pnp-csv\",\n \"circuit-json-to-readable-netlist\",\n \"circuit-json-to-simple-3d\",\n \"circuit-json-to-spice\",\n \"circuit-json-to-step\",\n \"circuit-json-to-tscircuit\",\n \"circuit-to-canvas\",\n \"circuit-to-svg\",\n \"kicad-to-circuit-json\",\n] as const\n\nexport type SupportedModuleName = (typeof supportedModules)[number]\nexport type SupportedModuleSpecifier =\n | SupportedModuleName\n | `${SupportedModuleName}@${string}`\n\nexport interface SupportedModuleMap {\n \"circuit-json-to-3d-png\": typeof CircuitJsonTo3dPngModule\n \"circuit-json-to-bom-csv\": typeof CircuitJsonToBomCsvModule\n \"circuit-json-to-bpc\": typeof CircuitJsonToBpcModule\n \"circuit-json-to-connectivity-map\": typeof CircuitJsonToConnectivityMapModule\n \"circuit-json-to-gerber\": typeof CircuitJsonToGerberModule\n \"circuit-json-to-gltf\": typeof CircuitJsonToGltfModule\n \"circuit-json-to-kicad\": typeof CircuitJsonToKicadModule\n \"circuit-json-to-lbrn\": typeof CircuitJsonToLbrnModule\n \"circuit-json-to-pnp-csv\": typeof CircuitJsonToPnpCsvModule\n \"circuit-json-to-readable-netlist\": typeof CircuitJsonToReadableNetlistModule\n \"circuit-json-to-simple-3d\": typeof CircuitJsonToSimple3dModule\n \"circuit-json-to-spice\": typeof CircuitJsonToSpiceModule\n \"circuit-json-to-step\": typeof CircuitJsonToStepModule\n \"circuit-json-to-tscircuit\": typeof CircuitJsonToTscircuitModule\n \"circuit-to-canvas\": typeof CircuitToCanvasModule\n \"circuit-to-svg\": typeof CircuitToSvgModule\n \"kicad-to-circuit-json\": typeof KicadToCircuitJsonModule\n}\n\nexport type StripVersion<TSpecifier extends string> =\n TSpecifier extends `${infer TBase}@${string}`\n ? TBase extends SupportedModuleName\n ? TBase\n : never\n : TSpecifier extends SupportedModuleName\n ? TSpecifier\n : never\n\nexport const getModuleName = (specifier: string): string => {\n const versionSeparatorIndex = specifier.indexOf(\"@\")\n return versionSeparatorIndex === -1\n ? specifier\n : specifier.slice(0, versionSeparatorIndex)\n}\n","import { registerDynamicModule } from \"./dynamic-module-registry\"\nimport {\n getModuleName,\n supportedModules,\n type StripVersion,\n type SupportedModuleMap,\n type SupportedModuleSpecifier,\n} from \"./supported-modules\"\n\nexport {\n getDynamicModuleRegistry,\n registerDynamicModule,\n} from \"./dynamic-module-registry\"\nexport type { DynamicModuleRegistry } from \"./dynamic-module-registry\"\nexport {\n getModuleName,\n supportedModules,\n} from \"./supported-modules\"\nexport type {\n StripVersion,\n SupportedModuleMap,\n SupportedModuleName,\n SupportedModuleSpecifier,\n} from \"./supported-modules\"\n\nconst supportedModuleSet = new Set<string>(supportedModules)\n\nexport const getImportUrl = (specifier: string): string => {\n assertSupportedModule(specifier)\n\n return getJscdnImportUrl(specifier)\n}\n\nexport const getImportUrls = (specifier: string): string[] => {\n assertSupportedModule(specifier)\n\n return [getJscdnImportUrl(specifier), `https://esm.run/${specifier}`]\n}\n\nfunction getJscdnImportUrl(specifier: string): string {\n const moduleName = getModuleName(specifier)\n const version =\n specifier.length === moduleName.length\n ? \"latest\"\n : specifier.slice(moduleName.length + 1)\n\n return `https://jscdn.tscircuit.com/${moduleName}/${version}/+esm`\n}\n\nfunction assertSupportedModule(specifier: string) {\n const moduleName = getModuleName(specifier)\n\n if (!supportedModuleSet.has(moduleName)) {\n throw new Error(`Unsupported module: ${specifier}`)\n }\n}\n\nasync function importer<TSpecifier extends SupportedModuleSpecifier>(\n specifier: TSpecifier,\n): Promise<SupportedModuleMap[StripVersion<TSpecifier>]>\nasync function importer(specifier: string): Promise<unknown>\nasync function importer(specifier: string): Promise<unknown> {\n let lastError: unknown\n\n for (const importUrl of getImportUrls(specifier)) {\n try {\n const mod = await import(/* @vite-ignore */ importUrl)\n return registerDynamicModule(getModuleName(specifier), mod)\n } catch (error) {\n lastError = error\n }\n }\n\n throw lastError\n}\n\nexport default importer\n"]}
1
+ {"version":3,"sources":["../lib/dynamic-module-registry.ts","../lib/supported-modules.ts","../lib/index.ts"],"names":[],"mappings":";AAYO,IAAM,2BAA2B,MAA6B;AACnE,EAAA,IAAI,WAAW,uBAAA,EAAyB;AACtC,IAAA,OAAO,UAAA,CAAW,uBAAA;AAAA,EACpB;AAEA,EAAA,MAAM,WAAkC,EAAC;AACzC,EAAA,UAAA,CAAW,uBAAA,GAA0B,QAAA;AACrC,EAAA,OAAO,QAAA;AACT;AAUO,SAAS,qBAAA,CACd,MACA,GAAA,EACS;AACT,EAAA,wBAAA,EAAyB,CAAE,IAAI,CAAA,GAAI,GAAA;AACnC,EAAA,OAAO,GAAA;AACT;;;ACjBO,IAAM,gBAAA,GAAmB;AAAA,EAC9B,wBAAA;AAAA,EACA,yBAAA;AAAA,EACA,qBAAA;AAAA,EACA,kCAAA;AAAA,EACA,mCAAA;AAAA,EACA,wBAAA;AAAA,EACA,sBAAA;AAAA,EACA,uBAAA;AAAA,EACA,sBAAA;AAAA,EACA,yBAAA;AAAA,EACA,kCAAA;AAAA,EACA,2BAAA;AAAA,EACA,uBAAA;AAAA,EACA,sBAAA;AAAA,EACA,2BAAA;AAAA,EACA,mBAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF;AAqCO,IAAM,aAAA,GAAgB,CAAC,SAAA,KAA8B;AAC1D,EAAA,MAAM,qBAAA,GAAwB,SAAA,CAAU,OAAA,CAAQ,GAAG,CAAA;AACnD,EAAA,OAAO,0BAA0B,EAAA,GAC7B,SAAA,GACA,SAAA,CAAU,KAAA,CAAM,GAAG,qBAAqB,CAAA;AAC9C;;;ACvDA,IAAM,kBAAA,GAAqB,IAAI,GAAA,CAAY,gBAAgB,CAAA;AAEpD,IAAM,YAAA,GAAe,CAAC,SAAA,KAA8B;AACzD,EAAA,qBAAA,CAAsB,SAAS,CAAA;AAE/B,EAAA,OAAO,kBAAkB,SAAS,CAAA;AACpC;AAEO,IAAM,aAAA,GAAgB,CAAC,SAAA,KAAgC;AAC5D,EAAA,qBAAA,CAAsB,SAAS,CAAA;AAE/B,EAAA,OAAO,CAAC,iBAAA,CAAkB,SAAS,CAAA,EAAG,CAAA,gBAAA,EAAmB,SAAS,CAAA,CAAE,CAAA;AACtE;AAEA,SAAS,kBAAkB,SAAA,EAA2B;AACpD,EAAA,MAAM,UAAA,GAAa,cAAc,SAAS,CAAA;AAC1C,EAAA,MAAM,OAAA,GACJ,SAAA,CAAU,MAAA,KAAW,UAAA,CAAW,MAAA,GAC5B,WACA,SAAA,CAAU,KAAA,CAAM,UAAA,CAAW,MAAA,GAAS,CAAC,CAAA;AAE3C,EAAA,OAAO,CAAA,4BAAA,EAA+B,UAAU,CAAA,CAAA,EAAI,OAAO,CAAA,KAAA,CAAA;AAC7D;AAEA,SAAS,sBAAsB,SAAA,EAAmB;AAChD,EAAA,MAAM,UAAA,GAAa,cAAc,SAAS,CAAA;AAE1C,EAAA,IAAI,CAAC,kBAAA,CAAmB,GAAA,CAAI,UAAU,CAAA,EAAG;AACvC,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,oBAAA,EAAuB,SAAS,CAAA,CAAE,CAAA;AAAA,EACpD;AACF;AAMA,eAAe,SAAS,SAAA,EAAqC;AAC3D,EAAA,IAAI,SAAA;AAEJ,EAAA,KAAA,MAAW,SAAA,IAAa,aAAA,CAAc,SAAS,CAAA,EAAG;AAChD,IAAA,IAAI;AACF,MAAA,MAAM,MAAM,MAAM;AAAA;AAAA,QAA0B;AAAA,OAAA;AAC5C,MAAA,OAAO,qBAAA,CAAsB,aAAA,CAAc,SAAS,CAAA,EAAG,GAAG,CAAA;AAAA,IAC5D,SAAS,KAAA,EAAO;AACd,MAAA,SAAA,GAAY,KAAA;AAAA,IACd;AAAA,EACF;AAEA,EAAA,MAAM,SAAA;AACR;AAEA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["import type {\n SupportedModuleMap,\n SupportedModuleName,\n} from \"./supported-modules\"\n\nexport type DynamicModuleRegistry = Partial<SupportedModuleMap> &\n Record<string, unknown>\n\ndeclare global {\n var tscircuitDynamicModules: DynamicModuleRegistry | undefined\n}\n\nexport const getDynamicModuleRegistry = (): DynamicModuleRegistry => {\n if (globalThis.tscircuitDynamicModules) {\n return globalThis.tscircuitDynamicModules\n }\n\n const registry: DynamicModuleRegistry = {}\n globalThis.tscircuitDynamicModules = registry\n return registry\n}\n\nexport function registerDynamicModule<TSpecifier extends SupportedModuleName>(\n name: TSpecifier,\n mod: SupportedModuleMap[TSpecifier],\n): SupportedModuleMap[TSpecifier]\nexport function registerDynamicModule<TModule>(\n name: string,\n mod: TModule,\n): TModule\nexport function registerDynamicModule<TModule>(\n name: string,\n mod: TModule,\n): TModule {\n getDynamicModuleRegistry()[name] = mod\n return mod\n}\n","import type * as CircuitJsonTo3dPngModule from \"./type-bundles/circuit-json-to-3d-png\"\nimport type * as CircuitJsonToBomCsvModule from \"./type-bundles/circuit-json-to-bom-csv\"\nimport type * as CircuitJsonToBpcModule from \"./type-bundles/circuit-json-to-bpc\"\nimport type * as CircuitJsonToConnectivityMapModule from \"./type-bundles/circuit-json-to-connectivity-map\"\nimport type * as CircuitJsonToFdmComponentBoxModule from \"./type-bundles/circuit-json-to-fdm-component-box\"\nimport type * as CircuitJsonToGerberModule from \"./type-bundles/circuit-json-to-gerber\"\nimport type * as CircuitJsonToGltfModule from \"./type-bundles/circuit-json-to-gltf\"\nimport type * as CircuitJsonToKicadModule from \"./type-bundles/circuit-json-to-kicad\"\nimport type * as CircuitJsonToLbrnModule from \"./type-bundles/circuit-json-to-lbrn\"\nimport type * as CircuitJsonToPnpCsvModule from \"./type-bundles/circuit-json-to-pnp-csv\"\nimport type * as CircuitJsonToReadableNetlistModule from \"./type-bundles/circuit-json-to-readable-netlist\"\nimport type * as CircuitJsonToSimple3dModule from \"./type-bundles/circuit-json-to-simple-3d\"\nimport type * as CircuitJsonToSpiceModule from \"./type-bundles/circuit-json-to-spice\"\nimport type * as CircuitJsonToStepModule from \"./type-bundles/circuit-json-to-step\"\nimport type * as CircuitJsonToTscircuitModule from \"./type-bundles/circuit-json-to-tscircuit\"\nimport type * as CircuitToCanvasModule from \"./type-bundles/circuit-to-canvas\"\nimport type * as CircuitToSvgModule from \"./type-bundles/circuit-to-svg\"\nimport type * as KicadToCircuitJsonModule from \"./type-bundles/kicad-to-circuit-json\"\n\nexport const supportedModules = [\n \"circuit-json-to-3d-png\",\n \"circuit-json-to-bom-csv\",\n \"circuit-json-to-bpc\",\n \"circuit-json-to-connectivity-map\",\n \"circuit-json-to-fdm-component-box\",\n \"circuit-json-to-gerber\",\n \"circuit-json-to-gltf\",\n \"circuit-json-to-kicad\",\n \"circuit-json-to-lbrn\",\n \"circuit-json-to-pnp-csv\",\n \"circuit-json-to-readable-netlist\",\n \"circuit-json-to-simple-3d\",\n \"circuit-json-to-spice\",\n \"circuit-json-to-step\",\n \"circuit-json-to-tscircuit\",\n \"circuit-to-canvas\",\n \"circuit-to-svg\",\n \"kicad-to-circuit-json\",\n] as const\n\nexport type SupportedModuleName = (typeof supportedModules)[number]\nexport type SupportedModuleSpecifier =\n | SupportedModuleName\n | `${SupportedModuleName}@${string}`\n\nexport interface SupportedModuleMap {\n \"circuit-json-to-3d-png\": typeof CircuitJsonTo3dPngModule\n \"circuit-json-to-bom-csv\": typeof CircuitJsonToBomCsvModule\n \"circuit-json-to-bpc\": typeof CircuitJsonToBpcModule\n \"circuit-json-to-connectivity-map\": typeof CircuitJsonToConnectivityMapModule\n \"circuit-json-to-fdm-component-box\": typeof CircuitJsonToFdmComponentBoxModule\n \"circuit-json-to-gerber\": typeof CircuitJsonToGerberModule\n \"circuit-json-to-gltf\": typeof CircuitJsonToGltfModule\n \"circuit-json-to-kicad\": typeof CircuitJsonToKicadModule\n \"circuit-json-to-lbrn\": typeof CircuitJsonToLbrnModule\n \"circuit-json-to-pnp-csv\": typeof CircuitJsonToPnpCsvModule\n \"circuit-json-to-readable-netlist\": typeof CircuitJsonToReadableNetlistModule\n \"circuit-json-to-simple-3d\": typeof CircuitJsonToSimple3dModule\n \"circuit-json-to-spice\": typeof CircuitJsonToSpiceModule\n \"circuit-json-to-step\": typeof CircuitJsonToStepModule\n \"circuit-json-to-tscircuit\": typeof CircuitJsonToTscircuitModule\n \"circuit-to-canvas\": typeof CircuitToCanvasModule\n \"circuit-to-svg\": typeof CircuitToSvgModule\n \"kicad-to-circuit-json\": typeof KicadToCircuitJsonModule\n}\n\nexport type StripVersion<TSpecifier extends string> =\n TSpecifier extends `${infer TBase}@${string}`\n ? TBase extends SupportedModuleName\n ? TBase\n : never\n : TSpecifier extends SupportedModuleName\n ? TSpecifier\n : never\n\nexport const getModuleName = (specifier: string): string => {\n const versionSeparatorIndex = specifier.indexOf(\"@\")\n return versionSeparatorIndex === -1\n ? specifier\n : specifier.slice(0, versionSeparatorIndex)\n}\n","import { registerDynamicModule } from \"./dynamic-module-registry\"\nimport {\n getModuleName,\n supportedModules,\n type StripVersion,\n type SupportedModuleMap,\n type SupportedModuleSpecifier,\n} from \"./supported-modules\"\n\nexport {\n getDynamicModuleRegistry,\n registerDynamicModule,\n} from \"./dynamic-module-registry\"\nexport type { DynamicModuleRegistry } from \"./dynamic-module-registry\"\nexport {\n getModuleName,\n supportedModules,\n} from \"./supported-modules\"\nexport type {\n StripVersion,\n SupportedModuleMap,\n SupportedModuleName,\n SupportedModuleSpecifier,\n} from \"./supported-modules\"\n\nconst supportedModuleSet = new Set<string>(supportedModules)\n\nexport const getImportUrl = (specifier: string): string => {\n assertSupportedModule(specifier)\n\n return getJscdnImportUrl(specifier)\n}\n\nexport const getImportUrls = (specifier: string): string[] => {\n assertSupportedModule(specifier)\n\n return [getJscdnImportUrl(specifier), `https://esm.run/${specifier}`]\n}\n\nfunction getJscdnImportUrl(specifier: string): string {\n const moduleName = getModuleName(specifier)\n const version =\n specifier.length === moduleName.length\n ? \"latest\"\n : specifier.slice(moduleName.length + 1)\n\n return `https://jscdn.tscircuit.com/${moduleName}/${version}/+esm`\n}\n\nfunction assertSupportedModule(specifier: string) {\n const moduleName = getModuleName(specifier)\n\n if (!supportedModuleSet.has(moduleName)) {\n throw new Error(`Unsupported module: ${specifier}`)\n }\n}\n\nasync function importer<TSpecifier extends SupportedModuleSpecifier>(\n specifier: TSpecifier,\n): Promise<SupportedModuleMap[StripVersion<TSpecifier>]>\nasync function importer(specifier: string): Promise<unknown>\nasync function importer(specifier: string): Promise<unknown> {\n let lastError: unknown\n\n for (const importUrl of getImportUrls(specifier)) {\n try {\n const mod = await import(/* @vite-ignore */ importUrl)\n return registerDynamicModule(getModuleName(specifier), mod)\n } catch (error) {\n lastError = error\n }\n }\n\n throw lastError\n}\n\nexport default importer\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/internal-dynamic-import",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "Type-safe dynamic imports for selected tscircuit packages via jscdn and fallback to jsDelivr",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -32,6 +32,7 @@
32
32
  "circuit-json-to-bom-csv": "0.0.14",
33
33
  "circuit-json-to-bpc": "0.0.13",
34
34
  "circuit-json-to-connectivity-map": "0.0.23",
35
+ "circuit-json-to-fdm-component-box": "0.0.2",
35
36
  "circuit-json-to-gerber": "0.0.84",
36
37
  "circuit-json-to-gltf": "0.0.106",
37
38
  "circuit-json-to-kicad": "0.0.137",
@@ -42,7 +43,7 @@
42
43
  "circuit-json-to-spice": "0.0.34",
43
44
  "circuit-json-to-step": "0.0.19",
44
45
  "circuit-json-to-tscircuit": "0.0.42",
45
- "circuit-to-canvas": "0.0.94",
46
+ "circuit-to-canvas": "0.0.123",
46
47
  "circuit-to-svg": "0.0.339",
47
48
  "kicad-to-circuit-json": "0.0.98",
48
49
  "tsup": "8.5.1",