jscad-electronics 0.0.171 → 0.0.172
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 +38 -3
- package/dist/index.js +1111 -964
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +247 -110
- package/dist/vanilla.js.map +1 -1
- package/package.json +1 -1
package/dist/vanilla.js
CHANGED
|
@@ -426,115 +426,6 @@ var Dip = ({
|
|
|
426
426
|
] });
|
|
427
427
|
};
|
|
428
428
|
|
|
429
|
-
// lib/SmdChipLead.tsx
|
|
430
|
-
function calculateSCurve(x, {
|
|
431
|
-
height: height10,
|
|
432
|
-
padContactLength,
|
|
433
|
-
curveLength,
|
|
434
|
-
bodyDistance,
|
|
435
|
-
steepness = 10
|
|
436
|
-
}) {
|
|
437
|
-
if (!curveLength) curveLength = bodyDistance * 0.3;
|
|
438
|
-
let flatFromBodySectionLength = bodyDistance - padContactLength - curveLength;
|
|
439
|
-
if (flatFromBodySectionLength < 0) {
|
|
440
|
-
curveLength += flatFromBodySectionLength;
|
|
441
|
-
flatFromBodySectionLength = 0;
|
|
442
|
-
}
|
|
443
|
-
const curveStart = padContactLength * 0.75;
|
|
444
|
-
const curveEnd = padContactLength + curveLength + (bodyDistance - padContactLength - curveLength) * 0.25;
|
|
445
|
-
if (x <= curveStart) return 0;
|
|
446
|
-
if (x >= curveEnd) return height10;
|
|
447
|
-
const t = (x - curveStart) / (curveEnd - curveStart);
|
|
448
|
-
return height10 / (1 + Math.exp(-steepness * (t - 0.5)));
|
|
449
|
-
}
|
|
450
|
-
var SmdChipLead = (props) => {
|
|
451
|
-
const { thickness, width: width10, padContactLength, bodyDistance, height: height10, rotation } = props;
|
|
452
|
-
const N = 15;
|
|
453
|
-
const points = Array.from({ length: N }).map((_, i) => i / (N - 1) * bodyDistance).map((x) => [x, calculateSCurve(x, props)]);
|
|
454
|
-
const polygon = getExpandedStroke(points, thickness);
|
|
455
|
-
return /* @__PURE__ */ jsx(Colorize, { color: "#fff", children: /* @__PURE__ */ jsx(Translate, { offset: { z: 0, y: 0, x: 0, ...props.position }, children: /* @__PURE__ */ jsx(Rotate, { rotation: ["90deg", 0, rotation ?? 0], children: /* @__PURE__ */ jsx(Translate, { offset: { x: 0, y: 0, z: -width10 / 2 }, children: /* @__PURE__ */ jsx(ExtrudeLinear, { height: width10, children: /* @__PURE__ */ jsx(Polygon, { points: polygon.map((p) => [p.x, p.y]) }) }) }) }) }) });
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
// lib/Tssop.tsx
|
|
459
|
-
var Tssop = ({
|
|
460
|
-
pinCount,
|
|
461
|
-
leadLength,
|
|
462
|
-
leadWidth,
|
|
463
|
-
pitch,
|
|
464
|
-
bodyWidth
|
|
465
|
-
}) => {
|
|
466
|
-
const sidePinCount = Math.ceil(pinCount / 2);
|
|
467
|
-
const isSmallTssop = sidePinCount <= 4;
|
|
468
|
-
const pinOffsetToCenter = (sidePinCount - 1) * pitch / 2;
|
|
469
|
-
const bodyLength10 = pitch * Math.max(sidePinCount - 1, 0) + (isSmallTssop ? 1.5 : 1.15);
|
|
470
|
-
const bodyVisualWidth = bodyWidth - (isSmallTssop ? 0.66 : 0.58);
|
|
471
|
-
const leadThickness = 0.15;
|
|
472
|
-
const leadHeight = 0.8;
|
|
473
|
-
const bodyHeight = 1.22;
|
|
474
|
-
const bodyStandoff = 0.24;
|
|
475
|
-
const padContactLength = leadLength * 0.5;
|
|
476
|
-
const leadReach = padContactLength + Math.max(0.22, Math.min(0.4, leadLength * 0.65));
|
|
477
|
-
const leadStartOffset = bodyWidth / 2 + leadLength / 2;
|
|
478
|
-
const curveLength = leadReach * 0.1;
|
|
479
|
-
const notchInset = Math.min(Math.min(bodyVisualWidth, bodyLength10) * 0.18, 1);
|
|
480
|
-
const notchRadius = Math.min(
|
|
481
|
-
Math.min(bodyVisualWidth, bodyLength10) * 0.12,
|
|
482
|
-
0.45
|
|
483
|
-
);
|
|
484
|
-
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
485
|
-
Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx(
|
|
486
|
-
SmdChipLead,
|
|
487
|
-
{
|
|
488
|
-
position: {
|
|
489
|
-
x: -leadStartOffset,
|
|
490
|
-
y: i * pitch - pinOffsetToCenter,
|
|
491
|
-
z: leadThickness / 2
|
|
492
|
-
},
|
|
493
|
-
width: leadWidth,
|
|
494
|
-
thickness: leadThickness,
|
|
495
|
-
padContactLength,
|
|
496
|
-
bodyDistance: leadReach,
|
|
497
|
-
curveLength,
|
|
498
|
-
height: leadHeight
|
|
499
|
-
},
|
|
500
|
-
`left-${i}`
|
|
501
|
-
)),
|
|
502
|
-
Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx(
|
|
503
|
-
SmdChipLead,
|
|
504
|
-
{
|
|
505
|
-
rotation: Math.PI,
|
|
506
|
-
position: {
|
|
507
|
-
x: leadStartOffset,
|
|
508
|
-
y: i * pitch - pinOffsetToCenter,
|
|
509
|
-
z: leadThickness / 2
|
|
510
|
-
},
|
|
511
|
-
width: leadWidth,
|
|
512
|
-
thickness: leadThickness,
|
|
513
|
-
padContactLength,
|
|
514
|
-
bodyDistance: leadReach,
|
|
515
|
-
curveLength,
|
|
516
|
-
height: leadHeight
|
|
517
|
-
},
|
|
518
|
-
`right-${i}`
|
|
519
|
-
)),
|
|
520
|
-
/* @__PURE__ */ jsx(
|
|
521
|
-
ChipBody,
|
|
522
|
-
{
|
|
523
|
-
center: { x: 0, y: 0, z: 0 },
|
|
524
|
-
width: bodyVisualWidth,
|
|
525
|
-
length: bodyLength10,
|
|
526
|
-
height: bodyHeight,
|
|
527
|
-
notchPosition: {
|
|
528
|
-
x: -(bodyVisualWidth / 2 - notchInset - 0.2),
|
|
529
|
-
y: bodyLength10 / 2 - notchInset - 0.2,
|
|
530
|
-
z: bodyHeight
|
|
531
|
-
},
|
|
532
|
-
notchRadius
|
|
533
|
-
}
|
|
534
|
-
)
|
|
535
|
-
] });
|
|
536
|
-
};
|
|
537
|
-
|
|
538
429
|
// lib/utils/DualRowGullWing.tsx
|
|
539
430
|
function createDualRowGullWing(p) {
|
|
540
431
|
const {
|
|
@@ -666,6 +557,116 @@ function createDualRowGullWing(p) {
|
|
|
666
557
|
] });
|
|
667
558
|
}
|
|
668
559
|
|
|
560
|
+
// lib/SmdChipLead.tsx
|
|
561
|
+
function calculateSCurve(x, {
|
|
562
|
+
height: height10,
|
|
563
|
+
padContactLength,
|
|
564
|
+
curveLength,
|
|
565
|
+
bodyDistance,
|
|
566
|
+
steepness = 10
|
|
567
|
+
}) {
|
|
568
|
+
if (!curveLength) curveLength = bodyDistance * 0.3;
|
|
569
|
+
let flatFromBodySectionLength = bodyDistance - padContactLength - curveLength;
|
|
570
|
+
if (flatFromBodySectionLength < 0) {
|
|
571
|
+
curveLength += flatFromBodySectionLength;
|
|
572
|
+
flatFromBodySectionLength = 0;
|
|
573
|
+
}
|
|
574
|
+
const curveStart = padContactLength * 0.75;
|
|
575
|
+
const curveEnd = padContactLength + curveLength + (bodyDistance - padContactLength - curveLength) * 0.25;
|
|
576
|
+
if (x <= curveStart) return 0;
|
|
577
|
+
if (x >= curveEnd) return height10;
|
|
578
|
+
const t = (x - curveStart) / (curveEnd - curveStart);
|
|
579
|
+
return height10 / (1 + Math.exp(-steepness * (t - 0.5)));
|
|
580
|
+
}
|
|
581
|
+
var SmdChipLead = (props) => {
|
|
582
|
+
const { thickness, width: width10, padContactLength, bodyDistance, height: height10, rotation } = props;
|
|
583
|
+
const N = 15;
|
|
584
|
+
const points = Array.from({ length: N }).map((_, i) => i / (N - 1) * bodyDistance).map((x) => [x, calculateSCurve(x, props)]);
|
|
585
|
+
const polygon = getExpandedStroke(points, thickness);
|
|
586
|
+
return /* @__PURE__ */ jsx(Colorize, { color: "#fff", children: /* @__PURE__ */ jsx(Translate, { offset: { z: 0, y: 0, x: 0, ...props.position }, children: /* @__PURE__ */ jsx(Rotate, { rotation: ["90deg", 0, rotation ?? 0], children: /* @__PURE__ */ jsx(Translate, { offset: { x: 0, y: 0, z: -width10 / 2 }, children: /* @__PURE__ */ jsx(ExtrudeLinear, { height: width10, children: /* @__PURE__ */ jsx(Polygon, { points: polygon.map((p) => [p.x, p.y]) }) }) }) }) }) });
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
// lib/Tssop.tsx
|
|
590
|
+
var LegacyTssop = ({
|
|
591
|
+
pinCount,
|
|
592
|
+
leadLength,
|
|
593
|
+
leadWidth,
|
|
594
|
+
pitch,
|
|
595
|
+
bodyWidth
|
|
596
|
+
}) => {
|
|
597
|
+
const sidePinCount = Math.ceil(pinCount / 2);
|
|
598
|
+
const isSmallTssop = sidePinCount <= 4;
|
|
599
|
+
const pinOffsetToCenter = (sidePinCount - 1) * pitch / 2;
|
|
600
|
+
const bodyLength10 = pitch * Math.max(sidePinCount - 1, 0) + (isSmallTssop ? 1.5 : 1.15);
|
|
601
|
+
const bodyVisualWidth = bodyWidth - (isSmallTssop ? 0.66 : 0.58);
|
|
602
|
+
const leadThickness = 0.15;
|
|
603
|
+
const leadHeight = 0.8;
|
|
604
|
+
const bodyHeight = 1.22;
|
|
605
|
+
const bodyStandoff = 0.24;
|
|
606
|
+
const padContactLength = leadLength * 0.5;
|
|
607
|
+
const leadReach = padContactLength + Math.max(0.22, Math.min(0.4, leadLength * 0.65));
|
|
608
|
+
const leadStartOffset = bodyWidth / 2 + leadLength / 2;
|
|
609
|
+
const curveLength = leadReach * 0.1;
|
|
610
|
+
const notchInset = Math.min(Math.min(bodyVisualWidth, bodyLength10) * 0.18, 1);
|
|
611
|
+
const notchRadius = Math.min(
|
|
612
|
+
Math.min(bodyVisualWidth, bodyLength10) * 0.12,
|
|
613
|
+
0.45
|
|
614
|
+
);
|
|
615
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
616
|
+
Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx(
|
|
617
|
+
SmdChipLead,
|
|
618
|
+
{
|
|
619
|
+
position: {
|
|
620
|
+
x: -leadStartOffset,
|
|
621
|
+
y: i * pitch - pinOffsetToCenter,
|
|
622
|
+
z: leadThickness / 2
|
|
623
|
+
},
|
|
624
|
+
width: leadWidth,
|
|
625
|
+
thickness: leadThickness,
|
|
626
|
+
padContactLength,
|
|
627
|
+
bodyDistance: leadReach,
|
|
628
|
+
curveLength,
|
|
629
|
+
height: leadHeight
|
|
630
|
+
},
|
|
631
|
+
`left-${i}`
|
|
632
|
+
)),
|
|
633
|
+
Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx(
|
|
634
|
+
SmdChipLead,
|
|
635
|
+
{
|
|
636
|
+
rotation: Math.PI,
|
|
637
|
+
position: {
|
|
638
|
+
x: leadStartOffset,
|
|
639
|
+
y: i * pitch - pinOffsetToCenter,
|
|
640
|
+
z: leadThickness / 2
|
|
641
|
+
},
|
|
642
|
+
width: leadWidth,
|
|
643
|
+
thickness: leadThickness,
|
|
644
|
+
padContactLength,
|
|
645
|
+
bodyDistance: leadReach,
|
|
646
|
+
curveLength,
|
|
647
|
+
height: leadHeight
|
|
648
|
+
},
|
|
649
|
+
`right-${i}`
|
|
650
|
+
)),
|
|
651
|
+
/* @__PURE__ */ jsx(
|
|
652
|
+
ChipBody,
|
|
653
|
+
{
|
|
654
|
+
center: { x: 0, y: 0, z: 0 },
|
|
655
|
+
width: bodyVisualWidth,
|
|
656
|
+
length: bodyLength10,
|
|
657
|
+
height: bodyHeight,
|
|
658
|
+
notchPosition: {
|
|
659
|
+
x: -(bodyVisualWidth / 2 - notchInset - 0.2),
|
|
660
|
+
y: bodyLength10 / 2 - notchInset - 0.2,
|
|
661
|
+
z: bodyHeight
|
|
662
|
+
},
|
|
663
|
+
notchRadius
|
|
664
|
+
}
|
|
665
|
+
)
|
|
666
|
+
] });
|
|
667
|
+
};
|
|
668
|
+
var Tssop = (props) => "leadSpan" in props ? createDualRowGullWing(props) : LegacyTssop(props);
|
|
669
|
+
|
|
669
670
|
// lib/MSOP.tsx
|
|
670
671
|
var LegacyMSOP = ({
|
|
671
672
|
pinCount,
|
|
@@ -3187,8 +3188,143 @@ var SOT323 = () => {
|
|
|
3187
3188
|
] });
|
|
3188
3189
|
};
|
|
3189
3190
|
|
|
3191
|
+
// lib/utils/PhysicalLqfp.tsx
|
|
3192
|
+
function createPhysicalLqfp(p) {
|
|
3193
|
+
const {
|
|
3194
|
+
pinCount,
|
|
3195
|
+
pitch,
|
|
3196
|
+
bodyWidth,
|
|
3197
|
+
bodyLength: bodyLength10,
|
|
3198
|
+
bodyHeight,
|
|
3199
|
+
standoff,
|
|
3200
|
+
leadSpanX,
|
|
3201
|
+
leadSpanY,
|
|
3202
|
+
leadWidth,
|
|
3203
|
+
leadThickness,
|
|
3204
|
+
contactLength,
|
|
3205
|
+
taperInset
|
|
3206
|
+
} = p;
|
|
3207
|
+
for (const key of [
|
|
3208
|
+
"pitch",
|
|
3209
|
+
"bodyWidth",
|
|
3210
|
+
"bodyLength",
|
|
3211
|
+
"bodyHeight",
|
|
3212
|
+
"leadSpanX",
|
|
3213
|
+
"leadSpanY",
|
|
3214
|
+
"leadWidth",
|
|
3215
|
+
"leadThickness",
|
|
3216
|
+
"contactLength"
|
|
3217
|
+
])
|
|
3218
|
+
if (!Number.isFinite(p[key]) || p[key] <= 0)
|
|
3219
|
+
throw new Error(`${key} must be finite and positive`);
|
|
3220
|
+
for (const [name, value] of Object.entries({
|
|
3221
|
+
standoff,
|
|
3222
|
+
taperInset
|
|
3223
|
+
}))
|
|
3224
|
+
if (!Number.isFinite(value) || value < 0)
|
|
3225
|
+
throw new Error(`${name} must be finite and nonnegative`);
|
|
3226
|
+
if (!Number.isInteger(pinCount) || pinCount < 8 || pinCount % 4)
|
|
3227
|
+
throw new Error("pinCount must be divisible by four and at least eight");
|
|
3228
|
+
const moldHeight = bodyHeight - standoff;
|
|
3229
|
+
const reach = Math.min(leadSpanX - bodyWidth, leadSpanY - bodyLength10) / 2;
|
|
3230
|
+
const rowLength = (pinCount / 4 - 1) * pitch + leadWidth;
|
|
3231
|
+
if (moldHeight <= leadThickness * 2 || leadWidth >= pitch || rowLength >= Math.min(bodyWidth, bodyLength10) - 2 * taperInset || taperInset * 2 >= Math.min(bodyWidth, bodyLength10) || contactLength >= reach)
|
|
3232
|
+
throw new Error("Invalid mold, lead spacing, or terminal reach");
|
|
3233
|
+
const midZ = standoff + moldHeight / 2;
|
|
3234
|
+
const slice = Math.min(2e-3, moldHeight / 100);
|
|
3235
|
+
const body = /* @__PURE__ */ jsxs(Hull, { children: [
|
|
3236
|
+
/* @__PURE__ */ jsx(Translate, { z: standoff + slice / 2, children: /* @__PURE__ */ jsx(
|
|
3237
|
+
Cuboid,
|
|
3238
|
+
{
|
|
3239
|
+
size: [
|
|
3240
|
+
bodyWidth - 2 * taperInset,
|
|
3241
|
+
bodyLength10 - 2 * taperInset,
|
|
3242
|
+
slice
|
|
3243
|
+
]
|
|
3244
|
+
}
|
|
3245
|
+
) }),
|
|
3246
|
+
/* @__PURE__ */ jsx(Translate, { z: midZ, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, slice] }) }),
|
|
3247
|
+
/* @__PURE__ */ jsx(Translate, { z: bodyHeight - slice / 2, children: /* @__PURE__ */ jsx(
|
|
3248
|
+
Cuboid,
|
|
3249
|
+
{
|
|
3250
|
+
size: [
|
|
3251
|
+
bodyWidth - 2 * taperInset,
|
|
3252
|
+
bodyLength10 - 2 * taperInset,
|
|
3253
|
+
slice
|
|
3254
|
+
]
|
|
3255
|
+
}
|
|
3256
|
+
) })
|
|
3257
|
+
] });
|
|
3258
|
+
const dimpleRadius = Math.min(bodyWidth, bodyLength10) * 0.045;
|
|
3259
|
+
const dimpleDepth = Math.min(0.04, moldHeight / 10);
|
|
3260
|
+
const lead = (side, along) => {
|
|
3261
|
+
const horizontal = side % 2 === 0;
|
|
3262
|
+
const sign = side < 2 ? -1 : 1;
|
|
3263
|
+
const width10 = horizontal ? bodyWidth : bodyLength10;
|
|
3264
|
+
const outer = (horizontal ? leadSpanX : leadSpanY) / 2;
|
|
3265
|
+
const root = width10 / 2 - Math.min(width10 / 8, 0.15);
|
|
3266
|
+
const bendStart = outer - contactLength;
|
|
3267
|
+
const bendEnd = width10 / 2 + Math.min(0.08, (reach - contactLength) / 4);
|
|
3268
|
+
const points = [
|
|
3269
|
+
[outer - slice / 2, leadThickness / 2],
|
|
3270
|
+
[bendStart, leadThickness / 2]
|
|
3271
|
+
];
|
|
3272
|
+
for (let i = 1; i <= 12; i++) {
|
|
3273
|
+
const t = i / 12;
|
|
3274
|
+
points.push([
|
|
3275
|
+
bendStart + (bendEnd - bendStart) * t,
|
|
3276
|
+
leadThickness / 2 + (midZ - leadThickness / 2) * t * t * (3 - 2 * t)
|
|
3277
|
+
]);
|
|
3278
|
+
}
|
|
3279
|
+
points.push([root, midZ]);
|
|
3280
|
+
const section = ([x, z]) => /* @__PURE__ */ jsx(
|
|
3281
|
+
Translate,
|
|
3282
|
+
{
|
|
3283
|
+
offset: {
|
|
3284
|
+
x: horizontal ? sign * x : along,
|
|
3285
|
+
y: horizontal ? along : sign * x,
|
|
3286
|
+
z
|
|
3287
|
+
},
|
|
3288
|
+
children: /* @__PURE__ */ jsx(
|
|
3289
|
+
Cuboid,
|
|
3290
|
+
{
|
|
3291
|
+
size: horizontal ? [slice, leadWidth, leadThickness] : [leadWidth, slice, leadThickness]
|
|
3292
|
+
}
|
|
3293
|
+
)
|
|
3294
|
+
}
|
|
3295
|
+
);
|
|
3296
|
+
return /* @__PURE__ */ jsx(Union, { children: points.slice(1).map((point, i) => /* @__PURE__ */ jsxs(Hull, { children: [
|
|
3297
|
+
section(points[i]),
|
|
3298
|
+
section(point)
|
|
3299
|
+
] }, i)) });
|
|
3300
|
+
};
|
|
3301
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
3302
|
+
/* @__PURE__ */ jsx(Colorize, { color: "#353535", children: /* @__PURE__ */ jsxs(Subtract, { children: [
|
|
3303
|
+
body,
|
|
3304
|
+
/* @__PURE__ */ jsx(
|
|
3305
|
+
Translate,
|
|
3306
|
+
{
|
|
3307
|
+
offset: {
|
|
3308
|
+
x: -bodyWidth / 2 + taperInset + dimpleRadius * 2,
|
|
3309
|
+
y: bodyLength10 / 2 - taperInset - dimpleRadius * 2,
|
|
3310
|
+
z: bodyHeight
|
|
3311
|
+
},
|
|
3312
|
+
children: /* @__PURE__ */ jsx(Cylinder, { radius: dimpleRadius, height: dimpleDepth * 2 })
|
|
3313
|
+
}
|
|
3314
|
+
)
|
|
3315
|
+
] }) }),
|
|
3316
|
+
/* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: Array.from(
|
|
3317
|
+
{ length: pinCount },
|
|
3318
|
+
(_, i) => lead(
|
|
3319
|
+
Math.floor(i / (pinCount / 4)),
|
|
3320
|
+
((pinCount / 4 - 1) / 2 - i % (pinCount / 4)) * pitch
|
|
3321
|
+
)
|
|
3322
|
+
) })
|
|
3323
|
+
] });
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3190
3326
|
// lib/lqfp.tsx
|
|
3191
|
-
var
|
|
3327
|
+
var LegacyLQFP = ({
|
|
3192
3328
|
pinCount,
|
|
3193
3329
|
pitch,
|
|
3194
3330
|
leadWidth,
|
|
@@ -3298,6 +3434,7 @@ var LQFP = ({
|
|
|
3298
3434
|
)
|
|
3299
3435
|
] });
|
|
3300
3436
|
};
|
|
3437
|
+
var LQFP = (props) => "leadSpanX" in props ? createPhysicalLqfp(props) : LegacyLQFP(props);
|
|
3301
3438
|
|
|
3302
3439
|
// lib/SOT-723.tsx
|
|
3303
3440
|
var SOT723 = () => {
|