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