@tscircuit/footprinter 0.0.149 → 0.0.151

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
@@ -988,7 +988,7 @@ declare const footprintSizes: {
988
988
  }[];
989
989
 
990
990
  type FootprinterParamsBuilder<K extends string> = {
991
- [P in K | "params" | "soup" | "circuitJson"]: P extends "params" | "soup" | "circuitJson" ? Footprinter[P] : (v?: number | string) => FootprinterParamsBuilder<K>;
991
+ [P in K | "params" | "soup" | "circuitJson"]: P extends "params" | "soup" | "circuitJson" ? Footprinter[P] : (v?: number | string | boolean) => FootprinterParamsBuilder<K>;
992
992
  };
993
993
  type CommonPassiveOptionKey = "metric" | "imperial" | "tht" | "p" | "pw" | "ph" | "w" | "h";
994
994
  type Footprinter = {
@@ -1000,7 +1000,7 @@ type Footprinter = {
1000
1000
  lr: (num_pins?: number) => FootprinterParamsBuilder<"w" | "l" | "pl" | "pr">;
1001
1001
  qfp: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p" | "id" | "od" | "wide" | "narrow">;
1002
1002
  quad: (num_pins?: number) => FootprinterParamsBuilder<"w" | "l" | "square" | "pl" | "pr" | "pb" | "pt" | "p" | "pw" | "ph">;
1003
- bga: (num_pins?: number) => FootprinterParamsBuilder<"grid" | "p" | "w" | "h" | "ball" | "pad" | "missing">;
1003
+ bga: (num_pins?: number) => FootprinterParamsBuilder<"grid" | "p" | "w" | "h" | "ball" | "pad" | "missing" | "tlorigin" | "blorigin" | "trorigin" | "brorigin">;
1004
1004
  qfn: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p">;
1005
1005
  soic: (num_pins?: number) => FootprinterParamsBuilder<"w" | "p" | "id" | "od">;
1006
1006
  mlp: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p">;
@@ -1030,7 +1030,6 @@ type Footprinter = {
1030
1030
  smb: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1031
1031
  sod923: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1032
1032
  sod323: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1033
- vssop8: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1034
1033
  sod80: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1035
1034
  sod882: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1036
1035
  sod882d: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
@@ -1047,6 +1046,7 @@ type Footprinter = {
1047
1046
  to92: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od" | "inline">;
1048
1047
  to92s: () => FootprinterParamsBuilder<"w" | "h" | "p" | "id" | "od">;
1049
1048
  sot223: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1049
+ vssop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1050
1050
  msop: (num_pins?: number) => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1051
1051
  sot23w: () => FootprinterParamsBuilder<"w" | "h" | "p" | "pl" | "pw">;
1052
1052
  pushbutton: () => FootprinterParamsBuilder<"tllabel" | "trlabel" | "bllabel" | "brlabel">;
package/dist/index.js CHANGED
@@ -68,7 +68,7 @@ __export(fn_exports, {
68
68
  to92: () => to92,
69
69
  to92s: () => to92s,
70
70
  tssop: () => tssop,
71
- vssop8: () => vssop8
71
+ vssop: () => vssop
72
72
  });
73
73
 
74
74
  // src/helpers/silkscreenRef.ts
@@ -510,6 +510,7 @@ var function_call = z4.string().or(z4.array(z4.any())).transform((a) => {
510
510
  }).pipe(z4.array(z4.string().or(z4.number())));
511
511
 
512
512
  // src/fn/bga.ts
513
+ import "circuit-json";
513
514
  var bga_def = z5.object({
514
515
  fn: z5.string(),
515
516
  num_pins: z5.number().optional().default(64),
@@ -587,16 +588,41 @@ var bga = (raw_params) => {
587
588
  let missing_pins_passed = 0;
588
589
  for (let y = 0; y < grid.y; y++) {
589
590
  for (let x = 0; x < grid.x; x++) {
590
- let pin_num = y * grid.x + x + 1;
591
+ const pad_x = (x - (grid.x - 1) / 2) * p;
592
+ const pad_y = (y - (grid.y - 1) / 2) * p;
593
+ let pin_x = x;
594
+ let pin_y = y;
595
+ switch (parameters.origin) {
596
+ case "bl":
597
+ pin_x = x;
598
+ pin_y = grid.y - 1 - y;
599
+ break;
600
+ case "br":
601
+ pin_x = grid.x - 1 - x;
602
+ pin_y = grid.y - 1 - y;
603
+ break;
604
+ case "tr":
605
+ pin_x = grid.x - 1 - x;
606
+ pin_y = y;
607
+ break;
608
+ case "tl":
609
+ default:
610
+ break;
611
+ }
612
+ let pin_num = pin_y * grid.x + pin_x + 1;
591
613
  if (missing_pin_nums_set.has(pin_num)) {
592
614
  missing_pins_passed++;
593
615
  continue;
594
616
  }
595
617
  pin_num -= missing_pins_passed;
596
- const pad_x = (x - (grid.x - 1) / 2) * p;
597
- const pad_y = -(y - (grid.y - 1) / 2) * p;
598
618
  pads.push(
599
- rectpad([pin_num, `${ALPHABET[y]}${x + 1}`], pad_x, pad_y, pad2, pad2)
619
+ rectpad(
620
+ [pin_num, `${ALPHABET[pin_y]}${pin_x + 1}`],
621
+ pad_x,
622
+ pad_y,
623
+ pad2,
624
+ pad2
625
+ )
600
626
  );
601
627
  }
602
628
  }
@@ -605,8 +631,71 @@ var bga = (raw_params) => {
605
631
  grid.y * p / 2,
606
632
  0.2
607
633
  );
634
+ const pin1MarkerSize = p / 6;
635
+ let markerRoute;
636
+ const edgeX = grid.x * p / 2;
637
+ const edgeY = grid.y * p / 2;
638
+ switch (parameters.origin) {
639
+ case "bl":
640
+ markerRoute = [
641
+ { x: -edgeX, y: -edgeY },
642
+ // Start at corner
643
+ { x: -edgeX, y: -edgeY - pin1MarkerSize },
644
+ // Up
645
+ { x: -edgeX - pin1MarkerSize, y: -edgeY },
646
+ // Left
647
+ { x: -edgeX, y: -edgeY }
648
+ // Back to start
649
+ ];
650
+ break;
651
+ case "br":
652
+ markerRoute = [
653
+ { x: edgeX, y: -edgeY },
654
+ // Start at corner
655
+ { x: edgeX, y: -edgeY - pin1MarkerSize },
656
+ // Up
657
+ { x: edgeX + pin1MarkerSize, y: -edgeY },
658
+ // Right
659
+ { x: edgeX, y: -edgeY }
660
+ // Back to start
661
+ ];
662
+ break;
663
+ case "tr":
664
+ markerRoute = [
665
+ { x: edgeX, y: edgeY },
666
+ // Start at corner
667
+ { x: edgeX, y: edgeY + pin1MarkerSize },
668
+ // Down
669
+ { x: edgeX + pin1MarkerSize, y: edgeY },
670
+ // Right
671
+ { x: edgeX, y: edgeY }
672
+ // Back to start
673
+ ];
674
+ break;
675
+ case "tl":
676
+ default:
677
+ markerRoute = [
678
+ { x: -edgeX, y: edgeY },
679
+ // Start at corner
680
+ { x: -edgeX, y: edgeY + pin1MarkerSize },
681
+ // Down
682
+ { x: -edgeX - pin1MarkerSize, y: edgeY },
683
+ // Left
684
+ { x: -edgeX, y: edgeY }
685
+ // Back to start
686
+ ];
687
+ break;
688
+ }
689
+ const pin1Marker = {
690
+ type: "pcb_silkscreen_path",
691
+ layer: "top",
692
+ pcb_component_id: "",
693
+ pcb_silkscreen_path_id: "pin1_marker",
694
+ route: markerRoute,
695
+ stroke_width: 0.05
696
+ };
608
697
  return {
609
- circuitJson: [...pads, silkscreenRefText],
698
+ circuitJson: [...pads, silkscreenRefText, pin1Marker],
610
699
  parameters
611
700
  };
612
701
  };
@@ -4456,118 +4545,17 @@ var smbWithoutParsing = (parameters) => {
4456
4545
  return pads;
4457
4546
  };
4458
4547
 
4459
- // src/fn/vssop8.ts
4548
+ // src/fn/smc.ts
4460
4549
  import { z as z42 } from "zod";
4461
4550
  import { length as length35 } from "circuit-json";
4462
- var vssop8_def = z42.object({
4551
+ var smc_def = z42.object({
4463
4552
  fn: z42.string(),
4464
- num_pins: z42.literal(8).default(8),
4465
- w: z42.string().default("3.06mm"),
4466
- h: z42.string().default("3.14mm"),
4467
- p: z42.string().default("0.65mm"),
4468
- pl: z42.string().default("1.6mm"),
4469
- pw: z42.string().default("0.5mm")
4470
- });
4471
- var vssop8 = (raw_params) => {
4472
- const parameters = vssop8_def.parse(raw_params);
4473
- const pad_spacing = length35.parse(parameters.p);
4474
- const silkscreenRefText = silkscreenRef(
4475
- 0,
4476
- length35.parse(parameters.h) / 2 + 0.5,
4477
- 0.3
4478
- );
4479
- const silkscreenBoxWidth = length35.parse(parameters.w);
4480
- const silkscreenBoxHeight = length35.parse(parameters.h);
4481
- const silkscreenTopLine = {
4482
- type: "pcb_silkscreen_path",
4483
- layer: "top",
4484
- pcb_component_id: "",
4485
- route: [
4486
- { x: -silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 },
4487
- { x: silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 }
4488
- ],
4489
- stroke_width: 0.05,
4490
- pcb_silkscreen_path_id: ""
4491
- };
4492
- const silkscreenBottomLine = {
4493
- type: "pcb_silkscreen_path",
4494
- layer: "top",
4495
- pcb_component_id: "",
4496
- route: [
4497
- { x: -silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 },
4498
- { x: silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 }
4499
- ],
4500
- stroke_width: 0.05,
4501
- pcb_silkscreen_path_id: ""
4502
- };
4503
- const pin1Position = getVssop8PadCoord({ pn: 1, pad_spacing });
4504
- const pin1MarkerPosition = {
4505
- x: pin1Position.x - 0.8,
4506
- y: pin1Position.y
4507
- };
4508
- const pin1Marking = {
4509
- type: "pcb_silkscreen_path",
4510
- layer: "top",
4511
- pcb_component_id: "pin_marker_1",
4512
- route: [
4513
- { x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y },
4514
- { x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y + 0.3 },
4515
- { x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y - 0.3 },
4516
- { x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y }
4517
- ],
4518
- stroke_width: 0.05,
4519
- pcb_silkscreen_path_id: "pin_marker_1"
4520
- };
4521
- return {
4522
- circuitJson: getVssop8Pads(parameters, pad_spacing).concat(
4523
- silkscreenTopLine,
4524
- silkscreenBottomLine,
4525
- silkscreenRefText,
4526
- pin1Marking
4527
- ),
4528
- parameters
4529
- };
4530
- };
4531
- var getVssop8PadCoord = (parameters) => {
4532
- const { pn, pad_spacing } = parameters;
4533
- const col = pn <= 4 ? -1 : 1;
4534
- const row = 1.5 - (pn - 1) % 4;
4535
- return {
4536
- x: col * length35.parse("1.8mm"),
4537
- y: row * pad_spacing
4538
- };
4539
- };
4540
- var getVssop8Pads = (parameters, pad_spacing) => {
4541
- const pads = [];
4542
- for (let i = 1; i <= parameters.num_pins; i++) {
4543
- const { x, y } = getVssop8PadCoord({
4544
- pn: i,
4545
- pad_spacing
4546
- });
4547
- pads.push(
4548
- rectpad(
4549
- i,
4550
- x,
4551
- y,
4552
- Number.parseFloat(parameters.pl),
4553
- Number.parseFloat(parameters.pw)
4554
- )
4555
- );
4556
- }
4557
- return pads;
4558
- };
4559
-
4560
- // src/fn/smc.ts
4561
- import { z as z43 } from "zod";
4562
- import { length as length36 } from "circuit-json";
4563
- var smc_def = z43.object({
4564
- fn: z43.string(),
4565
- num_pins: z43.literal(2).default(2),
4566
- w: z43.string().default("10.70mm"),
4567
- h: z43.string().default("6.60mm"),
4568
- pl: z43.string().default("3.30mm"),
4569
- pw: z43.string().default("2.50mm"),
4570
- p: z43.string().default("6.80mm")
4553
+ num_pins: z42.literal(2).default(2),
4554
+ w: z42.string().default("10.70mm"),
4555
+ h: z42.string().default("6.60mm"),
4556
+ pl: z42.string().default("3.30mm"),
4557
+ pw: z42.string().default("2.50mm"),
4558
+ p: z42.string().default("6.80mm")
4571
4559
  });
4572
4560
  var smc = (raw_params) => {
4573
4561
  const parameters = smc_def.parse(raw_params);
@@ -4578,20 +4566,20 @@ var smc = (raw_params) => {
4578
4566
  pcb_component_id: "",
4579
4567
  route: [
4580
4568
  {
4581
- x: length36.parse(parameters.p) / 2,
4582
- y: length36.parse(parameters.h) / 2 - 0.8
4569
+ x: length35.parse(parameters.p) / 2,
4570
+ y: length35.parse(parameters.h) / 2 - 0.8
4583
4571
  },
4584
4572
  {
4585
- x: -length36.parse(parameters.w) / 2 - 0.8,
4586
- y: length36.parse(parameters.h) / 2 - 0.8
4573
+ x: -length35.parse(parameters.w) / 2 - 0.8,
4574
+ y: length35.parse(parameters.h) / 2 - 0.8
4587
4575
  },
4588
4576
  {
4589
- x: -length36.parse(parameters.w) / 2 - 0.8,
4590
- y: -length36.parse(parameters.h) / 2 + 0.8
4577
+ x: -length35.parse(parameters.w) / 2 - 0.8,
4578
+ y: -length35.parse(parameters.h) / 2 + 0.8
4591
4579
  },
4592
4580
  {
4593
- x: length36.parse(parameters.p) / 2,
4594
- y: -length36.parse(parameters.h) / 2 + 0.8
4581
+ x: length35.parse(parameters.p) / 2,
4582
+ y: -length35.parse(parameters.h) / 2 + 0.8
4595
4583
  }
4596
4584
  ],
4597
4585
  stroke_width: 0.1,
@@ -4633,16 +4621,16 @@ var smcWithoutParsing = (parameters) => {
4633
4621
  };
4634
4622
 
4635
4623
  // src/fn/sot223.ts
4636
- import { z as z44 } from "zod";
4637
- var sot223_def = z44.object({
4638
- fn: z44.string(),
4639
- num_pins: z44.number().default(4),
4640
- w: z44.string().default("8.50mm"),
4641
- h: z44.string().default("6.90mm"),
4642
- pl: z44.string().default("2mm"),
4643
- pw: z44.string().default("1.5mm"),
4644
- p: z44.string().default("2.30mm"),
4645
- string: z44.string().optional()
4624
+ import { z as z43 } from "zod";
4625
+ var sot223_def = z43.object({
4626
+ fn: z43.string(),
4627
+ num_pins: z43.number().default(4),
4628
+ w: z43.string().default("8.50mm"),
4629
+ h: z43.string().default("6.90mm"),
4630
+ pl: z43.string().default("2mm"),
4631
+ pw: z43.string().default("1.5mm"),
4632
+ p: z43.string().default("2.30mm"),
4633
+ string: z43.string().optional()
4646
4634
  });
4647
4635
  var sot223 = (raw_params) => {
4648
4636
  const match = raw_params.string?.match(/^sot223_(\d+)/);
@@ -4888,16 +4876,16 @@ var sot223_6 = (parameters) => {
4888
4876
  };
4889
4877
 
4890
4878
  // src/fn/sot23w.ts
4891
- import { z as z45 } from "zod";
4892
- var sot23w_def = z45.object({
4893
- fn: z45.string(),
4894
- num_pins: z45.number().default(3),
4895
- w: z45.string().default("3.40mm"),
4896
- h: z45.string().default("3.30mm"),
4897
- pl: z45.string().default("1mm"),
4898
- pw: z45.string().default("0.7mm"),
4899
- p: z45.string().default("1.2mm"),
4900
- string: z45.string().optional()
4879
+ import { z as z44 } from "zod";
4880
+ var sot23w_def = z44.object({
4881
+ fn: z44.string(),
4882
+ num_pins: z44.number().default(3),
4883
+ w: z44.string().default("3.40mm"),
4884
+ h: z44.string().default("3.30mm"),
4885
+ pl: z44.string().default("1mm"),
4886
+ pw: z44.string().default("0.7mm"),
4887
+ p: z44.string().default("1.2mm"),
4888
+ string: z44.string().optional()
4901
4889
  });
4902
4890
  var sot23w = (raw_params) => {
4903
4891
  const match = raw_params.string?.match(/^sot23w_(\d+)/);
@@ -4985,16 +4973,16 @@ var sot23w_3 = (parameters) => {
4985
4973
  };
4986
4974
 
4987
4975
  // src/fn/to92s.ts
4988
- import { z as z46 } from "zod";
4989
- var to92s_def = z46.object({
4990
- fn: z46.string(),
4991
- num_pins: z46.union([z46.literal(3), z46.literal(2)]).default(3),
4992
- p: z46.string().default("1.27mm"),
4993
- id: z46.string().default("0.72mm"),
4994
- od: z46.string().default("0.95mm"),
4995
- w: z46.string().default("2.5mm"),
4996
- h: z46.string().default("4.2mm"),
4997
- string: z46.string().optional()
4976
+ import { z as z45 } from "zod";
4977
+ var to92s_def = z45.object({
4978
+ fn: z45.string(),
4979
+ num_pins: z45.union([z45.literal(3), z45.literal(2)]).default(3),
4980
+ p: z45.string().default("1.27mm"),
4981
+ id: z45.string().default("0.72mm"),
4982
+ od: z45.string().default("0.95mm"),
4983
+ w: z45.string().default("2.5mm"),
4984
+ h: z45.string().default("4.2mm"),
4985
+ string: z45.string().optional()
4998
4986
  });
4999
4987
  var to92s_3 = (parameters) => {
5000
4988
  const { p, id, od, w, h } = parameters;
@@ -5061,9 +5049,9 @@ var to92s = (raw_params) => {
5061
5049
 
5062
5050
  // src/fn/jst.ts
5063
5051
  import {
5064
- length as length37
5052
+ length as length36
5065
5053
  } from "circuit-json";
5066
- import { z as z47 } from "zod";
5054
+ import { z as z46 } from "zod";
5067
5055
 
5068
5056
  // src/helpers/platedHoleWithRectPad.ts
5069
5057
  import { mm as mm4 } from "@tscircuit/mm";
@@ -5086,14 +5074,14 @@ var platedHoleWithRectPad = (pn, x, y, holeDiameter, rectPadWidth, rectPadHeight
5086
5074
  };
5087
5075
 
5088
5076
  // src/fn/jst.ts
5089
- var jst_def = z47.object({
5090
- fn: z47.string(),
5091
- p: length37.optional().default("2.2mm"),
5092
- id: length37.optional().default("0.70mm"),
5093
- pw: length37.optional().default("1.20mm"),
5094
- pl: length37.optional().default("1.20mm"),
5095
- w: length37.optional().default("6mm"),
5096
- h: length37.optional().default("5mm")
5077
+ var jst_def = z46.object({
5078
+ fn: z46.string(),
5079
+ p: length36.optional().default("2.2mm"),
5080
+ id: length36.optional().default("0.70mm"),
5081
+ pw: length36.optional().default("1.20mm"),
5082
+ pl: length36.optional().default("1.20mm"),
5083
+ w: length36.optional().default("6mm"),
5084
+ h: length36.optional().default("5mm")
5097
5085
  });
5098
5086
  var jst = (raw_params) => {
5099
5087
  const parameters = jst_def.parse(raw_params);
@@ -5129,22 +5117,22 @@ var jst = (raw_params) => {
5129
5117
  };
5130
5118
 
5131
5119
  // src/fn/sod110.ts
5132
- import { z as z48 } from "zod";
5133
- import { length as length38 } from "circuit-json";
5134
- var sod_def12 = z48.object({
5135
- fn: z48.string(),
5136
- num_pins: z48.literal(2).default(2),
5137
- w: z48.string().default("3.30mm"),
5138
- h: z48.string().default("1.70mm"),
5139
- pl: z48.string().default("0.80mm"),
5140
- pw: z48.string().default("1mm"),
5141
- p: z48.string().default("1.90mm")
5120
+ import { z as z47 } from "zod";
5121
+ import { length as length37 } from "circuit-json";
5122
+ var sod_def12 = z47.object({
5123
+ fn: z47.string(),
5124
+ num_pins: z47.literal(2).default(2),
5125
+ w: z47.string().default("3.30mm"),
5126
+ h: z47.string().default("1.70mm"),
5127
+ pl: z47.string().default("0.80mm"),
5128
+ pw: z47.string().default("1mm"),
5129
+ p: z47.string().default("1.90mm")
5142
5130
  });
5143
5131
  var sod110 = (raw_params) => {
5144
5132
  const parameters = sod_def12.parse(raw_params);
5145
5133
  const silkscreenRefText = silkscreenRef(
5146
5134
  0,
5147
- length38.parse(parameters.h) / 2 + 0.5,
5135
+ length37.parse(parameters.h) / 2 + 0.5,
5148
5136
  0.3
5149
5137
  );
5150
5138
  const silkscreenLine = {
@@ -5153,20 +5141,20 @@ var sod110 = (raw_params) => {
5153
5141
  pcb_component_id: "",
5154
5142
  route: [
5155
5143
  {
5156
- x: length38.parse(parameters.p) / 2,
5157
- y: length38.parse(parameters.h) / 2
5144
+ x: length37.parse(parameters.p) / 2,
5145
+ y: length37.parse(parameters.h) / 2
5158
5146
  },
5159
5147
  {
5160
- x: -length38.parse(parameters.w) / 2,
5161
- y: length38.parse(parameters.h) / 2
5148
+ x: -length37.parse(parameters.w) / 2,
5149
+ y: length37.parse(parameters.h) / 2
5162
5150
  },
5163
5151
  {
5164
- x: -length38.parse(parameters.w) / 2,
5165
- y: -length38.parse(parameters.h) / 2
5152
+ x: -length37.parse(parameters.w) / 2,
5153
+ y: -length37.parse(parameters.h) / 2
5166
5154
  },
5167
5155
  {
5168
- x: length38.parse(parameters.p) / 2,
5169
- y: -length38.parse(parameters.h) / 2
5156
+ x: length37.parse(parameters.p) / 2,
5157
+ y: -length37.parse(parameters.h) / 2
5170
5158
  }
5171
5159
  ],
5172
5160
  stroke_width: 0.1,
@@ -5207,10 +5195,138 @@ var sodWithoutParsing13 = (parameters) => {
5207
5195
  return pads;
5208
5196
  };
5209
5197
 
5198
+ // src/fn/vssop.ts
5199
+ import { z as z48 } from "zod";
5200
+ import { length as length38 } from "circuit-json";
5201
+ var getDefaultValues = (num_pins) => {
5202
+ switch (num_pins) {
5203
+ case 8:
5204
+ return {
5205
+ w: "3.06mm",
5206
+ h: "3.14mm",
5207
+ p: "0.65mm",
5208
+ pl: "1.6mm",
5209
+ pw: "0.5mm"
5210
+ };
5211
+ case 10:
5212
+ return {
5213
+ w: "3.10mm",
5214
+ h: "3.33mm",
5215
+ p: "0.5mm",
5216
+ pl: "1.45mm",
5217
+ pw: "0.3mm"
5218
+ };
5219
+ default:
5220
+ return {
5221
+ w: "3.06mm",
5222
+ h: "3.14mm",
5223
+ p: "0.65mm",
5224
+ pl: "1.6mm",
5225
+ pw: "0.5mm"
5226
+ };
5227
+ }
5228
+ };
5229
+ var vssop_def = z48.object({
5230
+ fn: z48.string(),
5231
+ num_pins: z48.union([z48.literal(8), z48.literal(10)]).default(8),
5232
+ w: z48.string().optional(),
5233
+ h: z48.string().optional(),
5234
+ p: z48.string().optional(),
5235
+ pl: z48.string().optional(),
5236
+ pw: z48.string().optional(),
5237
+ string: z48.string().optional()
5238
+ });
5239
+ var vssop = (raw_params) => {
5240
+ const parameters = vssop_def.parse(raw_params);
5241
+ const defaults = getDefaultValues(parameters.num_pins);
5242
+ const w = length38.parse(parameters.w || defaults.w);
5243
+ const h = length38.parse(parameters.h || defaults.h);
5244
+ const p = length38.parse(parameters.p || defaults.p);
5245
+ const pl = length38.parse(parameters.pl || defaults.pl);
5246
+ const pw = length38.parse(parameters.pw || defaults.pw);
5247
+ const pads = [];
5248
+ for (let i = 0; i < parameters.num_pins; i++) {
5249
+ const { x, y } = getVssopPadCoord(parameters.num_pins, i + 1, w, p);
5250
+ pads.push(rectpad(i + 1, x, y, pl, pw));
5251
+ }
5252
+ const silkscreenBoxWidth = w;
5253
+ const silkscreenBoxHeight = h;
5254
+ const silkscreenTopLine = {
5255
+ type: "pcb_silkscreen_path",
5256
+ layer: "top",
5257
+ pcb_component_id: "",
5258
+ route: [
5259
+ { x: -silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 },
5260
+ { x: silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 }
5261
+ ],
5262
+ stroke_width: 0.05,
5263
+ pcb_silkscreen_path_id: ""
5264
+ };
5265
+ const silkscreenBottomLine = {
5266
+ type: "pcb_silkscreen_path",
5267
+ layer: "top",
5268
+ pcb_component_id: "",
5269
+ route: [
5270
+ { x: -silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 },
5271
+ { x: silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 }
5272
+ ],
5273
+ stroke_width: 0.05,
5274
+ pcb_silkscreen_path_id: ""
5275
+ };
5276
+ const pin1Position = getVssopPadCoord(
5277
+ parameters.num_pins,
5278
+ 1,
5279
+ silkscreenBoxWidth,
5280
+ p
5281
+ );
5282
+ const pin1MarkerPosition = {
5283
+ x: pin1Position.x - 0.8,
5284
+ y: pin1Position.y
5285
+ };
5286
+ const pin1Marking = {
5287
+ type: "pcb_silkscreen_path",
5288
+ layer: "top",
5289
+ pcb_component_id: "pin_marker_1",
5290
+ route: [
5291
+ { x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y },
5292
+ { x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y + 0.3 },
5293
+ { x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y - 0.3 },
5294
+ { x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y }
5295
+ ],
5296
+ stroke_width: 0.05,
5297
+ pcb_silkscreen_path_id: "pin_marker_1"
5298
+ };
5299
+ const silkscreenRefText = silkscreenRef(
5300
+ 0,
5301
+ silkscreenBoxHeight / 2 + 0.5,
5302
+ 0.3
5303
+ );
5304
+ return {
5305
+ circuitJson: [
5306
+ ...pads,
5307
+ silkscreenTopLine,
5308
+ silkscreenBottomLine,
5309
+ silkscreenRefText,
5310
+ pin1Marking
5311
+ ],
5312
+ parameters
5313
+ };
5314
+ };
5315
+ var getVssopPadCoord = (pinCount, pn, w, p) => {
5316
+ const half = pinCount / 2;
5317
+ const rowIndex = (pn - 1) % half;
5318
+ const col = pn <= half ? -1 : 1;
5319
+ const row = (half - 1) / 2 - rowIndex;
5320
+ return {
5321
+ x: col * length38.parse(pinCount === 8 ? "1.8mm" : "2.2mm"),
5322
+ y: row * p
5323
+ };
5324
+ };
5325
+
5210
5326
  // src/fn/msop.ts
5211
5327
  import { z as z49 } from "zod";
5212
5328
  import { length as length39 } from "circuit-json";
5213
- var getDefaultValues = (num_pins) => {
5329
+ var getDefaultValues2 = (num_pins) => {
5214
5330
  switch (num_pins) {
5215
5331
  case 10:
5216
5332
  return {
@@ -5268,7 +5384,7 @@ var getMsopCoords = (pinCount, pn, w, p) => {
5268
5384
  };
5269
5385
  var msop = (raw_params) => {
5270
5386
  const parameters = msop_def.parse(raw_params);
5271
- const defaults = getDefaultValues(parameters.num_pins);
5387
+ const defaults = getDefaultValues2(parameters.num_pins);
5272
5388
  const w = length39.parse(parameters.w || defaults.w);
5273
5389
  const h = length39.parse(parameters.h || defaults.h);
5274
5390
  const p = length39.parse(parameters.p || defaults.p);