@tscircuit/footprinter 0.0.120 → 0.0.122

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
@@ -1004,6 +1004,7 @@ type Footprinter = {
1004
1004
  to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
1005
1005
  minimelf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
1006
1006
  lqfp: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
1007
+ smb: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1007
1008
  sod923: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1008
1009
  pushbutton: () => FootprinterParamsBuilder<"tllabel" | "trlabel" | "bllabel" | "brlabel">;
1009
1010
  stampboard: () => FootprinterParamsBuilder<"w" | "h" | "left" | "right" | "top" | "bottom" | "p" | "pw" | "pl" | "innerhole" | "innerholeedgedistance">;
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ __export(fn_exports, {
30
30
  qfp: () => qfp,
31
31
  quad: () => quad,
32
32
  res: () => res,
33
+ smb: () => smb,
33
34
  sod123: () => sod123,
34
35
  sod123f: () => sod123f,
35
36
  sod128: () => sod128,
@@ -367,6 +368,20 @@ var dip = (raw_params) => {
367
368
  import mm2 from "@tscircuit/mm";
368
369
  import { z as z3 } from "zod";
369
370
  import { length as length3, distance } from "circuit-json";
371
+
372
+ // src/helpers/silkscreenpath.ts
373
+ var silkscreenpath = (route, options = {}) => {
374
+ return {
375
+ type: "pcb_silkscreen_path",
376
+ layer: options.layer || "top",
377
+ pcb_component_id: options.pcb_component_id || "",
378
+ pcb_silkscreen_path_id: options.pcb_silkscreen_path_id || "",
379
+ route,
380
+ stroke_width: options.stroke_width || 0.1
381
+ };
382
+ };
383
+
384
+ // src/helpers/passive-fn.ts
370
385
  var footprintSizes = [
371
386
  {
372
387
  imperial: "01005",
@@ -514,17 +529,32 @@ var passive = (params) => {
514
529
  throw new Error("could not infer pad width");
515
530
  if (ph === void 0)
516
531
  throw new Error("could not infer pad width");
517
- const silkscreenRefText = silkscreenRef(0, 0.9, 0.2);
532
+ const silkscreenLine = {
533
+ type: "pcb_silkscreen_path",
534
+ layer: "top",
535
+ pcb_component_id: "",
536
+ route: [
537
+ { x: p / 2, y: ph / 2 + 0.4 },
538
+ { x: -p / 2 - pw / 2 - 0.2, y: ph / 2 + 0.4 },
539
+ { x: -p / 2 - pw / 2 - 0.2, y: -ph / 2 - 0.4 },
540
+ { x: p / 2, y: -ph / 2 - 0.4 }
541
+ ],
542
+ stroke_width: 0.1,
543
+ pcb_silkscreen_path_id: ""
544
+ };
545
+ const silkscreenRefText = silkscreenRef(0, ph / 2 + 0.9, 0.2);
518
546
  if (tht) {
519
547
  return [
520
548
  platedhole(1, -p / 2, 0, pw, pw * 1 / 0.8),
521
549
  platedhole(2, p / 2, 0, pw, pw * 1 / 0.8),
550
+ silkscreenLine,
522
551
  silkscreenRefText
523
552
  ];
524
553
  } else {
525
554
  return [
526
555
  rectpad(["1", "left"], -p / 2, 0, pw, ph),
527
556
  rectpad(["2", "right"], p / 2, 0, pw, ph),
557
+ silkscreenLine,
528
558
  silkscreenRefText
529
559
  ];
530
560
  }
@@ -1527,20 +1557,6 @@ var axial = (raw_params) => {
1527
1557
  // src/fn/pushbutton.ts
1528
1558
  import { length as length10 } from "circuit-json";
1529
1559
  import { z as z15 } from "zod";
1530
-
1531
- // src/helpers/silkscreenpath.ts
1532
- var silkscreenpath = (route, options = {}) => {
1533
- return {
1534
- type: "pcb_silkscreen_path",
1535
- layer: options.layer || "top",
1536
- pcb_component_id: options.pcb_component_id || "",
1537
- pcb_silkscreen_path_id: options.pcb_silkscreen_path_id || "",
1538
- route,
1539
- stroke_width: options.stroke_width || 0.1
1540
- };
1541
- };
1542
-
1543
- // src/fn/pushbutton.ts
1544
1560
  var pushbutton_def = z15.object({
1545
1561
  fn: z15.literal("pushbutton"),
1546
1562
  w: length10.default(4.5),
@@ -3651,6 +3667,86 @@ var microMelfWithoutParsing = (parameters) => {
3651
3667
  return pads;
3652
3668
  };
3653
3669
 
3670
+ // src/fn/smb.ts
3671
+ import { z as z35 } from "zod";
3672
+ import { length as length29 } from "circuit-json";
3673
+ var smb_def = z35.object({
3674
+ fn: z35.string(),
3675
+ num_pins: z35.literal(2).default(2),
3676
+ w: z35.string().default("7.30mm"),
3677
+ h: z35.string().default("4.40mm"),
3678
+ pl: z35.string().default("2.50mm"),
3679
+ pw: z35.string().default("2.30mm"),
3680
+ p: z35.string().default("4.30mm")
3681
+ });
3682
+ var smb = (raw_params) => {
3683
+ const parameters = smb_def.parse(raw_params);
3684
+ const silkscreenRefText = silkscreenRef(
3685
+ 0,
3686
+ length29.parse(parameters.h) / 2 + 0.5,
3687
+ 0.3
3688
+ );
3689
+ const silkscreenLine = {
3690
+ type: "pcb_silkscreen_path",
3691
+ layer: "top",
3692
+ pcb_component_id: "",
3693
+ route: [
3694
+ {
3695
+ x: length29.parse(parameters.p) / 2,
3696
+ y: length29.parse(parameters.h) / 2
3697
+ },
3698
+ {
3699
+ x: -length29.parse(parameters.w) / 2 - 0.1,
3700
+ y: length29.parse(parameters.h) / 2
3701
+ },
3702
+ {
3703
+ x: -length29.parse(parameters.w) / 2 - 0.1,
3704
+ y: -length29.parse(parameters.h) / 2
3705
+ },
3706
+ {
3707
+ x: length29.parse(parameters.p) / 2,
3708
+ y: -length29.parse(parameters.h) / 2
3709
+ }
3710
+ ],
3711
+ stroke_width: 0.1,
3712
+ pcb_silkscreen_path_id: ""
3713
+ };
3714
+ return {
3715
+ circuitJson: smbWithoutParsing(parameters).concat(
3716
+ silkscreenLine,
3717
+ silkscreenRefText
3718
+ ),
3719
+ parameters
3720
+ };
3721
+ };
3722
+ var getSmbCoords = (parameters) => {
3723
+ const { pn, p } = parameters;
3724
+ if (pn === 1) {
3725
+ return { x: -p / 2, y: 0 };
3726
+ } else {
3727
+ return { x: p / 2, y: 0 };
3728
+ }
3729
+ };
3730
+ var smbWithoutParsing = (parameters) => {
3731
+ const pads = [];
3732
+ for (let i = 1; i <= parameters.num_pins; i++) {
3733
+ const { x, y } = getSmbCoords({
3734
+ pn: i,
3735
+ p: Number.parseFloat(parameters.p)
3736
+ });
3737
+ pads.push(
3738
+ rectpad(
3739
+ i,
3740
+ x,
3741
+ y,
3742
+ Number.parseFloat(parameters.pl),
3743
+ Number.parseFloat(parameters.pw)
3744
+ )
3745
+ );
3746
+ }
3747
+ return pads;
3748
+ };
3749
+
3654
3750
  // src/helpers/is-not-null.ts
3655
3751
  function isNotNull(value) {
3656
3752
  return value !== null;