@tscircuit/footprinter 0.0.165 → 0.0.166

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 CHANGED
@@ -1019,6 +1019,7 @@ type Footprinter = {
1019
1019
  hc49: () => FootprinterParamsBuilder<"p" | "id" | "od" | "w" | "h">;
1020
1020
  to220: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
1021
1021
  sot363: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw">;
1022
+ sot457: () => FootprinterParamsBuilder<"w" | "p" | "h" | "pl" | "pw" | "wave" | "reflow" | "pillr" | "pillh" | "pillw">;
1022
1023
  sot563: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw">;
1023
1024
  sot723: () => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
1024
1025
  sot23: () => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
package/dist/index.js CHANGED
@@ -62,6 +62,7 @@ __export(fn_exports, {
62
62
  sot23: () => sot23,
63
63
  sot23w: () => sot23w,
64
64
  sot363: () => sot363,
65
+ sot457: () => sot457,
65
66
  sot563: () => sot563,
66
67
  sot723: () => sot723,
67
68
  sot89: () => sot89,
@@ -5933,20 +5934,204 @@ var solderjumper = (params) => {
5933
5934
  };
5934
5935
  };
5935
5936
 
5936
- // src/fn/potentiometer.ts
5937
+ // src/fn/sot457.ts
5937
5938
  import { z as z53 } from "zod";
5938
- var potentiometer_def = z53.object({
5939
- fn: z53.string(),
5940
- num_pins: z53.union([z53.literal(3), z53.literal(2)]).default(3),
5941
- p: z53.string().default("3.8mm"),
5942
- id: z53.string().default("1.25mm"),
5943
- od: z53.string().default("2.35mm"),
5944
- ca: z53.string().default("14mm").describe(
5939
+
5940
+ // src/helpers/pillpad.ts
5941
+ var pillpad = (pn, x, y, w, h) => {
5942
+ return {
5943
+ type: "pcb_smtpad",
5944
+ x,
5945
+ y,
5946
+ width: w,
5947
+ height: h,
5948
+ radius: h / 2,
5949
+ layer: "top",
5950
+ shape: "pill",
5951
+ pcb_smtpad_id: "",
5952
+ port_hints: Array.isArray(pn) ? pn.map((item) => item.toString()) : [pn.toString()]
5953
+ };
5954
+ };
5955
+
5956
+ // src/fn/sot457.ts
5957
+ var commonSchema = {
5958
+ fn: z53.literal("sot457"),
5959
+ num_pins: z53.literal(6).default(6),
5960
+ pillh: z53.string().default("0.45mm"),
5961
+ pillw: z53.string().default("1.45mm"),
5962
+ pl: z53.string(),
5963
+ pw: z53.string(),
5964
+ p: z53.string(),
5965
+ wave: z53.boolean().optional(),
5966
+ reflow: z53.boolean().optional()
5967
+ };
5968
+ var sot457DefSchema = z53.object({
5969
+ ...commonSchema,
5970
+ h: z53.string().default("2.5mm"),
5971
+ w: z53.string().default("2.7mm"),
5972
+ pl: z53.string().default("0.8mm"),
5973
+ pw: z53.string().default("0.55mm"),
5974
+ p: z53.string().default("0.95mm")
5975
+ });
5976
+ var sot457WaveSchema = z53.object({
5977
+ ...commonSchema,
5978
+ h: z53.string().default("3mm"),
5979
+ w: z53.string().default("4mm"),
5980
+ pillr: z53.string().default("0.225mm"),
5981
+ pl: z53.string().default("1.45mm"),
5982
+ pw: z53.string().default("1.5mm"),
5983
+ p: z53.string().default("1.475mm")
5984
+ }).transform((data) => ({
5985
+ ...data,
5986
+ wave: data.wave ?? (data.reflow === void 0 ? true : !data.reflow),
5987
+ reflow: data.reflow ?? (data.wave === void 0 ? false : !data.wave)
5988
+ }));
5989
+ var parseDimension = (value) => {
5990
+ return Number.parseFloat(value.replace("mm", ""));
5991
+ };
5992
+ var getCcwSot457Coords = ({
5993
+ pitch,
5994
+ width,
5995
+ pinNumber
5996
+ }) => {
5997
+ const offset = 0.1;
5998
+ const coords = {
5999
+ 1: { x: -width / 2 - offset, y: pitch },
6000
+ 2: { x: -width / 2 - offset, y: 0 },
6001
+ 3: { x: -width / 2 - offset, y: -pitch },
6002
+ 4: { x: width / 2 + offset, y: -pitch },
6003
+ 5: { x: width / 2 + offset, y: 0 },
6004
+ 6: { x: width / 2 + offset, y: pitch }
6005
+ };
6006
+ const coord = coords[pinNumber];
6007
+ if (!coord) {
6008
+ throw new Error(`Invalid pin number: ${pinNumber}`);
6009
+ }
6010
+ return coord;
6011
+ };
6012
+ var generateSot457Elements = (params) => {
6013
+ const pads = [];
6014
+ const pitch = parseDimension(params.p);
6015
+ const padLength = parseDimension(params.pl);
6016
+ const padWidth = parseDimension(params.pw);
6017
+ const width = parseDimension(params.w);
6018
+ const height = parseDimension(params.h);
6019
+ if (params.wave) {
6020
+ const pinConfigs = {
6021
+ 1: ({ padWidth: padWidth2, padHeight }) => rectpad(1, -pitch, pitch, padHeight, padWidth2),
6022
+ 2: ({ padWidth: padWidth2, padHeight }) => rectpad(2, -pitch, -pitch, padHeight, padWidth2),
6023
+ 3: ({ padWidth: padWidth2, padHeight }) => pillpad(
6024
+ 3,
6025
+ -pitch,
6026
+ 0,
6027
+ parseDimension(params.pillw),
6028
+ parseDimension(params.pillh)
6029
+ ),
6030
+ 4: ({ padWidth: padWidth2, padHeight }) => pillpad(
6031
+ 4,
6032
+ pitch,
6033
+ 0,
6034
+ parseDimension(params.pillw),
6035
+ parseDimension(params.pillh)
6036
+ ),
6037
+ 5: ({ padWidth: padWidth2, padHeight }) => rectpad(5, pitch, pitch, padHeight, padWidth2),
6038
+ 6: ({ padWidth: padWidth2, padHeight }) => rectpad(6, pitch, -pitch, padHeight, padWidth2)
6039
+ };
6040
+ for (let i = 1; i <= params.num_pins; i++) {
6041
+ const config = pinConfigs[i];
6042
+ if (config) {
6043
+ pads.push(config({ padWidth: padLength, padHeight: padWidth }));
6044
+ }
6045
+ }
6046
+ } else {
6047
+ for (let i = 1; i <= params.num_pins; i++) {
6048
+ const { x, y } = getCcwSot457Coords({ pitch, width, pinNumber: i });
6049
+ pads.push(rectpad(i, x, y, padLength, padWidth));
6050
+ }
6051
+ }
6052
+ const silkscreenPath1 = {
6053
+ type: "pcb_silkscreen_path",
6054
+ layer: "top",
6055
+ pcb_component_id: "",
6056
+ pcb_silkscreen_path_id: "silkscreen_path_1",
6057
+ route: [
6058
+ { x: -width / 3, y: height / 2 + pitch / 1.3 },
6059
+ { x: width / 3, y: height / 2 + pitch / 1.3 }
6060
+ ],
6061
+ stroke_width: 0.05
6062
+ };
6063
+ const silkscreenPath2 = {
6064
+ type: "pcb_silkscreen_path",
6065
+ layer: "top",
6066
+ pcb_component_id: "",
6067
+ pcb_silkscreen_path_id: "silkscreen_path_2",
6068
+ route: [
6069
+ { x: -width / 3, y: -height / 2 - pitch / 1.3 },
6070
+ { x: width / 3, y: -height / 2 - pitch / 1.3 }
6071
+ ],
6072
+ stroke_width: 0.05
6073
+ };
6074
+ const silkscreenRefText = silkscreenRef(0, height + 0.5, 0.3);
6075
+ const pin1Position = getCcwSot457Coords({ pitch, width, pinNumber: 1 });
6076
+ const triangleHeight = params.wave ? 1 : 0.5;
6077
+ const triangleWidth = params.wave ? 0.7 : 0.3;
6078
+ pin1Position.x -= params.wave ? padWidth : padWidth * 1.7;
6079
+ const pin1Indicator = {
6080
+ type: "pcb_silkscreen_path",
6081
+ layer: "top",
6082
+ pcb_component_id: "",
6083
+ pcb_silkscreen_path_id: "pin1_indicator",
6084
+ route: [
6085
+ { x: pin1Position.x + triangleHeight / 2, y: pin1Position.y },
6086
+ {
6087
+ x: pin1Position.x - triangleHeight / 2,
6088
+ y: pin1Position.y + triangleWidth / 2
6089
+ },
6090
+ {
6091
+ x: pin1Position.x - triangleHeight / 2,
6092
+ y: pin1Position.y - triangleWidth / 2
6093
+ },
6094
+ { x: pin1Position.x + triangleHeight / 2, y: pin1Position.y }
6095
+ ],
6096
+ stroke_width: 0.05
6097
+ };
6098
+ return [
6099
+ silkscreenRefText,
6100
+ silkscreenPath1,
6101
+ silkscreenPath2,
6102
+ pin1Indicator,
6103
+ ...pads
6104
+ ];
6105
+ };
6106
+ var sot457 = (rawParams) => {
6107
+ if (rawParams.wave) {
6108
+ const parameters2 = sot457WaveSchema.parse({ ...rawParams, fn: "sot457" });
6109
+ return {
6110
+ circuitJson: generateSot457Elements(parameters2),
6111
+ parameters: parameters2
6112
+ };
6113
+ }
6114
+ const parameters = sot457DefSchema.parse(rawParams);
6115
+ return {
6116
+ circuitJson: generateSot457Elements(parameters),
6117
+ parameters
6118
+ };
6119
+ };
6120
+
6121
+ // src/fn/potentiometer.ts
6122
+ import { z as z54 } from "zod";
6123
+ var potentiometer_def = z54.object({
6124
+ fn: z54.string(),
6125
+ num_pins: z54.union([z54.literal(3), z54.literal(2)]).default(3),
6126
+ p: z54.string().default("3.8mm"),
6127
+ id: z54.string().default("1.25mm"),
6128
+ od: z54.string().default("2.35mm"),
6129
+ ca: z54.string().default("14mm").describe(
5945
6130
  "Caliper axis (width or diameter of the potentiometer body or adjustment knob)"
5946
6131
  ),
5947
- w: z53.string().default("5.35mm"),
5948
- h: z53.string().default("4mm"),
5949
- string: z53.string().optional()
6132
+ w: z54.string().default("5.35mm"),
6133
+ h: z54.string().default("4mm"),
6134
+ string: z54.string().optional()
5950
6135
  });
5951
6136
  var potentiometer_acp = (parameters) => {
5952
6137
  const { p, id, od, h, ca } = parameters;
@@ -6015,9 +6200,9 @@ var potentiometer = (raw_params) => {
6015
6200
  import {
6016
6201
  length as length43
6017
6202
  } from "circuit-json";
6018
- import { z as z54 } from "zod";
6019
- var electrolytic_def = z54.object({
6020
- fn: z54.string(),
6203
+ import { z as z55 } from "zod";
6204
+ var electrolytic_def = z55.object({
6205
+ fn: z55.string(),
6021
6206
  p: length43.optional().default("7.5mm"),
6022
6207
  id: length43.optional().default("1mm"),
6023
6208
  od: length43.optional().default("2mm"),