@tscircuit/props 0.0.130 → 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 +1234 -1214
- package/dist/index.js +163 -103
- 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/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",
|
|
@@ -724,133 +713,204 @@ var mosfetPins = [
|
|
|
724
713
|
];
|
|
725
714
|
expectTypesMatch(true);
|
|
726
715
|
|
|
727
|
-
// lib/
|
|
716
|
+
// lib/components/inductor.ts
|
|
717
|
+
import { inductance } from "circuit-json";
|
|
728
718
|
var inductorProps = commonComponentProps.extend({
|
|
729
719
|
inductance
|
|
730
720
|
});
|
|
731
721
|
var inductorPins = lrPins;
|
|
722
|
+
|
|
723
|
+
// lib/components/diode.ts
|
|
732
724
|
var diodeProps = commonComponentProps.extend({});
|
|
733
725
|
var diodePins = lrPolarPins;
|
|
726
|
+
|
|
727
|
+
// lib/components/led.ts
|
|
728
|
+
import { z as z43 } from "zod";
|
|
734
729
|
var ledProps = commonComponentProps.extend({
|
|
735
730
|
color: z43.string().optional()
|
|
736
731
|
});
|
|
737
732
|
var ledPins = lrPolarPins;
|
|
733
|
+
|
|
734
|
+
// lib/components/switch.ts
|
|
735
|
+
import { z as z44 } from "zod";
|
|
738
736
|
var switchProps = commonComponentProps.extend({
|
|
739
|
-
ftype:
|
|
740
|
-
switchType:
|
|
741
|
-
isNormallyClosed:
|
|
737
|
+
ftype: z44.literal("switch"),
|
|
738
|
+
switchType: z44.enum(["spst"]).default("spst"),
|
|
739
|
+
isNormallyClosed: z44.boolean().default(false)
|
|
742
740
|
});
|
|
743
|
-
|
|
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";
|
|
744
773
|
var viaProps = commonLayoutProps.extend({
|
|
745
774
|
fromLayer: layer_ref4,
|
|
746
775
|
toLayer: layer_ref4,
|
|
747
|
-
holeDiameter:
|
|
748
|
-
outerDiameter:
|
|
776
|
+
holeDiameter: distance13,
|
|
777
|
+
outerDiameter: distance13
|
|
749
778
|
});
|
|
750
|
-
|
|
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([
|
|
751
784
|
pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
752
|
-
shape:
|
|
753
|
-
radius:
|
|
785
|
+
shape: z48.literal("circle"),
|
|
786
|
+
radius: distance14
|
|
754
787
|
}),
|
|
755
788
|
pcbLayoutProps.extend({
|
|
756
|
-
shape:
|
|
757
|
-
width:
|
|
758
|
-
height:
|
|
789
|
+
shape: z48.literal("rect"),
|
|
790
|
+
width: distance14,
|
|
791
|
+
height: distance14
|
|
759
792
|
})
|
|
760
793
|
]);
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
width: distance12,
|
|
765
|
-
height: distance12
|
|
766
|
-
});
|
|
767
|
-
var schematicTextProps = z43.object({
|
|
768
|
-
schX: distance12,
|
|
769
|
-
schY: distance12,
|
|
770
|
-
text: z43.string()
|
|
771
|
-
});
|
|
772
|
-
var schematicLineProps = z43.object({
|
|
773
|
-
x1: distance12,
|
|
774
|
-
y1: distance12,
|
|
775
|
-
x2: distance12,
|
|
776
|
-
y2: distance12
|
|
777
|
-
});
|
|
778
|
-
var schematicPathProps = z43.object({
|
|
779
|
-
points: z43.array(point5),
|
|
780
|
-
isFilled: z43.boolean().optional().default(false),
|
|
781
|
-
fillColor: z43.enum(["red", "blue"]).optional()
|
|
782
|
-
});
|
|
783
|
-
var componentProps = commonComponentProps;
|
|
794
|
+
|
|
795
|
+
// lib/components/power-source.ts
|
|
796
|
+
import { voltage } from "circuit-json";
|
|
784
797
|
var powerSourceProps = commonComponentProps.extend({
|
|
785
798
|
voltage
|
|
786
799
|
});
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
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()
|
|
792
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";
|
|
793
842
|
var silkscreenTextProps = pcbLayoutProps.extend({
|
|
794
|
-
text:
|
|
795
|
-
anchorAlignment:
|
|
796
|
-
font:
|
|
797
|
-
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()
|
|
798
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";
|
|
799
852
|
var silkscreenPathProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
800
|
-
route:
|
|
801
|
-
strokeWidth:
|
|
853
|
+
route: z54.array(route_hint_point6),
|
|
854
|
+
strokeWidth: length6.optional()
|
|
802
855
|
});
|
|
856
|
+
|
|
857
|
+
// lib/components/silkscreen-line.ts
|
|
858
|
+
import { distance as distance18 } from "circuit-json";
|
|
803
859
|
var silkscreenLineProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
804
|
-
strokeWidth:
|
|
805
|
-
x1:
|
|
806
|
-
y1:
|
|
807
|
-
x2:
|
|
808
|
-
y2:
|
|
860
|
+
strokeWidth: distance18,
|
|
861
|
+
x1: distance18,
|
|
862
|
+
y1: distance18,
|
|
863
|
+
x2: distance18,
|
|
864
|
+
y2: distance18
|
|
809
865
|
});
|
|
866
|
+
|
|
867
|
+
// lib/components/silkscreen-rect.ts
|
|
868
|
+
import { distance as distance19 } from "circuit-json";
|
|
869
|
+
import { z as z55 } from "zod";
|
|
810
870
|
var silkscreenRectProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
811
|
-
isFilled:
|
|
812
|
-
isOutline:
|
|
813
|
-
strokeWidth:
|
|
814
|
-
width:
|
|
815
|
-
height:
|
|
871
|
+
isFilled: z55.boolean().optional(),
|
|
872
|
+
isOutline: z55.boolean().optional(),
|
|
873
|
+
strokeWidth: distance19.optional(),
|
|
874
|
+
width: distance19,
|
|
875
|
+
height: distance19
|
|
816
876
|
});
|
|
877
|
+
|
|
878
|
+
// lib/components/silkscreen-circle.ts
|
|
879
|
+
import { distance as distance20 } from "circuit-json";
|
|
880
|
+
import { z as z56 } from "zod";
|
|
817
881
|
var silkscreenCircleProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
818
|
-
isFilled:
|
|
819
|
-
isOutline:
|
|
820
|
-
strokeWidth:
|
|
821
|
-
radius:
|
|
822
|
-
});
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
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(
|
|
831
899
|
"Selector for the port you're targeting, not required if you're inside a trace"
|
|
832
900
|
),
|
|
833
|
-
order:
|
|
834
|
-
offset:
|
|
835
|
-
offsets:
|
|
836
|
-
traceWidth:
|
|
837
|
-
});
|
|
838
|
-
var pcbTraceProps = z43.object({
|
|
839
|
-
layer: z43.string().optional(),
|
|
840
|
-
thickness: distance12.optional(),
|
|
841
|
-
route: z43.array(route_hint_point4)
|
|
842
|
-
});
|
|
843
|
-
var fabricationNoteTextProps = pcbLayoutProps.extend({
|
|
844
|
-
text: z43.string(),
|
|
845
|
-
anchorAlignment: z43.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
846
|
-
font: z43.enum(["tscircuit2024"]).optional(),
|
|
847
|
-
fontSize: length3.optional(),
|
|
848
|
-
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()
|
|
849
905
|
});
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
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
|
|
854
914
|
});
|
|
855
915
|
export {
|
|
856
916
|
autorouterConfig,
|
|
@@ -882,7 +942,7 @@ export {
|
|
|
882
942
|
diodeProps,
|
|
883
943
|
direction,
|
|
884
944
|
directionAlongEdge,
|
|
885
|
-
|
|
945
|
+
distanceOrMultiplier,
|
|
886
946
|
edit_component_location_event,
|
|
887
947
|
edit_pcb_component_location_event,
|
|
888
948
|
edit_schematic_component_location_event,
|