@tscircuit/footprinter 0.0.149 → 0.0.150

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
@@ -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
@@ -4456,118 +4456,17 @@ var smbWithoutParsing = (parameters) => {
4456
4456
  return pads;
4457
4457
  };
4458
4458
 
4459
- // src/fn/vssop8.ts
4459
+ // src/fn/smc.ts
4460
4460
  import { z as z42 } from "zod";
4461
4461
  import { length as length35 } from "circuit-json";
4462
- var vssop8_def = z42.object({
4462
+ var smc_def = z42.object({
4463
4463
  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")
4464
+ num_pins: z42.literal(2).default(2),
4465
+ w: z42.string().default("10.70mm"),
4466
+ h: z42.string().default("6.60mm"),
4467
+ pl: z42.string().default("3.30mm"),
4468
+ pw: z42.string().default("2.50mm"),
4469
+ p: z42.string().default("6.80mm")
4571
4470
  });
4572
4471
  var smc = (raw_params) => {
4573
4472
  const parameters = smc_def.parse(raw_params);
@@ -4578,20 +4477,20 @@ var smc = (raw_params) => {
4578
4477
  pcb_component_id: "",
4579
4478
  route: [
4580
4479
  {
4581
- x: length36.parse(parameters.p) / 2,
4582
- y: length36.parse(parameters.h) / 2 - 0.8
4480
+ x: length35.parse(parameters.p) / 2,
4481
+ y: length35.parse(parameters.h) / 2 - 0.8
4583
4482
  },
4584
4483
  {
4585
- x: -length36.parse(parameters.w) / 2 - 0.8,
4586
- y: length36.parse(parameters.h) / 2 - 0.8
4484
+ x: -length35.parse(parameters.w) / 2 - 0.8,
4485
+ y: length35.parse(parameters.h) / 2 - 0.8
4587
4486
  },
4588
4487
  {
4589
- x: -length36.parse(parameters.w) / 2 - 0.8,
4590
- y: -length36.parse(parameters.h) / 2 + 0.8
4488
+ x: -length35.parse(parameters.w) / 2 - 0.8,
4489
+ y: -length35.parse(parameters.h) / 2 + 0.8
4591
4490
  },
4592
4491
  {
4593
- x: length36.parse(parameters.p) / 2,
4594
- y: -length36.parse(parameters.h) / 2 + 0.8
4492
+ x: length35.parse(parameters.p) / 2,
4493
+ y: -length35.parse(parameters.h) / 2 + 0.8
4595
4494
  }
4596
4495
  ],
4597
4496
  stroke_width: 0.1,
@@ -4633,16 +4532,16 @@ var smcWithoutParsing = (parameters) => {
4633
4532
  };
4634
4533
 
4635
4534
  // 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()
4535
+ import { z as z43 } from "zod";
4536
+ var sot223_def = z43.object({
4537
+ fn: z43.string(),
4538
+ num_pins: z43.number().default(4),
4539
+ w: z43.string().default("8.50mm"),
4540
+ h: z43.string().default("6.90mm"),
4541
+ pl: z43.string().default("2mm"),
4542
+ pw: z43.string().default("1.5mm"),
4543
+ p: z43.string().default("2.30mm"),
4544
+ string: z43.string().optional()
4646
4545
  });
4647
4546
  var sot223 = (raw_params) => {
4648
4547
  const match = raw_params.string?.match(/^sot223_(\d+)/);
@@ -4888,16 +4787,16 @@ var sot223_6 = (parameters) => {
4888
4787
  };
4889
4788
 
4890
4789
  // 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()
4790
+ import { z as z44 } from "zod";
4791
+ var sot23w_def = z44.object({
4792
+ fn: z44.string(),
4793
+ num_pins: z44.number().default(3),
4794
+ w: z44.string().default("3.40mm"),
4795
+ h: z44.string().default("3.30mm"),
4796
+ pl: z44.string().default("1mm"),
4797
+ pw: z44.string().default("0.7mm"),
4798
+ p: z44.string().default("1.2mm"),
4799
+ string: z44.string().optional()
4901
4800
  });
4902
4801
  var sot23w = (raw_params) => {
4903
4802
  const match = raw_params.string?.match(/^sot23w_(\d+)/);
@@ -4985,16 +4884,16 @@ var sot23w_3 = (parameters) => {
4985
4884
  };
4986
4885
 
4987
4886
  // 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()
4887
+ import { z as z45 } from "zod";
4888
+ var to92s_def = z45.object({
4889
+ fn: z45.string(),
4890
+ num_pins: z45.union([z45.literal(3), z45.literal(2)]).default(3),
4891
+ p: z45.string().default("1.27mm"),
4892
+ id: z45.string().default("0.72mm"),
4893
+ od: z45.string().default("0.95mm"),
4894
+ w: z45.string().default("2.5mm"),
4895
+ h: z45.string().default("4.2mm"),
4896
+ string: z45.string().optional()
4998
4897
  });
4999
4898
  var to92s_3 = (parameters) => {
5000
4899
  const { p, id, od, w, h } = parameters;
@@ -5061,9 +4960,9 @@ var to92s = (raw_params) => {
5061
4960
 
5062
4961
  // src/fn/jst.ts
5063
4962
  import {
5064
- length as length37
4963
+ length as length36
5065
4964
  } from "circuit-json";
5066
- import { z as z47 } from "zod";
4965
+ import { z as z46 } from "zod";
5067
4966
 
5068
4967
  // src/helpers/platedHoleWithRectPad.ts
5069
4968
  import { mm as mm4 } from "@tscircuit/mm";
@@ -5086,14 +4985,14 @@ var platedHoleWithRectPad = (pn, x, y, holeDiameter, rectPadWidth, rectPadHeight
5086
4985
  };
5087
4986
 
5088
4987
  // 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")
4988
+ var jst_def = z46.object({
4989
+ fn: z46.string(),
4990
+ p: length36.optional().default("2.2mm"),
4991
+ id: length36.optional().default("0.70mm"),
4992
+ pw: length36.optional().default("1.20mm"),
4993
+ pl: length36.optional().default("1.20mm"),
4994
+ w: length36.optional().default("6mm"),
4995
+ h: length36.optional().default("5mm")
5097
4996
  });
5098
4997
  var jst = (raw_params) => {
5099
4998
  const parameters = jst_def.parse(raw_params);
@@ -5129,22 +5028,22 @@ var jst = (raw_params) => {
5129
5028
  };
5130
5029
 
5131
5030
  // 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")
5031
+ import { z as z47 } from "zod";
5032
+ import { length as length37 } from "circuit-json";
5033
+ var sod_def12 = z47.object({
5034
+ fn: z47.string(),
5035
+ num_pins: z47.literal(2).default(2),
5036
+ w: z47.string().default("3.30mm"),
5037
+ h: z47.string().default("1.70mm"),
5038
+ pl: z47.string().default("0.80mm"),
5039
+ pw: z47.string().default("1mm"),
5040
+ p: z47.string().default("1.90mm")
5142
5041
  });
5143
5042
  var sod110 = (raw_params) => {
5144
5043
  const parameters = sod_def12.parse(raw_params);
5145
5044
  const silkscreenRefText = silkscreenRef(
5146
5045
  0,
5147
- length38.parse(parameters.h) / 2 + 0.5,
5046
+ length37.parse(parameters.h) / 2 + 0.5,
5148
5047
  0.3
5149
5048
  );
5150
5049
  const silkscreenLine = {
@@ -5153,20 +5052,20 @@ var sod110 = (raw_params) => {
5153
5052
  pcb_component_id: "",
5154
5053
  route: [
5155
5054
  {
5156
- x: length38.parse(parameters.p) / 2,
5157
- y: length38.parse(parameters.h) / 2
5055
+ x: length37.parse(parameters.p) / 2,
5056
+ y: length37.parse(parameters.h) / 2
5158
5057
  },
5159
5058
  {
5160
- x: -length38.parse(parameters.w) / 2,
5161
- y: length38.parse(parameters.h) / 2
5059
+ x: -length37.parse(parameters.w) / 2,
5060
+ y: length37.parse(parameters.h) / 2
5162
5061
  },
5163
5062
  {
5164
- x: -length38.parse(parameters.w) / 2,
5165
- y: -length38.parse(parameters.h) / 2
5063
+ x: -length37.parse(parameters.w) / 2,
5064
+ y: -length37.parse(parameters.h) / 2
5166
5065
  },
5167
5066
  {
5168
- x: length38.parse(parameters.p) / 2,
5169
- y: -length38.parse(parameters.h) / 2
5067
+ x: length37.parse(parameters.p) / 2,
5068
+ y: -length37.parse(parameters.h) / 2
5170
5069
  }
5171
5070
  ],
5172
5071
  stroke_width: 0.1,
@@ -5207,10 +5106,138 @@ var sodWithoutParsing13 = (parameters) => {
5207
5106
  return pads;
5208
5107
  };
5209
5108
 
5109
+ // src/fn/vssop.ts
5110
+ import { z as z48 } from "zod";
5111
+ import { length as length38 } from "circuit-json";
5112
+ var getDefaultValues = (num_pins) => {
5113
+ switch (num_pins) {
5114
+ case 8:
5115
+ return {
5116
+ w: "3.06mm",
5117
+ h: "3.14mm",
5118
+ p: "0.65mm",
5119
+ pl: "1.6mm",
5120
+ pw: "0.5mm"
5121
+ };
5122
+ case 10:
5123
+ return {
5124
+ w: "3.10mm",
5125
+ h: "3.33mm",
5126
+ p: "0.5mm",
5127
+ pl: "1.45mm",
5128
+ pw: "0.3mm"
5129
+ };
5130
+ default:
5131
+ return {
5132
+ w: "3.06mm",
5133
+ h: "3.14mm",
5134
+ p: "0.65mm",
5135
+ pl: "1.6mm",
5136
+ pw: "0.5mm"
5137
+ };
5138
+ }
5139
+ };
5140
+ var vssop_def = z48.object({
5141
+ fn: z48.string(),
5142
+ num_pins: z48.union([z48.literal(8), z48.literal(10)]).default(8),
5143
+ w: z48.string().optional(),
5144
+ h: z48.string().optional(),
5145
+ p: z48.string().optional(),
5146
+ pl: z48.string().optional(),
5147
+ pw: z48.string().optional(),
5148
+ string: z48.string().optional()
5149
+ });
5150
+ var vssop = (raw_params) => {
5151
+ const parameters = vssop_def.parse(raw_params);
5152
+ const defaults = getDefaultValues(parameters.num_pins);
5153
+ const w = length38.parse(parameters.w || defaults.w);
5154
+ const h = length38.parse(parameters.h || defaults.h);
5155
+ const p = length38.parse(parameters.p || defaults.p);
5156
+ const pl = length38.parse(parameters.pl || defaults.pl);
5157
+ const pw = length38.parse(parameters.pw || defaults.pw);
5158
+ const pads = [];
5159
+ for (let i = 0; i < parameters.num_pins; i++) {
5160
+ const { x, y } = getVssopPadCoord(parameters.num_pins, i + 1, w, p);
5161
+ pads.push(rectpad(i + 1, x, y, pl, pw));
5162
+ }
5163
+ const silkscreenBoxWidth = w;
5164
+ const silkscreenBoxHeight = h;
5165
+ const silkscreenTopLine = {
5166
+ type: "pcb_silkscreen_path",
5167
+ layer: "top",
5168
+ pcb_component_id: "",
5169
+ route: [
5170
+ { x: -silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 },
5171
+ { x: silkscreenBoxWidth / 2, y: silkscreenBoxHeight / 2 }
5172
+ ],
5173
+ stroke_width: 0.05,
5174
+ pcb_silkscreen_path_id: ""
5175
+ };
5176
+ const silkscreenBottomLine = {
5177
+ type: "pcb_silkscreen_path",
5178
+ layer: "top",
5179
+ pcb_component_id: "",
5180
+ route: [
5181
+ { x: -silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 },
5182
+ { x: silkscreenBoxWidth / 2, y: -silkscreenBoxHeight / 2 }
5183
+ ],
5184
+ stroke_width: 0.05,
5185
+ pcb_silkscreen_path_id: ""
5186
+ };
5187
+ const pin1Position = getVssopPadCoord(
5188
+ parameters.num_pins,
5189
+ 1,
5190
+ silkscreenBoxWidth,
5191
+ p
5192
+ );
5193
+ const pin1MarkerPosition = {
5194
+ x: pin1Position.x - 0.8,
5195
+ y: pin1Position.y
5196
+ };
5197
+ const pin1Marking = {
5198
+ type: "pcb_silkscreen_path",
5199
+ layer: "top",
5200
+ pcb_component_id: "pin_marker_1",
5201
+ route: [
5202
+ { x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y },
5203
+ { x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y + 0.3 },
5204
+ { x: pin1MarkerPosition.x - 0.7, y: pin1MarkerPosition.y - 0.3 },
5205
+ { x: pin1MarkerPosition.x - 0.4, y: pin1MarkerPosition.y }
5206
+ ],
5207
+ stroke_width: 0.05,
5208
+ pcb_silkscreen_path_id: "pin_marker_1"
5209
+ };
5210
+ const silkscreenRefText = silkscreenRef(
5211
+ 0,
5212
+ silkscreenBoxHeight / 2 + 0.5,
5213
+ 0.3
5214
+ );
5215
+ return {
5216
+ circuitJson: [
5217
+ ...pads,
5218
+ silkscreenTopLine,
5219
+ silkscreenBottomLine,
5220
+ silkscreenRefText,
5221
+ pin1Marking
5222
+ ],
5223
+ parameters
5224
+ };
5225
+ };
5226
+ var getVssopPadCoord = (pinCount, pn, w, p) => {
5227
+ const half = pinCount / 2;
5228
+ const rowIndex = (pn - 1) % half;
5229
+ const col = pn <= half ? -1 : 1;
5230
+ const row = (half - 1) / 2 - rowIndex;
5231
+ return {
5232
+ x: col * length38.parse(pinCount === 8 ? "1.8mm" : "2.2mm"),
5233
+ y: row * p
5234
+ };
5235
+ };
5236
+
5210
5237
  // src/fn/msop.ts
5211
5238
  import { z as z49 } from "zod";
5212
5239
  import { length as length39 } from "circuit-json";
5213
- var getDefaultValues = (num_pins) => {
5240
+ var getDefaultValues2 = (num_pins) => {
5214
5241
  switch (num_pins) {
5215
5242
  case 10:
5216
5243
  return {
@@ -5268,7 +5295,7 @@ var getMsopCoords = (pinCount, pn, w, p) => {
5268
5295
  };
5269
5296
  var msop = (raw_params) => {
5270
5297
  const parameters = msop_def.parse(raw_params);
5271
- const defaults = getDefaultValues(parameters.num_pins);
5298
+ const defaults = getDefaultValues2(parameters.num_pins);
5272
5299
  const w = length39.parse(parameters.w || defaults.w);
5273
5300
  const h = length39.parse(parameters.h || defaults.h);
5274
5301
  const p = length39.parse(parameters.p || defaults.p);