jscad-electronics 0.0.165 → 0.0.167
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 +13 -1
- package/dist/index.js +1435 -1357
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +139 -242
- package/dist/vanilla.js.map +1 -1
- package/package.json +1 -1
package/dist/vanilla.js
CHANGED
|
@@ -193,189 +193,8 @@ var ExtrudedPads = ({
|
|
|
193
193
|
] });
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
// lib/CeramicChipAntenna.tsx
|
|
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";
|
|
238
|
-
var melfResistorSizes = {
|
|
239
|
-
"0102": [2.2, 1.1, 0.4],
|
|
240
|
-
"0204": [3.6, 1.4, 0.75],
|
|
241
|
-
"0207": [5.8, 2.2, 1.15]
|
|
242
|
-
};
|
|
243
|
-
var MelfResistor = ({
|
|
244
|
-
size = "0204",
|
|
245
|
-
footprint = "smdpads2_p2.8mm_pw1.2mm_ph1.6mm"
|
|
246
|
-
}) => {
|
|
247
|
-
const dims = melfResistorSizes[size];
|
|
248
|
-
if (!dims) throw new Error("Unsupported MELF resistor size");
|
|
249
|
-
const [length, diameter, capLength] = dims;
|
|
250
|
-
const pads = fp3.string(footprint).circuitJson().filter(
|
|
251
|
-
(e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
|
|
252
|
-
);
|
|
253
|
-
if (pads.length !== 2) throw new Error("MelfResistor requires two pads");
|
|
254
|
-
const [a, b] = pads;
|
|
255
|
-
const angle = Math.atan2(b.y - a.y, b.x - a.x);
|
|
256
|
-
return /* @__PURE__ */ jsx(Translate, { offset: [(a.x + b.x) / 2, (a.y + b.y) / 2, diameter / 2], children: /* @__PURE__ */ jsx(Rotate, { rotation: [0, 0, angle], children: /* @__PURE__ */ jsxs(Rotate, { rotation: [0, Math.PI / 2, 0], children: [
|
|
257
|
-
/* @__PURE__ */ jsx(Colorize, { color: "#426d63", children: /* @__PURE__ */ jsx(
|
|
258
|
-
Cylinder,
|
|
259
|
-
{
|
|
260
|
-
radius: (diameter - 0.08) / 2,
|
|
261
|
-
height: length - 2 * capLength + 0.04
|
|
262
|
-
}
|
|
263
|
-
) }),
|
|
264
|
-
/* @__PURE__ */ jsx(Colorize, { color: "#c6c8cb", children: [-1, 1].map((side) => /* @__PURE__ */ jsx(
|
|
265
|
-
Cylinder,
|
|
266
|
-
{
|
|
267
|
-
radius: diameter / 2,
|
|
268
|
-
height: capLength,
|
|
269
|
-
center: [0, 0, side * (length - capLength) / 2]
|
|
270
|
-
},
|
|
271
|
-
side
|
|
272
|
-
)) })
|
|
273
|
-
] }) }) });
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
// lib/TwoPadCrystal.tsx
|
|
277
|
-
import { fp as fp4 } from "@tscircuit/footprinter";
|
|
278
|
-
var twoPadCrystalPackages = {
|
|
279
|
-
FC135: [3.2, 1.5, 0.9, 0.7],
|
|
280
|
-
FC12M: [2.05, 1.2, 0.6, 0.5],
|
|
281
|
-
FC1610AN: [1.65, 1.05, 0.5, 0.4],
|
|
282
|
-
NX3225GD: [3.2, 2.5, 0.8, 1.2]
|
|
283
|
-
};
|
|
284
|
-
var TwoPadCrystal = ({
|
|
285
|
-
packageName = "FC135",
|
|
286
|
-
footprint = "smdpads2_p2.5mm_pw1mm_ph1.8mm"
|
|
287
|
-
}) => {
|
|
288
|
-
const dims = twoPadCrystalPackages[packageName];
|
|
289
|
-
if (!dims) throw new Error("Unsupported two-pad crystal package");
|
|
290
|
-
const [length, width10, height10, terminalLength] = dims;
|
|
291
|
-
const pads = fp4.string(footprint).circuitJson().filter(
|
|
292
|
-
(e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
|
|
293
|
-
);
|
|
294
|
-
if (pads.length !== 2) throw new Error("TwoPadCrystal requires two pads");
|
|
295
|
-
const [a, b] = pads;
|
|
296
|
-
const angle = Math.atan2(b.y - a.y, b.x - a.x);
|
|
297
|
-
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: [
|
|
298
|
-
/* @__PURE__ */ jsx(Colorize, { color: "#e0dcca", children: /* @__PURE__ */ jsx(Cuboid, { size: [length, width10, 0.2], center: [0, 0, 0.13] }) }),
|
|
299
|
-
/* @__PURE__ */ jsx(Colorize, { color: "#acb1b8", children: /* @__PURE__ */ jsx(
|
|
300
|
-
RoundedCuboid,
|
|
301
|
-
{
|
|
302
|
-
size: [length - 0.04, width10 - 0.04, height10 - 0.18],
|
|
303
|
-
roundRadius: 0.035,
|
|
304
|
-
center: [0, 0, (height10 + 0.18) / 2]
|
|
305
|
-
}
|
|
306
|
-
) }),
|
|
307
|
-
/* @__PURE__ */ jsx(Colorize, { color: "#c6af65", children: [-1, 1].map((side) => /* @__PURE__ */ jsx(
|
|
308
|
-
Cuboid,
|
|
309
|
-
{
|
|
310
|
-
size: [terminalLength, width10 - 0.12, 0.06],
|
|
311
|
-
center: [side * (length - terminalLength) / 2, 0, 0.03]
|
|
312
|
-
},
|
|
313
|
-
side
|
|
314
|
-
)) })
|
|
315
|
-
] }) });
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
// lib/TantalumCapacitor.tsx
|
|
319
|
-
import { fp as fp5 } from "@tscircuit/footprinter";
|
|
320
|
-
var tantalumCases = {
|
|
321
|
-
A: [3.2, 1.6, 1.6, 1.2, 0.8],
|
|
322
|
-
B: [3.5, 2.8, 1.9, 2.2, 0.8],
|
|
323
|
-
C: [6, 3.2, 2.6, 2.2, 1.3],
|
|
324
|
-
D: [7.3, 4.3, 2.9, 2.4, 1.3]
|
|
325
|
-
};
|
|
326
|
-
var TantalumCapacitor = ({
|
|
327
|
-
caseSize = "A",
|
|
328
|
-
footprint = "smdpads2_p3.1mm_pw1.4mm_ph1.6mm"
|
|
329
|
-
}) => {
|
|
330
|
-
const dims = tantalumCases[caseSize];
|
|
331
|
-
if (!dims) throw new Error("Unsupported tantalum case");
|
|
332
|
-
const [length, width10, height10, leadWidth, leadLength] = dims;
|
|
333
|
-
const pads = fp5.string(footprint).circuitJson().filter(
|
|
334
|
-
(e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
|
|
335
|
-
);
|
|
336
|
-
if (pads.length !== 2) throw new Error("TantalumCapacitor requires two pads");
|
|
337
|
-
const [a, b] = pads;
|
|
338
|
-
const angle = Math.atan2(b.y - a.y, b.x - a.x);
|
|
339
|
-
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: [
|
|
340
|
-
/* @__PURE__ */ jsx(Colorize, { color: "#d5a64e", children: /* @__PURE__ */ jsxs(Hull, { children: [
|
|
341
|
-
/* @__PURE__ */ jsx(Cuboid, { size: [length - 0.1, width10, 0.02], center: [0, 0, 0.21] }),
|
|
342
|
-
/* @__PURE__ */ jsx(
|
|
343
|
-
Cuboid,
|
|
344
|
-
{
|
|
345
|
-
size: [length - 0.25, width10 - 0.15, 0.02],
|
|
346
|
-
center: [0, 0, height10 - 0.01]
|
|
347
|
-
}
|
|
348
|
-
)
|
|
349
|
-
] }) }),
|
|
350
|
-
/* @__PURE__ */ jsx(Colorize, { color: "#c5c8cb", children: [-1, 1].map((side) => /* @__PURE__ */ jsxs(Union, { children: [
|
|
351
|
-
/* @__PURE__ */ jsx(
|
|
352
|
-
Cuboid,
|
|
353
|
-
{
|
|
354
|
-
size: [leadLength, leadWidth, 0.25],
|
|
355
|
-
center: [side * (length - leadLength) / 2, 0, 0.125]
|
|
356
|
-
}
|
|
357
|
-
),
|
|
358
|
-
/* @__PURE__ */ jsx(
|
|
359
|
-
Cuboid,
|
|
360
|
-
{
|
|
361
|
-
size: [0.15, leadWidth, height10 * 0.45],
|
|
362
|
-
center: [side * (length - 0.15) / 2, 0, height10 * 0.225]
|
|
363
|
-
}
|
|
364
|
-
)
|
|
365
|
-
] }, side)) }),
|
|
366
|
-
/* @__PURE__ */ jsx(
|
|
367
|
-
Cuboid,
|
|
368
|
-
{
|
|
369
|
-
size: [0.25, width10 - 0.25, 0.01],
|
|
370
|
-
center: [-length / 2 + 0.5, 0, height10],
|
|
371
|
-
color: "#423426"
|
|
372
|
-
}
|
|
373
|
-
)
|
|
374
|
-
] }) });
|
|
375
|
-
};
|
|
376
|
-
|
|
377
196
|
// lib/Footprinter3d.tsx
|
|
378
|
-
import { fp as
|
|
197
|
+
import { fp as fp10 } from "@tscircuit/footprinter";
|
|
379
198
|
import { mp } from "@tscircuit/modelprinter";
|
|
380
199
|
|
|
381
200
|
// lib/ChipBody.tsx
|
|
@@ -3422,8 +3241,41 @@ var DFN = ({
|
|
|
3422
3241
|
padWidth = bodyLength10 / 5.3 * 0.6,
|
|
3423
3242
|
padLength = bodyLength10 / 5.3 * 1,
|
|
3424
3243
|
pitch = 0.5,
|
|
3425
|
-
thermalPadThickness = 0.2
|
|
3244
|
+
thermalPadThickness = 0.2,
|
|
3245
|
+
bodyStyle = "chamfered",
|
|
3246
|
+
standoff = 0,
|
|
3247
|
+
terminalInset = 0,
|
|
3248
|
+
terminalThickness = thermalPadThickness,
|
|
3249
|
+
pin1TerminalChamfer = 0,
|
|
3250
|
+
pin1MarkWidth = 0
|
|
3426
3251
|
}) => {
|
|
3252
|
+
if (bodyStyle === "rectangular") {
|
|
3253
|
+
if (!Number.isInteger(num_pins) || num_pins < 2 || num_pins % 2 !== 0)
|
|
3254
|
+
throw new Error("DFN requires an even pin count of at least two");
|
|
3255
|
+
for (const value of [
|
|
3256
|
+
bodyWidth,
|
|
3257
|
+
bodyLength10,
|
|
3258
|
+
bodyThickness,
|
|
3259
|
+
padWidth,
|
|
3260
|
+
padLength,
|
|
3261
|
+
pitch,
|
|
3262
|
+
terminalThickness
|
|
3263
|
+
])
|
|
3264
|
+
if (!Number.isFinite(value) || value <= 0)
|
|
3265
|
+
throw new Error("DFN dimensions must be finite and positive");
|
|
3266
|
+
for (const value of [
|
|
3267
|
+
standoff,
|
|
3268
|
+
terminalInset,
|
|
3269
|
+
pin1TerminalChamfer,
|
|
3270
|
+
pin1MarkWidth
|
|
3271
|
+
])
|
|
3272
|
+
if (!Number.isFinite(value) || value < 0)
|
|
3273
|
+
throw new Error("DFN offsets must be finite and nonnegative");
|
|
3274
|
+
if (terminalThickness <= standoff || terminalThickness > standoff + bodyThickness || terminalInset + padLength >= bodyWidth / 2 || (num_pins / 2 - 1) * pitch + padWidth > bodyLength10 || num_pins > 2 && padWidth >= pitch || pin1TerminalChamfer >= Math.min(padLength, padWidth / 2) || pin1MarkWidth >= bodyWidth / 4)
|
|
3275
|
+
throw new Error(
|
|
3276
|
+
"DFN dimensions leave disconnected or overlapping terminals"
|
|
3277
|
+
);
|
|
3278
|
+
}
|
|
3427
3279
|
const pinPositions = [];
|
|
3428
3280
|
const pinsPerSide = Math.floor(num_pins / 2);
|
|
3429
3281
|
const pinSpan = pitch * (pinsPerSide - 1);
|
|
@@ -3433,10 +3285,88 @@ var DFN = ({
|
|
|
3433
3285
|
const y = pinSpan / 2 - indexOnSide * pitch;
|
|
3434
3286
|
const padSizeX = padLength;
|
|
3435
3287
|
const padSizeY = padWidth;
|
|
3436
|
-
const x = side === "left" ? -bodyWidth / 2 + padSizeX / 2 : bodyWidth / 2 - padSizeX / 2;
|
|
3288
|
+
const x = side === "left" ? -bodyWidth / 2 + padSizeX / 2 + terminalInset : bodyWidth / 2 - padSizeX / 2 - terminalInset;
|
|
3437
3289
|
const pinNumber = i + 1;
|
|
3438
3290
|
pinPositions.push({ pinNumber, x, y, padSizeX, padSizeY });
|
|
3439
3291
|
}
|
|
3292
|
+
if (bodyStyle === "rectangular") {
|
|
3293
|
+
const top = standoff + bodyThickness;
|
|
3294
|
+
const inkThickness = Math.min(bodyThickness, bodyLength10) / 100;
|
|
3295
|
+
const stripe = /* @__PURE__ */ jsx(
|
|
3296
|
+
Cuboid,
|
|
3297
|
+
{
|
|
3298
|
+
size: [pin1MarkWidth, bodyLength10 * 0.8, inkThickness],
|
|
3299
|
+
center: [
|
|
3300
|
+
-bodyWidth / 2 + pin1MarkWidth * 1.5,
|
|
3301
|
+
0,
|
|
3302
|
+
top - inkThickness / 2
|
|
3303
|
+
]
|
|
3304
|
+
}
|
|
3305
|
+
);
|
|
3306
|
+
const body = /* @__PURE__ */ jsx(
|
|
3307
|
+
Cuboid,
|
|
3308
|
+
{
|
|
3309
|
+
size: [bodyWidth, bodyLength10, bodyThickness],
|
|
3310
|
+
center: [0, 0, standoff + bodyThickness / 2]
|
|
3311
|
+
}
|
|
3312
|
+
);
|
|
3313
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
3314
|
+
/* @__PURE__ */ jsx(Colorize, { color: "#25272a", children: pin1MarkWidth > 0 ? /* @__PURE__ */ jsxs(Subtract, { children: [
|
|
3315
|
+
body,
|
|
3316
|
+
stripe
|
|
3317
|
+
] }) : body }),
|
|
3318
|
+
/* @__PURE__ */ jsx(Colorize, { color: "#c7c9cd", children: pinPositions.map(
|
|
3319
|
+
(p) => p.pinNumber === 1 && pin1TerminalChamfer > 0 ? /* @__PURE__ */ jsxs(Hull, { children: [
|
|
3320
|
+
/* @__PURE__ */ jsx(
|
|
3321
|
+
Cuboid,
|
|
3322
|
+
{
|
|
3323
|
+
size: [
|
|
3324
|
+
padLength - pin1TerminalChamfer,
|
|
3325
|
+
padWidth,
|
|
3326
|
+
terminalThickness
|
|
3327
|
+
],
|
|
3328
|
+
center: [
|
|
3329
|
+
p.x + pin1TerminalChamfer / 2,
|
|
3330
|
+
p.y,
|
|
3331
|
+
terminalThickness / 2
|
|
3332
|
+
]
|
|
3333
|
+
}
|
|
3334
|
+
),
|
|
3335
|
+
/* @__PURE__ */ jsx(
|
|
3336
|
+
Cuboid,
|
|
3337
|
+
{
|
|
3338
|
+
size: [
|
|
3339
|
+
padLength,
|
|
3340
|
+
padWidth - 2 * pin1TerminalChamfer,
|
|
3341
|
+
terminalThickness
|
|
3342
|
+
],
|
|
3343
|
+
center: [p.x, p.y, terminalThickness / 2]
|
|
3344
|
+
}
|
|
3345
|
+
)
|
|
3346
|
+
] }, p.pinNumber) : /* @__PURE__ */ jsx(
|
|
3347
|
+
Cuboid,
|
|
3348
|
+
{
|
|
3349
|
+
size: [p.padSizeX, p.padSizeY, terminalThickness],
|
|
3350
|
+
center: [p.x, p.y, terminalThickness / 2]
|
|
3351
|
+
},
|
|
3352
|
+
p.pinNumber
|
|
3353
|
+
)
|
|
3354
|
+
) }),
|
|
3355
|
+
thermalPadSize && /* @__PURE__ */ jsx(
|
|
3356
|
+
Cuboid,
|
|
3357
|
+
{
|
|
3358
|
+
color: "#c7c9cd",
|
|
3359
|
+
size: [
|
|
3360
|
+
thermalPadSize.width,
|
|
3361
|
+
thermalPadSize.length,
|
|
3362
|
+
thermalPadThickness
|
|
3363
|
+
],
|
|
3364
|
+
center: [0, 0, thermalPadThickness / 2]
|
|
3365
|
+
}
|
|
3366
|
+
),
|
|
3367
|
+
pin1MarkWidth > 0 && /* @__PURE__ */ jsx(Colorize, { color: "#969997", children: stripe })
|
|
3368
|
+
] });
|
|
3369
|
+
}
|
|
3440
3370
|
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
3441
3371
|
/* @__PURE__ */ jsx(
|
|
3442
3372
|
ChipBody,
|
|
@@ -5361,7 +5291,7 @@ var JSTPH2_0mm = ({
|
|
|
5361
5291
|
};
|
|
5362
5292
|
|
|
5363
5293
|
// lib/JSTXH2_5mm.tsx
|
|
5364
|
-
import { fp as
|
|
5294
|
+
import { fp as fp2 } from "@tscircuit/footprinter";
|
|
5365
5295
|
var JSTXH2_5mm = ({
|
|
5366
5296
|
numPins = 4,
|
|
5367
5297
|
showPins = true,
|
|
@@ -5470,7 +5400,7 @@ var JSTXH2_5mm = ({
|
|
|
5470
5400
|
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)),
|
|
5471
5401
|
showFootprint && (() => {
|
|
5472
5402
|
try {
|
|
5473
|
-
const circuitJson =
|
|
5403
|
+
const circuitJson = fp2.string(`jst${numPins}_xh`).circuitJson();
|
|
5474
5404
|
const platedHoles = circuitJson.filter(
|
|
5475
5405
|
(e) => e.type === "pcb_plated_hole"
|
|
5476
5406
|
);
|
|
@@ -5490,10 +5420,10 @@ var JSTXH2_5mm = ({
|
|
|
5490
5420
|
};
|
|
5491
5421
|
|
|
5492
5422
|
// lib/JstSh.tsx
|
|
5493
|
-
import { fp as
|
|
5423
|
+
import { fp as fp3 } from "@tscircuit/footprinter";
|
|
5494
5424
|
import { mm } from "@tscircuit/mm";
|
|
5495
5425
|
function isJstShFootprint(footprint) {
|
|
5496
|
-
const p =
|
|
5426
|
+
const p = fp3.string(footprint).json();
|
|
5497
5427
|
if (p.fn !== "jst") return false;
|
|
5498
5428
|
return Boolean(
|
|
5499
5429
|
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
|
|
@@ -5505,9 +5435,9 @@ var JstSh = ({ footprint = "jst6_sh" }) => {
|
|
|
5505
5435
|
"JstSh requires a named SH or matching 1mm SH top-entry footprint"
|
|
5506
5436
|
);
|
|
5507
5437
|
const canonical = footprint.replace(/_pin1location\([^)]*\)/g, "");
|
|
5508
|
-
const params =
|
|
5509
|
-
const pads =
|
|
5510
|
-
const target =
|
|
5438
|
+
const params = fp3.string(canonical).json();
|
|
5439
|
+
const pads = fp3.string(canonical).circuitJson().filter((e) => e.type === "pcb_smtpad" && e.shape === "rect");
|
|
5440
|
+
const target = fp3.string(footprint).circuitJson().filter(
|
|
5511
5441
|
(e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
|
|
5512
5442
|
);
|
|
5513
5443
|
const n = params.num_pins;
|
|
@@ -6067,9 +5997,9 @@ var SmdPinHeader = ({
|
|
|
6067
5997
|
import { mm as mm2 } from "@tscircuit/mm";
|
|
6068
5998
|
|
|
6069
5999
|
// lib/utils/getPlatedHoleCenters.ts
|
|
6070
|
-
import { fp as
|
|
6000
|
+
import { fp as fp4 } from "@tscircuit/footprinter";
|
|
6071
6001
|
var getPlatedHoleCenters = (footprint) => {
|
|
6072
|
-
const elements =
|
|
6002
|
+
const elements = fp4.string(footprint).circuitJson();
|
|
6073
6003
|
return elements.filter(
|
|
6074
6004
|
(element) => element.type === "pcb_plated_hole" && Number.isFinite(element.x) && Number.isFinite(element.y)
|
|
6075
6005
|
).map((element) => ({
|
|
@@ -6080,9 +6010,9 @@ var getPlatedHoleCenters = (footprint) => {
|
|
|
6080
6010
|
};
|
|
6081
6011
|
|
|
6082
6012
|
// lib/utils/getSmtPadRects.ts
|
|
6083
|
-
import { fp as
|
|
6013
|
+
import { fp as fp5 } from "@tscircuit/footprinter";
|
|
6084
6014
|
var getSmtPadRects = (footprint) => {
|
|
6085
|
-
const elements =
|
|
6015
|
+
const elements = fp5.string(footprint).circuitJson();
|
|
6086
6016
|
return elements.filter(
|
|
6087
6017
|
(element) => element.type === "pcb_smtpad" && element.shape === "rect" && Number.isFinite(element.x) && Number.isFinite(element.y)
|
|
6088
6018
|
).map((element) => ({
|
|
@@ -6799,18 +6729,18 @@ var SmdPushButton = ({
|
|
|
6799
6729
|
};
|
|
6800
6730
|
|
|
6801
6731
|
// lib/SmdSlideSwitch.tsx
|
|
6802
|
-
import { fp as
|
|
6732
|
+
import { fp as fp6 } from "@tscircuit/footprinter";
|
|
6803
6733
|
var SmdSlideSwitch = ({
|
|
6804
6734
|
footprint = "smdslideswitch7",
|
|
6805
6735
|
position = 0
|
|
6806
6736
|
}) => {
|
|
6807
6737
|
const canonical = footprint.replace(/_pin1location\([^)]*\)/g, "");
|
|
6808
|
-
const params =
|
|
6809
|
-
const elements =
|
|
6738
|
+
const params = fp6.string(canonical).json();
|
|
6739
|
+
const elements = fp6.string(canonical).circuitJson();
|
|
6810
6740
|
const pads = elements.filter(
|
|
6811
6741
|
(e) => e.type === "pcb_smtpad" && e.shape === "rect"
|
|
6812
6742
|
);
|
|
6813
|
-
const target =
|
|
6743
|
+
const target = fp6.string(footprint).circuitJson().filter(
|
|
6814
6744
|
(e) => e.type === "pcb_smtpad" && (e.shape === "rect" || e.shape === "rotated_rect")
|
|
6815
6745
|
);
|
|
6816
6746
|
if (pads.length < 7 || !Number.isFinite(params.mpx) || params.mpx < 3)
|
|
@@ -6916,7 +6846,7 @@ var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength10 = 1.6 }) => {
|
|
|
6916
6846
|
};
|
|
6917
6847
|
|
|
6918
6848
|
// lib/BGA.tsx
|
|
6919
|
-
import { fp as
|
|
6849
|
+
import { fp as fp7 } from "@tscircuit/footprinter";
|
|
6920
6850
|
var BGA = ({
|
|
6921
6851
|
packageWidth = 10,
|
|
6922
6852
|
packageLength = 10,
|
|
@@ -6932,7 +6862,7 @@ var BGA = ({
|
|
|
6932
6862
|
const bodyHeight = packageHeight - standoffHeight;
|
|
6933
6863
|
const bodyOffset = standoffHeight + bodyHeight / 2;
|
|
6934
6864
|
const ballOffset = Math.max(standoffHeight / 2, ballDiameter / 2);
|
|
6935
|
-
const ballsSoup = footprintString ?
|
|
6865
|
+
const ballsSoup = footprintString ? fp7.string(footprintString).circuitJson() : null;
|
|
6936
6866
|
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
6937
6867
|
/* @__PURE__ */ jsx(Translate, { z: bodyOffset, children: /* @__PURE__ */ jsx(Colorize, { color: "#555", children: /* @__PURE__ */ jsx(Cuboid, { size: [packageWidth, packageLength, bodyHeight] }) }) }),
|
|
6938
6868
|
!footprintString && Array.from({ length: ballRows * ballColumns }).map((_, index) => {
|
|
@@ -6962,7 +6892,7 @@ var BGA = ({
|
|
|
6962
6892
|
};
|
|
6963
6893
|
|
|
6964
6894
|
// lib/UsbCMidmount.tsx
|
|
6965
|
-
import { fp as
|
|
6895
|
+
import { fp as fp8 } from "@tscircuit/footprinter";
|
|
6966
6896
|
var Capsule = ({
|
|
6967
6897
|
width: width10,
|
|
6968
6898
|
height: height10,
|
|
@@ -6972,14 +6902,14 @@ var UsbCMidmount = ({
|
|
|
6972
6902
|
footprint = "usbcmidmount16"
|
|
6973
6903
|
}) => {
|
|
6974
6904
|
const canonical = footprint.replace(/_pin1location\([^)]*\)/g, "");
|
|
6975
|
-
const params =
|
|
6976
|
-
const elements =
|
|
6905
|
+
const params = fp8.string(canonical).json();
|
|
6906
|
+
const elements = fp8.string(canonical).circuitJson();
|
|
6977
6907
|
const pads = elements.filter(
|
|
6978
6908
|
(e) => e.type === "pcb_smtpad" && e.shape === "rect"
|
|
6979
6909
|
);
|
|
6980
6910
|
const slots = elements.filter((e) => e.type === "pcb_plated_hole");
|
|
6981
6911
|
const holes = elements.filter((e) => e.type === "pcb_hole");
|
|
6982
|
-
const target =
|
|
6912
|
+
const target = fp8.string(footprint).circuitJson().find((e) => e.type === "pcb_plated_hole");
|
|
6983
6913
|
const first = slots[0];
|
|
6984
6914
|
const angle = first && target && "x" in target ? Math.atan2(target.y, target.x) - Math.atan2(first.y, first.x) : 0;
|
|
6985
6915
|
const width10 = 8.94, height10 = 3.2, wall = 0.22;
|
|
@@ -7063,15 +6993,15 @@ var UsbCMidmount = ({
|
|
|
7063
6993
|
};
|
|
7064
6994
|
|
|
7065
6995
|
// lib/SOT143.tsx
|
|
7066
|
-
import { fp as
|
|
7067
|
-
var getPads = (footprint) =>
|
|
6996
|
+
import { fp as fp9 } from "@tscircuit/footprinter";
|
|
6997
|
+
var getPads = (footprint) => fp9.string(footprint).circuitJson().filter(
|
|
7068
6998
|
(element) => element.type === "pcb_smtpad" && (element.shape === "rect" || element.shape === "rotated_rect")
|
|
7069
6999
|
).map((pad) => ({ x: pad.x, y: pad.y, pin: pad.port_hints?.[0] }));
|
|
7070
7000
|
var SOT143 = ({ footprint = "sot143" }) => {
|
|
7071
7001
|
const pads = getPads(footprint);
|
|
7072
7002
|
if (pads.length !== 4) throw new Error("SOT143 requires four signal pads");
|
|
7073
7003
|
const canonical = getPads("sot143");
|
|
7074
|
-
const options =
|
|
7004
|
+
const options = fp9.string(footprint).json();
|
|
7075
7005
|
const origin = canonical[1];
|
|
7076
7006
|
const target = pads.find((pad) => pad.pin === "2");
|
|
7077
7007
|
const angle = options.pin1location ? Math.round(
|
|
@@ -7658,39 +7588,6 @@ var FlexScreen = (props) => {
|
|
|
7658
7588
|
|
|
7659
7589
|
// lib/Footprinter3d.tsx
|
|
7660
7590
|
var Footprinter3d = ({ footprint }) => {
|
|
7661
|
-
if (/(?:^|_)antennaRFANT5220110A0T(?:_|$)/.test(footprint))
|
|
7662
|
-
return /* @__PURE__ */ jsx(CeramicChipAntenna, { footprint });
|
|
7663
|
-
const melfResistor = footprint.match(
|
|
7664
|
-
/(?:^|_)melfresistor(0102|0204|0207)(?:_|$)/
|
|
7665
|
-
);
|
|
7666
|
-
if (melfResistor)
|
|
7667
|
-
return /* @__PURE__ */ jsx(
|
|
7668
|
-
MelfResistor,
|
|
7669
|
-
{
|
|
7670
|
-
footprint,
|
|
7671
|
-
size: melfResistor[1]
|
|
7672
|
-
}
|
|
7673
|
-
);
|
|
7674
|
-
const tantalum = footprint.match(/(?:^|_)tantalum([ABCD])(?:_|$)/);
|
|
7675
|
-
if (tantalum)
|
|
7676
|
-
return /* @__PURE__ */ jsx(
|
|
7677
|
-
TantalumCapacitor,
|
|
7678
|
-
{
|
|
7679
|
-
footprint,
|
|
7680
|
-
caseSize: tantalum[1]
|
|
7681
|
-
}
|
|
7682
|
-
);
|
|
7683
|
-
const crystal2 = footprint.match(
|
|
7684
|
-
/(?:^|_)crystal2(FC135|FC12M|FC1610AN|NX3225GD)(?:_|$)/
|
|
7685
|
-
);
|
|
7686
|
-
if (crystal2)
|
|
7687
|
-
return /* @__PURE__ */ jsx(
|
|
7688
|
-
TwoPadCrystal,
|
|
7689
|
-
{
|
|
7690
|
-
footprint,
|
|
7691
|
-
packageName: crystal2[1]
|
|
7692
|
-
}
|
|
7693
|
-
);
|
|
7694
7591
|
const modelFn = mp.string(footprint.split("_", 1)[0]).params().fn;
|
|
7695
7592
|
if (mp.getModelNames().includes(modelFn)) {
|
|
7696
7593
|
const model = mp.string(footprint).json();
|
|
@@ -7715,7 +7612,7 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
7715
7612
|
const numPins = pinMatch && pinMatch[1] ? pinMatch[1] : "2";
|
|
7716
7613
|
normalizedFootprint = `jst${numPins}_xh`;
|
|
7717
7614
|
}
|
|
7718
|
-
const fpJson =
|
|
7615
|
+
const fpJson = fp10.string(normalizedFootprint).json();
|
|
7719
7616
|
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
7720
7617
|
const color = colorMatch ? colorMatch[1] : void 0;
|
|
7721
7618
|
const dim = (value, fallback) => {
|