easyeda 0.0.196 → 0.0.197
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/browser/index.js +1344 -581
- package/dist/browser/index.js.map +1 -1
- package/dist/{chunk-UZMC3PUZ.js → chunk-E6OHT5YV.js} +1586 -823
- package/dist/chunk-E6OHT5YV.js.map +1 -0
- package/dist/cli/main.js +7 -7
- package/dist/cli/main.js.map +1 -1
- package/dist/lib/index.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-UZMC3PUZ.js.map +0 -1
|
@@ -22,8 +22,10 @@ __export(dist_exports, {
|
|
|
22
22
|
layer_ref: () => layer_ref,
|
|
23
23
|
layer_string: () => layer_string,
|
|
24
24
|
length: () => length,
|
|
25
|
+
ninePointAnchor: () => ninePointAnchor,
|
|
25
26
|
pcb_autorouting_error: () => pcb_autorouting_error,
|
|
26
27
|
pcb_board: () => pcb_board,
|
|
28
|
+
pcb_breakout_point: () => pcb_breakout_point,
|
|
27
29
|
pcb_component: () => pcb_component,
|
|
28
30
|
pcb_cutout: () => pcb_cutout,
|
|
29
31
|
pcb_cutout_circle: () => pcb_cutout_circle,
|
|
@@ -31,6 +33,8 @@ __export(dist_exports, {
|
|
|
31
33
|
pcb_cutout_rect: () => pcb_cutout_rect,
|
|
32
34
|
pcb_fabrication_note_path: () => pcb_fabrication_note_path,
|
|
33
35
|
pcb_fabrication_note_text: () => pcb_fabrication_note_text,
|
|
36
|
+
pcb_ground_plane: () => pcb_ground_plane,
|
|
37
|
+
pcb_ground_plane_region: () => pcb_ground_plane_region,
|
|
34
38
|
pcb_group: () => pcb_group,
|
|
35
39
|
pcb_hole: () => pcb_hole,
|
|
36
40
|
pcb_hole_circle_or_square_shape: () => pcb_hole_circle_or_square_shape,
|
|
@@ -54,6 +58,7 @@ __export(dist_exports, {
|
|
|
54
58
|
pcb_smtpad_pill: () => pcb_smtpad_pill,
|
|
55
59
|
pcb_solder_paste: () => pcb_solder_paste,
|
|
56
60
|
pcb_text: () => pcb_text,
|
|
61
|
+
pcb_thermal_spoke: () => pcb_thermal_spoke,
|
|
57
62
|
pcb_trace: () => pcb_trace,
|
|
58
63
|
pcb_trace_error: () => pcb_trace_error,
|
|
59
64
|
pcb_trace_hint: () => pcb_trace_hint,
|
|
@@ -80,6 +85,7 @@ __export(dist_exports, {
|
|
|
80
85
|
schematic_debug_rect: () => schematic_debug_rect,
|
|
81
86
|
schematic_error: () => schematic_error,
|
|
82
87
|
schematic_group: () => schematic_group,
|
|
88
|
+
schematic_layout_error: () => schematic_layout_error,
|
|
83
89
|
schematic_line: () => schematic_line,
|
|
84
90
|
schematic_manual_edit_conflict_warning: () => schematic_manual_edit_conflict_warning,
|
|
85
91
|
schematic_net_label: () => schematic_net_label,
|
|
@@ -93,13 +99,12 @@ __export(dist_exports, {
|
|
|
93
99
|
source_component_base: () => source_component_base,
|
|
94
100
|
source_failed_to_create_component_error: () => source_failed_to_create_component_error,
|
|
95
101
|
source_group: () => source_group,
|
|
96
|
-
source_led: () => source_led,
|
|
97
102
|
source_missing_property_error: () => source_missing_property_error,
|
|
98
103
|
source_net: () => source_net,
|
|
104
|
+
source_pcb_ground_plane: () => source_pcb_ground_plane,
|
|
99
105
|
source_port: () => source_port,
|
|
100
106
|
source_project_metadata: () => source_project_metadata,
|
|
101
107
|
source_simple_battery: () => source_simple_battery,
|
|
102
|
-
source_simple_bug: () => source_simple_bug,
|
|
103
108
|
source_simple_capacitor: () => source_simple_capacitor,
|
|
104
109
|
source_simple_chip: () => source_simple_chip,
|
|
105
110
|
source_simple_crystal: () => source_simple_crystal,
|
|
@@ -115,6 +120,7 @@ __export(dist_exports, {
|
|
|
115
120
|
source_simple_resistor: () => source_simple_resistor,
|
|
116
121
|
source_simple_resonator: () => source_simple_resonator,
|
|
117
122
|
source_simple_switch: () => source_simple_switch,
|
|
123
|
+
source_simple_test_point: () => source_simple_test_point,
|
|
118
124
|
source_simple_transistor: () => source_simple_transistor,
|
|
119
125
|
source_trace: () => source_trace,
|
|
120
126
|
supplier_name: () => supplier_name,
|
|
@@ -159,18 +165,18 @@ function nanoid(size2 = 21) {
|
|
|
159
165
|
}
|
|
160
166
|
|
|
161
167
|
// node_modules/circuit-json/dist/index.mjs
|
|
162
|
-
import { z as z8 } from "zod";
|
|
163
168
|
import { z as z6 } from "zod";
|
|
164
|
-
import { z as z7 } from "zod";
|
|
165
169
|
import { z as z9 } from "zod";
|
|
170
|
+
import { z as z7 } from "zod";
|
|
171
|
+
import { z as z8 } from "zod";
|
|
166
172
|
import { z as z10 } from "zod";
|
|
167
173
|
import { z as z11 } from "zod";
|
|
168
174
|
import { z as z12 } from "zod";
|
|
169
175
|
import { z as z13 } from "zod";
|
|
170
176
|
import { z as z14 } from "zod";
|
|
171
177
|
import { z as z15 } from "zod";
|
|
172
|
-
import { z as z16 } from "zod";
|
|
173
178
|
import { z as z31 } from "zod";
|
|
179
|
+
import { z as z16 } from "zod";
|
|
174
180
|
import { z as z17 } from "zod";
|
|
175
181
|
import { z as z18 } from "zod";
|
|
176
182
|
import { z as z19 } from "zod";
|
|
@@ -194,8 +200,8 @@ import { z as z37 } from "zod";
|
|
|
194
200
|
import { z as z38 } from "zod";
|
|
195
201
|
import { z as z39 } from "zod";
|
|
196
202
|
import { z as z40 } from "zod";
|
|
197
|
-
import { z as z43 } from "zod";
|
|
198
203
|
import { z as z41 } from "zod";
|
|
204
|
+
import { z as z43 } from "zod";
|
|
199
205
|
import { z as z42 } from "zod";
|
|
200
206
|
import { z as z44 } from "zod";
|
|
201
207
|
import { z as z45 } from "zod";
|
|
@@ -237,6 +243,11 @@ import { z as z80 } from "zod";
|
|
|
237
243
|
import { z as z81 } from "zod";
|
|
238
244
|
import { z as z82 } from "zod";
|
|
239
245
|
import { z as z83 } from "zod";
|
|
246
|
+
import { z as z84 } from "zod";
|
|
247
|
+
import { z as z85 } from "zod";
|
|
248
|
+
import { z as z86 } from "zod";
|
|
249
|
+
import { z as z87 } from "zod";
|
|
250
|
+
import { z as z88 } from "zod";
|
|
240
251
|
var unitMappings = {
|
|
241
252
|
Hz: {
|
|
242
253
|
baseUnit: "Hz",
|
|
@@ -462,25 +473,59 @@ var battery_capacity = z.number().or(z.string().endsWith("mAh")).transform((v) =
|
|
|
462
473
|
}
|
|
463
474
|
return v;
|
|
464
475
|
}).describe("Battery capacity in mAh");
|
|
476
|
+
var expectTypesMatch = (shouldBe) => {
|
|
477
|
+
};
|
|
478
|
+
expectTypesMatch("extra props b");
|
|
479
|
+
expectTypesMatch("missing props b");
|
|
480
|
+
expectTypesMatch(true);
|
|
481
|
+
expectTypesMatch("mismatched prop types: a");
|
|
482
|
+
var expectStringUnionsMatch = (shouldBe) => {
|
|
483
|
+
};
|
|
484
|
+
expectStringUnionsMatch(true);
|
|
485
|
+
expectStringUnionsMatch(
|
|
486
|
+
'T1 has extra: "c", T2 has extra: "d"'
|
|
487
|
+
);
|
|
488
|
+
expectStringUnionsMatch('T1 has extra: "c"');
|
|
489
|
+
expectStringUnionsMatch('T2 has extra: "c"');
|
|
490
|
+
expectStringUnionsMatch(
|
|
491
|
+
'T1 has extra: "d", T2 has extra: "c"'
|
|
492
|
+
);
|
|
493
|
+
expectStringUnionsMatch(true);
|
|
465
494
|
var point = z2.object({
|
|
466
495
|
x: distance,
|
|
467
496
|
y: distance
|
|
468
497
|
});
|
|
469
498
|
var position = point;
|
|
499
|
+
expectTypesMatch(true);
|
|
500
|
+
expectTypesMatch(true);
|
|
470
501
|
var point3 = z3.object({
|
|
471
502
|
x: distance,
|
|
472
503
|
y: distance,
|
|
473
504
|
z: distance
|
|
474
505
|
});
|
|
475
506
|
var position3 = point3;
|
|
507
|
+
expectTypesMatch(true);
|
|
476
508
|
var size = z4.object({
|
|
477
509
|
width: z4.number(),
|
|
478
510
|
height: z4.number()
|
|
479
511
|
});
|
|
512
|
+
expectTypesMatch(true);
|
|
480
513
|
var getZodPrefixedIdWithDefault = (prefix) => {
|
|
481
514
|
return z5.string().optional().default(() => `${prefix}_${nanoid(10)}`);
|
|
482
515
|
};
|
|
483
|
-
var
|
|
516
|
+
var ninePointAnchor = z6.enum([
|
|
517
|
+
"top_left",
|
|
518
|
+
"top_center",
|
|
519
|
+
"top_right",
|
|
520
|
+
"center_left",
|
|
521
|
+
"center",
|
|
522
|
+
"center_right",
|
|
523
|
+
"bottom_left",
|
|
524
|
+
"bottom_center",
|
|
525
|
+
"bottom_right"
|
|
526
|
+
]);
|
|
527
|
+
expectTypesMatch(true);
|
|
528
|
+
var supplier_name = z7.enum([
|
|
484
529
|
"jlcpcb",
|
|
485
530
|
"macrofab",
|
|
486
531
|
"pcbway",
|
|
@@ -488,126 +533,118 @@ var supplier_name = z6.enum([
|
|
|
488
533
|
"mouser",
|
|
489
534
|
"lcsc"
|
|
490
535
|
]);
|
|
491
|
-
var expectTypesMatch = (shouldBe) => {
|
|
492
|
-
};
|
|
493
|
-
expectTypesMatch("extra props b");
|
|
494
|
-
expectTypesMatch("missing props b");
|
|
495
536
|
expectTypesMatch(true);
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
)
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
)
|
|
508
|
-
expectStringUnionsMatch(true);
|
|
509
|
-
var source_component_base = z7.object({
|
|
510
|
-
type: z7.literal("source_component"),
|
|
511
|
-
ftype: z7.string().optional(),
|
|
512
|
-
source_component_id: z7.string(),
|
|
513
|
-
name: z7.string(),
|
|
514
|
-
manufacturer_part_number: z7.string().optional(),
|
|
515
|
-
supplier_part_numbers: z7.record(supplier_name, z7.array(z7.string())).optional(),
|
|
516
|
-
display_value: z7.string().optional(),
|
|
517
|
-
are_pins_interchangeable: z7.boolean().optional(),
|
|
518
|
-
internally_connected_source_port_ids: z7.array(z7.array(z7.string())).optional(),
|
|
519
|
-
source_group_id: z7.string().optional()
|
|
537
|
+
var source_component_base = z8.object({
|
|
538
|
+
type: z8.literal("source_component"),
|
|
539
|
+
ftype: z8.string().optional(),
|
|
540
|
+
source_component_id: z8.string(),
|
|
541
|
+
name: z8.string(),
|
|
542
|
+
manufacturer_part_number: z8.string().optional(),
|
|
543
|
+
supplier_part_numbers: z8.record(supplier_name, z8.array(z8.string())).optional(),
|
|
544
|
+
display_value: z8.string().optional(),
|
|
545
|
+
are_pins_interchangeable: z8.boolean().optional(),
|
|
546
|
+
internally_connected_source_port_ids: z8.array(z8.array(z8.string())).optional(),
|
|
547
|
+
source_group_id: z8.string().optional(),
|
|
548
|
+
subcircuit_id: z8.string().optional()
|
|
520
549
|
});
|
|
521
550
|
expectTypesMatch(true);
|
|
522
551
|
var source_simple_capacitor = source_component_base.extend({
|
|
523
|
-
ftype:
|
|
552
|
+
ftype: z9.literal("simple_capacitor"),
|
|
524
553
|
capacitance,
|
|
525
554
|
max_voltage_rating: voltage.optional(),
|
|
526
|
-
display_capacitance:
|
|
555
|
+
display_capacitance: z9.string().optional(),
|
|
527
556
|
max_decoupling_trace_length: distance.optional()
|
|
528
557
|
});
|
|
529
558
|
expectTypesMatch(true);
|
|
530
559
|
var source_simple_resistor = source_component_base.extend({
|
|
531
|
-
ftype:
|
|
560
|
+
ftype: z10.literal("simple_resistor"),
|
|
532
561
|
resistance,
|
|
533
|
-
display_resistance:
|
|
562
|
+
display_resistance: z10.string().optional()
|
|
534
563
|
});
|
|
535
564
|
expectTypesMatch(true);
|
|
536
565
|
var source_simple_diode = source_component_base.extend({
|
|
537
|
-
ftype:
|
|
566
|
+
ftype: z11.literal("simple_diode")
|
|
538
567
|
});
|
|
539
568
|
expectTypesMatch(true);
|
|
540
569
|
var source_simple_led = source_simple_diode.extend({
|
|
541
|
-
ftype:
|
|
542
|
-
color:
|
|
543
|
-
wavelength:
|
|
570
|
+
ftype: z12.literal("simple_led"),
|
|
571
|
+
color: z12.string().optional(),
|
|
572
|
+
wavelength: z12.string().optional()
|
|
544
573
|
});
|
|
545
574
|
expectTypesMatch(true);
|
|
546
575
|
var source_simple_ground = source_component_base.extend({
|
|
547
|
-
ftype:
|
|
576
|
+
ftype: z13.literal("simple_ground")
|
|
548
577
|
});
|
|
549
578
|
expectTypesMatch(true);
|
|
550
|
-
var source_simple_bug = source_component_base.extend({
|
|
551
|
-
ftype: z13.literal("simple_bug")
|
|
552
|
-
}).describe("@deprecated");
|
|
553
579
|
var source_simple_chip = source_component_base.extend({
|
|
554
580
|
ftype: z14.literal("simple_chip")
|
|
555
581
|
});
|
|
556
582
|
expectTypesMatch(true);
|
|
557
|
-
var source_led = source_simple_diode.extend({
|
|
558
|
-
ftype: z15.literal("led")
|
|
559
|
-
});
|
|
560
|
-
expectTypesMatch(true);
|
|
561
583
|
var source_simple_power_source = source_component_base.extend({
|
|
562
|
-
ftype:
|
|
584
|
+
ftype: z15.literal("simple_power_source"),
|
|
563
585
|
voltage
|
|
564
586
|
});
|
|
565
587
|
expectTypesMatch(true);
|
|
566
588
|
var source_simple_fuse = source_component_base.extend({
|
|
567
|
-
ftype:
|
|
568
|
-
current_rating_amps:
|
|
569
|
-
voltage_rating_volts:
|
|
589
|
+
ftype: z16.literal("simple_fuse"),
|
|
590
|
+
current_rating_amps: z16.number().describe("Nominal current in amps the fuse is rated for"),
|
|
591
|
+
voltage_rating_volts: z16.number().describe("Voltage rating in volts, e.g. \xB15V would be 5")
|
|
570
592
|
});
|
|
571
593
|
expectTypesMatch(true);
|
|
572
594
|
var source_simple_battery = source_component_base.extend({
|
|
573
|
-
ftype:
|
|
595
|
+
ftype: z17.literal("simple_battery"),
|
|
574
596
|
capacity: battery_capacity
|
|
575
597
|
});
|
|
576
598
|
expectTypesMatch(true);
|
|
577
599
|
var source_simple_inductor = source_component_base.extend({
|
|
578
|
-
ftype:
|
|
579
|
-
inductance
|
|
600
|
+
ftype: z18.literal("simple_inductor"),
|
|
601
|
+
inductance,
|
|
602
|
+
max_current_rating: z18.number().optional()
|
|
580
603
|
});
|
|
581
604
|
expectTypesMatch(true);
|
|
582
605
|
var source_simple_push_button = source_component_base.extend({
|
|
583
|
-
ftype:
|
|
606
|
+
ftype: z19.literal("simple_push_button")
|
|
584
607
|
});
|
|
585
608
|
expectTypesMatch(true);
|
|
586
609
|
var source_simple_potentiometer = source_component_base.extend({
|
|
587
|
-
ftype:
|
|
610
|
+
ftype: z20.literal("simple_potentiometer"),
|
|
588
611
|
max_resistance: resistance
|
|
589
612
|
});
|
|
613
|
+
expectTypesMatch(
|
|
614
|
+
true
|
|
615
|
+
);
|
|
590
616
|
var source_simple_crystal = source_component_base.extend({
|
|
591
|
-
ftype:
|
|
592
|
-
frequency:
|
|
593
|
-
load_capacitance:
|
|
617
|
+
ftype: z21.literal("simple_crystal"),
|
|
618
|
+
frequency: z21.number().describe("Frequency in Hz"),
|
|
619
|
+
load_capacitance: z21.number().optional().describe("Load capacitance in pF")
|
|
594
620
|
});
|
|
595
621
|
expectTypesMatch(true);
|
|
596
622
|
var source_simple_pin_header = source_component_base.extend({
|
|
597
|
-
ftype:
|
|
598
|
-
pin_count:
|
|
599
|
-
gender:
|
|
623
|
+
ftype: z22.literal("simple_pin_header"),
|
|
624
|
+
pin_count: z22.number(),
|
|
625
|
+
gender: z22.enum(["male", "female"]).optional().default("male")
|
|
600
626
|
});
|
|
627
|
+
expectTypesMatch(true);
|
|
601
628
|
var source_simple_resonator = source_component_base.extend({
|
|
602
|
-
ftype:
|
|
629
|
+
ftype: z23.literal("simple_resonator"),
|
|
603
630
|
load_capacitance: capacitance,
|
|
604
631
|
equivalent_series_resistance: resistance.optional(),
|
|
605
632
|
frequency
|
|
606
633
|
});
|
|
607
634
|
expectTypesMatch(true);
|
|
608
635
|
var source_simple_transistor = source_component_base.extend({
|
|
609
|
-
ftype:
|
|
610
|
-
transistor_type:
|
|
636
|
+
ftype: z24.literal("simple_transistor"),
|
|
637
|
+
transistor_type: z24.enum(["npn", "pnp"])
|
|
638
|
+
});
|
|
639
|
+
expectTypesMatch(true);
|
|
640
|
+
var source_simple_test_point = source_component_base.extend({
|
|
641
|
+
ftype: z25.literal("simple_test_point"),
|
|
642
|
+
footprint_variant: z25.enum(["pad", "through_hole"]).optional(),
|
|
643
|
+
pad_shape: z25.enum(["rect", "circle"]).optional(),
|
|
644
|
+
pad_diameter: z25.union([z25.number(), z25.string()]).optional(),
|
|
645
|
+
hole_diameter: z25.union([z25.number(), z25.string()]).optional(),
|
|
646
|
+
width: z25.union([z25.number(), z25.string()]).optional(),
|
|
647
|
+
height: z25.union([z25.number(), z25.string()]).optional()
|
|
611
648
|
});
|
|
612
649
|
expectTypesMatch(true);
|
|
613
650
|
var source_simple_mosfet = source_component_base.extend({
|
|
@@ -624,6 +661,7 @@ var source_project_metadata = z28.object({
|
|
|
624
661
|
type: z28.literal("source_project_metadata"),
|
|
625
662
|
name: z28.string().optional(),
|
|
626
663
|
software_used_string: z28.string().optional(),
|
|
664
|
+
project_url: z28.string().optional(),
|
|
627
665
|
created_at: z28.string().datetime().optional()
|
|
628
666
|
});
|
|
629
667
|
expectTypesMatch(true);
|
|
@@ -634,7 +672,8 @@ var source_missing_property_error = z29.object({
|
|
|
634
672
|
),
|
|
635
673
|
source_component_id: z29.string(),
|
|
636
674
|
property_name: z29.string(),
|
|
637
|
-
|
|
675
|
+
subcircuit_id: z29.string().optional(),
|
|
676
|
+
error_type: z29.literal("source_missing_property_error").default("source_missing_property_error"),
|
|
638
677
|
message: z29.string()
|
|
639
678
|
}).describe("The source code is missing a property");
|
|
640
679
|
expectTypesMatch(true);
|
|
@@ -643,6 +682,7 @@ var source_failed_to_create_component_error = z30.object({
|
|
|
643
682
|
source_failed_to_create_component_error_id: getZodPrefixedIdWithDefault(
|
|
644
683
|
"source_failed_to_create_component_error"
|
|
645
684
|
),
|
|
685
|
+
error_type: z30.literal("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),
|
|
646
686
|
component_name: z30.string().optional(),
|
|
647
687
|
subcircuit_id: z30.string().optional(),
|
|
648
688
|
parent_source_component_id: z30.string().optional(),
|
|
@@ -664,8 +704,6 @@ var any_source_component = z31.union([
|
|
|
664
704
|
source_simple_led,
|
|
665
705
|
source_simple_ground,
|
|
666
706
|
source_simple_chip,
|
|
667
|
-
source_simple_bug,
|
|
668
|
-
source_led,
|
|
669
707
|
source_simple_power_source,
|
|
670
708
|
source_simple_battery,
|
|
671
709
|
source_simple_inductor,
|
|
@@ -676,12 +714,14 @@ var any_source_component = z31.union([
|
|
|
676
714
|
source_simple_resonator,
|
|
677
715
|
source_simple_switch,
|
|
678
716
|
source_simple_transistor,
|
|
717
|
+
source_simple_test_point,
|
|
679
718
|
source_simple_mosfet,
|
|
680
719
|
source_simple_fuse,
|
|
681
720
|
source_project_metadata,
|
|
682
721
|
source_missing_property_error,
|
|
683
722
|
source_failed_to_create_component_error
|
|
684
723
|
]);
|
|
724
|
+
expectTypesMatch(true);
|
|
685
725
|
var source_port = z32.object({
|
|
686
726
|
type: z32.literal("source_port"),
|
|
687
727
|
pin_number: z32.number().optional(),
|
|
@@ -689,7 +729,8 @@ var source_port = z32.object({
|
|
|
689
729
|
name: z32.string(),
|
|
690
730
|
source_port_id: z32.string(),
|
|
691
731
|
source_component_id: z32.string(),
|
|
692
|
-
subcircuit_id: z32.string().optional()
|
|
732
|
+
subcircuit_id: z32.string().optional(),
|
|
733
|
+
subcircuit_connectivity_map_key: z32.string().optional()
|
|
693
734
|
});
|
|
694
735
|
expectTypesMatch(true);
|
|
695
736
|
var source_trace = z33.object({
|
|
@@ -712,6 +753,7 @@ var source_group = z34.object({
|
|
|
712
753
|
is_subcircuit: z34.boolean().optional(),
|
|
713
754
|
name: z34.string().optional()
|
|
714
755
|
});
|
|
756
|
+
expectTypesMatch(true);
|
|
715
757
|
var source_net = z35.object({
|
|
716
758
|
type: z35.literal("source_net"),
|
|
717
759
|
source_net_id: z35.string(),
|
|
@@ -722,132 +764,135 @@ var source_net = z35.object({
|
|
|
722
764
|
is_digital_signal: z35.boolean().optional(),
|
|
723
765
|
is_analog_signal: z35.boolean().optional(),
|
|
724
766
|
trace_width: z35.number().optional(),
|
|
725
|
-
subcircuit_id: z35.string().optional()
|
|
767
|
+
subcircuit_id: z35.string().optional(),
|
|
768
|
+
subcircuit_connectivity_map_key: z35.string().optional()
|
|
726
769
|
});
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
770
|
+
expectTypesMatch(true);
|
|
771
|
+
var source_pcb_ground_plane = z36.object({
|
|
772
|
+
type: z36.literal("source_pcb_ground_plane"),
|
|
773
|
+
source_pcb_ground_plane_id: z36.string(),
|
|
774
|
+
source_group_id: z36.string(),
|
|
775
|
+
source_net_id: z36.string(),
|
|
776
|
+
subcircuit_id: z36.string().optional()
|
|
777
|
+
}).describe("Defines a ground plane in the source domain");
|
|
778
|
+
expectTypesMatch(true);
|
|
779
|
+
var schematic_box = z37.object({
|
|
780
|
+
type: z37.literal("schematic_box"),
|
|
781
|
+
schematic_component_id: z37.string().optional(),
|
|
730
782
|
width: distance,
|
|
731
783
|
height: distance,
|
|
732
|
-
is_dashed:
|
|
784
|
+
is_dashed: z37.boolean().default(false),
|
|
733
785
|
x: distance,
|
|
734
|
-
y: distance
|
|
786
|
+
y: distance,
|
|
787
|
+
subcircuit_id: z37.string().optional()
|
|
735
788
|
}).describe("Draws a box on the schematic");
|
|
736
789
|
expectTypesMatch(true);
|
|
737
|
-
var schematic_path =
|
|
738
|
-
type:
|
|
739
|
-
schematic_component_id:
|
|
740
|
-
fill_color:
|
|
741
|
-
is_filled:
|
|
742
|
-
points:
|
|
790
|
+
var schematic_path = z38.object({
|
|
791
|
+
type: z38.literal("schematic_path"),
|
|
792
|
+
schematic_component_id: z38.string(),
|
|
793
|
+
fill_color: z38.enum(["red", "blue"]).optional(),
|
|
794
|
+
is_filled: z38.boolean().optional(),
|
|
795
|
+
points: z38.array(point),
|
|
796
|
+
subcircuit_id: z38.string().optional()
|
|
743
797
|
});
|
|
744
798
|
expectTypesMatch(true);
|
|
745
|
-
var schematic_pin_styles =
|
|
746
|
-
|
|
799
|
+
var schematic_pin_styles = z39.record(
|
|
800
|
+
z39.object({
|
|
747
801
|
left_margin: length.optional(),
|
|
748
802
|
right_margin: length.optional(),
|
|
749
803
|
top_margin: length.optional(),
|
|
750
804
|
bottom_margin: length.optional()
|
|
751
805
|
})
|
|
752
806
|
);
|
|
753
|
-
var schematic_component_port_arrangement_by_size =
|
|
754
|
-
left_size:
|
|
755
|
-
right_size:
|
|
756
|
-
top_size:
|
|
757
|
-
bottom_size:
|
|
807
|
+
var schematic_component_port_arrangement_by_size = z39.object({
|
|
808
|
+
left_size: z39.number(),
|
|
809
|
+
right_size: z39.number(),
|
|
810
|
+
top_size: z39.number().optional(),
|
|
811
|
+
bottom_size: z39.number().optional()
|
|
758
812
|
});
|
|
759
813
|
expectTypesMatch(true);
|
|
760
|
-
var schematic_component_port_arrangement_by_sides =
|
|
761
|
-
left_side:
|
|
762
|
-
pins:
|
|
814
|
+
var schematic_component_port_arrangement_by_sides = z39.object({
|
|
815
|
+
left_side: z39.object({
|
|
816
|
+
pins: z39.array(z39.number()),
|
|
763
817
|
// @ts-ignore
|
|
764
|
-
direction:
|
|
818
|
+
direction: z39.enum(["top-to-bottom", "bottom-to-top"]).optional()
|
|
765
819
|
}).optional(),
|
|
766
|
-
right_side:
|
|
767
|
-
pins:
|
|
820
|
+
right_side: z39.object({
|
|
821
|
+
pins: z39.array(z39.number()),
|
|
768
822
|
// @ts-ignore
|
|
769
|
-
direction:
|
|
823
|
+
direction: z39.enum(["top-to-bottom", "bottom-to-top"]).optional()
|
|
770
824
|
}).optional(),
|
|
771
|
-
top_side:
|
|
772
|
-
pins:
|
|
825
|
+
top_side: z39.object({
|
|
826
|
+
pins: z39.array(z39.number()),
|
|
773
827
|
// @ts-ignore
|
|
774
|
-
direction:
|
|
828
|
+
direction: z39.enum(["left-to-right", "right-to-left"]).optional()
|
|
775
829
|
}).optional(),
|
|
776
|
-
bottom_side:
|
|
777
|
-
pins:
|
|
830
|
+
bottom_side: z39.object({
|
|
831
|
+
pins: z39.array(z39.number()),
|
|
778
832
|
// @ts-ignore
|
|
779
|
-
direction:
|
|
833
|
+
direction: z39.enum(["left-to-right", "right-to-left"]).optional()
|
|
780
834
|
}).optional()
|
|
781
835
|
});
|
|
782
836
|
expectTypesMatch(true);
|
|
783
|
-
var port_arrangement =
|
|
837
|
+
var port_arrangement = z39.union([
|
|
784
838
|
schematic_component_port_arrangement_by_size,
|
|
785
839
|
schematic_component_port_arrangement_by_sides
|
|
786
840
|
]);
|
|
787
|
-
var schematic_component =
|
|
788
|
-
type:
|
|
841
|
+
var schematic_component = z39.object({
|
|
842
|
+
type: z39.literal("schematic_component"),
|
|
789
843
|
size,
|
|
790
844
|
center: point,
|
|
791
|
-
source_component_id:
|
|
792
|
-
schematic_component_id:
|
|
845
|
+
source_component_id: z39.string(),
|
|
846
|
+
schematic_component_id: z39.string(),
|
|
793
847
|
pin_spacing: length.optional(),
|
|
794
848
|
pin_styles: schematic_pin_styles.optional(),
|
|
795
849
|
box_width: length.optional(),
|
|
796
|
-
symbol_name:
|
|
850
|
+
symbol_name: z39.string().optional(),
|
|
797
851
|
port_arrangement: port_arrangement.optional(),
|
|
798
|
-
port_labels:
|
|
799
|
-
symbol_display_value:
|
|
800
|
-
subcircuit_id:
|
|
801
|
-
schematic_group_id:
|
|
852
|
+
port_labels: z39.record(z39.string()).optional(),
|
|
853
|
+
symbol_display_value: z39.string().optional(),
|
|
854
|
+
subcircuit_id: z39.string().optional(),
|
|
855
|
+
schematic_group_id: z39.string().optional()
|
|
802
856
|
});
|
|
803
857
|
expectTypesMatch(true);
|
|
804
|
-
var schematic_line =
|
|
805
|
-
type:
|
|
806
|
-
schematic_component_id:
|
|
858
|
+
var schematic_line = z40.object({
|
|
859
|
+
type: z40.literal("schematic_line"),
|
|
860
|
+
schematic_component_id: z40.string(),
|
|
807
861
|
x1: distance,
|
|
808
862
|
x2: distance,
|
|
809
863
|
y1: distance,
|
|
810
|
-
y2: distance
|
|
864
|
+
y2: distance,
|
|
865
|
+
subcircuit_id: z40.string().optional()
|
|
811
866
|
});
|
|
812
867
|
expectTypesMatch(true);
|
|
813
|
-
var schematic_trace =
|
|
814
|
-
type:
|
|
815
|
-
schematic_trace_id:
|
|
816
|
-
source_trace_id:
|
|
817
|
-
junctions:
|
|
818
|
-
|
|
819
|
-
x:
|
|
820
|
-
y:
|
|
868
|
+
var schematic_trace = z41.object({
|
|
869
|
+
type: z41.literal("schematic_trace"),
|
|
870
|
+
schematic_trace_id: z41.string(),
|
|
871
|
+
source_trace_id: z41.string(),
|
|
872
|
+
junctions: z41.array(
|
|
873
|
+
z41.object({
|
|
874
|
+
x: z41.number(),
|
|
875
|
+
y: z41.number()
|
|
821
876
|
})
|
|
822
877
|
),
|
|
823
|
-
edges:
|
|
824
|
-
|
|
825
|
-
from:
|
|
826
|
-
x:
|
|
827
|
-
y:
|
|
878
|
+
edges: z41.array(
|
|
879
|
+
z41.object({
|
|
880
|
+
from: z41.object({
|
|
881
|
+
x: z41.number(),
|
|
882
|
+
y: z41.number()
|
|
828
883
|
}),
|
|
829
|
-
to:
|
|
830
|
-
x:
|
|
831
|
-
y:
|
|
884
|
+
to: z41.object({
|
|
885
|
+
x: z41.number(),
|
|
886
|
+
y: z41.number()
|
|
832
887
|
}),
|
|
833
|
-
is_crossing:
|
|
834
|
-
from_schematic_port_id:
|
|
835
|
-
to_schematic_port_id:
|
|
888
|
+
is_crossing: z41.boolean().optional(),
|
|
889
|
+
from_schematic_port_id: z41.string().optional(),
|
|
890
|
+
to_schematic_port_id: z41.string().optional()
|
|
836
891
|
})
|
|
837
|
-
)
|
|
892
|
+
),
|
|
893
|
+
subcircuit_id: z41.string().optional()
|
|
838
894
|
});
|
|
839
895
|
expectTypesMatch(true);
|
|
840
|
-
var ninePointAnchor = z41.enum([
|
|
841
|
-
"top_left",
|
|
842
|
-
"top_center",
|
|
843
|
-
"top_right",
|
|
844
|
-
"center_left",
|
|
845
|
-
"center",
|
|
846
|
-
"center_right",
|
|
847
|
-
"bottom_left",
|
|
848
|
-
"bottom_center",
|
|
849
|
-
"bottom_right"
|
|
850
|
-
]);
|
|
851
896
|
var fivePointAnchor = z42.enum([
|
|
852
897
|
"center",
|
|
853
898
|
"left",
|
|
@@ -855,6 +900,7 @@ var fivePointAnchor = z42.enum([
|
|
|
855
900
|
"top",
|
|
856
901
|
"bottom"
|
|
857
902
|
]);
|
|
903
|
+
expectTypesMatch(true);
|
|
858
904
|
var schematic_text = z43.object({
|
|
859
905
|
type: z43.literal("schematic_text"),
|
|
860
906
|
schematic_component_id: z43.string().optional(),
|
|
@@ -867,7 +913,8 @@ var schematic_text = z43.object({
|
|
|
867
913
|
}),
|
|
868
914
|
rotation: z43.number().default(0),
|
|
869
915
|
anchor: z43.union([fivePointAnchor.describe("legacy"), ninePointAnchor]).default("center"),
|
|
870
|
-
color: z43.string().default("#000000")
|
|
916
|
+
color: z43.string().default("#000000"),
|
|
917
|
+
subcircuit_id: z43.string().optional()
|
|
871
918
|
});
|
|
872
919
|
expectTypesMatch(true);
|
|
873
920
|
var schematic_port = z44.object({
|
|
@@ -881,7 +928,9 @@ var schematic_port = z44.object({
|
|
|
881
928
|
side_of_component: z44.enum(["top", "bottom", "left", "right"]).optional(),
|
|
882
929
|
true_ccw_index: z44.number().optional(),
|
|
883
930
|
pin_number: z44.number().optional(),
|
|
884
|
-
display_pin_label: z44.string().optional()
|
|
931
|
+
display_pin_label: z44.string().optional(),
|
|
932
|
+
subcircuit_id: z44.string().optional(),
|
|
933
|
+
is_connected: z44.boolean().optional()
|
|
885
934
|
}).describe("Defines a port on a schematic component");
|
|
886
935
|
expectTypesMatch(true);
|
|
887
936
|
var schematic_net_label = z45.object({
|
|
@@ -894,75 +943,93 @@ var schematic_net_label = z45.object({
|
|
|
894
943
|
anchor_position: point.optional(),
|
|
895
944
|
anchor_side: z45.enum(["top", "bottom", "left", "right"]),
|
|
896
945
|
text: z45.string(),
|
|
897
|
-
symbol_name: z45.string().optional()
|
|
946
|
+
symbol_name: z45.string().optional(),
|
|
947
|
+
is_movable: z45.boolean().optional(),
|
|
948
|
+
subcircuit_id: z45.string().optional()
|
|
898
949
|
});
|
|
899
950
|
expectTypesMatch(true);
|
|
900
951
|
var schematic_error = z46.object({
|
|
901
952
|
type: z46.literal("schematic_error"),
|
|
902
953
|
schematic_error_id: z46.string(),
|
|
903
954
|
// eventually each error type should be broken out into a dir of files
|
|
904
|
-
error_type: z46.literal("schematic_port_not_found"),
|
|
905
|
-
message: z46.string()
|
|
955
|
+
error_type: z46.literal("schematic_port_not_found").default("schematic_port_not_found"),
|
|
956
|
+
message: z46.string(),
|
|
957
|
+
subcircuit_id: z46.string().optional()
|
|
906
958
|
}).describe("Defines a schematic error on the schematic");
|
|
907
959
|
expectTypesMatch(true);
|
|
908
|
-
var
|
|
909
|
-
type: z47.literal("
|
|
910
|
-
|
|
960
|
+
var schematic_layout_error = z47.object({
|
|
961
|
+
type: z47.literal("schematic_layout_error"),
|
|
962
|
+
schematic_layout_error_id: getZodPrefixedIdWithDefault(
|
|
963
|
+
"schematic_layout_error"
|
|
964
|
+
),
|
|
965
|
+
error_type: z47.literal("schematic_layout_error").default("schematic_layout_error"),
|
|
966
|
+
message: z47.string(),
|
|
967
|
+
source_group_id: z47.string(),
|
|
968
|
+
schematic_group_id: z47.string(),
|
|
969
|
+
subcircuit_id: z47.string().optional()
|
|
970
|
+
}).describe("Error emitted when schematic layout fails for a group");
|
|
971
|
+
expectTypesMatch(true);
|
|
972
|
+
var schematic_debug_object_base = z48.object({
|
|
973
|
+
type: z48.literal("schematic_debug_object"),
|
|
974
|
+
label: z48.string().optional(),
|
|
975
|
+
subcircuit_id: z48.string().optional()
|
|
911
976
|
});
|
|
912
977
|
var schematic_debug_rect = schematic_debug_object_base.extend({
|
|
913
|
-
shape:
|
|
978
|
+
shape: z48.literal("rect"),
|
|
914
979
|
center: point,
|
|
915
980
|
size
|
|
916
981
|
});
|
|
917
982
|
var schematic_debug_line = schematic_debug_object_base.extend({
|
|
918
|
-
shape:
|
|
983
|
+
shape: z48.literal("line"),
|
|
919
984
|
start: point,
|
|
920
985
|
end: point
|
|
921
986
|
});
|
|
922
987
|
var schematic_debug_point = schematic_debug_object_base.extend({
|
|
923
|
-
shape:
|
|
988
|
+
shape: z48.literal("point"),
|
|
924
989
|
center: point
|
|
925
990
|
});
|
|
926
|
-
var schematic_debug_object =
|
|
991
|
+
var schematic_debug_object = z48.discriminatedUnion("shape", [
|
|
927
992
|
schematic_debug_rect,
|
|
928
993
|
schematic_debug_line,
|
|
929
994
|
schematic_debug_point
|
|
930
995
|
]);
|
|
931
996
|
expectTypesMatch(true);
|
|
932
|
-
var schematic_voltage_probe =
|
|
933
|
-
type:
|
|
934
|
-
schematic_voltage_probe_id:
|
|
997
|
+
var schematic_voltage_probe = z49.object({
|
|
998
|
+
type: z49.literal("schematic_voltage_probe"),
|
|
999
|
+
schematic_voltage_probe_id: z49.string(),
|
|
935
1000
|
position: point,
|
|
936
|
-
schematic_trace_id:
|
|
937
|
-
voltage: voltage.optional()
|
|
1001
|
+
schematic_trace_id: z49.string(),
|
|
1002
|
+
voltage: voltage.optional(),
|
|
1003
|
+
subcircuit_id: z49.string().optional()
|
|
938
1004
|
}).describe("Defines a voltage probe measurement point on a schematic trace");
|
|
939
1005
|
expectTypesMatch(true);
|
|
940
|
-
var schematic_manual_edit_conflict_warning =
|
|
941
|
-
type:
|
|
1006
|
+
var schematic_manual_edit_conflict_warning = z50.object({
|
|
1007
|
+
type: z50.literal("schematic_manual_edit_conflict_warning"),
|
|
942
1008
|
schematic_manual_edit_conflict_warning_id: getZodPrefixedIdWithDefault(
|
|
943
1009
|
"schematic_manual_edit_conflict_warning"
|
|
944
1010
|
),
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1011
|
+
warning_type: z50.literal("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),
|
|
1012
|
+
message: z50.string(),
|
|
1013
|
+
schematic_component_id: z50.string(),
|
|
1014
|
+
schematic_group_id: z50.string().optional(),
|
|
1015
|
+
subcircuit_id: z50.string().optional(),
|
|
1016
|
+
source_component_id: z50.string()
|
|
950
1017
|
}).describe(
|
|
951
1018
|
"Warning emitted when a component has both manual placement and explicit schX/schY coordinates"
|
|
952
1019
|
);
|
|
953
1020
|
expectTypesMatch(true);
|
|
954
|
-
var schematic_group =
|
|
955
|
-
type:
|
|
1021
|
+
var schematic_group = z51.object({
|
|
1022
|
+
type: z51.literal("schematic_group"),
|
|
956
1023
|
schematic_group_id: getZodPrefixedIdWithDefault("schematic_group"),
|
|
957
|
-
source_group_id:
|
|
958
|
-
is_subcircuit:
|
|
959
|
-
subcircuit_id:
|
|
1024
|
+
source_group_id: z51.string(),
|
|
1025
|
+
is_subcircuit: z51.boolean().optional(),
|
|
1026
|
+
subcircuit_id: z51.string().optional(),
|
|
960
1027
|
width: length,
|
|
961
1028
|
height: length,
|
|
962
1029
|
center: point,
|
|
963
|
-
schematic_component_ids:
|
|
964
|
-
name:
|
|
965
|
-
description:
|
|
1030
|
+
schematic_component_ids: z51.array(z51.string()),
|
|
1031
|
+
name: z51.string().optional(),
|
|
1032
|
+
description: z51.string().optional()
|
|
966
1033
|
}).describe("Defines a group of components on the schematic");
|
|
967
1034
|
expectTypesMatch(true);
|
|
968
1035
|
var all_layers = [
|
|
@@ -975,9 +1042,9 @@ var all_layers = [
|
|
|
975
1042
|
"inner5",
|
|
976
1043
|
"inner6"
|
|
977
1044
|
];
|
|
978
|
-
var layer_string =
|
|
1045
|
+
var layer_string = z52.enum(all_layers);
|
|
979
1046
|
var layer_ref = layer_string.or(
|
|
980
|
-
|
|
1047
|
+
z52.object({
|
|
981
1048
|
name: layer_string
|
|
982
1049
|
})
|
|
983
1050
|
).transform((layer) => {
|
|
@@ -986,41 +1053,45 @@ var layer_ref = layer_string.or(
|
|
|
986
1053
|
}
|
|
987
1054
|
return layer.name;
|
|
988
1055
|
});
|
|
989
|
-
|
|
990
|
-
var
|
|
1056
|
+
expectTypesMatch(true);
|
|
1057
|
+
var visible_layer = z52.enum(["top", "bottom"]);
|
|
1058
|
+
var pcb_route_hint = z53.object({
|
|
991
1059
|
x: distance,
|
|
992
1060
|
y: distance,
|
|
993
|
-
via:
|
|
1061
|
+
via: z53.boolean().optional(),
|
|
994
1062
|
via_to_layer: layer_ref.optional()
|
|
995
1063
|
});
|
|
996
|
-
var pcb_route_hints =
|
|
997
|
-
|
|
1064
|
+
var pcb_route_hints = z53.array(pcb_route_hint);
|
|
1065
|
+
expectTypesMatch(true);
|
|
1066
|
+
expectTypesMatch(true);
|
|
1067
|
+
var route_hint_point = z54.object({
|
|
998
1068
|
x: distance,
|
|
999
1069
|
y: distance,
|
|
1000
|
-
via:
|
|
1070
|
+
via: z54.boolean().optional(),
|
|
1001
1071
|
to_layer: layer_ref.optional(),
|
|
1002
1072
|
trace_width: distance.optional()
|
|
1003
1073
|
});
|
|
1004
|
-
|
|
1005
|
-
|
|
1074
|
+
expectTypesMatch(true);
|
|
1075
|
+
var pcb_component = z55.object({
|
|
1076
|
+
type: z55.literal("pcb_component"),
|
|
1006
1077
|
pcb_component_id: getZodPrefixedIdWithDefault("pcb_component"),
|
|
1007
|
-
source_component_id:
|
|
1078
|
+
source_component_id: z55.string(),
|
|
1008
1079
|
center: point,
|
|
1009
1080
|
layer: layer_ref,
|
|
1010
1081
|
rotation,
|
|
1011
1082
|
width: length,
|
|
1012
1083
|
height: length,
|
|
1013
|
-
subcircuit_id:
|
|
1014
|
-
pcb_group_id:
|
|
1084
|
+
subcircuit_id: z55.string().optional(),
|
|
1085
|
+
pcb_group_id: z55.string().optional()
|
|
1015
1086
|
}).describe("Defines a component on the PCB");
|
|
1016
1087
|
expectTypesMatch(true);
|
|
1017
|
-
var pcb_hole_circle_or_square =
|
|
1018
|
-
type:
|
|
1088
|
+
var pcb_hole_circle_or_square = z56.object({
|
|
1089
|
+
type: z56.literal("pcb_hole"),
|
|
1019
1090
|
pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
|
|
1020
|
-
pcb_group_id:
|
|
1021
|
-
subcircuit_id:
|
|
1022
|
-
hole_shape:
|
|
1023
|
-
hole_diameter:
|
|
1091
|
+
pcb_group_id: z56.string().optional(),
|
|
1092
|
+
subcircuit_id: z56.string().optional(),
|
|
1093
|
+
hole_shape: z56.enum(["circle", "square"]),
|
|
1094
|
+
hole_diameter: z56.number(),
|
|
1024
1095
|
x: distance,
|
|
1025
1096
|
y: distance
|
|
1026
1097
|
});
|
|
@@ -1028,14 +1099,14 @@ var pcb_hole_circle_or_square_shape = pcb_hole_circle_or_square.describe(
|
|
|
1028
1099
|
"Defines a circular or square hole on the PCB"
|
|
1029
1100
|
);
|
|
1030
1101
|
expectTypesMatch(true);
|
|
1031
|
-
var pcb_hole_oval =
|
|
1032
|
-
type:
|
|
1102
|
+
var pcb_hole_oval = z56.object({
|
|
1103
|
+
type: z56.literal("pcb_hole"),
|
|
1033
1104
|
pcb_hole_id: getZodPrefixedIdWithDefault("pcb_hole"),
|
|
1034
|
-
pcb_group_id:
|
|
1035
|
-
subcircuit_id:
|
|
1036
|
-
hole_shape:
|
|
1037
|
-
hole_width:
|
|
1038
|
-
hole_height:
|
|
1105
|
+
pcb_group_id: z56.string().optional(),
|
|
1106
|
+
subcircuit_id: z56.string().optional(),
|
|
1107
|
+
hole_shape: z56.literal("oval"),
|
|
1108
|
+
hole_width: z56.number(),
|
|
1109
|
+
hole_height: z56.number(),
|
|
1039
1110
|
x: distance,
|
|
1040
1111
|
y: distance
|
|
1041
1112
|
});
|
|
@@ -1044,76 +1115,76 @@ var pcb_hole_oval_shape = pcb_hole_oval.describe(
|
|
|
1044
1115
|
);
|
|
1045
1116
|
expectTypesMatch(true);
|
|
1046
1117
|
var pcb_hole = pcb_hole_circle_or_square.or(pcb_hole_oval);
|
|
1047
|
-
var pcb_plated_hole_circle =
|
|
1048
|
-
type:
|
|
1049
|
-
shape:
|
|
1050
|
-
pcb_group_id:
|
|
1051
|
-
subcircuit_id:
|
|
1052
|
-
outer_diameter:
|
|
1053
|
-
hole_diameter:
|
|
1118
|
+
var pcb_plated_hole_circle = z57.object({
|
|
1119
|
+
type: z57.literal("pcb_plated_hole"),
|
|
1120
|
+
shape: z57.literal("circle"),
|
|
1121
|
+
pcb_group_id: z57.string().optional(),
|
|
1122
|
+
subcircuit_id: z57.string().optional(),
|
|
1123
|
+
outer_diameter: z57.number(),
|
|
1124
|
+
hole_diameter: z57.number(),
|
|
1054
1125
|
x: distance,
|
|
1055
1126
|
y: distance,
|
|
1056
|
-
layers:
|
|
1057
|
-
port_hints:
|
|
1058
|
-
pcb_component_id:
|
|
1059
|
-
pcb_port_id:
|
|
1127
|
+
layers: z57.array(layer_ref),
|
|
1128
|
+
port_hints: z57.array(z57.string()).optional(),
|
|
1129
|
+
pcb_component_id: z57.string().optional(),
|
|
1130
|
+
pcb_port_id: z57.string().optional(),
|
|
1060
1131
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
1061
1132
|
});
|
|
1062
|
-
var pcb_plated_hole_oval =
|
|
1063
|
-
type:
|
|
1064
|
-
shape:
|
|
1065
|
-
pcb_group_id:
|
|
1066
|
-
subcircuit_id:
|
|
1067
|
-
outer_width:
|
|
1068
|
-
outer_height:
|
|
1069
|
-
hole_width:
|
|
1070
|
-
hole_height:
|
|
1133
|
+
var pcb_plated_hole_oval = z57.object({
|
|
1134
|
+
type: z57.literal("pcb_plated_hole"),
|
|
1135
|
+
shape: z57.enum(["oval", "pill"]),
|
|
1136
|
+
pcb_group_id: z57.string().optional(),
|
|
1137
|
+
subcircuit_id: z57.string().optional(),
|
|
1138
|
+
outer_width: z57.number(),
|
|
1139
|
+
outer_height: z57.number(),
|
|
1140
|
+
hole_width: z57.number(),
|
|
1141
|
+
hole_height: z57.number(),
|
|
1071
1142
|
x: distance,
|
|
1072
1143
|
y: distance,
|
|
1073
|
-
layers:
|
|
1074
|
-
port_hints:
|
|
1075
|
-
pcb_component_id:
|
|
1076
|
-
pcb_port_id:
|
|
1144
|
+
layers: z57.array(layer_ref),
|
|
1145
|
+
port_hints: z57.array(z57.string()).optional(),
|
|
1146
|
+
pcb_component_id: z57.string().optional(),
|
|
1147
|
+
pcb_port_id: z57.string().optional(),
|
|
1077
1148
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
1078
1149
|
});
|
|
1079
|
-
var pcb_circular_hole_with_rect_pad =
|
|
1080
|
-
type:
|
|
1081
|
-
shape:
|
|
1082
|
-
pcb_group_id:
|
|
1083
|
-
subcircuit_id:
|
|
1084
|
-
hole_shape:
|
|
1085
|
-
pad_shape:
|
|
1086
|
-
hole_diameter:
|
|
1087
|
-
rect_pad_width:
|
|
1088
|
-
rect_pad_height:
|
|
1150
|
+
var pcb_circular_hole_with_rect_pad = z57.object({
|
|
1151
|
+
type: z57.literal("pcb_plated_hole"),
|
|
1152
|
+
shape: z57.literal("circular_hole_with_rect_pad"),
|
|
1153
|
+
pcb_group_id: z57.string().optional(),
|
|
1154
|
+
subcircuit_id: z57.string().optional(),
|
|
1155
|
+
hole_shape: z57.literal("circle"),
|
|
1156
|
+
pad_shape: z57.literal("rect"),
|
|
1157
|
+
hole_diameter: z57.number(),
|
|
1158
|
+
rect_pad_width: z57.number(),
|
|
1159
|
+
rect_pad_height: z57.number(),
|
|
1089
1160
|
x: distance,
|
|
1090
1161
|
y: distance,
|
|
1091
|
-
layers:
|
|
1092
|
-
port_hints:
|
|
1093
|
-
pcb_component_id:
|
|
1094
|
-
pcb_port_id:
|
|
1162
|
+
layers: z57.array(layer_ref),
|
|
1163
|
+
port_hints: z57.array(z57.string()).optional(),
|
|
1164
|
+
pcb_component_id: z57.string().optional(),
|
|
1165
|
+
pcb_port_id: z57.string().optional(),
|
|
1095
1166
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
1096
1167
|
});
|
|
1097
|
-
var pcb_pill_hole_with_rect_pad =
|
|
1098
|
-
type:
|
|
1099
|
-
shape:
|
|
1100
|
-
pcb_group_id:
|
|
1101
|
-
subcircuit_id:
|
|
1102
|
-
hole_shape:
|
|
1103
|
-
pad_shape:
|
|
1104
|
-
hole_width:
|
|
1105
|
-
hole_height:
|
|
1106
|
-
rect_pad_width:
|
|
1107
|
-
rect_pad_height:
|
|
1168
|
+
var pcb_pill_hole_with_rect_pad = z57.object({
|
|
1169
|
+
type: z57.literal("pcb_plated_hole"),
|
|
1170
|
+
shape: z57.literal("pill_hole_with_rect_pad"),
|
|
1171
|
+
pcb_group_id: z57.string().optional(),
|
|
1172
|
+
subcircuit_id: z57.string().optional(),
|
|
1173
|
+
hole_shape: z57.literal("pill"),
|
|
1174
|
+
pad_shape: z57.literal("rect"),
|
|
1175
|
+
hole_width: z57.number(),
|
|
1176
|
+
hole_height: z57.number(),
|
|
1177
|
+
rect_pad_width: z57.number(),
|
|
1178
|
+
rect_pad_height: z57.number(),
|
|
1108
1179
|
x: distance,
|
|
1109
1180
|
y: distance,
|
|
1110
|
-
layers:
|
|
1111
|
-
port_hints:
|
|
1112
|
-
pcb_component_id:
|
|
1113
|
-
pcb_port_id:
|
|
1181
|
+
layers: z57.array(layer_ref),
|
|
1182
|
+
port_hints: z57.array(z57.string()).optional(),
|
|
1183
|
+
pcb_component_id: z57.string().optional(),
|
|
1184
|
+
pcb_port_id: z57.string().optional(),
|
|
1114
1185
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
1115
1186
|
});
|
|
1116
|
-
var pcb_plated_hole =
|
|
1187
|
+
var pcb_plated_hole = z57.union([
|
|
1117
1188
|
pcb_plated_hole_circle,
|
|
1118
1189
|
pcb_plated_hole_oval,
|
|
1119
1190
|
pcb_circular_hole_with_rect_pad,
|
|
@@ -1125,161 +1196,175 @@ expectTypesMatch(
|
|
|
1125
1196
|
expectTypesMatch(true);
|
|
1126
1197
|
expectTypesMatch(true);
|
|
1127
1198
|
expectTypesMatch(true);
|
|
1128
|
-
var pcb_port =
|
|
1129
|
-
type:
|
|
1199
|
+
var pcb_port = z58.object({
|
|
1200
|
+
type: z58.literal("pcb_port"),
|
|
1130
1201
|
pcb_port_id: getZodPrefixedIdWithDefault("pcb_port"),
|
|
1131
|
-
pcb_group_id:
|
|
1132
|
-
subcircuit_id:
|
|
1133
|
-
source_port_id:
|
|
1134
|
-
pcb_component_id:
|
|
1202
|
+
pcb_group_id: z58.string().optional(),
|
|
1203
|
+
subcircuit_id: z58.string().optional(),
|
|
1204
|
+
source_port_id: z58.string(),
|
|
1205
|
+
pcb_component_id: z58.string(),
|
|
1135
1206
|
x: distance,
|
|
1136
1207
|
y: distance,
|
|
1137
|
-
layers:
|
|
1208
|
+
layers: z58.array(layer_ref)
|
|
1138
1209
|
}).describe("Defines a port on the PCB");
|
|
1139
1210
|
expectTypesMatch(true);
|
|
1140
|
-
var pcb_smtpad_circle =
|
|
1141
|
-
type:
|
|
1142
|
-
shape:
|
|
1211
|
+
var pcb_smtpad_circle = z59.object({
|
|
1212
|
+
type: z59.literal("pcb_smtpad"),
|
|
1213
|
+
shape: z59.literal("circle"),
|
|
1143
1214
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1144
|
-
pcb_group_id:
|
|
1145
|
-
subcircuit_id:
|
|
1215
|
+
pcb_group_id: z59.string().optional(),
|
|
1216
|
+
subcircuit_id: z59.string().optional(),
|
|
1146
1217
|
x: distance,
|
|
1147
1218
|
y: distance,
|
|
1148
|
-
radius:
|
|
1219
|
+
radius: z59.number(),
|
|
1149
1220
|
layer: layer_ref,
|
|
1150
|
-
port_hints:
|
|
1151
|
-
pcb_component_id:
|
|
1152
|
-
pcb_port_id:
|
|
1221
|
+
port_hints: z59.array(z59.string()).optional(),
|
|
1222
|
+
pcb_component_id: z59.string().optional(),
|
|
1223
|
+
pcb_port_id: z59.string().optional()
|
|
1153
1224
|
});
|
|
1154
|
-
var pcb_smtpad_rect =
|
|
1155
|
-
type:
|
|
1156
|
-
shape:
|
|
1225
|
+
var pcb_smtpad_rect = z59.object({
|
|
1226
|
+
type: z59.literal("pcb_smtpad"),
|
|
1227
|
+
shape: z59.literal("rect"),
|
|
1157
1228
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1158
|
-
pcb_group_id:
|
|
1159
|
-
subcircuit_id:
|
|
1229
|
+
pcb_group_id: z59.string().optional(),
|
|
1230
|
+
subcircuit_id: z59.string().optional(),
|
|
1160
1231
|
x: distance,
|
|
1161
1232
|
y: distance,
|
|
1162
|
-
width:
|
|
1163
|
-
height:
|
|
1233
|
+
width: z59.number(),
|
|
1234
|
+
height: z59.number(),
|
|
1164
1235
|
layer: layer_ref,
|
|
1165
|
-
port_hints:
|
|
1166
|
-
pcb_component_id:
|
|
1167
|
-
pcb_port_id:
|
|
1236
|
+
port_hints: z59.array(z59.string()).optional(),
|
|
1237
|
+
pcb_component_id: z59.string().optional(),
|
|
1238
|
+
pcb_port_id: z59.string().optional()
|
|
1168
1239
|
});
|
|
1169
|
-
var pcb_smtpad_rotated_rect =
|
|
1170
|
-
type:
|
|
1171
|
-
shape:
|
|
1240
|
+
var pcb_smtpad_rotated_rect = z59.object({
|
|
1241
|
+
type: z59.literal("pcb_smtpad"),
|
|
1242
|
+
shape: z59.literal("rotated_rect"),
|
|
1172
1243
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1173
|
-
pcb_group_id:
|
|
1174
|
-
subcircuit_id:
|
|
1244
|
+
pcb_group_id: z59.string().optional(),
|
|
1245
|
+
subcircuit_id: z59.string().optional(),
|
|
1175
1246
|
x: distance,
|
|
1176
1247
|
y: distance,
|
|
1177
|
-
width:
|
|
1178
|
-
height:
|
|
1248
|
+
width: z59.number(),
|
|
1249
|
+
height: z59.number(),
|
|
1179
1250
|
ccw_rotation: rotation,
|
|
1180
1251
|
layer: layer_ref,
|
|
1181
|
-
port_hints:
|
|
1182
|
-
pcb_component_id:
|
|
1183
|
-
pcb_port_id:
|
|
1252
|
+
port_hints: z59.array(z59.string()).optional(),
|
|
1253
|
+
pcb_component_id: z59.string().optional(),
|
|
1254
|
+
pcb_port_id: z59.string().optional()
|
|
1184
1255
|
});
|
|
1185
|
-
var pcb_smtpad_pill =
|
|
1186
|
-
type:
|
|
1187
|
-
shape:
|
|
1256
|
+
var pcb_smtpad_pill = z59.object({
|
|
1257
|
+
type: z59.literal("pcb_smtpad"),
|
|
1258
|
+
shape: z59.literal("pill"),
|
|
1188
1259
|
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1189
|
-
pcb_group_id:
|
|
1190
|
-
subcircuit_id:
|
|
1260
|
+
pcb_group_id: z59.string().optional(),
|
|
1261
|
+
subcircuit_id: z59.string().optional(),
|
|
1191
1262
|
x: distance,
|
|
1192
1263
|
y: distance,
|
|
1193
|
-
width:
|
|
1194
|
-
height:
|
|
1195
|
-
radius:
|
|
1264
|
+
width: z59.number(),
|
|
1265
|
+
height: z59.number(),
|
|
1266
|
+
radius: z59.number(),
|
|
1196
1267
|
layer: layer_ref,
|
|
1197
|
-
port_hints:
|
|
1198
|
-
pcb_component_id:
|
|
1199
|
-
pcb_port_id:
|
|
1268
|
+
port_hints: z59.array(z59.string()).optional(),
|
|
1269
|
+
pcb_component_id: z59.string().optional(),
|
|
1270
|
+
pcb_port_id: z59.string().optional()
|
|
1200
1271
|
});
|
|
1201
|
-
var
|
|
1272
|
+
var pcb_smtpad_polygon = z59.object({
|
|
1273
|
+
type: z59.literal("pcb_smtpad"),
|
|
1274
|
+
shape: z59.literal("polygon"),
|
|
1275
|
+
pcb_smtpad_id: getZodPrefixedIdWithDefault("pcb_smtpad"),
|
|
1276
|
+
pcb_group_id: z59.string().optional(),
|
|
1277
|
+
subcircuit_id: z59.string().optional(),
|
|
1278
|
+
points: z59.array(point),
|
|
1279
|
+
layer: layer_ref,
|
|
1280
|
+
port_hints: z59.array(z59.string()).optional(),
|
|
1281
|
+
pcb_component_id: z59.string().optional(),
|
|
1282
|
+
pcb_port_id: z59.string().optional()
|
|
1283
|
+
});
|
|
1284
|
+
var pcb_smtpad = z59.discriminatedUnion("shape", [
|
|
1202
1285
|
pcb_smtpad_circle,
|
|
1203
1286
|
pcb_smtpad_rect,
|
|
1204
1287
|
pcb_smtpad_rotated_rect,
|
|
1205
|
-
pcb_smtpad_pill
|
|
1288
|
+
pcb_smtpad_pill,
|
|
1289
|
+
pcb_smtpad_polygon
|
|
1206
1290
|
]).describe("Defines an SMT pad on the PCB");
|
|
1207
1291
|
expectTypesMatch(true);
|
|
1208
1292
|
expectTypesMatch(true);
|
|
1209
1293
|
expectTypesMatch(true);
|
|
1210
1294
|
expectTypesMatch(true);
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1295
|
+
expectTypesMatch(true);
|
|
1296
|
+
var pcb_solder_paste_circle = z60.object({
|
|
1297
|
+
type: z60.literal("pcb_solder_paste"),
|
|
1298
|
+
shape: z60.literal("circle"),
|
|
1214
1299
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1215
|
-
pcb_group_id:
|
|
1216
|
-
subcircuit_id:
|
|
1300
|
+
pcb_group_id: z60.string().optional(),
|
|
1301
|
+
subcircuit_id: z60.string().optional(),
|
|
1217
1302
|
x: distance,
|
|
1218
1303
|
y: distance,
|
|
1219
|
-
radius:
|
|
1304
|
+
radius: z60.number(),
|
|
1220
1305
|
layer: layer_ref,
|
|
1221
|
-
pcb_component_id:
|
|
1222
|
-
pcb_smtpad_id:
|
|
1306
|
+
pcb_component_id: z60.string().optional(),
|
|
1307
|
+
pcb_smtpad_id: z60.string().optional()
|
|
1223
1308
|
});
|
|
1224
|
-
var pcb_solder_paste_rect =
|
|
1225
|
-
type:
|
|
1226
|
-
shape:
|
|
1309
|
+
var pcb_solder_paste_rect = z60.object({
|
|
1310
|
+
type: z60.literal("pcb_solder_paste"),
|
|
1311
|
+
shape: z60.literal("rect"),
|
|
1227
1312
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1228
|
-
pcb_group_id:
|
|
1229
|
-
subcircuit_id:
|
|
1313
|
+
pcb_group_id: z60.string().optional(),
|
|
1314
|
+
subcircuit_id: z60.string().optional(),
|
|
1230
1315
|
x: distance,
|
|
1231
1316
|
y: distance,
|
|
1232
|
-
width:
|
|
1233
|
-
height:
|
|
1317
|
+
width: z60.number(),
|
|
1318
|
+
height: z60.number(),
|
|
1234
1319
|
layer: layer_ref,
|
|
1235
|
-
pcb_component_id:
|
|
1236
|
-
pcb_smtpad_id:
|
|
1320
|
+
pcb_component_id: z60.string().optional(),
|
|
1321
|
+
pcb_smtpad_id: z60.string().optional()
|
|
1237
1322
|
});
|
|
1238
|
-
var pcb_solder_paste_pill =
|
|
1239
|
-
type:
|
|
1240
|
-
shape:
|
|
1323
|
+
var pcb_solder_paste_pill = z60.object({
|
|
1324
|
+
type: z60.literal("pcb_solder_paste"),
|
|
1325
|
+
shape: z60.literal("pill"),
|
|
1241
1326
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1242
|
-
pcb_group_id:
|
|
1243
|
-
subcircuit_id:
|
|
1327
|
+
pcb_group_id: z60.string().optional(),
|
|
1328
|
+
subcircuit_id: z60.string().optional(),
|
|
1244
1329
|
x: distance,
|
|
1245
1330
|
y: distance,
|
|
1246
|
-
width:
|
|
1247
|
-
height:
|
|
1248
|
-
radius:
|
|
1331
|
+
width: z60.number(),
|
|
1332
|
+
height: z60.number(),
|
|
1333
|
+
radius: z60.number(),
|
|
1249
1334
|
layer: layer_ref,
|
|
1250
|
-
pcb_component_id:
|
|
1251
|
-
pcb_smtpad_id:
|
|
1335
|
+
pcb_component_id: z60.string().optional(),
|
|
1336
|
+
pcb_smtpad_id: z60.string().optional()
|
|
1252
1337
|
});
|
|
1253
|
-
var pcb_solder_paste_rotated_rect =
|
|
1254
|
-
type:
|
|
1255
|
-
shape:
|
|
1338
|
+
var pcb_solder_paste_rotated_rect = z60.object({
|
|
1339
|
+
type: z60.literal("pcb_solder_paste"),
|
|
1340
|
+
shape: z60.literal("rotated_rect"),
|
|
1256
1341
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1257
|
-
pcb_group_id:
|
|
1258
|
-
subcircuit_id:
|
|
1342
|
+
pcb_group_id: z60.string().optional(),
|
|
1343
|
+
subcircuit_id: z60.string().optional(),
|
|
1259
1344
|
x: distance,
|
|
1260
1345
|
y: distance,
|
|
1261
|
-
width:
|
|
1262
|
-
height:
|
|
1346
|
+
width: z60.number(),
|
|
1347
|
+
height: z60.number(),
|
|
1263
1348
|
ccw_rotation: distance,
|
|
1264
1349
|
layer: layer_ref,
|
|
1265
|
-
pcb_component_id:
|
|
1266
|
-
pcb_smtpad_id:
|
|
1350
|
+
pcb_component_id: z60.string().optional(),
|
|
1351
|
+
pcb_smtpad_id: z60.string().optional()
|
|
1267
1352
|
});
|
|
1268
|
-
var pcb_solder_paste_oval =
|
|
1269
|
-
type:
|
|
1270
|
-
shape:
|
|
1353
|
+
var pcb_solder_paste_oval = z60.object({
|
|
1354
|
+
type: z60.literal("pcb_solder_paste"),
|
|
1355
|
+
shape: z60.literal("oval"),
|
|
1271
1356
|
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
1272
|
-
pcb_group_id:
|
|
1273
|
-
subcircuit_id:
|
|
1357
|
+
pcb_group_id: z60.string().optional(),
|
|
1358
|
+
subcircuit_id: z60.string().optional(),
|
|
1274
1359
|
x: distance,
|
|
1275
1360
|
y: distance,
|
|
1276
|
-
width:
|
|
1277
|
-
height:
|
|
1361
|
+
width: z60.number(),
|
|
1362
|
+
height: z60.number(),
|
|
1278
1363
|
layer: layer_ref,
|
|
1279
|
-
pcb_component_id:
|
|
1280
|
-
pcb_smtpad_id:
|
|
1364
|
+
pcb_component_id: z60.string().optional(),
|
|
1365
|
+
pcb_smtpad_id: z60.string().optional()
|
|
1281
1366
|
});
|
|
1282
|
-
var pcb_solder_paste =
|
|
1367
|
+
var pcb_solder_paste = z60.union([
|
|
1283
1368
|
pcb_solder_paste_circle,
|
|
1284
1369
|
pcb_solder_paste_rect,
|
|
1285
1370
|
pcb_solder_paste_pill,
|
|
@@ -1293,82 +1378,85 @@ expectTypesMatch(
|
|
|
1293
1378
|
true
|
|
1294
1379
|
);
|
|
1295
1380
|
expectTypesMatch(true);
|
|
1296
|
-
var pcb_text =
|
|
1297
|
-
type:
|
|
1381
|
+
var pcb_text = z61.object({
|
|
1382
|
+
type: z61.literal("pcb_text"),
|
|
1298
1383
|
pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
|
|
1299
|
-
pcb_group_id:
|
|
1300
|
-
subcircuit_id:
|
|
1301
|
-
text:
|
|
1384
|
+
pcb_group_id: z61.string().optional(),
|
|
1385
|
+
subcircuit_id: z61.string().optional(),
|
|
1386
|
+
text: z61.string(),
|
|
1302
1387
|
center: point,
|
|
1303
1388
|
layer: layer_ref,
|
|
1304
1389
|
width: length,
|
|
1305
1390
|
height: length,
|
|
1306
|
-
lines:
|
|
1391
|
+
lines: z61.number(),
|
|
1307
1392
|
// @ts-ignore
|
|
1308
|
-
align:
|
|
1393
|
+
align: z61.enum(["bottom-left"])
|
|
1309
1394
|
}).describe("Defines text on the PCB");
|
|
1310
1395
|
expectTypesMatch(true);
|
|
1311
|
-
var pcb_trace_route_point_wire =
|
|
1312
|
-
route_type:
|
|
1396
|
+
var pcb_trace_route_point_wire = z62.object({
|
|
1397
|
+
route_type: z62.literal("wire"),
|
|
1313
1398
|
x: distance,
|
|
1314
1399
|
y: distance,
|
|
1315
1400
|
width: distance,
|
|
1316
|
-
start_pcb_port_id:
|
|
1317
|
-
end_pcb_port_id:
|
|
1401
|
+
start_pcb_port_id: z62.string().optional(),
|
|
1402
|
+
end_pcb_port_id: z62.string().optional(),
|
|
1318
1403
|
layer: layer_ref
|
|
1319
1404
|
});
|
|
1320
|
-
var pcb_trace_route_point_via =
|
|
1321
|
-
route_type:
|
|
1405
|
+
var pcb_trace_route_point_via = z62.object({
|
|
1406
|
+
route_type: z62.literal("via"),
|
|
1322
1407
|
x: distance,
|
|
1323
1408
|
y: distance,
|
|
1324
1409
|
hole_diameter: distance.optional(),
|
|
1325
1410
|
outer_diameter: distance.optional(),
|
|
1326
|
-
from_layer:
|
|
1327
|
-
to_layer:
|
|
1411
|
+
from_layer: z62.string(),
|
|
1412
|
+
to_layer: z62.string()
|
|
1328
1413
|
});
|
|
1329
|
-
var pcb_trace_route_point =
|
|
1414
|
+
var pcb_trace_route_point = z62.union([
|
|
1330
1415
|
pcb_trace_route_point_wire,
|
|
1331
1416
|
pcb_trace_route_point_via
|
|
1332
1417
|
]);
|
|
1333
|
-
var pcb_trace =
|
|
1334
|
-
type:
|
|
1335
|
-
source_trace_id:
|
|
1336
|
-
pcb_component_id:
|
|
1418
|
+
var pcb_trace = z62.object({
|
|
1419
|
+
type: z62.literal("pcb_trace"),
|
|
1420
|
+
source_trace_id: z62.string().optional(),
|
|
1421
|
+
pcb_component_id: z62.string().optional(),
|
|
1337
1422
|
pcb_trace_id: getZodPrefixedIdWithDefault("pcb_trace"),
|
|
1338
|
-
pcb_group_id:
|
|
1339
|
-
subcircuit_id:
|
|
1340
|
-
route_thickness_mode:
|
|
1341
|
-
route_order_index:
|
|
1342
|
-
should_round_corners:
|
|
1343
|
-
trace_length:
|
|
1344
|
-
route:
|
|
1423
|
+
pcb_group_id: z62.string().optional(),
|
|
1424
|
+
subcircuit_id: z62.string().optional(),
|
|
1425
|
+
route_thickness_mode: z62.enum(["constant", "interpolated"]).default("constant").optional(),
|
|
1426
|
+
route_order_index: z62.number().optional(),
|
|
1427
|
+
should_round_corners: z62.boolean().optional(),
|
|
1428
|
+
trace_length: z62.number().optional(),
|
|
1429
|
+
route: z62.array(pcb_trace_route_point)
|
|
1345
1430
|
}).describe("Defines a trace on the PCB");
|
|
1346
1431
|
expectTypesMatch(true);
|
|
1347
1432
|
expectTypesMatch(true);
|
|
1348
|
-
var pcb_trace_error =
|
|
1349
|
-
type:
|
|
1433
|
+
var pcb_trace_error = z63.object({
|
|
1434
|
+
type: z63.literal("pcb_trace_error"),
|
|
1350
1435
|
pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
|
|
1351
|
-
error_type:
|
|
1352
|
-
message:
|
|
1436
|
+
error_type: z63.literal("pcb_trace_error").default("pcb_trace_error"),
|
|
1437
|
+
message: z63.string(),
|
|
1353
1438
|
center: point.optional(),
|
|
1354
|
-
pcb_trace_id:
|
|
1355
|
-
source_trace_id:
|
|
1356
|
-
pcb_component_ids:
|
|
1357
|
-
pcb_port_ids:
|
|
1439
|
+
pcb_trace_id: z63.string(),
|
|
1440
|
+
source_trace_id: z63.string(),
|
|
1441
|
+
pcb_component_ids: z63.array(z63.string()),
|
|
1442
|
+
pcb_port_ids: z63.array(z63.string()),
|
|
1443
|
+
subcircuit_id: z63.string().optional()
|
|
1358
1444
|
}).describe("Defines a trace error on the PCB");
|
|
1359
1445
|
expectTypesMatch(true);
|
|
1360
|
-
var pcb_port_not_matched_error =
|
|
1361
|
-
type:
|
|
1446
|
+
var pcb_port_not_matched_error = z64.object({
|
|
1447
|
+
type: z64.literal("pcb_port_not_matched_error"),
|
|
1362
1448
|
pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
|
|
1363
|
-
|
|
1364
|
-
|
|
1449
|
+
error_type: z64.literal("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),
|
|
1450
|
+
message: z64.string(),
|
|
1451
|
+
pcb_component_ids: z64.array(z64.string()),
|
|
1452
|
+
subcircuit_id: z64.string().optional()
|
|
1365
1453
|
}).describe("Defines a trace error on the PCB where a port is not matched");
|
|
1366
1454
|
expectTypesMatch(true);
|
|
1367
|
-
var pcb_via =
|
|
1368
|
-
type:
|
|
1455
|
+
var pcb_via = z65.object({
|
|
1456
|
+
type: z65.literal("pcb_via"),
|
|
1369
1457
|
pcb_via_id: getZodPrefixedIdWithDefault("pcb_via"),
|
|
1370
|
-
pcb_group_id:
|
|
1371
|
-
subcircuit_id:
|
|
1458
|
+
pcb_group_id: z65.string().optional(),
|
|
1459
|
+
subcircuit_id: z65.string().optional(),
|
|
1372
1460
|
x: distance,
|
|
1373
1461
|
y: distance,
|
|
1374
1462
|
outer_diameter: distance.default("0.6mm"),
|
|
@@ -1377,44 +1465,47 @@ var pcb_via = z64.object({
|
|
|
1377
1465
|
from_layer: layer_ref.optional(),
|
|
1378
1466
|
/** @deprecated */
|
|
1379
1467
|
to_layer: layer_ref.optional(),
|
|
1380
|
-
layers:
|
|
1381
|
-
pcb_trace_id:
|
|
1468
|
+
layers: z65.array(layer_ref),
|
|
1469
|
+
pcb_trace_id: z65.string().optional()
|
|
1382
1470
|
}).describe("Defines a via on the PCB");
|
|
1383
1471
|
expectTypesMatch(true);
|
|
1384
|
-
var pcb_board =
|
|
1385
|
-
type:
|
|
1472
|
+
var pcb_board = z66.object({
|
|
1473
|
+
type: z66.literal("pcb_board"),
|
|
1386
1474
|
pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
|
|
1387
|
-
is_subcircuit:
|
|
1388
|
-
subcircuit_id:
|
|
1475
|
+
is_subcircuit: z66.boolean().optional(),
|
|
1476
|
+
subcircuit_id: z66.string().optional(),
|
|
1389
1477
|
width: length,
|
|
1390
1478
|
height: length,
|
|
1391
1479
|
center: point,
|
|
1392
1480
|
thickness: length.optional().default(1.4),
|
|
1393
|
-
num_layers:
|
|
1394
|
-
outline:
|
|
1395
|
-
material:
|
|
1481
|
+
num_layers: z66.number().optional().default(4),
|
|
1482
|
+
outline: z66.array(point).optional(),
|
|
1483
|
+
material: z66.enum(["fr4", "fr1"]).default("fr4")
|
|
1396
1484
|
}).describe("Defines the board outline of the PCB");
|
|
1397
1485
|
expectTypesMatch(true);
|
|
1398
|
-
var pcb_placement_error =
|
|
1399
|
-
type:
|
|
1486
|
+
var pcb_placement_error = z67.object({
|
|
1487
|
+
type: z67.literal("pcb_placement_error"),
|
|
1400
1488
|
pcb_placement_error_id: getZodPrefixedIdWithDefault("pcb_placement_error"),
|
|
1401
|
-
|
|
1489
|
+
error_type: z67.literal("pcb_placement_error").default("pcb_placement_error"),
|
|
1490
|
+
message: z67.string(),
|
|
1491
|
+
subcircuit_id: z67.string().optional()
|
|
1402
1492
|
}).describe("Defines a placement error on the PCB");
|
|
1403
1493
|
expectTypesMatch(true);
|
|
1404
|
-
var pcb_trace_hint =
|
|
1405
|
-
type:
|
|
1494
|
+
var pcb_trace_hint = z68.object({
|
|
1495
|
+
type: z68.literal("pcb_trace_hint"),
|
|
1406
1496
|
pcb_trace_hint_id: getZodPrefixedIdWithDefault("pcb_trace_hint"),
|
|
1407
|
-
pcb_port_id:
|
|
1408
|
-
pcb_component_id:
|
|
1409
|
-
route:
|
|
1497
|
+
pcb_port_id: z68.string(),
|
|
1498
|
+
pcb_component_id: z68.string(),
|
|
1499
|
+
route: z68.array(route_hint_point),
|
|
1500
|
+
subcircuit_id: z68.string().optional()
|
|
1410
1501
|
}).describe("A hint that can be used during generation of a PCB trace");
|
|
1411
1502
|
expectTypesMatch(true);
|
|
1412
|
-
var pcb_silkscreen_line =
|
|
1413
|
-
type:
|
|
1503
|
+
var pcb_silkscreen_line = z69.object({
|
|
1504
|
+
type: z69.literal("pcb_silkscreen_line"),
|
|
1414
1505
|
pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
|
|
1415
|
-
pcb_component_id:
|
|
1416
|
-
pcb_group_id:
|
|
1417
|
-
subcircuit_id:
|
|
1506
|
+
pcb_component_id: z69.string(),
|
|
1507
|
+
pcb_group_id: z69.string().optional(),
|
|
1508
|
+
subcircuit_id: z69.string().optional(),
|
|
1418
1509
|
stroke_width: distance.default("0.1mm"),
|
|
1419
1510
|
x1: distance,
|
|
1420
1511
|
y1: distance,
|
|
@@ -1423,142 +1514,146 @@ var pcb_silkscreen_line = z68.object({
|
|
|
1423
1514
|
layer: visible_layer
|
|
1424
1515
|
}).describe("Defines a silkscreen line on the PCB");
|
|
1425
1516
|
expectTypesMatch(true);
|
|
1426
|
-
var pcb_silkscreen_path =
|
|
1427
|
-
type:
|
|
1517
|
+
var pcb_silkscreen_path = z70.object({
|
|
1518
|
+
type: z70.literal("pcb_silkscreen_path"),
|
|
1428
1519
|
pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
|
|
1429
|
-
pcb_component_id:
|
|
1430
|
-
pcb_group_id:
|
|
1431
|
-
subcircuit_id:
|
|
1520
|
+
pcb_component_id: z70.string(),
|
|
1521
|
+
pcb_group_id: z70.string().optional(),
|
|
1522
|
+
subcircuit_id: z70.string().optional(),
|
|
1432
1523
|
layer: visible_layer,
|
|
1433
|
-
route:
|
|
1524
|
+
route: z70.array(point),
|
|
1434
1525
|
stroke_width: length
|
|
1435
1526
|
}).describe("Defines a silkscreen path on the PCB");
|
|
1436
1527
|
expectTypesMatch(true);
|
|
1437
|
-
var pcb_silkscreen_text =
|
|
1438
|
-
type:
|
|
1528
|
+
var pcb_silkscreen_text = z71.object({
|
|
1529
|
+
type: z71.literal("pcb_silkscreen_text"),
|
|
1439
1530
|
pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
|
|
1440
|
-
pcb_group_id:
|
|
1441
|
-
subcircuit_id:
|
|
1442
|
-
font:
|
|
1531
|
+
pcb_group_id: z71.string().optional(),
|
|
1532
|
+
subcircuit_id: z71.string().optional(),
|
|
1533
|
+
font: z71.literal("tscircuit2024").default("tscircuit2024"),
|
|
1443
1534
|
font_size: distance.default("0.2mm"),
|
|
1444
|
-
pcb_component_id:
|
|
1445
|
-
text:
|
|
1446
|
-
ccw_rotation:
|
|
1535
|
+
pcb_component_id: z71.string(),
|
|
1536
|
+
text: z71.string(),
|
|
1537
|
+
ccw_rotation: z71.number().optional(),
|
|
1447
1538
|
layer: layer_ref,
|
|
1448
|
-
is_mirrored:
|
|
1539
|
+
is_mirrored: z71.boolean().default(false).optional(),
|
|
1449
1540
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
1450
1541
|
anchor_alignment: ninePointAnchor.default("center")
|
|
1451
1542
|
}).describe("Defines silkscreen text on the PCB");
|
|
1452
1543
|
expectTypesMatch(true);
|
|
1453
|
-
var pcb_silkscreen_rect =
|
|
1454
|
-
type:
|
|
1544
|
+
var pcb_silkscreen_rect = z72.object({
|
|
1545
|
+
type: z72.literal("pcb_silkscreen_rect"),
|
|
1455
1546
|
pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
|
|
1456
|
-
pcb_component_id:
|
|
1457
|
-
pcb_group_id:
|
|
1458
|
-
subcircuit_id:
|
|
1547
|
+
pcb_component_id: z72.string(),
|
|
1548
|
+
pcb_group_id: z72.string().optional(),
|
|
1549
|
+
subcircuit_id: z72.string().optional(),
|
|
1459
1550
|
center: point,
|
|
1460
1551
|
width: length,
|
|
1461
1552
|
height: length,
|
|
1462
1553
|
layer: layer_ref,
|
|
1463
|
-
stroke_width: length.default("1mm")
|
|
1554
|
+
stroke_width: length.default("1mm"),
|
|
1555
|
+
is_filled: z72.boolean().default(true).optional(),
|
|
1556
|
+
has_stroke: z72.boolean().optional(),
|
|
1557
|
+
is_stroke_dashed: z72.boolean().optional()
|
|
1464
1558
|
}).describe("Defines a silkscreen rect on the PCB");
|
|
1465
1559
|
expectTypesMatch(true);
|
|
1466
|
-
var pcb_silkscreen_circle =
|
|
1467
|
-
type:
|
|
1560
|
+
var pcb_silkscreen_circle = z73.object({
|
|
1561
|
+
type: z73.literal("pcb_silkscreen_circle"),
|
|
1468
1562
|
pcb_silkscreen_circle_id: getZodPrefixedIdWithDefault(
|
|
1469
1563
|
"pcb_silkscreen_circle"
|
|
1470
1564
|
),
|
|
1471
|
-
pcb_component_id:
|
|
1472
|
-
pcb_group_id:
|
|
1473
|
-
subcircuit_id:
|
|
1565
|
+
pcb_component_id: z73.string(),
|
|
1566
|
+
pcb_group_id: z73.string().optional(),
|
|
1567
|
+
subcircuit_id: z73.string().optional(),
|
|
1474
1568
|
center: point,
|
|
1475
1569
|
radius: length,
|
|
1476
1570
|
layer: visible_layer,
|
|
1477
1571
|
stroke_width: length.default("1mm")
|
|
1478
1572
|
}).describe("Defines a silkscreen circle on the PCB");
|
|
1479
1573
|
expectTypesMatch(true);
|
|
1480
|
-
var pcb_silkscreen_oval =
|
|
1481
|
-
type:
|
|
1574
|
+
var pcb_silkscreen_oval = z74.object({
|
|
1575
|
+
type: z74.literal("pcb_silkscreen_oval"),
|
|
1482
1576
|
pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
|
|
1483
|
-
pcb_component_id:
|
|
1484
|
-
pcb_group_id:
|
|
1485
|
-
subcircuit_id:
|
|
1577
|
+
pcb_component_id: z74.string(),
|
|
1578
|
+
pcb_group_id: z74.string().optional(),
|
|
1579
|
+
subcircuit_id: z74.string().optional(),
|
|
1486
1580
|
center: point,
|
|
1487
1581
|
radius_x: distance,
|
|
1488
1582
|
radius_y: distance,
|
|
1489
1583
|
layer: visible_layer
|
|
1490
1584
|
}).describe("Defines a silkscreen oval on the PCB");
|
|
1491
1585
|
expectTypesMatch(true);
|
|
1492
|
-
var pcb_fabrication_note_text =
|
|
1493
|
-
type:
|
|
1586
|
+
var pcb_fabrication_note_text = z75.object({
|
|
1587
|
+
type: z75.literal("pcb_fabrication_note_text"),
|
|
1494
1588
|
pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
|
|
1495
1589
|
"pcb_fabrication_note_text"
|
|
1496
1590
|
),
|
|
1497
|
-
subcircuit_id:
|
|
1498
|
-
pcb_group_id:
|
|
1499
|
-
font:
|
|
1591
|
+
subcircuit_id: z75.string().optional(),
|
|
1592
|
+
pcb_group_id: z75.string().optional(),
|
|
1593
|
+
font: z75.literal("tscircuit2024").default("tscircuit2024"),
|
|
1500
1594
|
font_size: distance.default("1mm"),
|
|
1501
|
-
pcb_component_id:
|
|
1502
|
-
text:
|
|
1595
|
+
pcb_component_id: z75.string(),
|
|
1596
|
+
text: z75.string(),
|
|
1503
1597
|
layer: visible_layer,
|
|
1504
1598
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
1505
|
-
anchor_alignment:
|
|
1506
|
-
color:
|
|
1599
|
+
anchor_alignment: z75.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
1600
|
+
color: z75.string().optional()
|
|
1507
1601
|
}).describe(
|
|
1508
1602
|
"Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"
|
|
1509
1603
|
);
|
|
1510
1604
|
expectTypesMatch(true);
|
|
1511
|
-
var pcb_fabrication_note_path =
|
|
1512
|
-
type:
|
|
1605
|
+
var pcb_fabrication_note_path = z76.object({
|
|
1606
|
+
type: z76.literal("pcb_fabrication_note_path"),
|
|
1513
1607
|
pcb_fabrication_note_path_id: getZodPrefixedIdWithDefault(
|
|
1514
1608
|
"pcb_fabrication_note_path"
|
|
1515
1609
|
),
|
|
1516
|
-
pcb_component_id:
|
|
1517
|
-
subcircuit_id:
|
|
1610
|
+
pcb_component_id: z76.string(),
|
|
1611
|
+
subcircuit_id: z76.string().optional(),
|
|
1518
1612
|
layer: layer_ref,
|
|
1519
|
-
route:
|
|
1613
|
+
route: z76.array(point),
|
|
1520
1614
|
stroke_width: length,
|
|
1521
|
-
color:
|
|
1615
|
+
color: z76.string().optional()
|
|
1522
1616
|
}).describe(
|
|
1523
1617
|
"Defines a fabrication path on the PCB for fabricators or assemblers"
|
|
1524
1618
|
);
|
|
1525
1619
|
expectTypesMatch(true);
|
|
1526
|
-
var pcb_keepout =
|
|
1527
|
-
type:
|
|
1528
|
-
shape:
|
|
1529
|
-
pcb_group_id:
|
|
1530
|
-
subcircuit_id:
|
|
1620
|
+
var pcb_keepout = z77.object({
|
|
1621
|
+
type: z77.literal("pcb_keepout"),
|
|
1622
|
+
shape: z77.literal("rect"),
|
|
1623
|
+
pcb_group_id: z77.string().optional(),
|
|
1624
|
+
subcircuit_id: z77.string().optional(),
|
|
1531
1625
|
center: point,
|
|
1532
1626
|
width: distance,
|
|
1533
1627
|
height: distance,
|
|
1534
|
-
pcb_keepout_id:
|
|
1535
|
-
layers:
|
|
1628
|
+
pcb_keepout_id: z77.string(),
|
|
1629
|
+
layers: z77.array(z77.string()),
|
|
1536
1630
|
// Specify layers where the keepout applies
|
|
1537
|
-
description:
|
|
1631
|
+
description: z77.string().optional()
|
|
1538
1632
|
// Optional description of the keepout
|
|
1539
1633
|
}).or(
|
|
1540
|
-
|
|
1541
|
-
type:
|
|
1542
|
-
shape:
|
|
1543
|
-
pcb_group_id:
|
|
1544
|
-
subcircuit_id:
|
|
1634
|
+
z77.object({
|
|
1635
|
+
type: z77.literal("pcb_keepout"),
|
|
1636
|
+
shape: z77.literal("circle"),
|
|
1637
|
+
pcb_group_id: z77.string().optional(),
|
|
1638
|
+
subcircuit_id: z77.string().optional(),
|
|
1545
1639
|
center: point,
|
|
1546
1640
|
radius: distance,
|
|
1547
|
-
pcb_keepout_id:
|
|
1548
|
-
layers:
|
|
1641
|
+
pcb_keepout_id: z77.string(),
|
|
1642
|
+
layers: z77.array(z77.string()),
|
|
1549
1643
|
// Specify layers where the keepout applies
|
|
1550
|
-
description:
|
|
1644
|
+
description: z77.string().optional()
|
|
1551
1645
|
// Optional description of the keepout
|
|
1552
1646
|
})
|
|
1553
1647
|
);
|
|
1554
|
-
|
|
1555
|
-
|
|
1648
|
+
expectTypesMatch(true);
|
|
1649
|
+
var pcb_cutout_base = z78.object({
|
|
1650
|
+
type: z78.literal("pcb_cutout"),
|
|
1556
1651
|
pcb_cutout_id: getZodPrefixedIdWithDefault("pcb_cutout"),
|
|
1557
|
-
pcb_group_id:
|
|
1558
|
-
subcircuit_id:
|
|
1652
|
+
pcb_group_id: z78.string().optional(),
|
|
1653
|
+
subcircuit_id: z78.string().optional()
|
|
1559
1654
|
});
|
|
1560
1655
|
var pcb_cutout_rect = pcb_cutout_base.extend({
|
|
1561
|
-
shape:
|
|
1656
|
+
shape: z78.literal("rect"),
|
|
1562
1657
|
center: point,
|
|
1563
1658
|
width: length,
|
|
1564
1659
|
height: length,
|
|
@@ -1566,94 +1661,149 @@ var pcb_cutout_rect = pcb_cutout_base.extend({
|
|
|
1566
1661
|
});
|
|
1567
1662
|
expectTypesMatch(true);
|
|
1568
1663
|
var pcb_cutout_circle = pcb_cutout_base.extend({
|
|
1569
|
-
shape:
|
|
1664
|
+
shape: z78.literal("circle"),
|
|
1570
1665
|
center: point,
|
|
1571
1666
|
radius: length
|
|
1572
1667
|
});
|
|
1573
1668
|
expectTypesMatch(true);
|
|
1574
1669
|
var pcb_cutout_polygon = pcb_cutout_base.extend({
|
|
1575
|
-
shape:
|
|
1576
|
-
points:
|
|
1670
|
+
shape: z78.literal("polygon"),
|
|
1671
|
+
points: z78.array(point)
|
|
1577
1672
|
});
|
|
1578
1673
|
expectTypesMatch(true);
|
|
1579
|
-
var pcb_cutout =
|
|
1674
|
+
var pcb_cutout = z78.discriminatedUnion("shape", [
|
|
1580
1675
|
pcb_cutout_rect,
|
|
1581
1676
|
pcb_cutout_circle,
|
|
1582
1677
|
pcb_cutout_polygon
|
|
1583
1678
|
]).describe("Defines a cutout on the PCB, removing board material.");
|
|
1584
1679
|
expectTypesMatch(true);
|
|
1585
|
-
var pcb_missing_footprint_error =
|
|
1586
|
-
type:
|
|
1680
|
+
var pcb_missing_footprint_error = z79.object({
|
|
1681
|
+
type: z79.literal("pcb_missing_footprint_error"),
|
|
1587
1682
|
pcb_missing_footprint_error_id: getZodPrefixedIdWithDefault(
|
|
1588
1683
|
"pcb_missing_footprint_error"
|
|
1589
1684
|
),
|
|
1590
|
-
pcb_group_id:
|
|
1591
|
-
subcircuit_id:
|
|
1592
|
-
error_type:
|
|
1593
|
-
source_component_id:
|
|
1594
|
-
message:
|
|
1685
|
+
pcb_group_id: z79.string().optional(),
|
|
1686
|
+
subcircuit_id: z79.string().optional(),
|
|
1687
|
+
error_type: z79.literal("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),
|
|
1688
|
+
source_component_id: z79.string(),
|
|
1689
|
+
message: z79.string()
|
|
1595
1690
|
}).describe("Defines a missing footprint error on the PCB");
|
|
1596
1691
|
expectTypesMatch(
|
|
1597
1692
|
true
|
|
1598
1693
|
);
|
|
1599
|
-
var pcb_group =
|
|
1600
|
-
type:
|
|
1694
|
+
var pcb_group = z80.object({
|
|
1695
|
+
type: z80.literal("pcb_group"),
|
|
1601
1696
|
pcb_group_id: getZodPrefixedIdWithDefault("pcb_group"),
|
|
1602
|
-
source_group_id:
|
|
1603
|
-
is_subcircuit:
|
|
1604
|
-
subcircuit_id:
|
|
1697
|
+
source_group_id: z80.string(),
|
|
1698
|
+
is_subcircuit: z80.boolean().optional(),
|
|
1699
|
+
subcircuit_id: z80.string().optional(),
|
|
1605
1700
|
width: length,
|
|
1606
1701
|
height: length,
|
|
1607
1702
|
center: point,
|
|
1608
|
-
pcb_component_ids:
|
|
1609
|
-
name:
|
|
1610
|
-
description:
|
|
1703
|
+
pcb_component_ids: z80.array(z80.string()),
|
|
1704
|
+
name: z80.string().optional(),
|
|
1705
|
+
description: z80.string().optional(),
|
|
1706
|
+
autorouter_configuration: z80.object({
|
|
1707
|
+
trace_clearance: length
|
|
1708
|
+
}).optional(),
|
|
1709
|
+
autorouter_used_string: z80.string().optional()
|
|
1611
1710
|
}).describe("Defines a group of components on the PCB");
|
|
1612
1711
|
expectTypesMatch(true);
|
|
1613
|
-
var pcb_autorouting_error =
|
|
1614
|
-
type:
|
|
1712
|
+
var pcb_autorouting_error = z81.object({
|
|
1713
|
+
type: z81.literal("pcb_autorouting_error"),
|
|
1615
1714
|
pcb_error_id: getZodPrefixedIdWithDefault("pcb_autorouting_error"),
|
|
1616
|
-
|
|
1715
|
+
error_type: z81.literal("pcb_autorouting_error").default("pcb_autorouting_error"),
|
|
1716
|
+
message: z81.string(),
|
|
1717
|
+
subcircuit_id: z81.string().optional()
|
|
1617
1718
|
}).describe("The autorouting has failed to route a portion of the board");
|
|
1618
1719
|
expectTypesMatch(true);
|
|
1619
|
-
var pcb_manual_edit_conflict_warning =
|
|
1620
|
-
type:
|
|
1720
|
+
var pcb_manual_edit_conflict_warning = z82.object({
|
|
1721
|
+
type: z82.literal("pcb_manual_edit_conflict_warning"),
|
|
1621
1722
|
pcb_manual_edit_conflict_warning_id: getZodPrefixedIdWithDefault(
|
|
1622
1723
|
"pcb_manual_edit_conflict_warning"
|
|
1623
1724
|
),
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1725
|
+
warning_type: z82.literal("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),
|
|
1726
|
+
message: z82.string(),
|
|
1727
|
+
pcb_component_id: z82.string(),
|
|
1728
|
+
pcb_group_id: z82.string().optional(),
|
|
1729
|
+
subcircuit_id: z82.string().optional(),
|
|
1730
|
+
source_component_id: z82.string()
|
|
1629
1731
|
}).describe(
|
|
1630
1732
|
"Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"
|
|
1631
1733
|
);
|
|
1632
1734
|
expectTypesMatch(true);
|
|
1633
|
-
var
|
|
1634
|
-
type:
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1735
|
+
var pcb_breakout_point = z83.object({
|
|
1736
|
+
type: z83.literal("pcb_breakout_point"),
|
|
1737
|
+
pcb_breakout_point_id: getZodPrefixedIdWithDefault("pcb_breakout_point"),
|
|
1738
|
+
pcb_group_id: z83.string(),
|
|
1739
|
+
subcircuit_id: z83.string().optional(),
|
|
1740
|
+
source_trace_id: z83.string().optional(),
|
|
1741
|
+
source_port_id: z83.string().optional(),
|
|
1742
|
+
source_net_id: z83.string().optional(),
|
|
1743
|
+
x: distance,
|
|
1744
|
+
y: distance
|
|
1745
|
+
}).describe(
|
|
1746
|
+
"Defines a routing target within a pcb_group for a source_trace or source_net"
|
|
1747
|
+
);
|
|
1748
|
+
expectTypesMatch(true);
|
|
1749
|
+
var pcb_ground_plane = z84.object({
|
|
1750
|
+
type: z84.literal("pcb_ground_plane"),
|
|
1751
|
+
pcb_ground_plane_id: getZodPrefixedIdWithDefault("pcb_ground_plane"),
|
|
1752
|
+
source_pcb_ground_plane_id: z84.string(),
|
|
1753
|
+
source_net_id: z84.string(),
|
|
1754
|
+
pcb_group_id: z84.string().optional(),
|
|
1755
|
+
subcircuit_id: z84.string().optional()
|
|
1756
|
+
}).describe("Defines a ground plane on the PCB");
|
|
1757
|
+
expectTypesMatch(true);
|
|
1758
|
+
var pcb_ground_plane_region = z85.object({
|
|
1759
|
+
type: z85.literal("pcb_ground_plane_region"),
|
|
1760
|
+
pcb_ground_plane_region_id: getZodPrefixedIdWithDefault(
|
|
1761
|
+
"pcb_ground_plane_region"
|
|
1762
|
+
),
|
|
1763
|
+
pcb_ground_plane_id: z85.string(),
|
|
1764
|
+
pcb_group_id: z85.string().optional(),
|
|
1765
|
+
subcircuit_id: z85.string().optional(),
|
|
1766
|
+
layer: layer_ref,
|
|
1767
|
+
points: z85.array(point)
|
|
1768
|
+
}).describe("Defines a polygon region of a ground plane");
|
|
1769
|
+
expectTypesMatch(true);
|
|
1770
|
+
var pcb_thermal_spoke = z86.object({
|
|
1771
|
+
type: z86.literal("pcb_thermal_spoke"),
|
|
1772
|
+
pcb_thermal_spoke_id: getZodPrefixedIdWithDefault("pcb_thermal_spoke"),
|
|
1773
|
+
pcb_ground_plane_id: z86.string(),
|
|
1774
|
+
shape: z86.string(),
|
|
1775
|
+
spoke_count: z86.number(),
|
|
1776
|
+
spoke_thickness: distance,
|
|
1777
|
+
spoke_inner_diameter: distance,
|
|
1778
|
+
spoke_outer_diameter: distance,
|
|
1779
|
+
pcb_plated_hole_id: z86.string().optional(),
|
|
1780
|
+
subcircuit_id: z86.string().optional()
|
|
1781
|
+
}).describe("Pattern for connecting a ground plane to a plated hole");
|
|
1782
|
+
expectTypesMatch(true);
|
|
1783
|
+
var cad_component = z87.object({
|
|
1784
|
+
type: z87.literal("cad_component"),
|
|
1785
|
+
cad_component_id: z87.string(),
|
|
1786
|
+
pcb_component_id: z87.string(),
|
|
1787
|
+
source_component_id: z87.string(),
|
|
1638
1788
|
position: point3,
|
|
1639
1789
|
rotation: point3.optional(),
|
|
1640
1790
|
size: point3.optional(),
|
|
1641
1791
|
layer: layer_ref.optional(),
|
|
1792
|
+
subcircuit_id: z87.string().optional(),
|
|
1642
1793
|
// These are all ways to generate/load the 3d model
|
|
1643
|
-
footprinter_string:
|
|
1644
|
-
model_obj_url:
|
|
1645
|
-
model_stl_url:
|
|
1646
|
-
model_3mf_url:
|
|
1647
|
-
model_jscad:
|
|
1794
|
+
footprinter_string: z87.string().optional(),
|
|
1795
|
+
model_obj_url: z87.string().optional(),
|
|
1796
|
+
model_stl_url: z87.string().optional(),
|
|
1797
|
+
model_3mf_url: z87.string().optional(),
|
|
1798
|
+
model_jscad: z87.any().optional()
|
|
1648
1799
|
}).describe("Defines a component on the PCB");
|
|
1649
|
-
|
|
1800
|
+
expectTypesMatch(true);
|
|
1801
|
+
var any_circuit_element = z88.union([
|
|
1650
1802
|
source_trace,
|
|
1651
1803
|
source_port,
|
|
1652
1804
|
any_source_component,
|
|
1653
|
-
source_led,
|
|
1654
1805
|
source_net,
|
|
1655
1806
|
source_group,
|
|
1656
|
-
source_simple_bug,
|
|
1657
1807
|
source_simple_chip,
|
|
1658
1808
|
source_simple_capacitor,
|
|
1659
1809
|
source_simple_diode,
|
|
@@ -1666,9 +1816,11 @@ var any_circuit_element = z83.union([
|
|
|
1666
1816
|
source_simple_resonator,
|
|
1667
1817
|
source_simple_switch,
|
|
1668
1818
|
source_simple_transistor,
|
|
1819
|
+
source_simple_test_point,
|
|
1669
1820
|
source_simple_mosfet,
|
|
1670
1821
|
source_simple_potentiometer,
|
|
1671
1822
|
source_simple_push_button,
|
|
1823
|
+
source_pcb_ground_plane,
|
|
1672
1824
|
source_project_metadata,
|
|
1673
1825
|
pcb_component,
|
|
1674
1826
|
pcb_hole,
|
|
@@ -1697,7 +1849,11 @@ var any_circuit_element = z83.union([
|
|
|
1697
1849
|
pcb_fabrication_note_path,
|
|
1698
1850
|
pcb_fabrication_note_text,
|
|
1699
1851
|
pcb_autorouting_error,
|
|
1852
|
+
pcb_breakout_point,
|
|
1700
1853
|
pcb_cutout,
|
|
1854
|
+
pcb_ground_plane,
|
|
1855
|
+
pcb_ground_plane_region,
|
|
1856
|
+
pcb_thermal_spoke,
|
|
1701
1857
|
schematic_box,
|
|
1702
1858
|
schematic_text,
|
|
1703
1859
|
schematic_line,
|
|
@@ -1706,6 +1862,7 @@ var any_circuit_element = z83.union([
|
|
|
1706
1862
|
schematic_trace,
|
|
1707
1863
|
schematic_path,
|
|
1708
1864
|
schematic_error,
|
|
1865
|
+
schematic_layout_error,
|
|
1709
1866
|
schematic_net_label,
|
|
1710
1867
|
schematic_debug_object,
|
|
1711
1868
|
schematic_voltage_probe,
|
|
@@ -1762,16 +1919,85 @@ function generateArcFromSweep(startX, startY, endX, endY, radius, largeArcFlag,
|
|
|
1762
1919
|
return path2;
|
|
1763
1920
|
}
|
|
1764
1921
|
|
|
1765
|
-
// node_modules/@tscircuit/
|
|
1922
|
+
// node_modules/@tscircuit/circuit-json-util/dist/index.js
|
|
1766
1923
|
import { applyToPoint, decomposeTSR } from "transformation-matrix";
|
|
1767
|
-
|
|
1768
|
-
|
|
1924
|
+
function connect(map, a, b) {
|
|
1925
|
+
if (!a || !b)
|
|
1926
|
+
return;
|
|
1927
|
+
let setA = map.get(a);
|
|
1928
|
+
if (!setA) {
|
|
1929
|
+
setA = /* @__PURE__ */ new Set();
|
|
1930
|
+
map.set(a, setA);
|
|
1931
|
+
}
|
|
1932
|
+
setA.add(b);
|
|
1933
|
+
let setB = map.get(b);
|
|
1934
|
+
if (!setB) {
|
|
1935
|
+
setB = /* @__PURE__ */ new Set();
|
|
1936
|
+
map.set(b, setB);
|
|
1937
|
+
}
|
|
1938
|
+
setB.add(a);
|
|
1939
|
+
}
|
|
1940
|
+
function buildSubtree(soup, opts) {
|
|
1941
|
+
if (!opts.subcircuit_id && !opts.source_group_id)
|
|
1942
|
+
return [...soup];
|
|
1943
|
+
const idMap = /* @__PURE__ */ new Map();
|
|
1944
|
+
for (const elm of soup) {
|
|
1945
|
+
const idVal = elm[`${elm.type}_id`];
|
|
1946
|
+
if (typeof idVal === "string") {
|
|
1947
|
+
idMap.set(idVal, elm);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
const adj = /* @__PURE__ */ new Map();
|
|
1951
|
+
for (const elm of soup) {
|
|
1952
|
+
const entries = Object.entries(elm);
|
|
1953
|
+
for (const [key, val] of entries) {
|
|
1954
|
+
if (key.endsWith("_id") && typeof val === "string") {
|
|
1955
|
+
const other = idMap.get(val);
|
|
1956
|
+
connect(adj, elm, other);
|
|
1957
|
+
} else if (key.endsWith("_ids") && Array.isArray(val)) {
|
|
1958
|
+
for (const v of val) {
|
|
1959
|
+
if (typeof v === "string") {
|
|
1960
|
+
const other = idMap.get(v);
|
|
1961
|
+
connect(adj, elm, other);
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
const queue = [];
|
|
1968
|
+
const included = /* @__PURE__ */ new Set();
|
|
1969
|
+
for (const elm of soup) {
|
|
1970
|
+
if (opts.subcircuit_id && elm.subcircuit_id === opts.subcircuit_id || opts.source_group_id && (elm.source_group_id === opts.source_group_id || Array.isArray(elm.member_source_group_ids) && elm.member_source_group_ids.includes(
|
|
1971
|
+
opts.source_group_id
|
|
1972
|
+
))) {
|
|
1973
|
+
queue.push(elm);
|
|
1974
|
+
included.add(elm);
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
while (queue.length > 0) {
|
|
1978
|
+
const elm = queue.shift();
|
|
1979
|
+
const neighbors = adj.get(elm);
|
|
1980
|
+
if (!neighbors)
|
|
1981
|
+
continue;
|
|
1982
|
+
for (const n of neighbors) {
|
|
1983
|
+
if (!included.has(n)) {
|
|
1984
|
+
included.add(n);
|
|
1985
|
+
queue.push(n);
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
return soup.filter((e) => included.has(e));
|
|
1990
|
+
}
|
|
1991
|
+
var cju = (circuitJsonInput, options = {}) => {
|
|
1992
|
+
const circuitJson = circuitJsonInput;
|
|
1993
|
+
let internalStore = circuitJson._internal_store;
|
|
1769
1994
|
if (!internalStore) {
|
|
1770
1995
|
internalStore = {
|
|
1771
|
-
counts: {}
|
|
1996
|
+
counts: {},
|
|
1997
|
+
editCount: 0
|
|
1772
1998
|
};
|
|
1773
|
-
|
|
1774
|
-
for (const elm of
|
|
1999
|
+
circuitJson._internal_store = internalStore;
|
|
2000
|
+
for (const elm of circuitJson) {
|
|
1775
2001
|
const type = elm.type;
|
|
1776
2002
|
const idVal = elm[`${type}_id`];
|
|
1777
2003
|
if (!idVal)
|
|
@@ -1788,12 +2014,23 @@ var su = (soup, options = {}) => {
|
|
|
1788
2014
|
const su2 = new Proxy(
|
|
1789
2015
|
{},
|
|
1790
2016
|
{
|
|
1791
|
-
get: (proxy_target,
|
|
1792
|
-
if (
|
|
1793
|
-
return () =>
|
|
2017
|
+
get: (proxy_target, prop) => {
|
|
2018
|
+
if (prop === "toArray") {
|
|
2019
|
+
return () => {
|
|
2020
|
+
;
|
|
2021
|
+
circuitJson.editCount = internalStore.editCount;
|
|
2022
|
+
return circuitJson;
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
if (prop === "editCount") {
|
|
2026
|
+
return internalStore.editCount;
|
|
2027
|
+
}
|
|
2028
|
+
if (prop === "subtree") {
|
|
2029
|
+
return (opts) => cju(buildSubtree(circuitJson, opts), options);
|
|
1794
2030
|
}
|
|
2031
|
+
const component_type = prop;
|
|
1795
2032
|
return {
|
|
1796
|
-
get: (id) =>
|
|
2033
|
+
get: (id) => circuitJson.find(
|
|
1797
2034
|
(e) => e.type === component_type && e[`${component_type}_id`] === id
|
|
1798
2035
|
),
|
|
1799
2036
|
getUsing: (using) => {
|
|
@@ -1805,24 +2042,24 @@ var su = (soup, options = {}) => {
|
|
|
1805
2042
|
}
|
|
1806
2043
|
const join_key = keys[0];
|
|
1807
2044
|
const join_type = join_key.replace("_id", "");
|
|
1808
|
-
const joiner =
|
|
2045
|
+
const joiner = circuitJson.find(
|
|
1809
2046
|
(e) => e.type === join_type && e[join_key] === using[join_key]
|
|
1810
2047
|
);
|
|
1811
2048
|
if (!joiner)
|
|
1812
2049
|
return null;
|
|
1813
|
-
return
|
|
2050
|
+
return circuitJson.find(
|
|
1814
2051
|
(e) => e.type === component_type && e[`${component_type}_id`] === joiner[`${component_type}_id`]
|
|
1815
2052
|
);
|
|
1816
2053
|
},
|
|
1817
2054
|
getWhere: (where) => {
|
|
1818
2055
|
const keys = Object.keys(where);
|
|
1819
|
-
return
|
|
2056
|
+
return circuitJson.find(
|
|
1820
2057
|
(e) => e.type === component_type && keys.every((key) => e[key] === where[key])
|
|
1821
2058
|
);
|
|
1822
2059
|
},
|
|
1823
2060
|
list: (where) => {
|
|
1824
2061
|
const keys = !where ? [] : Object.keys(where);
|
|
1825
|
-
return
|
|
2062
|
+
return circuitJson.filter(
|
|
1826
2063
|
(e) => e.type === component_type && keys.every((key) => e[key] === where[key])
|
|
1827
2064
|
);
|
|
1828
2065
|
},
|
|
@@ -1839,31 +2076,560 @@ var su = (soup, options = {}) => {
|
|
|
1839
2076
|
const parser = dist_exports[component_type] ?? any_soup_element;
|
|
1840
2077
|
parser.parse(newElm);
|
|
1841
2078
|
}
|
|
1842
|
-
|
|
2079
|
+
circuitJson.push(newElm);
|
|
2080
|
+
internalStore.editCount++;
|
|
1843
2081
|
return newElm;
|
|
1844
2082
|
},
|
|
1845
2083
|
delete: (id) => {
|
|
1846
|
-
const elm =
|
|
2084
|
+
const elm = circuitJson.find(
|
|
1847
2085
|
(e) => e[`${component_type}_id`] === id
|
|
1848
2086
|
);
|
|
1849
2087
|
if (!elm)
|
|
1850
2088
|
return;
|
|
1851
|
-
|
|
2089
|
+
circuitJson.splice(circuitJson.indexOf(elm), 1);
|
|
2090
|
+
internalStore.editCount++;
|
|
1852
2091
|
},
|
|
1853
2092
|
update: (id, newProps) => {
|
|
1854
|
-
const elm =
|
|
2093
|
+
const elm = circuitJson.find(
|
|
2094
|
+
(e) => e.type === component_type && e[`${component_type}_id`] === id
|
|
2095
|
+
);
|
|
2096
|
+
if (!elm)
|
|
2097
|
+
return null;
|
|
2098
|
+
Object.assign(elm, newProps);
|
|
2099
|
+
internalStore.editCount++;
|
|
2100
|
+
return elm;
|
|
2101
|
+
},
|
|
2102
|
+
select: (selector) => {
|
|
2103
|
+
if (component_type === "source_component") {
|
|
2104
|
+
return circuitJson.find(
|
|
2105
|
+
(e) => e.type === "source_component" && e.name === selector.replace(/\./g, "")
|
|
2106
|
+
);
|
|
2107
|
+
} else if (component_type === "pcb_port" || component_type === "source_port" || component_type === "schematic_port") {
|
|
2108
|
+
const [component_name, port_selector] = selector.replace(/\./g, "").split(/[\s\>]+/);
|
|
2109
|
+
const source_component = circuitJson.find(
|
|
2110
|
+
(e) => e.type === "source_component" && e.name === component_name
|
|
2111
|
+
);
|
|
2112
|
+
if (!source_component)
|
|
2113
|
+
return null;
|
|
2114
|
+
const source_port2 = circuitJson.find(
|
|
2115
|
+
(e) => e.type === "source_port" && e.source_component_id === source_component.source_component_id && (e.name === port_selector || (e.port_hints ?? []).includes(port_selector))
|
|
2116
|
+
);
|
|
2117
|
+
if (!source_port2)
|
|
2118
|
+
return null;
|
|
2119
|
+
if (component_type === "source_port")
|
|
2120
|
+
return source_port2;
|
|
2121
|
+
if (component_type === "pcb_port") {
|
|
2122
|
+
return circuitJson.find(
|
|
2123
|
+
(e) => e.type === "pcb_port" && e.source_port_id === source_port2.source_port_id
|
|
2124
|
+
);
|
|
2125
|
+
} else if (component_type === "schematic_port") {
|
|
2126
|
+
return circuitJson.find(
|
|
2127
|
+
(e) => e.type === "schematic_port" && e.source_port_id === source_port2.source_port_id
|
|
2128
|
+
);
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
};
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
);
|
|
2136
|
+
return su2;
|
|
2137
|
+
};
|
|
2138
|
+
cju.unparsed = cju;
|
|
2139
|
+
var su = cju;
|
|
2140
|
+
function createIdKey(element) {
|
|
2141
|
+
const type = element.type;
|
|
2142
|
+
return `${type}:${element[`${type}_id`]}`;
|
|
2143
|
+
}
|
|
2144
|
+
var cjuIndexed = (soup, options = {}) => {
|
|
2145
|
+
let internalStore = soup._internal_store_indexed;
|
|
2146
|
+
if (!internalStore) {
|
|
2147
|
+
internalStore = {
|
|
2148
|
+
counts: {},
|
|
2149
|
+
editCount: 0,
|
|
2150
|
+
indexes: {}
|
|
2151
|
+
};
|
|
2152
|
+
for (const elm of soup) {
|
|
2153
|
+
const type = elm.type;
|
|
2154
|
+
const idVal = elm[`${type}_id`];
|
|
2155
|
+
if (!idVal)
|
|
2156
|
+
continue;
|
|
2157
|
+
const idNum = Number.parseInt(idVal.split("_").pop() || "");
|
|
2158
|
+
if (!Number.isNaN(idNum)) {
|
|
2159
|
+
internalStore.counts[type] = Math.max(
|
|
2160
|
+
internalStore.counts[type] ?? 0,
|
|
2161
|
+
idNum
|
|
2162
|
+
);
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
const indexConfig = options.indexConfig || {};
|
|
2166
|
+
const indexes = internalStore.indexes;
|
|
2167
|
+
if (indexConfig.byId) {
|
|
2168
|
+
indexes.byId = /* @__PURE__ */ new Map();
|
|
2169
|
+
}
|
|
2170
|
+
if (indexConfig.byType) {
|
|
2171
|
+
indexes.byType = /* @__PURE__ */ new Map();
|
|
2172
|
+
}
|
|
2173
|
+
if (indexConfig.byRelation) {
|
|
2174
|
+
indexes.byRelation = /* @__PURE__ */ new Map();
|
|
2175
|
+
}
|
|
2176
|
+
if (indexConfig.bySubcircuit) {
|
|
2177
|
+
indexes.bySubcircuit = /* @__PURE__ */ new Map();
|
|
2178
|
+
}
|
|
2179
|
+
if (indexConfig.byCustomField && indexConfig.byCustomField.length > 0) {
|
|
2180
|
+
indexes.byCustomField = /* @__PURE__ */ new Map();
|
|
2181
|
+
for (const field of indexConfig.byCustomField) {
|
|
2182
|
+
indexes.byCustomField.set(field, /* @__PURE__ */ new Map());
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
for (const element of soup) {
|
|
2186
|
+
if (indexConfig.byId) {
|
|
2187
|
+
const idKey = createIdKey(element);
|
|
2188
|
+
indexes.byId.set(idKey, element);
|
|
2189
|
+
}
|
|
2190
|
+
if (indexConfig.byType) {
|
|
2191
|
+
const elementsOfType = indexes.byType.get(element.type) || [];
|
|
2192
|
+
elementsOfType.push(element);
|
|
2193
|
+
indexes.byType.set(element.type, elementsOfType);
|
|
2194
|
+
}
|
|
2195
|
+
if (indexConfig.byRelation) {
|
|
2196
|
+
const elementEntries = Object.entries(element);
|
|
2197
|
+
for (const [key, value] of elementEntries) {
|
|
2198
|
+
if (key.endsWith("_id") && key !== `${element.type}_id` && typeof value === "string") {
|
|
2199
|
+
const relationTypeMap = indexes.byRelation.get(key) || /* @__PURE__ */ new Map();
|
|
2200
|
+
const relatedElements = relationTypeMap.get(value) || [];
|
|
2201
|
+
relatedElements.push(element);
|
|
2202
|
+
relationTypeMap.set(value, relatedElements);
|
|
2203
|
+
indexes.byRelation.set(key, relationTypeMap);
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
if (indexConfig.bySubcircuit && "subcircuit_id" in element) {
|
|
2208
|
+
const subcircuitId = element.subcircuit_id;
|
|
2209
|
+
if (subcircuitId && typeof subcircuitId === "string") {
|
|
2210
|
+
const subcircuitElements = indexes.bySubcircuit.get(subcircuitId) || [];
|
|
2211
|
+
subcircuitElements.push(element);
|
|
2212
|
+
indexes.bySubcircuit.set(subcircuitId, subcircuitElements);
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
if (indexConfig.byCustomField && indexes.byCustomField) {
|
|
2216
|
+
for (const field of indexConfig.byCustomField) {
|
|
2217
|
+
if (field in element) {
|
|
2218
|
+
const fieldValue = element[field];
|
|
2219
|
+
if (fieldValue !== void 0 && (typeof fieldValue === "string" || typeof fieldValue === "number")) {
|
|
2220
|
+
const fieldValueStr = String(fieldValue);
|
|
2221
|
+
const fieldMap = indexes.byCustomField.get(field);
|
|
2222
|
+
const elementsWithFieldValue = fieldMap.get(fieldValueStr) || [];
|
|
2223
|
+
elementsWithFieldValue.push(element);
|
|
2224
|
+
fieldMap.set(fieldValueStr, elementsWithFieldValue);
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
;
|
|
2231
|
+
soup._internal_store_indexed = internalStore;
|
|
2232
|
+
}
|
|
2233
|
+
const suIndexed = new Proxy(
|
|
2234
|
+
{},
|
|
2235
|
+
{
|
|
2236
|
+
get: (proxy_target, prop) => {
|
|
2237
|
+
if (prop === "toArray") {
|
|
2238
|
+
return () => {
|
|
2239
|
+
;
|
|
2240
|
+
soup.editCount = internalStore.editCount;
|
|
2241
|
+
return soup;
|
|
2242
|
+
};
|
|
2243
|
+
}
|
|
2244
|
+
if (prop === "editCount") {
|
|
2245
|
+
return internalStore.editCount;
|
|
2246
|
+
}
|
|
2247
|
+
const component_type = prop;
|
|
2248
|
+
return {
|
|
2249
|
+
get: (id) => {
|
|
2250
|
+
const indexConfig = options.indexConfig || {};
|
|
2251
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
2252
|
+
return internalStore.indexes.byId.get(
|
|
2253
|
+
`${component_type}:${id}`
|
|
2254
|
+
) || null;
|
|
2255
|
+
}
|
|
2256
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
2257
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
2258
|
+
return elementsOfType.find(
|
|
2259
|
+
(e) => e[`${component_type}_id`] === id
|
|
2260
|
+
) || null;
|
|
2261
|
+
}
|
|
2262
|
+
return soup.find(
|
|
1855
2263
|
(e) => e.type === component_type && e[`${component_type}_id`] === id
|
|
2264
|
+
) || null;
|
|
2265
|
+
},
|
|
2266
|
+
getUsing: (using) => {
|
|
2267
|
+
const indexConfig = options.indexConfig || {};
|
|
2268
|
+
const keys = Object.keys(using);
|
|
2269
|
+
if (keys.length !== 1) {
|
|
2270
|
+
throw new Error(
|
|
2271
|
+
"getUsing requires exactly one key, e.g. { pcb_component_id }"
|
|
2272
|
+
);
|
|
2273
|
+
}
|
|
2274
|
+
const join_key = keys[0];
|
|
2275
|
+
const join_type = join_key.replace("_id", "");
|
|
2276
|
+
if (indexConfig.byRelation && internalStore.indexes.byRelation) {
|
|
2277
|
+
const relationMap = internalStore.indexes.byRelation.get(join_key);
|
|
2278
|
+
if (relationMap) {
|
|
2279
|
+
const relatedElements = relationMap.get(using[join_key]) || [];
|
|
2280
|
+
const joiner2 = relatedElements.find((e) => e.type === join_type);
|
|
2281
|
+
if (!joiner2)
|
|
2282
|
+
return null;
|
|
2283
|
+
const joinerId = joiner2[`${component_type}_id`];
|
|
2284
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
2285
|
+
return internalStore.indexes.byId.get(
|
|
2286
|
+
`${component_type}:${joinerId}`
|
|
2287
|
+
) || null;
|
|
2288
|
+
}
|
|
2289
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
2290
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
2291
|
+
return elementsOfType.find(
|
|
2292
|
+
(e) => e[`${component_type}_id`] === joinerId
|
|
2293
|
+
) || null;
|
|
2294
|
+
}
|
|
2295
|
+
return soup.find(
|
|
2296
|
+
(e) => e.type === component_type && e[`${component_type}_id`] === joinerId
|
|
2297
|
+
) || null;
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
const joiner = soup.find(
|
|
2301
|
+
(e) => e.type === join_type && e[join_key] === using[join_key]
|
|
1856
2302
|
);
|
|
2303
|
+
if (!joiner)
|
|
2304
|
+
return null;
|
|
2305
|
+
return soup.find(
|
|
2306
|
+
(e) => e.type === component_type && e[`${component_type}_id`] === joiner[`${component_type}_id`]
|
|
2307
|
+
) || null;
|
|
2308
|
+
},
|
|
2309
|
+
getWhere: (where) => {
|
|
2310
|
+
const indexConfig = options.indexConfig || {};
|
|
2311
|
+
const keys = Object.keys(where);
|
|
2312
|
+
if (keys.length === 1 && indexConfig.byCustomField && internalStore.indexes.byCustomField) {
|
|
2313
|
+
const field = keys[0];
|
|
2314
|
+
const fieldMap = internalStore.indexes.byCustomField.get(field);
|
|
2315
|
+
if (fieldMap) {
|
|
2316
|
+
const fieldValue = String(where[field]);
|
|
2317
|
+
const elementsWithFieldValue = fieldMap.get(fieldValue) || [];
|
|
2318
|
+
return elementsWithFieldValue.find(
|
|
2319
|
+
(e) => e.type === component_type
|
|
2320
|
+
) || null;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
if ("subcircuit_id" in where && indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit) {
|
|
2324
|
+
const subcircuitId = where.subcircuit_id;
|
|
2325
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(subcircuitId) || [];
|
|
2326
|
+
return subcircuitElements.find(
|
|
2327
|
+
(e) => e.type === component_type && keys.every((key) => e[key] === where[key])
|
|
2328
|
+
) || null;
|
|
2329
|
+
}
|
|
2330
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
2331
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
2332
|
+
return elementsOfType.find(
|
|
2333
|
+
(e) => keys.every((key) => e[key] === where[key])
|
|
2334
|
+
) || null;
|
|
2335
|
+
}
|
|
2336
|
+
return soup.find(
|
|
2337
|
+
(e) => e.type === component_type && keys.every((key) => e[key] === where[key])
|
|
2338
|
+
) || null;
|
|
2339
|
+
},
|
|
2340
|
+
list: (where) => {
|
|
2341
|
+
const indexConfig = options.indexConfig || {};
|
|
2342
|
+
const keys = !where ? [] : Object.keys(where);
|
|
2343
|
+
if (keys.length === 0 && indexConfig.byType && internalStore.indexes.byType) {
|
|
2344
|
+
return internalStore.indexes.byType.get(component_type) || [];
|
|
2345
|
+
}
|
|
2346
|
+
if (keys.length === 1 && keys[0] === "subcircuit_id" && indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit) {
|
|
2347
|
+
const subcircuitId = where.subcircuit_id;
|
|
2348
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(subcircuitId) || [];
|
|
2349
|
+
return subcircuitElements.filter(
|
|
2350
|
+
(e) => e.type === component_type
|
|
2351
|
+
);
|
|
2352
|
+
}
|
|
2353
|
+
let elementsToFilter;
|
|
2354
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
2355
|
+
elementsToFilter = internalStore.indexes.byType.get(component_type) || [];
|
|
2356
|
+
} else {
|
|
2357
|
+
elementsToFilter = soup.filter((e) => e.type === component_type);
|
|
2358
|
+
}
|
|
2359
|
+
if (keys.length > 0) {
|
|
2360
|
+
return elementsToFilter.filter(
|
|
2361
|
+
(e) => keys.every((key) => e[key] === where[key])
|
|
2362
|
+
);
|
|
2363
|
+
}
|
|
2364
|
+
return elementsToFilter;
|
|
2365
|
+
},
|
|
2366
|
+
insert: (elm) => {
|
|
2367
|
+
internalStore.counts[component_type] ??= -1;
|
|
2368
|
+
internalStore.counts[component_type]++;
|
|
2369
|
+
const index = internalStore.counts[component_type];
|
|
2370
|
+
const newElm = {
|
|
2371
|
+
type: component_type,
|
|
2372
|
+
[`${component_type}_id`]: `${component_type}_${index}`,
|
|
2373
|
+
...elm
|
|
2374
|
+
};
|
|
2375
|
+
if (options.validateInserts) {
|
|
2376
|
+
const parser = dist_exports[component_type] ?? any_soup_element;
|
|
2377
|
+
parser.parse(newElm);
|
|
2378
|
+
}
|
|
2379
|
+
soup.push(newElm);
|
|
2380
|
+
internalStore.editCount++;
|
|
2381
|
+
const indexConfig = options.indexConfig || {};
|
|
2382
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
2383
|
+
const idKey = createIdKey(newElm);
|
|
2384
|
+
internalStore.indexes.byId.set(idKey, newElm);
|
|
2385
|
+
}
|
|
2386
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
2387
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
2388
|
+
elementsOfType.push(newElm);
|
|
2389
|
+
internalStore.indexes.byType.set(component_type, elementsOfType);
|
|
2390
|
+
}
|
|
2391
|
+
if (indexConfig.byRelation && internalStore.indexes.byRelation) {
|
|
2392
|
+
const elementEntries = Object.entries(newElm);
|
|
2393
|
+
for (const [key, value] of elementEntries) {
|
|
2394
|
+
if (key.endsWith("_id") && key !== `${newElm.type}_id` && typeof value === "string") {
|
|
2395
|
+
const relationTypeMap = internalStore.indexes.byRelation.get(key) || /* @__PURE__ */ new Map();
|
|
2396
|
+
const relatedElements = relationTypeMap.get(value) || [];
|
|
2397
|
+
relatedElements.push(newElm);
|
|
2398
|
+
relationTypeMap.set(value, relatedElements);
|
|
2399
|
+
internalStore.indexes.byRelation.set(key, relationTypeMap);
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
if (indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit && "subcircuit_id" in newElm) {
|
|
2404
|
+
const subcircuitId = newElm.subcircuit_id;
|
|
2405
|
+
if (subcircuitId && typeof subcircuitId === "string") {
|
|
2406
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(subcircuitId) || [];
|
|
2407
|
+
subcircuitElements.push(newElm);
|
|
2408
|
+
internalStore.indexes.bySubcircuit.set(
|
|
2409
|
+
subcircuitId,
|
|
2410
|
+
subcircuitElements
|
|
2411
|
+
);
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
if (indexConfig.byCustomField && internalStore.indexes.byCustomField) {
|
|
2415
|
+
for (const field of indexConfig.byCustomField) {
|
|
2416
|
+
if (field in newElm) {
|
|
2417
|
+
const fieldValue = newElm[field];
|
|
2418
|
+
if (fieldValue !== void 0 && (typeof fieldValue === "string" || typeof fieldValue === "number")) {
|
|
2419
|
+
const fieldValueStr = String(fieldValue);
|
|
2420
|
+
const fieldMap = internalStore.indexes.byCustomField.get(field);
|
|
2421
|
+
const elementsWithFieldValue = fieldMap.get(fieldValueStr) || [];
|
|
2422
|
+
elementsWithFieldValue.push(newElm);
|
|
2423
|
+
fieldMap.set(fieldValueStr, elementsWithFieldValue);
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
return newElm;
|
|
2429
|
+
},
|
|
2430
|
+
delete: (id) => {
|
|
2431
|
+
const indexConfig = options.indexConfig || {};
|
|
2432
|
+
let elm;
|
|
2433
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
2434
|
+
elm = internalStore.indexes.byId.get(`${component_type}:${id}`);
|
|
2435
|
+
} else if (indexConfig.byType && internalStore.indexes.byType) {
|
|
2436
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
2437
|
+
elm = elementsOfType.find(
|
|
2438
|
+
(e) => e[`${component_type}_id`] === id
|
|
2439
|
+
);
|
|
2440
|
+
} else {
|
|
2441
|
+
elm = soup.find((e) => e[`${component_type}_id`] === id);
|
|
2442
|
+
}
|
|
1857
2443
|
if (!elm)
|
|
1858
2444
|
return;
|
|
2445
|
+
const elmIndex = soup.indexOf(elm);
|
|
2446
|
+
if (elmIndex >= 0) {
|
|
2447
|
+
soup.splice(elmIndex, 1);
|
|
2448
|
+
internalStore.editCount++;
|
|
2449
|
+
}
|
|
2450
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
2451
|
+
const idKey = createIdKey(elm);
|
|
2452
|
+
internalStore.indexes.byId.delete(idKey);
|
|
2453
|
+
}
|
|
2454
|
+
if (indexConfig.byType && internalStore.indexes.byType) {
|
|
2455
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
2456
|
+
const filteredElements = elementsOfType.filter(
|
|
2457
|
+
(e) => e[`${component_type}_id`] !== id
|
|
2458
|
+
);
|
|
2459
|
+
internalStore.indexes.byType.set(component_type, filteredElements);
|
|
2460
|
+
}
|
|
2461
|
+
if (indexConfig.byRelation && internalStore.indexes.byRelation) {
|
|
2462
|
+
for (const [
|
|
2463
|
+
relationKey,
|
|
2464
|
+
relationMap
|
|
2465
|
+
] of internalStore.indexes.byRelation.entries()) {
|
|
2466
|
+
for (const [relationValue, elements] of relationMap.entries()) {
|
|
2467
|
+
const updatedElements = elements.filter((e) => e !== elm);
|
|
2468
|
+
if (updatedElements.length === 0) {
|
|
2469
|
+
relationMap.delete(relationValue);
|
|
2470
|
+
} else {
|
|
2471
|
+
relationMap.set(relationValue, updatedElements);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
if (indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit && "subcircuit_id" in elm) {
|
|
2477
|
+
const subcircuitId = elm.subcircuit_id;
|
|
2478
|
+
if (subcircuitId) {
|
|
2479
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(subcircuitId) || [];
|
|
2480
|
+
const updatedElements = subcircuitElements.filter(
|
|
2481
|
+
(e) => e !== elm
|
|
2482
|
+
);
|
|
2483
|
+
if (updatedElements.length === 0) {
|
|
2484
|
+
internalStore.indexes.bySubcircuit.delete(subcircuitId);
|
|
2485
|
+
} else {
|
|
2486
|
+
internalStore.indexes.bySubcircuit.set(
|
|
2487
|
+
subcircuitId,
|
|
2488
|
+
updatedElements
|
|
2489
|
+
);
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
if (indexConfig.byCustomField && internalStore.indexes.byCustomField) {
|
|
2494
|
+
for (const fieldMap of internalStore.indexes.byCustomField.values()) {
|
|
2495
|
+
for (const [fieldValue, elements] of fieldMap.entries()) {
|
|
2496
|
+
const updatedElements = elements.filter((e) => e !== elm);
|
|
2497
|
+
if (updatedElements.length === 0) {
|
|
2498
|
+
fieldMap.delete(fieldValue);
|
|
2499
|
+
} else {
|
|
2500
|
+
fieldMap.set(fieldValue, updatedElements);
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
},
|
|
2506
|
+
update: (id, newProps) => {
|
|
2507
|
+
const indexConfig = options.indexConfig || {};
|
|
2508
|
+
let elm;
|
|
2509
|
+
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
2510
|
+
elm = internalStore.indexes.byId.get(`${component_type}:${id}`);
|
|
2511
|
+
} else if (indexConfig.byType && internalStore.indexes.byType) {
|
|
2512
|
+
const elementsOfType = internalStore.indexes.byType.get(component_type) || [];
|
|
2513
|
+
elm = elementsOfType.find(
|
|
2514
|
+
(e) => e[`${component_type}_id`] === id
|
|
2515
|
+
);
|
|
2516
|
+
} else {
|
|
2517
|
+
elm = soup.find(
|
|
2518
|
+
(e) => e.type === component_type && e[`${component_type}_id`] === id
|
|
2519
|
+
);
|
|
2520
|
+
}
|
|
2521
|
+
if (!elm)
|
|
2522
|
+
return null;
|
|
2523
|
+
if (indexConfig.byRelation && internalStore.indexes.byRelation) {
|
|
2524
|
+
const elementEntries = Object.entries(elm);
|
|
2525
|
+
for (const [key, value] of elementEntries) {
|
|
2526
|
+
if (key.endsWith("_id") && key !== `${elm.type}_id` && typeof value === "string") {
|
|
2527
|
+
if (key in newProps && newProps[key] !== value) {
|
|
2528
|
+
const relationTypeMap = internalStore.indexes.byRelation.get(key);
|
|
2529
|
+
if (relationTypeMap) {
|
|
2530
|
+
const relatedElements = relationTypeMap.get(value) || [];
|
|
2531
|
+
const updatedElements = relatedElements.filter(
|
|
2532
|
+
(e) => e !== elm
|
|
2533
|
+
);
|
|
2534
|
+
if (updatedElements.length === 0) {
|
|
2535
|
+
relationTypeMap.delete(value);
|
|
2536
|
+
} else {
|
|
2537
|
+
relationTypeMap.set(value, updatedElements);
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
if (indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit && "subcircuit_id" in elm && "subcircuit_id" in newProps) {
|
|
2545
|
+
const oldSubcircuitId = elm.subcircuit_id;
|
|
2546
|
+
const newSubcircuitId = newProps.subcircuit_id;
|
|
2547
|
+
if (oldSubcircuitId !== newSubcircuitId) {
|
|
2548
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(oldSubcircuitId) || [];
|
|
2549
|
+
const updatedElements = subcircuitElements.filter(
|
|
2550
|
+
(e) => e !== elm
|
|
2551
|
+
);
|
|
2552
|
+
if (updatedElements.length === 0) {
|
|
2553
|
+
internalStore.indexes.bySubcircuit.delete(oldSubcircuitId);
|
|
2554
|
+
} else {
|
|
2555
|
+
internalStore.indexes.bySubcircuit.set(
|
|
2556
|
+
oldSubcircuitId,
|
|
2557
|
+
updatedElements
|
|
2558
|
+
);
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
if (indexConfig.byCustomField && internalStore.indexes.byCustomField) {
|
|
2563
|
+
for (const field of indexConfig.byCustomField) {
|
|
2564
|
+
if (field in elm && field in newProps && elm[field] !== newProps[field]) {
|
|
2565
|
+
const fieldMap = internalStore.indexes.byCustomField.get(field);
|
|
2566
|
+
if (fieldMap) {
|
|
2567
|
+
const oldValue = String(elm[field]);
|
|
2568
|
+
const elements = fieldMap.get(oldValue) || [];
|
|
2569
|
+
const updatedElements = elements.filter((e) => e !== elm);
|
|
2570
|
+
if (updatedElements.length === 0) {
|
|
2571
|
+
fieldMap.delete(oldValue);
|
|
2572
|
+
} else {
|
|
2573
|
+
fieldMap.set(oldValue, updatedElements);
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
1859
2579
|
Object.assign(elm, newProps);
|
|
2580
|
+
internalStore.editCount++;
|
|
2581
|
+
if (indexConfig.byRelation && internalStore.indexes.byRelation) {
|
|
2582
|
+
const elementEntries = Object.entries(elm);
|
|
2583
|
+
for (const [key, value] of elementEntries) {
|
|
2584
|
+
if (key.endsWith("_id") && key !== `${elm.type}_id` && typeof value === "string") {
|
|
2585
|
+
if (key in newProps) {
|
|
2586
|
+
const relationTypeMap = internalStore.indexes.byRelation.get(key) || /* @__PURE__ */ new Map();
|
|
2587
|
+
const relatedElements = relationTypeMap.get(value) || [];
|
|
2588
|
+
if (!relatedElements.includes(elm)) {
|
|
2589
|
+
relatedElements.push(elm);
|
|
2590
|
+
relationTypeMap.set(value, relatedElements);
|
|
2591
|
+
internalStore.indexes.byRelation.set(key, relationTypeMap);
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
if (indexConfig.bySubcircuit && internalStore.indexes.bySubcircuit && "subcircuit_id" in elm && "subcircuit_id" in newProps) {
|
|
2598
|
+
const subcircuitId = elm.subcircuit_id;
|
|
2599
|
+
if (subcircuitId && typeof subcircuitId === "string") {
|
|
2600
|
+
const subcircuitElements = internalStore.indexes.bySubcircuit.get(subcircuitId) || [];
|
|
2601
|
+
if (!subcircuitElements.includes(elm)) {
|
|
2602
|
+
subcircuitElements.push(elm);
|
|
2603
|
+
internalStore.indexes.bySubcircuit.set(
|
|
2604
|
+
subcircuitId,
|
|
2605
|
+
subcircuitElements
|
|
2606
|
+
);
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
if (indexConfig.byCustomField && internalStore.indexes.byCustomField) {
|
|
2611
|
+
for (const field of indexConfig.byCustomField) {
|
|
2612
|
+
if (field in elm && field in newProps) {
|
|
2613
|
+
const fieldValue = elm[field];
|
|
2614
|
+
if (fieldValue !== void 0 && (typeof fieldValue === "string" || typeof fieldValue === "number")) {
|
|
2615
|
+
const fieldValueStr = String(fieldValue);
|
|
2616
|
+
const fieldMap = internalStore.indexes.byCustomField.get(field);
|
|
2617
|
+
const elementsWithFieldValue = fieldMap.get(fieldValueStr) || [];
|
|
2618
|
+
if (!elementsWithFieldValue.includes(elm)) {
|
|
2619
|
+
elementsWithFieldValue.push(elm);
|
|
2620
|
+
fieldMap.set(fieldValueStr, elementsWithFieldValue);
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
1860
2626
|
return elm;
|
|
1861
2627
|
},
|
|
1862
2628
|
select: (selector) => {
|
|
1863
2629
|
if (component_type === "source_component") {
|
|
1864
2630
|
return soup.find(
|
|
1865
2631
|
(e) => e.type === "source_component" && e.name === selector.replace(/\./g, "")
|
|
1866
|
-
);
|
|
2632
|
+
) || null;
|
|
1867
2633
|
} else if (component_type === "pcb_port" || component_type === "source_port" || component_type === "schematic_port") {
|
|
1868
2634
|
const [component_name, port_selector] = selector.replace(/\./g, "").split(/[\s\>]+/);
|
|
1869
2635
|
const source_component = soup.find(
|
|
@@ -1881,25 +2647,28 @@ var su = (soup, options = {}) => {
|
|
|
1881
2647
|
if (component_type === "pcb_port") {
|
|
1882
2648
|
return soup.find(
|
|
1883
2649
|
(e) => e.type === "pcb_port" && e.source_port_id === source_port2.source_port_id
|
|
1884
|
-
);
|
|
2650
|
+
) || null;
|
|
1885
2651
|
} else if (component_type === "schematic_port") {
|
|
1886
2652
|
return soup.find(
|
|
1887
2653
|
(e) => e.type === "schematic_port" && e.source_port_id === source_port2.source_port_id
|
|
1888
|
-
);
|
|
2654
|
+
) || null;
|
|
1889
2655
|
}
|
|
1890
2656
|
}
|
|
2657
|
+
return null;
|
|
1891
2658
|
}
|
|
1892
2659
|
};
|
|
1893
2660
|
}
|
|
1894
2661
|
}
|
|
1895
2662
|
);
|
|
1896
|
-
return
|
|
2663
|
+
return suIndexed;
|
|
1897
2664
|
};
|
|
1898
|
-
|
|
1899
|
-
var su_default = su;
|
|
2665
|
+
cjuIndexed.unparsed = cjuIndexed;
|
|
1900
2666
|
var transformPCBElement = (elm, matrix) => {
|
|
1901
2667
|
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
1902
|
-
const { x, y } = applyToPoint(matrix, {
|
|
2668
|
+
const { x, y } = applyToPoint(matrix, {
|
|
2669
|
+
x: Number(elm.x),
|
|
2670
|
+
y: Number(elm.y)
|
|
2671
|
+
});
|
|
1903
2672
|
elm.x = x;
|
|
1904
2673
|
elm.y = y;
|
|
1905
2674
|
} else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
|
|
@@ -2129,22 +2898,17 @@ var findBoundsAndCenter = (elements) => {
|
|
|
2129
2898
|
|
|
2130
2899
|
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
2131
2900
|
import { compose, scale, translate, applyToPoint as applyToPoint2 } from "transformation-matrix";
|
|
2132
|
-
|
|
2133
|
-
// lib/compute-center-offset.ts
|
|
2134
2901
|
import { mm } from "@tscircuit/mm";
|
|
2135
2902
|
|
|
2136
|
-
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
2137
|
-
import { mm as mm2 } from "@tscircuit/mm";
|
|
2138
|
-
|
|
2139
2903
|
// lib/utils/easyeda-unit-to-mm.ts
|
|
2140
2904
|
var mil10ToMm = (value) => value * 10 * 0.0254;
|
|
2141
2905
|
|
|
2142
2906
|
// lib/convert-easyeda-json-to-tscircuit-soup-json.ts
|
|
2143
2907
|
import { normalizePinLabels } from "@tscircuit/core";
|
|
2144
2908
|
var mil2mm = (mil) => {
|
|
2145
|
-
if (typeof mil === "number") return
|
|
2146
|
-
if (mil.match(/^\d+$/)) return
|
|
2147
|
-
return
|
|
2909
|
+
if (typeof mil === "number") return mm(`${mil}mil`);
|
|
2910
|
+
if (mil.match(/^\d+$/)) return mm(`${mil}mil`);
|
|
2911
|
+
return mm(mil);
|
|
2148
2912
|
};
|
|
2149
2913
|
var milx10 = (mil10) => {
|
|
2150
2914
|
if (typeof mil10 === "number") return mil2mm(mil10) * 10;
|
|
@@ -2235,14 +2999,14 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
2235
2999
|
type: "source_component",
|
|
2236
3000
|
source_component_id: "source_component_1",
|
|
2237
3001
|
name: "U1",
|
|
2238
|
-
ftype: "
|
|
3002
|
+
ftype: "simple_chip"
|
|
2239
3003
|
});
|
|
2240
3004
|
const pcb_component2 = pcb_component.parse({
|
|
2241
3005
|
type: "pcb_component",
|
|
2242
3006
|
pcb_component_id: "pcb_component_1",
|
|
2243
3007
|
source_component_id: "source_component_1",
|
|
2244
3008
|
name: "U1",
|
|
2245
|
-
ftype: "
|
|
3009
|
+
ftype: "simple_chip",
|
|
2246
3010
|
width: 0,
|
|
2247
3011
|
// we update this at the end
|
|
2248
3012
|
height: 0,
|
|
@@ -2495,14 +3259,14 @@ async function fetchEasyEDAComponent(jlcpcbPartNumber, { fetch: fetch2 = globalT
|
|
|
2495
3259
|
}
|
|
2496
3260
|
|
|
2497
3261
|
// lib/schemas/easy-eda-json-schema.ts
|
|
2498
|
-
import { z as
|
|
3262
|
+
import { z as z91 } from "zod";
|
|
2499
3263
|
|
|
2500
3264
|
// lib/schemas/package-detail-shape-schema.ts
|
|
2501
|
-
import { z as
|
|
2502
|
-
var tenthmil =
|
|
3265
|
+
import { z as z89 } from "zod";
|
|
3266
|
+
var tenthmil = z89.union([z89.number(), z89.string()]).optional().transform(
|
|
2503
3267
|
(n) => typeof n === "string" && n.endsWith("mil") ? n : `${Number.parseFloat(n) * 10}mil`
|
|
2504
|
-
).pipe(
|
|
2505
|
-
var PointSchema =
|
|
3268
|
+
).pipe(z89.string());
|
|
3269
|
+
var PointSchema = z89.any().transform((p) => {
|
|
2506
3270
|
if (Array.isArray(p)) {
|
|
2507
3271
|
const [x, y] = p;
|
|
2508
3272
|
return { x, y };
|
|
@@ -2512,104 +3276,104 @@ var PointSchema = z84.any().transform((p) => {
|
|
|
2512
3276
|
}
|
|
2513
3277
|
throw new Error(`Invalid point: ${p}`);
|
|
2514
3278
|
}).pipe(
|
|
2515
|
-
|
|
2516
|
-
x:
|
|
2517
|
-
y:
|
|
3279
|
+
z89.object({
|
|
3280
|
+
x: z89.number(),
|
|
3281
|
+
y: z89.number()
|
|
2518
3282
|
})
|
|
2519
3283
|
);
|
|
2520
|
-
var BaseShapeSchema =
|
|
2521
|
-
type:
|
|
2522
|
-
id:
|
|
2523
|
-
layer:
|
|
3284
|
+
var BaseShapeSchema = z89.object({
|
|
3285
|
+
type: z89.string(),
|
|
3286
|
+
id: z89.string().optional(),
|
|
3287
|
+
layer: z89.coerce.number().optional()
|
|
2524
3288
|
});
|
|
2525
3289
|
var TrackSchema = BaseShapeSchema.extend({
|
|
2526
|
-
type:
|
|
2527
|
-
width:
|
|
2528
|
-
points:
|
|
3290
|
+
type: z89.literal("TRACK"),
|
|
3291
|
+
width: z89.coerce.number(),
|
|
3292
|
+
points: z89.array(PointSchema)
|
|
2529
3293
|
});
|
|
2530
3294
|
var PadSchema = BaseShapeSchema.extend({
|
|
2531
|
-
type:
|
|
2532
|
-
shape:
|
|
2533
|
-
center:
|
|
3295
|
+
type: z89.literal("PAD"),
|
|
3296
|
+
shape: z89.enum(["RECT", "ELLIPSE", "OVAL"]),
|
|
3297
|
+
center: z89.object({
|
|
2534
3298
|
x: tenthmil,
|
|
2535
3299
|
y: tenthmil
|
|
2536
3300
|
}),
|
|
2537
3301
|
width: tenthmil,
|
|
2538
3302
|
height: tenthmil,
|
|
2539
|
-
layermask:
|
|
2540
|
-
net:
|
|
2541
|
-
number:
|
|
3303
|
+
layermask: z89.number(),
|
|
3304
|
+
net: z89.union([z89.string(), z89.number()]).optional(),
|
|
3305
|
+
number: z89.union([z89.string(), z89.number()]),
|
|
2542
3306
|
holeRadius: tenthmil,
|
|
2543
|
-
points:
|
|
2544
|
-
rotation:
|
|
2545
|
-
plated:
|
|
3307
|
+
points: z89.array(PointSchema).optional(),
|
|
3308
|
+
rotation: z89.number().optional(),
|
|
3309
|
+
plated: z89.boolean()
|
|
2546
3310
|
});
|
|
2547
3311
|
var ArcSchema = BaseShapeSchema.extend({
|
|
2548
|
-
type:
|
|
2549
|
-
width:
|
|
3312
|
+
type: z89.literal("ARC"),
|
|
3313
|
+
width: z89.number(),
|
|
2550
3314
|
start: PointSchema,
|
|
2551
3315
|
end: PointSchema,
|
|
2552
|
-
radiusX:
|
|
2553
|
-
radiusY:
|
|
2554
|
-
largeArc:
|
|
2555
|
-
sweepDirection:
|
|
3316
|
+
radiusX: z89.number(),
|
|
3317
|
+
radiusY: z89.number(),
|
|
3318
|
+
largeArc: z89.boolean(),
|
|
3319
|
+
sweepDirection: z89.enum(["CW", "CCW"])
|
|
2556
3320
|
});
|
|
2557
3321
|
var CircleSchema = BaseShapeSchema.extend({
|
|
2558
|
-
type:
|
|
3322
|
+
type: z89.literal("CIRCLE"),
|
|
2559
3323
|
center: PointSchema,
|
|
2560
|
-
radius:
|
|
2561
|
-
width:
|
|
3324
|
+
radius: z89.number(),
|
|
3325
|
+
width: z89.number()
|
|
2562
3326
|
});
|
|
2563
3327
|
var SolidRegionSchema = BaseShapeSchema.extend({
|
|
2564
|
-
type:
|
|
2565
|
-
layermask:
|
|
2566
|
-
points:
|
|
2567
|
-
fillStyle:
|
|
3328
|
+
type: z89.literal("SOLIDREGION"),
|
|
3329
|
+
layermask: z89.number(),
|
|
3330
|
+
points: z89.array(PointSchema),
|
|
3331
|
+
fillStyle: z89.string()
|
|
2568
3332
|
});
|
|
2569
3333
|
var SVGNodeSchema = BaseShapeSchema.extend({
|
|
2570
|
-
type:
|
|
2571
|
-
svgData:
|
|
2572
|
-
gId:
|
|
2573
|
-
nodeName:
|
|
2574
|
-
nodeType:
|
|
2575
|
-
layerid:
|
|
2576
|
-
attrs:
|
|
2577
|
-
childNodes:
|
|
3334
|
+
type: z89.literal("SVGNODE"),
|
|
3335
|
+
svgData: z89.object({
|
|
3336
|
+
gId: z89.string(),
|
|
3337
|
+
nodeName: z89.string(),
|
|
3338
|
+
nodeType: z89.number(),
|
|
3339
|
+
layerid: z89.string(),
|
|
3340
|
+
attrs: z89.record(z89.string(), z89.string()),
|
|
3341
|
+
childNodes: z89.array(z89.unknown())
|
|
2578
3342
|
})
|
|
2579
3343
|
});
|
|
2580
3344
|
var HoleSchema = BaseShapeSchema.extend({
|
|
2581
|
-
type:
|
|
3345
|
+
type: z89.literal("HOLE"),
|
|
2582
3346
|
center: PointSchema,
|
|
2583
|
-
radius:
|
|
3347
|
+
radius: z89.number()
|
|
2584
3348
|
});
|
|
2585
3349
|
var ViaSchema = BaseShapeSchema.extend({
|
|
2586
|
-
type:
|
|
3350
|
+
type: z89.literal("VIA"),
|
|
2587
3351
|
center: PointSchema,
|
|
2588
|
-
outerDiameter:
|
|
2589
|
-
holeDiameter:
|
|
3352
|
+
outerDiameter: z89.number(),
|
|
3353
|
+
holeDiameter: z89.number()
|
|
2590
3354
|
});
|
|
2591
3355
|
var RectSchema = BaseShapeSchema.extend({
|
|
2592
|
-
type:
|
|
3356
|
+
type: z89.literal("RECT"),
|
|
2593
3357
|
x: tenthmil,
|
|
2594
3358
|
y: tenthmil,
|
|
2595
3359
|
width: tenthmil,
|
|
2596
3360
|
height: tenthmil,
|
|
2597
|
-
lineWidth:
|
|
2598
|
-
fillStyle:
|
|
2599
|
-
rotation:
|
|
3361
|
+
lineWidth: z89.number(),
|
|
3362
|
+
fillStyle: z89.string(),
|
|
3363
|
+
rotation: z89.number().optional()
|
|
2600
3364
|
});
|
|
2601
3365
|
var TextSchema = BaseShapeSchema.extend({
|
|
2602
|
-
type:
|
|
2603
|
-
text:
|
|
3366
|
+
type: z89.literal("TEXT"),
|
|
3367
|
+
text: z89.string(),
|
|
2604
3368
|
x: tenthmil,
|
|
2605
3369
|
y: tenthmil,
|
|
2606
|
-
size_mm:
|
|
2607
|
-
rotation:
|
|
2608
|
-
layer:
|
|
2609
|
-
textAnchor:
|
|
2610
|
-
font:
|
|
3370
|
+
size_mm: z89.number(),
|
|
3371
|
+
rotation: z89.number().optional(),
|
|
3372
|
+
layer: z89.number().optional(),
|
|
3373
|
+
textAnchor: z89.enum(["L", "C", "R", ""]).optional().transform((val) => val === "" ? void 0 : val),
|
|
3374
|
+
font: z89.string().optional()
|
|
2611
3375
|
});
|
|
2612
|
-
var PackageDetailShapeSchema =
|
|
3376
|
+
var PackageDetailShapeSchema = z89.discriminatedUnion("type", [
|
|
2613
3377
|
TrackSchema,
|
|
2614
3378
|
PadSchema,
|
|
2615
3379
|
ArcSchema,
|
|
@@ -2631,9 +3395,9 @@ var pairs = (arr) => {
|
|
|
2631
3395
|
var parsePoints = (pointsStr) => pairs(
|
|
2632
3396
|
pointsStr.trim().split(" ").map((n) => Number(n))
|
|
2633
3397
|
);
|
|
2634
|
-
var ShapeItemSchema =
|
|
2635
|
-
type:
|
|
2636
|
-
data:
|
|
3398
|
+
var ShapeItemSchema = z89.object({
|
|
3399
|
+
type: z89.string(),
|
|
3400
|
+
data: z89.string()
|
|
2637
3401
|
}).transform((shape) => {
|
|
2638
3402
|
switch (shape.type) {
|
|
2639
3403
|
case "TRACK": {
|
|
@@ -2801,23 +3565,22 @@ var ShapeItemSchema = z84.object({
|
|
|
2801
3565
|
throw new Error(`Unknown shape type: ${shape.type}`);
|
|
2802
3566
|
}
|
|
2803
3567
|
}).pipe(PackageDetailShapeSchema);
|
|
2804
|
-
var ShapesArraySchema =
|
|
3568
|
+
var ShapesArraySchema = z89.array(ShapeItemSchema);
|
|
2805
3569
|
|
|
2806
3570
|
// lib/schemas/single-letter-shape-schema.ts
|
|
2807
|
-
import { z as
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
y: z85.number()
|
|
3571
|
+
import { z as z90 } from "zod";
|
|
3572
|
+
var PointSchema2 = z90.object({
|
|
3573
|
+
x: z90.number(),
|
|
3574
|
+
y: z90.number()
|
|
2812
3575
|
});
|
|
2813
|
-
var RectangleShapeOutputSchema =
|
|
2814
|
-
type:
|
|
3576
|
+
var RectangleShapeOutputSchema = z90.object({
|
|
3577
|
+
type: z90.literal("RECTANGLE"),
|
|
2815
3578
|
position: PointSchema2,
|
|
2816
|
-
width:
|
|
2817
|
-
height:
|
|
2818
|
-
color:
|
|
2819
|
-
lineWidth:
|
|
2820
|
-
id:
|
|
3579
|
+
width: z90.number(),
|
|
3580
|
+
height: z90.number(),
|
|
3581
|
+
color: z90.string(),
|
|
3582
|
+
lineWidth: z90.number(),
|
|
3583
|
+
id: z90.string()
|
|
2821
3584
|
});
|
|
2822
3585
|
var parseRectangle = (str) => {
|
|
2823
3586
|
const [, x, y, , , width, height, color, lineWidth, , , id] = str.split("~");
|
|
@@ -2831,15 +3594,15 @@ var parseRectangle = (str) => {
|
|
|
2831
3594
|
id
|
|
2832
3595
|
};
|
|
2833
3596
|
};
|
|
2834
|
-
var RectangleShapeSchema =
|
|
2835
|
-
var EllipseShapeOutputSchema =
|
|
2836
|
-
type:
|
|
3597
|
+
var RectangleShapeSchema = z90.string().startsWith("R~").transform(parseRectangle).pipe(RectangleShapeOutputSchema);
|
|
3598
|
+
var EllipseShapeOutputSchema = z90.object({
|
|
3599
|
+
type: z90.literal("ELLIPSE"),
|
|
2837
3600
|
center: PointSchema2,
|
|
2838
|
-
radiusX:
|
|
2839
|
-
radiusY:
|
|
2840
|
-
color:
|
|
2841
|
-
lineWidth:
|
|
2842
|
-
id:
|
|
3601
|
+
radiusX: z90.number(),
|
|
3602
|
+
radiusY: z90.number(),
|
|
3603
|
+
color: z90.string(),
|
|
3604
|
+
lineWidth: z90.number(),
|
|
3605
|
+
id: z90.string()
|
|
2843
3606
|
});
|
|
2844
3607
|
var parseEllipse = (str) => {
|
|
2845
3608
|
const [, x, y, radiusX, radiusY, color, lineWidth, , , id] = str.split("~");
|
|
@@ -2853,16 +3616,16 @@ var parseEllipse = (str) => {
|
|
|
2853
3616
|
id
|
|
2854
3617
|
};
|
|
2855
3618
|
};
|
|
2856
|
-
var EllipseShapeSchema =
|
|
2857
|
-
var ArcShapeOutputSchema =
|
|
2858
|
-
type:
|
|
3619
|
+
var EllipseShapeSchema = z90.string().startsWith("E~").transform(parseEllipse).pipe(EllipseShapeOutputSchema);
|
|
3620
|
+
var ArcShapeOutputSchema = z90.object({
|
|
3621
|
+
type: z90.literal("ARC"),
|
|
2859
3622
|
start: PointSchema2,
|
|
2860
3623
|
end: PointSchema2,
|
|
2861
|
-
radius:
|
|
2862
|
-
sweepFlag:
|
|
2863
|
-
color:
|
|
2864
|
-
lineWidth:
|
|
2865
|
-
id:
|
|
3624
|
+
radius: z90.number(),
|
|
3625
|
+
sweepFlag: z90.boolean(),
|
|
3626
|
+
color: z90.string(),
|
|
3627
|
+
lineWidth: z90.number(),
|
|
3628
|
+
id: z90.string()
|
|
2866
3629
|
});
|
|
2867
3630
|
var parseArc = (str) => {
|
|
2868
3631
|
const [, pathData, color, lineWidth, , , id] = str.split("~");
|
|
@@ -2874,7 +3637,7 @@ var parseArc = (str) => {
|
|
|
2874
3637
|
const x2 = Number(parts[8]) || 0;
|
|
2875
3638
|
const y2 = Number(parts[9]) || 0;
|
|
2876
3639
|
const parsedLineWidth = Number(lineWidth);
|
|
2877
|
-
const finalLineWidth = isNaN(parsedLineWidth) ? 1 : parsedLineWidth;
|
|
3640
|
+
const finalLineWidth = Number.isNaN(parsedLineWidth) ? 1 : parsedLineWidth;
|
|
2878
3641
|
return {
|
|
2879
3642
|
type: "ARC",
|
|
2880
3643
|
start: { x: x1, y: y1 },
|
|
@@ -2887,19 +3650,19 @@ var parseArc = (str) => {
|
|
|
2887
3650
|
id: id || "gge1"
|
|
2888
3651
|
};
|
|
2889
3652
|
};
|
|
2890
|
-
var ArcShapeSchema =
|
|
2891
|
-
var PinShapeOutputSchema =
|
|
2892
|
-
type:
|
|
2893
|
-
visibility:
|
|
2894
|
-
pinNumber:
|
|
2895
|
-
x:
|
|
2896
|
-
y:
|
|
2897
|
-
rotation:
|
|
2898
|
-
id:
|
|
2899
|
-
label:
|
|
2900
|
-
labelColor:
|
|
2901
|
-
path:
|
|
2902
|
-
arrow:
|
|
3653
|
+
var ArcShapeSchema = z90.string().startsWith("A~").transform(parseArc).pipe(ArcShapeOutputSchema);
|
|
3654
|
+
var PinShapeOutputSchema = z90.object({
|
|
3655
|
+
type: z90.literal("PIN"),
|
|
3656
|
+
visibility: z90.enum(["show", "hide"]),
|
|
3657
|
+
pinNumber: z90.union([z90.string(), z90.number()]),
|
|
3658
|
+
x: z90.number(),
|
|
3659
|
+
y: z90.number(),
|
|
3660
|
+
rotation: z90.number(),
|
|
3661
|
+
id: z90.string(),
|
|
3662
|
+
label: z90.string(),
|
|
3663
|
+
labelColor: z90.string(),
|
|
3664
|
+
path: z90.string(),
|
|
3665
|
+
arrow: z90.string()
|
|
2903
3666
|
});
|
|
2904
3667
|
var parsePin = (pinString) => {
|
|
2905
3668
|
const parts = pinString.split("~");
|
|
@@ -2912,14 +3675,14 @@ var parsePin = (pinString) => {
|
|
|
2912
3675
|
const path2 = pathMatch ? pathMatch[1] : "";
|
|
2913
3676
|
const arrowMatch = pinString.match(/\^\^0~(.+)$/);
|
|
2914
3677
|
const arrow = arrowMatch ? arrowMatch[1] : "";
|
|
2915
|
-
const r = parseFloat(rotation2);
|
|
3678
|
+
const r = Number.parseFloat(rotation2);
|
|
2916
3679
|
return {
|
|
2917
3680
|
type: "PIN",
|
|
2918
3681
|
visibility,
|
|
2919
3682
|
id,
|
|
2920
|
-
pinNumber: isNaN(Number(pinNumber)) ? pinNumber : Number(pinNumber),
|
|
2921
|
-
x: parseFloat(x),
|
|
2922
|
-
y: parseFloat(y),
|
|
3683
|
+
pinNumber: Number.isNaN(Number(pinNumber)) ? pinNumber : Number(pinNumber),
|
|
3684
|
+
x: Number.parseFloat(x),
|
|
3685
|
+
y: Number.parseFloat(y),
|
|
2923
3686
|
rotation: Number.isNaN(r) ? 0 : r,
|
|
2924
3687
|
label,
|
|
2925
3688
|
labelColor,
|
|
@@ -2927,13 +3690,13 @@ var parsePin = (pinString) => {
|
|
|
2927
3690
|
arrow
|
|
2928
3691
|
};
|
|
2929
3692
|
};
|
|
2930
|
-
var PinShapeSchema =
|
|
2931
|
-
var PolylineShapeOutputSchema =
|
|
2932
|
-
type:
|
|
2933
|
-
points:
|
|
2934
|
-
color:
|
|
2935
|
-
lineWidth:
|
|
2936
|
-
id:
|
|
3693
|
+
var PinShapeSchema = z90.string().startsWith("P~").transform(parsePin).pipe(PinShapeOutputSchema);
|
|
3694
|
+
var PolylineShapeOutputSchema = z90.object({
|
|
3695
|
+
type: z90.literal("POLYLINE"),
|
|
3696
|
+
points: z90.array(PointSchema2),
|
|
3697
|
+
color: z90.string(),
|
|
3698
|
+
lineWidth: z90.number(),
|
|
3699
|
+
id: z90.string()
|
|
2937
3700
|
});
|
|
2938
3701
|
var parsePoints2 = (pointsStr) => {
|
|
2939
3702
|
return pointsStr.split(" ").reduce((acc, value, index) => {
|
|
@@ -2956,14 +3719,14 @@ var parsePolyline = (str) => {
|
|
|
2956
3719
|
id
|
|
2957
3720
|
};
|
|
2958
3721
|
};
|
|
2959
|
-
var PolylineShapeSchema =
|
|
2960
|
-
var PolygonShapeOutputSchema =
|
|
2961
|
-
type:
|
|
2962
|
-
points:
|
|
2963
|
-
fillColor:
|
|
2964
|
-
lineWidth:
|
|
2965
|
-
lineColor:
|
|
2966
|
-
id:
|
|
3722
|
+
var PolylineShapeSchema = z90.string().startsWith("PL~").transform(parsePolyline).pipe(PolylineShapeOutputSchema);
|
|
3723
|
+
var PolygonShapeOutputSchema = z90.object({
|
|
3724
|
+
type: z90.literal("POLYGON"),
|
|
3725
|
+
points: z90.array(PointSchema2),
|
|
3726
|
+
fillColor: z90.string(),
|
|
3727
|
+
lineWidth: z90.number(),
|
|
3728
|
+
lineColor: z90.string(),
|
|
3729
|
+
id: z90.string()
|
|
2967
3730
|
});
|
|
2968
3731
|
var parsePolygon = (str) => {
|
|
2969
3732
|
const [, ...rest] = str.split("~");
|
|
@@ -2977,14 +3740,14 @@ var parsePolygon = (str) => {
|
|
|
2977
3740
|
id
|
|
2978
3741
|
};
|
|
2979
3742
|
};
|
|
2980
|
-
var PolygonShapeSchema =
|
|
2981
|
-
var PathShapeOutputSchema =
|
|
2982
|
-
type:
|
|
2983
|
-
pathData:
|
|
2984
|
-
fillColor:
|
|
2985
|
-
strokeWidth:
|
|
2986
|
-
strokeColor:
|
|
2987
|
-
id:
|
|
3743
|
+
var PolygonShapeSchema = z90.string().startsWith("PG~").transform(parsePolygon).pipe(PolygonShapeOutputSchema);
|
|
3744
|
+
var PathShapeOutputSchema = z90.object({
|
|
3745
|
+
type: z90.literal("PATH"),
|
|
3746
|
+
pathData: z90.string(),
|
|
3747
|
+
fillColor: z90.string(),
|
|
3748
|
+
strokeWidth: z90.number(),
|
|
3749
|
+
strokeColor: z90.string(),
|
|
3750
|
+
id: z90.string()
|
|
2988
3751
|
});
|
|
2989
3752
|
var parsePath = (str) => {
|
|
2990
3753
|
const [, pathData, fillColor, strokeWidth, strokeColor, , id] = str.split("~");
|
|
@@ -2997,24 +3760,24 @@ var parsePath = (str) => {
|
|
|
2997
3760
|
id
|
|
2998
3761
|
};
|
|
2999
3762
|
};
|
|
3000
|
-
var PathShapeSchema =
|
|
3001
|
-
var TextShapeOutputSchema =
|
|
3002
|
-
type:
|
|
3003
|
-
alignment:
|
|
3004
|
-
x:
|
|
3005
|
-
y:
|
|
3006
|
-
rotation:
|
|
3007
|
-
fontColor:
|
|
3008
|
-
backgroundColor:
|
|
3009
|
-
fontSize:
|
|
3010
|
-
fontWeight:
|
|
3011
|
-
fontStyle:
|
|
3012
|
-
fontDecoration:
|
|
3013
|
-
content:
|
|
3014
|
-
textType:
|
|
3015
|
-
visibility:
|
|
3016
|
-
mirror:
|
|
3017
|
-
id:
|
|
3763
|
+
var PathShapeSchema = z90.string().startsWith("PT~").transform(parsePath).pipe(PathShapeOutputSchema);
|
|
3764
|
+
var TextShapeOutputSchema = z90.object({
|
|
3765
|
+
type: z90.literal("TEXT"),
|
|
3766
|
+
alignment: z90.enum(["L", "C", "R"]),
|
|
3767
|
+
x: z90.number(),
|
|
3768
|
+
y: z90.number(),
|
|
3769
|
+
rotation: z90.number(),
|
|
3770
|
+
fontColor: z90.string(),
|
|
3771
|
+
backgroundColor: z90.string().optional(),
|
|
3772
|
+
fontSize: z90.string(),
|
|
3773
|
+
fontWeight: z90.enum(["normal", "bold"]).optional().default("normal"),
|
|
3774
|
+
fontStyle: z90.enum(["normal", "italic"]).optional().default("normal"),
|
|
3775
|
+
fontDecoration: z90.enum(["", "underline"]),
|
|
3776
|
+
content: z90.string(),
|
|
3777
|
+
textType: z90.string(),
|
|
3778
|
+
visibility: z90.enum(["0", "1"]),
|
|
3779
|
+
mirror: z90.string(),
|
|
3780
|
+
id: z90.string()
|
|
3018
3781
|
});
|
|
3019
3782
|
var parseText = (str) => {
|
|
3020
3783
|
const [
|
|
@@ -3054,8 +3817,8 @@ var parseText = (str) => {
|
|
|
3054
3817
|
id
|
|
3055
3818
|
};
|
|
3056
3819
|
};
|
|
3057
|
-
var TextShapeSchema =
|
|
3058
|
-
var SingleLetterShapeSchema =
|
|
3820
|
+
var TextShapeSchema = z90.string().startsWith("T~").transform(parseText).pipe(TextShapeOutputSchema);
|
|
3821
|
+
var SingleLetterShapeSchema = z90.string().transform((x) => {
|
|
3059
3822
|
if (x.startsWith("R~")) return RectangleShapeSchema.parse(x);
|
|
3060
3823
|
if (x.startsWith("E~")) return EllipseShapeSchema.parse(x);
|
|
3061
3824
|
if (x.startsWith("P~")) return PinShapeSchema.parse(x);
|
|
@@ -3066,7 +3829,7 @@ var SingleLetterShapeSchema = z85.string().transform((x) => {
|
|
|
3066
3829
|
if (x.startsWith("A~")) return ArcShapeSchema.parse(x);
|
|
3067
3830
|
throw new Error(`Invalid shape type: ${x}`);
|
|
3068
3831
|
}).pipe(
|
|
3069
|
-
|
|
3832
|
+
z90.union([
|
|
3070
3833
|
RectangleShapeOutputSchema,
|
|
3071
3834
|
EllipseShapeOutputSchema,
|
|
3072
3835
|
PinShapeOutputSchema,
|
|
@@ -3079,85 +3842,85 @@ var SingleLetterShapeSchema = z85.string().transform((x) => {
|
|
|
3079
3842
|
);
|
|
3080
3843
|
|
|
3081
3844
|
// lib/schemas/easy-eda-json-schema.ts
|
|
3082
|
-
var maybeNumber =
|
|
3083
|
-
var SzlcscSchema =
|
|
3084
|
-
id:
|
|
3085
|
-
number:
|
|
3086
|
-
step:
|
|
3087
|
-
min:
|
|
3088
|
-
price:
|
|
3089
|
-
stock:
|
|
3090
|
-
url:
|
|
3091
|
-
image:
|
|
3092
|
-
});
|
|
3093
|
-
var LcscSchema =
|
|
3094
|
-
id:
|
|
3095
|
-
number:
|
|
3096
|
-
step:
|
|
3097
|
-
min:
|
|
3098
|
-
price:
|
|
3099
|
-
stock:
|
|
3100
|
-
url:
|
|
3101
|
-
});
|
|
3102
|
-
var OwnerSchema =
|
|
3103
|
-
uuid:
|
|
3104
|
-
username:
|
|
3105
|
-
nickname:
|
|
3106
|
-
avatar:
|
|
3107
|
-
});
|
|
3108
|
-
var HeadSchema =
|
|
3109
|
-
docType:
|
|
3110
|
-
editorVersion:
|
|
3111
|
-
c_para:
|
|
3112
|
-
x:
|
|
3113
|
-
y:
|
|
3114
|
-
puuid:
|
|
3115
|
-
uuid:
|
|
3116
|
-
utime:
|
|
3845
|
+
var maybeNumber = z91.any().transform((k) => k === "nan" || Number.isNaN(k) ? null : k).pipe(z91.number().nullable().optional());
|
|
3846
|
+
var SzlcscSchema = z91.object({
|
|
3847
|
+
id: z91.number(),
|
|
3848
|
+
number: z91.string(),
|
|
3849
|
+
step: z91.number().optional(),
|
|
3850
|
+
min: z91.number().optional(),
|
|
3851
|
+
price: z91.number().optional(),
|
|
3852
|
+
stock: z91.number().optional(),
|
|
3853
|
+
url: z91.string().url().optional(),
|
|
3854
|
+
image: z91.string().optional().optional()
|
|
3855
|
+
});
|
|
3856
|
+
var LcscSchema = z91.object({
|
|
3857
|
+
id: z91.number(),
|
|
3858
|
+
number: z91.string(),
|
|
3859
|
+
step: z91.number().optional(),
|
|
3860
|
+
min: z91.number().optional(),
|
|
3861
|
+
price: z91.number().optional(),
|
|
3862
|
+
stock: z91.number().optional(),
|
|
3863
|
+
url: z91.string().url().optional()
|
|
3864
|
+
});
|
|
3865
|
+
var OwnerSchema = z91.object({
|
|
3866
|
+
uuid: z91.string(),
|
|
3867
|
+
username: z91.string(),
|
|
3868
|
+
nickname: z91.string(),
|
|
3869
|
+
avatar: z91.string()
|
|
3870
|
+
});
|
|
3871
|
+
var HeadSchema = z91.object({
|
|
3872
|
+
docType: z91.preprocess((val) => val == null ? val : String(val), z91.string()),
|
|
3873
|
+
editorVersion: z91.string(),
|
|
3874
|
+
c_para: z91.record(z91.string(), z91.string().nullable()),
|
|
3875
|
+
x: z91.number(),
|
|
3876
|
+
y: z91.number(),
|
|
3877
|
+
puuid: z91.string().optional(),
|
|
3878
|
+
uuid: z91.string(),
|
|
3879
|
+
utime: z91.preprocess((val) => {
|
|
3117
3880
|
if (val === "") return 0;
|
|
3118
3881
|
if (typeof val === "string") return Number(val);
|
|
3119
3882
|
return val;
|
|
3120
|
-
},
|
|
3121
|
-
importFlag:
|
|
3122
|
-
c_spiceCmd:
|
|
3123
|
-
hasIdFlag:
|
|
3124
|
-
});
|
|
3125
|
-
var BBoxSchema =
|
|
3126
|
-
x:
|
|
3127
|
-
y:
|
|
3128
|
-
width:
|
|
3129
|
-
height:
|
|
3130
|
-
});
|
|
3131
|
-
var LayerItemSchema =
|
|
3132
|
-
name:
|
|
3133
|
-
color:
|
|
3134
|
-
visible:
|
|
3135
|
-
active:
|
|
3136
|
-
config:
|
|
3137
|
-
transparency:
|
|
3138
|
-
});
|
|
3139
|
-
var ObjectItemSchema =
|
|
3140
|
-
name:
|
|
3141
|
-
visible:
|
|
3142
|
-
locked:
|
|
3143
|
-
});
|
|
3144
|
-
var DataStrSchema =
|
|
3883
|
+
}, z91.number()),
|
|
3884
|
+
importFlag: z91.number().optional(),
|
|
3885
|
+
c_spiceCmd: z91.any().optional(),
|
|
3886
|
+
hasIdFlag: z91.boolean()
|
|
3887
|
+
});
|
|
3888
|
+
var BBoxSchema = z91.object({
|
|
3889
|
+
x: z91.number(),
|
|
3890
|
+
y: z91.number(),
|
|
3891
|
+
width: z91.number(),
|
|
3892
|
+
height: z91.number()
|
|
3893
|
+
});
|
|
3894
|
+
var LayerItemSchema = z91.object({
|
|
3895
|
+
name: z91.string(),
|
|
3896
|
+
color: z91.string(),
|
|
3897
|
+
visible: z91.boolean(),
|
|
3898
|
+
active: z91.boolean(),
|
|
3899
|
+
config: z91.boolean(),
|
|
3900
|
+
transparency: z91.boolean()
|
|
3901
|
+
});
|
|
3902
|
+
var ObjectItemSchema = z91.object({
|
|
3903
|
+
name: z91.string(),
|
|
3904
|
+
visible: z91.boolean(),
|
|
3905
|
+
locked: z91.boolean()
|
|
3906
|
+
});
|
|
3907
|
+
var DataStrSchema = z91.object({
|
|
3145
3908
|
head: HeadSchema,
|
|
3146
|
-
canvas:
|
|
3147
|
-
shape:
|
|
3909
|
+
canvas: z91.string(),
|
|
3910
|
+
shape: z91.array(SingleLetterShapeSchema),
|
|
3148
3911
|
BBox: BBoxSchema,
|
|
3149
|
-
colors:
|
|
3912
|
+
colors: z91.array(z91.unknown())
|
|
3150
3913
|
});
|
|
3151
|
-
var PackageDetailDataStrSchema =
|
|
3914
|
+
var PackageDetailDataStrSchema = z91.object({
|
|
3152
3915
|
head: HeadSchema,
|
|
3153
|
-
canvas:
|
|
3154
|
-
shape:
|
|
3916
|
+
canvas: z91.string(),
|
|
3917
|
+
shape: z91.array(z91.string()).transform(
|
|
3155
3918
|
(shapes) => shapes.map((shape) => {
|
|
3156
3919
|
const [type, ...data] = shape.split("~");
|
|
3157
3920
|
return ShapeItemSchema.parse({ type, data: data.join("~") });
|
|
3158
3921
|
})
|
|
3159
|
-
).pipe(
|
|
3160
|
-
layers:
|
|
3922
|
+
).pipe(z91.array(PackageDetailShapeSchema)),
|
|
3923
|
+
layers: z91.array(z91.string()).transform(
|
|
3161
3924
|
(layers) => layers.map((layer) => {
|
|
3162
3925
|
const [name, color, visible, active, config, transparency] = layer.split("~");
|
|
3163
3926
|
return LayerItemSchema.parse({
|
|
@@ -3170,7 +3933,7 @@ var PackageDetailDataStrSchema = z86.object({
|
|
|
3170
3933
|
});
|
|
3171
3934
|
})
|
|
3172
3935
|
),
|
|
3173
|
-
objects:
|
|
3936
|
+
objects: z91.array(z91.string()).transform(
|
|
3174
3937
|
(objects) => objects.map((obj) => {
|
|
3175
3938
|
const [name, visible, locked] = obj.split("~");
|
|
3176
3939
|
return ObjectItemSchema.parse({
|
|
@@ -3181,49 +3944,49 @@ var PackageDetailDataStrSchema = z86.object({
|
|
|
3181
3944
|
})
|
|
3182
3945
|
),
|
|
3183
3946
|
BBox: BBoxSchema,
|
|
3184
|
-
netColors:
|
|
3947
|
+
netColors: z91.array(z91.unknown()).optional()
|
|
3185
3948
|
});
|
|
3186
|
-
var PackageDetailSchema =
|
|
3187
|
-
uuid:
|
|
3188
|
-
title:
|
|
3189
|
-
docType:
|
|
3190
|
-
updateTime:
|
|
3949
|
+
var PackageDetailSchema = z91.object({
|
|
3950
|
+
uuid: z91.string(),
|
|
3951
|
+
title: z91.string(),
|
|
3952
|
+
docType: z91.number(),
|
|
3953
|
+
updateTime: z91.number(),
|
|
3191
3954
|
owner: OwnerSchema,
|
|
3192
|
-
datastrid:
|
|
3193
|
-
writable:
|
|
3955
|
+
datastrid: z91.string(),
|
|
3956
|
+
writable: z91.boolean(),
|
|
3194
3957
|
dataStr: PackageDetailDataStrSchema
|
|
3195
3958
|
});
|
|
3196
|
-
var EasyEdaJsonSchema =
|
|
3197
|
-
uuid:
|
|
3198
|
-
title:
|
|
3199
|
-
description:
|
|
3200
|
-
docType:
|
|
3201
|
-
type:
|
|
3959
|
+
var EasyEdaJsonSchema = z91.object({
|
|
3960
|
+
uuid: z91.string(),
|
|
3961
|
+
title: z91.string(),
|
|
3962
|
+
description: z91.string(),
|
|
3963
|
+
docType: z91.number(),
|
|
3964
|
+
type: z91.number(),
|
|
3202
3965
|
szlcsc: SzlcscSchema,
|
|
3203
3966
|
lcsc: LcscSchema,
|
|
3204
3967
|
owner: OwnerSchema,
|
|
3205
|
-
tags:
|
|
3206
|
-
updateTime:
|
|
3207
|
-
updated_at:
|
|
3968
|
+
tags: z91.array(z91.string()),
|
|
3969
|
+
updateTime: z91.number(),
|
|
3970
|
+
updated_at: z91.string(),
|
|
3208
3971
|
dataStr: DataStrSchema,
|
|
3209
|
-
verify:
|
|
3210
|
-
SMT:
|
|
3211
|
-
datastrid:
|
|
3212
|
-
jlcOnSale:
|
|
3213
|
-
writable:
|
|
3214
|
-
isFavorite:
|
|
3972
|
+
verify: z91.boolean(),
|
|
3973
|
+
SMT: z91.boolean().optional(),
|
|
3974
|
+
datastrid: z91.string(),
|
|
3975
|
+
jlcOnSale: z91.number().optional(),
|
|
3976
|
+
writable: z91.boolean(),
|
|
3977
|
+
isFavorite: z91.boolean(),
|
|
3215
3978
|
packageDetail: PackageDetailSchema
|
|
3216
3979
|
});
|
|
3217
3980
|
|
|
3218
3981
|
// lib/websafe/generate-footprint-tsx.ts
|
|
3219
3982
|
import { mmStr } from "@tscircuit/mm";
|
|
3220
3983
|
var generateFootprintTsx = (circuitJson) => {
|
|
3221
|
-
const holes =
|
|
3222
|
-
const platedHoles =
|
|
3223
|
-
const smtPads =
|
|
3224
|
-
const vias =
|
|
3225
|
-
const silkscreenPaths =
|
|
3226
|
-
const silkscreenTexts =
|
|
3984
|
+
const holes = su(circuitJson).pcb_hole.list();
|
|
3985
|
+
const platedHoles = su(circuitJson).pcb_plated_hole.list();
|
|
3986
|
+
const smtPads = su(circuitJson).pcb_smtpad.list();
|
|
3987
|
+
const vias = su(circuitJson).pcb_via.list();
|
|
3988
|
+
const silkscreenPaths = su(circuitJson).pcb_silkscreen_path.list();
|
|
3989
|
+
const silkscreenTexts = su(circuitJson).pcb_silkscreen_text.list();
|
|
3227
3990
|
const elementStrings = [];
|
|
3228
3991
|
for (const hole of holes) {
|
|
3229
3992
|
if (hole.hole_shape === "circle") {
|
|
@@ -3351,7 +4114,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
3351
4114
|
});
|
|
3352
4115
|
const rawPn = betterEasy.dataStr.head.c_para["Manufacturer Part"];
|
|
3353
4116
|
const pn = rawPn ? normalizeManufacturerPartNumber(rawPn) : "unknown";
|
|
3354
|
-
const sourcePorts =
|
|
4117
|
+
const sourcePorts = su(circuitJson).source_port.list();
|
|
3355
4118
|
const pinLabels = {};
|
|
3356
4119
|
const sortedPorts = sourcePorts.sort((a, b) => {
|
|
3357
4120
|
const aNum = Number.parseInt(a.name.replace("pin", ""));
|
|
@@ -3364,7 +4127,7 @@ var convertBetterEasyToTsx = async ({
|
|
|
3364
4127
|
...sourcePort.port_hints ?? []
|
|
3365
4128
|
];
|
|
3366
4129
|
}
|
|
3367
|
-
const [cadComponent] =
|
|
4130
|
+
const [cadComponent] = su(circuitJson).cad_component.list();
|
|
3368
4131
|
let modelObjUrl;
|
|
3369
4132
|
if (cadComponent?.model_obj_url) {
|
|
3370
4133
|
const isValidUrl = await checkModelObjUrlValidity(
|
|
@@ -3487,4 +4250,4 @@ export {
|
|
|
3487
4250
|
convertRawEasyToTsx,
|
|
3488
4251
|
convertEasyEdaJsonToVariousFormats
|
|
3489
4252
|
};
|
|
3490
|
-
//# sourceMappingURL=chunk-
|
|
4253
|
+
//# sourceMappingURL=chunk-E6OHT5YV.js.map
|