jscad-electronics 0.0.163 → 0.0.165
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 +22 -1
- package/dist/index.js +1282 -1046
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +253 -27
- package/dist/vanilla.js.map +1 -1
- package/package.json +1 -1
package/dist/vanilla.js
CHANGED
|
@@ -193,8 +193,48 @@ var ExtrudedPads = ({
|
|
|
193
193
|
] });
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
// lib/
|
|
196
|
+
// lib/CeramicChipAntenna.tsx
|
|
197
197
|
import { fp as fp2 } from "@tscircuit/footprinter";
|
|
198
|
+
var CeramicChipAntenna = ({
|
|
199
|
+
footprint = "smdpads2_p5.4mm_pw1mm_ph2mm"
|
|
200
|
+
}) => {
|
|
201
|
+
const pads = fp2.string(footprint).circuitJson().filter(
|
|
202
|
+
(e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
|
|
203
|
+
);
|
|
204
|
+
if (pads.length !== 2) throw new Error("CeramicChipAntenna requires two pads");
|
|
205
|
+
const [a, b] = pads;
|
|
206
|
+
const angle = Math.atan2(b.y - a.y, b.x - a.x);
|
|
207
|
+
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: [
|
|
208
|
+
/* @__PURE__ */ jsx(
|
|
209
|
+
Cuboid,
|
|
210
|
+
{
|
|
211
|
+
size: [4.44, 1.99, 1.14],
|
|
212
|
+
center: [0, 0, 0.575],
|
|
213
|
+
color: "#4053a3"
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
[-1, 1].map((side) => /* @__PURE__ */ jsx(
|
|
217
|
+
Cuboid,
|
|
218
|
+
{
|
|
219
|
+
size: [0.4, 2, 1.15],
|
|
220
|
+
center: [side * 2.4, 0, 0.575],
|
|
221
|
+
color: "#c2c4c7"
|
|
222
|
+
},
|
|
223
|
+
side
|
|
224
|
+
)),
|
|
225
|
+
/* @__PURE__ */ jsx(
|
|
226
|
+
Cuboid,
|
|
227
|
+
{
|
|
228
|
+
size: [0.9, 2, 0.01],
|
|
229
|
+
center: [-1.75, 0, 1.145],
|
|
230
|
+
color: "#b1b3b6"
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
] }) });
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// lib/MelfResistor.tsx
|
|
237
|
+
import { fp as fp3 } from "@tscircuit/footprinter";
|
|
198
238
|
var melfResistorSizes = {
|
|
199
239
|
"0102": [2.2, 1.1, 0.4],
|
|
200
240
|
"0204": [3.6, 1.4, 0.75],
|
|
@@ -207,7 +247,7 @@ var MelfResistor = ({
|
|
|
207
247
|
const dims = melfResistorSizes[size];
|
|
208
248
|
if (!dims) throw new Error("Unsupported MELF resistor size");
|
|
209
249
|
const [length, diameter, capLength] = dims;
|
|
210
|
-
const pads =
|
|
250
|
+
const pads = fp3.string(footprint).circuitJson().filter(
|
|
211
251
|
(e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
|
|
212
252
|
);
|
|
213
253
|
if (pads.length !== 2) throw new Error("MelfResistor requires two pads");
|
|
@@ -234,7 +274,7 @@ var MelfResistor = ({
|
|
|
234
274
|
};
|
|
235
275
|
|
|
236
276
|
// lib/TwoPadCrystal.tsx
|
|
237
|
-
import { fp as
|
|
277
|
+
import { fp as fp4 } from "@tscircuit/footprinter";
|
|
238
278
|
var twoPadCrystalPackages = {
|
|
239
279
|
FC135: [3.2, 1.5, 0.9, 0.7],
|
|
240
280
|
FC12M: [2.05, 1.2, 0.6, 0.5],
|
|
@@ -248,7 +288,7 @@ var TwoPadCrystal = ({
|
|
|
248
288
|
const dims = twoPadCrystalPackages[packageName];
|
|
249
289
|
if (!dims) throw new Error("Unsupported two-pad crystal package");
|
|
250
290
|
const [length, width10, height10, terminalLength] = dims;
|
|
251
|
-
const pads =
|
|
291
|
+
const pads = fp4.string(footprint).circuitJson().filter(
|
|
252
292
|
(e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
|
|
253
293
|
);
|
|
254
294
|
if (pads.length !== 2) throw new Error("TwoPadCrystal requires two pads");
|
|
@@ -276,7 +316,7 @@ var TwoPadCrystal = ({
|
|
|
276
316
|
};
|
|
277
317
|
|
|
278
318
|
// lib/TantalumCapacitor.tsx
|
|
279
|
-
import { fp as
|
|
319
|
+
import { fp as fp5 } from "@tscircuit/footprinter";
|
|
280
320
|
var tantalumCases = {
|
|
281
321
|
A: [3.2, 1.6, 1.6, 1.2, 0.8],
|
|
282
322
|
B: [3.5, 2.8, 1.9, 2.2, 0.8],
|
|
@@ -290,7 +330,7 @@ var TantalumCapacitor = ({
|
|
|
290
330
|
const dims = tantalumCases[caseSize];
|
|
291
331
|
if (!dims) throw new Error("Unsupported tantalum case");
|
|
292
332
|
const [length, width10, height10, leadWidth, leadLength] = dims;
|
|
293
|
-
const pads =
|
|
333
|
+
const pads = fp5.string(footprint).circuitJson().filter(
|
|
294
334
|
(e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
|
|
295
335
|
);
|
|
296
336
|
if (pads.length !== 2) throw new Error("TantalumCapacitor requires two pads");
|
|
@@ -335,7 +375,7 @@ var TantalumCapacitor = ({
|
|
|
335
375
|
};
|
|
336
376
|
|
|
337
377
|
// lib/Footprinter3d.tsx
|
|
338
|
-
import { fp as
|
|
378
|
+
import { fp as fp14 } from "@tscircuit/footprinter";
|
|
339
379
|
import { mp } from "@tscircuit/modelprinter";
|
|
340
380
|
|
|
341
381
|
// lib/ChipBody.tsx
|
|
@@ -5321,7 +5361,7 @@ var JSTPH2_0mm = ({
|
|
|
5321
5361
|
};
|
|
5322
5362
|
|
|
5323
5363
|
// lib/JSTXH2_5mm.tsx
|
|
5324
|
-
import { fp as
|
|
5364
|
+
import { fp as fp6 } from "@tscircuit/footprinter";
|
|
5325
5365
|
var JSTXH2_5mm = ({
|
|
5326
5366
|
numPins = 4,
|
|
5327
5367
|
showPins = true,
|
|
@@ -5430,7 +5470,7 @@ var JSTXH2_5mm = ({
|
|
|
5430
5470
|
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)),
|
|
5431
5471
|
showFootprint && (() => {
|
|
5432
5472
|
try {
|
|
5433
|
-
const circuitJson =
|
|
5473
|
+
const circuitJson = fp6.string(`jst${numPins}_xh`).circuitJson();
|
|
5434
5474
|
const platedHoles = circuitJson.filter(
|
|
5435
5475
|
(e) => e.type === "pcb_plated_hole"
|
|
5436
5476
|
);
|
|
@@ -5449,6 +5489,107 @@ var JSTXH2_5mm = ({
|
|
|
5449
5489
|
] });
|
|
5450
5490
|
};
|
|
5451
5491
|
|
|
5492
|
+
// lib/JstSh.tsx
|
|
5493
|
+
import { fp as fp7 } from "@tscircuit/footprinter";
|
|
5494
|
+
import { mm } from "@tscircuit/mm";
|
|
5495
|
+
function isJstShFootprint(footprint) {
|
|
5496
|
+
const p = fp7.string(footprint).json();
|
|
5497
|
+
if (p.fn !== "jst") return false;
|
|
5498
|
+
return Boolean(
|
|
5499
|
+
p.sh || p.smd && Math.abs(mm(p.p) - 1) < 0.01 && Math.abs(mm(p.mpx ?? 0) - (p.num_pins - 1 + 2.6)) < 0.15 && Math.abs(mm(p.mpy ?? 0) - 2.525) < 0.15
|
|
5500
|
+
);
|
|
5501
|
+
}
|
|
5502
|
+
var JstSh = ({ footprint = "jst6_sh" }) => {
|
|
5503
|
+
if (!isJstShFootprint(footprint))
|
|
5504
|
+
throw new Error(
|
|
5505
|
+
"JstSh requires a named SH or matching 1mm SH top-entry footprint"
|
|
5506
|
+
);
|
|
5507
|
+
const canonical = footprint.replace(/_pin1location\([^)]*\)/g, "");
|
|
5508
|
+
const params = fp7.string(canonical).json();
|
|
5509
|
+
const pads = fp7.string(canonical).circuitJson().filter((e) => e.type === "pcb_smtpad" && e.shape === "rect");
|
|
5510
|
+
const target = fp7.string(footprint).circuitJson().filter(
|
|
5511
|
+
(e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
|
|
5512
|
+
);
|
|
5513
|
+
const n = params.num_pins;
|
|
5514
|
+
if (!Number.isInteger(n) || n < 2 || n > 20 || pads.length !== n + 2)
|
|
5515
|
+
throw new Error("JstSh requires 2\u201320 contacts and two hold-down pads");
|
|
5516
|
+
const signals = pads.slice(0, n), mounts = pads.slice(n);
|
|
5517
|
+
const angle = Math.atan2(target[1].y - target[0].y, target[1].x - target[0].x) - Math.atan2(pads[1].y - pads[0].y, pads[1].x - pads[0].x);
|
|
5518
|
+
const x = signals.reduce((sum, p) => sum + p.x, 0) / n, rowY = signals[0].y;
|
|
5519
|
+
const direction = mounts[0].y > rowY ? 1 : -1;
|
|
5520
|
+
const y = rowY + direction * 1.8, width10 = n + 2, depth = 2.9, height10 = 4.2;
|
|
5521
|
+
const pinY = y - direction * 0.25;
|
|
5522
|
+
return /* @__PURE__ */ jsxs(Rotate, { rotation: [0, 0, angle], children: [
|
|
5523
|
+
/* @__PURE__ */ jsx(Colorize, { color: "#e4e1d6", children: /* @__PURE__ */ jsxs(Subtract, { children: [
|
|
5524
|
+
/* @__PURE__ */ jsx(
|
|
5525
|
+
Cuboid,
|
|
5526
|
+
{
|
|
5527
|
+
size: [width10, depth, height10],
|
|
5528
|
+
center: [x, y, height10 / 2 + 0.05]
|
|
5529
|
+
}
|
|
5530
|
+
),
|
|
5531
|
+
/* @__PURE__ */ jsx(
|
|
5532
|
+
Cuboid,
|
|
5533
|
+
{
|
|
5534
|
+
size: [width10 - 1.3, 1.8, height10],
|
|
5535
|
+
center: [x, y, height10 / 2 + 0.8]
|
|
5536
|
+
}
|
|
5537
|
+
),
|
|
5538
|
+
mounts.map((pad, i) => /* @__PURE__ */ jsx(
|
|
5539
|
+
Cuboid,
|
|
5540
|
+
{
|
|
5541
|
+
size: [0.7, pad.height * 0.8, 1.5],
|
|
5542
|
+
center: [pad.x, pad.y, 0.75]
|
|
5543
|
+
},
|
|
5544
|
+
`recess-${i}`
|
|
5545
|
+
)),
|
|
5546
|
+
[-1, 1].map((side) => /* @__PURE__ */ jsx(
|
|
5547
|
+
Cuboid,
|
|
5548
|
+
{
|
|
5549
|
+
size: [0.55, 0.6, 1],
|
|
5550
|
+
center: [
|
|
5551
|
+
x + side * (width10 / 2 - 0.9),
|
|
5552
|
+
y + direction * depth / 2,
|
|
5553
|
+
4
|
|
5554
|
+
]
|
|
5555
|
+
},
|
|
5556
|
+
side
|
|
5557
|
+
))
|
|
5558
|
+
] }) }),
|
|
5559
|
+
/* @__PURE__ */ jsxs(Colorize, { color: "#c6c7c9", children: [
|
|
5560
|
+
signals.map((pad, i) => {
|
|
5561
|
+
const tailY = pad.y - direction * pad.height * 0.4;
|
|
5562
|
+
return /* @__PURE__ */ jsxs(Union, { children: [
|
|
5563
|
+
/* @__PURE__ */ jsx(
|
|
5564
|
+
Cuboid,
|
|
5565
|
+
{
|
|
5566
|
+
size: [0.2, Math.abs(pinY - tailY) + 0.1, 0.2],
|
|
5567
|
+
center: [pad.x, (pinY + tailY) / 2, 0.1]
|
|
5568
|
+
}
|
|
5569
|
+
),
|
|
5570
|
+
/* @__PURE__ */ jsx(Cuboid, { size: [0.2, 0.2, 3.45], center: [pad.x, pinY, 1.725] })
|
|
5571
|
+
] }, i);
|
|
5572
|
+
}),
|
|
5573
|
+
mounts.map((pad, i) => /* @__PURE__ */ jsxs(Union, { children: [
|
|
5574
|
+
/* @__PURE__ */ jsx(
|
|
5575
|
+
Cuboid,
|
|
5576
|
+
{
|
|
5577
|
+
size: [0.7, pad.height * 0.75, 0.2],
|
|
5578
|
+
center: [pad.x, pad.y, 0.1]
|
|
5579
|
+
}
|
|
5580
|
+
),
|
|
5581
|
+
/* @__PURE__ */ jsx(
|
|
5582
|
+
Cuboid,
|
|
5583
|
+
{
|
|
5584
|
+
size: [0.2, pad.height * 0.6, 1.35],
|
|
5585
|
+
center: [pad.x, pad.y, 0.675]
|
|
5586
|
+
}
|
|
5587
|
+
)
|
|
5588
|
+
] }, `mount-${i}`))
|
|
5589
|
+
] })
|
|
5590
|
+
] });
|
|
5591
|
+
};
|
|
5592
|
+
|
|
5452
5593
|
// lib/Crystal.tsx
|
|
5453
5594
|
var getTerminalPoints = ([centerX, centerY], width10, length, chamfer, isPinOne) => {
|
|
5454
5595
|
const xDirection = Math.sign(centerX);
|
|
@@ -5923,12 +6064,12 @@ var SmdPinHeader = ({
|
|
|
5923
6064
|
};
|
|
5924
6065
|
|
|
5925
6066
|
// lib/Footprinter3d.tsx
|
|
5926
|
-
import { mm } from "@tscircuit/mm";
|
|
6067
|
+
import { mm as mm2 } from "@tscircuit/mm";
|
|
5927
6068
|
|
|
5928
6069
|
// lib/utils/getPlatedHoleCenters.ts
|
|
5929
|
-
import { fp as
|
|
6070
|
+
import { fp as fp8 } from "@tscircuit/footprinter";
|
|
5930
6071
|
var getPlatedHoleCenters = (footprint) => {
|
|
5931
|
-
const elements =
|
|
6072
|
+
const elements = fp8.string(footprint).circuitJson();
|
|
5932
6073
|
return elements.filter(
|
|
5933
6074
|
(element) => element.type === "pcb_plated_hole" && Number.isFinite(element.x) && Number.isFinite(element.y)
|
|
5934
6075
|
).map((element) => ({
|
|
@@ -5939,9 +6080,9 @@ var getPlatedHoleCenters = (footprint) => {
|
|
|
5939
6080
|
};
|
|
5940
6081
|
|
|
5941
6082
|
// lib/utils/getSmtPadRects.ts
|
|
5942
|
-
import { fp as
|
|
6083
|
+
import { fp as fp9 } from "@tscircuit/footprinter";
|
|
5943
6084
|
var getSmtPadRects = (footprint) => {
|
|
5944
|
-
const elements =
|
|
6085
|
+
const elements = fp9.string(footprint).circuitJson();
|
|
5945
6086
|
return elements.filter(
|
|
5946
6087
|
(element) => element.type === "pcb_smtpad" && element.shape === "rect" && Number.isFinite(element.x) && Number.isFinite(element.y)
|
|
5947
6088
|
).map((element) => ({
|
|
@@ -6657,6 +6798,84 @@ var SmdPushButton = ({
|
|
|
6657
6798
|
] });
|
|
6658
6799
|
};
|
|
6659
6800
|
|
|
6801
|
+
// lib/SmdSlideSwitch.tsx
|
|
6802
|
+
import { fp as fp10 } from "@tscircuit/footprinter";
|
|
6803
|
+
var SmdSlideSwitch = ({
|
|
6804
|
+
footprint = "smdslideswitch7",
|
|
6805
|
+
position = 0
|
|
6806
|
+
}) => {
|
|
6807
|
+
const canonical = footprint.replace(/_pin1location\([^)]*\)/g, "");
|
|
6808
|
+
const params = fp10.string(canonical).json();
|
|
6809
|
+
const elements = fp10.string(canonical).circuitJson();
|
|
6810
|
+
const pads = elements.filter(
|
|
6811
|
+
(e) => e.type === "pcb_smtpad" && e.shape === "rect"
|
|
6812
|
+
);
|
|
6813
|
+
const target = fp10.string(footprint).circuitJson().filter(
|
|
6814
|
+
(e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
|
|
6815
|
+
);
|
|
6816
|
+
if (pads.length < 7 || !Number.isFinite(params.mpx) || params.mpx < 3)
|
|
6817
|
+
throw new Error("SmdSlideSwitch needs signal pads and four mounting pads");
|
|
6818
|
+
const angle = Math.atan2(target[1].y - target[0].y, target[1].x - target[0].x) - Math.atan2(pads[1].y - pads[0].y, pads[1].x - pads[0].x);
|
|
6819
|
+
const width10 = params.mpx - 0.5, depth = 2.7, height10 = params.mpx > 6 ? 1.5 : 1.4, y = params.mounty;
|
|
6820
|
+
return /* @__PURE__ */ jsxs(Rotate, { rotation: [0, 0, angle], children: [
|
|
6821
|
+
/* @__PURE__ */ jsx(Colorize, { color: "#aeb4ba", children: /* @__PURE__ */ jsxs(Subtract, { children: [
|
|
6822
|
+
/* @__PURE__ */ jsx(Cuboid, { size: [width10, depth, height10], center: [0, y, height10 / 2] }),
|
|
6823
|
+
/* @__PURE__ */ jsx(
|
|
6824
|
+
Cuboid,
|
|
6825
|
+
{
|
|
6826
|
+
size: [width10 - 0.3, depth - 0.3, height10],
|
|
6827
|
+
center: [0, y, height10 / 2 - 0.15]
|
|
6828
|
+
}
|
|
6829
|
+
),
|
|
6830
|
+
/* @__PURE__ */ jsx(Cuboid, { size: [2.7, 0.5, 0.9], center: [0, y - depth / 2, 0.65] })
|
|
6831
|
+
] }) }),
|
|
6832
|
+
/* @__PURE__ */ jsxs(Colorize, { color: "#28292c", children: [
|
|
6833
|
+
/* @__PURE__ */ jsx(
|
|
6834
|
+
Cuboid,
|
|
6835
|
+
{
|
|
6836
|
+
size: [width10 - 0.32, depth - 0.32, 0.35],
|
|
6837
|
+
center: [0, y, 0.175]
|
|
6838
|
+
}
|
|
6839
|
+
),
|
|
6840
|
+
/* @__PURE__ */ jsx(
|
|
6841
|
+
Cuboid,
|
|
6842
|
+
{
|
|
6843
|
+
size: [1, 2.25, 0.65],
|
|
6844
|
+
center: [position === 0 ? -0.5 : 0.5, y - 1.5, 0.65]
|
|
6845
|
+
}
|
|
6846
|
+
),
|
|
6847
|
+
elements.filter((e) => e.type === "pcb_hole").map(
|
|
6848
|
+
(hole, i) => "hole_diameter" in hole && "x" in hole ? /* @__PURE__ */ jsx(
|
|
6849
|
+
Cylinder,
|
|
6850
|
+
{
|
|
6851
|
+
radius: hole.hole_diameter * 0.42,
|
|
6852
|
+
height: 0.6,
|
|
6853
|
+
center: [hole.x, hole.y, -0.2]
|
|
6854
|
+
},
|
|
6855
|
+
i
|
|
6856
|
+
) : null
|
|
6857
|
+
)
|
|
6858
|
+
] }),
|
|
6859
|
+
/* @__PURE__ */ jsx(Colorize, { color: "#c6c7c9", children: pads.map((pad, i) => {
|
|
6860
|
+
const signal = i < pads.length - 4;
|
|
6861
|
+
const outerY = pad.y + pad.height * 0.4;
|
|
6862
|
+
const innerY = Math.min(pad.y - pad.height * 0.4, y + depth / 2 - 0.2);
|
|
6863
|
+
return /* @__PURE__ */ jsx(
|
|
6864
|
+
Cuboid,
|
|
6865
|
+
{
|
|
6866
|
+
size: [
|
|
6867
|
+
pad.width * 0.8,
|
|
6868
|
+
signal ? outerY - innerY : pad.height * 0.8,
|
|
6869
|
+
0.18
|
|
6870
|
+
],
|
|
6871
|
+
center: [pad.x, signal ? (outerY + innerY) / 2 : pad.y, 0.09]
|
|
6872
|
+
},
|
|
6873
|
+
i
|
|
6874
|
+
);
|
|
6875
|
+
}) })
|
|
6876
|
+
] });
|
|
6877
|
+
};
|
|
6878
|
+
|
|
6660
6879
|
// lib/SOT-563.tsx
|
|
6661
6880
|
var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength10 = 1.6 }) => {
|
|
6662
6881
|
const bodyWidth = 1.2;
|
|
@@ -6697,7 +6916,7 @@ var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength10 = 1.6 }) => {
|
|
|
6697
6916
|
};
|
|
6698
6917
|
|
|
6699
6918
|
// lib/BGA.tsx
|
|
6700
|
-
import { fp as
|
|
6919
|
+
import { fp as fp11 } from "@tscircuit/footprinter";
|
|
6701
6920
|
var BGA = ({
|
|
6702
6921
|
packageWidth = 10,
|
|
6703
6922
|
packageLength = 10,
|
|
@@ -6713,7 +6932,7 @@ var BGA = ({
|
|
|
6713
6932
|
const bodyHeight = packageHeight - standoffHeight;
|
|
6714
6933
|
const bodyOffset = standoffHeight + bodyHeight / 2;
|
|
6715
6934
|
const ballOffset = Math.max(standoffHeight / 2, ballDiameter / 2);
|
|
6716
|
-
const ballsSoup = footprintString ?
|
|
6935
|
+
const ballsSoup = footprintString ? fp11.string(footprintString).circuitJson() : null;
|
|
6717
6936
|
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
6718
6937
|
/* @__PURE__ */ jsx(Translate, { z: bodyOffset, children: /* @__PURE__ */ jsx(Colorize, { color: "#555", children: /* @__PURE__ */ jsx(Cuboid, { size: [packageWidth, packageLength, bodyHeight] }) }) }),
|
|
6719
6938
|
!footprintString && Array.from({ length: ballRows * ballColumns }).map((_, index) => {
|
|
@@ -6743,7 +6962,7 @@ var BGA = ({
|
|
|
6743
6962
|
};
|
|
6744
6963
|
|
|
6745
6964
|
// lib/UsbCMidmount.tsx
|
|
6746
|
-
import { fp as
|
|
6965
|
+
import { fp as fp12 } from "@tscircuit/footprinter";
|
|
6747
6966
|
var Capsule = ({
|
|
6748
6967
|
width: width10,
|
|
6749
6968
|
height: height10,
|
|
@@ -6753,14 +6972,14 @@ var UsbCMidmount = ({
|
|
|
6753
6972
|
footprint = "usbcmidmount16"
|
|
6754
6973
|
}) => {
|
|
6755
6974
|
const canonical = footprint.replace(/_pin1location\([^)]*\)/g, "");
|
|
6756
|
-
const params =
|
|
6757
|
-
const elements =
|
|
6975
|
+
const params = fp12.string(canonical).json();
|
|
6976
|
+
const elements = fp12.string(canonical).circuitJson();
|
|
6758
6977
|
const pads = elements.filter(
|
|
6759
6978
|
(e) => e.type === "pcb_smtpad" && e.shape === "rect"
|
|
6760
6979
|
);
|
|
6761
6980
|
const slots = elements.filter((e) => e.type === "pcb_plated_hole");
|
|
6762
6981
|
const holes = elements.filter((e) => e.type === "pcb_hole");
|
|
6763
|
-
const target =
|
|
6982
|
+
const target = fp12.string(footprint).circuitJson().find((e) => e.type === "pcb_plated_hole");
|
|
6764
6983
|
const first = slots[0];
|
|
6765
6984
|
const angle = first && target && "x" in target ? Math.atan2(target.y, target.x) - Math.atan2(first.y, first.x) : 0;
|
|
6766
6985
|
const width10 = 8.94, height10 = 3.2, wall = 0.22;
|
|
@@ -6844,15 +7063,15 @@ var UsbCMidmount = ({
|
|
|
6844
7063
|
};
|
|
6845
7064
|
|
|
6846
7065
|
// lib/SOT143.tsx
|
|
6847
|
-
import { fp as
|
|
6848
|
-
var getPads = (footprint) =>
|
|
7066
|
+
import { fp as fp13 } from "@tscircuit/footprinter";
|
|
7067
|
+
var getPads = (footprint) => fp13.string(footprint).circuitJson().filter(
|
|
6849
7068
|
(element) => element.type === "pcb_smtpad" && (element.shape === "rect" || element.shape === "rotated_rect")
|
|
6850
7069
|
).map((pad) => ({ x: pad.x, y: pad.y, pin: pad.port_hints?.[0] }));
|
|
6851
7070
|
var SOT143 = ({ footprint = "sot143" }) => {
|
|
6852
7071
|
const pads = getPads(footprint);
|
|
6853
7072
|
if (pads.length !== 4) throw new Error("SOT143 requires four signal pads");
|
|
6854
7073
|
const canonical = getPads("sot143");
|
|
6855
|
-
const options =
|
|
7074
|
+
const options = fp13.string(footprint).json();
|
|
6856
7075
|
const origin = canonical[1];
|
|
6857
7076
|
const target = pads.find((pad) => pad.pin === "2");
|
|
6858
7077
|
const angle = options.pin1location ? Math.round(
|
|
@@ -7439,6 +7658,8 @@ var FlexScreen = (props) => {
|
|
|
7439
7658
|
|
|
7440
7659
|
// lib/Footprinter3d.tsx
|
|
7441
7660
|
var Footprinter3d = ({ footprint }) => {
|
|
7661
|
+
if (/(?:^|_)antennaRFANT5220110A0T(?:_|$)/.test(footprint))
|
|
7662
|
+
return /* @__PURE__ */ jsx(CeramicChipAntenna, { footprint });
|
|
7442
7663
|
const melfResistor = footprint.match(
|
|
7443
7664
|
/(?:^|_)melfresistor(0102|0204|0207)(?:_|$)/
|
|
7444
7665
|
);
|
|
@@ -7494,12 +7715,12 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
7494
7715
|
const numPins = pinMatch && pinMatch[1] ? pinMatch[1] : "2";
|
|
7495
7716
|
normalizedFootprint = `jst${numPins}_xh`;
|
|
7496
7717
|
}
|
|
7497
|
-
const fpJson =
|
|
7718
|
+
const fpJson = fp14.string(normalizedFootprint).json();
|
|
7498
7719
|
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
7499
7720
|
const color = colorMatch ? colorMatch[1] : void 0;
|
|
7500
7721
|
const dim = (value, fallback) => {
|
|
7501
7722
|
if (value === void 0 || value === null) return fallback;
|
|
7502
|
-
const parsed =
|
|
7723
|
+
const parsed = mm2(value);
|
|
7503
7724
|
return Number.isFinite(parsed) ? parsed : fallback;
|
|
7504
7725
|
};
|
|
7505
7726
|
switch (fpJson.fn) {
|
|
@@ -7704,6 +7925,8 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
7704
7925
|
}
|
|
7705
7926
|
case "sot457":
|
|
7706
7927
|
return /* @__PURE__ */ jsx(SOT457, {});
|
|
7928
|
+
case "smdslideswitch":
|
|
7929
|
+
return /* @__PURE__ */ jsx(SmdSlideSwitch, { footprint: normalizedFootprint });
|
|
7707
7930
|
case "usbcmidmount":
|
|
7708
7931
|
return /* @__PURE__ */ jsx(UsbCMidmount, { footprint: normalizedFootprint });
|
|
7709
7932
|
case "sot143":
|
|
@@ -7734,6 +7957,9 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
7734
7957
|
}
|
|
7735
7958
|
);
|
|
7736
7959
|
case "jst":
|
|
7960
|
+
if (isJstShFootprint(normalizedFootprint)) {
|
|
7961
|
+
return /* @__PURE__ */ jsx(JstSh, { footprint: normalizedFootprint });
|
|
7962
|
+
}
|
|
7737
7963
|
if (fpJson.zh) {
|
|
7738
7964
|
return /* @__PURE__ */ jsx(JSTZH1_5mm, { numPins: fpJson.num_pins });
|
|
7739
7965
|
}
|
|
@@ -8110,8 +8336,8 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
8110
8336
|
return /* @__PURE__ */ jsx(A2512, { color });
|
|
8111
8337
|
}
|
|
8112
8338
|
if ((fpJson.fn === "res" || fpJson.fn === "cap") && fpJson.p !== void 0 && fpJson.ph !== void 0) {
|
|
8113
|
-
const padPitch =
|
|
8114
|
-
const padHeight =
|
|
8339
|
+
const padPitch = mm2(fpJson.p);
|
|
8340
|
+
const padHeight = mm2(fpJson.ph);
|
|
8115
8341
|
if (Number.isFinite(padPitch) && Number.isFinite(padHeight)) {
|
|
8116
8342
|
return /* @__PURE__ */ jsx(
|
|
8117
8343
|
ParametricChip,
|