@tscircuit/footprinter 0.0.171 → 0.0.173

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
@@ -1060,6 +1060,7 @@ type Footprinter = {
1060
1060
  sot563: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw">;
1061
1061
  sot723: () => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
1062
1062
  sot23: () => FootprinterParamsBuilder<"w" | "h" | "pl" | "pw">;
1063
+ sot323: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1063
1064
  sot89: () => FootprinterParamsBuilder<"w" | "p" | "pl" | "pw" | "h">;
1064
1065
  sod323w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1065
1066
  smc: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pw" | "pl">;
@@ -1073,6 +1074,7 @@ type Footprinter = {
1073
1074
  sma: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1074
1075
  smf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1075
1076
  smb: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1077
+ smbf: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1076
1078
  potentiometer: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "pw" | "ca">;
1077
1079
  electrolytic: () => FootprinterParamsBuilder<"d" | "p" | "id" | "od">;
1078
1080
  sod923: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ __export(fn_exports, {
36
36
  res: () => res,
37
37
  sma: () => sma,
38
38
  smb: () => smb,
39
+ smbf: () => smbf,
39
40
  smc: () => smc,
40
41
  smf: () => smf,
41
42
  sod110: () => sod110,
@@ -61,6 +62,7 @@ __export(fn_exports, {
61
62
  sot223: () => sot223,
62
63
  sot23: () => sot23,
63
64
  sot23w: () => sot23w,
65
+ sot323: () => sot323,
64
66
  sot363: () => sot363,
65
67
  sot457: () => sot457,
66
68
  sot563: () => sot563,
@@ -4041,12 +4043,12 @@ var sot89_3 = (parameters) => {
4041
4043
  const pads = [];
4042
4044
  const padGap = Number.parseFloat(parameters.p);
4043
4045
  const padWidth = Number.parseFloat(parameters.pw);
4044
- const length44 = Number.parseFloat(parameters.w);
4046
+ const length45 = Number.parseFloat(parameters.w);
4045
4047
  const padHeight = Number.parseFloat(parameters.pl);
4046
4048
  pads.push(
4047
- rectpad(1, -length44 / 2, padGap, padHeight, padWidth),
4048
- rectpad(2, -length44 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
4049
- rectpad(3, -length44 / 2, -padGap, padHeight, padWidth)
4049
+ rectpad(1, -length45 / 2, padGap, padHeight, padWidth),
4050
+ rectpad(2, -length45 / 2 + (1.5 - 1.3) / 2, 0, 1.5, padWidth),
4051
+ rectpad(3, -length45 / 2, -padGap, padHeight, padWidth)
4050
4052
  );
4051
4053
  const silkscreenRefText = silkscreenRef(0, 0, 0.3);
4052
4054
  const width = Number.parseFloat(parameters.w) / 2 - 1;
@@ -4086,7 +4088,7 @@ var sot89_5 = (parameters) => {
4086
4088
  const pads = [];
4087
4089
  const padGap = Number.parseFloat(parameters.p);
4088
4090
  const padWidth = Number.parseFloat(parameters.pw);
4089
- const length44 = Number.parseFloat(parameters.w);
4091
+ const length45 = Number.parseFloat(parameters.w);
4090
4092
  pads.push(
4091
4093
  rectpad(1, -1.85, -1.5, 1.5, 0.7),
4092
4094
  rectpad(2, -1.85, 1.5, 1.5, 0.7),
@@ -6432,6 +6434,182 @@ var electrolytic = (raw_params) => {
6432
6434
  };
6433
6435
  };
6434
6436
 
6437
+ // src/fn/smbf.ts
6438
+ import { z as z56 } from "zod";
6439
+ import { length as length44 } from "circuit-json";
6440
+ var smbf_def = z56.object({
6441
+ fn: z56.string(),
6442
+ num_pins: z56.literal(2).default(2),
6443
+ w: z56.string().default("6.5mm"),
6444
+ h: z56.string().default("3mm"),
6445
+ pl: z56.string().default("1.75mm"),
6446
+ pw: z56.string().default("2.40mm"),
6447
+ p: z56.string().default("4.75mm")
6448
+ });
6449
+ var smbf = (raw_params) => {
6450
+ const parameters = smbf_def.parse(raw_params);
6451
+ const silkscreenRefText = silkscreenRef(
6452
+ 0,
6453
+ length44.parse(parameters.h) - 0.5,
6454
+ 0.3
6455
+ );
6456
+ const silkscreenLine = {
6457
+ type: "pcb_silkscreen_path",
6458
+ layer: "top",
6459
+ pcb_component_id: "",
6460
+ route: [
6461
+ {
6462
+ x: length44.parse(parameters.p) / 2,
6463
+ y: length44.parse(parameters.h) / 2
6464
+ },
6465
+ {
6466
+ x: -length44.parse(parameters.w) / 2 - 0.3,
6467
+ y: length44.parse(parameters.h) / 2
6468
+ },
6469
+ {
6470
+ x: -length44.parse(parameters.w) / 2 - 0.3,
6471
+ y: -length44.parse(parameters.h) / 2
6472
+ },
6473
+ {
6474
+ x: length44.parse(parameters.p) / 2,
6475
+ y: -length44.parse(parameters.h) / 2
6476
+ }
6477
+ ],
6478
+ stroke_width: 0.1,
6479
+ pcb_silkscreen_path_id: ""
6480
+ };
6481
+ return {
6482
+ circuitJson: smbfWithoutParsing(parameters).concat(
6483
+ silkscreenLine,
6484
+ silkscreenRefText
6485
+ ),
6486
+ parameters
6487
+ };
6488
+ };
6489
+ var getSmbfCoords = (parameters) => {
6490
+ const { pn, p } = parameters;
6491
+ if (pn === 1) {
6492
+ return { x: -p / 2, y: 0 };
6493
+ }
6494
+ return { x: p / 2, y: 0 };
6495
+ };
6496
+ var smbfWithoutParsing = (parameters) => {
6497
+ const pads = [];
6498
+ for (let i = 1; i <= parameters.num_pins; i++) {
6499
+ const { x, y } = getSmbfCoords({
6500
+ pn: i,
6501
+ p: Number.parseFloat(parameters.p)
6502
+ });
6503
+ pads.push(
6504
+ rectpad(
6505
+ i,
6506
+ x,
6507
+ y,
6508
+ Number.parseFloat(parameters.pl),
6509
+ Number.parseFloat(parameters.pw)
6510
+ )
6511
+ );
6512
+ }
6513
+ return pads;
6514
+ };
6515
+
6516
+ // src/fn/sot323.ts
6517
+ import { z as z57 } from "zod";
6518
+ var sot323_def = z57.object({
6519
+ fn: z57.string(),
6520
+ num_pins: z57.number().default(3),
6521
+ w: z57.string().default("2.45mm"),
6522
+ h: z57.string().default("2.40mm"),
6523
+ pl: z57.string().default("0.45mm"),
6524
+ pw: z57.string().default("0.70mm"),
6525
+ p: z57.string().default("1mm"),
6526
+ string: z57.string().optional()
6527
+ });
6528
+ var sot323 = (raw_params) => {
6529
+ const match = raw_params.string?.match(/^sot323_(\d+)/);
6530
+ const numPins = match ? Number.parseInt(match[1], 3) : 3;
6531
+ const parameters = sot323_def.parse({
6532
+ ...raw_params,
6533
+ num_pins: numPins
6534
+ });
6535
+ if (parameters.num_pins === 3) {
6536
+ return {
6537
+ circuitJson: sot323_3(parameters),
6538
+ parameters
6539
+ };
6540
+ }
6541
+ throw new Error("Invalid number of pins");
6542
+ };
6543
+ var getCcwSot323Coords = (parameters) => {
6544
+ const { pn, w, h, pl, p } = parameters;
6545
+ if (pn === 1) {
6546
+ return { x: -p, y: 0.65 };
6547
+ }
6548
+ if (pn === 2) {
6549
+ return { x: -p, y: -0.65 };
6550
+ }
6551
+ return { x: p, y: 0 };
6552
+ };
6553
+ var sot323_3 = (parameters) => {
6554
+ const pads = [];
6555
+ for (let i = 0; i < parameters.num_pins; i++) {
6556
+ const { x, y } = getCcwSot323Coords({
6557
+ num_pins: parameters.num_pins,
6558
+ pn: i + 1,
6559
+ w: Number.parseFloat(parameters.w),
6560
+ h: Number.parseFloat(parameters.h),
6561
+ pl: Number.parseFloat(parameters.pl),
6562
+ p: Number.parseFloat(parameters.p)
6563
+ });
6564
+ pads.push(
6565
+ rectpad(
6566
+ i + 1,
6567
+ x,
6568
+ y,
6569
+ Number.parseFloat(parameters.pl),
6570
+ Number.parseFloat(parameters.pw)
6571
+ )
6572
+ );
6573
+ }
6574
+ const silkscreenRefText = silkscreenRef(
6575
+ 0,
6576
+ Number.parseInt(parameters.h) / 2 + 1,
6577
+ 0.3
6578
+ );
6579
+ const width = Number.parseFloat(parameters.w) / 2 - Number.parseFloat(parameters.pl);
6580
+ const height = Number.parseFloat(parameters.h) / 2;
6581
+ const silkscreenPath1 = {
6582
+ layer: "top",
6583
+ pcb_component_id: "",
6584
+ pcb_silkscreen_path_id: "silkscreen_path_1",
6585
+ route: [
6586
+ { x: -width, y: height + 0.3 },
6587
+ { x: width, y: height + 0.3 },
6588
+ { x: width, y: height / 2 }
6589
+ ],
6590
+ type: "pcb_silkscreen_path",
6591
+ stroke_width: 0.1
6592
+ };
6593
+ const silkscreenPath2 = {
6594
+ layer: "top",
6595
+ pcb_component_id: "",
6596
+ pcb_silkscreen_path_id: "silkscreen_path_2",
6597
+ route: [
6598
+ { x: -width, y: -height - 0.3 },
6599
+ { x: width, y: -height - 0.3 },
6600
+ { x: width, y: -height / 2 }
6601
+ ],
6602
+ type: "pcb_silkscreen_path",
6603
+ stroke_width: 0.1
6604
+ };
6605
+ return [
6606
+ ...pads,
6607
+ silkscreenPath1,
6608
+ silkscreenPath2,
6609
+ silkscreenRefText
6610
+ ];
6611
+ };
6612
+
6435
6613
  // src/helpers/is-not-null.ts
6436
6614
  function isNotNull(value) {
6437
6615
  return value !== null;