@tscircuit/core 0.0.92 → 0.0.93
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 +101 -92
- package/dist/index.js +30 -25
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import { ZodType, z } from 'zod';
|
|
3
|
-
import { LayerRef, AnyCircuitElement,
|
|
3
|
+
import { LayerRef, AnyCircuitElement, PcbTraceError, PcbPlacementError, AnySourceComponent, RouteHintPoint } from 'circuit-json';
|
|
4
4
|
import { SoupUtilObjects } from '@tscircuit/soup-util';
|
|
5
5
|
import { ReactElement } from 'react';
|
|
6
6
|
import { Matrix } from 'transformation-matrix';
|
|
@@ -85,7 +85,7 @@ declare abstract class Renderable implements IRenderable {
|
|
|
85
85
|
*/
|
|
86
86
|
runRenderPhase(phase: RenderPhase): void;
|
|
87
87
|
runRenderPhaseForChildren(phase: RenderPhase): void;
|
|
88
|
-
renderError(message: string | Omit<
|
|
88
|
+
renderError(message: string | Omit<PcbTraceError, "pcb_error_id"> | Omit<PcbPlacementError, "pcb_error_id">): void;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
interface BaseComponentConfig {
|
|
@@ -903,35 +903,35 @@ type PolarizedPassivePorts = PassivePorts | "anode" | "cathode" | "pos" | "neg";
|
|
|
903
903
|
declare class Resistor extends NormalComponent<typeof resistorProps, PassivePorts> {
|
|
904
904
|
get config(): {
|
|
905
905
|
componentName: string;
|
|
906
|
-
schematicSymbolName:
|
|
907
|
-
zodProps:
|
|
908
|
-
pcbX:
|
|
909
|
-
pcbY:
|
|
910
|
-
pcbRotation:
|
|
911
|
-
schX:
|
|
912
|
-
schY:
|
|
913
|
-
schRotation:
|
|
914
|
-
layer:
|
|
915
|
-
name:
|
|
916
|
-
}, "strip",
|
|
906
|
+
schematicSymbolName: string;
|
|
907
|
+
zodProps: zod.ZodObject<zod.objectUtil.extendShape<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
908
|
+
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
909
|
+
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
910
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
911
|
+
schX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
912
|
+
schY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
913
|
+
schRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
914
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
915
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
916
|
+
}, "strip", zod.ZodTypeAny, {
|
|
917
917
|
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
918
918
|
}, {
|
|
919
919
|
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
920
920
|
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
921
921
|
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
922
922
|
}>>;
|
|
923
|
-
footprint:
|
|
923
|
+
footprint: zod.ZodOptional<zod.ZodType<Props.Footprint, zod.ZodTypeDef, Props.Footprint>>;
|
|
924
924
|
}, {
|
|
925
|
-
supplierPartNumbers:
|
|
925
|
+
supplierPartNumbers: zod.ZodOptional<zod.ZodRecord<zod.ZodEnum<["jlcpcb", "macrofab", "pcbway", "digikey", "mouser", "lcsc"]>, zod.ZodArray<zod.ZodString, "many">>>;
|
|
926
926
|
}>, {
|
|
927
|
-
key:
|
|
928
|
-
name:
|
|
929
|
-
cadModel:
|
|
930
|
-
rotationOffset:
|
|
931
|
-
x:
|
|
932
|
-
y:
|
|
933
|
-
z:
|
|
934
|
-
}, "strip",
|
|
927
|
+
key: zod.ZodOptional<zod.ZodAny>;
|
|
928
|
+
name: zod.ZodString;
|
|
929
|
+
cadModel: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
930
|
+
rotationOffset: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodObject<{
|
|
931
|
+
x: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
932
|
+
y: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
933
|
+
z: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
934
|
+
}, "strip", zod.ZodTypeAny, {
|
|
935
935
|
x: string | number;
|
|
936
936
|
y: string | number;
|
|
937
937
|
z: string | number;
|
|
@@ -940,11 +940,11 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
940
940
|
y: string | number;
|
|
941
941
|
z: string | number;
|
|
942
942
|
}>]>>;
|
|
943
|
-
positionOffset:
|
|
944
|
-
x:
|
|
945
|
-
y:
|
|
946
|
-
z:
|
|
947
|
-
}, "strip",
|
|
943
|
+
positionOffset: zod.ZodOptional<zod.ZodObject<{
|
|
944
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
945
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
946
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
947
|
+
}, "strip", zod.ZodTypeAny, {
|
|
948
948
|
x: number;
|
|
949
949
|
y: number;
|
|
950
950
|
z: number;
|
|
@@ -953,11 +953,11 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
953
953
|
y: string | number;
|
|
954
954
|
z: string | number;
|
|
955
955
|
}>>;
|
|
956
|
-
size:
|
|
957
|
-
x:
|
|
958
|
-
y:
|
|
959
|
-
z:
|
|
960
|
-
}, "strip",
|
|
956
|
+
size: zod.ZodOptional<zod.ZodObject<{
|
|
957
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
958
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
959
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
960
|
+
}, "strip", zod.ZodTypeAny, {
|
|
961
961
|
x: number;
|
|
962
962
|
y: number;
|
|
963
963
|
z: number;
|
|
@@ -967,8 +967,8 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
967
967
|
z: string | number;
|
|
968
968
|
}>>;
|
|
969
969
|
}, {
|
|
970
|
-
stlUrl:
|
|
971
|
-
}>, "strip",
|
|
970
|
+
stlUrl: zod.ZodString;
|
|
971
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
972
972
|
stlUrl: string;
|
|
973
973
|
rotationOffset?: number | {
|
|
974
974
|
x: string | number;
|
|
@@ -1002,12 +1002,12 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
1002
1002
|
y: string | number;
|
|
1003
1003
|
z: string | number;
|
|
1004
1004
|
} | undefined;
|
|
1005
|
-
}>,
|
|
1006
|
-
rotationOffset:
|
|
1007
|
-
x:
|
|
1008
|
-
y:
|
|
1009
|
-
z:
|
|
1010
|
-
}, "strip",
|
|
1005
|
+
}>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
1006
|
+
rotationOffset: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodObject<{
|
|
1007
|
+
x: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
1008
|
+
y: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
1009
|
+
z: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
1010
|
+
}, "strip", zod.ZodTypeAny, {
|
|
1011
1011
|
x: string | number;
|
|
1012
1012
|
y: string | number;
|
|
1013
1013
|
z: string | number;
|
|
@@ -1016,11 +1016,11 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
1016
1016
|
y: string | number;
|
|
1017
1017
|
z: string | number;
|
|
1018
1018
|
}>]>>;
|
|
1019
|
-
positionOffset:
|
|
1020
|
-
x:
|
|
1021
|
-
y:
|
|
1022
|
-
z:
|
|
1023
|
-
}, "strip",
|
|
1019
|
+
positionOffset: zod.ZodOptional<zod.ZodObject<{
|
|
1020
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1021
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1022
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1023
|
+
}, "strip", zod.ZodTypeAny, {
|
|
1024
1024
|
x: number;
|
|
1025
1025
|
y: number;
|
|
1026
1026
|
z: number;
|
|
@@ -1029,11 +1029,11 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
1029
1029
|
y: string | number;
|
|
1030
1030
|
z: string | number;
|
|
1031
1031
|
}>>;
|
|
1032
|
-
size:
|
|
1033
|
-
x:
|
|
1034
|
-
y:
|
|
1035
|
-
z:
|
|
1036
|
-
}, "strip",
|
|
1032
|
+
size: zod.ZodOptional<zod.ZodObject<{
|
|
1033
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1034
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1035
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1036
|
+
}, "strip", zod.ZodTypeAny, {
|
|
1037
1037
|
x: number;
|
|
1038
1038
|
y: number;
|
|
1039
1039
|
z: number;
|
|
@@ -1043,9 +1043,9 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
1043
1043
|
z: string | number;
|
|
1044
1044
|
}>>;
|
|
1045
1045
|
}, {
|
|
1046
|
-
objUrl:
|
|
1047
|
-
mtlUrl:
|
|
1048
|
-
}>, "strip",
|
|
1046
|
+
objUrl: zod.ZodString;
|
|
1047
|
+
mtlUrl: zod.ZodOptional<zod.ZodString>;
|
|
1048
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
1049
1049
|
objUrl: string;
|
|
1050
1050
|
rotationOffset?: number | {
|
|
1051
1051
|
x: string | number;
|
|
@@ -1081,12 +1081,12 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
1081
1081
|
z: string | number;
|
|
1082
1082
|
} | undefined;
|
|
1083
1083
|
mtlUrl?: string | undefined;
|
|
1084
|
-
}>,
|
|
1085
|
-
rotationOffset:
|
|
1086
|
-
x:
|
|
1087
|
-
y:
|
|
1088
|
-
z:
|
|
1089
|
-
}, "strip",
|
|
1084
|
+
}>, zod.ZodObject<zod.objectUtil.extendShape<{
|
|
1085
|
+
rotationOffset: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodObject<{
|
|
1086
|
+
x: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
1087
|
+
y: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
1088
|
+
z: zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>;
|
|
1089
|
+
}, "strip", zod.ZodTypeAny, {
|
|
1090
1090
|
x: string | number;
|
|
1091
1091
|
y: string | number;
|
|
1092
1092
|
z: string | number;
|
|
@@ -1095,11 +1095,11 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
1095
1095
|
y: string | number;
|
|
1096
1096
|
z: string | number;
|
|
1097
1097
|
}>]>>;
|
|
1098
|
-
positionOffset:
|
|
1099
|
-
x:
|
|
1100
|
-
y:
|
|
1101
|
-
z:
|
|
1102
|
-
}, "strip",
|
|
1098
|
+
positionOffset: zod.ZodOptional<zod.ZodObject<{
|
|
1099
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1100
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1101
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1102
|
+
}, "strip", zod.ZodTypeAny, {
|
|
1103
1103
|
x: number;
|
|
1104
1104
|
y: number;
|
|
1105
1105
|
z: number;
|
|
@@ -1108,11 +1108,11 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
1108
1108
|
y: string | number;
|
|
1109
1109
|
z: string | number;
|
|
1110
1110
|
}>>;
|
|
1111
|
-
size:
|
|
1112
|
-
x:
|
|
1113
|
-
y:
|
|
1114
|
-
z:
|
|
1115
|
-
}, "strip",
|
|
1111
|
+
size: zod.ZodOptional<zod.ZodObject<{
|
|
1112
|
+
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1113
|
+
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1114
|
+
z: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1115
|
+
}, "strip", zod.ZodTypeAny, {
|
|
1116
1116
|
x: number;
|
|
1117
1117
|
y: number;
|
|
1118
1118
|
z: number;
|
|
@@ -1122,8 +1122,8 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
1122
1122
|
z: string | number;
|
|
1123
1123
|
}>>;
|
|
1124
1124
|
}, {
|
|
1125
|
-
jscad:
|
|
1126
|
-
}>, "strip",
|
|
1125
|
+
jscad: zod.ZodRecord<zod.ZodString, zod.ZodAny>;
|
|
1126
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
1127
1127
|
jscad: Record<string, any>;
|
|
1128
1128
|
rotationOffset?: number | {
|
|
1129
1129
|
x: string | number;
|
|
@@ -1158,15 +1158,15 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
1158
1158
|
z: string | number;
|
|
1159
1159
|
} | undefined;
|
|
1160
1160
|
}>]>>;
|
|
1161
|
-
children:
|
|
1162
|
-
symbolName:
|
|
1161
|
+
children: zod.ZodOptional<zod.ZodAny>;
|
|
1162
|
+
symbolName: zod.ZodOptional<zod.ZodString>;
|
|
1163
1163
|
}>, {
|
|
1164
|
-
resistance:
|
|
1165
|
-
pullupFor:
|
|
1166
|
-
pullupTo:
|
|
1167
|
-
pulldownFor:
|
|
1168
|
-
pulldownTo:
|
|
1169
|
-
}>, "strip",
|
|
1164
|
+
resistance: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
1165
|
+
pullupFor: zod.ZodOptional<zod.ZodString>;
|
|
1166
|
+
pullupTo: zod.ZodOptional<zod.ZodString>;
|
|
1167
|
+
pulldownFor: zod.ZodOptional<zod.ZodString>;
|
|
1168
|
+
pulldownTo: zod.ZodOptional<zod.ZodString>;
|
|
1169
|
+
}>, "strip", zod.ZodTypeAny, {
|
|
1170
1170
|
name: string;
|
|
1171
1171
|
resistance: number;
|
|
1172
1172
|
pcbX?: number | undefined;
|
|
@@ -1315,8 +1315,7 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
1315
1315
|
}>;
|
|
1316
1316
|
sourceFtype: Ftype;
|
|
1317
1317
|
};
|
|
1318
|
-
|
|
1319
|
-
pin2: Port;
|
|
1318
|
+
initPorts(): void;
|
|
1320
1319
|
doInitialCreateNetsFromProps(): void;
|
|
1321
1320
|
doInitialCreateTracesFromProps(): void;
|
|
1322
1321
|
doInitialSourceRender(): void;
|
|
@@ -1325,7 +1324,7 @@ declare class Resistor extends NormalComponent<typeof resistorProps, PassivePort
|
|
|
1325
1324
|
declare class Led extends NormalComponent<typeof ledProps, PolarizedPassivePorts> {
|
|
1326
1325
|
get config(): {
|
|
1327
1326
|
componentName: string;
|
|
1328
|
-
schematicSymbolName:
|
|
1327
|
+
schematicSymbolName: string;
|
|
1329
1328
|
zodProps: zod.ZodObject<zod.objectUtil.extendShape<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
1330
1329
|
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
1331
1330
|
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
@@ -1725,11 +1724,10 @@ declare class Led extends NormalComponent<typeof ledProps, PolarizedPassivePorts
|
|
|
1725
1724
|
}>;
|
|
1726
1725
|
sourceFtype: Ftype;
|
|
1727
1726
|
};
|
|
1727
|
+
initPorts(): void;
|
|
1728
1728
|
pos: Port;
|
|
1729
|
-
pin1: Port;
|
|
1730
1729
|
anode: Port;
|
|
1731
1730
|
neg: Port;
|
|
1732
|
-
pin2: Port;
|
|
1733
1731
|
cathode: Port;
|
|
1734
1732
|
}
|
|
1735
1733
|
|
|
@@ -2136,10 +2134,10 @@ declare class Diode extends NormalComponent<typeof diodeProps, TwoPinPorts> {
|
|
|
2136
2134
|
initPorts(): void;
|
|
2137
2135
|
}
|
|
2138
2136
|
|
|
2139
|
-
|
|
2140
|
-
declare class Capacitor extends NormalComponent<typeof capacitorProps, PortNames> {
|
|
2137
|
+
declare class Capacitor extends NormalComponent<typeof capacitorProps, PassivePorts> {
|
|
2141
2138
|
get config(): {
|
|
2142
2139
|
componentName: string;
|
|
2140
|
+
schematicSymbolName: string;
|
|
2143
2141
|
zodProps: zod.ZodObject<zod.objectUtil.extendShape<zod.objectUtil.extendShape<zod.objectUtil.extendShape<{
|
|
2144
2142
|
pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
2145
2143
|
pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
@@ -2397,9 +2395,14 @@ declare class Capacitor extends NormalComponent<typeof capacitorProps, PortNames
|
|
|
2397
2395
|
children: zod.ZodOptional<zod.ZodAny>;
|
|
2398
2396
|
symbolName: zod.ZodOptional<zod.ZodString>;
|
|
2399
2397
|
}>, {
|
|
2400
|
-
|
|
2398
|
+
capacitance: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
2399
|
+
decouplingFor: zod.ZodOptional<zod.ZodString>;
|
|
2400
|
+
decouplingTo: zod.ZodOptional<zod.ZodString>;
|
|
2401
|
+
bypassFor: zod.ZodOptional<zod.ZodString>;
|
|
2402
|
+
bypassTo: zod.ZodOptional<zod.ZodString>;
|
|
2401
2403
|
}>, "strip", zod.ZodTypeAny, {
|
|
2402
2404
|
name: string;
|
|
2405
|
+
capacitance: number;
|
|
2403
2406
|
pcbX?: number | undefined;
|
|
2404
2407
|
pcbY?: number | undefined;
|
|
2405
2408
|
pcbRotation?: number | undefined;
|
|
@@ -2465,9 +2468,13 @@ declare class Capacitor extends NormalComponent<typeof capacitorProps, PortNames
|
|
|
2465
2468
|
} | undefined;
|
|
2466
2469
|
children?: any;
|
|
2467
2470
|
symbolName?: string | undefined;
|
|
2468
|
-
|
|
2471
|
+
decouplingFor?: string | undefined;
|
|
2472
|
+
decouplingTo?: string | undefined;
|
|
2473
|
+
bypassFor?: string | undefined;
|
|
2474
|
+
bypassTo?: string | undefined;
|
|
2469
2475
|
}, {
|
|
2470
2476
|
name: string;
|
|
2477
|
+
capacitance: string | number;
|
|
2471
2478
|
pcbX?: string | number | undefined;
|
|
2472
2479
|
pcbY?: string | number | undefined;
|
|
2473
2480
|
pcbRotation?: string | number | undefined;
|
|
@@ -2535,12 +2542,14 @@ declare class Capacitor extends NormalComponent<typeof capacitorProps, PortNames
|
|
|
2535
2542
|
} | undefined;
|
|
2536
2543
|
children?: any;
|
|
2537
2544
|
symbolName?: string | undefined;
|
|
2538
|
-
|
|
2545
|
+
decouplingFor?: string | undefined;
|
|
2546
|
+
decouplingTo?: string | undefined;
|
|
2547
|
+
bypassFor?: string | undefined;
|
|
2548
|
+
bypassTo?: string | undefined;
|
|
2539
2549
|
}>;
|
|
2540
2550
|
sourceFtype: "simple_capacitor";
|
|
2541
2551
|
};
|
|
2542
|
-
|
|
2543
|
-
pin2: Port;
|
|
2552
|
+
initPorts(): void;
|
|
2544
2553
|
doInitialCreateNetsFromProps(): void;
|
|
2545
2554
|
doInitialCreateTracesFromProps(): void;
|
|
2546
2555
|
doInitialSourceRender(): void;
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,6 @@ import { symbols } from "schematic-symbols";
|
|
|
43
43
|
import "react";
|
|
44
44
|
|
|
45
45
|
// lib/components/base-components/Renderable.ts
|
|
46
|
-
import "react";
|
|
47
46
|
var orderedRenderPhases = [
|
|
48
47
|
"ReactSubtreesRender",
|
|
49
48
|
"InitializePortsFromChildren",
|
|
@@ -783,9 +782,6 @@ var Footprint = class extends PrimitiveComponent {
|
|
|
783
782
|
// lib/components/base-components/NormalComponent.ts
|
|
784
783
|
import { z as z4 } from "zod";
|
|
785
784
|
|
|
786
|
-
// lib/components/primitive-components/Port.ts
|
|
787
|
-
import { z as z2 } from "zod";
|
|
788
|
-
|
|
789
785
|
// lib/utils/get-relative-direction.ts
|
|
790
786
|
function getRelativeDirection(pointA, pointB) {
|
|
791
787
|
const dx = pointB.x - pointA.x;
|
|
@@ -799,6 +795,7 @@ function getRelativeDirection(pointA, pointB) {
|
|
|
799
795
|
// lib/components/primitive-components/Port.ts
|
|
800
796
|
import "schematic-symbols";
|
|
801
797
|
import { applyToPoint as applyToPoint2, compose as compose2, translate as translate2 } from "transformation-matrix";
|
|
798
|
+
import { z as z2 } from "zod";
|
|
802
799
|
var portProps = z2.object({
|
|
803
800
|
name: z2.string().optional(),
|
|
804
801
|
pinNumber: z2.number().optional(),
|
|
@@ -856,12 +853,12 @@ var Port = class extends PrimitiveComponent {
|
|
|
856
853
|
x: 0,
|
|
857
854
|
y: 0
|
|
858
855
|
});
|
|
859
|
-
throw new Error(
|
|
860
|
-
`Could not find schematic symbol port for port ${this} so couldn't determine port position`
|
|
861
|
-
);
|
|
862
856
|
}
|
|
863
857
|
const symbol = this.parent?.getSchematicSymbol();
|
|
864
|
-
if (!symbol)
|
|
858
|
+
if (!symbol) {
|
|
859
|
+
console.warn(`Could not find parent symbol for ${this}`);
|
|
860
|
+
return { x: 0, y: 0 };
|
|
861
|
+
}
|
|
865
862
|
const transform = compose2(
|
|
866
863
|
this.parent.computeSchematicGlobalTransform(),
|
|
867
864
|
translate2(-symbol.center.x, -symbol.center.y)
|
|
@@ -995,7 +992,7 @@ var Port = class extends PrimitiveComponent {
|
|
|
995
992
|
};
|
|
996
993
|
|
|
997
994
|
// lib/components/base-components/NormalComponent.ts
|
|
998
|
-
import { symbols as
|
|
995
|
+
import { symbols as symbols2 } from "schematic-symbols";
|
|
999
996
|
import { fp } from "footprinter";
|
|
1000
997
|
import {
|
|
1001
998
|
isValidElement as isReactElement2,
|
|
@@ -1792,7 +1789,7 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
1792
1789
|
const { config } = this;
|
|
1793
1790
|
const portsToCreate = [];
|
|
1794
1791
|
if (config.schematicSymbolName) {
|
|
1795
|
-
const sym =
|
|
1792
|
+
const sym = symbols2[`${config.schematicSymbolName}_horz`];
|
|
1796
1793
|
if (!sym) return;
|
|
1797
1794
|
for (const symPort of sym.ports) {
|
|
1798
1795
|
const port = getPortFromHints(symPort.labels);
|
|
@@ -1882,8 +1879,8 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
1882
1879
|
const { db } = this.root;
|
|
1883
1880
|
const { schematicSymbolName } = this.config;
|
|
1884
1881
|
if (!schematicSymbolName) return;
|
|
1885
|
-
const symbol_name = `${this.config.schematicSymbolName}
|
|
1886
|
-
const symbol =
|
|
1882
|
+
const symbol_name = `${this.config.schematicSymbolName}`;
|
|
1883
|
+
const symbol = symbols2[symbol_name];
|
|
1887
1884
|
if (!symbol) {
|
|
1888
1885
|
throw new Error(`Could not find schematic-symbol "${symbol_name}"`);
|
|
1889
1886
|
}
|
|
@@ -2019,7 +2016,7 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2019
2016
|
getPortsFromSchematicSymbol() {
|
|
2020
2017
|
const { config } = this;
|
|
2021
2018
|
if (!config.schematicSymbolName) return [];
|
|
2022
|
-
const symbol =
|
|
2019
|
+
const symbol = symbols2[config.schematicSymbolName];
|
|
2023
2020
|
if (!symbol) return [];
|
|
2024
2021
|
const newPorts = [];
|
|
2025
2022
|
for (const symbolPort of symbol.ports) {
|
|
@@ -2268,7 +2265,6 @@ var Board = class extends Group {
|
|
|
2268
2265
|
|
|
2269
2266
|
// lib/components/normal-components/Resistor.ts
|
|
2270
2267
|
import { resistorProps } from "@tscircuit/props";
|
|
2271
|
-
import "zod";
|
|
2272
2268
|
|
|
2273
2269
|
// lib/components/primitive-components/Trace.ts
|
|
2274
2270
|
import { traceProps } from "@tscircuit/props";
|
|
@@ -2902,16 +2898,19 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
2902
2898
|
|
|
2903
2899
|
// lib/components/normal-components/Resistor.ts
|
|
2904
2900
|
var Resistor = class extends NormalComponent {
|
|
2901
|
+
// @ts-ignore (cause the symbolName is string and not fixed)
|
|
2905
2902
|
get config() {
|
|
2906
2903
|
return {
|
|
2907
2904
|
componentName: "Resistor",
|
|
2908
|
-
schematicSymbolName: "
|
|
2905
|
+
schematicSymbolName: this.props.symbolName ?? "boxresistor_horz",
|
|
2909
2906
|
zodProps: resistorProps,
|
|
2910
2907
|
sourceFtype: "simple_resistor"
|
|
2911
2908
|
};
|
|
2912
2909
|
}
|
|
2913
|
-
|
|
2914
|
-
|
|
2910
|
+
initPorts() {
|
|
2911
|
+
this.add(new Port({ name: "pin1", pinNumber: 1, aliases: ["anode", "pos"] }));
|
|
2912
|
+
this.add(new Port({ name: "pin2", pinNumber: 2, aliases: ["cathode", "neg"] }));
|
|
2913
|
+
}
|
|
2915
2914
|
doInitialCreateNetsFromProps() {
|
|
2916
2915
|
this._createNetsFromProps([this.props.pullupFor, this.props.pullupTo]);
|
|
2917
2916
|
}
|
|
@@ -2949,19 +2948,22 @@ var Resistor = class extends NormalComponent {
|
|
|
2949
2948
|
// lib/components/normal-components/Led.ts
|
|
2950
2949
|
import { ledProps } from "@tscircuit/props";
|
|
2951
2950
|
var Led = class extends NormalComponent {
|
|
2951
|
+
// @ts-ignore
|
|
2952
2952
|
get config() {
|
|
2953
2953
|
return {
|
|
2954
2954
|
componentName: "Led",
|
|
2955
|
-
schematicSymbolName: "
|
|
2955
|
+
schematicSymbolName: this.props.symbolName ?? "led_horz",
|
|
2956
2956
|
zodProps: ledProps,
|
|
2957
2957
|
sourceFtype: "simple_diode"
|
|
2958
2958
|
};
|
|
2959
2959
|
}
|
|
2960
|
+
initPorts() {
|
|
2961
|
+
this.add(new Port({ name: "pin1", pinNumber: 1, aliases: ["anode", "pos"] }));
|
|
2962
|
+
this.add(new Port({ name: "pin2", pinNumber: 2, aliases: ["cathode", "neg"] }));
|
|
2963
|
+
}
|
|
2960
2964
|
pos = this.portMap.pin1;
|
|
2961
|
-
pin1 = this.portMap.pin1;
|
|
2962
2965
|
anode = this.portMap.pin1;
|
|
2963
2966
|
neg = this.portMap.pin2;
|
|
2964
|
-
pin2 = this.portMap.pin2;
|
|
2965
2967
|
cathode = this.portMap.pin2;
|
|
2966
2968
|
};
|
|
2967
2969
|
|
|
@@ -2996,18 +2998,21 @@ var Diode = class extends NormalComponent {
|
|
|
2996
2998
|
};
|
|
2997
2999
|
|
|
2998
3000
|
// lib/components/normal-components/Capacitor.ts
|
|
2999
|
-
import {
|
|
3001
|
+
import { capacitorProps } from "@tscircuit/props";
|
|
3000
3002
|
var Capacitor = class extends NormalComponent {
|
|
3003
|
+
// @ts-ignore (cause the symbolName is string and not fixed)
|
|
3001
3004
|
get config() {
|
|
3002
3005
|
return {
|
|
3003
3006
|
componentName: "Capacitor",
|
|
3004
|
-
|
|
3005
|
-
zodProps:
|
|
3007
|
+
schematicSymbolName: this.props.symbolName ?? "capacitor_horz",
|
|
3008
|
+
zodProps: capacitorProps,
|
|
3006
3009
|
sourceFtype: FTYPE.simple_capacitor
|
|
3007
3010
|
};
|
|
3008
3011
|
}
|
|
3009
|
-
|
|
3010
|
-
|
|
3012
|
+
initPorts() {
|
|
3013
|
+
this.add(new Port({ name: "pin1", pinNumber: 1, aliases: ["anode", "pos"] }));
|
|
3014
|
+
this.add(new Port({ name: "pin2", pinNumber: 2, aliases: ["cathode", "neg"] }));
|
|
3015
|
+
}
|
|
3011
3016
|
doInitialCreateNetsFromProps() {
|
|
3012
3017
|
this._createNetsFromProps([
|
|
3013
3018
|
this.props.decouplingFor,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.93",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"performance-now": "^2.1.0",
|
|
44
44
|
"react": "^18.3.1",
|
|
45
45
|
"react-reconciler": "^0.29.2",
|
|
46
|
-
"schematic-symbols": "0.0.
|
|
46
|
+
"schematic-symbols": "0.0.19",
|
|
47
47
|
"transformation-matrix": "^2.16.1",
|
|
48
48
|
"zod": "^3.23.8"
|
|
49
49
|
}
|