circuit-json 0.0.76 → 0.0.77

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.mjs ADDED
@@ -0,0 +1,1037 @@
1
+ // src/utils/convert-si-unit-to-number.ts
2
+ import convertUnits from "convert-units";
3
+ var si_prefix_multiplier = {
4
+ tera: 1e13,
5
+ T: 1e13,
6
+ giga: 1e10,
7
+ G: 1e10,
8
+ mega: 1e7,
9
+ M: 1e7,
10
+ kilo: 1e4,
11
+ k: 1e4,
12
+ deci: 1,
13
+ d: 1,
14
+ centi: 0.1,
15
+ c: 0.1,
16
+ milli: 0.01,
17
+ m: 0.01,
18
+ micro: 1e-5,
19
+ u: 1e-5,
20
+ \u00B5: 1e-5,
21
+ nano: 1e-8,
22
+ n: 1e-8,
23
+ pico: 1e-11,
24
+ p: 1e-11
25
+ };
26
+ var si_prefixes = Object.keys(si_prefix_multiplier);
27
+ var target_conversion = {
28
+ mass: "g",
29
+ length: "mm",
30
+ time: "ms",
31
+ volume: "ml",
32
+ angle: "deg"
33
+ };
34
+ function getSiPrefixMultiplierFromUnit(v) {
35
+ for (const prefix of si_prefixes) {
36
+ if (v.startsWith(prefix)) {
37
+ return si_prefix_multiplier[prefix];
38
+ }
39
+ }
40
+ return 1;
41
+ }
42
+ var parseAndConvertSiUnit = (v) => {
43
+ if (typeof v === "undefined") return { unit: null, value: null };
44
+ if (typeof v === "string" && v.match(/^[\d\.]+$/))
45
+ return { value: parseFloat(v), unit: null };
46
+ if (typeof v === "number") return { value: v, unit: null };
47
+ if (typeof v === "object" && "x" in v && "y" in v) {
48
+ return {
49
+ unit: parseAndConvertSiUnit(v.x).unit,
50
+ value: {
51
+ x: parseAndConvertSiUnit(v.x).value,
52
+ y: parseAndConvertSiUnit(v.y).value
53
+ }
54
+ };
55
+ }
56
+ const unit_reversed = v.split("").reverse().join("").match(/[a-zA-Z]+/)?.[0];
57
+ if (!unit_reversed) {
58
+ throw new Error(`Could not determine unit: "${v}"`);
59
+ }
60
+ const unit = unit_reversed.split("").reverse().join("");
61
+ const value = v.slice(0, -unit.length);
62
+ let measure;
63
+ try {
64
+ measure = convertUnits().describe(unit)?.measure;
65
+ } catch (e) {
66
+ }
67
+ if (measure) {
68
+ const target_unit = target_conversion[measure];
69
+ if (!target_unit) {
70
+ throw new Error(
71
+ `Could not determine target unit for measure: "${measure}"`
72
+ );
73
+ }
74
+ return {
75
+ unit,
76
+ value: convertUnits(parseFloat(value)).from(unit).to(target_unit)
77
+ };
78
+ } else {
79
+ return {
80
+ unit,
81
+ value: getSiPrefixMultiplierFromUnit(unit) * parseFloat(value)
82
+ };
83
+ }
84
+ };
85
+
86
+ // src/units/index.ts
87
+ import { z } from "zod";
88
+ var resistance = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v).value);
89
+ var capacitance = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v).value);
90
+ var inductance = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v).value);
91
+ var voltage = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v).value);
92
+ var length = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v).value);
93
+ var distance = length;
94
+ var current = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v).value);
95
+ var time = z.string().or(z.number()).transform((v) => parseAndConvertSiUnit(v).value);
96
+ var rotation = z.string().or(z.number()).transform((arg) => {
97
+ if (typeof arg === "number") return arg;
98
+ if (arg.endsWith("deg")) {
99
+ return Number.parseFloat(arg.split("deg")[0]);
100
+ }
101
+ if (arg.endsWith("rad")) {
102
+ return Number.parseFloat(arg.split("rad")[0]) * 180 / Math.PI;
103
+ }
104
+ return Number.parseFloat(arg);
105
+ });
106
+
107
+ // src/common/point.ts
108
+ import { z as z2 } from "zod";
109
+ var point = z2.object({
110
+ x: distance,
111
+ y: distance
112
+ });
113
+ var position = point;
114
+
115
+ // src/common/point3.ts
116
+ import { z as z3 } from "zod";
117
+ var point3 = z3.object({
118
+ x: distance,
119
+ y: distance,
120
+ z: distance
121
+ });
122
+ var position3 = point3;
123
+
124
+ // src/common/size.ts
125
+ import { z as z4 } from "zod";
126
+ var size = z4.object({
127
+ width: z4.number(),
128
+ height: z4.number()
129
+ });
130
+
131
+ // src/common/getZodPrefixedIdWithDefault.ts
132
+ import { z as z5 } from "zod";
133
+ import { nanoid } from "nanoid";
134
+ var getZodPrefixedIdWithDefault = (prefix) => {
135
+ return z5.string().optional().default(() => `${prefix}_${nanoid(10)}`);
136
+ };
137
+
138
+ // src/source/source_simple_capacitor.ts
139
+ import { z as z8 } from "zod";
140
+
141
+ // src/pcb/properties/supplier_name.ts
142
+ import { z as z6 } from "zod";
143
+ var supplier_name = z6.enum([
144
+ "jlcpcb",
145
+ "macrofab",
146
+ "pcbway",
147
+ "digikey",
148
+ "mouser",
149
+ "lcsc"
150
+ ]);
151
+
152
+ // src/source/base/source_component_base.ts
153
+ import { z as z7 } from "zod";
154
+ var source_component_base = z7.object({
155
+ type: z7.literal("source_component"),
156
+ ftype: z7.string().optional(),
157
+ source_component_id: z7.string(),
158
+ name: z7.string(),
159
+ manufacturer_part_number: z7.string().optional(),
160
+ supplier_part_numbers: z7.record(supplier_name, z7.array(z7.string())).optional()
161
+ });
162
+
163
+ // src/source/source_simple_capacitor.ts
164
+ var source_simple_capacitor = source_component_base.extend({
165
+ ftype: z8.literal("simple_capacitor"),
166
+ capacitance
167
+ });
168
+
169
+ // src/source/source_simple_resistor.ts
170
+ import { z as z9 } from "zod";
171
+ var source_simple_resistor = source_component_base.extend({
172
+ ftype: z9.literal("simple_resistor"),
173
+ resistance
174
+ });
175
+
176
+ // src/source/source_simple_diode.ts
177
+ import { z as z10 } from "zod";
178
+ var source_simple_diode = source_component_base.extend({
179
+ ftype: z10.literal("simple_diode")
180
+ });
181
+
182
+ // src/source/source_simple_ground.ts
183
+ import { z as z11 } from "zod";
184
+ var source_simple_ground = source_component_base.extend({
185
+ ftype: z11.literal("simple_ground")
186
+ });
187
+
188
+ // src/source/source_simple_bug.ts
189
+ import { z as z12 } from "zod";
190
+ var source_simple_bug = source_component_base.extend({
191
+ ftype: z12.literal("simple_bug")
192
+ }).describe("@deprecated");
193
+
194
+ // src/source/source_simple_chip.ts
195
+ import { z as z13 } from "zod";
196
+ var source_simple_chip = source_component_base.extend({
197
+ ftype: z13.literal("simple_chip")
198
+ });
199
+
200
+ // src/source/source_simple_inductor.ts
201
+ import { z as z14 } from "zod";
202
+ var source_simple_inductor = source_component_base.extend({
203
+ ftype: z14.literal("simple_inductor"),
204
+ inductance
205
+ });
206
+
207
+ // src/source/source_led.ts
208
+ import { z as z15 } from "zod";
209
+ var source_led = source_simple_diode.extend({
210
+ ftype: z15.literal("led")
211
+ });
212
+
213
+ // src/source/source_simple_power_source.ts
214
+ import { z as z16 } from "zod";
215
+ var source_simple_power_source = source_component_base.extend({
216
+ ftype: z16.literal("simple_power_source"),
217
+ voltage
218
+ });
219
+
220
+ // src/source/any_source_component.ts
221
+ import { z as z17 } from "zod";
222
+ var any_source_component = z17.union([
223
+ source_simple_resistor,
224
+ source_simple_capacitor,
225
+ source_simple_diode,
226
+ source_simple_ground,
227
+ source_simple_chip,
228
+ source_simple_bug,
229
+ source_led,
230
+ source_simple_power_source
231
+ ]);
232
+
233
+ // src/source/source_port.ts
234
+ import { z as z18 } from "zod";
235
+ var source_port = z18.object({
236
+ type: z18.literal("source_port"),
237
+ pin_number: z18.number().optional(),
238
+ port_hints: z18.array(z18.string()).optional(),
239
+ name: z18.string(),
240
+ source_port_id: z18.string(),
241
+ source_component_id: z18.string()
242
+ });
243
+
244
+ // src/source/source_trace.ts
245
+ import { z as z19 } from "zod";
246
+ var source_trace = z19.object({
247
+ type: z19.literal("source_trace"),
248
+ source_trace_id: z19.string(),
249
+ connected_source_port_ids: z19.array(z19.string()),
250
+ connected_source_net_ids: z19.array(z19.string())
251
+ });
252
+
253
+ // src/source/source_group.ts
254
+ import { z as z20 } from "zod";
255
+ var source_group = z20.object({
256
+ type: z20.literal("source_group"),
257
+ source_group_id: z20.string(),
258
+ name: z20.string().optional()
259
+ });
260
+
261
+ // src/source/source_net.ts
262
+ import { z as z21 } from "zod";
263
+ var source_net = z21.object({
264
+ type: z21.literal("source_net"),
265
+ source_net_id: z21.string(),
266
+ name: z21.string(),
267
+ member_source_group_ids: z21.array(z21.string()),
268
+ is_power: z21.boolean().optional(),
269
+ is_ground: z21.boolean().optional(),
270
+ is_digital_signal: z21.boolean().optional(),
271
+ is_analog_signal: z21.boolean().optional(),
272
+ trace_width: z21.number().optional()
273
+ });
274
+
275
+ // src/schematic/schematic_box.ts
276
+ import { z as z22 } from "zod";
277
+ var schematic_box = z22.object({
278
+ type: z22.literal("schematic_box"),
279
+ schematic_component_id: z22.string(),
280
+ width: distance,
281
+ height: distance,
282
+ x: distance,
283
+ y: distance
284
+ }).describe("Draws a box on the schematic");
285
+
286
+ // src/schematic/schematic_path.ts
287
+ import { z as z23 } from "zod";
288
+ var schematic_path = z23.object({
289
+ type: z23.literal("schematic_path"),
290
+ schematic_component_id: z23.string(),
291
+ fill_color: z23.enum(["red", "blue"]).optional(),
292
+ is_filled: z23.boolean().optional(),
293
+ points: z23.array(point)
294
+ });
295
+
296
+ // src/schematic/schematic_component.ts
297
+ import { z as z24 } from "zod";
298
+ var schematic_pin_styles = z24.record(
299
+ z24.object({
300
+ left_margin: length.optional(),
301
+ right_margin: length.optional(),
302
+ top_margin: length.optional(),
303
+ bottom_margin: length.optional()
304
+ })
305
+ );
306
+ var schematic_component = z24.object({
307
+ type: z24.literal("schematic_component"),
308
+ rotation: rotation.default(0),
309
+ size,
310
+ center: point,
311
+ source_component_id: z24.string(),
312
+ schematic_component_id: z24.string(),
313
+ pin_spacing: length.optional(),
314
+ pin_styles: schematic_pin_styles.optional(),
315
+ box_width: length.optional(),
316
+ symbol_name: z24.string().optional(),
317
+ port_arrangement: z24.union([
318
+ z24.object({
319
+ left_size: z24.number(),
320
+ right_size: z24.number(),
321
+ top_size: z24.number().optional(),
322
+ bottom_size: z24.number().optional()
323
+ }),
324
+ z24.object({
325
+ left_side: z24.object({
326
+ pins: z24.array(z24.number()),
327
+ direction: z24.enum(["top-to-bottom", "bottom-to-top"]).optional()
328
+ }).optional(),
329
+ right_side: z24.object({
330
+ pins: z24.array(z24.number()),
331
+ direction: z24.enum(["top-to-bottom", "bottom-to-top"]).optional()
332
+ }).optional(),
333
+ top_side: z24.object({
334
+ pins: z24.array(z24.number()),
335
+ direction: z24.enum(["left-to-right", "right-to-left"]).optional()
336
+ }).optional(),
337
+ bottom_side: z24.object({
338
+ pins: z24.array(z24.number()),
339
+ direction: z24.enum(["left-to-right", "right-to-left"]).optional()
340
+ }).optional()
341
+ })
342
+ ]).optional(),
343
+ port_labels: z24.record(z24.string()).optional()
344
+ });
345
+
346
+ // src/schematic/schematic_line.ts
347
+ import { z as z25 } from "zod";
348
+ var schematic_line = z25.object({
349
+ type: z25.literal("schematic_line"),
350
+ schematic_component_id: z25.string(),
351
+ x1: distance,
352
+ x2: distance,
353
+ y1: distance,
354
+ y2: distance
355
+ });
356
+
357
+ // src/schematic/schematic_trace.ts
358
+ import { z as z26 } from "zod";
359
+ var schematic_trace = z26.object({
360
+ type: z26.literal("schematic_trace"),
361
+ schematic_trace_id: z26.string(),
362
+ source_trace_id: z26.string(),
363
+ edges: z26.array(
364
+ z26.object({
365
+ from: z26.object({
366
+ x: z26.number(),
367
+ y: z26.number()
368
+ }),
369
+ to: z26.object({
370
+ x: z26.number(),
371
+ y: z26.number()
372
+ }),
373
+ from_schematic_port_id: z26.string().optional(),
374
+ to_schematic_port_id: z26.string().optional()
375
+ })
376
+ )
377
+ });
378
+
379
+ // src/schematic/schematic_text.ts
380
+ import { z as z27 } from "zod";
381
+ var schematic_text = z27.object({
382
+ type: z27.literal("schematic_text"),
383
+ schematic_component_id: z27.string(),
384
+ schematic_text_id: z27.string(),
385
+ text: z27.string(),
386
+ position: z27.object({
387
+ x: distance,
388
+ y: distance
389
+ }),
390
+ rotation: z27.number().default(0),
391
+ anchor: z27.enum(["center", "left", "right", "top", "bottom"]).default("center")
392
+ });
393
+
394
+ // src/schematic/schematic_port.ts
395
+ import { z as z28 } from "zod";
396
+ var schematic_port = z28.object({
397
+ type: z28.literal("schematic_port"),
398
+ schematic_port_id: z28.string(),
399
+ source_port_id: z28.string(),
400
+ schematic_component_id: z28.string().optional(),
401
+ center: point,
402
+ facing_direction: z28.enum(["up", "down", "left", "right"]).optional()
403
+ }).describe("Defines a port on a schematic component");
404
+
405
+ // src/schematic/schematic_net_label.ts
406
+ import { z as z29 } from "zod";
407
+ var schematic_net_label = z29.object({
408
+ type: z29.literal("schematic_net_label"),
409
+ source_net_id: z29.string(),
410
+ center: point,
411
+ anchor_side: z29.enum(["top", "bottom", "left", "right"]),
412
+ text: z29.string()
413
+ });
414
+
415
+ // src/schematic/schematic_error.ts
416
+ import { z as z30 } from "zod";
417
+ var schematic_error = z30.object({
418
+ schematic_error_id: z30.string(),
419
+ type: z30.literal("schematic_error"),
420
+ // eventually each error type should be broken out into a dir of files
421
+ error_type: z30.literal("schematic_port_not_found"),
422
+ message: z30.string()
423
+ }).describe("Defines a schematic error on the schematic");
424
+
425
+ // src/pcb/properties/layer_ref.ts
426
+ import { z as z31 } from "zod";
427
+ var all_layers = [
428
+ "top",
429
+ "bottom",
430
+ "inner1",
431
+ "inner2",
432
+ "inner3",
433
+ "inner4",
434
+ "inner5",
435
+ "inner6"
436
+ ];
437
+ var layer_string = z31.enum(all_layers);
438
+ var layer_ref = layer_string.or(
439
+ z31.object({
440
+ name: layer_string
441
+ })
442
+ ).transform((layer) => {
443
+ if (typeof layer === "string") {
444
+ return layer;
445
+ }
446
+ return layer.name;
447
+ });
448
+ var visible_layer = z31.enum(["top", "bottom"]);
449
+
450
+ // src/pcb/properties/pcb_route_hints.ts
451
+ import { z as z32 } from "zod";
452
+ var pcb_route_hint = z32.object({
453
+ x: distance,
454
+ y: distance,
455
+ via: z32.boolean().optional(),
456
+ via_to_layer: layer_ref.optional()
457
+ });
458
+ var pcb_route_hints = z32.array(pcb_route_hint);
459
+
460
+ // src/pcb/properties/route_hint_point.ts
461
+ import { z as z33 } from "zod";
462
+ var route_hint_point = z33.object({
463
+ x: distance,
464
+ y: distance,
465
+ via: z33.boolean().optional(),
466
+ to_layer: layer_ref.optional(),
467
+ trace_width: distance.optional()
468
+ });
469
+
470
+ // src/pcb/pcb_component.ts
471
+ import { z as z34 } from "zod";
472
+
473
+ // src/utils/expect-types-match.ts
474
+ var expectTypesMatch = (shouldBe) => {
475
+ };
476
+
477
+ // src/pcb/pcb_component.ts
478
+ var pcb_component = z34.object({
479
+ type: z34.literal("pcb_component"),
480
+ pcb_component_id: getZodPrefixedIdWithDefault("pcb_component"),
481
+ source_component_id: z34.string(),
482
+ center: point,
483
+ layer: layer_ref,
484
+ rotation,
485
+ width: length,
486
+ height: length
487
+ }).describe("Defines a component on the PCB");
488
+ expectTypesMatch(true);
489
+
490
+ // src/pcb/pcb_hole.ts
491
+ import { z as z35 } from "zod";
492
+ var pcb_hole_circle_or_square = z35.object({
493
+ type: z35.literal("pcb_hole"),
494
+ pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
495
+ hole_shape: z35.enum(["circle", "square"]),
496
+ hole_diameter: z35.number(),
497
+ x: distance,
498
+ y: distance
499
+ });
500
+ var pcb_hole_circle_or_square_shape = pcb_hole_circle_or_square.describe(
501
+ "Defines a circular or square hole on the PCB"
502
+ );
503
+ expectTypesMatch(true);
504
+ var pcb_hole_oval = z35.object({
505
+ type: z35.literal("pcb_hole"),
506
+ pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
507
+ hole_shape: z35.literal("oval"),
508
+ hole_width: z35.number(),
509
+ hole_height: z35.number(),
510
+ x: distance,
511
+ y: distance
512
+ });
513
+ var pcb_hole_oval_shape = pcb_hole_oval.describe(
514
+ "Defines an oval hole on the PCB"
515
+ );
516
+ expectTypesMatch(true);
517
+ var pcb_hole = pcb_hole_circle_or_square.or(pcb_hole_oval);
518
+
519
+ // src/pcb/pcb_plated_hole.ts
520
+ import { z as z36 } from "zod";
521
+ var pcb_plated_hole_circle = z36.object({
522
+ type: z36.literal("pcb_plated_hole"),
523
+ shape: z36.literal("circle"),
524
+ outer_diameter: z36.number(),
525
+ hole_diameter: z36.number(),
526
+ x: distance,
527
+ y: distance,
528
+ layers: z36.array(layer_ref),
529
+ port_hints: z36.array(z36.string()).optional(),
530
+ pcb_component_id: z36.string().optional(),
531
+ pcb_port_id: z36.string().optional(),
532
+ pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
533
+ });
534
+ var pcb_plated_hole_oval = z36.object({
535
+ type: z36.literal("pcb_plated_hole"),
536
+ shape: z36.enum(["oval", "pill"]),
537
+ outer_width: z36.number(),
538
+ outer_height: z36.number(),
539
+ hole_width: z36.number(),
540
+ hole_height: z36.number(),
541
+ x: distance,
542
+ y: distance,
543
+ layers: z36.array(layer_ref),
544
+ port_hints: z36.array(z36.string()).optional(),
545
+ pcb_component_id: z36.string().optional(),
546
+ pcb_port_id: z36.string().optional(),
547
+ pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
548
+ });
549
+ var pcb_plated_hole = z36.union([
550
+ pcb_plated_hole_circle,
551
+ pcb_plated_hole_oval
552
+ ]);
553
+ expectTypesMatch(
554
+ true
555
+ );
556
+ expectTypesMatch(true);
557
+
558
+ // src/pcb/pcb_port.ts
559
+ import { z as z37 } from "zod";
560
+ var pcb_port = z37.object({
561
+ type: z37.literal("pcb_port"),
562
+ pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
563
+ source_port_id: z37.string(),
564
+ pcb_component_id: z37.string(),
565
+ x: distance,
566
+ y: distance,
567
+ layers: z37.array(layer_ref)
568
+ }).describe("Defines a port on the PCB");
569
+ expectTypesMatch(true);
570
+
571
+ // src/pcb/pcb_smtpad.ts
572
+ import { z as z38 } from "zod";
573
+ var pcb_smtpad_circle = z38.object({
574
+ type: z38.literal("pcb_smtpad"),
575
+ shape: z38.literal("circle"),
576
+ pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
577
+ x: distance,
578
+ y: distance,
579
+ radius: z38.number(),
580
+ layer: layer_ref,
581
+ port_hints: z38.array(z38.string()).optional(),
582
+ pcb_component_id: z38.string().optional(),
583
+ pcb_port_id: z38.string().optional()
584
+ });
585
+ var pcb_smtpad_rect = z38.object({
586
+ type: z38.literal("pcb_smtpad"),
587
+ shape: z38.literal("rect"),
588
+ pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
589
+ x: distance,
590
+ y: distance,
591
+ width: z38.number(),
592
+ height: z38.number(),
593
+ layer: layer_ref,
594
+ port_hints: z38.array(z38.string()).optional(),
595
+ pcb_component_id: z38.string().optional(),
596
+ pcb_port_id: z38.string().optional()
597
+ });
598
+ var pcb_smtpad = z38.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defines an SMT pad on the PCB");
599
+ expectTypesMatch(true);
600
+ expectTypesMatch(true);
601
+
602
+ // src/pcb/pcb_text.ts
603
+ import { z as z39 } from "zod";
604
+ var pcb_text = z39.object({
605
+ type: z39.literal("pcb_text"),
606
+ pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
607
+ text: z39.string(),
608
+ center: point,
609
+ layer: layer_ref,
610
+ width: length,
611
+ height: length,
612
+ lines: z39.number(),
613
+ align: z39.enum(["bottom-left"])
614
+ }).describe("Defines text on the PCB");
615
+ expectTypesMatch(true);
616
+
617
+ // src/pcb/pcb_trace.ts
618
+ import { z as z40 } from "zod";
619
+ var pcb_trace_route_point_wire = z40.object({
620
+ route_type: z40.literal("wire"),
621
+ x: distance,
622
+ y: distance,
623
+ width: distance,
624
+ start_pcb_port_id: z40.string().optional(),
625
+ end_pcb_port_id: z40.string().optional(),
626
+ layer: layer_ref
627
+ });
628
+ var pcb_trace_route_point_via = z40.object({
629
+ route_type: z40.literal("via"),
630
+ x: distance,
631
+ y: distance,
632
+ from_layer: z40.string(),
633
+ to_layer: z40.string()
634
+ });
635
+ var pcb_trace_route_point = z40.union([
636
+ pcb_trace_route_point_wire,
637
+ pcb_trace_route_point_via
638
+ ]);
639
+ var pcb_trace = z40.object({
640
+ type: z40.literal("pcb_trace"),
641
+ source_trace_id: z40.string().optional(),
642
+ pcb_component_id: z40.string().optional(),
643
+ pcb_trace_id: getZodPrefixedIdWithDefault("pcb_trace"),
644
+ route_thickness_mode: z40.enum(["constant", "interpolated"]).default("constant").optional(),
645
+ should_round_corners: z40.boolean().optional(),
646
+ route: z40.array(
647
+ z40.union([
648
+ z40.object({
649
+ route_type: z40.literal("wire"),
650
+ x: distance,
651
+ y: distance,
652
+ width: distance,
653
+ start_pcb_port_id: z40.string().optional(),
654
+ end_pcb_port_id: z40.string().optional(),
655
+ layer: layer_ref
656
+ }),
657
+ z40.object({
658
+ route_type: z40.literal("via"),
659
+ x: distance,
660
+ y: distance,
661
+ from_layer: z40.string(),
662
+ to_layer: z40.string()
663
+ })
664
+ ])
665
+ )
666
+ }).describe("Defines a trace on the PCB");
667
+ expectTypesMatch(true);
668
+ expectTypesMatch(true);
669
+
670
+ // src/pcb/pcb_trace_error.ts
671
+ import { z as z41 } from "zod";
672
+ var pcb_trace_error = z41.object({
673
+ type: z41.literal("pcb_trace_error"),
674
+ pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
675
+ error_type: z41.literal("pcb_trace_error"),
676
+ message: z41.string(),
677
+ center: point.optional(),
678
+ pcb_trace_id: z41.string(),
679
+ source_trace_id: z41.string(),
680
+ pcb_component_ids: z41.array(z41.string()),
681
+ pcb_port_ids: z41.array(z41.string())
682
+ }).describe("Defines a trace error on the PCB");
683
+ expectTypesMatch(true);
684
+
685
+ // src/pcb/pcb_port_not_matched_error.ts
686
+ import { z as z42 } from "zod";
687
+ var pcb_port_not_matched_error = z42.object({
688
+ type: z42.literal("pcb_port_not_matched_error"),
689
+ pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
690
+ message: z42.string(),
691
+ pcb_component_ids: z42.array(z42.string())
692
+ }).describe("Defines a trace error on the PCB where a port is not matched");
693
+ expectTypesMatch(true);
694
+
695
+ // src/pcb/pcb_via.ts
696
+ import { z as z43 } from "zod";
697
+ var pcb_via = z43.object({
698
+ type: z43.literal("pcb_via"),
699
+ pcb_via_id: getZodPrefixedIdWithDefault("pcb_via"),
700
+ x: distance,
701
+ y: distance,
702
+ outer_diameter: distance.default("0.6mm"),
703
+ hole_diameter: distance.default("0.25mm"),
704
+ /** @deprecated */
705
+ from_layer: layer_ref.optional(),
706
+ /** @deprecated */
707
+ to_layer: layer_ref.optional(),
708
+ layers: z43.array(layer_ref)
709
+ }).describe("Defines a via on the PCB");
710
+ expectTypesMatch(true);
711
+
712
+ // src/pcb/pcb_board.ts
713
+ import { z as z44 } from "zod";
714
+ var pcb_board = z44.object({
715
+ type: z44.literal("pcb_board"),
716
+ pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
717
+ width: length,
718
+ height: length,
719
+ center: point,
720
+ outline: z44.array(point).optional()
721
+ }).describe("Defines the board outline of the PCB");
722
+ expectTypesMatch(true);
723
+
724
+ // src/pcb/pcb_placement_error.ts
725
+ import { z as z45 } from "zod";
726
+ var pcb_placement_error = z45.object({
727
+ type: z45.literal("pcb_placement_error"),
728
+ pcb_placement_error_id: getZodPrefixedIdWithDefault("pcb_placement_error"),
729
+ message: z45.string()
730
+ }).describe("Defines a placement error on the PCB");
731
+ expectTypesMatch(true);
732
+
733
+ // src/pcb/pcb_trace_hint.ts
734
+ import { z as z46 } from "zod";
735
+ var pcb_trace_hint = z46.object({
736
+ type: z46.literal("pcb_trace_hint"),
737
+ pcb_trace_hint_id: getZodPrefixedIdWithDefault("pcb_trace_hint"),
738
+ pcb_port_id: z46.string(),
739
+ pcb_component_id: z46.string(),
740
+ route: z46.array(route_hint_point)
741
+ }).describe("A hint that can be used during generation of a PCB trace");
742
+ expectTypesMatch(true);
743
+
744
+ // src/pcb/pcb_silkscreen_line.ts
745
+ import { z as z47 } from "zod";
746
+ var pcb_silkscreen_line = z47.object({
747
+ type: z47.literal("pcb_silkscreen_line"),
748
+ pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
749
+ pcb_component_id: z47.string(),
750
+ stroke_width: distance.default("0.1mm"),
751
+ x1: distance,
752
+ y1: distance,
753
+ x2: distance,
754
+ y2: distance,
755
+ layer: visible_layer
756
+ }).describe("Defines a silkscreen line on the PCB");
757
+ expectTypesMatch(true);
758
+
759
+ // src/pcb/pcb_silkscreen_path.ts
760
+ import { z as z48 } from "zod";
761
+ var pcb_silkscreen_path = z48.object({
762
+ type: z48.literal("pcb_silkscreen_path"),
763
+ pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
764
+ pcb_component_id: z48.string(),
765
+ layer: visible_layer,
766
+ route: z48.array(point),
767
+ stroke_width: length
768
+ }).describe("Defines a silkscreen path on the PCB");
769
+ expectTypesMatch(true);
770
+
771
+ // src/pcb/pcb_silkscreen_text.ts
772
+ import { z as z49 } from "zod";
773
+ var pcb_silkscreen_text = z49.object({
774
+ type: z49.literal("pcb_silkscreen_text"),
775
+ pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
776
+ font: z49.literal("tscircuit2024").default("tscircuit2024"),
777
+ font_size: distance.default("0.2mm"),
778
+ pcb_component_id: z49.string(),
779
+ text: z49.string(),
780
+ layer: layer_ref,
781
+ anchor_position: point.default({ x: 0, y: 0 }),
782
+ anchor_alignment: z49.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
783
+ }).describe("Defines silkscreen text on the PCB");
784
+ expectTypesMatch(true);
785
+
786
+ // src/pcb/pcb_silkscreen_rect.ts
787
+ import { z as z50 } from "zod";
788
+ var pcb_silkscreen_rect = z50.object({
789
+ type: z50.literal("pcb_silkscreen_rect"),
790
+ pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
791
+ pcb_component_id: z50.string(),
792
+ center: point,
793
+ width: length,
794
+ height: length,
795
+ layer: layer_ref
796
+ }).describe("Defines a silkscreen rect on the PCB");
797
+ expectTypesMatch(true);
798
+
799
+ // src/pcb/pcb_silkscreen_circle.ts
800
+ import { z as z51 } from "zod";
801
+ var pcb_silkscreen_circle = z51.object({
802
+ type: z51.literal("pcb_silkscreen_circle"),
803
+ pcb_silkscreen_circle_id: getZodPrefixedIdWithDefault(
804
+ "pcb_silkscreen_circle"
805
+ ),
806
+ pcb_component_id: z51.string(),
807
+ center: point,
808
+ radius: length,
809
+ layer: visible_layer
810
+ }).describe("Defines a silkscreen circle on the PCB");
811
+ expectTypesMatch(true);
812
+
813
+ // src/pcb/pcb_silkscreen_oval.ts
814
+ import { z as z52 } from "zod";
815
+ var pcb_silkscreen_oval = z52.object({
816
+ type: z52.literal("pcb_silkscreen_oval"),
817
+ pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
818
+ pcb_component_id: z52.string(),
819
+ center: point,
820
+ radius_x: distance,
821
+ radius_y: distance,
822
+ layer: visible_layer
823
+ }).describe("Defines a silkscreen oval on the PCB");
824
+ expectTypesMatch(true);
825
+
826
+ // src/pcb/pcb_fabrication_note_text.ts
827
+ import { z as z53 } from "zod";
828
+ var pcb_fabrication_note_text = z53.object({
829
+ type: z53.literal("pcb_fabrication_note_text"),
830
+ pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
831
+ "pcb_fabrication_note_text"
832
+ ),
833
+ font: z53.literal("tscircuit2024").default("tscircuit2024"),
834
+ font_size: distance.default("1mm"),
835
+ pcb_component_id: z53.string(),
836
+ text: z53.string(),
837
+ layer: visible_layer,
838
+ anchor_position: point.default({ x: 0, y: 0 }),
839
+ anchor_alignment: z53.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
840
+ color: z53.string().optional()
841
+ }).describe(
842
+ "Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"
843
+ );
844
+ expectTypesMatch(true);
845
+
846
+ // src/pcb/pcb_fabrication_note_path.ts
847
+ import { z as z54 } from "zod";
848
+ var pcb_fabrication_note_path = z54.object({
849
+ type: z54.literal("pcb_fabrication_note_path"),
850
+ pcb_fabrication_note_path_id: getZodPrefixedIdWithDefault(
851
+ "pcb_fabrication_note_path"
852
+ ),
853
+ pcb_component_id: z54.string(),
854
+ layer: layer_ref,
855
+ route: z54.array(point),
856
+ stroke_width: length,
857
+ color: z54.string().optional()
858
+ }).describe(
859
+ "Defines a fabrication path on the PCB for fabricators or assemblers"
860
+ );
861
+ expectTypesMatch(true);
862
+
863
+ // src/pcb/pcb_keepout.ts
864
+ import { z as z55 } from "zod";
865
+ var pcb_keepout = z55.object({
866
+ type: z55.literal("pcb_keepout"),
867
+ shape: z55.literal("rect"),
868
+ center: point,
869
+ width: distance,
870
+ height: distance,
871
+ pcb_keepout_id: z55.string(),
872
+ layers: z55.array(z55.string()),
873
+ // Specify layers where the keepout applies
874
+ description: z55.string().optional()
875
+ // Optional description of the keepout
876
+ }).or(
877
+ z55.object({
878
+ type: z55.literal("pcb_keepout"),
879
+ shape: z55.literal("circle"),
880
+ center: point,
881
+ radius: distance,
882
+ pcb_keepout_id: z55.string(),
883
+ layers: z55.array(z55.string()),
884
+ // Specify layers where the keepout applies
885
+ description: z55.string().optional()
886
+ // Optional description of the keepout
887
+ })
888
+ );
889
+
890
+ // src/cad/cad_component.ts
891
+ import { z as z56 } from "zod";
892
+ var cad_component = z56.object({
893
+ type: z56.literal("cad_component"),
894
+ cad_component_id: z56.string(),
895
+ pcb_component_id: z56.string(),
896
+ source_component_id: z56.string(),
897
+ position: point3,
898
+ rotation: point3.optional(),
899
+ size: point3.optional(),
900
+ layer: layer_ref.optional(),
901
+ // These are all ways to generate/load the 3d model
902
+ footprinter_string: z56.string().optional(),
903
+ model_obj_url: z56.string().optional(),
904
+ model_stl_url: z56.string().optional(),
905
+ model_3mf_url: z56.string().optional(),
906
+ model_jscad: z56.any().optional()
907
+ }).describe("Defines a component on the PCB");
908
+
909
+ // src/any_circuit_element.ts
910
+ import { z as z57 } from "zod";
911
+ var any_circuit_element = z57.union([
912
+ source_trace,
913
+ source_port,
914
+ any_source_component,
915
+ source_led,
916
+ source_net,
917
+ source_group,
918
+ source_simple_bug,
919
+ source_simple_chip,
920
+ source_simple_capacitor,
921
+ source_simple_diode,
922
+ source_simple_resistor,
923
+ source_simple_power_source,
924
+ pcb_component,
925
+ pcb_hole,
926
+ pcb_plated_hole,
927
+ pcb_keepout,
928
+ pcb_port,
929
+ pcb_text,
930
+ pcb_trace,
931
+ pcb_via,
932
+ pcb_smtpad,
933
+ pcb_board,
934
+ pcb_trace_hint,
935
+ pcb_silkscreen_line,
936
+ pcb_silkscreen_path,
937
+ pcb_silkscreen_text,
938
+ pcb_silkscreen_rect,
939
+ pcb_silkscreen_circle,
940
+ pcb_silkscreen_oval,
941
+ pcb_trace_error,
942
+ pcb_placement_error,
943
+ pcb_port_not_matched_error,
944
+ pcb_fabrication_note_path,
945
+ pcb_fabrication_note_text,
946
+ schematic_box,
947
+ schematic_text,
948
+ schematic_line,
949
+ schematic_component,
950
+ schematic_port,
951
+ schematic_trace,
952
+ schematic_path,
953
+ schematic_error,
954
+ schematic_net_label,
955
+ cad_component
956
+ ]);
957
+ var any_soup_element = any_circuit_element;
958
+ export {
959
+ all_layers,
960
+ any_circuit_element,
961
+ any_soup_element,
962
+ any_source_component,
963
+ cad_component,
964
+ capacitance,
965
+ current,
966
+ distance,
967
+ getZodPrefixedIdWithDefault,
968
+ inductance,
969
+ layer_ref,
970
+ layer_string,
971
+ length,
972
+ pcb_board,
973
+ pcb_component,
974
+ pcb_fabrication_note_path,
975
+ pcb_fabrication_note_text,
976
+ pcb_hole,
977
+ pcb_hole_circle_or_square_shape,
978
+ pcb_hole_oval_shape,
979
+ pcb_keepout,
980
+ pcb_placement_error,
981
+ pcb_plated_hole,
982
+ pcb_port,
983
+ pcb_port_not_matched_error,
984
+ pcb_route_hint,
985
+ pcb_route_hints,
986
+ pcb_silkscreen_circle,
987
+ pcb_silkscreen_line,
988
+ pcb_silkscreen_oval,
989
+ pcb_silkscreen_path,
990
+ pcb_silkscreen_rect,
991
+ pcb_silkscreen_text,
992
+ pcb_smtpad,
993
+ pcb_text,
994
+ pcb_trace,
995
+ pcb_trace_error,
996
+ pcb_trace_hint,
997
+ pcb_trace_route_point,
998
+ pcb_trace_route_point_via,
999
+ pcb_trace_route_point_wire,
1000
+ pcb_via,
1001
+ point,
1002
+ point3,
1003
+ position,
1004
+ position3,
1005
+ resistance,
1006
+ rotation,
1007
+ route_hint_point,
1008
+ schematic_box,
1009
+ schematic_component,
1010
+ schematic_error,
1011
+ schematic_line,
1012
+ schematic_net_label,
1013
+ schematic_path,
1014
+ schematic_pin_styles,
1015
+ schematic_port,
1016
+ schematic_text,
1017
+ schematic_trace,
1018
+ size,
1019
+ source_component_base,
1020
+ source_group,
1021
+ source_led,
1022
+ source_net,
1023
+ source_port,
1024
+ source_simple_bug,
1025
+ source_simple_capacitor,
1026
+ source_simple_chip,
1027
+ source_simple_diode,
1028
+ source_simple_ground,
1029
+ source_simple_power_source,
1030
+ source_simple_resistor,
1031
+ source_trace,
1032
+ supplier_name,
1033
+ time,
1034
+ visible_layer,
1035
+ voltage
1036
+ };
1037
+ //# sourceMappingURL=index.mjs.map