@tscircuit/footprinter 0.0.160 → 0.0.161

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
@@ -1048,6 +1048,7 @@ type Footprinter = {
1048
1048
  to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "inline">;
1049
1049
  to92s: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
1050
1050
  sot223: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1051
+ son: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw" | "epw" | "eph" | "ep">;
1051
1052
  vssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1052
1053
  msop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1053
1054
  sot23w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
package/dist/index.js CHANGED
@@ -56,6 +56,7 @@ __export(fn_exports, {
56
56
  sod923: () => sod923,
57
57
  soic: () => soic,
58
58
  solderjumper: () => solderjumper,
59
+ son: () => son,
59
60
  sop8: () => sop8,
60
61
  sot223: () => sot223,
61
62
  sot23: () => sot23,
@@ -3872,12 +3873,12 @@ var sot89_3 = (parameters) => {
3872
3873
  const pads = [];
3873
3874
  const padGap = Number.parseFloat(parameters.p);
3874
3875
  const padWidth = Number.parseFloat(parameters.pw);
3875
- const length44 = Number.parseFloat(parameters.w);
3876
+ const length45 = Number.parseFloat(parameters.w);
3876
3877
  const padHeight = Number.parseFloat(parameters.pl);
3877
3878
  pads.push(
3878
- rectpad(1, -length44 / 2, padGap, padHeight, padWidth),
3879
- rectpad(2, -length44 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
3880
- rectpad(3, -length44 / 2, -padGap, padHeight, padWidth)
3879
+ rectpad(1, -length45 / 2, padGap, padHeight, padWidth),
3880
+ rectpad(2, -length45 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
3881
+ rectpad(3, -length45 / 2, -padGap, padHeight, padWidth)
3881
3882
  );
3882
3883
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
3883
3884
  const width = Number.parseFloat(parameters.w) / 2 - 1;
@@ -3917,7 +3918,7 @@ var sot89_5 = (parameters) => {
3917
3918
  const pads = [];
3918
3919
  const padGap = Number.parseFloat(parameters.p);
3919
3920
  const padWidth = Number.parseFloat(parameters.pw);
3920
- const length44 = Number.parseFloat(parameters.w);
3921
+ const length45 = Number.parseFloat(parameters.w);
3921
3922
  pads.push(
3922
3923
  rectpad(1, -1.85, -1.5, 1.5, 0.7),
3923
3924
  rectpad(2, -1.85, 1.5, 1.5, 0.7),
@@ -5704,13 +5705,123 @@ var sodWithoutParsing15 = (parameters) => {
5704
5705
  return pads;
5705
5706
  };
5706
5707
 
5707
- // src/fn/solderjumper.ts
5708
+ // src/fn/son.ts
5709
+ import { z as z52 } from "zod";
5708
5710
  import { length as length42 } from "circuit-json";
5711
+ var son_def = z52.object({
5712
+ fn: z52.string(),
5713
+ num_pins: z52.literal(8).default(8),
5714
+ w: z52.string().default("3mm"),
5715
+ h: z52.string().default("3mm"),
5716
+ p: z52.string().default("0.5mm"),
5717
+ pl: z52.string().default("0.52mm"),
5718
+ pw: z52.string().default("0.35mm"),
5719
+ epw: z52.string().default("1.40mm"),
5720
+ eph: z52.string().default("1.60mm"),
5721
+ string: z52.string().optional(),
5722
+ ep: z52.boolean().default(false)
5723
+ });
5724
+ var son = (raw_params) => {
5725
+ if (raw_params.string && raw_params.string.includes("_ep")) {
5726
+ raw_params.ep = true;
5727
+ }
5728
+ const parameters = son_def.parse(raw_params);
5729
+ const w = length42.parse(parameters.w);
5730
+ const h = length42.parse(parameters.h);
5731
+ const p = length42.parse(parameters.p);
5732
+ const pl = length42.parse(parameters.pl);
5733
+ const pw = length42.parse(parameters.pw);
5734
+ const epw = length42.parse(parameters.epw);
5735
+ const eph = length42.parse(parameters.eph);
5736
+ const pads = [];
5737
+ for (let i = 0; i < parameters.num_pins; i++) {
5738
+ const { x, y } = getSonPadCoord(parameters.num_pins, i + 1, w, p);
5739
+ pads.push(rectpad(i + 1, x, y, pl, pw));
5740
+ }
5741
+ if (parameters.ep) {
5742
+ pads.push(rectpad(parameters.num_pins + 1, 0, 0, epw, eph));
5743
+ }
5744
+ const silkscreenBoxWidth = w;
5745
+ const silkscreenBoxHeight = h;
5746
+ const silkscreenTopLine = {
5747
+ type: "pcb_silkscreen_path",
5748
+ layer: "top",
5749
+ pcb_component_id: "",
5750
+ route: [
5751
+ { x: -silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 },
5752
+ { x: silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 }
5753
+ ],
5754
+ stroke_width: 0.05,
5755
+ pcb_silkscreen_path_id: ""
5756
+ };
5757
+ const silkscreenBottomLine = {
5758
+ type: "pcb_silkscreen_path",
5759
+ layer: "top",
5760
+ pcb_component_id: "",
5761
+ route: [
5762
+ { x: -silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 },
5763
+ { x: silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 }
5764
+ ],
5765
+ stroke_width: 0.05,
5766
+ pcb_silkscreen_path_id: ""
5767
+ };
5768
+ const pin1Position = getSonPadCoord(
5769
+ parameters.num_pins,
5770
+ 1,
5771
+ silkscreenBoxWidth,
5772
+ p
5773
+ );
5774
+ const pin1MarkerPosition = {
5775
+ x: pin1Position.x - 0.4,
5776
+ y: pin1Position.y
5777
+ };
5778
+ const pin1Marking = {
5779
+ type: "pcb_silkscreen_path",
5780
+ layer: "top",
5781
+ pcb_component_id: "pin_marker_1",
5782
+ route: [
5783
+ { x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y },
5784
+ { x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y + 0.3 },
5785
+ { x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y - 0.3 },
5786
+ { x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y }
5787
+ ],
5788
+ stroke_width: 0.05,
5789
+ pcb_silkscreen_path_id: "pin_marker_1"
5790
+ };
5791
+ const silkscreenRefText = silkscreenRef(
5792
+ 0,
5793
+ silkscreenBoxHeight / 2 + 0.5,
5794
+ 0.3
5795
+ );
5796
+ return {
5797
+ circuitJson: [
5798
+ ...pads,
5799
+ silkscreenTopLine,
5800
+ silkscreenBottomLine,
5801
+ silkscreenRefText,
5802
+ pin1Marking
5803
+ ],
5804
+ parameters
5805
+ };
5806
+ };
5807
+ var getSonPadCoord = (num_pins, pn, w, p) => {
5808
+ const half = num_pins / 2;
5809
+ const rowIndex = (pn - 1) % half;
5810
+ const col = pn <= half ? -1 : 1;
5811
+ const row = (half - 1) / 2 - rowIndex;
5812
+ return {
5813
+ x: col * length42.parse("1.4mm"),
5814
+ y: row * p
5815
+ };
5816
+ };
5817
+
5818
+ // src/fn/solderjumper.ts
5819
+ import { length as length43 } from "circuit-json";
5709
5820
  var solderjumper = (params) => {
5710
5821
  const { num_pins, bridged, p = 2.54, pw = 1.5, ph = 1.5 } = params;
5711
- const padSpacing = length42.parse(p);
5712
- const padWidth = length42.parse(pw);
5713
- const padHeight = length42.parse(ph);
5822
+ const padSpacing = length43.parse(p);
5823
+ const padWidth = length43.parse(pw);
5824
+ const padHeight = length43.parse(ph);
5714
5825
  const traceWidth = Math.min(padHeight / 4, 0.5);
5715
5826
  const pads = [];
5716
5827
  for (let i = 0; i < num_pins; i++) {
@@ -5798,19 +5909,19 @@ var solderjumper = (params) => {
5798
5909
  };
5799
5910
 
5800
5911
  // src/fn/potentiometer.ts
5801
- import { z as z52 } from "zod";
5802
- var potentiometer_def = z52.object({
5803
- fn: z52.string(),
5804
- num_pins: z52.union([z52.literal(3), z52.literal(2)]).default(3),
5805
- p: z52.string().default("3.8mm"),
5806
- id: z52.string().default("1.25mm"),
5807
- od: z52.string().default("2.35mm"),
5808
- ca: z52.string().default("14mm").describe(
5912
+ import { z as z53 } from "zod";
5913
+ var potentiometer_def = z53.object({
5914
+ fn: z53.string(),
5915
+ num_pins: z53.union([z53.literal(3), z53.literal(2)]).default(3),
5916
+ p: z53.string().default("3.8mm"),
5917
+ id: z53.string().default("1.25mm"),
5918
+ od: z53.string().default("2.35mm"),
5919
+ ca: z53.string().default("14mm").describe(
5809
5920
  "Caliper axis (width or diameter of the potentiometer body or adjustment knob)"
5810
5921
  ),
5811
- w: z52.string().default("5.35mm"),
5812
- h: z52.string().default("4mm"),
5813
- string: z52.string().optional()
5922
+ w: z53.string().default("5.35mm"),
5923
+ h: z53.string().default("4mm"),
5924
+ string: z53.string().optional()
5814
5925
  });
5815
5926
  var potentiometer_acp = (parameters) => {
5816
5927
  const { p, id, od, h, ca } = parameters;
@@ -5877,15 +5988,15 @@ var potentiometer = (raw_params) => {
5877
5988
 
5878
5989
  // src/fn/electrolytic.ts
5879
5990
  import {
5880
- length as length43
5991
+ length as length44
5881
5992
  } from "circuit-json";
5882
- import { z as z53 } from "zod";
5883
- var electrolytic_def = z53.object({
5884
- fn: z53.string(),
5885
- p: length43.optional().default("7.5mm"),
5886
- id: length43.optional().default("1mm"),
5887
- od: length43.optional().default("2mm"),
5888
- d: length43.optional().default("10.5mm")
5993
+ import { z as z54 } from "zod";
5994
+ var electrolytic_def = z54.object({
5995
+ fn: z54.string(),
5996
+ p: length44.optional().default("7.5mm"),
5997
+ id: length44.optional().default("1mm"),
5998
+ od: length44.optional().default("2mm"),
5999
+ d: length44.optional().default("10.5mm")
5889
6000
  });
5890
6001
  var generate_circle_arcs = (centerX, centerY, radius, cut, cutHeight) => {
5891
6002
  const topArc = [];