@tscircuit/footprinter 0.0.180 → 0.0.182
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 +91 -0
- package/dist/index.js +121 -27
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1026,6 +1026,92 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
|
|
|
1026
1026
|
}, {
|
|
1027
1027
|
w: string | number;
|
|
1028
1028
|
h: string | number;
|
|
1029
|
+
}>, z.ZodEffects<z.ZodObject<{
|
|
1030
|
+
fn: z.ZodString;
|
|
1031
|
+
circle: z.ZodOptional<z.ZodBoolean>;
|
|
1032
|
+
rect: z.ZodOptional<z.ZodBoolean>;
|
|
1033
|
+
square: z.ZodOptional<z.ZodBoolean>;
|
|
1034
|
+
d: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1035
|
+
pd: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1036
|
+
diameter: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1037
|
+
r: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1038
|
+
pr: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1039
|
+
radius: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1040
|
+
w: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1041
|
+
pw: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1042
|
+
width: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1043
|
+
h: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1044
|
+
ph: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1045
|
+
height: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1046
|
+
s: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1047
|
+
size: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
1048
|
+
string: z.ZodOptional<z.ZodString>;
|
|
1049
|
+
}, "strip", z.ZodTypeAny, {
|
|
1050
|
+
fn: string;
|
|
1051
|
+
string?: string | undefined;
|
|
1052
|
+
circle?: boolean | undefined;
|
|
1053
|
+
w?: number | undefined;
|
|
1054
|
+
rect?: boolean | undefined;
|
|
1055
|
+
width?: number | undefined;
|
|
1056
|
+
height?: number | undefined;
|
|
1057
|
+
radius?: number | undefined;
|
|
1058
|
+
pw?: number | undefined;
|
|
1059
|
+
ph?: number | undefined;
|
|
1060
|
+
h?: number | undefined;
|
|
1061
|
+
square?: boolean | undefined;
|
|
1062
|
+
d?: number | undefined;
|
|
1063
|
+
pd?: number | undefined;
|
|
1064
|
+
diameter?: number | undefined;
|
|
1065
|
+
r?: number | undefined;
|
|
1066
|
+
pr?: number | undefined;
|
|
1067
|
+
s?: number | undefined;
|
|
1068
|
+
size?: number | undefined;
|
|
1069
|
+
}, {
|
|
1070
|
+
fn: string;
|
|
1071
|
+
string?: string | undefined;
|
|
1072
|
+
circle?: boolean | undefined;
|
|
1073
|
+
w?: string | number | undefined;
|
|
1074
|
+
rect?: boolean | undefined;
|
|
1075
|
+
width?: string | number | undefined;
|
|
1076
|
+
height?: string | number | undefined;
|
|
1077
|
+
radius?: string | number | undefined;
|
|
1078
|
+
pw?: string | number | undefined;
|
|
1079
|
+
ph?: string | number | undefined;
|
|
1080
|
+
h?: string | number | undefined;
|
|
1081
|
+
square?: boolean | undefined;
|
|
1082
|
+
d?: string | number | undefined;
|
|
1083
|
+
pd?: string | number | undefined;
|
|
1084
|
+
diameter?: string | number | undefined;
|
|
1085
|
+
r?: string | number | undefined;
|
|
1086
|
+
pr?: string | number | undefined;
|
|
1087
|
+
s?: string | number | undefined;
|
|
1088
|
+
size?: string | number | undefined;
|
|
1089
|
+
}>, {
|
|
1090
|
+
fn: string;
|
|
1091
|
+
shape: "circle" | "rect" | "square";
|
|
1092
|
+
radius: number | undefined;
|
|
1093
|
+
width: number | undefined;
|
|
1094
|
+
height: number | undefined;
|
|
1095
|
+
}, {
|
|
1096
|
+
fn: string;
|
|
1097
|
+
string?: string | undefined;
|
|
1098
|
+
circle?: boolean | undefined;
|
|
1099
|
+
w?: string | number | undefined;
|
|
1100
|
+
rect?: boolean | undefined;
|
|
1101
|
+
width?: string | number | undefined;
|
|
1102
|
+
height?: string | number | undefined;
|
|
1103
|
+
radius?: string | number | undefined;
|
|
1104
|
+
pw?: string | number | undefined;
|
|
1105
|
+
ph?: string | number | undefined;
|
|
1106
|
+
h?: string | number | undefined;
|
|
1107
|
+
square?: boolean | undefined;
|
|
1108
|
+
d?: string | number | undefined;
|
|
1109
|
+
pd?: string | number | undefined;
|
|
1110
|
+
diameter?: string | number | undefined;
|
|
1111
|
+
r?: string | number | undefined;
|
|
1112
|
+
pr?: string | number | undefined;
|
|
1113
|
+
s?: string | number | undefined;
|
|
1114
|
+
size?: string | number | undefined;
|
|
1029
1115
|
}>]>;
|
|
1030
1116
|
type AnyFootprinterDefinitionOutput = z.infer<typeof any_footprinter_def>;
|
|
1031
1117
|
|
|
@@ -1111,6 +1197,11 @@ type Footprinter = {
|
|
|
1111
1197
|
stampboard: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
|
|
1112
1198
|
stampreceiver: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
|
|
1113
1199
|
breakoutheaders: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "id" | "od">;
|
|
1200
|
+
smtpad: () => FootprinterParamsBuilder<"circle" | "rect" | "square" | "d" | "pd" | "diameter" | "r" | "pr" | "radius" | "w" | "pw" | "width" | "h" | "ph" | "height" | "s" | "size"> & {
|
|
1201
|
+
params: () => any;
|
|
1202
|
+
soup: () => AnySoupElement[];
|
|
1203
|
+
circuitJson: () => AnyCircuitElement[];
|
|
1204
|
+
};
|
|
1114
1205
|
pad: () => FootprinterParamsBuilder<"w" | "h"> & {
|
|
1115
1206
|
params: () => any;
|
|
1116
1207
|
soup: () => AnySoupElement[];
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,7 @@ __export(fn_exports, {
|
|
|
40
40
|
smbf: () => smbf,
|
|
41
41
|
smc: () => smc,
|
|
42
42
|
smf: () => smf,
|
|
43
|
+
smtpad: () => smtpad,
|
|
43
44
|
sod110: () => sod110,
|
|
44
45
|
sod123: () => sod123,
|
|
45
46
|
sod123f: () => sod123f,
|
|
@@ -3018,7 +3019,8 @@ var pad = (params) => {
|
|
|
3018
3019
|
circuitJson: [
|
|
3019
3020
|
rectpad(1, 0, 0, width, height),
|
|
3020
3021
|
silkscreenRef(0, height / 2 + 0.5, 0.2)
|
|
3021
|
-
]
|
|
3022
|
+
],
|
|
3023
|
+
parameters: params
|
|
3022
3024
|
};
|
|
3023
3025
|
};
|
|
3024
3026
|
|
|
@@ -4040,12 +4042,12 @@ var sot89_3 = (parameters) => {
|
|
|
4040
4042
|
const pads = [];
|
|
4041
4043
|
const padGap = Number.parseFloat(parameters.p);
|
|
4042
4044
|
const padWidth = Number.parseFloat(parameters.pw);
|
|
4043
|
-
const
|
|
4045
|
+
const length47 = Number.parseFloat(parameters.w);
|
|
4044
4046
|
const padHeight = Number.parseFloat(parameters.pl);
|
|
4045
4047
|
pads.push(
|
|
4046
|
-
rectpad(1, -
|
|
4047
|
-
rectpad(2, -
|
|
4048
|
-
rectpad(3, -
|
|
4048
|
+
rectpad(1, -length47 / 2, padGap, padHeight, padWidth),
|
|
4049
|
+
rectpad(2, -length47 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
|
|
4050
|
+
rectpad(3, -length47 / 2, -padGap, padHeight, padWidth)
|
|
4049
4051
|
);
|
|
4050
4052
|
const silkscreenRefText = silkscreenRef(0, 0, 0.3);
|
|
4051
4053
|
const width = Number.parseFloat(parameters.w) / 2 - 1;
|
|
@@ -4085,7 +4087,7 @@ var sot89_5 = (parameters) => {
|
|
|
4085
4087
|
const pads = [];
|
|
4086
4088
|
const padGap = Number.parseFloat(parameters.p);
|
|
4087
4089
|
const padWidth = Number.parseFloat(parameters.pw);
|
|
4088
|
-
const
|
|
4090
|
+
const length47 = Number.parseFloat(parameters.w);
|
|
4089
4091
|
pads.push(
|
|
4090
4092
|
rectpad(1, -1.85, -1.5, 1.5, 0.7),
|
|
4091
4093
|
rectpad(2, -1.85, 1.5, 1.5, 0.7),
|
|
@@ -6612,29 +6614,121 @@ var sot323_3 = (parameters) => {
|
|
|
6612
6614
|
];
|
|
6613
6615
|
};
|
|
6614
6616
|
|
|
6615
|
-
// src/fn/
|
|
6617
|
+
// src/fn/smtpad.ts
|
|
6616
6618
|
import { z as z58 } from "zod";
|
|
6617
6619
|
import { length as length45 } from "circuit-json";
|
|
6620
|
+
|
|
6621
|
+
// src/helpers/circlepad.ts
|
|
6622
|
+
var circlepad = (pn, { x, y, radius }) => {
|
|
6623
|
+
return {
|
|
6624
|
+
type: "pcb_smtpad",
|
|
6625
|
+
x,
|
|
6626
|
+
y,
|
|
6627
|
+
radius,
|
|
6628
|
+
layer: "top",
|
|
6629
|
+
shape: "circle",
|
|
6630
|
+
pcb_smtpad_id: "",
|
|
6631
|
+
port_hints: Array.isArray(pn) ? pn.map((item) => item.toString()) : [pn.toString()]
|
|
6632
|
+
};
|
|
6633
|
+
};
|
|
6634
|
+
|
|
6635
|
+
// src/fn/smtpad.ts
|
|
6618
6636
|
import { mm as mm6 } from "@tscircuit/mm";
|
|
6619
|
-
var
|
|
6637
|
+
var smtpad_def = z58.object({
|
|
6620
6638
|
fn: z58.string(),
|
|
6639
|
+
circle: z58.boolean().optional(),
|
|
6640
|
+
rect: z58.boolean().optional(),
|
|
6641
|
+
square: z58.boolean().optional(),
|
|
6621
6642
|
d: length45.optional(),
|
|
6622
|
-
hd: length45.optional(),
|
|
6623
|
-
r: length45.optional(),
|
|
6624
|
-
hr: length45.optional(),
|
|
6625
6643
|
pd: length45.optional(),
|
|
6644
|
+
diameter: length45.optional(),
|
|
6645
|
+
r: length45.optional(),
|
|
6626
6646
|
pr: length45.optional(),
|
|
6627
|
-
|
|
6647
|
+
radius: length45.optional(),
|
|
6648
|
+
w: length45.optional(),
|
|
6649
|
+
pw: length45.optional(),
|
|
6650
|
+
width: length45.optional(),
|
|
6651
|
+
h: length45.optional(),
|
|
6652
|
+
ph: length45.optional(),
|
|
6653
|
+
height: length45.optional(),
|
|
6654
|
+
s: length45.optional(),
|
|
6655
|
+
size: length45.optional(),
|
|
6656
|
+
string: z58.string().optional()
|
|
6657
|
+
}).transform((v) => {
|
|
6658
|
+
let shape = "rect";
|
|
6659
|
+
if (v.circle) shape = "circle";
|
|
6660
|
+
if (v.square) shape = "square";
|
|
6661
|
+
if (v.rect) shape = "rect";
|
|
6662
|
+
let radius;
|
|
6663
|
+
let width;
|
|
6664
|
+
let height;
|
|
6665
|
+
if (shape === "circle") {
|
|
6666
|
+
if (v.r !== void 0) radius = mm6(v.r);
|
|
6667
|
+
else if (v.pr !== void 0) radius = mm6(v.pr);
|
|
6668
|
+
else if (v.radius !== void 0) radius = mm6(v.radius);
|
|
6669
|
+
else if (v.d !== void 0) radius = mm6(v.d) / 2;
|
|
6670
|
+
else if (v.pd !== void 0) radius = mm6(v.pd) / 2;
|
|
6671
|
+
else if (v.diameter !== void 0) radius = mm6(v.diameter) / 2;
|
|
6672
|
+
else radius = mm6("1mm") / 2;
|
|
6673
|
+
} else {
|
|
6674
|
+
if (v.w !== void 0) width = mm6(v.w);
|
|
6675
|
+
else if (v.pw !== void 0) width = mm6(v.pw);
|
|
6676
|
+
else if (v.width !== void 0) width = mm6(v.width);
|
|
6677
|
+
else if (v.s !== void 0) width = mm6(v.s);
|
|
6678
|
+
else if (v.size !== void 0) width = mm6(v.size);
|
|
6679
|
+
else width = mm6("1mm");
|
|
6680
|
+
if (v.h !== void 0) height = mm6(v.h);
|
|
6681
|
+
else if (v.ph !== void 0) height = mm6(v.ph);
|
|
6682
|
+
else if (v.height !== void 0) height = mm6(v.height);
|
|
6683
|
+
else height = width;
|
|
6684
|
+
}
|
|
6685
|
+
return {
|
|
6686
|
+
fn: v.fn,
|
|
6687
|
+
shape,
|
|
6688
|
+
radius,
|
|
6689
|
+
width,
|
|
6690
|
+
height
|
|
6691
|
+
};
|
|
6692
|
+
});
|
|
6693
|
+
var smtpad = (raw_params) => {
|
|
6694
|
+
const params = smtpad_def.parse(raw_params);
|
|
6695
|
+
const { shape, radius, width, height } = params;
|
|
6696
|
+
return {
|
|
6697
|
+
circuitJson: [
|
|
6698
|
+
shape === "circle" ? circlepad(1, { x: 0, y: 0, radius }) : rectpad(1, 0, 0, width, height),
|
|
6699
|
+
silkscreenRef(
|
|
6700
|
+
0,
|
|
6701
|
+
shape === "circle" ? radius + 0.5 : height / 2 + 0.5,
|
|
6702
|
+
0.2
|
|
6703
|
+
)
|
|
6704
|
+
],
|
|
6705
|
+
parameters: params
|
|
6706
|
+
};
|
|
6707
|
+
};
|
|
6708
|
+
|
|
6709
|
+
// src/fn/platedhole.ts
|
|
6710
|
+
import { z as z59 } from "zod";
|
|
6711
|
+
import { length as length46 } from "circuit-json";
|
|
6712
|
+
import { mm as mm7 } from "@tscircuit/mm";
|
|
6713
|
+
var platedhole_def = z59.object({
|
|
6714
|
+
fn: z59.string(),
|
|
6715
|
+
d: length46.optional(),
|
|
6716
|
+
hd: length46.optional(),
|
|
6717
|
+
r: length46.optional(),
|
|
6718
|
+
hr: length46.optional(),
|
|
6719
|
+
pd: length46.optional(),
|
|
6720
|
+
pr: length46.optional(),
|
|
6721
|
+
squarepad: z59.boolean().optional().default(false)
|
|
6628
6722
|
}).transform((v) => {
|
|
6629
6723
|
let holeD;
|
|
6630
|
-
if (v.d !== void 0) holeD =
|
|
6631
|
-
else if (v.hd !== void 0) holeD =
|
|
6632
|
-
else if (v.r !== void 0) holeD =
|
|
6633
|
-
else if (v.hr !== void 0) holeD =
|
|
6634
|
-
else holeD =
|
|
6724
|
+
if (v.d !== void 0) holeD = mm7(v.d);
|
|
6725
|
+
else if (v.hd !== void 0) holeD = mm7(v.hd);
|
|
6726
|
+
else if (v.r !== void 0) holeD = mm7(v.r) * 2;
|
|
6727
|
+
else if (v.hr !== void 0) holeD = mm7(v.hr) * 2;
|
|
6728
|
+
else holeD = mm7("1mm");
|
|
6635
6729
|
let padD;
|
|
6636
|
-
if (v.pd !== void 0) padD =
|
|
6637
|
-
else if (v.pr !== void 0) padD =
|
|
6730
|
+
if (v.pd !== void 0) padD = mm7(v.pd);
|
|
6731
|
+
else if (v.pr !== void 0) padD = mm7(v.pr) * 2;
|
|
6638
6732
|
else padD = holeD * (1.5 / 1);
|
|
6639
6733
|
return {
|
|
6640
6734
|
fn: v.fn,
|
|
@@ -6656,14 +6750,14 @@ var platedhole3 = (raw_params) => {
|
|
|
6656
6750
|
};
|
|
6657
6751
|
|
|
6658
6752
|
// src/fn/sot.ts
|
|
6659
|
-
import { z as
|
|
6660
|
-
var sot_def =
|
|
6661
|
-
fn:
|
|
6662
|
-
num_pins:
|
|
6663
|
-
h:
|
|
6664
|
-
pl:
|
|
6665
|
-
pw:
|
|
6666
|
-
p:
|
|
6753
|
+
import { z as z60 } from "zod";
|
|
6754
|
+
var sot_def = z60.object({
|
|
6755
|
+
fn: z60.string(),
|
|
6756
|
+
num_pins: z60.literal(6).default(6),
|
|
6757
|
+
h: z60.string().default("1.6mm"),
|
|
6758
|
+
pl: z60.string().default("1mm"),
|
|
6759
|
+
pw: z60.string().default("0.7mm"),
|
|
6760
|
+
p: z60.string().default("0.95mm")
|
|
6667
6761
|
});
|
|
6668
6762
|
var sot = (raw_params) => {
|
|
6669
6763
|
const parameters = sot_def.parse(raw_params);
|