@tscircuit/props 0.0.129 → 0.0.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1257 -1215
- package/dist/index.js +165 -104
- package/dist/index.js.map +1 -1
- package/lib/common/layout.ts +3 -0
- package/lib/components/diode.ts +6 -0
- package/lib/components/fabrication-note-path.ts +12 -0
- package/lib/components/fabrication-note-text.ts +14 -0
- package/lib/components/group.ts +2 -0
- package/lib/components/inductor.ts +9 -0
- package/lib/components/led.ts +8 -0
- package/lib/components/pcb-keepout.ts +16 -0
- package/lib/components/pcb-trace.ts +9 -0
- package/lib/components/port.ts +11 -0
- package/lib/components/power-source.ts +8 -0
- package/lib/components/schematic-box.ts +10 -0
- package/lib/components/schematic-line.ts +10 -0
- package/lib/components/schematic-path.ts +9 -0
- package/lib/components/schematic-text.ts +9 -0
- package/lib/components/silkscreen-circle.ts +13 -0
- package/lib/components/silkscreen-line.ts +14 -0
- package/lib/components/silkscreen-path.ts +11 -0
- package/lib/components/silkscreen-rect.ts +14 -0
- package/lib/components/silkscreen-text.ts +13 -0
- package/lib/components/switch.ts +9 -0
- package/lib/components/trace-hint.ts +27 -0
- package/lib/components/via.ts +11 -0
- package/lib/index.ts +21 -232
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
// lib/index.ts
|
|
2
|
-
import {
|
|
3
|
-
distance as distance12,
|
|
4
|
-
inductance,
|
|
5
|
-
layer_ref as layer_ref4,
|
|
6
|
-
length as length3,
|
|
7
|
-
point as point5,
|
|
8
|
-
route_hint_point as route_hint_point4,
|
|
9
|
-
voltage
|
|
10
|
-
} from "circuit-json";
|
|
11
|
-
import { z as z43 } from "zod";
|
|
12
|
-
|
|
13
1
|
// lib/typecheck.ts
|
|
14
2
|
var expectTypesMatch = (shouldBe) => {
|
|
15
3
|
};
|
|
@@ -121,6 +109,7 @@ var commonComponentProps = commonLayoutProps.merge(supplierProps).extend({
|
|
|
121
109
|
symbolName: z6.string().optional()
|
|
122
110
|
});
|
|
123
111
|
expectTypesMatch(true);
|
|
112
|
+
var componentProps = commonComponentProps;
|
|
124
113
|
var lrPins = ["pin1", "left", "pin2", "right"];
|
|
125
114
|
var lrPolarPins = [
|
|
126
115
|
"pin1",
|
|
@@ -309,7 +298,8 @@ var autorouterProp = z19.union([
|
|
|
309
298
|
]);
|
|
310
299
|
var baseGroupProps = commonLayoutProps.extend({
|
|
311
300
|
name: z19.string().optional(),
|
|
312
|
-
children: z19.any().optional()
|
|
301
|
+
children: z19.any().optional(),
|
|
302
|
+
key: z19.any().optional()
|
|
313
303
|
});
|
|
314
304
|
var subcircuitGroupProps = baseGroupProps.extend({
|
|
315
305
|
layout: z19.custom((v) => true).optional(),
|
|
@@ -723,133 +713,204 @@ var mosfetPins = [
|
|
|
723
713
|
];
|
|
724
714
|
expectTypesMatch(true);
|
|
725
715
|
|
|
726
|
-
// lib/
|
|
716
|
+
// lib/components/inductor.ts
|
|
717
|
+
import { inductance } from "circuit-json";
|
|
727
718
|
var inductorProps = commonComponentProps.extend({
|
|
728
719
|
inductance
|
|
729
720
|
});
|
|
730
721
|
var inductorPins = lrPins;
|
|
722
|
+
|
|
723
|
+
// lib/components/diode.ts
|
|
731
724
|
var diodeProps = commonComponentProps.extend({});
|
|
732
725
|
var diodePins = lrPolarPins;
|
|
726
|
+
|
|
727
|
+
// lib/components/led.ts
|
|
728
|
+
import { z as z43 } from "zod";
|
|
733
729
|
var ledProps = commonComponentProps.extend({
|
|
734
730
|
color: z43.string().optional()
|
|
735
731
|
});
|
|
736
732
|
var ledPins = lrPolarPins;
|
|
733
|
+
|
|
734
|
+
// lib/components/switch.ts
|
|
735
|
+
import { z as z44 } from "zod";
|
|
737
736
|
var switchProps = commonComponentProps.extend({
|
|
738
|
-
ftype:
|
|
739
|
-
switchType:
|
|
740
|
-
isNormallyClosed:
|
|
737
|
+
ftype: z44.literal("switch"),
|
|
738
|
+
switchType: z44.enum(["spst"]).default("spst"),
|
|
739
|
+
isNormallyClosed: z44.boolean().default(false)
|
|
741
740
|
});
|
|
742
|
-
|
|
741
|
+
|
|
742
|
+
// lib/components/fabrication-note-text.ts
|
|
743
|
+
import { length as length3 } from "circuit-json";
|
|
744
|
+
import { z as z45 } from "zod";
|
|
745
|
+
var fabricationNoteTextProps = pcbLayoutProps.extend({
|
|
746
|
+
text: z45.string(),
|
|
747
|
+
anchorAlignment: z45.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
748
|
+
font: z45.enum(["tscircuit2024"]).optional(),
|
|
749
|
+
fontSize: length3.optional(),
|
|
750
|
+
color: z45.string().optional()
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
// lib/components/fabrication-note-path.ts
|
|
754
|
+
import { length as length4, route_hint_point as route_hint_point4 } from "circuit-json";
|
|
755
|
+
import { z as z46 } from "zod";
|
|
756
|
+
var fabricationNotePathProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
757
|
+
route: z46.array(route_hint_point4),
|
|
758
|
+
strokeWidth: length4.optional(),
|
|
759
|
+
color: z46.string().optional()
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
// lib/components/pcb-trace.ts
|
|
763
|
+
import { distance as distance12, route_hint_point as route_hint_point5 } from "circuit-json";
|
|
764
|
+
import { z as z47 } from "zod";
|
|
765
|
+
var pcbTraceProps = z47.object({
|
|
766
|
+
layer: z47.string().optional(),
|
|
767
|
+
thickness: distance12.optional(),
|
|
768
|
+
route: z47.array(route_hint_point5)
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
// lib/components/via.ts
|
|
772
|
+
import { distance as distance13, layer_ref as layer_ref4 } from "circuit-json";
|
|
743
773
|
var viaProps = commonLayoutProps.extend({
|
|
744
774
|
fromLayer: layer_ref4,
|
|
745
775
|
toLayer: layer_ref4,
|
|
746
|
-
holeDiameter:
|
|
747
|
-
outerDiameter:
|
|
776
|
+
holeDiameter: distance13,
|
|
777
|
+
outerDiameter: distance13
|
|
748
778
|
});
|
|
749
|
-
|
|
779
|
+
|
|
780
|
+
// lib/components/pcb-keepout.ts
|
|
781
|
+
import { distance as distance14 } from "circuit-json";
|
|
782
|
+
import { z as z48 } from "zod";
|
|
783
|
+
var pcbKeepoutProps = z48.union([
|
|
750
784
|
pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
751
|
-
shape:
|
|
752
|
-
radius:
|
|
785
|
+
shape: z48.literal("circle"),
|
|
786
|
+
radius: distance14
|
|
753
787
|
}),
|
|
754
788
|
pcbLayoutProps.extend({
|
|
755
|
-
shape:
|
|
756
|
-
width:
|
|
757
|
-
height:
|
|
789
|
+
shape: z48.literal("rect"),
|
|
790
|
+
width: distance14,
|
|
791
|
+
height: distance14
|
|
758
792
|
})
|
|
759
793
|
]);
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
width: distance12,
|
|
764
|
-
height: distance12
|
|
765
|
-
});
|
|
766
|
-
var schematicTextProps = z43.object({
|
|
767
|
-
schX: distance12,
|
|
768
|
-
schY: distance12,
|
|
769
|
-
text: z43.string()
|
|
770
|
-
});
|
|
771
|
-
var schematicLineProps = z43.object({
|
|
772
|
-
x1: distance12,
|
|
773
|
-
y1: distance12,
|
|
774
|
-
x2: distance12,
|
|
775
|
-
y2: distance12
|
|
776
|
-
});
|
|
777
|
-
var schematicPathProps = z43.object({
|
|
778
|
-
points: z43.array(point5),
|
|
779
|
-
isFilled: z43.boolean().optional().default(false),
|
|
780
|
-
fillColor: z43.enum(["red", "blue"]).optional()
|
|
781
|
-
});
|
|
782
|
-
var componentProps = commonComponentProps;
|
|
794
|
+
|
|
795
|
+
// lib/components/power-source.ts
|
|
796
|
+
import { voltage } from "circuit-json";
|
|
783
797
|
var powerSourceProps = commonComponentProps.extend({
|
|
784
798
|
voltage
|
|
785
799
|
});
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
800
|
+
|
|
801
|
+
// lib/components/schematic-box.ts
|
|
802
|
+
import { distance as distance15 } from "circuit-json";
|
|
803
|
+
import { z as z49 } from "zod";
|
|
804
|
+
var schematicBoxProps = z49.object({
|
|
805
|
+
schX: distance15,
|
|
806
|
+
schY: distance15,
|
|
807
|
+
width: distance15,
|
|
808
|
+
height: distance15
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
// lib/components/schematic-line.ts
|
|
812
|
+
import { distance as distance16 } from "circuit-json";
|
|
813
|
+
import { z as z50 } from "zod";
|
|
814
|
+
var schematicLineProps = z50.object({
|
|
815
|
+
x1: distance16,
|
|
816
|
+
y1: distance16,
|
|
817
|
+
x2: distance16,
|
|
818
|
+
y2: distance16
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
// lib/components/schematic-text.ts
|
|
822
|
+
import { distance as distance17 } from "circuit-json";
|
|
823
|
+
import { z as z51 } from "zod";
|
|
824
|
+
var schematicTextProps = z51.object({
|
|
825
|
+
schX: distance17,
|
|
826
|
+
schY: distance17,
|
|
827
|
+
text: z51.string()
|
|
791
828
|
});
|
|
829
|
+
|
|
830
|
+
// lib/components/schematic-path.ts
|
|
831
|
+
import { point as point5 } from "circuit-json";
|
|
832
|
+
import { z as z52 } from "zod";
|
|
833
|
+
var schematicPathProps = z52.object({
|
|
834
|
+
points: z52.array(point5),
|
|
835
|
+
isFilled: z52.boolean().optional().default(false),
|
|
836
|
+
fillColor: z52.enum(["red", "blue"]).optional()
|
|
837
|
+
});
|
|
838
|
+
|
|
839
|
+
// lib/components/silkscreen-text.ts
|
|
840
|
+
import { length as length5 } from "circuit-json";
|
|
841
|
+
import { z as z53 } from "zod";
|
|
792
842
|
var silkscreenTextProps = pcbLayoutProps.extend({
|
|
793
|
-
text:
|
|
794
|
-
anchorAlignment:
|
|
795
|
-
font:
|
|
796
|
-
fontSize:
|
|
843
|
+
text: z53.string(),
|
|
844
|
+
anchorAlignment: z53.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
845
|
+
font: z53.enum(["tscircuit2024"]).optional(),
|
|
846
|
+
fontSize: length5.optional()
|
|
797
847
|
});
|
|
848
|
+
|
|
849
|
+
// lib/components/silkscreen-path.ts
|
|
850
|
+
import { length as length6, route_hint_point as route_hint_point6 } from "circuit-json";
|
|
851
|
+
import { z as z54 } from "zod";
|
|
798
852
|
var silkscreenPathProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
799
|
-
route:
|
|
800
|
-
strokeWidth:
|
|
853
|
+
route: z54.array(route_hint_point6),
|
|
854
|
+
strokeWidth: length6.optional()
|
|
801
855
|
});
|
|
856
|
+
|
|
857
|
+
// lib/components/silkscreen-line.ts
|
|
858
|
+
import { distance as distance18 } from "circuit-json";
|
|
802
859
|
var silkscreenLineProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
803
|
-
strokeWidth:
|
|
804
|
-
x1:
|
|
805
|
-
y1:
|
|
806
|
-
x2:
|
|
807
|
-
y2:
|
|
860
|
+
strokeWidth: distance18,
|
|
861
|
+
x1: distance18,
|
|
862
|
+
y1: distance18,
|
|
863
|
+
x2: distance18,
|
|
864
|
+
y2: distance18
|
|
808
865
|
});
|
|
866
|
+
|
|
867
|
+
// lib/components/silkscreen-rect.ts
|
|
868
|
+
import { distance as distance19 } from "circuit-json";
|
|
869
|
+
import { z as z55 } from "zod";
|
|
809
870
|
var silkscreenRectProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
810
|
-
isFilled:
|
|
811
|
-
isOutline:
|
|
812
|
-
strokeWidth:
|
|
813
|
-
width:
|
|
814
|
-
height:
|
|
871
|
+
isFilled: z55.boolean().optional(),
|
|
872
|
+
isOutline: z55.boolean().optional(),
|
|
873
|
+
strokeWidth: distance19.optional(),
|
|
874
|
+
width: distance19,
|
|
875
|
+
height: distance19
|
|
815
876
|
});
|
|
877
|
+
|
|
878
|
+
// lib/components/silkscreen-circle.ts
|
|
879
|
+
import { distance as distance20 } from "circuit-json";
|
|
880
|
+
import { z as z56 } from "zod";
|
|
816
881
|
var silkscreenCircleProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
817
|
-
isFilled:
|
|
818
|
-
isOutline:
|
|
819
|
-
strokeWidth:
|
|
820
|
-
radius:
|
|
821
|
-
});
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
882
|
+
isFilled: z56.boolean().optional(),
|
|
883
|
+
isOutline: z56.boolean().optional(),
|
|
884
|
+
strokeWidth: distance20.optional(),
|
|
885
|
+
radius: distance20
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
// lib/components/trace-hint.ts
|
|
889
|
+
import { distance as distance21, layer_ref as layer_ref5, route_hint_point as route_hint_point7 } from "circuit-json";
|
|
890
|
+
import { z as z57 } from "zod";
|
|
891
|
+
var routeHintPointProps = z57.object({
|
|
892
|
+
x: distance21,
|
|
893
|
+
y: distance21,
|
|
894
|
+
via: z57.boolean().optional(),
|
|
895
|
+
toLayer: layer_ref5.optional()
|
|
896
|
+
});
|
|
897
|
+
var traceHintProps = z57.object({
|
|
898
|
+
for: z57.string().optional().describe(
|
|
830
899
|
"Selector for the port you're targeting, not required if you're inside a trace"
|
|
831
900
|
),
|
|
832
|
-
order:
|
|
833
|
-
offset:
|
|
834
|
-
offsets:
|
|
835
|
-
traceWidth:
|
|
836
|
-
});
|
|
837
|
-
var pcbTraceProps = z43.object({
|
|
838
|
-
layer: z43.string().optional(),
|
|
839
|
-
thickness: distance12.optional(),
|
|
840
|
-
route: z43.array(route_hint_point4)
|
|
841
|
-
});
|
|
842
|
-
var fabricationNoteTextProps = pcbLayoutProps.extend({
|
|
843
|
-
text: z43.string(),
|
|
844
|
-
anchorAlignment: z43.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
845
|
-
font: z43.enum(["tscircuit2024"]).optional(),
|
|
846
|
-
fontSize: length3.optional(),
|
|
847
|
-
color: z43.string().optional()
|
|
901
|
+
order: z57.number().optional(),
|
|
902
|
+
offset: route_hint_point7.or(routeHintPointProps).optional(),
|
|
903
|
+
offsets: z57.array(route_hint_point7).or(z57.array(routeHintPointProps)).optional(),
|
|
904
|
+
traceWidth: z57.number().optional()
|
|
848
905
|
});
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
906
|
+
|
|
907
|
+
// lib/components/port.ts
|
|
908
|
+
import { z as z58 } from "zod";
|
|
909
|
+
var portProps = commonLayoutProps.extend({
|
|
910
|
+
name: z58.string(),
|
|
911
|
+
pinNumber: z58.number().optional(),
|
|
912
|
+
aliases: z58.array(z58.string()).optional(),
|
|
913
|
+
direction
|
|
853
914
|
});
|
|
854
915
|
export {
|
|
855
916
|
autorouterConfig,
|
|
@@ -881,7 +942,7 @@ export {
|
|
|
881
942
|
diodeProps,
|
|
882
943
|
direction,
|
|
883
944
|
directionAlongEdge,
|
|
884
|
-
|
|
945
|
+
distanceOrMultiplier,
|
|
885
946
|
edit_component_location_event,
|
|
886
947
|
edit_pcb_component_location_event,
|
|
887
948
|
edit_schematic_component_location_event,
|