jscad-electronics 0.0.160 → 0.0.161

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/vanilla.js CHANGED
@@ -193,8 +193,67 @@ var ExtrudedPads = ({
193
193
  ] });
194
194
  };
195
195
 
196
+ // lib/TantalumCapacitor.tsx
197
+ import { fp as fp2 } from "@tscircuit/footprinter";
198
+ var tantalumCases = {
199
+ A: [3.2, 1.6, 1.6, 1.2, 0.8],
200
+ B: [3.5, 2.8, 1.9, 2.2, 0.8],
201
+ C: [6, 3.2, 2.6, 2.2, 1.3],
202
+ D: [7.3, 4.3, 2.9, 2.4, 1.3]
203
+ };
204
+ var TantalumCapacitor = ({
205
+ caseSize = "A",
206
+ footprint = "smdpads2_p3.1mm_pw1.4mm_ph1.6mm"
207
+ }) => {
208
+ const dims = tantalumCases[caseSize];
209
+ if (!dims) throw new Error("Unsupported tantalum case");
210
+ const [length, width10, height10, leadWidth, leadLength] = dims;
211
+ const pads = fp2.string(footprint).circuitJson().filter(
212
+ (e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
213
+ );
214
+ if (pads.length !== 2) throw new Error("TantalumCapacitor requires two pads");
215
+ const [a, b] = pads;
216
+ const angle = Math.atan2(b.y - a.y, b.x - a.x);
217
+ return /* @__PURE__ */ jsx(Translate, { offset: [(a.x + b.x) / 2, (a.y + b.y) / 2, 0], children: /* @__PURE__ */ jsxs(Rotate, { rotation: [0, 0, angle], children: [
218
+ /* @__PURE__ */ jsx(Colorize, { color: "#d5a64e", children: /* @__PURE__ */ jsxs(Hull, { children: [
219
+ /* @__PURE__ */ jsx(Cuboid, { size: [length - 0.1, width10, 0.02], center: [0, 0, 0.21] }),
220
+ /* @__PURE__ */ jsx(
221
+ Cuboid,
222
+ {
223
+ size: [length - 0.25, width10 - 0.15, 0.02],
224
+ center: [0, 0, height10 - 0.01]
225
+ }
226
+ )
227
+ ] }) }),
228
+ /* @__PURE__ */ jsx(Colorize, { color: "#c5c8cb", children: [-1, 1].map((side) => /* @__PURE__ */ jsxs(Union, { children: [
229
+ /* @__PURE__ */ jsx(
230
+ Cuboid,
231
+ {
232
+ size: [leadLength, leadWidth, 0.25],
233
+ center: [side * (length - leadLength) / 2, 0, 0.125]
234
+ }
235
+ ),
236
+ /* @__PURE__ */ jsx(
237
+ Cuboid,
238
+ {
239
+ size: [0.15, leadWidth, height10 * 0.45],
240
+ center: [side * (length - 0.15) / 2, 0, height10 * 0.225]
241
+ }
242
+ )
243
+ ] }, side)) }),
244
+ /* @__PURE__ */ jsx(
245
+ Cuboid,
246
+ {
247
+ size: [0.25, width10 - 0.25, 0.01],
248
+ center: [-length / 2 + 0.5, 0, height10],
249
+ color: "#423426"
250
+ }
251
+ )
252
+ ] }) });
253
+ };
254
+
196
255
  // lib/Footprinter3d.tsx
197
- import { fp as fp8 } from "@tscircuit/footprinter";
256
+ import { fp as fp9 } from "@tscircuit/footprinter";
198
257
  import { mp } from "@tscircuit/modelprinter";
199
258
 
200
259
  // lib/ChipBody.tsx
@@ -5180,7 +5239,7 @@ var JSTPH2_0mm = ({
5180
5239
  };
5181
5240
 
5182
5241
  // lib/JSTXH2_5mm.tsx
5183
- import { fp as fp2 } from "@tscircuit/footprinter";
5242
+ import { fp as fp3 } from "@tscircuit/footprinter";
5184
5243
  var JSTXH2_5mm = ({
5185
5244
  numPins = 4,
5186
5245
  showPins = true,
@@ -5289,7 +5348,7 @@ var JSTXH2_5mm = ({
5289
5348
  showPins && Array.from({ length: numPins }).map((_, i) => /* @__PURE__ */ jsx(Colorize, { color: pinColor, children: /* @__PURE__ */ jsx(Translate, { offset: [startX + i * pitch, 0, pinLength / 2 - 3.4], children: /* @__PURE__ */ jsx(Cuboid, { size: [0.64, 0.64, pinLength] }) }) }, i)),
5290
5349
  showFootprint && (() => {
5291
5350
  try {
5292
- const circuitJson = fp2.string(`jst${numPins}_xh`).circuitJson();
5351
+ const circuitJson = fp3.string(`jst${numPins}_xh`).circuitJson();
5293
5352
  const platedHoles = circuitJson.filter(
5294
5353
  (e) => e.type === "pcb_plated_hole"
5295
5354
  );
@@ -5785,9 +5844,9 @@ var SmdPinHeader = ({
5785
5844
  import { mm } from "@tscircuit/mm";
5786
5845
 
5787
5846
  // lib/utils/getPlatedHoleCenters.ts
5788
- import { fp as fp3 } from "@tscircuit/footprinter";
5847
+ import { fp as fp4 } from "@tscircuit/footprinter";
5789
5848
  var getPlatedHoleCenters = (footprint) => {
5790
- const elements = fp3.string(footprint).circuitJson();
5849
+ const elements = fp4.string(footprint).circuitJson();
5791
5850
  return elements.filter(
5792
5851
  (element) => element.type === "pcb_plated_hole" && Number.isFinite(element.x) && Number.isFinite(element.y)
5793
5852
  ).map((element) => ({
@@ -5798,9 +5857,9 @@ var getPlatedHoleCenters = (footprint) => {
5798
5857
  };
5799
5858
 
5800
5859
  // lib/utils/getSmtPadRects.ts
5801
- import { fp as fp4 } from "@tscircuit/footprinter";
5860
+ import { fp as fp5 } from "@tscircuit/footprinter";
5802
5861
  var getSmtPadRects = (footprint) => {
5803
- const elements = fp4.string(footprint).circuitJson();
5862
+ const elements = fp5.string(footprint).circuitJson();
5804
5863
  return elements.filter(
5805
5864
  (element) => element.type === "pcb_smtpad" && element.shape === "rect" && Number.isFinite(element.x) && Number.isFinite(element.y)
5806
5865
  ).map((element) => ({
@@ -6556,7 +6615,7 @@ var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength10 = 1.6 }) => {
6556
6615
  };
6557
6616
 
6558
6617
  // lib/BGA.tsx
6559
- import { fp as fp5 } from "@tscircuit/footprinter";
6618
+ import { fp as fp6 } from "@tscircuit/footprinter";
6560
6619
  var BGA = ({
6561
6620
  packageWidth = 10,
6562
6621
  packageLength = 10,
@@ -6572,7 +6631,7 @@ var BGA = ({
6572
6631
  const bodyHeight = packageHeight - standoffHeight;
6573
6632
  const bodyOffset = standoffHeight + bodyHeight / 2;
6574
6633
  const ballOffset = Math.max(standoffHeight / 2, ballDiameter / 2);
6575
- const ballsSoup = footprintString ? fp5.string(footprintString).circuitJson() : null;
6634
+ const ballsSoup = footprintString ? fp6.string(footprintString).circuitJson() : null;
6576
6635
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
6577
6636
  /* @__PURE__ */ jsx(Translate, { z: bodyOffset, children: /* @__PURE__ */ jsx(Colorize, { color: "#555", children: /* @__PURE__ */ jsx(Cuboid, { size: [packageWidth, packageLength, bodyHeight] }) }) }),
6578
6637
  !footprintString && Array.from({ length: ballRows * ballColumns }).map((_, index) => {
@@ -6602,7 +6661,7 @@ var BGA = ({
6602
6661
  };
6603
6662
 
6604
6663
  // lib/UsbCMidmount.tsx
6605
- import { fp as fp6 } from "@tscircuit/footprinter";
6664
+ import { fp as fp7 } from "@tscircuit/footprinter";
6606
6665
  var Capsule = ({
6607
6666
  width: width10,
6608
6667
  height: height10,
@@ -6612,14 +6671,14 @@ var UsbCMidmount = ({
6612
6671
  footprint = "usbcmidmount16"
6613
6672
  }) => {
6614
6673
  const canonical = footprint.replace(/_pin1location\([^)]*\)/g, "");
6615
- const params = fp6.string(canonical).json();
6616
- const elements = fp6.string(canonical).circuitJson();
6674
+ const params = fp7.string(canonical).json();
6675
+ const elements = fp7.string(canonical).circuitJson();
6617
6676
  const pads = elements.filter(
6618
6677
  (e) => e.type === "pcb_smtpad" && e.shape === "rect"
6619
6678
  );
6620
6679
  const slots = elements.filter((e) => e.type === "pcb_plated_hole");
6621
6680
  const holes = elements.filter((e) => e.type === "pcb_hole");
6622
- const target = fp6.string(footprint).circuitJson().find((e) => e.type === "pcb_plated_hole");
6681
+ const target = fp7.string(footprint).circuitJson().find((e) => e.type === "pcb_plated_hole");
6623
6682
  const first = slots[0];
6624
6683
  const angle = first && target && "x" in target ? Math.atan2(target.y, target.x) - Math.atan2(first.y, first.x) : 0;
6625
6684
  const width10 = 8.94, height10 = 3.2, wall = 0.22;
@@ -6703,15 +6762,15 @@ var UsbCMidmount = ({
6703
6762
  };
6704
6763
 
6705
6764
  // lib/SOT143.tsx
6706
- import { fp as fp7 } from "@tscircuit/footprinter";
6707
- var getPads = (footprint) => fp7.string(footprint).circuitJson().filter(
6765
+ import { fp as fp8 } from "@tscircuit/footprinter";
6766
+ var getPads = (footprint) => fp8.string(footprint).circuitJson().filter(
6708
6767
  (element) => element.type === "pcb_smtpad" && (element.shape === "rect" || element.shape === "rotated_rect")
6709
6768
  ).map((pad) => ({ x: pad.x, y: pad.y, pin: pad.port_hints?.[0] }));
6710
6769
  var SOT143 = ({ footprint = "sot143" }) => {
6711
6770
  const pads = getPads(footprint);
6712
6771
  if (pads.length !== 4) throw new Error("SOT143 requires four signal pads");
6713
6772
  const canonical = getPads("sot143");
6714
- const options = fp7.string(footprint).json();
6773
+ const options = fp8.string(footprint).json();
6715
6774
  const origin = canonical[1];
6716
6775
  const target = pads.find((pad) => pad.pin === "2");
6717
6776
  const angle = options.pin1location ? Math.round(
@@ -7298,6 +7357,15 @@ var FlexScreen = (props) => {
7298
7357
 
7299
7358
  // lib/Footprinter3d.tsx
7300
7359
  var Footprinter3d = ({ footprint }) => {
7360
+ const tantalum = footprint.match(/(?:^|_)tantalum([ABCD])(?:_|$)/);
7361
+ if (tantalum)
7362
+ return /* @__PURE__ */ jsx(
7363
+ TantalumCapacitor,
7364
+ {
7365
+ footprint,
7366
+ caseSize: tantalum[1]
7367
+ }
7368
+ );
7301
7369
  const modelFn = mp.string(footprint.split("_", 1)[0]).params().fn;
7302
7370
  if (mp.getModelNames().includes(modelFn)) {
7303
7371
  const model = mp.string(footprint).json();
@@ -7322,7 +7390,7 @@ var Footprinter3d = ({ footprint }) => {
7322
7390
  const numPins = pinMatch && pinMatch[1] ? pinMatch[1] : "2";
7323
7391
  normalizedFootprint = `jst${numPins}_xh`;
7324
7392
  }
7325
- const fpJson = fp8.string(normalizedFootprint).json();
7393
+ const fpJson = fp9.string(normalizedFootprint).json();
7326
7394
  const colorMatch = footprint.match(/_color\(([^)]+)\)/);
7327
7395
  const color = colorMatch ? colorMatch[1] : void 0;
7328
7396
  const dim = (value, fallback) => {