@tscircuit/footprinter 0.0.272 → 0.0.274

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
@@ -1807,6 +1807,7 @@ type Footprinter = {
1807
1807
  sot: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1808
1808
  sot323: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1809
1809
  sot89: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw" | "h">;
1810
+ sot343: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1810
1811
  sod323w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1811
1812
  smc: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
1812
1813
  minimelf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
@@ -1839,6 +1840,7 @@ type Footprinter = {
1839
1840
  sod110: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1840
1841
  to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "inline">;
1841
1842
  to92s: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
1843
+ to92l: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
1842
1844
  sot223: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1843
1845
  m2host: () => FootprinterParamsBuilder<never>;
1844
1846
  son: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw" | "epw" | "eph" | "ep">;
package/dist/index.js CHANGED
@@ -68,6 +68,7 @@ __export(fn_exports, {
68
68
  sot23w: () => sot23w,
69
69
  sot25: () => sot25,
70
70
  sot323: () => sot323,
71
+ sot343: () => sot343,
71
72
  sot363: () => sot363,
72
73
  sot457: () => sot457,
73
74
  sot563: () => sot563,
@@ -80,6 +81,7 @@ __export(fn_exports, {
80
81
  stampreceiver: () => stampreceiver,
81
82
  to220: () => to220,
82
83
  to92: () => to92,
84
+ to92l: () => to92l,
83
85
  to92s: () => to92s,
84
86
  tqfp: () => tqfp,
85
87
  tssop: () => tssop,
@@ -7438,10 +7440,114 @@ var sotWithoutParsing = (parameters) => {
7438
7440
  ];
7439
7441
  };
7440
7442
 
7441
- // src/fn/m2host.ts
7443
+ // src/fn/sot343.ts
7442
7444
  import { z as z66 } from "zod";
7445
+ var sot343_def = base_def.extend({
7446
+ fn: z66.string(),
7447
+ num_pins: z66.number().default(4),
7448
+ w: z66.string().default("3.2mm"),
7449
+ h: z66.string().default("2.6mm"),
7450
+ pl: z66.string().default("0.65mm"),
7451
+ pw: z66.string().default("0.39mm"),
7452
+ p: z66.string().default("0.65mm"),
7453
+ string: z66.string().optional()
7454
+ });
7455
+ var sot343 = (raw_params) => {
7456
+ const match = raw_params.string?.match(/^sot343_(\d+)/);
7457
+ const numPins = match ? Number.parseInt(match[1], 4) : 4;
7458
+ const parameters = sot343_def.parse({
7459
+ ...raw_params,
7460
+ num_pins: numPins
7461
+ });
7462
+ if (parameters.num_pins === 4) {
7463
+ return {
7464
+ circuitJson: sot343_4(parameters),
7465
+ parameters
7466
+ };
7467
+ }
7468
+ throw new Error("Invalid number of pins");
7469
+ };
7470
+ var getCcwSot343Coords = (parameters) => {
7471
+ const { pn, p } = parameters;
7472
+ if (pn === 1) return { x: -p * 1.92, y: -0.65 };
7473
+ if (pn === 2) return { x: -p * 1.92, y: 0.65 };
7474
+ if (pn === 3) return { x: p, y: 0.65 };
7475
+ if (pn === 4) return { x: p, y: -0.65 };
7476
+ return { x: 0, y: 0 };
7477
+ };
7478
+ var sot343_4 = (parameters) => {
7479
+ const pads = [];
7480
+ const w = Number.parseFloat(parameters.w);
7481
+ const h = Number.parseFloat(parameters.h);
7482
+ const pl = Number.parseFloat(parameters.pl);
7483
+ const pw = Number.parseFloat(parameters.pw);
7484
+ const p = Number.parseFloat(parameters.p);
7485
+ let minX = Infinity;
7486
+ let maxX = -Infinity;
7487
+ let minY = Infinity;
7488
+ let maxY = -Infinity;
7489
+ for (let i = 0; i < parameters.num_pins; i++) {
7490
+ const { x, y } = getCcwSot343Coords({
7491
+ num_pins: parameters.num_pins,
7492
+ pn: i + 1,
7493
+ w,
7494
+ h,
7495
+ pl,
7496
+ p
7497
+ });
7498
+ pads.push(rectpad(i + 1, x, y, pl, pw));
7499
+ if (x < minX) minX = x;
7500
+ if (x > maxX) maxX = x;
7501
+ if (y < minY) minY = y;
7502
+ if (y > maxY) maxY = y;
7503
+ }
7504
+ const silkscreenXOffset = (minX + maxX) / 2;
7505
+ const padVerticalDistance = maxY - minY;
7506
+ const silkscreenMargin = h * 0.3;
7507
+ const offsetY = padVerticalDistance / 2 + silkscreenMargin;
7508
+ let silkscreenLineLength = w * 0.8;
7509
+ if (h <= 2.6) {
7510
+ silkscreenLineLength /= 2;
7511
+ }
7512
+ const silkscreenRefText = silkscreenRef(
7513
+ silkscreenXOffset,
7514
+ offsetY + 0.5,
7515
+ 0.3
7516
+ );
7517
+ const silkscreenPathTop = {
7518
+ layer: "top",
7519
+ pcb_component_id: "",
7520
+ pcb_silkscreen_path_id: "silkscreen_path_top",
7521
+ route: [
7522
+ { x: silkscreenXOffset - silkscreenLineLength / 2, y: offsetY },
7523
+ { x: silkscreenXOffset + silkscreenLineLength / 2, y: offsetY }
7524
+ ],
7525
+ type: "pcb_silkscreen_path",
7526
+ stroke_width: 0.1
7527
+ };
7528
+ const silkscreenPathBottom = {
7529
+ layer: "top",
7530
+ pcb_component_id: "",
7531
+ pcb_silkscreen_path_id: "silkscreen_path_bottom",
7532
+ route: [
7533
+ { x: silkscreenXOffset - silkscreenLineLength / 2, y: -offsetY },
7534
+ { x: silkscreenXOffset + silkscreenLineLength / 2, y: -offsetY }
7535
+ ],
7536
+ type: "pcb_silkscreen_path",
7537
+ stroke_width: 0.1
7538
+ };
7539
+ return [
7540
+ ...pads,
7541
+ silkscreenPathTop,
7542
+ silkscreenPathBottom,
7543
+ silkscreenRefText
7544
+ ];
7545
+ };
7546
+
7547
+ // src/fn/m2host.ts
7548
+ import { z as z67 } from "zod";
7443
7549
  var m2host_def = base_def.extend({
7444
- fn: z66.string()
7550
+ fn: z67.string()
7445
7551
  });
7446
7552
  var m2host = (raw_params) => {
7447
7553
  const parameters = m2host_def.parse(raw_params);
@@ -7543,6 +7649,62 @@ var m2host = (raw_params) => {
7543
7649
  };
7544
7650
  };
7545
7651
 
7652
+ // src/fn/to92l.ts
7653
+ import { z as z68 } from "zod";
7654
+ var to92l_def = base_def.extend({
7655
+ fn: z68.string(),
7656
+ num_pins: z68.number().default(3),
7657
+ p: z68.string().default("1.27mm"),
7658
+ id: z68.string().default("0.75mm"),
7659
+ od: z68.string().default("1.3mm"),
7660
+ w: z68.string().default("4.8mm"),
7661
+ h: z68.string().default("4.0mm")
7662
+ });
7663
+ var to92l = (raw_params) => {
7664
+ const parameters = to92l_def.parse(raw_params);
7665
+ const p = Number.parseFloat(parameters.p);
7666
+ const w = Number.parseFloat(parameters.w);
7667
+ const h = Number.parseFloat(parameters.h);
7668
+ const holes = [
7669
+ platedHoleWithRectPad(1, 0, 0, parameters.id, parameters.od, parameters.od),
7670
+ platedhole(2, p, p, parameters.id, parameters.od),
7671
+ platedhole(3, p * 2, 0, parameters.id, parameters.od)
7672
+ ];
7673
+ const radius = w / 2;
7674
+ const cx = p;
7675
+ const cy = 0.2;
7676
+ const y_bottom = cy + radius - h;
7677
+ const semicircle = Array.from({ length: 32 }, (_, i) => {
7678
+ const angle = Math.PI * i / 31;
7679
+ return {
7680
+ x: cx + radius * Math.cos(angle),
7681
+ y: cy + radius * Math.sin(angle)
7682
+ };
7683
+ });
7684
+ const silkBody = {
7685
+ type: "pcb_silkscreen_path",
7686
+ layer: "top",
7687
+ pcb_component_id: "",
7688
+ pcb_silkscreen_path_id: "",
7689
+ stroke_width: 0.12,
7690
+ route: [
7691
+ ...semicircle,
7692
+ { x: cx - radius, y: y_bottom },
7693
+ { x: cx + radius, y: y_bottom },
7694
+ semicircle[0]
7695
+ ]
7696
+ };
7697
+ const silkscreenRefText = silkscreenRef(
7698
+ cx,
7699
+ cy + radius + 1,
7700
+ 0.5
7701
+ );
7702
+ return {
7703
+ circuitJson: [...holes, silkBody, silkscreenRefText],
7704
+ parameters
7705
+ };
7706
+ };
7707
+
7546
7708
  // src/helpers/is-not-null.ts
7547
7709
  function isNotNull(value) {
7548
7710
  return value !== null && value !== void 0;