@tscircuit/footprinter 0.0.87 → 0.0.89

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.js CHANGED
@@ -86,7 +86,7 @@ var silkscreenRef = (x, y, font_size) => {
86
86
  var extendDipDef = (newDefaults) => z.object({
87
87
  fn: z.string(),
88
88
  dip: z.literal(true),
89
- num_pins: z.number(),
89
+ num_pins: z.number().optional().default(6),
90
90
  wide: z.boolean().optional(),
91
91
  narrow: z.boolean().optional(),
92
92
  w: length.optional(),
@@ -358,7 +358,7 @@ var passive = (params) => {
358
358
  throw new Error("could not infer pad width");
359
359
  if (ph === void 0)
360
360
  throw new Error("could not infer pad width");
361
- const silkscreenRefText = silkscreenRef(0, h / 2, h / 12);
361
+ const silkscreenRefText = silkscreenRef(0, 0.9, 0.2);
362
362
  if (tht) {
363
363
  return [
364
364
  platedhole(1, -p / 2, 0, pw, pw * 1 / 0.8),
@@ -433,7 +433,7 @@ var function_call = z4.string().or(z4.array(z4.any())).transform((a) => {
433
433
  // src/fn/bga.ts
434
434
  var bga_def = z5.object({
435
435
  fn: z5.string(),
436
- num_pins: z5.number(),
436
+ num_pins: z5.number().optional().default(64),
437
437
  grid: dim2d.optional(),
438
438
  p: distance2.default("0.8mm"),
439
439
  w: length3.optional(),
@@ -478,12 +478,12 @@ var bga_def = z5.object({
478
478
  });
479
479
  var bga = (raw_params) => {
480
480
  const parameters = bga_def.parse(raw_params);
481
- let { num_pins: num_pins2, grid, p, w, h, ball, pad, missing } = parameters;
481
+ let { num_pins, grid, p, w, h, ball, pad, missing } = parameters;
482
482
  ball ??= 0.75 / 1.27 * p;
483
483
  pad ??= ball * 0.8;
484
484
  const pads = [];
485
485
  const missing_pin_nums = (missing ?? []).filter((a) => typeof a === "number");
486
- const num_pins_missing = grid.x * grid.y - num_pins2;
486
+ const num_pins_missing = grid.x * grid.y - num_pins;
487
487
  if (missing.length === 0 && num_pins_missing > 0) {
488
488
  if (Math.sqrt(num_pins_missing) % 1 === 0) {
489
489
  missing.push("center");
@@ -504,17 +504,6 @@ var bga = (raw_params) => {
504
504
  if (missing?.includes("topleft")) {
505
505
  missing_pin_nums.push(1);
506
506
  }
507
- if (num_pins_missing !== missing_pin_nums.length) {
508
- throw new Error(
509
- `not able to create bga component, unable to determine missing pins (try specifying them with "missing+1+2+..."
510
-
511
- ${JSON.stringify(
512
- parameters,
513
- null,
514
- " "
515
- )}`
516
- );
517
- }
518
507
  const missing_pin_nums_set = new Set(missing_pin_nums);
519
508
  let missing_pins_passed = 0;
520
509
  for (let y = 0; y < grid.y; y++) {
@@ -548,7 +537,7 @@ import { z as z6 } from "zod";
548
537
  import { length as length4 } from "@tscircuit/soup";
549
538
  var extendSoicDef = (newDefaults) => z6.object({
550
539
  fn: z6.string(),
551
- num_pins: z6.number(),
540
+ num_pins: z6.number().optional().default(8),
552
541
  w: length4.default(length4.parse(newDefaults.w ?? "5.3mm")),
553
542
  p: length4.default(length4.parse(newDefaults.p ?? "1.27mm")),
554
543
  pw: length4.optional(),
@@ -570,8 +559,8 @@ var getCcwSoicCoords = (parameters) => {
570
559
  if (parameters.widthincludeslegs !== void 0) {
571
560
  parameters.legsoutside = !parameters.widthincludeslegs;
572
561
  }
573
- const { num_pins: num_pins2, pn, w, p, pl, legsoutside } = parameters;
574
- const ph = num_pins2 / 2;
562
+ const { num_pins, pn, w, p, pl, legsoutside } = parameters;
563
+ const ph = num_pins / 2;
575
564
  const isLeft = pn <= ph;
576
565
  const leftPinGaps = ph - 1;
577
566
  const gs = p;
@@ -654,13 +643,13 @@ var pin_order_specifier = z7.enum([
654
643
 
655
644
  // src/helpers/get-quad-pin-map.ts
656
645
  var getQuadPinMap = ({
657
- num_pins: num_pins2,
646
+ num_pins,
658
647
  cw,
659
648
  ccw,
660
649
  startingpin
661
650
  }) => {
662
651
  const pin_map = [];
663
- const pins_per_side = num_pins2 / 4;
652
+ const pins_per_side = num_pins / 4;
664
653
  let current_position_ccw_normal = 1;
665
654
  const sfp = {};
666
655
  for (const specifier of startingpin ?? []) {
@@ -698,17 +687,17 @@ var getQuadPinMap = ({
698
687
  current_position_ccw_normal = pins_per_side * 4;
699
688
  }
700
689
  pin_map.push(-1);
701
- for (let i = 0; i < num_pins2; i++) {
690
+ for (let i = 0; i < num_pins; i++) {
702
691
  pin_map[current_position_ccw_normal] = i + 1;
703
692
  if (ccw || !cw) {
704
693
  current_position_ccw_normal++;
705
- if (current_position_ccw_normal > num_pins2) {
694
+ if (current_position_ccw_normal > num_pins) {
706
695
  current_position_ccw_normal = 1;
707
696
  }
708
697
  } else {
709
698
  current_position_ccw_normal--;
710
699
  if (current_position_ccw_normal < 1) {
711
- current_position_ccw_normal = num_pins2;
700
+ current_position_ccw_normal = num_pins;
712
701
  }
713
702
  }
714
703
  }
@@ -721,7 +710,7 @@ var base_quad_def = z8.object({
721
710
  cc: z8.literal(true).optional(),
722
711
  ccw: z8.literal(true).optional(),
723
712
  startingpin: z8.string().or(z8.array(pin_order_specifier)).transform((a) => typeof a === "string" ? a.slice(1, -1).split(",") : a).pipe(z8.array(pin_order_specifier)).optional(),
724
- num_pins: z8.number(),
713
+ num_pins: z8.number().optional().default(64),
725
714
  w: length5.optional(),
726
715
  h: length5.optional(),
727
716
  p: length5.default(length5.parse("0.5mm")),
@@ -1106,7 +1095,7 @@ var sot363 = (raw_params) => {
1106
1095
  import { z as z9 } from "zod";
1107
1096
  var sot23_def = z9.object({
1108
1097
  fn: z9.string(),
1109
- num_pins: z9.number().default(3),
1098
+ num_pins: z9.literal(3).default(3),
1110
1099
  w: z9.string().default("1.92mm"),
1111
1100
  h: z9.string().default("2.74mm"),
1112
1101
  pl: z9.string().default("0.8mm"),
@@ -1253,7 +1242,7 @@ import { z as z11 } from "zod";
1253
1242
  import { length as length6 } from "@tscircuit/soup";
1254
1243
  var pinrow_def = z11.object({
1255
1244
  fn: z11.string(),
1256
- num_pins: z11.number(),
1245
+ num_pins: z11.number().optional().default(6),
1257
1246
  p: length6.default("0.1in").describe("pitch"),
1258
1247
  id: length6.default("1.0mm").describe("inner diameter"),
1259
1248
  od: length6.default("1.5mm").describe("outer diameter")
@@ -1321,10 +1310,11 @@ var ms013 = (raw_params) => {
1321
1310
  };
1322
1311
 
1323
1312
  // src/fn/sot723.ts
1313
+ import { length as length7 } from "@tscircuit/soup";
1324
1314
  import { z as z12 } from "zod";
1325
1315
  var sot723_def = z12.object({
1326
1316
  fn: z12.string(),
1327
- num_pins: z12.number().default(3),
1317
+ num_pins: z12.literal(3).default(3),
1328
1318
  w: z12.string().default("1.2mm"),
1329
1319
  h: z12.string().default("1.2mm"),
1330
1320
  pl: z12.string().default("0.3mm"),
@@ -1334,9 +1324,9 @@ var sot723 = (raw_params) => {
1334
1324
  const parameters = sot723_def.parse(raw_params);
1335
1325
  const pad = sot723WithoutParsing(parameters);
1336
1326
  const silkscreenRefText = silkscreenRef(
1337
- 0,
1338
- Number(parameters.h),
1339
- 0.3
1327
+ 0.4,
1328
+ length7.parse(parameters.h),
1329
+ 0.2
1340
1330
  );
1341
1331
  return {
1342
1332
  circuitJson: [...pad, silkscreenRefText],
@@ -1378,9 +1368,10 @@ var sot723WithoutParsing = (parameters) => {
1378
1368
 
1379
1369
  // src/fn/sod123.ts
1380
1370
  import { z as z13 } from "zod";
1381
- import "circuit-json";
1371
+ import { length as length8 } from "circuit-json";
1382
1372
  var sod_def = z13.object({
1383
1373
  fn: z13.string(),
1374
+ num_pins: z13.literal(2).default(2),
1384
1375
  w: z13.string().default("2.36mm"),
1385
1376
  h: z13.string().default("1.22mm"),
1386
1377
  pl: z13.string().default("0.9mm"),
@@ -1391,7 +1382,7 @@ var sod123 = (raw_params) => {
1391
1382
  const parameters = sod_def.parse(raw_params);
1392
1383
  const silkscreenRefText = silkscreenRef(
1393
1384
  0,
1394
- Number(parameters.h) / 4 + 0.4,
1385
+ length8.parse(parameters.h) / 4 + 0.4,
1395
1386
  0.3
1396
1387
  );
1397
1388
  return {
@@ -1411,14 +1402,14 @@ var getSodCoords = (parameters) => {
1411
1402
  };
1412
1403
  var sodWithoutParsing = (parameters) => {
1413
1404
  const pads = [];
1414
- for (let i = 0; i < 2; i++) {
1405
+ for (let i = 1; i <= parameters.num_pins; i++) {
1415
1406
  const { x, y } = getSodCoords({
1416
- pn: i + 1,
1407
+ pn: i,
1417
1408
  pad_spacing: Number.parseFloat(parameters.pad_spacing)
1418
1409
  });
1419
1410
  pads.push(
1420
1411
  rectpad(
1421
- i + 1,
1412
+ i,
1422
1413
  x,
1423
1414
  y,
1424
1415
  Number.parseFloat(parameters.pl),
@@ -1431,15 +1422,15 @@ var sodWithoutParsing = (parameters) => {
1431
1422
 
1432
1423
  // src/fn/axial.ts
1433
1424
  import {
1434
- length as length8
1425
+ length as length9
1435
1426
  } from "@tscircuit/soup";
1436
1427
  import { z as z14 } from "zod";
1437
1428
  var axial_def = z14.object({
1438
1429
  fn: z14.string(),
1439
- num_pins: z14.any().transform(() => 2),
1440
- p: length8.optional().default("2.54mm"),
1441
- id: length8.optional().default("0.7mm"),
1442
- od: length8.optional().default("1mm")
1430
+ num_pins: z14.literal(2).default(2),
1431
+ p: length9.optional().default("2.54mm"),
1432
+ id: length9.optional().default("0.7mm"),
1433
+ od: length9.optional().default("1mm")
1443
1434
  });
1444
1435
  var axial = (raw_params) => {
1445
1436
  const parameters = axial_def.parse(raw_params);
@@ -1487,13 +1478,17 @@ var silkscreenpath = (route, options = {}) => {
1487
1478
 
1488
1479
  // src/fn/pushbutton.ts
1489
1480
  var pushbutton_def = z15.object({
1490
- fn: z15.literal("pushbutton")
1481
+ fn: z15.literal("pushbutton"),
1482
+ w: z15.literal(4.5).default(4.5),
1483
+ h: z15.literal(6.5).default(6.5),
1484
+ id: z15.literal(1).default(1),
1485
+ od: z15.literal(1.2).default(1.2)
1491
1486
  });
1492
1487
  var pushbutton = (raw_params) => {
1493
1488
  const parameters = pushbutton_def.parse(raw_params);
1494
- const width = 4.5;
1495
- const height = 6.5;
1496
- const holeDiameter = 1;
1489
+ const width = parameters.w;
1490
+ const height = parameters.h;
1491
+ const holeDiameter = parameters.id;
1497
1492
  const holes = [
1498
1493
  platedhole(1, -width / 2, height / 2, holeDiameter, holeDiameter * 1.2),
1499
1494
  platedhole(2, -width / 2, -height / 2, holeDiameter, holeDiameter * 1.2),
@@ -1534,21 +1529,21 @@ var pushbutton = (raw_params) => {
1534
1529
 
1535
1530
  // src/fn/stampboard.ts
1536
1531
  import {
1537
- length as length9
1532
+ length as length10
1538
1533
  } from "circuit-json";
1539
1534
  import { z as z16 } from "zod";
1540
1535
  var stampboard_def = z16.object({
1541
1536
  fn: z16.string(),
1542
- w: length9.default("22.58mm"),
1543
- left: length9.optional(),
1544
- right: length9.optional(),
1545
- top: length9.optional(),
1546
- bottom: length9.optional(),
1547
- p: length9.default(length9.parse("2.54mm")),
1548
- pw: length9.default(length9.parse("1.6mm")),
1549
- pl: length9.default(length9.parse("2.4mm")),
1537
+ w: length10.default("22.58mm"),
1538
+ left: length10.optional().default(20),
1539
+ right: length10.optional().default(20),
1540
+ top: length10.optional(),
1541
+ bottom: length10.optional(),
1542
+ p: length10.default(length10.parse("2.54mm")),
1543
+ pw: length10.default(length10.parse("1.6mm")),
1544
+ pl: length10.default(length10.parse("2.4mm")),
1550
1545
  innerhole: z16.boolean().default(false),
1551
- innerholeedgedistance: length9.default(length9.parse("1.61mm"))
1546
+ innerholeedgedistance: length10.default(length10.parse("1.61mm"))
1552
1547
  });
1553
1548
  var getHeight = (parameters) => {
1554
1549
  const params = stampboard_def.parse(parameters);
@@ -1672,6 +1667,7 @@ var stampboard = (raw_params) => {
1672
1667
  let routes = [];
1673
1668
  const innerDiameter = 1;
1674
1669
  const outerDiameter = 1.2;
1670
+ const totalPadsNumber = params.left + params.right + (params.bottom ?? 0) + (params.top ?? 0);
1675
1671
  if (params.right) {
1676
1672
  const yoff = -((params.right - 1) / 2) * params.p;
1677
1673
  for (let i = 0; i < params.right; i++) {
@@ -1684,7 +1680,7 @@ var stampboard = (raw_params) => {
1684
1680
  }
1685
1681
  rectpads.push(
1686
1682
  rectpad(
1687
- i + 1,
1683
+ i + 1 + params.left + (params.bottom ?? 0),
1688
1684
  params.w / 2 - params.pl / 2,
1689
1685
  yoff + i * params.p,
1690
1686
  params.pl,
@@ -1694,7 +1690,7 @@ var stampboard = (raw_params) => {
1694
1690
  if (params.innerhole) {
1695
1691
  holes.push(
1696
1692
  platedhole(
1697
- i + 1,
1693
+ i + 1 + params.left + (params.bottom ?? 0) + totalPadsNumber,
1698
1694
  params.w / 2,
1699
1695
  yoff + i * params.p,
1700
1696
  innerDiameter,
@@ -1703,7 +1699,7 @@ var stampboard = (raw_params) => {
1703
1699
  );
1704
1700
  holes.push(
1705
1701
  platedhole(
1706
- i + 1,
1702
+ i + 1 + params.left + (params.bottom ?? 0) + totalPadsNumber * 2,
1707
1703
  params.w / 2 - params.innerholeedgedistance,
1708
1704
  yoff + i * params.p,
1709
1705
  innerDiameter,
@@ -1735,7 +1731,7 @@ var stampboard = (raw_params) => {
1735
1731
  if (params.innerhole) {
1736
1732
  holes.push(
1737
1733
  platedhole(
1738
- i + 1,
1734
+ i + 1 + totalPadsNumber,
1739
1735
  -params.w / 2,
1740
1736
  yoff + i * params.p,
1741
1737
  innerDiameter,
@@ -1744,7 +1740,7 @@ var stampboard = (raw_params) => {
1744
1740
  );
1745
1741
  holes.push(
1746
1742
  platedhole(
1747
- i + 1,
1743
+ i + 1 + totalPadsNumber * 2,
1748
1744
  -params.w / 2 + params.innerholeedgedistance,
1749
1745
  yoff + i * params.p,
1750
1746
  innerDiameter,
@@ -1766,7 +1762,7 @@ var stampboard = (raw_params) => {
1766
1762
  }
1767
1763
  rectpads.push(
1768
1764
  rectpad(
1769
- i + 1,
1765
+ i + 1 + params.left + params.right + (params.bottom ?? 0),
1770
1766
  xoff + i * params.p,
1771
1767
  getHeight(params) / 2 - params.pl / 2,
1772
1768
  params.pw,
@@ -1776,7 +1772,7 @@ var stampboard = (raw_params) => {
1776
1772
  if (params.innerhole) {
1777
1773
  holes.push(
1778
1774
  platedhole(
1779
- i + 1,
1775
+ i + 1 + params.left + params.right + (params.bottom ?? 0) + totalPadsNumber,
1780
1776
  xoff + i * params.p,
1781
1777
  getHeight(params) / 2,
1782
1778
  innerDiameter,
@@ -1785,7 +1781,7 @@ var stampboard = (raw_params) => {
1785
1781
  );
1786
1782
  holes.push(
1787
1783
  platedhole(
1788
- i + 1,
1784
+ i + 1 + params.left + params.right + (params.bottom ?? 0) + totalPadsNumber * 2,
1789
1785
  xoff + i * params.p,
1790
1786
  getHeight(params) / 2 - params.innerholeedgedistance,
1791
1787
  innerDiameter,
@@ -1807,7 +1803,7 @@ var stampboard = (raw_params) => {
1807
1803
  }
1808
1804
  rectpads.push(
1809
1805
  rectpad(
1810
- i + 1,
1806
+ i + 1 + params.left,
1811
1807
  xoff + i * params.p,
1812
1808
  -getHeight(params) / 2 + params.pl / 2,
1813
1809
  params.pw,
@@ -1817,7 +1813,7 @@ var stampboard = (raw_params) => {
1817
1813
  if (params.innerhole) {
1818
1814
  holes.push(
1819
1815
  platedhole(
1820
- i + 1,
1816
+ i + 1 + params.left + totalPadsNumber,
1821
1817
  xoff + i * params.p,
1822
1818
  -getHeight(params) / 2,
1823
1819
  innerDiameter,
@@ -1826,7 +1822,7 @@ var stampboard = (raw_params) => {
1826
1822
  );
1827
1823
  holes.push(
1828
1824
  platedhole(
1829
- i + 1,
1825
+ i + 1 + params.left + totalPadsNumber * 2,
1830
1826
  xoff + i * params.p,
1831
1827
  -getHeight(params) / 2 + params.innerholeedgedistance,
1832
1828
  innerDiameter,
@@ -1877,21 +1873,21 @@ var stampboard = (raw_params) => {
1877
1873
 
1878
1874
  // src/fn/stampreceiver.ts
1879
1875
  import {
1880
- length as length10
1876
+ length as length11
1881
1877
  } from "circuit-json";
1882
1878
  import { z as z17 } from "zod";
1883
1879
  var stampreceiver_def = z17.object({
1884
1880
  fn: z17.string(),
1885
- w: length10.default("22.58mm"),
1886
- left: length10.optional(),
1887
- right: length10.optional(),
1888
- top: length10.optional(),
1889
- bottom: length10.optional(),
1890
- p: length10.default(length10.parse("2.54mm")),
1891
- pw: length10.default(length10.parse("1.6mm")),
1892
- pl: length10.default(length10.parse("3.2mm")),
1881
+ w: length11.default("22.58mm"),
1882
+ left: length11.optional().default(20),
1883
+ right: length11.optional().default(20),
1884
+ top: length11.optional(),
1885
+ bottom: length11.optional(),
1886
+ p: length11.default(length11.parse("2.54mm")),
1887
+ pw: length11.default(length11.parse("1.6mm")),
1888
+ pl: length11.default(length11.parse("3.2mm")),
1893
1889
  innerhole: z17.boolean().default(false),
1894
- innerholeedgedistance: length10.default(length10.parse("1.61mm"))
1890
+ innerholeedgedistance: length11.default(length11.parse("1.61mm"))
1895
1891
  });
1896
1892
  var getHeight2 = (parameters) => {
1897
1893
  const params = stampreceiver_def.parse(parameters);
@@ -1906,107 +1902,52 @@ var getHeight2 = (parameters) => {
1906
1902
  }
1907
1903
  return 51;
1908
1904
  };
1909
- var getTriangleDir2 = (x, y, side) => {
1910
- let routes = [];
1911
- const triangleHeight = 1;
1912
- const triangleWidth = 0.6;
1913
- if (side === "left") {
1914
- routes = [
1915
- {
1916
- x: x + triangleHeight / 2,
1917
- y
1918
- },
1919
- // Tip of the triangle (pointing right)
1920
- {
1921
- x: x - triangleHeight / 2,
1922
- y: y + triangleWidth / 2
1923
- },
1924
- // Bottom corner of the base
1925
- {
1926
- x: x - triangleHeight / 2,
1927
- y: y - triangleWidth / 2
1928
- },
1929
- // Top corner of the base
1930
- {
1931
- x: x + triangleHeight / 2,
1932
- y
1933
- }
1934
- // Close the path at the tip
1935
- ];
1936
- }
1937
- if (side === "right") {
1938
- routes = [
1939
- {
1940
- x: x - triangleHeight / 2,
1941
- y
1942
- },
1943
- // Tip of the triangle (pointing left)
1944
- {
1945
- x: x + triangleHeight / 2,
1946
- y: y + triangleWidth / 2
1947
- },
1948
- // Top corner of the base
1949
- {
1950
- x: x + triangleHeight / 2,
1951
- y: y - triangleWidth / 2
1952
- },
1953
- // Bottom corner of the base
1954
- {
1955
- x: x - triangleHeight / 2,
1956
- y
1957
- }
1958
- // Close the path at the tip
1959
- ];
1960
- }
1961
- if (side === "bottom") {
1962
- routes = [
1963
- {
1964
- x,
1965
- y: y + triangleHeight / 2
1966
- },
1967
- // Tip of the triangle (pointing up)
1968
- {
1969
- x: x - triangleWidth / 2,
1970
- y: y - triangleHeight / 2
1971
- },
1972
- // Left corner of the base
1973
- {
1974
- x: x + triangleWidth / 2,
1975
- y: y - triangleHeight / 2
1976
- },
1977
- // Right corner of the base
1978
- {
1979
- x,
1980
- y: y + triangleHeight / 2
1981
- }
1982
- // Close the path at the tip
1983
- ];
1984
- }
1985
- if (side === "top") {
1986
- routes = [
1987
- {
1988
- x,
1989
- y: y - triangleHeight / 2
1990
- },
1991
- // Tip of the triangle (pointing down)
1992
- {
1993
- x: x - triangleWidth / 2,
1994
- y: y + triangleHeight / 2
1995
- },
1996
- // Left corner of the base
1997
- {
1998
- x: x + triangleWidth / 2,
1999
- y: y + triangleHeight / 2
2000
- },
2001
- // Right corner of the base
2002
- {
2003
- x,
2004
- y: y - triangleHeight / 2
2005
- }
2006
- // Close the path at the tip
2007
- ];
2008
- }
2009
- return routes;
1905
+ var getTriangleDir2 = (x, y, side, triangleHeight = 1, triangleWidth = 0.6) => {
1906
+ const halfHeight = triangleHeight / 2;
1907
+ const halfWidth = triangleWidth / 2;
1908
+ const routes = {
1909
+ left: [
1910
+ { x: x + halfHeight, y },
1911
+ // Tip
1912
+ { x: x - halfHeight, y: y + halfWidth },
1913
+ // Bottom corner
1914
+ { x: x - halfHeight, y: y - halfWidth },
1915
+ // Top corner
1916
+ { x: x + halfHeight, y }
1917
+ // Close path
1918
+ ],
1919
+ right: [
1920
+ { x: x - halfHeight, y },
1921
+ // Tip
1922
+ { x: x + halfHeight, y: y + halfWidth },
1923
+ // Top corner
1924
+ { x: x + halfHeight, y: y - halfWidth },
1925
+ // Bottom corner
1926
+ { x: x - halfHeight, y }
1927
+ // Close path
1928
+ ],
1929
+ top: [
1930
+ { x, y: y - halfHeight },
1931
+ // Tip
1932
+ { x: x - halfWidth, y: y + halfHeight },
1933
+ // Left corner
1934
+ { x: x + halfWidth, y: y + halfHeight },
1935
+ // Right corner
1936
+ { x, y: y - halfHeight }
1937
+ // Close path
1938
+ ],
1939
+ bottom: [
1940
+ { x, y: y + halfHeight },
1941
+ // Tip
1942
+ { x: x - halfWidth, y: y - halfHeight },
1943
+ // Left corner
1944
+ { x: x + halfWidth, y: y - halfHeight },
1945
+ // Right corner
1946
+ { x, y: y + halfHeight }
1947
+ // Close path
1948
+ ]
1949
+ };
1950
+ return routes[side];
2010
1951
  };
2011
1952
  var stampreceiver = (raw_params) => {
2012
1953
  const params = stampreceiver_def.parse(raw_params);
@@ -2014,6 +1955,7 @@ var stampreceiver = (raw_params) => {
2014
1955
  const holes = [];
2015
1956
  const innerDiameter = 1;
2016
1957
  const outerDiameter = 1.2;
1958
+ const totalPadsNumber = params.left + params.right + (params.bottom ?? 0) + (params.top ?? 0);
2017
1959
  let routes = [];
2018
1960
  if (params.right) {
2019
1961
  const yoff = -((params.right - 1) / 2) * params.p;
@@ -2027,7 +1969,7 @@ var stampreceiver = (raw_params) => {
2027
1969
  }
2028
1970
  rectpads.push(
2029
1971
  rectpad(
2030
- i + 1,
1972
+ i + 1 + params.left + (params.bottom ?? 0),
2031
1973
  params.w / 2 - params.pl / 2,
2032
1974
  yoff + i * params.p,
2033
1975
  params.pl,
@@ -2036,7 +1978,7 @@ var stampreceiver = (raw_params) => {
2036
1978
  );
2037
1979
  params.innerhole && holes.push(
2038
1980
  platedhole(
2039
- i + 1,
1981
+ i + 1 + params.left + (params.bottom ?? 0) + totalPadsNumber,
2040
1982
  params.w / 2 - params.innerholeedgedistance,
2041
1983
  yoff + i * params.p,
2042
1984
  innerDiameter,
@@ -2066,7 +2008,7 @@ var stampreceiver = (raw_params) => {
2066
2008
  );
2067
2009
  params.innerhole && holes.push(
2068
2010
  platedhole(
2069
- i + 1,
2011
+ i + 1 + totalPadsNumber,
2070
2012
  -params.w / 2 + params.innerholeedgedistance,
2071
2013
  yoff + i * params.p,
2072
2014
  innerDiameter,
@@ -2087,7 +2029,7 @@ var stampreceiver = (raw_params) => {
2087
2029
  }
2088
2030
  rectpads.push(
2089
2031
  rectpad(
2090
- i + 1,
2032
+ i + 1 + params.right + (params.bottom ?? 0) + params.left,
2091
2033
  xoff + i * params.p,
2092
2034
  getHeight2(params) / 2 - params.pl / 2,
2093
2035
  params.pw,
@@ -2096,7 +2038,7 @@ var stampreceiver = (raw_params) => {
2096
2038
  );
2097
2039
  params.innerhole && holes.push(
2098
2040
  platedhole(
2099
- i + 1,
2041
+ i + 1 + params.right + (params.bottom ?? 0) + params.left + totalPadsNumber,
2100
2042
  xoff + i * params.p,
2101
2043
  getHeight2(params) / 2 - params.innerholeedgedistance,
2102
2044
  innerDiameter,
@@ -2117,7 +2059,7 @@ var stampreceiver = (raw_params) => {
2117
2059
  }
2118
2060
  rectpads.push(
2119
2061
  rectpad(
2120
- i + 1,
2062
+ i + 1 + params.left,
2121
2063
  xoff + i * params.p,
2122
2064
  -getHeight2(params) / 2 + params.pl / 2,
2123
2065
  params.pw,
@@ -2126,7 +2068,7 @@ var stampreceiver = (raw_params) => {
2126
2068
  );
2127
2069
  params.innerhole && holes.push(
2128
2070
  platedhole(
2129
- i + 1,
2071
+ i + 1 + params.left + totalPadsNumber,
2130
2072
  xoff + i * params.p,
2131
2073
  -getHeight2(params) / 2 + params.innerholeedgedistance,
2132
2074
  innerDiameter,
@@ -2199,12 +2141,12 @@ var lqfp = (parameters) => {
2199
2141
  import { z as z18 } from "zod";
2200
2142
  var sot235_def = z18.object({
2201
2143
  fn: z18.string(),
2144
+ num_pins: z18.literal(5).default(5),
2202
2145
  h: z18.string().default("1.6mm"),
2203
2146
  pl: z18.string().default("1mm"),
2204
2147
  pw: z18.string().default("0.7mm"),
2205
2148
  p: z18.string().default("0.95mm")
2206
2149
  });
2207
- var num_pins = 5;
2208
2150
  var sot235 = (raw_params) => {
2209
2151
  const parameters = sot235_def.parse(raw_params);
2210
2152
  return {
@@ -2233,7 +2175,7 @@ var getCcwSot235Coords = (parameters) => {
2233
2175
  };
2234
2176
  var sot23_5WithoutParsing = (parameters) => {
2235
2177
  const pads = [];
2236
- for (let i = 1; i <= num_pins; i++) {
2178
+ for (let i = 1; i <= parameters.num_pins; i++) {
2237
2179
  const { x, y } = getCcwSot235Coords({
2238
2180
  h: Number.parseFloat(parameters.h),
2239
2181
  p: Number.parseFloat(parameters.p),
@@ -2249,7 +2191,7 @@ var sot23_5WithoutParsing = (parameters) => {
2249
2191
  )
2250
2192
  );
2251
2193
  }
2252
- const width = (num_pins + 1) / 2 * Number.parseFloat(parameters.p);
2194
+ const width = (parameters.num_pins + 1) / 2 * Number.parseFloat(parameters.p);
2253
2195
  const height = Number.parseFloat(parameters.h);
2254
2196
  const silkscreenPath1 = {
2255
2197
  layer: "top",
@@ -2399,7 +2341,7 @@ var footprinter = () => {
2399
2341
  target.imperial = v;
2400
2342
  }
2401
2343
  } else {
2402
- target.num_pins = Number.parseFloat(v);
2344
+ target.num_pins = Number.isNaN(Number.parseFloat(v)) ? void 0 : Number.parseFloat(v);
2403
2345
  }
2404
2346
  }
2405
2347
  } else {