@tscircuit/footprinter 0.0.142 → 0.0.144
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 +2 -0
- package/dist/index.js +186 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1041,7 +1041,9 @@ type Footprinter = {
|
|
|
1041
1041
|
sod123w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1042
1042
|
sod110: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1043
1043
|
to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "inline">;
|
|
1044
|
+
to92s: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
|
|
1044
1045
|
sot223: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1046
|
+
sot23w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1045
1047
|
pushbutton: () => FootprinterParamsBuilder<"tllabel" | "trlabel" | "bllabel" | "brlabel">;
|
|
1046
1048
|
stampboard: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
|
|
1047
1049
|
stampreceiver: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,7 @@ __export(fn_exports, {
|
|
|
51
51
|
sop8: () => sop8,
|
|
52
52
|
sot223: () => sot223,
|
|
53
53
|
sot23: () => sot23,
|
|
54
|
+
sot23w: () => sot23w,
|
|
54
55
|
sot363: () => sot363,
|
|
55
56
|
sot563: () => sot563,
|
|
56
57
|
sot723: () => sot723,
|
|
@@ -60,6 +61,7 @@ __export(fn_exports, {
|
|
|
60
61
|
stampreceiver: () => stampreceiver,
|
|
61
62
|
to220: () => to220,
|
|
62
63
|
to92: () => to92,
|
|
64
|
+
to92s: () => to92s,
|
|
63
65
|
tssop: () => tssop,
|
|
64
66
|
vssop8: () => vssop8
|
|
65
67
|
});
|
|
@@ -4724,11 +4726,183 @@ var sot223_6 = (parameters) => {
|
|
|
4724
4726
|
return [...pads, silkscreenPath1, silkscreenPath2, silkscreenRefText];
|
|
4725
4727
|
};
|
|
4726
4728
|
|
|
4729
|
+
// src/fn/sot23w.ts
|
|
4730
|
+
import { z as z43 } from "zod";
|
|
4731
|
+
var sot23w_def = z43.object({
|
|
4732
|
+
fn: z43.string(),
|
|
4733
|
+
num_pins: z43.number().default(3),
|
|
4734
|
+
w: z43.string().default("3.40mm"),
|
|
4735
|
+
h: z43.string().default("3.30mm"),
|
|
4736
|
+
pl: z43.string().default("1mm"),
|
|
4737
|
+
pw: z43.string().default("0.7mm"),
|
|
4738
|
+
p: z43.string().default("1.2mm"),
|
|
4739
|
+
string: z43.string().optional()
|
|
4740
|
+
});
|
|
4741
|
+
var sot23w = (raw_params) => {
|
|
4742
|
+
const match = raw_params.string?.match(/^sot23w_(\d+)/);
|
|
4743
|
+
const numPins = match ? Number.parseInt(match[1], 3) : 3;
|
|
4744
|
+
const parameters = sot23w_def.parse({
|
|
4745
|
+
...raw_params,
|
|
4746
|
+
num_pins: numPins
|
|
4747
|
+
});
|
|
4748
|
+
if (parameters.num_pins === 3) {
|
|
4749
|
+
return {
|
|
4750
|
+
circuitJson: sot23w_3(parameters),
|
|
4751
|
+
parameters
|
|
4752
|
+
};
|
|
4753
|
+
}
|
|
4754
|
+
throw new Error("Invalid number of pins");
|
|
4755
|
+
};
|
|
4756
|
+
var getCcwSot23wCoords = (parameters) => {
|
|
4757
|
+
const { pn, w, h, pl, p } = parameters;
|
|
4758
|
+
if (pn === 1) {
|
|
4759
|
+
return { x: -p, y: 0.95 };
|
|
4760
|
+
}
|
|
4761
|
+
if (pn === 2) {
|
|
4762
|
+
return { x: -p, y: -0.95 };
|
|
4763
|
+
}
|
|
4764
|
+
return { x: p, y: 0 };
|
|
4765
|
+
};
|
|
4766
|
+
var sot23w_3 = (parameters) => {
|
|
4767
|
+
const pads = [];
|
|
4768
|
+
for (let i = 0; i < parameters.num_pins; i++) {
|
|
4769
|
+
const { x, y } = getCcwSot23wCoords({
|
|
4770
|
+
num_pins: parameters.num_pins,
|
|
4771
|
+
pn: i + 1,
|
|
4772
|
+
w: Number.parseFloat(parameters.w),
|
|
4773
|
+
h: Number.parseFloat(parameters.h),
|
|
4774
|
+
pl: Number.parseFloat(parameters.pl),
|
|
4775
|
+
p: Number.parseFloat(parameters.p)
|
|
4776
|
+
});
|
|
4777
|
+
pads.push(
|
|
4778
|
+
rectpad(
|
|
4779
|
+
i + 1,
|
|
4780
|
+
x,
|
|
4781
|
+
y,
|
|
4782
|
+
Number.parseFloat(parameters.pl),
|
|
4783
|
+
Number.parseFloat(parameters.pw)
|
|
4784
|
+
)
|
|
4785
|
+
);
|
|
4786
|
+
}
|
|
4787
|
+
const silkscreenRefText = silkscreenRef(
|
|
4788
|
+
0,
|
|
4789
|
+
Number.parseInt(parameters.h) / 2 + 1,
|
|
4790
|
+
0.3
|
|
4791
|
+
);
|
|
4792
|
+
const width = Number.parseFloat(parameters.w) / 2 - 1;
|
|
4793
|
+
const height = Number.parseFloat(parameters.h) / 2;
|
|
4794
|
+
const silkscreenPath1 = {
|
|
4795
|
+
layer: "top",
|
|
4796
|
+
pcb_component_id: "",
|
|
4797
|
+
pcb_silkscreen_path_id: "silkscreen_path_1",
|
|
4798
|
+
route: [
|
|
4799
|
+
{ x: -width, y: height },
|
|
4800
|
+
{ x: width + 0.3, y: height },
|
|
4801
|
+
{ x: width + 0.3, y: height / 2 }
|
|
4802
|
+
],
|
|
4803
|
+
type: "pcb_silkscreen_path",
|
|
4804
|
+
stroke_width: 0.1
|
|
4805
|
+
};
|
|
4806
|
+
const silkscreenPath2 = {
|
|
4807
|
+
layer: "top",
|
|
4808
|
+
pcb_component_id: "",
|
|
4809
|
+
pcb_silkscreen_path_id: "silkscreen_path_2",
|
|
4810
|
+
route: [
|
|
4811
|
+
{ x: -width, y: -height },
|
|
4812
|
+
{ x: width + 0.3, y: -height },
|
|
4813
|
+
{ x: width + 0.3, y: -height / 2 }
|
|
4814
|
+
],
|
|
4815
|
+
type: "pcb_silkscreen_path",
|
|
4816
|
+
stroke_width: 0.1
|
|
4817
|
+
};
|
|
4818
|
+
return [
|
|
4819
|
+
...pads,
|
|
4820
|
+
silkscreenPath1,
|
|
4821
|
+
silkscreenPath2,
|
|
4822
|
+
silkscreenRefText
|
|
4823
|
+
];
|
|
4824
|
+
};
|
|
4825
|
+
|
|
4826
|
+
// src/fn/to92s.ts
|
|
4827
|
+
import { z as z44 } from "zod";
|
|
4828
|
+
var to92s_def = z44.object({
|
|
4829
|
+
fn: z44.string(),
|
|
4830
|
+
num_pins: z44.union([z44.literal(3), z44.literal(2)]).default(3),
|
|
4831
|
+
p: z44.string().default("1.27mm"),
|
|
4832
|
+
id: z44.string().default("0.72mm"),
|
|
4833
|
+
od: z44.string().default("0.95mm"),
|
|
4834
|
+
w: z44.string().default("2.5mm"),
|
|
4835
|
+
h: z44.string().default("4.2mm"),
|
|
4836
|
+
string: z44.string().optional()
|
|
4837
|
+
});
|
|
4838
|
+
var to92s_3 = (parameters) => {
|
|
4839
|
+
const { p, id, od, w, h } = parameters;
|
|
4840
|
+
const holeY = Number.parseFloat(h) / 2;
|
|
4841
|
+
const padSpacing = Number.parseFloat(p);
|
|
4842
|
+
return [
|
|
4843
|
+
platedhole(1, -padSpacing, holeY - padSpacing, id, od),
|
|
4844
|
+
platedhole(2, 0, holeY - padSpacing, id, od),
|
|
4845
|
+
platedhole(3, padSpacing, holeY - padSpacing, id, od)
|
|
4846
|
+
];
|
|
4847
|
+
};
|
|
4848
|
+
var to92s_2 = (parameters) => {
|
|
4849
|
+
const { p, id, od, h } = parameters;
|
|
4850
|
+
const holeY = Number.parseFloat(h) / 2;
|
|
4851
|
+
const padSpacing = Number.parseFloat(p);
|
|
4852
|
+
return [
|
|
4853
|
+
platedhole(1, -padSpacing, holeY - padSpacing, id, od),
|
|
4854
|
+
platedhole(2, padSpacing, holeY - padSpacing, id, od)
|
|
4855
|
+
];
|
|
4856
|
+
};
|
|
4857
|
+
var to92s = (raw_params) => {
|
|
4858
|
+
const match = raw_params.string?.match(/^to92s_(\d+)/);
|
|
4859
|
+
const numPins = match ? Number.parseInt(match[1], 10) : 3;
|
|
4860
|
+
const parameters = to92s_def.parse({
|
|
4861
|
+
...raw_params,
|
|
4862
|
+
num_pins: numPins
|
|
4863
|
+
});
|
|
4864
|
+
let platedHoles = [];
|
|
4865
|
+
if (parameters.num_pins === 3) {
|
|
4866
|
+
platedHoles = to92s_3(parameters);
|
|
4867
|
+
} else if (parameters.num_pins === 2) {
|
|
4868
|
+
platedHoles = to92s_2(parameters);
|
|
4869
|
+
} else {
|
|
4870
|
+
throw new Error("Invalid number of pins for TO-92");
|
|
4871
|
+
}
|
|
4872
|
+
const holeY = Number.parseFloat(parameters.h) / 2;
|
|
4873
|
+
const padSpacing = Number.parseFloat(parameters.p);
|
|
4874
|
+
const silkscreenBody = {
|
|
4875
|
+
type: "pcb_silkscreen_path",
|
|
4876
|
+
layer: "top",
|
|
4877
|
+
pcb_component_id: "",
|
|
4878
|
+
route: [
|
|
4879
|
+
{ x: -holeY, y: holeY - padSpacing },
|
|
4880
|
+
{ x: -1.9, y: 0 },
|
|
4881
|
+
{ x: 1.9, y: 0 },
|
|
4882
|
+
{ x: holeY, y: holeY - padSpacing },
|
|
4883
|
+
{ x: 1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
|
|
4884
|
+
{ x: -1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
|
|
4885
|
+
{ x: -holeY, y: holeY - padSpacing }
|
|
4886
|
+
],
|
|
4887
|
+
stroke_width: 0.1,
|
|
4888
|
+
pcb_silkscreen_path_id: ""
|
|
4889
|
+
};
|
|
4890
|
+
const silkscreenRefText = silkscreenRef(0, holeY + 1, 0.5);
|
|
4891
|
+
return {
|
|
4892
|
+
circuitJson: [
|
|
4893
|
+
...platedHoles,
|
|
4894
|
+
silkscreenBody,
|
|
4895
|
+
silkscreenRefText
|
|
4896
|
+
],
|
|
4897
|
+
parameters
|
|
4898
|
+
};
|
|
4899
|
+
};
|
|
4900
|
+
|
|
4727
4901
|
// src/fn/jst.ts
|
|
4728
4902
|
import {
|
|
4729
4903
|
length as length35
|
|
4730
4904
|
} from "circuit-json";
|
|
4731
|
-
import { z as
|
|
4905
|
+
import { z as z45 } from "zod";
|
|
4732
4906
|
|
|
4733
4907
|
// src/helpers/platedHoleWithRectPad.ts
|
|
4734
4908
|
import { mm as mm4 } from "@tscircuit/mm";
|
|
@@ -4751,8 +4925,8 @@ var platedHoleWithRectPad = (pn, x, y, holeDiameter, rectPadWidth, rectPadHeight
|
|
|
4751
4925
|
};
|
|
4752
4926
|
|
|
4753
4927
|
// src/fn/jst.ts
|
|
4754
|
-
var jst_def =
|
|
4755
|
-
fn:
|
|
4928
|
+
var jst_def = z45.object({
|
|
4929
|
+
fn: z45.string(),
|
|
4756
4930
|
p: length35.optional().default("2.2mm"),
|
|
4757
4931
|
id: length35.optional().default("0.70mm"),
|
|
4758
4932
|
pw: length35.optional().default("1.20mm"),
|
|
@@ -4794,16 +4968,16 @@ var jst = (raw_params) => {
|
|
|
4794
4968
|
};
|
|
4795
4969
|
|
|
4796
4970
|
// src/fn/sod110.ts
|
|
4797
|
-
import { z as
|
|
4971
|
+
import { z as z46 } from "zod";
|
|
4798
4972
|
import { length as length36 } from "circuit-json";
|
|
4799
|
-
var sod_def12 =
|
|
4800
|
-
fn:
|
|
4801
|
-
num_pins:
|
|
4802
|
-
w:
|
|
4803
|
-
h:
|
|
4804
|
-
pl:
|
|
4805
|
-
pw:
|
|
4806
|
-
p:
|
|
4973
|
+
var sod_def12 = z46.object({
|
|
4974
|
+
fn: z46.string(),
|
|
4975
|
+
num_pins: z46.literal(2).default(2),
|
|
4976
|
+
w: z46.string().default("3.30mm"),
|
|
4977
|
+
h: z46.string().default("1.70mm"),
|
|
4978
|
+
pl: z46.string().default("0.80mm"),
|
|
4979
|
+
pw: z46.string().default("1mm"),
|
|
4980
|
+
p: z46.string().default("1.90mm")
|
|
4807
4981
|
});
|
|
4808
4982
|
var sod110 = (raw_params) => {
|
|
4809
4983
|
const parameters = sod_def12.parse(raw_params);
|