@tscircuit/footprinter 0.0.157 → 0.0.158
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 +1 -0
- package/dist/index.js +84 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1028,6 +1028,7 @@ type Footprinter = {
|
|
|
1028
1028
|
sma: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1029
1029
|
smf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1030
1030
|
smb: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1031
|
+
potentiometer: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "pw" | "ca">;
|
|
1031
1032
|
sod923: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1032
1033
|
sod323: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
|
1033
1034
|
sod80: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(fn_exports, {
|
|
|
27
27
|
msop: () => msop,
|
|
28
28
|
pad: () => pad,
|
|
29
29
|
pinrow: () => pinrow,
|
|
30
|
+
potentiometer: () => potentiometer,
|
|
30
31
|
pushbutton: () => pushbutton,
|
|
31
32
|
qfn: () => qfn,
|
|
32
33
|
qfp: () => qfp,
|
|
@@ -3998,8 +3999,8 @@ var to220_def = z34.object({
|
|
|
3998
3999
|
});
|
|
3999
4000
|
var to220 = (raw_params) => {
|
|
4000
4001
|
const parameters = to220_def.parse(raw_params);
|
|
4001
|
-
const { fn, id, od, w, h, string:
|
|
4002
|
-
const numPins = Number.parseInt(
|
|
4002
|
+
const { fn, id, od, w, h, string: string3 } = parameters;
|
|
4003
|
+
const numPins = Number.parseInt(string3?.split("_")[1] ?? "3");
|
|
4003
4004
|
const holeY = -1;
|
|
4004
4005
|
const halfWidth = w / 2;
|
|
4005
4006
|
const halfHeight = h / 2;
|
|
@@ -5763,13 +5764,91 @@ var solderjumper = (params) => {
|
|
|
5763
5764
|
};
|
|
5764
5765
|
};
|
|
5765
5766
|
|
|
5767
|
+
// src/fn/potentiometer.ts
|
|
5768
|
+
import { z as z52 } from "zod";
|
|
5769
|
+
var potentiometer_def = z52.object({
|
|
5770
|
+
fn: z52.string(),
|
|
5771
|
+
num_pins: z52.union([z52.literal(3), z52.literal(2)]).default(3),
|
|
5772
|
+
p: z52.string().default("3.8mm"),
|
|
5773
|
+
id: z52.string().default("1.25mm"),
|
|
5774
|
+
od: z52.string().default("2.35mm"),
|
|
5775
|
+
ca: z52.string().default("14mm").describe(
|
|
5776
|
+
"Caliper axis (width or diameter of the potentiometer body or adjustment knob)"
|
|
5777
|
+
),
|
|
5778
|
+
w: z52.string().default("5.35mm"),
|
|
5779
|
+
h: z52.string().default("4mm"),
|
|
5780
|
+
string: z52.string().optional()
|
|
5781
|
+
});
|
|
5782
|
+
var potentiometer_acp = (parameters) => {
|
|
5783
|
+
const { p, id, od, h, ca } = parameters;
|
|
5784
|
+
const y = Number.parseFloat(h);
|
|
5785
|
+
const caliper = Number.parseFloat(ca);
|
|
5786
|
+
return [
|
|
5787
|
+
platedhole(1, 0, caliper / 4 + 0.3, id, od),
|
|
5788
|
+
platedhole(2, y, 0, id, od),
|
|
5789
|
+
platedhole(3, 0, -caliper / 4 - 0.3, id, od)
|
|
5790
|
+
];
|
|
5791
|
+
};
|
|
5792
|
+
var potentiometer = (raw_params) => {
|
|
5793
|
+
const match = raw_params.string?.match(/^potentiometer_(\d+)/);
|
|
5794
|
+
const numPins = match ? Number.parseInt(match[1], 10) : 3;
|
|
5795
|
+
const parameters = potentiometer_def.parse({
|
|
5796
|
+
...raw_params,
|
|
5797
|
+
num_pins: numPins
|
|
5798
|
+
});
|
|
5799
|
+
let platedHoles = [];
|
|
5800
|
+
if (parameters.num_pins === 3) {
|
|
5801
|
+
platedHoles = potentiometer_acp(parameters);
|
|
5802
|
+
}
|
|
5803
|
+
const y = Number.parseFloat(parameters.ca) / 2 + 0.15;
|
|
5804
|
+
const x = Number.parseFloat(parameters.w);
|
|
5805
|
+
const od = Number.parseFloat(parameters.od) / 2 + 0.35;
|
|
5806
|
+
const silkscreenBody = {
|
|
5807
|
+
type: "pcb_silkscreen_path",
|
|
5808
|
+
layer: "top",
|
|
5809
|
+
pcb_component_id: "",
|
|
5810
|
+
route: [
|
|
5811
|
+
{ x: 0, y: y - 1.75 },
|
|
5812
|
+
{ x: 0, y },
|
|
5813
|
+
{ x, y },
|
|
5814
|
+
{ x, y: od }
|
|
5815
|
+
],
|
|
5816
|
+
stroke_width: 0.1,
|
|
5817
|
+
pcb_silkscreen_path_id: ""
|
|
5818
|
+
};
|
|
5819
|
+
const silkscreenBody2 = {
|
|
5820
|
+
type: "pcb_silkscreen_path",
|
|
5821
|
+
layer: "top",
|
|
5822
|
+
pcb_component_id: "",
|
|
5823
|
+
route: [
|
|
5824
|
+
{ x, y: -od },
|
|
5825
|
+
{ x, y: -y },
|
|
5826
|
+
{ x: 0, y: -y },
|
|
5827
|
+
{ x: 0, y: -y + 1.75 }
|
|
5828
|
+
],
|
|
5829
|
+
stroke_width: 0.1,
|
|
5830
|
+
pcb_silkscreen_path_id: ""
|
|
5831
|
+
};
|
|
5832
|
+
const W = Number.parseFloat(parameters.w) / 2;
|
|
5833
|
+
const silkscreenRefText = silkscreenRef(W, y + 1, 0.5);
|
|
5834
|
+
return {
|
|
5835
|
+
circuitJson: [
|
|
5836
|
+
...platedHoles,
|
|
5837
|
+
silkscreenBody,
|
|
5838
|
+
silkscreenBody2,
|
|
5839
|
+
silkscreenRefText
|
|
5840
|
+
],
|
|
5841
|
+
parameters
|
|
5842
|
+
};
|
|
5843
|
+
};
|
|
5844
|
+
|
|
5766
5845
|
// src/helpers/is-not-null.ts
|
|
5767
5846
|
function isNotNull(value) {
|
|
5768
5847
|
return value !== null;
|
|
5769
5848
|
}
|
|
5770
5849
|
|
|
5771
5850
|
// src/footprinter.ts
|
|
5772
|
-
var
|
|
5851
|
+
var string2 = (def) => {
|
|
5773
5852
|
let fp2 = footprinter();
|
|
5774
5853
|
const modifiedDef = (def.length === 4 || def.length === 5) && /^\d+$/.test(def) ? `res${def}` : def;
|
|
5775
5854
|
const def_parts = modifiedDef.split("_").map((s) => {
|
|
@@ -5873,7 +5952,7 @@ var footprinter = () => {
|
|
|
5873
5952
|
);
|
|
5874
5953
|
return proxy;
|
|
5875
5954
|
};
|
|
5876
|
-
footprinter.string =
|
|
5955
|
+
footprinter.string = string2;
|
|
5877
5956
|
footprinter.getFootprintNames = getFootprintNames;
|
|
5878
5957
|
var fp = footprinter;
|
|
5879
5958
|
export {
|
|
@@ -5882,6 +5961,6 @@ export {
|
|
|
5882
5961
|
getFootprintNames,
|
|
5883
5962
|
getFootprintNamesByType,
|
|
5884
5963
|
getFootprintSizes,
|
|
5885
|
-
string
|
|
5964
|
+
string2 as string
|
|
5886
5965
|
};
|
|
5887
5966
|
//# sourceMappingURL=index.js.map
|