circuit-json 0.0.85 → 0.0.86

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 CHANGED
@@ -170,6 +170,17 @@ var rotation = z.string().or(z.number()).transform((arg) => {
170
170
  }
171
171
  return Number.parseFloat(arg);
172
172
  });
173
+ var battery_capacity = z.number().or(z.string().endsWith("mAh")).transform((v) => {
174
+ if (typeof v === "string") {
175
+ const valString = v.replace("mAh", "");
176
+ const num = Number.parseFloat(valString);
177
+ if (Number.isNaN(num)) {
178
+ throw new Error("Invalid capacity");
179
+ }
180
+ return num;
181
+ }
182
+ return v;
183
+ }).describe("Battery capacity in mAh");
173
184
 
174
185
  // src/common/point.ts
175
186
  import { z as z2 } from "zod";
@@ -286,8 +297,17 @@ var source_simple_power_source = source_component_base.extend({
286
297
  });
287
298
 
288
299
  // src/source/any_source_component.ts
300
+ import { z as z18 } from "zod";
301
+
302
+ // src/source/source_simple_battery.ts
289
303
  import { z as z17 } from "zod";
290
- var any_source_component = z17.union([
304
+ var source_simple_battery = source_component_base.extend({
305
+ ftype: z17.literal("simple_battery"),
306
+ capacity: battery_capacity
307
+ });
308
+
309
+ // src/source/any_source_component.ts
310
+ var any_source_component = z18.union([
291
311
  source_simple_resistor,
292
312
  source_simple_capacitor,
293
313
  source_simple_diode,
@@ -295,56 +315,57 @@ var any_source_component = z17.union([
295
315
  source_simple_chip,
296
316
  source_simple_bug,
297
317
  source_led,
298
- source_simple_power_source
318
+ source_simple_power_source,
319
+ source_simple_battery
299
320
  ]);
300
321
 
301
322
  // src/source/source_port.ts
302
- import { z as z18 } from "zod";
303
- var source_port = z18.object({
304
- type: z18.literal("source_port"),
305
- pin_number: z18.number().optional(),
306
- port_hints: z18.array(z18.string()).optional(),
307
- name: z18.string(),
308
- source_port_id: z18.string(),
309
- source_component_id: z18.string()
323
+ import { z as z19 } from "zod";
324
+ var source_port = z19.object({
325
+ type: z19.literal("source_port"),
326
+ pin_number: z19.number().optional(),
327
+ port_hints: z19.array(z19.string()).optional(),
328
+ name: z19.string(),
329
+ source_port_id: z19.string(),
330
+ source_component_id: z19.string()
310
331
  });
311
332
 
312
333
  // src/source/source_trace.ts
313
- import { z as z19 } from "zod";
314
- var source_trace = z19.object({
315
- type: z19.literal("source_trace"),
316
- source_trace_id: z19.string(),
317
- connected_source_port_ids: z19.array(z19.string()),
318
- connected_source_net_ids: z19.array(z19.string())
334
+ import { z as z20 } from "zod";
335
+ var source_trace = z20.object({
336
+ type: z20.literal("source_trace"),
337
+ source_trace_id: z20.string(),
338
+ connected_source_port_ids: z20.array(z20.string()),
339
+ connected_source_net_ids: z20.array(z20.string())
319
340
  });
320
341
 
321
342
  // src/source/source_group.ts
322
- import { z as z20 } from "zod";
323
- var source_group = z20.object({
324
- type: z20.literal("source_group"),
325
- source_group_id: z20.string(),
326
- name: z20.string().optional()
343
+ import { z as z21 } from "zod";
344
+ var source_group = z21.object({
345
+ type: z21.literal("source_group"),
346
+ source_group_id: z21.string(),
347
+ name: z21.string().optional()
327
348
  });
328
349
 
329
350
  // src/source/source_net.ts
330
- import { z as z21 } from "zod";
331
- var source_net = z21.object({
332
- type: z21.literal("source_net"),
333
- source_net_id: z21.string(),
334
- name: z21.string(),
335
- member_source_group_ids: z21.array(z21.string()),
336
- is_power: z21.boolean().optional(),
337
- is_ground: z21.boolean().optional(),
338
- is_digital_signal: z21.boolean().optional(),
339
- is_analog_signal: z21.boolean().optional(),
340
- trace_width: z21.number().optional()
351
+ import { z as z22 } from "zod";
352
+ var source_net = z22.object({
353
+ type: z22.literal("source_net"),
354
+ source_net_id: z22.string(),
355
+ name: z22.string(),
356
+ member_source_group_ids: z22.array(z22.string()),
357
+ is_power: z22.boolean().optional(),
358
+ is_ground: z22.boolean().optional(),
359
+ is_digital_signal: z22.boolean().optional(),
360
+ is_analog_signal: z22.boolean().optional(),
361
+ trace_width: z22.number().optional()
341
362
  });
342
363
 
343
364
  // src/schematic/schematic_box.ts
344
- import { z as z22 } from "zod";
345
- var schematic_box = z22.object({
346
- type: z22.literal("schematic_box"),
347
- schematic_component_id: z22.string(),
365
+ import { z as z23 } from "zod";
366
+ var schematic_box = z23.object({
367
+ type: z23.literal("schematic_box"),
368
+ schematic_component_id: z23.string(),
348
369
  width: distance,
349
370
  height: distance,
350
371
  x: distance,
@@ -352,70 +373,70 @@ var schematic_box = z22.object({
352
373
  }).describe("Draws a box on the schematic");
353
374
 
354
375
  // src/schematic/schematic_path.ts
355
- import { z as z23 } from "zod";
356
- var schematic_path = z23.object({
357
- type: z23.literal("schematic_path"),
358
- schematic_component_id: z23.string(),
359
- fill_color: z23.enum(["red", "blue"]).optional(),
360
- is_filled: z23.boolean().optional(),
361
- points: z23.array(point)
376
+ import { z as z24 } from "zod";
377
+ var schematic_path = z24.object({
378
+ type: z24.literal("schematic_path"),
379
+ schematic_component_id: z24.string(),
380
+ fill_color: z24.enum(["red", "blue"]).optional(),
381
+ is_filled: z24.boolean().optional(),
382
+ points: z24.array(point)
362
383
  });
363
384
 
364
385
  // src/schematic/schematic_component.ts
365
- import { z as z24 } from "zod";
366
- var schematic_pin_styles = z24.record(
367
- z24.object({
386
+ import { z as z25 } from "zod";
387
+ var schematic_pin_styles = z25.record(
388
+ z25.object({
368
389
  left_margin: length.optional(),
369
390
  right_margin: length.optional(),
370
391
  top_margin: length.optional(),
371
392
  bottom_margin: length.optional()
372
393
  })
373
394
  );
374
- var schematic_component = z24.object({
375
- type: z24.literal("schematic_component"),
395
+ var schematic_component = z25.object({
396
+ type: z25.literal("schematic_component"),
376
397
  rotation: rotation.default(0),
377
398
  size,
378
399
  center: point,
379
- source_component_id: z24.string(),
380
- schematic_component_id: z24.string(),
400
+ source_component_id: z25.string(),
401
+ schematic_component_id: z25.string(),
381
402
  pin_spacing: length.optional(),
382
403
  pin_styles: schematic_pin_styles.optional(),
383
404
  box_width: length.optional(),
384
- symbol_name: z24.string().optional(),
385
- port_arrangement: z24.union([
386
- z24.object({
387
- left_size: z24.number(),
388
- right_size: z24.number(),
389
- top_size: z24.number().optional(),
390
- bottom_size: z24.number().optional()
405
+ symbol_name: z25.string().optional(),
406
+ port_arrangement: z25.union([
407
+ z25.object({
408
+ left_size: z25.number(),
409
+ right_size: z25.number(),
410
+ top_size: z25.number().optional(),
411
+ bottom_size: z25.number().optional()
391
412
  }),
392
- z24.object({
393
- left_side: z24.object({
394
- pins: z24.array(z24.number()),
395
- direction: z24.enum(["top-to-bottom", "bottom-to-top"]).optional()
413
+ z25.object({
414
+ left_side: z25.object({
415
+ pins: z25.array(z25.number()),
416
+ direction: z25.enum(["top-to-bottom", "bottom-to-top"]).optional()
396
417
  }).optional(),
397
- right_side: z24.object({
398
- pins: z24.array(z24.number()),
399
- direction: z24.enum(["top-to-bottom", "bottom-to-top"]).optional()
418
+ right_side: z25.object({
419
+ pins: z25.array(z25.number()),
420
+ direction: z25.enum(["top-to-bottom", "bottom-to-top"]).optional()
400
421
  }).optional(),
401
- top_side: z24.object({
402
- pins: z24.array(z24.number()),
403
- direction: z24.enum(["left-to-right", "right-to-left"]).optional()
422
+ top_side: z25.object({
423
+ pins: z25.array(z25.number()),
424
+ direction: z25.enum(["left-to-right", "right-to-left"]).optional()
404
425
  }).optional(),
405
- bottom_side: z24.object({
406
- pins: z24.array(z24.number()),
407
- direction: z24.enum(["left-to-right", "right-to-left"]).optional()
426
+ bottom_side: z25.object({
427
+ pins: z25.array(z25.number()),
428
+ direction: z25.enum(["left-to-right", "right-to-left"]).optional()
408
429
  }).optional()
409
430
  })
410
431
  ]).optional(),
411
- port_labels: z24.record(z24.string()).optional()
432
+ port_labels: z25.record(z25.string()).optional()
412
433
  });
413
434
 
414
435
  // src/schematic/schematic_line.ts
415
- import { z as z25 } from "zod";
416
- var schematic_line = z25.object({
417
- type: z25.literal("schematic_line"),
418
- schematic_component_id: z25.string(),
436
+ import { z as z26 } from "zod";
437
+ var schematic_line = z26.object({
438
+ type: z26.literal("schematic_line"),
439
+ schematic_component_id: z26.string(),
419
440
  x1: distance,
420
441
  x2: distance,
421
442
  y1: distance,
@@ -423,75 +444,75 @@ var schematic_line = z25.object({
423
444
  });
424
445
 
425
446
  // src/schematic/schematic_trace.ts
426
- import { z as z26 } from "zod";
427
- var schematic_trace = z26.object({
428
- type: z26.literal("schematic_trace"),
429
- schematic_trace_id: z26.string(),
430
- source_trace_id: z26.string(),
431
- edges: z26.array(
432
- z26.object({
433
- from: z26.object({
434
- x: z26.number(),
435
- y: z26.number()
447
+ import { z as z27 } from "zod";
448
+ var schematic_trace = z27.object({
449
+ type: z27.literal("schematic_trace"),
450
+ schematic_trace_id: z27.string(),
451
+ source_trace_id: z27.string(),
452
+ edges: z27.array(
453
+ z27.object({
454
+ from: z27.object({
455
+ x: z27.number(),
456
+ y: z27.number()
436
457
  }),
437
- to: z26.object({
438
- x: z26.number(),
439
- y: z26.number()
458
+ to: z27.object({
459
+ x: z27.number(),
460
+ y: z27.number()
440
461
  }),
441
- from_schematic_port_id: z26.string().optional(),
442
- to_schematic_port_id: z26.string().optional()
462
+ from_schematic_port_id: z27.string().optional(),
463
+ to_schematic_port_id: z27.string().optional()
443
464
  })
444
465
  )
445
466
  });
446
467
 
447
468
  // src/schematic/schematic_text.ts
448
- import { z as z27 } from "zod";
449
- var schematic_text = z27.object({
450
- type: z27.literal("schematic_text"),
451
- schematic_component_id: z27.string(),
452
- schematic_text_id: z27.string(),
453
- text: z27.string(),
454
- position: z27.object({
469
+ import { z as z28 } from "zod";
470
+ var schematic_text = z28.object({
471
+ type: z28.literal("schematic_text"),
472
+ schematic_component_id: z28.string(),
473
+ schematic_text_id: z28.string(),
474
+ text: z28.string(),
475
+ position: z28.object({
455
476
  x: distance,
456
477
  y: distance
457
478
  }),
458
- rotation: z27.number().default(0),
459
- anchor: z27.enum(["center", "left", "right", "top", "bottom"]).default("center")
479
+ rotation: z28.number().default(0),
480
+ anchor: z28.enum(["center", "left", "right", "top", "bottom"]).default("center")
460
481
  });
461
482
 
462
483
  // src/schematic/schematic_port.ts
463
- import { z as z28 } from "zod";
464
- var schematic_port = z28.object({
465
- type: z28.literal("schematic_port"),
466
- schematic_port_id: z28.string(),
467
- source_port_id: z28.string(),
468
- schematic_component_id: z28.string().optional(),
484
+ import { z as z29 } from "zod";
485
+ var schematic_port = z29.object({
486
+ type: z29.literal("schematic_port"),
487
+ schematic_port_id: z29.string(),
488
+ source_port_id: z29.string(),
489
+ schematic_component_id: z29.string().optional(),
469
490
  center: point,
470
- facing_direction: z28.enum(["up", "down", "left", "right"]).optional()
491
+ facing_direction: z29.enum(["up", "down", "left", "right"]).optional()
471
492
  }).describe("Defines a port on a schematic component");
472
493
 
473
494
  // src/schematic/schematic_net_label.ts
474
- import { z as z29 } from "zod";
475
- var schematic_net_label = z29.object({
476
- type: z29.literal("schematic_net_label"),
477
- source_net_id: z29.string(),
495
+ import { z as z30 } from "zod";
496
+ var schematic_net_label = z30.object({
497
+ type: z30.literal("schematic_net_label"),
498
+ source_net_id: z30.string(),
478
499
  center: point,
479
- anchor_side: z29.enum(["top", "bottom", "left", "right"]),
480
- text: z29.string()
500
+ anchor_side: z30.enum(["top", "bottom", "left", "right"]),
501
+ text: z30.string()
481
502
  });
482
503
 
483
504
  // src/schematic/schematic_error.ts
484
- import { z as z30 } from "zod";
485
- var schematic_error = z30.object({
486
- schematic_error_id: z30.string(),
487
- type: z30.literal("schematic_error"),
505
+ import { z as z31 } from "zod";
506
+ var schematic_error = z31.object({
507
+ schematic_error_id: z31.string(),
508
+ type: z31.literal("schematic_error"),
488
509
  // eventually each error type should be broken out into a dir of files
489
- error_type: z30.literal("schematic_port_not_found"),
490
- message: z30.string()
510
+ error_type: z31.literal("schematic_port_not_found"),
511
+ message: z31.string()
491
512
  }).describe("Defines a schematic error on the schematic");
492
513
 
493
514
  // src/pcb/properties/layer_ref.ts
494
- import { z as z31 } from "zod";
515
+ import { z as z32 } from "zod";
495
516
  var all_layers = [
496
517
  "top",
497
518
  "bottom",
@@ -502,9 +523,9 @@ var all_layers = [
502
523
  "inner5",
503
524
  "inner6"
504
525
  ];
505
- var layer_string = z31.enum(all_layers);
526
+ var layer_string = z32.enum(all_layers);
506
527
  var layer_ref = layer_string.or(
507
- z31.object({
528
+ z32.object({
508
529
  name: layer_string
509
530
  })
510
531
  ).transform((layer) => {
@@ -513,40 +534,40 @@ var layer_ref = layer_string.or(
513
534
  }
514
535
  return layer.name;
515
536
  });
516
- var visible_layer = z31.enum(["top", "bottom"]);
537
+ var visible_layer = z32.enum(["top", "bottom"]);
517
538
 
518
539
  // src/pcb/properties/pcb_route_hints.ts
519
- import { z as z32 } from "zod";
520
- var pcb_route_hint = z32.object({
540
+ import { z as z33 } from "zod";
541
+ var pcb_route_hint = z33.object({
521
542
  x: distance,
522
543
  y: distance,
523
- via: z32.boolean().optional(),
544
+ via: z33.boolean().optional(),
524
545
  via_to_layer: layer_ref.optional()
525
546
  });
526
- var pcb_route_hints = z32.array(pcb_route_hint);
547
+ var pcb_route_hints = z33.array(pcb_route_hint);
527
548
 
528
549
  // src/pcb/properties/route_hint_point.ts
529
- import { z as z33 } from "zod";
530
- var route_hint_point = z33.object({
550
+ import { z as z34 } from "zod";
551
+ var route_hint_point = z34.object({
531
552
  x: distance,
532
553
  y: distance,
533
- via: z33.boolean().optional(),
554
+ via: z34.boolean().optional(),
534
555
  to_layer: layer_ref.optional(),
535
556
  trace_width: distance.optional()
536
557
  });
537
558
 
538
559
  // src/pcb/pcb_component.ts
539
- import { z as z34 } from "zod";
560
+ import { z as z35 } from "zod";
540
561
 
541
562
  // src/utils/expect-types-match.ts
542
563
  var expectTypesMatch = (shouldBe) => {
543
564
  };
544
565
 
545
566
  // src/pcb/pcb_component.ts
546
- var pcb_component = z34.object({
547
- type: z34.literal("pcb_component"),
567
+ var pcb_component = z35.object({
568
+ type: z35.literal("pcb_component"),
548
569
  pcb_component_id: getZodPrefixedIdWithDefault("pcb_component"),
549
- source_component_id: z34.string(),
570
+ source_component_id: z35.string(),
550
571
  center: point,
551
572
  layer: layer_ref,
552
573
  rotation,
@@ -556,12 +577,12 @@ var pcb_component = z34.object({
556
577
  expectTypesMatch(true);
557
578
 
558
579
  // src/pcb/pcb_hole.ts
559
- import { z as z35 } from "zod";
560
- var pcb_hole_circle_or_square = z35.object({
561
- type: z35.literal("pcb_hole"),
580
+ import { z as z36 } from "zod";
581
+ var pcb_hole_circle_or_square = z36.object({
582
+ type: z36.literal("pcb_hole"),
562
583
  pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
563
- hole_shape: z35.enum(["circle", "square"]),
564
- hole_diameter: z35.number(),
584
+ hole_shape: z36.enum(["circle", "square"]),
585
+ hole_diameter: z36.number(),
565
586
  x: distance,
566
587
  y: distance
567
588
  });
@@ -569,12 +590,12 @@ var pcb_hole_circle_or_square_shape = pcb_hole_circle_or_square.describe(
569
590
  "Defines a circular or square hole on the PCB"
570
591
  );
571
592
  expectTypesMatch(true);
572
- var pcb_hole_oval = z35.object({
573
- type: z35.literal("pcb_hole"),
593
+ var pcb_hole_oval = z36.object({
594
+ type: z36.literal("pcb_hole"),
574
595
  pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
575
- hole_shape: z35.literal("oval"),
576
- hole_width: z35.number(),
577
- hole_height: z35.number(),
596
+ hole_shape: z36.literal("oval"),
597
+ hole_width: z36.number(),
598
+ hole_height: z36.number(),
578
599
  x: distance,
579
600
  y: distance
580
601
  });
@@ -585,36 +606,36 @@ expectTypesMatch(true);
585
606
  var pcb_hole = pcb_hole_circle_or_square.or(pcb_hole_oval);
586
607
 
587
608
  // src/pcb/pcb_plated_hole.ts
588
- import { z as z36 } from "zod";
589
- var pcb_plated_hole_circle = z36.object({
590
- type: z36.literal("pcb_plated_hole"),
591
- shape: z36.literal("circle"),
592
- outer_diameter: z36.number(),
593
- hole_diameter: z36.number(),
609
+ import { z as z37 } from "zod";
610
+ var pcb_plated_hole_circle = z37.object({
611
+ type: z37.literal("pcb_plated_hole"),
612
+ shape: z37.literal("circle"),
613
+ outer_diameter: z37.number(),
614
+ hole_diameter: z37.number(),
594
615
  x: distance,
595
616
  y: distance,
596
- layers: z36.array(layer_ref),
597
- port_hints: z36.array(z36.string()).optional(),
598
- pcb_component_id: z36.string().optional(),
599
- pcb_port_id: z36.string().optional(),
617
+ layers: z37.array(layer_ref),
618
+ port_hints: z37.array(z37.string()).optional(),
619
+ pcb_component_id: z37.string().optional(),
620
+ pcb_port_id: z37.string().optional(),
600
621
  pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
601
622
  });
602
- var pcb_plated_hole_oval = z36.object({
603
- type: z36.literal("pcb_plated_hole"),
604
- shape: z36.enum(["oval", "pill"]),
605
- outer_width: z36.number(),
606
- outer_height: z36.number(),
607
- hole_width: z36.number(),
608
- hole_height: z36.number(),
623
+ var pcb_plated_hole_oval = z37.object({
624
+ type: z37.literal("pcb_plated_hole"),
625
+ shape: z37.enum(["oval", "pill"]),
626
+ outer_width: z37.number(),
627
+ outer_height: z37.number(),
628
+ hole_width: z37.number(),
629
+ hole_height: z37.number(),
609
630
  x: distance,
610
631
  y: distance,
611
- layers: z36.array(layer_ref),
612
- port_hints: z36.array(z36.string()).optional(),
613
- pcb_component_id: z36.string().optional(),
614
- pcb_port_id: z36.string().optional(),
632
+ layers: z37.array(layer_ref),
633
+ port_hints: z37.array(z37.string()).optional(),
634
+ pcb_component_id: z37.string().optional(),
635
+ pcb_port_id: z37.string().optional(),
615
636
  pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
616
637
  });
617
- var pcb_plated_hole = z36.union([
638
+ var pcb_plated_hole = z37.union([
618
639
  pcb_plated_hole_circle,
619
640
  pcb_plated_hole_oval
620
641
  ]);
@@ -624,140 +645,140 @@ expectTypesMatch(
624
645
  expectTypesMatch(true);
625
646
 
626
647
  // src/pcb/pcb_port.ts
627
- import { z as z37 } from "zod";
628
- var pcb_port = z37.object({
629
- type: z37.literal("pcb_port"),
648
+ import { z as z38 } from "zod";
649
+ var pcb_port = z38.object({
650
+ type: z38.literal("pcb_port"),
630
651
  pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
631
- source_port_id: z37.string(),
632
- pcb_component_id: z37.string(),
652
+ source_port_id: z38.string(),
653
+ pcb_component_id: z38.string(),
633
654
  x: distance,
634
655
  y: distance,
635
- layers: z37.array(layer_ref)
656
+ layers: z38.array(layer_ref)
636
657
  }).describe("Defines a port on the PCB");
637
658
  expectTypesMatch(true);
638
659
 
639
660
  // src/pcb/pcb_smtpad.ts
640
- import { z as z38 } from "zod";
641
- var pcb_smtpad_circle = z38.object({
642
- type: z38.literal("pcb_smtpad"),
643
- shape: z38.literal("circle"),
661
+ import { z as z39 } from "zod";
662
+ var pcb_smtpad_circle = z39.object({
663
+ type: z39.literal("pcb_smtpad"),
664
+ shape: z39.literal("circle"),
644
665
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
645
666
  x: distance,
646
667
  y: distance,
647
- radius: z38.number(),
668
+ radius: z39.number(),
648
669
  layer: layer_ref,
649
- port_hints: z38.array(z38.string()).optional(),
650
- pcb_component_id: z38.string().optional(),
651
- pcb_port_id: z38.string().optional()
670
+ port_hints: z39.array(z39.string()).optional(),
671
+ pcb_component_id: z39.string().optional(),
672
+ pcb_port_id: z39.string().optional()
652
673
  });
653
- var pcb_smtpad_rect = z38.object({
654
- type: z38.literal("pcb_smtpad"),
655
- shape: z38.literal("rect"),
674
+ var pcb_smtpad_rect = z39.object({
675
+ type: z39.literal("pcb_smtpad"),
676
+ shape: z39.literal("rect"),
656
677
  pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
657
678
  x: distance,
658
679
  y: distance,
659
- width: z38.number(),
660
- height: z38.number(),
680
+ width: z39.number(),
681
+ height: z39.number(),
661
682
  layer: layer_ref,
662
- port_hints: z38.array(z38.string()).optional(),
663
- pcb_component_id: z38.string().optional(),
664
- pcb_port_id: z38.string().optional()
683
+ port_hints: z39.array(z39.string()).optional(),
684
+ pcb_component_id: z39.string().optional(),
685
+ pcb_port_id: z39.string().optional()
665
686
  });
666
- var pcb_smtpad = z38.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defines an SMT pad on the PCB");
687
+ var pcb_smtpad = z39.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defines an SMT pad on the PCB");
667
688
  expectTypesMatch(true);
668
689
  expectTypesMatch(true);
669
690
 
670
691
  // src/pcb/pcb_solder_paste.ts
671
- import { z as z39 } from "zod";
672
- var pcb_solder_paste_circle = z39.object({
673
- type: z39.literal("pcb_solder_paste"),
674
- shape: z39.literal("circle"),
692
+ import { z as z40 } from "zod";
693
+ var pcb_solder_paste_circle = z40.object({
694
+ type: z40.literal("pcb_solder_paste"),
695
+ shape: z40.literal("circle"),
675
696
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
676
697
  x: distance,
677
698
  y: distance,
678
- radius: z39.number(),
699
+ radius: z40.number(),
679
700
  layer: layer_ref,
680
- pcb_component_id: z39.string().optional(),
681
- pcb_smtpad_id: z39.string().optional()
701
+ pcb_component_id: z40.string().optional(),
702
+ pcb_smtpad_id: z40.string().optional()
682
703
  });
683
- var pcb_solder_paste_rect = z39.object({
684
- type: z39.literal("pcb_solder_paste"),
685
- shape: z39.literal("rect"),
704
+ var pcb_solder_paste_rect = z40.object({
705
+ type: z40.literal("pcb_solder_paste"),
706
+ shape: z40.literal("rect"),
686
707
  pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
687
708
  x: distance,
688
709
  y: distance,
689
- width: z39.number(),
690
- height: z39.number(),
710
+ width: z40.number(),
711
+ height: z40.number(),
691
712
  layer: layer_ref,
692
- pcb_component_id: z39.string().optional(),
693
- pcb_smtpad_id: z39.string().optional()
713
+ pcb_component_id: z40.string().optional(),
714
+ pcb_smtpad_id: z40.string().optional()
694
715
  });
695
- var pcb_solder_paste = z39.union([pcb_solder_paste_circle, pcb_solder_paste_rect]).describe("Defines solderpaste on the PCB");
716
+ var pcb_solder_paste = z40.union([pcb_solder_paste_circle, pcb_solder_paste_rect]).describe("Defines solderpaste on the PCB");
696
717
  expectTypesMatch(true);
697
718
  expectTypesMatch(true);
698
719
 
699
720
  // src/pcb/pcb_text.ts
700
- import { z as z40 } from "zod";
701
- var pcb_text = z40.object({
702
- type: z40.literal("pcb_text"),
721
+ import { z as z41 } from "zod";
722
+ var pcb_text = z41.object({
723
+ type: z41.literal("pcb_text"),
703
724
  pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
704
- text: z40.string(),
725
+ text: z41.string(),
705
726
  center: point,
706
727
  layer: layer_ref,
707
728
  width: length,
708
729
  height: length,
709
- lines: z40.number(),
710
- align: z40.enum(["bottom-left"])
730
+ lines: z41.number(),
731
+ align: z41.enum(["bottom-left"])
711
732
  }).describe("Defines text on the PCB");
712
733
  expectTypesMatch(true);
713
734
 
714
735
  // src/pcb/pcb_trace.ts
715
- import { z as z41 } from "zod";
716
- var pcb_trace_route_point_wire = z41.object({
717
- route_type: z41.literal("wire"),
736
+ import { z as z42 } from "zod";
737
+ var pcb_trace_route_point_wire = z42.object({
738
+ route_type: z42.literal("wire"),
718
739
  x: distance,
719
740
  y: distance,
720
741
  width: distance,
721
- start_pcb_port_id: z41.string().optional(),
722
- end_pcb_port_id: z41.string().optional(),
742
+ start_pcb_port_id: z42.string().optional(),
743
+ end_pcb_port_id: z42.string().optional(),
723
744
  layer: layer_ref
724
745
  });
725
- var pcb_trace_route_point_via = z41.object({
726
- route_type: z41.literal("via"),
746
+ var pcb_trace_route_point_via = z42.object({
747
+ route_type: z42.literal("via"),
727
748
  x: distance,
728
749
  y: distance,
729
- from_layer: z41.string(),
730
- to_layer: z41.string()
750
+ from_layer: z42.string(),
751
+ to_layer: z42.string()
731
752
  });
732
- var pcb_trace_route_point = z41.union([
753
+ var pcb_trace_route_point = z42.union([
733
754
  pcb_trace_route_point_wire,
734
755
  pcb_trace_route_point_via
735
756
  ]);
736
- var pcb_trace = z41.object({
737
- type: z41.literal("pcb_trace"),
738
- source_trace_id: z41.string().optional(),
739
- pcb_component_id: z41.string().optional(),
757
+ var pcb_trace = z42.object({
758
+ type: z42.literal("pcb_trace"),
759
+ source_trace_id: z42.string().optional(),
760
+ pcb_component_id: z42.string().optional(),
740
761
  pcb_trace_id: getZodPrefixedIdWithDefault("pcb_trace"),
741
- route_thickness_mode: z41.enum(["constant", "interpolated"]).default("constant").optional(),
742
- route_order_index: z41.number().optional(),
743
- should_round_corners: z41.boolean().optional(),
744
- route: z41.array(
745
- z41.union([
746
- z41.object({
747
- route_type: z41.literal("wire"),
762
+ route_thickness_mode: z42.enum(["constant", "interpolated"]).default("constant").optional(),
763
+ route_order_index: z42.number().optional(),
764
+ should_round_corners: z42.boolean().optional(),
765
+ route: z42.array(
766
+ z42.union([
767
+ z42.object({
768
+ route_type: z42.literal("wire"),
748
769
  x: distance,
749
770
  y: distance,
750
771
  width: distance,
751
- start_pcb_port_id: z41.string().optional(),
752
- end_pcb_port_id: z41.string().optional(),
772
+ start_pcb_port_id: z42.string().optional(),
773
+ end_pcb_port_id: z42.string().optional(),
753
774
  layer: layer_ref
754
775
  }),
755
- z41.object({
756
- route_type: z41.literal("via"),
776
+ z42.object({
777
+ route_type: z42.literal("via"),
757
778
  x: distance,
758
779
  y: distance,
759
- from_layer: z41.string(),
760
- to_layer: z41.string()
780
+ from_layer: z42.string(),
781
+ to_layer: z42.string()
761
782
  })
762
783
  ])
763
784
  )
@@ -766,34 +787,34 @@ expectTypesMatch(true);
766
787
  expectTypesMatch(true);
767
788
 
768
789
  // src/pcb/pcb_trace_error.ts
769
- import { z as z42 } from "zod";
770
- var pcb_trace_error = z42.object({
771
- type: z42.literal("pcb_trace_error"),
790
+ import { z as z43 } from "zod";
791
+ var pcb_trace_error = z43.object({
792
+ type: z43.literal("pcb_trace_error"),
772
793
  pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
773
- error_type: z42.literal("pcb_trace_error"),
774
- message: z42.string(),
794
+ error_type: z43.literal("pcb_trace_error"),
795
+ message: z43.string(),
775
796
  center: point.optional(),
776
- pcb_trace_id: z42.string(),
777
- source_trace_id: z42.string(),
778
- pcb_component_ids: z42.array(z42.string()),
779
- pcb_port_ids: z42.array(z42.string())
797
+ pcb_trace_id: z43.string(),
798
+ source_trace_id: z43.string(),
799
+ pcb_component_ids: z43.array(z43.string()),
800
+ pcb_port_ids: z43.array(z43.string())
780
801
  }).describe("Defines a trace error on the PCB");
781
802
  expectTypesMatch(true);
782
803
 
783
804
  // src/pcb/pcb_port_not_matched_error.ts
784
- import { z as z43 } from "zod";
785
- var pcb_port_not_matched_error = z43.object({
786
- type: z43.literal("pcb_port_not_matched_error"),
805
+ import { z as z44 } from "zod";
806
+ var pcb_port_not_matched_error = z44.object({
807
+ type: z44.literal("pcb_port_not_matched_error"),
787
808
  pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
788
- message: z43.string(),
789
- pcb_component_ids: z43.array(z43.string())
809
+ message: z44.string(),
810
+ pcb_component_ids: z44.array(z44.string())
790
811
  }).describe("Defines a trace error on the PCB where a port is not matched");
791
812
  expectTypesMatch(true);
792
813
 
793
814
  // src/pcb/pcb_via.ts
794
- import { z as z44 } from "zod";
795
- var pcb_via = z44.object({
796
- type: z44.literal("pcb_via"),
815
+ import { z as z45 } from "zod";
816
+ var pcb_via = z45.object({
817
+ type: z45.literal("pcb_via"),
797
818
  pcb_via_id: getZodPrefixedIdWithDefault("pcb_via"),
798
819
  x: distance,
799
820
  y: distance,
@@ -803,51 +824,51 @@ var pcb_via = z44.object({
803
824
  from_layer: layer_ref.optional(),
804
825
  /** @deprecated */
805
826
  to_layer: layer_ref.optional(),
806
- layers: z44.array(layer_ref),
807
- pcb_trace_id: z44.string().optional()
827
+ layers: z45.array(layer_ref),
828
+ pcb_trace_id: z45.string().optional()
808
829
  }).describe("Defines a via on the PCB");
809
830
  expectTypesMatch(true);
810
831
 
811
832
  // src/pcb/pcb_board.ts
812
- import { z as z45 } from "zod";
813
- var pcb_board = z45.object({
814
- type: z45.literal("pcb_board"),
833
+ import { z as z46 } from "zod";
834
+ var pcb_board = z46.object({
835
+ type: z46.literal("pcb_board"),
815
836
  pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
816
837
  width: length,
817
838
  height: length,
818
839
  center: point,
819
840
  thickness: length.optional().default(1.4),
820
- num_layers: z45.number().optional().default(4),
821
- outline: z45.array(point).optional()
841
+ num_layers: z46.number().optional().default(4),
842
+ outline: z46.array(point).optional()
822
843
  }).describe("Defines the board outline of the PCB");
823
844
  expectTypesMatch(true);
824
845
 
825
846
  // src/pcb/pcb_placement_error.ts
826
- import { z as z46 } from "zod";
827
- var pcb_placement_error = z46.object({
828
- type: z46.literal("pcb_placement_error"),
847
+ import { z as z47 } from "zod";
848
+ var pcb_placement_error = z47.object({
849
+ type: z47.literal("pcb_placement_error"),
829
850
  pcb_placement_error_id: getZodPrefixedIdWithDefault("pcb_placement_error"),
830
- message: z46.string()
851
+ message: z47.string()
831
852
  }).describe("Defines a placement error on the PCB");
832
853
  expectTypesMatch(true);
833
854
 
834
855
  // src/pcb/pcb_trace_hint.ts
835
- import { z as z47 } from "zod";
836
- var pcb_trace_hint = z47.object({
837
- type: z47.literal("pcb_trace_hint"),
856
+ import { z as z48 } from "zod";
857
+ var pcb_trace_hint = z48.object({
858
+ type: z48.literal("pcb_trace_hint"),
838
859
  pcb_trace_hint_id: getZodPrefixedIdWithDefault("pcb_trace_hint"),
839
- pcb_port_id: z47.string(),
840
- pcb_component_id: z47.string(),
841
- route: z47.array(route_hint_point)
860
+ pcb_port_id: z48.string(),
861
+ pcb_component_id: z48.string(),
862
+ route: z48.array(route_hint_point)
842
863
  }).describe("A hint that can be used during generation of a PCB trace");
843
864
  expectTypesMatch(true);
844
865
 
845
866
  // src/pcb/pcb_silkscreen_line.ts
846
- import { z as z48 } from "zod";
847
- var pcb_silkscreen_line = z48.object({
848
- type: z48.literal("pcb_silkscreen_line"),
867
+ import { z as z49 } from "zod";
868
+ var pcb_silkscreen_line = z49.object({
869
+ type: z49.literal("pcb_silkscreen_line"),
849
870
  pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
850
- pcb_component_id: z48.string(),
871
+ pcb_component_id: z49.string(),
851
872
  stroke_width: distance.default("0.1mm"),
852
873
  x1: distance,
853
874
  y1: distance,
@@ -858,39 +879,39 @@ var pcb_silkscreen_line = z48.object({
858
879
  expectTypesMatch(true);
859
880
 
860
881
  // src/pcb/pcb_silkscreen_path.ts
861
- import { z as z49 } from "zod";
862
- var pcb_silkscreen_path = z49.object({
863
- type: z49.literal("pcb_silkscreen_path"),
882
+ import { z as z50 } from "zod";
883
+ var pcb_silkscreen_path = z50.object({
884
+ type: z50.literal("pcb_silkscreen_path"),
864
885
  pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
865
- pcb_component_id: z49.string(),
886
+ pcb_component_id: z50.string(),
866
887
  layer: visible_layer,
867
- route: z49.array(point),
888
+ route: z50.array(point),
868
889
  stroke_width: length
869
890
  }).describe("Defines a silkscreen path on the PCB");
870
891
  expectTypesMatch(true);
871
892
 
872
893
  // src/pcb/pcb_silkscreen_text.ts
873
- import { z as z50 } from "zod";
874
- var pcb_silkscreen_text = z50.object({
875
- type: z50.literal("pcb_silkscreen_text"),
894
+ import { z as z51 } from "zod";
895
+ var pcb_silkscreen_text = z51.object({
896
+ type: z51.literal("pcb_silkscreen_text"),
876
897
  pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
877
- font: z50.literal("tscircuit2024").default("tscircuit2024"),
898
+ font: z51.literal("tscircuit2024").default("tscircuit2024"),
878
899
  font_size: distance.default("0.2mm"),
879
- pcb_component_id: z50.string(),
880
- text: z50.string(),
900
+ pcb_component_id: z51.string(),
901
+ text: z51.string(),
881
902
  layer: layer_ref,
882
- is_mirrored: z50.boolean().default(false).optional(),
903
+ is_mirrored: z51.boolean().default(false).optional(),
883
904
  anchor_position: point.default({ x: 0, y: 0 }),
884
- anchor_alignment: z50.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
905
+ anchor_alignment: z51.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
885
906
  }).describe("Defines silkscreen text on the PCB");
886
907
  expectTypesMatch(true);
887
908
 
888
909
  // src/pcb/pcb_silkscreen_rect.ts
889
- import { z as z51 } from "zod";
890
- var pcb_silkscreen_rect = z51.object({
891
- type: z51.literal("pcb_silkscreen_rect"),
910
+ import { z as z52 } from "zod";
911
+ var pcb_silkscreen_rect = z52.object({
912
+ type: z52.literal("pcb_silkscreen_rect"),
892
913
  pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
893
- pcb_component_id: z51.string(),
914
+ pcb_component_id: z52.string(),
894
915
  center: point,
895
916
  width: length,
896
917
  height: length,
@@ -899,13 +920,13 @@ var pcb_silkscreen_rect = z51.object({
899
920
  expectTypesMatch(true);
900
921
 
901
922
  // src/pcb/pcb_silkscreen_circle.ts
902
- import { z as z52 } from "zod";
903
- var pcb_silkscreen_circle = z52.object({
904
- type: z52.literal("pcb_silkscreen_circle"),
923
+ import { z as z53 } from "zod";
924
+ var pcb_silkscreen_circle = z53.object({
925
+ type: z53.literal("pcb_silkscreen_circle"),
905
926
  pcb_silkscreen_circle_id: getZodPrefixedIdWithDefault(
906
927
  "pcb_silkscreen_circle"
907
928
  ),
908
- pcb_component_id: z52.string(),
929
+ pcb_component_id: z53.string(),
909
930
  center: point,
910
931
  radius: length,
911
932
  layer: visible_layer
@@ -913,11 +934,11 @@ var pcb_silkscreen_circle = z52.object({
913
934
  expectTypesMatch(true);
914
935
 
915
936
  // src/pcb/pcb_silkscreen_oval.ts
916
- import { z as z53 } from "zod";
917
- var pcb_silkscreen_oval = z53.object({
918
- type: z53.literal("pcb_silkscreen_oval"),
937
+ import { z as z54 } from "zod";
938
+ var pcb_silkscreen_oval = z54.object({
939
+ type: z54.literal("pcb_silkscreen_oval"),
919
940
  pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
920
- pcb_component_id: z53.string(),
941
+ pcb_component_id: z54.string(),
921
942
  center: point,
922
943
  radius_x: distance,
923
944
  radius_y: distance,
@@ -926,91 +947,91 @@ var pcb_silkscreen_oval = z53.object({
926
947
  expectTypesMatch(true);
927
948
 
928
949
  // src/pcb/pcb_fabrication_note_text.ts
929
- import { z as z54 } from "zod";
930
- var pcb_fabrication_note_text = z54.object({
931
- type: z54.literal("pcb_fabrication_note_text"),
950
+ import { z as z55 } from "zod";
951
+ var pcb_fabrication_note_text = z55.object({
952
+ type: z55.literal("pcb_fabrication_note_text"),
932
953
  pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
933
954
  "pcb_fabrication_note_text"
934
955
  ),
935
- font: z54.literal("tscircuit2024").default("tscircuit2024"),
956
+ font: z55.literal("tscircuit2024").default("tscircuit2024"),
936
957
  font_size: distance.default("1mm"),
937
- pcb_component_id: z54.string(),
938
- text: z54.string(),
958
+ pcb_component_id: z55.string(),
959
+ text: z55.string(),
939
960
  layer: visible_layer,
940
961
  anchor_position: point.default({ x: 0, y: 0 }),
941
- anchor_alignment: z54.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
942
- color: z54.string().optional()
962
+ anchor_alignment: z55.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
963
+ color: z55.string().optional()
943
964
  }).describe(
944
965
  "Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"
945
966
  );
946
967
  expectTypesMatch(true);
947
968
 
948
969
  // src/pcb/pcb_fabrication_note_path.ts
949
- import { z as z55 } from "zod";
950
- var pcb_fabrication_note_path = z55.object({
951
- type: z55.literal("pcb_fabrication_note_path"),
970
+ import { z as z56 } from "zod";
971
+ var pcb_fabrication_note_path = z56.object({
972
+ type: z56.literal("pcb_fabrication_note_path"),
952
973
  pcb_fabrication_note_path_id: getZodPrefixedIdWithDefault(
953
974
  "pcb_fabrication_note_path"
954
975
  ),
955
- pcb_component_id: z55.string(),
976
+ pcb_component_id: z56.string(),
956
977
  layer: layer_ref,
957
- route: z55.array(point),
978
+ route: z56.array(point),
958
979
  stroke_width: length,
959
- color: z55.string().optional()
980
+ color: z56.string().optional()
960
981
  }).describe(
961
982
  "Defines a fabrication path on the PCB for fabricators or assemblers"
962
983
  );
963
984
  expectTypesMatch(true);
964
985
 
965
986
  // src/pcb/pcb_keepout.ts
966
- import { z as z56 } from "zod";
967
- var pcb_keepout = z56.object({
968
- type: z56.literal("pcb_keepout"),
969
- shape: z56.literal("rect"),
987
+ import { z as z57 } from "zod";
988
+ var pcb_keepout = z57.object({
989
+ type: z57.literal("pcb_keepout"),
990
+ shape: z57.literal("rect"),
970
991
  center: point,
971
992
  width: distance,
972
993
  height: distance,
973
- pcb_keepout_id: z56.string(),
974
- layers: z56.array(z56.string()),
994
+ pcb_keepout_id: z57.string(),
995
+ layers: z57.array(z57.string()),
975
996
  // Specify layers where the keepout applies
976
- description: z56.string().optional()
997
+ description: z57.string().optional()
977
998
  // Optional description of the keepout
978
999
  }).or(
979
- z56.object({
980
- type: z56.literal("pcb_keepout"),
981
- shape: z56.literal("circle"),
1000
+ z57.object({
1001
+ type: z57.literal("pcb_keepout"),
1002
+ shape: z57.literal("circle"),
982
1003
  center: point,
983
1004
  radius: distance,
984
- pcb_keepout_id: z56.string(),
985
- layers: z56.array(z56.string()),
1005
+ pcb_keepout_id: z57.string(),
1006
+ layers: z57.array(z57.string()),
986
1007
  // Specify layers where the keepout applies
987
- description: z56.string().optional()
1008
+ description: z57.string().optional()
988
1009
  // Optional description of the keepout
989
1010
  })
990
1011
  );
991
1012
 
992
1013
  // src/cad/cad_component.ts
993
- import { z as z57 } from "zod";
994
- var cad_component = z57.object({
995
- type: z57.literal("cad_component"),
996
- cad_component_id: z57.string(),
997
- pcb_component_id: z57.string(),
998
- source_component_id: z57.string(),
1014
+ import { z as z58 } from "zod";
1015
+ var cad_component = z58.object({
1016
+ type: z58.literal("cad_component"),
1017
+ cad_component_id: z58.string(),
1018
+ pcb_component_id: z58.string(),
1019
+ source_component_id: z58.string(),
999
1020
  position: point3,
1000
1021
  rotation: point3.optional(),
1001
1022
  size: point3.optional(),
1002
1023
  layer: layer_ref.optional(),
1003
1024
  // These are all ways to generate/load the 3d model
1004
- footprinter_string: z57.string().optional(),
1005
- model_obj_url: z57.string().optional(),
1006
- model_stl_url: z57.string().optional(),
1007
- model_3mf_url: z57.string().optional(),
1008
- model_jscad: z57.any().optional()
1025
+ footprinter_string: z58.string().optional(),
1026
+ model_obj_url: z58.string().optional(),
1027
+ model_stl_url: z58.string().optional(),
1028
+ model_3mf_url: z58.string().optional(),
1029
+ model_jscad: z58.any().optional()
1009
1030
  }).describe("Defines a component on the PCB");
1010
1031
 
1011
1032
  // src/any_circuit_element.ts
1012
- import { z as z58 } from "zod";
1013
- var any_circuit_element = z58.union([
1033
+ import { z as z59 } from "zod";
1034
+ var any_circuit_element = z59.union([
1014
1035
  source_trace,
1015
1036
  source_port,
1016
1037
  any_source_component,
@@ -1023,6 +1044,7 @@ var any_circuit_element = z58.union([
1023
1044
  source_simple_diode,
1024
1045
  source_simple_resistor,
1025
1046
  source_simple_power_source,
1047
+ source_simple_battery,
1026
1048
  pcb_component,
1027
1049
  pcb_hole,
1028
1050
  pcb_plated_hole,
@@ -1063,6 +1085,7 @@ export {
1063
1085
  any_circuit_element,
1064
1086
  any_soup_element,
1065
1087
  any_source_component,
1088
+ battery_capacity,
1066
1089
  cad_component,
1067
1090
  capacitance,
1068
1091
  current,
@@ -1125,6 +1148,7 @@ export {
1125
1148
  source_led,
1126
1149
  source_net,
1127
1150
  source_port,
1151
+ source_simple_battery,
1128
1152
  source_simple_bug,
1129
1153
  source_simple_capacitor,
1130
1154
  source_simple_chip,