@tscircuit/footprinter 0.0.141 → 0.0.143

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
@@ -379,9 +379,9 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
379
379
  p?: string | number | undefined;
380
380
  id?: string | number | undefined;
381
381
  od?: string | number | undefined;
382
- rows?: string | number | undefined;
383
382
  male?: boolean | undefined;
384
383
  female?: boolean | undefined;
384
+ rows?: string | number | undefined;
385
385
  }>, {
386
386
  male: boolean;
387
387
  female: boolean;
@@ -397,9 +397,9 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
397
397
  p?: string | number | undefined;
398
398
  id?: string | number | undefined;
399
399
  od?: string | number | undefined;
400
- rows?: string | number | undefined;
401
400
  male?: boolean | undefined;
402
401
  female?: boolean | undefined;
402
+ rows?: string | number | undefined;
403
403
  }>, {
404
404
  male: boolean;
405
405
  female: boolean;
@@ -415,9 +415,9 @@ declare const any_footprinter_def: z.ZodUnion<[z.ZodObject<{
415
415
  p?: string | number | undefined;
416
416
  id?: string | number | undefined;
417
417
  od?: string | number | undefined;
418
- rows?: string | number | undefined;
419
418
  male?: boolean | undefined;
420
419
  female?: boolean | undefined;
420
+ rows?: string | number | undefined;
421
421
  }>, z.ZodEffects<z.ZodObject<z.objectUtil.extendShape<{
422
422
  fn: z.ZodString;
423
423
  cc: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -1019,6 +1019,7 @@ type Footprinter = {
1019
1019
  smc: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
1020
1020
  minimelf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
1021
1021
  melf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
1022
+ jst: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "pw" | "pl">;
1022
1023
  micromelf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
1023
1024
  ms013: () => FootprinterParamsBuilder<"w" | "p">;
1024
1025
  ms012: () => FootprinterParamsBuilder<"w" | "p">;
@@ -1040,6 +1041,7 @@ type Footprinter = {
1040
1041
  sod123w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1041
1042
  sod110: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1042
1043
  to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "inline">;
1044
+ to92s: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
1043
1045
  sot223: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1044
1046
  pushbutton: () => FootprinterParamsBuilder<"tllabel" | "trlabel" | "bllabel" | "brlabel">;
1045
1047
  stampboard: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ __export(fn_exports, {
15
15
  diode: () => diode,
16
16
  dip: () => dip,
17
17
  hc49: () => hc49,
18
+ jst: () => jst,
18
19
  led: () => led,
19
20
  lqfp: () => lqfp,
20
21
  melf: () => melf,
@@ -59,6 +60,7 @@ __export(fn_exports, {
59
60
  stampreceiver: () => stampreceiver,
60
61
  to220: () => to220,
61
62
  to92: () => to92,
63
+ to92s: () => to92s,
62
64
  tssop: () => tssop,
63
65
  vssop8: () => vssop8
64
66
  });
@@ -3534,12 +3536,12 @@ var sot89_3 = (parameters) => {
3534
3536
  const pads = [];
3535
3537
  const padGap = Number.parseFloat(parameters.p);
3536
3538
  const padWidth = Number.parseFloat(parameters.pw);
3537
- const length36 = Number.parseFloat(parameters.w);
3539
+ const length37 = Number.parseFloat(parameters.w);
3538
3540
  const padHeight = Number.parseFloat(parameters.pl);
3539
3541
  pads.push(
3540
- rectpad(1, -length36 / 2, padGap, padHeight, padWidth),
3541
- rectpad(2, -length36 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
3542
- rectpad(3, -length36 / 2, -padGap, padHeight, padWidth)
3542
+ rectpad(1, -length37 / 2, padGap, padHeight, padWidth),
3543
+ rectpad(2, -length37 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
3544
+ rectpad(3, -length37 / 2, -padGap, padHeight, padWidth)
3543
3545
  );
3544
3546
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
3545
3547
  const width = Number.parseFloat(parameters.w) / 2 - 1;
@@ -3579,7 +3581,7 @@ var sot89_5 = (parameters) => {
3579
3581
  const pads = [];
3580
3582
  const padGap = Number.parseFloat(parameters.p);
3581
3583
  const padWidth = Number.parseFloat(parameters.pw);
3582
- const length36 = Number.parseFloat(parameters.w);
3584
+ const length37 = Number.parseFloat(parameters.w);
3583
3585
  pads.push(
3584
3586
  rectpad(1, -1.85, -1.5, 1.5, 0.7),
3585
3587
  rectpad(2, -1.85, 1.5, 1.5, 0.7),
@@ -4723,23 +4725,167 @@ var sot223_6 = (parameters) => {
4723
4725
  return [...pads, silkscreenPath1, silkscreenPath2, silkscreenRefText];
4724
4726
  };
4725
4727
 
4726
- // src/fn/sod110.ts
4728
+ // src/fn/to92s.ts
4727
4729
  import { z as z43 } from "zod";
4728
- import { length as length35 } from "circuit-json";
4729
- var sod_def12 = z43.object({
4730
+ var to92s_def = z43.object({
4730
4731
  fn: z43.string(),
4731
- num_pins: z43.literal(2).default(2),
4732
- w: z43.string().default("3.30mm"),
4733
- h: z43.string().default("1.70mm"),
4734
- pl: z43.string().default("0.80mm"),
4735
- pw: z43.string().default("1mm"),
4736
- p: z43.string().default("1.90mm")
4732
+ num_pins: z43.union([z43.literal(3), z43.literal(2)]).default(3),
4733
+ p: z43.string().default("1.27mm"),
4734
+ id: z43.string().default("0.72mm"),
4735
+ od: z43.string().default("0.95mm"),
4736
+ w: z43.string().default("2.5mm"),
4737
+ h: z43.string().default("4.2mm"),
4738
+ string: z43.string().optional()
4739
+ });
4740
+ var to92s_3 = (parameters) => {
4741
+ const { p, id, od, w, h } = parameters;
4742
+ const holeY = Number.parseFloat(h) / 2;
4743
+ const padSpacing = Number.parseFloat(p);
4744
+ return [
4745
+ platedhole(1, -padSpacing, holeY - padSpacing, id, od),
4746
+ platedhole(2, 0, holeY - padSpacing, id, od),
4747
+ platedhole(3, padSpacing, holeY - padSpacing, id, od)
4748
+ ];
4749
+ };
4750
+ var to92s_2 = (parameters) => {
4751
+ const { p, id, od, h } = parameters;
4752
+ const holeY = Number.parseFloat(h) / 2;
4753
+ const padSpacing = Number.parseFloat(p);
4754
+ return [
4755
+ platedhole(1, -padSpacing, holeY - padSpacing, id, od),
4756
+ platedhole(2, padSpacing, holeY - padSpacing, id, od)
4757
+ ];
4758
+ };
4759
+ var to92s = (raw_params) => {
4760
+ const match = raw_params.string?.match(/^to92s_(\d+)/);
4761
+ const numPins = match ? Number.parseInt(match[1], 10) : 3;
4762
+ const parameters = to92s_def.parse({
4763
+ ...raw_params,
4764
+ num_pins: numPins
4765
+ });
4766
+ let platedHoles = [];
4767
+ if (parameters.num_pins === 3) {
4768
+ platedHoles = to92s_3(parameters);
4769
+ } else if (parameters.num_pins === 2) {
4770
+ platedHoles = to92s_2(parameters);
4771
+ } else {
4772
+ throw new Error("Invalid number of pins for TO-92");
4773
+ }
4774
+ const holeY = Number.parseFloat(parameters.h) / 2;
4775
+ const padSpacing = Number.parseFloat(parameters.p);
4776
+ const silkscreenBody = {
4777
+ type: "pcb_silkscreen_path",
4778
+ layer: "top",
4779
+ pcb_component_id: "",
4780
+ route: [
4781
+ { x: -holeY, y: holeY - padSpacing },
4782
+ { x: -1.9, y: 0 },
4783
+ { x: 1.9, y: 0 },
4784
+ { x: holeY, y: holeY - padSpacing },
4785
+ { x: 1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
4786
+ { x: -1.5, y: Number.parseFloat(parameters.h) / 2 + 0.5 },
4787
+ { x: -holeY, y: holeY - padSpacing }
4788
+ ],
4789
+ stroke_width: 0.1,
4790
+ pcb_silkscreen_path_id: ""
4791
+ };
4792
+ const silkscreenRefText = silkscreenRef(0, holeY + 1, 0.5);
4793
+ return {
4794
+ circuitJson: [
4795
+ ...platedHoles,
4796
+ silkscreenBody,
4797
+ silkscreenRefText
4798
+ ],
4799
+ parameters
4800
+ };
4801
+ };
4802
+
4803
+ // src/fn/jst.ts
4804
+ import {
4805
+ length as length35
4806
+ } from "circuit-json";
4807
+ import { z as z44 } from "zod";
4808
+
4809
+ // src/helpers/platedHoleWithRectPad.ts
4810
+ import { mm as mm4 } from "@tscircuit/mm";
4811
+ var platedHoleWithRectPad = (pn, x, y, holeDiameter, rectPadWidth, rectPadHeight) => {
4812
+ return {
4813
+ pcb_plated_hole_id: "",
4814
+ type: "pcb_plated_hole",
4815
+ shape: "circular_hole_with_rect_pad",
4816
+ x,
4817
+ y,
4818
+ hole_diameter: mm4(holeDiameter),
4819
+ hole_shape: "circle",
4820
+ pad_shape: "rect",
4821
+ rect_pad_width: mm4(rectPadWidth),
4822
+ rect_pad_height: mm4(rectPadHeight),
4823
+ pcb_port_id: "",
4824
+ layers: ["top", "bottom"],
4825
+ port_hints: [pn.toString()]
4826
+ };
4827
+ };
4828
+
4829
+ // src/fn/jst.ts
4830
+ var jst_def = z44.object({
4831
+ fn: z44.string(),
4832
+ p: length35.optional().default("2.2mm"),
4833
+ id: length35.optional().default("0.70mm"),
4834
+ pw: length35.optional().default("1.20mm"),
4835
+ pl: length35.optional().default("1.20mm"),
4836
+ w: length35.optional().default("6mm"),
4837
+ h: length35.optional().default("5mm")
4838
+ });
4839
+ var jst = (raw_params) => {
4840
+ const parameters = jst_def.parse(raw_params);
4841
+ const { p, id, pw, pl, h } = parameters;
4842
+ const half_p = p / 2;
4843
+ const plated_holes = [
4844
+ platedHoleWithRectPad(1, -half_p, 2, id, pw, pl),
4845
+ platedHoleWithRectPad(2, half_p, 2, id, pw, pl)
4846
+ ];
4847
+ const silkscreenBody = {
4848
+ type: "pcb_silkscreen_path",
4849
+ layer: "top",
4850
+ pcb_component_id: "",
4851
+ route: [
4852
+ { x: -3, y: 3 },
4853
+ { x: 3, y: 3 },
4854
+ { x: 3, y: -2 },
4855
+ { x: -3, y: -2 },
4856
+ { x: -3, y: 3 }
4857
+ ],
4858
+ stroke_width: 0.1,
4859
+ pcb_silkscreen_path_id: ""
4860
+ };
4861
+ const silkscreenRefText = silkscreenRef(0, h / 2 + 1, 0.5);
4862
+ return {
4863
+ circuitJson: [
4864
+ ...plated_holes,
4865
+ silkscreenBody,
4866
+ silkscreenRefText
4867
+ ],
4868
+ parameters
4869
+ };
4870
+ };
4871
+
4872
+ // src/fn/sod110.ts
4873
+ import { z as z45 } from "zod";
4874
+ import { length as length36 } from "circuit-json";
4875
+ var sod_def12 = z45.object({
4876
+ fn: z45.string(),
4877
+ num_pins: z45.literal(2).default(2),
4878
+ w: z45.string().default("3.30mm"),
4879
+ h: z45.string().default("1.70mm"),
4880
+ pl: z45.string().default("0.80mm"),
4881
+ pw: z45.string().default("1mm"),
4882
+ p: z45.string().default("1.90mm")
4737
4883
  });
4738
4884
  var sod110 = (raw_params) => {
4739
4885
  const parameters = sod_def12.parse(raw_params);
4740
4886
  const silkscreenRefText = silkscreenRef(
4741
4887
  0,
4742
- length35.parse(parameters.h) / 2 + 0.5,
4888
+ length36.parse(parameters.h) / 2 + 0.5,
4743
4889
  0.3
4744
4890
  );
4745
4891
  const silkscreenLine = {
@@ -4748,20 +4894,20 @@ var sod110 = (raw_params) => {
4748
4894
  pcb_component_id: "",
4749
4895
  route: [
4750
4896
  {
4751
- x: length35.parse(parameters.p) / 2,
4752
- y: length35.parse(parameters.h) / 2
4897
+ x: length36.parse(parameters.p) / 2,
4898
+ y: length36.parse(parameters.h) / 2
4753
4899
  },
4754
4900
  {
4755
- x: -length35.parse(parameters.w) / 2,
4756
- y: length35.parse(parameters.h) / 2
4901
+ x: -length36.parse(parameters.w) / 2,
4902
+ y: length36.parse(parameters.h) / 2
4757
4903
  },
4758
4904
  {
4759
- x: -length35.parse(parameters.w) / 2,
4760
- y: -length35.parse(parameters.h) / 2
4905
+ x: -length36.parse(parameters.w) / 2,
4906
+ y: -length36.parse(parameters.h) / 2
4761
4907
  },
4762
4908
  {
4763
- x: length35.parse(parameters.p) / 2,
4764
- y: -length35.parse(parameters.h) / 2
4909
+ x: length36.parse(parameters.p) / 2,
4910
+ y: -length36.parse(parameters.h) / 2
4765
4911
  }
4766
4912
  ],
4767
4913
  stroke_width: 0.1,