@tscircuit/footprinter 0.0.273 → 0.0.275

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
@@ -1840,6 +1840,7 @@ type Footprinter = {
1840
1840
  sod110: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1841
1841
  to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "inline">;
1842
1842
  to92s: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
1843
+ to92l: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
1843
1844
  sot223: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1844
1845
  m2host: () => FootprinterParamsBuilder<never>;
1845
1846
  son: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw" | "epw" | "eph" | "ep">;
package/dist/index.js CHANGED
@@ -81,6 +81,7 @@ __export(fn_exports, {
81
81
  stampreceiver: () => stampreceiver,
82
82
  to220: () => to220,
83
83
  to92: () => to92,
84
+ to92l: () => to92l,
84
85
  to92s: () => to92s,
85
86
  tqfp: () => tqfp,
86
87
  tssop: () => tssop,
@@ -3436,6 +3437,29 @@ var pad = (params) => {
3436
3437
 
3437
3438
  // src/fn/to92.ts
3438
3439
  import { z as z25 } from "zod";
3440
+ import "@tscircuit/mm";
3441
+
3442
+ // src/helpers/platedHolePill.ts
3443
+ import { mm as mm6 } from "@tscircuit/mm";
3444
+ var platedHolePill = (pn, x, y, holeDiameter, outerWidth, outerHeight) => {
3445
+ return {
3446
+ pcb_plated_hole_id: "",
3447
+ type: "pcb_plated_hole",
3448
+ shape: "pill",
3449
+ x,
3450
+ y,
3451
+ outer_width: mm6(outerWidth),
3452
+ outer_height: mm6(outerHeight),
3453
+ hole_width: mm6(holeDiameter),
3454
+ hole_height: mm6(holeDiameter),
3455
+ pcb_port_id: "",
3456
+ layers: ["top", "bottom"],
3457
+ port_hints: [pn.toString()],
3458
+ ccw_rotation: 0
3459
+ };
3460
+ };
3461
+
3462
+ // src/fn/to92.ts
3439
3463
  var to92_def = base_def.extend({
3440
3464
  fn: z25.string(),
3441
3465
  num_pins: z25.union([z25.literal(3), z25.literal(2)]).default(3),
@@ -3456,15 +3480,6 @@ var generateSemicircle = (centerX, centerY, radius) => {
3456
3480
  };
3457
3481
  });
3458
3482
  };
3459
- var to92_2 = (parameters) => {
3460
- const { p, id, od, h } = parameters;
3461
- const holeY = Number.parseFloat(h) / 2;
3462
- const padSpacing = Number.parseFloat(p);
3463
- return [
3464
- platedhole(1, -padSpacing, holeY - padSpacing, id, od),
3465
- platedhole(2, padSpacing, holeY - padSpacing, id, od)
3466
- ];
3467
- };
3468
3483
  var to92 = (raw_params) => {
3469
3484
  const match = raw_params.string?.match(/^to92_(\d+)/);
3470
3485
  const numPins = match ? Number.parseInt(match[1], 10) : 3;
@@ -3475,19 +3490,71 @@ var to92 = (raw_params) => {
3475
3490
  const { p, id, od, w, h, inline } = parameters;
3476
3491
  const holeY = Number.parseFloat(h) / 2;
3477
3492
  const padSpacing = Number.parseFloat(p);
3493
+ const holeDia = Number.parseFloat(id);
3494
+ const padDia = Number.parseFloat(od);
3495
+ const padWidth = padDia;
3496
+ const padHeight = padDia * (1.5 / 1.05);
3478
3497
  let platedHoles = [];
3479
3498
  if (parameters.num_pins === 3) {
3480
- platedHoles = inline ? [
3481
- platedhole(1, -padSpacing, holeY - padSpacing, id, od),
3482
- platedhole(2, 0, holeY - padSpacing, id, od),
3483
- platedhole(3, padSpacing, holeY - padSpacing, id, od)
3484
- ] : [
3485
- platedhole(1, 0, holeY, id, od),
3486
- platedhole(2, -padSpacing, holeY - padSpacing, id, od),
3487
- platedhole(3, padSpacing, holeY - padSpacing, id, od)
3488
- ];
3499
+ if (inline) {
3500
+ platedHoles = [
3501
+ platedHoleWithRectPad(
3502
+ 1,
3503
+ -padSpacing,
3504
+ holeY - padSpacing,
3505
+ holeDia,
3506
+ padDia,
3507
+ padHeight,
3508
+ 0,
3509
+ 0
3510
+ ),
3511
+ platedHolePill(2, 0, holeY - padSpacing, holeDia, padWidth, padHeight),
3512
+ platedHolePill(
3513
+ 3,
3514
+ padSpacing,
3515
+ holeY - padSpacing,
3516
+ holeDia,
3517
+ padWidth,
3518
+ padHeight
3519
+ )
3520
+ ];
3521
+ } else {
3522
+ platedHoles = [
3523
+ platedHoleWithRectPad(
3524
+ 1,
3525
+ -padSpacing,
3526
+ holeY - padSpacing,
3527
+ holeDia,
3528
+ padDia,
3529
+ padDia,
3530
+ 0,
3531
+ 0
3532
+ ),
3533
+ platedhole(2, 0, holeY, holeDia, padDia),
3534
+ platedhole(3, padSpacing, holeY - padSpacing, holeDia, padDia)
3535
+ ];
3536
+ }
3489
3537
  } else if (parameters.num_pins === 2) {
3490
- platedHoles = to92_2(parameters);
3538
+ platedHoles = [
3539
+ platedHoleWithRectPad(
3540
+ 1,
3541
+ -padSpacing,
3542
+ holeY - padSpacing,
3543
+ holeDia,
3544
+ padWidth,
3545
+ padHeight,
3546
+ 0,
3547
+ 0
3548
+ ),
3549
+ platedHolePill(
3550
+ 2,
3551
+ padSpacing,
3552
+ holeY - padSpacing,
3553
+ holeDia,
3554
+ padWidth,
3555
+ padHeight
3556
+ )
3557
+ ];
3491
3558
  } else {
3492
3559
  throw new Error("Invalid number of pins for TO-92");
3493
3560
  }
@@ -7186,7 +7253,7 @@ var sot323_3 = (parameters) => {
7186
7253
  // src/fn/smtpad.ts
7187
7254
  import { z as z63 } from "zod";
7188
7255
  import { length as length48 } from "circuit-json";
7189
- import { mm as mm6 } from "@tscircuit/mm";
7256
+ import { mm as mm8 } from "@tscircuit/mm";
7190
7257
  var smtpad_def = base_def.extend({
7191
7258
  fn: z63.string(),
7192
7259
  circle: z63.boolean().optional(),
@@ -7218,27 +7285,27 @@ var smtpad_def = base_def.extend({
7218
7285
  let width;
7219
7286
  let height;
7220
7287
  if (shape === "circle") {
7221
- if (v.r !== void 0) radius = mm6(v.r);
7222
- else if (v.pr !== void 0) radius = mm6(v.pr);
7223
- else if (v.radius !== void 0) radius = mm6(v.radius);
7224
- else if (v.d !== void 0) radius = mm6(v.d) / 2;
7225
- else if (v.pd !== void 0) radius = mm6(v.pd) / 2;
7226
- else if (v.diameter !== void 0) radius = mm6(v.diameter) / 2;
7227
- else radius = mm6("1mm") / 2;
7288
+ if (v.r !== void 0) radius = mm8(v.r);
7289
+ else if (v.pr !== void 0) radius = mm8(v.pr);
7290
+ else if (v.radius !== void 0) radius = mm8(v.radius);
7291
+ else if (v.d !== void 0) radius = mm8(v.d) / 2;
7292
+ else if (v.pd !== void 0) radius = mm8(v.pd) / 2;
7293
+ else if (v.diameter !== void 0) radius = mm8(v.diameter) / 2;
7294
+ else radius = mm8("1mm") / 2;
7228
7295
  } else {
7229
- if (v.w !== void 0) width = mm6(v.w);
7230
- else if (v.pw !== void 0) width = mm6(v.pw);
7231
- else if (v.width !== void 0) width = mm6(v.width);
7232
- else if (v.s !== void 0) width = mm6(v.s);
7233
- else if (v.size !== void 0) width = mm6(v.size);
7234
- else width = mm6("1mm");
7235
- if (v.h !== void 0) height = mm6(v.h);
7236
- else if (v.ph !== void 0) height = mm6(v.ph);
7237
- else if (v.height !== void 0) height = mm6(v.height);
7296
+ if (v.w !== void 0) width = mm8(v.w);
7297
+ else if (v.pw !== void 0) width = mm8(v.pw);
7298
+ else if (v.width !== void 0) width = mm8(v.width);
7299
+ else if (v.s !== void 0) width = mm8(v.s);
7300
+ else if (v.size !== void 0) width = mm8(v.size);
7301
+ else width = mm8("1mm");
7302
+ if (v.h !== void 0) height = mm8(v.h);
7303
+ else if (v.ph !== void 0) height = mm8(v.ph);
7304
+ else if (v.height !== void 0) height = mm8(v.height);
7238
7305
  else if (shape === "square") height = width;
7239
7306
  else if (shape === "rect")
7240
7307
  height = width;
7241
- else height = mm6("1mm");
7308
+ else height = mm8("1mm");
7242
7309
  }
7243
7310
  return {
7244
7311
  fn: v.fn,
@@ -7275,7 +7342,7 @@ var smtpad = (raw_params) => {
7275
7342
  // src/fn/platedhole.ts
7276
7343
  import { z as z64 } from "zod";
7277
7344
  import { length as length49 } from "circuit-json";
7278
- import { mm as mm7 } from "@tscircuit/mm";
7345
+ import { mm as mm9 } from "@tscircuit/mm";
7279
7346
  var platedhole_def = base_def.extend({
7280
7347
  fn: z64.string(),
7281
7348
  d: length49.optional(),
@@ -7287,14 +7354,14 @@ var platedhole_def = base_def.extend({
7287
7354
  squarepad: z64.boolean().optional().default(false)
7288
7355
  }).transform((v) => {
7289
7356
  let holeD;
7290
- if (v.d !== void 0) holeD = mm7(v.d);
7291
- else if (v.hd !== void 0) holeD = mm7(v.hd);
7292
- else if (v.r !== void 0) holeD = mm7(v.r) * 2;
7293
- else if (v.hr !== void 0) holeD = mm7(v.hr) * 2;
7294
- else holeD = mm7("1mm");
7357
+ if (v.d !== void 0) holeD = mm9(v.d);
7358
+ else if (v.hd !== void 0) holeD = mm9(v.hd);
7359
+ else if (v.r !== void 0) holeD = mm9(v.r) * 2;
7360
+ else if (v.hr !== void 0) holeD = mm9(v.hr) * 2;
7361
+ else holeD = mm9("1mm");
7295
7362
  let padD;
7296
- if (v.pd !== void 0) padD = mm7(v.pd);
7297
- else if (v.pr !== void 0) padD = mm7(v.pr) * 2;
7363
+ if (v.pd !== void 0) padD = mm9(v.pd);
7364
+ else if (v.pr !== void 0) padD = mm9(v.pr) * 2;
7298
7365
  else padD = holeD * (1.5 / 1);
7299
7366
  return {
7300
7367
  fn: v.fn,
@@ -7648,6 +7715,62 @@ var m2host = (raw_params) => {
7648
7715
  };
7649
7716
  };
7650
7717
 
7718
+ // src/fn/to92l.ts
7719
+ import { z as z68 } from "zod";
7720
+ var to92l_def = base_def.extend({
7721
+ fn: z68.string(),
7722
+ num_pins: z68.number().default(3),
7723
+ p: z68.string().default("1.27mm"),
7724
+ id: z68.string().default("0.75mm"),
7725
+ od: z68.string().default("1.3mm"),
7726
+ w: z68.string().default("4.8mm"),
7727
+ h: z68.string().default("4.0mm")
7728
+ });
7729
+ var to92l = (raw_params) => {
7730
+ const parameters = to92l_def.parse(raw_params);
7731
+ const p = Number.parseFloat(parameters.p);
7732
+ const w = Number.parseFloat(parameters.w);
7733
+ const h = Number.parseFloat(parameters.h);
7734
+ const holes = [
7735
+ platedHoleWithRectPad(1, 0, 0, parameters.id, parameters.od, parameters.od),
7736
+ platedhole(2, p, p, parameters.id, parameters.od),
7737
+ platedhole(3, p * 2, 0, parameters.id, parameters.od)
7738
+ ];
7739
+ const radius = w / 2;
7740
+ const cx = p;
7741
+ const cy = 0.2;
7742
+ const y_bottom = cy + radius - h;
7743
+ const semicircle = Array.from({ length: 32 }, (_, i) => {
7744
+ const angle = Math.PI * i / 31;
7745
+ return {
7746
+ x: cx + radius * Math.cos(angle),
7747
+ y: cy + radius * Math.sin(angle)
7748
+ };
7749
+ });
7750
+ const silkBody = {
7751
+ type: "pcb_silkscreen_path",
7752
+ layer: "top",
7753
+ pcb_component_id: "",
7754
+ pcb_silkscreen_path_id: "",
7755
+ stroke_width: 0.12,
7756
+ route: [
7757
+ ...semicircle,
7758
+ { x: cx - radius, y: y_bottom },
7759
+ { x: cx + radius, y: y_bottom },
7760
+ semicircle[0]
7761
+ ]
7762
+ };
7763
+ const silkscreenRefText = silkscreenRef(
7764
+ cx,
7765
+ cy + radius + 1,
7766
+ 0.5
7767
+ );
7768
+ return {
7769
+ circuitJson: [...holes, silkBody, silkscreenRefText],
7770
+ parameters
7771
+ };
7772
+ };
7773
+
7651
7774
  // src/helpers/is-not-null.ts
7652
7775
  function isNotNull(value) {
7653
7776
  return value !== null && value !== void 0;