@tscircuit/props 0.0.111 → 0.0.113
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 +386 -6
- package/dist/index.js +97 -66
- package/dist/index.js.map +1 -1
- package/lib/manual-edits/index.ts +3 -1
- package/lib/manual-edits/manual-edit-events/edit_pcb_component_location_event.ts +37 -0
- package/lib/manual-edits/manual-edit-events/edit_schematic_component_location_event.ts +31 -0
- package/lib/manual-edits/manual-edit-events/index.ts +2 -1
- package/lib/manual-edits/manual_edit_event.ts +15 -6
- package/lib/manual-edits/manual_edit_file.ts +3 -1
- package/lib/manual-edits/manual_pcb_placement.ts +24 -0
- package/lib/manual-edits/manual_schematic_placement.ts +30 -0
- package/package.json +1 -1
- package/lib/manual-edits/manual-edit-events/edit_component_location_event.ts +0 -29
- package/lib/manual-edits/manual_pcb_position.ts +0 -15
package/dist/index.js
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
inductance,
|
|
5
5
|
layer_ref as layer_ref4,
|
|
6
6
|
length as length3,
|
|
7
|
-
point as
|
|
7
|
+
point as point5,
|
|
8
8
|
route_hint_point as route_hint_point4,
|
|
9
9
|
voltage
|
|
10
10
|
} from "circuit-json";
|
|
11
|
-
import { z as
|
|
11
|
+
import { z as z40 } from "zod";
|
|
12
12
|
|
|
13
13
|
// lib/typecheck.ts
|
|
14
14
|
var expectTypesMatch = (shouldBe) => {
|
|
@@ -585,14 +585,16 @@ expectTypesMatch(
|
|
|
585
585
|
true
|
|
586
586
|
);
|
|
587
587
|
|
|
588
|
-
// lib/manual-edits/manual-edit-events/
|
|
588
|
+
// lib/manual-edits/manual-edit-events/edit_pcb_component_location_event.ts
|
|
589
589
|
import { z as z32 } from "zod";
|
|
590
|
-
var
|
|
591
|
-
pcb_edit_event_type: z32.literal("edit_component_location"),
|
|
590
|
+
var edit_pcb_component_location_event = base_manual_edit_event.extend({
|
|
591
|
+
pcb_edit_event_type: z32.literal("edit_component_location").describe("deprecated"),
|
|
592
|
+
edit_event_type: z32.literal("edit_pcb_component_location"),
|
|
592
593
|
pcb_component_id: z32.string(),
|
|
593
594
|
original_center: z32.object({ x: z32.number(), y: z32.number() }),
|
|
594
595
|
new_center: z32.object({ x: z32.number(), y: z32.number() })
|
|
595
596
|
});
|
|
597
|
+
var edit_component_location_event = edit_pcb_component_location_event;
|
|
596
598
|
expectTypesMatch(true);
|
|
597
599
|
|
|
598
600
|
// lib/manual-edits/manual-edit-events/edit_trace_hint_event.ts
|
|
@@ -610,39 +612,64 @@ expectTypesMatch(
|
|
|
610
612
|
true
|
|
611
613
|
);
|
|
612
614
|
|
|
613
|
-
// lib/manual-edits/
|
|
614
|
-
import { z as z37 } from "zod";
|
|
615
|
-
|
|
616
|
-
// lib/manual-edits/manual_pcb_position.ts
|
|
615
|
+
// lib/manual-edits/manual-edit-events/edit_schematic_component_location_event.ts
|
|
617
616
|
import { z as z34 } from "zod";
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
617
|
+
var edit_schematic_component_location_event = base_manual_edit_event.extend({
|
|
618
|
+
edit_event_type: z34.literal("edit_schematic_component_location"),
|
|
619
|
+
schematic_component_id: z34.string(),
|
|
620
|
+
original_center: z34.object({ x: z34.number(), y: z34.number() }),
|
|
621
|
+
new_center: z34.object({ x: z34.number(), y: z34.number() })
|
|
623
622
|
});
|
|
623
|
+
expectTypesMatch(true);
|
|
624
624
|
|
|
625
625
|
// lib/manual-edits/manual_edit_event.ts
|
|
626
626
|
import { z as z35 } from "zod";
|
|
627
627
|
var manual_edit_event = z35.union([
|
|
628
|
-
|
|
629
|
-
edit_trace_hint_event
|
|
628
|
+
edit_pcb_component_location_event,
|
|
629
|
+
edit_trace_hint_event,
|
|
630
|
+
edit_schematic_component_location_event
|
|
630
631
|
]);
|
|
631
632
|
expectTypesMatch(true);
|
|
632
633
|
|
|
633
|
-
// lib/manual-edits/
|
|
634
|
+
// lib/manual-edits/manual_edit_file.ts
|
|
635
|
+
import { z as z39 } from "zod";
|
|
636
|
+
|
|
637
|
+
// lib/manual-edits/manual_pcb_placement.ts
|
|
634
638
|
import { z as z36 } from "zod";
|
|
639
|
+
import { point as point2 } from "circuit-json";
|
|
640
|
+
var manual_pcb_placement = z36.object({
|
|
641
|
+
selector: z36.string(),
|
|
642
|
+
relative_to: z36.string().optional().default("group_center").describe("Can be a selector or 'group_center'"),
|
|
643
|
+
center: point2
|
|
644
|
+
});
|
|
645
|
+
expectTypesMatch(true);
|
|
646
|
+
|
|
647
|
+
// lib/manual-edits/manual_trace_hint.ts
|
|
648
|
+
import { z as z37 } from "zod";
|
|
635
649
|
import { route_hint_point as route_hint_point3 } from "circuit-json";
|
|
636
|
-
var manual_trace_hint =
|
|
637
|
-
pcb_port_selector:
|
|
638
|
-
offsets:
|
|
650
|
+
var manual_trace_hint = z37.object({
|
|
651
|
+
pcb_port_selector: z37.string(),
|
|
652
|
+
offsets: z37.array(route_hint_point3)
|
|
639
653
|
});
|
|
640
654
|
expectTypesMatch(true);
|
|
641
655
|
|
|
656
|
+
// lib/manual-edits/manual_schematic_placement.ts
|
|
657
|
+
import { z as z38 } from "zod";
|
|
658
|
+
import { point as point4 } from "circuit-json";
|
|
659
|
+
var manual_schematic_placement = z38.object({
|
|
660
|
+
selector: z38.string(),
|
|
661
|
+
relative_to: z38.string().optional().default("group_center").describe("Can be a selector or 'group_center'"),
|
|
662
|
+
center: point4
|
|
663
|
+
});
|
|
664
|
+
expectTypesMatch(
|
|
665
|
+
true
|
|
666
|
+
);
|
|
667
|
+
|
|
642
668
|
// lib/manual-edits/manual_edit_file.ts
|
|
643
|
-
var manual_edit_file =
|
|
644
|
-
pcb_placements:
|
|
645
|
-
manual_trace_hints:
|
|
669
|
+
var manual_edit_file = z39.object({
|
|
670
|
+
pcb_placements: z39.array(manual_pcb_placement).optional(),
|
|
671
|
+
manual_trace_hints: z39.array(manual_trace_hint).optional(),
|
|
672
|
+
schematic_placements: z39.array(manual_schematic_placement).optional()
|
|
646
673
|
});
|
|
647
674
|
|
|
648
675
|
// lib/index.ts
|
|
@@ -653,72 +680,72 @@ var inductorPins = lrPins;
|
|
|
653
680
|
var diodeProps = commonComponentProps.extend({});
|
|
654
681
|
var diodePins = lrPolarPins;
|
|
655
682
|
var ledProps = commonComponentProps.extend({
|
|
656
|
-
color:
|
|
683
|
+
color: z40.string().optional()
|
|
657
684
|
});
|
|
658
685
|
var ledPins = lrPolarPins;
|
|
659
686
|
var switchProps = commonComponentProps.extend({
|
|
660
|
-
ftype:
|
|
661
|
-
switchType:
|
|
662
|
-
isNormallyClosed:
|
|
687
|
+
ftype: z40.literal("switch"),
|
|
688
|
+
switchType: z40.enum(["spst"]).default("spst"),
|
|
689
|
+
isNormallyClosed: z40.boolean().default(false)
|
|
663
690
|
});
|
|
664
|
-
var distanceOrMultiplier2 = distance12.or(
|
|
691
|
+
var distanceOrMultiplier2 = distance12.or(z40.enum(["2x", "3x", "4x"]));
|
|
665
692
|
var viaProps = commonLayoutProps.extend({
|
|
666
693
|
fromLayer: layer_ref4,
|
|
667
694
|
toLayer: layer_ref4,
|
|
668
695
|
holeDiameter: distance12,
|
|
669
696
|
outerDiameter: distance12
|
|
670
697
|
});
|
|
671
|
-
var pcbKeepoutProps =
|
|
698
|
+
var pcbKeepoutProps = z40.union([
|
|
672
699
|
pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
673
|
-
shape:
|
|
700
|
+
shape: z40.literal("circle"),
|
|
674
701
|
radius: distance12
|
|
675
702
|
}),
|
|
676
703
|
pcbLayoutProps.extend({
|
|
677
|
-
shape:
|
|
704
|
+
shape: z40.literal("rect"),
|
|
678
705
|
width: distance12,
|
|
679
706
|
height: distance12
|
|
680
707
|
})
|
|
681
708
|
]);
|
|
682
|
-
var schematicBoxProps =
|
|
709
|
+
var schematicBoxProps = z40.object({
|
|
683
710
|
schX: distance12,
|
|
684
711
|
schY: distance12,
|
|
685
712
|
width: distance12,
|
|
686
713
|
height: distance12
|
|
687
714
|
});
|
|
688
|
-
var schematicTextProps =
|
|
715
|
+
var schematicTextProps = z40.object({
|
|
689
716
|
schX: distance12,
|
|
690
717
|
schY: distance12,
|
|
691
|
-
text:
|
|
718
|
+
text: z40.string()
|
|
692
719
|
});
|
|
693
|
-
var schematicLineProps =
|
|
720
|
+
var schematicLineProps = z40.object({
|
|
694
721
|
x1: distance12,
|
|
695
722
|
y1: distance12,
|
|
696
723
|
x2: distance12,
|
|
697
724
|
y2: distance12
|
|
698
725
|
});
|
|
699
|
-
var schematicPathProps =
|
|
700
|
-
points:
|
|
701
|
-
isFilled:
|
|
702
|
-
fillColor:
|
|
726
|
+
var schematicPathProps = z40.object({
|
|
727
|
+
points: z40.array(point5),
|
|
728
|
+
isFilled: z40.boolean().optional().default(false),
|
|
729
|
+
fillColor: z40.enum(["red", "blue"]).optional()
|
|
703
730
|
});
|
|
704
731
|
var componentProps = commonComponentProps;
|
|
705
732
|
var powerSourceProps = commonComponentProps.extend({
|
|
706
733
|
voltage
|
|
707
734
|
});
|
|
708
735
|
var portProps = commonLayoutProps.extend({
|
|
709
|
-
name:
|
|
710
|
-
pinNumber:
|
|
711
|
-
aliases:
|
|
736
|
+
name: z40.string(),
|
|
737
|
+
pinNumber: z40.number().optional(),
|
|
738
|
+
aliases: z40.array(z40.string()).optional(),
|
|
712
739
|
direction
|
|
713
740
|
});
|
|
714
741
|
var silkscreenTextProps = pcbLayoutProps.extend({
|
|
715
|
-
text:
|
|
716
|
-
anchorAlignment:
|
|
717
|
-
font:
|
|
742
|
+
text: z40.string(),
|
|
743
|
+
anchorAlignment: z40.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
744
|
+
font: z40.enum(["tscircuit2024"]).optional(),
|
|
718
745
|
fontSize: length3.optional()
|
|
719
746
|
});
|
|
720
747
|
var silkscreenPathProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
721
|
-
route:
|
|
748
|
+
route: z40.array(route_hint_point4),
|
|
722
749
|
strokeWidth: length3.optional()
|
|
723
750
|
});
|
|
724
751
|
var silkscreenLineProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
@@ -729,49 +756,49 @@ var silkscreenLineProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotat
|
|
|
729
756
|
y2: distance12
|
|
730
757
|
});
|
|
731
758
|
var silkscreenRectProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
732
|
-
isFilled:
|
|
733
|
-
isOutline:
|
|
759
|
+
isFilled: z40.boolean().optional(),
|
|
760
|
+
isOutline: z40.boolean().optional(),
|
|
734
761
|
strokeWidth: distance12.optional(),
|
|
735
762
|
width: distance12,
|
|
736
763
|
height: distance12
|
|
737
764
|
});
|
|
738
765
|
var silkscreenCircleProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
739
|
-
isFilled:
|
|
740
|
-
isOutline:
|
|
766
|
+
isFilled: z40.boolean().optional(),
|
|
767
|
+
isOutline: z40.boolean().optional(),
|
|
741
768
|
strokeWidth: distance12.optional(),
|
|
742
769
|
radius: distance12
|
|
743
770
|
});
|
|
744
|
-
var routeHintPointProps =
|
|
771
|
+
var routeHintPointProps = z40.object({
|
|
745
772
|
x: distance12,
|
|
746
773
|
y: distance12,
|
|
747
|
-
via:
|
|
774
|
+
via: z40.boolean().optional(),
|
|
748
775
|
toLayer: layer_ref4.optional()
|
|
749
776
|
});
|
|
750
|
-
var traceHintProps =
|
|
751
|
-
for:
|
|
777
|
+
var traceHintProps = z40.object({
|
|
778
|
+
for: z40.string().optional().describe(
|
|
752
779
|
"Selector for the port you're targeting, not required if you're inside a trace"
|
|
753
780
|
),
|
|
754
|
-
order:
|
|
781
|
+
order: z40.number().optional(),
|
|
755
782
|
offset: route_hint_point4.or(routeHintPointProps).optional(),
|
|
756
|
-
offsets:
|
|
757
|
-
traceWidth:
|
|
783
|
+
offsets: z40.array(route_hint_point4).or(z40.array(routeHintPointProps)).optional(),
|
|
784
|
+
traceWidth: z40.number().optional()
|
|
758
785
|
});
|
|
759
|
-
var pcbTraceProps =
|
|
760
|
-
layer:
|
|
786
|
+
var pcbTraceProps = z40.object({
|
|
787
|
+
layer: z40.string().optional(),
|
|
761
788
|
thickness: distance12.optional(),
|
|
762
|
-
route:
|
|
789
|
+
route: z40.array(route_hint_point4)
|
|
763
790
|
});
|
|
764
791
|
var fabricationNoteTextProps = pcbLayoutProps.extend({
|
|
765
|
-
text:
|
|
766
|
-
anchorAlignment:
|
|
767
|
-
font:
|
|
792
|
+
text: z40.string(),
|
|
793
|
+
anchorAlignment: z40.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
794
|
+
font: z40.enum(["tscircuit2024"]).optional(),
|
|
768
795
|
fontSize: length3.optional(),
|
|
769
|
-
color:
|
|
796
|
+
color: z40.string().optional()
|
|
770
797
|
});
|
|
771
798
|
var fabricationNotePathProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
772
|
-
route:
|
|
799
|
+
route: z40.array(route_hint_point4),
|
|
773
800
|
strokeWidth: length3.optional(),
|
|
774
|
-
color:
|
|
801
|
+
color: z40.string().optional()
|
|
775
802
|
});
|
|
776
803
|
export {
|
|
777
804
|
autorouterConfig,
|
|
@@ -805,6 +832,8 @@ export {
|
|
|
805
832
|
directionAlongEdge,
|
|
806
833
|
distanceOrMultiplier2 as distanceOrMultiplier,
|
|
807
834
|
edit_component_location_event,
|
|
835
|
+
edit_pcb_component_location_event,
|
|
836
|
+
edit_schematic_component_location_event,
|
|
808
837
|
edit_trace_hint_event,
|
|
809
838
|
explicitPinSideDefinition,
|
|
810
839
|
fabricationNotePathProps,
|
|
@@ -820,8 +849,10 @@ export {
|
|
|
820
849
|
ledProps,
|
|
821
850
|
lrPins,
|
|
822
851
|
lrPolarPins,
|
|
852
|
+
manual_edit_event,
|
|
823
853
|
manual_edit_file,
|
|
824
854
|
manual_pcb_placement,
|
|
855
|
+
manual_schematic_placement,
|
|
825
856
|
manual_trace_hint,
|
|
826
857
|
netAliasProps,
|
|
827
858
|
netProps,
|