circuit-json 0.0.81 → 0.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +296 -20
- package/dist/index.mjs +295 -198
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -1,52 +1,134 @@
|
|
|
1
1
|
// src/utils/convert-si-unit-to-number.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
var unitMappings = {
|
|
3
|
+
Hz: {
|
|
4
|
+
baseUnit: "Hz",
|
|
5
|
+
variants: {
|
|
6
|
+
MHz: 1e6,
|
|
7
|
+
kHz: 1e3,
|
|
8
|
+
Hz: 1
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
g: {
|
|
12
|
+
baseUnit: "g",
|
|
13
|
+
variants: {
|
|
14
|
+
kg: 1e3,
|
|
15
|
+
g: 1
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
\u03A9: {
|
|
19
|
+
baseUnit: "\u03A9",
|
|
20
|
+
variants: {
|
|
21
|
+
m\u03A9: 1e-3,
|
|
22
|
+
\u03A9: 1,
|
|
23
|
+
k\u03A9: 1e3,
|
|
24
|
+
M\u03A9: 1e6,
|
|
25
|
+
G\u03A9: 1e9,
|
|
26
|
+
T\u03A9: 1e12
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
V: {
|
|
30
|
+
baseUnit: "V",
|
|
31
|
+
variants: {
|
|
32
|
+
mV: 1e-3,
|
|
33
|
+
V: 1,
|
|
34
|
+
kV: 1e3,
|
|
35
|
+
MV: 1e6,
|
|
36
|
+
GV: 1e9,
|
|
37
|
+
TV: 1e12
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
A: {
|
|
41
|
+
baseUnit: "A",
|
|
42
|
+
variants: {
|
|
43
|
+
\u00B5A: 1e-6,
|
|
44
|
+
mA: 1e-3,
|
|
45
|
+
ma: 1e-3,
|
|
46
|
+
A: 1,
|
|
47
|
+
kA: 1e3,
|
|
48
|
+
MA: 1e6
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
F: {
|
|
52
|
+
baseUnit: "F",
|
|
53
|
+
variants: {
|
|
54
|
+
pF: 1e-12,
|
|
55
|
+
nF: 1e-9,
|
|
56
|
+
\u00B5F: 1e-6,
|
|
57
|
+
mF: 1e-3,
|
|
58
|
+
F: 1
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
ml: {
|
|
62
|
+
baseUnit: "ml",
|
|
63
|
+
variants: {
|
|
64
|
+
ml: 1,
|
|
65
|
+
mL: 1,
|
|
66
|
+
l: 1e3,
|
|
67
|
+
L: 1e3
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
deg: {
|
|
71
|
+
baseUnit: "deg",
|
|
72
|
+
variants: {
|
|
73
|
+
rad: 180 / Math.PI
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
ms: {
|
|
77
|
+
baseUnit: "ms",
|
|
78
|
+
variants: {
|
|
79
|
+
s: 1e3
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
mm: {
|
|
83
|
+
baseUnit: "mm",
|
|
84
|
+
variants: {
|
|
85
|
+
nm: 1e-6,
|
|
86
|
+
\u00B5m: 1e-3,
|
|
87
|
+
um: 1e-3,
|
|
88
|
+
mm: 1,
|
|
89
|
+
cm: 10,
|
|
90
|
+
dm: 100,
|
|
91
|
+
m: 1e3,
|
|
92
|
+
km: 1e6,
|
|
93
|
+
in: 25.4,
|
|
94
|
+
ft: 304.8,
|
|
95
|
+
IN: 25.4,
|
|
96
|
+
FT: 304.8,
|
|
97
|
+
yd: 914.4,
|
|
98
|
+
mi: 1609344
|
|
99
|
+
}
|
|
100
|
+
}
|
|
33
101
|
};
|
|
34
|
-
function
|
|
35
|
-
for (const
|
|
36
|
-
if (
|
|
37
|
-
return
|
|
102
|
+
function getBaseTscircuitUnit(unit) {
|
|
103
|
+
for (const [baseUnit, info] of Object.entries(unitMappings)) {
|
|
104
|
+
if (unit in info.variants) {
|
|
105
|
+
return {
|
|
106
|
+
baseUnit: info.baseUnit,
|
|
107
|
+
conversionFactor: info.variants[unit]
|
|
108
|
+
};
|
|
38
109
|
}
|
|
39
110
|
}
|
|
40
|
-
return
|
|
111
|
+
return {
|
|
112
|
+
baseUnit: unit,
|
|
113
|
+
conversionFactor: 1
|
|
114
|
+
};
|
|
41
115
|
}
|
|
42
116
|
var parseAndConvertSiUnit = (v) => {
|
|
43
|
-
if (typeof v === "undefined")
|
|
117
|
+
if (typeof v === "undefined")
|
|
118
|
+
return { parsedUnit: null, unitOfValue: null, value: null };
|
|
44
119
|
if (typeof v === "string" && v.match(/^[\d\.]+$/))
|
|
45
|
-
return {
|
|
46
|
-
|
|
120
|
+
return {
|
|
121
|
+
value: Number.parseFloat(v),
|
|
122
|
+
parsedUnit: null,
|
|
123
|
+
unitOfValue: null
|
|
124
|
+
};
|
|
125
|
+
if (typeof v === "number")
|
|
126
|
+
return { value: v, parsedUnit: null, unitOfValue: null };
|
|
47
127
|
if (typeof v === "object" && "x" in v && "y" in v) {
|
|
128
|
+
const { parsedUnit, unitOfValue } = parseAndConvertSiUnit(v.x);
|
|
48
129
|
return {
|
|
49
|
-
|
|
130
|
+
parsedUnit,
|
|
131
|
+
unitOfValue,
|
|
50
132
|
value: {
|
|
51
133
|
x: parseAndConvertSiUnit(v.x).value,
|
|
52
134
|
y: parseAndConvertSiUnit(v.y).value
|
|
@@ -59,28 +141,12 @@ var parseAndConvertSiUnit = (v) => {
|
|
|
59
141
|
}
|
|
60
142
|
const unit = unit_reversed.split("").reverse().join("");
|
|
61
143
|
const value = v.slice(0, -unit.length);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const target_unit = target_conversion[measure];
|
|
69
|
-
if (!target_unit) {
|
|
70
|
-
throw new Error(
|
|
71
|
-
`Could not determine target unit for measure: "${measure}"`
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
unit,
|
|
76
|
-
value: convertUnits(parseFloat(value)).from(unit).to(target_unit)
|
|
77
|
-
};
|
|
78
|
-
} else {
|
|
79
|
-
return {
|
|
80
|
-
unit,
|
|
81
|
-
value: getSiPrefixMultiplierFromUnit(unit) * parseFloat(value)
|
|
82
|
-
};
|
|
83
|
-
}
|
|
144
|
+
const { baseUnit, conversionFactor } = getBaseTscircuitUnit(unit);
|
|
145
|
+
return {
|
|
146
|
+
parsedUnit: unit,
|
|
147
|
+
unitOfValue: baseUnit,
|
|
148
|
+
value: conversionFactor * Number.parseFloat(value)
|
|
149
|
+
};
|
|
84
150
|
};
|
|
85
151
|
|
|
86
152
|
// src/units/index.ts
|
|
@@ -599,68 +665,97 @@ var pcb_smtpad = z38.union([pcb_smtpad_circle, pcb_smtpad_rect]).describe("Defin
|
|
|
599
665
|
expectTypesMatch(true);
|
|
600
666
|
expectTypesMatch(true);
|
|
601
667
|
|
|
602
|
-
// src/pcb/
|
|
668
|
+
// src/pcb/pcb_solder_paste.ts
|
|
603
669
|
import { z as z39 } from "zod";
|
|
604
|
-
var
|
|
605
|
-
type: z39.literal("
|
|
670
|
+
var pcb_solder_paste_circle = z39.object({
|
|
671
|
+
type: z39.literal("pcb_solder_paste"),
|
|
672
|
+
shape: z39.literal("circle"),
|
|
673
|
+
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
674
|
+
x: distance,
|
|
675
|
+
y: distance,
|
|
676
|
+
radius: z39.number(),
|
|
677
|
+
layer: layer_ref,
|
|
678
|
+
pcb_component_id: z39.string().optional(),
|
|
679
|
+
pcb_smtpad_id: z39.string().optional()
|
|
680
|
+
});
|
|
681
|
+
var pcb_solder_paste_rect = z39.object({
|
|
682
|
+
type: z39.literal("pcb_solder_paste"),
|
|
683
|
+
shape: z39.literal("rect"),
|
|
684
|
+
pcb_solder_paste_id: getZodPrefixedIdWithDefault("pcb_solder_paste"),
|
|
685
|
+
x: distance,
|
|
686
|
+
y: distance,
|
|
687
|
+
width: z39.number(),
|
|
688
|
+
height: z39.number(),
|
|
689
|
+
layer: layer_ref,
|
|
690
|
+
pcb_component_id: z39.string().optional(),
|
|
691
|
+
pcb_smtpad_id: z39.string().optional()
|
|
692
|
+
});
|
|
693
|
+
var pcb_solder_paste = z39.union([pcb_solder_paste_circle, pcb_solder_paste_rect]).describe("Defines solderpaste on the PCB");
|
|
694
|
+
expectTypesMatch(true);
|
|
695
|
+
expectTypesMatch(true);
|
|
696
|
+
|
|
697
|
+
// src/pcb/pcb_text.ts
|
|
698
|
+
import { z as z40 } from "zod";
|
|
699
|
+
var pcb_text = z40.object({
|
|
700
|
+
type: z40.literal("pcb_text"),
|
|
606
701
|
pcb_text_id: getZodPrefixedIdWithDefault("pcb_text"),
|
|
607
|
-
text:
|
|
702
|
+
text: z40.string(),
|
|
608
703
|
center: point,
|
|
609
704
|
layer: layer_ref,
|
|
610
705
|
width: length,
|
|
611
706
|
height: length,
|
|
612
|
-
lines:
|
|
613
|
-
align:
|
|
707
|
+
lines: z40.number(),
|
|
708
|
+
align: z40.enum(["bottom-left"])
|
|
614
709
|
}).describe("Defines text on the PCB");
|
|
615
710
|
expectTypesMatch(true);
|
|
616
711
|
|
|
617
712
|
// src/pcb/pcb_trace.ts
|
|
618
|
-
import { z as
|
|
619
|
-
var pcb_trace_route_point_wire =
|
|
620
|
-
route_type:
|
|
713
|
+
import { z as z41 } from "zod";
|
|
714
|
+
var pcb_trace_route_point_wire = z41.object({
|
|
715
|
+
route_type: z41.literal("wire"),
|
|
621
716
|
x: distance,
|
|
622
717
|
y: distance,
|
|
623
718
|
width: distance,
|
|
624
|
-
start_pcb_port_id:
|
|
625
|
-
end_pcb_port_id:
|
|
719
|
+
start_pcb_port_id: z41.string().optional(),
|
|
720
|
+
end_pcb_port_id: z41.string().optional(),
|
|
626
721
|
layer: layer_ref
|
|
627
722
|
});
|
|
628
|
-
var pcb_trace_route_point_via =
|
|
629
|
-
route_type:
|
|
723
|
+
var pcb_trace_route_point_via = z41.object({
|
|
724
|
+
route_type: z41.literal("via"),
|
|
630
725
|
x: distance,
|
|
631
726
|
y: distance,
|
|
632
|
-
from_layer:
|
|
633
|
-
to_layer:
|
|
727
|
+
from_layer: z41.string(),
|
|
728
|
+
to_layer: z41.string()
|
|
634
729
|
});
|
|
635
|
-
var pcb_trace_route_point =
|
|
730
|
+
var pcb_trace_route_point = z41.union([
|
|
636
731
|
pcb_trace_route_point_wire,
|
|
637
732
|
pcb_trace_route_point_via
|
|
638
733
|
]);
|
|
639
|
-
var pcb_trace =
|
|
640
|
-
type:
|
|
641
|
-
source_trace_id:
|
|
642
|
-
pcb_component_id:
|
|
734
|
+
var pcb_trace = z41.object({
|
|
735
|
+
type: z41.literal("pcb_trace"),
|
|
736
|
+
source_trace_id: z41.string().optional(),
|
|
737
|
+
pcb_component_id: z41.string().optional(),
|
|
643
738
|
pcb_trace_id: getZodPrefixedIdWithDefault("pcb_trace"),
|
|
644
|
-
route_thickness_mode:
|
|
645
|
-
route_order_index:
|
|
646
|
-
should_round_corners:
|
|
647
|
-
route:
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
route_type:
|
|
739
|
+
route_thickness_mode: z41.enum(["constant", "interpolated"]).default("constant").optional(),
|
|
740
|
+
route_order_index: z41.number().optional(),
|
|
741
|
+
should_round_corners: z41.boolean().optional(),
|
|
742
|
+
route: z41.array(
|
|
743
|
+
z41.union([
|
|
744
|
+
z41.object({
|
|
745
|
+
route_type: z41.literal("wire"),
|
|
651
746
|
x: distance,
|
|
652
747
|
y: distance,
|
|
653
748
|
width: distance,
|
|
654
|
-
start_pcb_port_id:
|
|
655
|
-
end_pcb_port_id:
|
|
749
|
+
start_pcb_port_id: z41.string().optional(),
|
|
750
|
+
end_pcb_port_id: z41.string().optional(),
|
|
656
751
|
layer: layer_ref
|
|
657
752
|
}),
|
|
658
|
-
|
|
659
|
-
route_type:
|
|
753
|
+
z41.object({
|
|
754
|
+
route_type: z41.literal("via"),
|
|
660
755
|
x: distance,
|
|
661
756
|
y: distance,
|
|
662
|
-
from_layer:
|
|
663
|
-
to_layer:
|
|
757
|
+
from_layer: z41.string(),
|
|
758
|
+
to_layer: z41.string()
|
|
664
759
|
})
|
|
665
760
|
])
|
|
666
761
|
)
|
|
@@ -669,34 +764,34 @@ expectTypesMatch(true);
|
|
|
669
764
|
expectTypesMatch(true);
|
|
670
765
|
|
|
671
766
|
// src/pcb/pcb_trace_error.ts
|
|
672
|
-
import { z as
|
|
673
|
-
var pcb_trace_error =
|
|
674
|
-
type:
|
|
767
|
+
import { z as z42 } from "zod";
|
|
768
|
+
var pcb_trace_error = z42.object({
|
|
769
|
+
type: z42.literal("pcb_trace_error"),
|
|
675
770
|
pcb_trace_error_id: getZodPrefixedIdWithDefault("pcb_trace_error"),
|
|
676
|
-
error_type:
|
|
677
|
-
message:
|
|
771
|
+
error_type: z42.literal("pcb_trace_error"),
|
|
772
|
+
message: z42.string(),
|
|
678
773
|
center: point.optional(),
|
|
679
|
-
pcb_trace_id:
|
|
680
|
-
source_trace_id:
|
|
681
|
-
pcb_component_ids:
|
|
682
|
-
pcb_port_ids:
|
|
774
|
+
pcb_trace_id: z42.string(),
|
|
775
|
+
source_trace_id: z42.string(),
|
|
776
|
+
pcb_component_ids: z42.array(z42.string()),
|
|
777
|
+
pcb_port_ids: z42.array(z42.string())
|
|
683
778
|
}).describe("Defines a trace error on the PCB");
|
|
684
779
|
expectTypesMatch(true);
|
|
685
780
|
|
|
686
781
|
// src/pcb/pcb_port_not_matched_error.ts
|
|
687
|
-
import { z as
|
|
688
|
-
var pcb_port_not_matched_error =
|
|
689
|
-
type:
|
|
782
|
+
import { z as z43 } from "zod";
|
|
783
|
+
var pcb_port_not_matched_error = z43.object({
|
|
784
|
+
type: z43.literal("pcb_port_not_matched_error"),
|
|
690
785
|
pcb_error_id: getZodPrefixedIdWithDefault("pcb_error"),
|
|
691
|
-
message:
|
|
692
|
-
pcb_component_ids:
|
|
786
|
+
message: z43.string(),
|
|
787
|
+
pcb_component_ids: z43.array(z43.string())
|
|
693
788
|
}).describe("Defines a trace error on the PCB where a port is not matched");
|
|
694
789
|
expectTypesMatch(true);
|
|
695
790
|
|
|
696
791
|
// src/pcb/pcb_via.ts
|
|
697
|
-
import { z as
|
|
698
|
-
var pcb_via =
|
|
699
|
-
type:
|
|
792
|
+
import { z as z44 } from "zod";
|
|
793
|
+
var pcb_via = z44.object({
|
|
794
|
+
type: z44.literal("pcb_via"),
|
|
700
795
|
pcb_via_id: getZodPrefixedIdWithDefault("pcb_via"),
|
|
701
796
|
x: distance,
|
|
702
797
|
y: distance,
|
|
@@ -706,51 +801,51 @@ var pcb_via = z43.object({
|
|
|
706
801
|
from_layer: layer_ref.optional(),
|
|
707
802
|
/** @deprecated */
|
|
708
803
|
to_layer: layer_ref.optional(),
|
|
709
|
-
layers:
|
|
710
|
-
pcb_trace_id:
|
|
804
|
+
layers: z44.array(layer_ref),
|
|
805
|
+
pcb_trace_id: z44.string().optional()
|
|
711
806
|
}).describe("Defines a via on the PCB");
|
|
712
807
|
expectTypesMatch(true);
|
|
713
808
|
|
|
714
809
|
// src/pcb/pcb_board.ts
|
|
715
|
-
import { z as
|
|
716
|
-
var pcb_board =
|
|
717
|
-
type:
|
|
810
|
+
import { z as z45 } from "zod";
|
|
811
|
+
var pcb_board = z45.object({
|
|
812
|
+
type: z45.literal("pcb_board"),
|
|
718
813
|
pcb_board_id: getZodPrefixedIdWithDefault("pcb_board"),
|
|
719
814
|
width: length,
|
|
720
815
|
height: length,
|
|
721
816
|
center: point,
|
|
722
817
|
thickness: length.optional().default(1.4),
|
|
723
|
-
num_layers:
|
|
724
|
-
outline:
|
|
818
|
+
num_layers: z45.number().optional().default(4),
|
|
819
|
+
outline: z45.array(point).optional()
|
|
725
820
|
}).describe("Defines the board outline of the PCB");
|
|
726
821
|
expectTypesMatch(true);
|
|
727
822
|
|
|
728
823
|
// src/pcb/pcb_placement_error.ts
|
|
729
|
-
import { z as
|
|
730
|
-
var pcb_placement_error =
|
|
731
|
-
type:
|
|
824
|
+
import { z as z46 } from "zod";
|
|
825
|
+
var pcb_placement_error = z46.object({
|
|
826
|
+
type: z46.literal("pcb_placement_error"),
|
|
732
827
|
pcb_placement_error_id: getZodPrefixedIdWithDefault("pcb_placement_error"),
|
|
733
|
-
message:
|
|
828
|
+
message: z46.string()
|
|
734
829
|
}).describe("Defines a placement error on the PCB");
|
|
735
830
|
expectTypesMatch(true);
|
|
736
831
|
|
|
737
832
|
// src/pcb/pcb_trace_hint.ts
|
|
738
|
-
import { z as
|
|
739
|
-
var pcb_trace_hint =
|
|
740
|
-
type:
|
|
833
|
+
import { z as z47 } from "zod";
|
|
834
|
+
var pcb_trace_hint = z47.object({
|
|
835
|
+
type: z47.literal("pcb_trace_hint"),
|
|
741
836
|
pcb_trace_hint_id: getZodPrefixedIdWithDefault("pcb_trace_hint"),
|
|
742
|
-
pcb_port_id:
|
|
743
|
-
pcb_component_id:
|
|
744
|
-
route:
|
|
837
|
+
pcb_port_id: z47.string(),
|
|
838
|
+
pcb_component_id: z47.string(),
|
|
839
|
+
route: z47.array(route_hint_point)
|
|
745
840
|
}).describe("A hint that can be used during generation of a PCB trace");
|
|
746
841
|
expectTypesMatch(true);
|
|
747
842
|
|
|
748
843
|
// src/pcb/pcb_silkscreen_line.ts
|
|
749
|
-
import { z as
|
|
750
|
-
var pcb_silkscreen_line =
|
|
751
|
-
type:
|
|
844
|
+
import { z as z48 } from "zod";
|
|
845
|
+
var pcb_silkscreen_line = z48.object({
|
|
846
|
+
type: z48.literal("pcb_silkscreen_line"),
|
|
752
847
|
pcb_silkscreen_line_id: getZodPrefixedIdWithDefault("pcb_silkscreen_line"),
|
|
753
|
-
pcb_component_id:
|
|
848
|
+
pcb_component_id: z48.string(),
|
|
754
849
|
stroke_width: distance.default("0.1mm"),
|
|
755
850
|
x1: distance,
|
|
756
851
|
y1: distance,
|
|
@@ -761,39 +856,39 @@ var pcb_silkscreen_line = z47.object({
|
|
|
761
856
|
expectTypesMatch(true);
|
|
762
857
|
|
|
763
858
|
// src/pcb/pcb_silkscreen_path.ts
|
|
764
|
-
import { z as
|
|
765
|
-
var pcb_silkscreen_path =
|
|
766
|
-
type:
|
|
859
|
+
import { z as z49 } from "zod";
|
|
860
|
+
var pcb_silkscreen_path = z49.object({
|
|
861
|
+
type: z49.literal("pcb_silkscreen_path"),
|
|
767
862
|
pcb_silkscreen_path_id: getZodPrefixedIdWithDefault("pcb_silkscreen_path"),
|
|
768
|
-
pcb_component_id:
|
|
863
|
+
pcb_component_id: z49.string(),
|
|
769
864
|
layer: visible_layer,
|
|
770
|
-
route:
|
|
865
|
+
route: z49.array(point),
|
|
771
866
|
stroke_width: length
|
|
772
867
|
}).describe("Defines a silkscreen path on the PCB");
|
|
773
868
|
expectTypesMatch(true);
|
|
774
869
|
|
|
775
870
|
// src/pcb/pcb_silkscreen_text.ts
|
|
776
|
-
import { z as
|
|
777
|
-
var pcb_silkscreen_text =
|
|
778
|
-
type:
|
|
871
|
+
import { z as z50 } from "zod";
|
|
872
|
+
var pcb_silkscreen_text = z50.object({
|
|
873
|
+
type: z50.literal("pcb_silkscreen_text"),
|
|
779
874
|
pcb_silkscreen_text_id: getZodPrefixedIdWithDefault("pcb_silkscreen_text"),
|
|
780
|
-
font:
|
|
875
|
+
font: z50.literal("tscircuit2024").default("tscircuit2024"),
|
|
781
876
|
font_size: distance.default("0.2mm"),
|
|
782
|
-
pcb_component_id:
|
|
783
|
-
text:
|
|
877
|
+
pcb_component_id: z50.string(),
|
|
878
|
+
text: z50.string(),
|
|
784
879
|
layer: layer_ref,
|
|
785
|
-
is_mirrored:
|
|
880
|
+
is_mirrored: z50.boolean().default(false).optional(),
|
|
786
881
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
787
|
-
anchor_alignment:
|
|
882
|
+
anchor_alignment: z50.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center")
|
|
788
883
|
}).describe("Defines silkscreen text on the PCB");
|
|
789
884
|
expectTypesMatch(true);
|
|
790
885
|
|
|
791
886
|
// src/pcb/pcb_silkscreen_rect.ts
|
|
792
|
-
import { z as
|
|
793
|
-
var pcb_silkscreen_rect =
|
|
794
|
-
type:
|
|
887
|
+
import { z as z51 } from "zod";
|
|
888
|
+
var pcb_silkscreen_rect = z51.object({
|
|
889
|
+
type: z51.literal("pcb_silkscreen_rect"),
|
|
795
890
|
pcb_silkscreen_rect_id: getZodPrefixedIdWithDefault("pcb_silkscreen_rect"),
|
|
796
|
-
pcb_component_id:
|
|
891
|
+
pcb_component_id: z51.string(),
|
|
797
892
|
center: point,
|
|
798
893
|
width: length,
|
|
799
894
|
height: length,
|
|
@@ -802,13 +897,13 @@ var pcb_silkscreen_rect = z50.object({
|
|
|
802
897
|
expectTypesMatch(true);
|
|
803
898
|
|
|
804
899
|
// src/pcb/pcb_silkscreen_circle.ts
|
|
805
|
-
import { z as
|
|
806
|
-
var pcb_silkscreen_circle =
|
|
807
|
-
type:
|
|
900
|
+
import { z as z52 } from "zod";
|
|
901
|
+
var pcb_silkscreen_circle = z52.object({
|
|
902
|
+
type: z52.literal("pcb_silkscreen_circle"),
|
|
808
903
|
pcb_silkscreen_circle_id: getZodPrefixedIdWithDefault(
|
|
809
904
|
"pcb_silkscreen_circle"
|
|
810
905
|
),
|
|
811
|
-
pcb_component_id:
|
|
906
|
+
pcb_component_id: z52.string(),
|
|
812
907
|
center: point,
|
|
813
908
|
radius: length,
|
|
814
909
|
layer: visible_layer
|
|
@@ -816,11 +911,11 @@ var pcb_silkscreen_circle = z51.object({
|
|
|
816
911
|
expectTypesMatch(true);
|
|
817
912
|
|
|
818
913
|
// src/pcb/pcb_silkscreen_oval.ts
|
|
819
|
-
import { z as
|
|
820
|
-
var pcb_silkscreen_oval =
|
|
821
|
-
type:
|
|
914
|
+
import { z as z53 } from "zod";
|
|
915
|
+
var pcb_silkscreen_oval = z53.object({
|
|
916
|
+
type: z53.literal("pcb_silkscreen_oval"),
|
|
822
917
|
pcb_silkscreen_oval_id: getZodPrefixedIdWithDefault("pcb_silkscreen_oval"),
|
|
823
|
-
pcb_component_id:
|
|
918
|
+
pcb_component_id: z53.string(),
|
|
824
919
|
center: point,
|
|
825
920
|
radius_x: distance,
|
|
826
921
|
radius_y: distance,
|
|
@@ -829,91 +924,91 @@ var pcb_silkscreen_oval = z52.object({
|
|
|
829
924
|
expectTypesMatch(true);
|
|
830
925
|
|
|
831
926
|
// src/pcb/pcb_fabrication_note_text.ts
|
|
832
|
-
import { z as
|
|
833
|
-
var pcb_fabrication_note_text =
|
|
834
|
-
type:
|
|
927
|
+
import { z as z54 } from "zod";
|
|
928
|
+
var pcb_fabrication_note_text = z54.object({
|
|
929
|
+
type: z54.literal("pcb_fabrication_note_text"),
|
|
835
930
|
pcb_fabrication_note_text_id: getZodPrefixedIdWithDefault(
|
|
836
931
|
"pcb_fabrication_note_text"
|
|
837
932
|
),
|
|
838
|
-
font:
|
|
933
|
+
font: z54.literal("tscircuit2024").default("tscircuit2024"),
|
|
839
934
|
font_size: distance.default("1mm"),
|
|
840
|
-
pcb_component_id:
|
|
841
|
-
text:
|
|
935
|
+
pcb_component_id: z54.string(),
|
|
936
|
+
text: z54.string(),
|
|
842
937
|
layer: visible_layer,
|
|
843
938
|
anchor_position: point.default({ x: 0, y: 0 }),
|
|
844
|
-
anchor_alignment:
|
|
845
|
-
color:
|
|
939
|
+
anchor_alignment: z54.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
940
|
+
color: z54.string().optional()
|
|
846
941
|
}).describe(
|
|
847
942
|
"Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"
|
|
848
943
|
);
|
|
849
944
|
expectTypesMatch(true);
|
|
850
945
|
|
|
851
946
|
// src/pcb/pcb_fabrication_note_path.ts
|
|
852
|
-
import { z as
|
|
853
|
-
var pcb_fabrication_note_path =
|
|
854
|
-
type:
|
|
947
|
+
import { z as z55 } from "zod";
|
|
948
|
+
var pcb_fabrication_note_path = z55.object({
|
|
949
|
+
type: z55.literal("pcb_fabrication_note_path"),
|
|
855
950
|
pcb_fabrication_note_path_id: getZodPrefixedIdWithDefault(
|
|
856
951
|
"pcb_fabrication_note_path"
|
|
857
952
|
),
|
|
858
|
-
pcb_component_id:
|
|
953
|
+
pcb_component_id: z55.string(),
|
|
859
954
|
layer: layer_ref,
|
|
860
|
-
route:
|
|
955
|
+
route: z55.array(point),
|
|
861
956
|
stroke_width: length,
|
|
862
|
-
color:
|
|
957
|
+
color: z55.string().optional()
|
|
863
958
|
}).describe(
|
|
864
959
|
"Defines a fabrication path on the PCB for fabricators or assemblers"
|
|
865
960
|
);
|
|
866
961
|
expectTypesMatch(true);
|
|
867
962
|
|
|
868
963
|
// src/pcb/pcb_keepout.ts
|
|
869
|
-
import { z as
|
|
870
|
-
var pcb_keepout =
|
|
871
|
-
type:
|
|
872
|
-
shape:
|
|
964
|
+
import { z as z56 } from "zod";
|
|
965
|
+
var pcb_keepout = z56.object({
|
|
966
|
+
type: z56.literal("pcb_keepout"),
|
|
967
|
+
shape: z56.literal("rect"),
|
|
873
968
|
center: point,
|
|
874
969
|
width: distance,
|
|
875
970
|
height: distance,
|
|
876
|
-
pcb_keepout_id:
|
|
877
|
-
layers:
|
|
971
|
+
pcb_keepout_id: z56.string(),
|
|
972
|
+
layers: z56.array(z56.string()),
|
|
878
973
|
// Specify layers where the keepout applies
|
|
879
|
-
description:
|
|
974
|
+
description: z56.string().optional()
|
|
880
975
|
// Optional description of the keepout
|
|
881
976
|
}).or(
|
|
882
|
-
|
|
883
|
-
type:
|
|
884
|
-
shape:
|
|
977
|
+
z56.object({
|
|
978
|
+
type: z56.literal("pcb_keepout"),
|
|
979
|
+
shape: z56.literal("circle"),
|
|
885
980
|
center: point,
|
|
886
981
|
radius: distance,
|
|
887
|
-
pcb_keepout_id:
|
|
888
|
-
layers:
|
|
982
|
+
pcb_keepout_id: z56.string(),
|
|
983
|
+
layers: z56.array(z56.string()),
|
|
889
984
|
// Specify layers where the keepout applies
|
|
890
|
-
description:
|
|
985
|
+
description: z56.string().optional()
|
|
891
986
|
// Optional description of the keepout
|
|
892
987
|
})
|
|
893
988
|
);
|
|
894
989
|
|
|
895
990
|
// src/cad/cad_component.ts
|
|
896
|
-
import { z as
|
|
897
|
-
var cad_component =
|
|
898
|
-
type:
|
|
899
|
-
cad_component_id:
|
|
900
|
-
pcb_component_id:
|
|
901
|
-
source_component_id:
|
|
991
|
+
import { z as z57 } from "zod";
|
|
992
|
+
var cad_component = z57.object({
|
|
993
|
+
type: z57.literal("cad_component"),
|
|
994
|
+
cad_component_id: z57.string(),
|
|
995
|
+
pcb_component_id: z57.string(),
|
|
996
|
+
source_component_id: z57.string(),
|
|
902
997
|
position: point3,
|
|
903
998
|
rotation: point3.optional(),
|
|
904
999
|
size: point3.optional(),
|
|
905
1000
|
layer: layer_ref.optional(),
|
|
906
1001
|
// These are all ways to generate/load the 3d model
|
|
907
|
-
footprinter_string:
|
|
908
|
-
model_obj_url:
|
|
909
|
-
model_stl_url:
|
|
910
|
-
model_3mf_url:
|
|
911
|
-
model_jscad:
|
|
1002
|
+
footprinter_string: z57.string().optional(),
|
|
1003
|
+
model_obj_url: z57.string().optional(),
|
|
1004
|
+
model_stl_url: z57.string().optional(),
|
|
1005
|
+
model_3mf_url: z57.string().optional(),
|
|
1006
|
+
model_jscad: z57.any().optional()
|
|
912
1007
|
}).describe("Defines a component on the PCB");
|
|
913
1008
|
|
|
914
1009
|
// src/any_circuit_element.ts
|
|
915
|
-
import { z as
|
|
916
|
-
var any_circuit_element =
|
|
1010
|
+
import { z as z58 } from "zod";
|
|
1011
|
+
var any_circuit_element = z58.union([
|
|
917
1012
|
source_trace,
|
|
918
1013
|
source_port,
|
|
919
1014
|
any_source_component,
|
|
@@ -935,6 +1030,7 @@ var any_circuit_element = z57.union([
|
|
|
935
1030
|
pcb_trace,
|
|
936
1031
|
pcb_via,
|
|
937
1032
|
pcb_smtpad,
|
|
1033
|
+
pcb_solder_paste,
|
|
938
1034
|
pcb_board,
|
|
939
1035
|
pcb_trace_hint,
|
|
940
1036
|
pcb_silkscreen_line,
|
|
@@ -995,6 +1091,7 @@ export {
|
|
|
995
1091
|
pcb_silkscreen_rect,
|
|
996
1092
|
pcb_silkscreen_text,
|
|
997
1093
|
pcb_smtpad,
|
|
1094
|
+
pcb_solder_paste,
|
|
998
1095
|
pcb_text,
|
|
999
1096
|
pcb_trace,
|
|
1000
1097
|
pcb_trace_error,
|