jscad-electronics 0.0.169 → 0.0.171

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
@@ -535,8 +535,139 @@ var Tssop = ({
535
535
  ] });
536
536
  };
537
537
 
538
+ // lib/utils/DualRowGullWing.tsx
539
+ function createDualRowGullWing(p) {
540
+ const {
541
+ pinCount,
542
+ pitch,
543
+ bodyWidth,
544
+ bodyLength: bodyLength10,
545
+ bodyHeight,
546
+ standoff,
547
+ leadSpan,
548
+ leadWidth,
549
+ leadThickness,
550
+ contactLength,
551
+ taperInset,
552
+ exposedPadWidth = 0,
553
+ exposedPadLength = 0
554
+ } = p;
555
+ for (const key of [
556
+ "pitch",
557
+ "bodyWidth",
558
+ "bodyLength",
559
+ "bodyHeight",
560
+ "leadSpan",
561
+ "leadWidth",
562
+ "leadThickness",
563
+ "contactLength"
564
+ ])
565
+ if (!Number.isFinite(p[key]) || p[key] <= 0)
566
+ throw new Error(`${key} must be finite and positive`);
567
+ for (const [name, value] of Object.entries({
568
+ standoff,
569
+ taperInset,
570
+ exposedPadWidth,
571
+ exposedPadLength
572
+ }))
573
+ if (!Number.isFinite(value) || value < 0)
574
+ throw new Error(`${name} must be finite and nonnegative`);
575
+ if (!Number.isInteger(pinCount) || pinCount < 4 || pinCount % 2)
576
+ throw new Error("pinCount must be even and at least 4");
577
+ const moldHeight = bodyHeight - standoff;
578
+ const reach = (leadSpan - bodyWidth) / 2;
579
+ const rowLength = (pinCount / 2 - 1) * pitch + leadWidth;
580
+ if (moldHeight <= leadThickness * 2 || leadWidth >= pitch || rowLength >= bodyLength10 - 2 * taperInset || taperInset * 2 >= Math.min(bodyWidth, bodyLength10) || contactLength >= reach)
581
+ throw new Error("Invalid mold, lead spacing, or terminal reach");
582
+ if (exposedPadWidth === 0 !== (exposedPadLength === 0) || exposedPadWidth >= bodyWidth - 2 * taperInset || exposedPadLength >= bodyLength10 - 2 * taperInset)
583
+ throw new Error("Exposed pad must fit inside the bottom mold face");
584
+ const midZ = standoff + moldHeight / 2;
585
+ const slice = Math.min(2e-3, moldHeight / 100);
586
+ const body = /* @__PURE__ */ jsxs(Hull, { children: [
587
+ /* @__PURE__ */ jsx(Translate, { z: standoff + slice / 2, children: /* @__PURE__ */ jsx(
588
+ Cuboid,
589
+ {
590
+ size: [
591
+ bodyWidth - 2 * taperInset,
592
+ bodyLength10 - 2 * taperInset,
593
+ slice
594
+ ]
595
+ }
596
+ ) }),
597
+ /* @__PURE__ */ jsx(Translate, { z: midZ, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, slice] }) }),
598
+ /* @__PURE__ */ jsx(Translate, { z: bodyHeight - slice / 2, children: /* @__PURE__ */ jsx(
599
+ Cuboid,
600
+ {
601
+ size: [
602
+ bodyWidth - 2 * taperInset,
603
+ bodyLength10 - 2 * taperInset,
604
+ slice
605
+ ]
606
+ }
607
+ ) })
608
+ ] });
609
+ const dimpleRadius = Math.min(bodyWidth, bodyLength10) * 0.045;
610
+ const dimpleDepth = Math.min(0.04, moldHeight / 10);
611
+ const lead = (side, y) => {
612
+ const outer = leadSpan / 2;
613
+ const root = bodyWidth / 2 - Math.min(bodyWidth / 8, 0.15);
614
+ const bendStart = outer - contactLength;
615
+ const bendEnd = bodyWidth / 2 + Math.min(0.08, (reach - contactLength) / 4);
616
+ const points = [
617
+ [outer - slice / 2, leadThickness / 2],
618
+ [bendStart, leadThickness / 2]
619
+ ];
620
+ for (let i = 1; i <= 12; i++) {
621
+ const t = i / 12;
622
+ points.push([
623
+ bendStart + (bendEnd - bendStart) * t,
624
+ leadThickness / 2 + (midZ - leadThickness / 2) * t * t * (3 - 2 * t)
625
+ ]);
626
+ }
627
+ points.push([root, midZ]);
628
+ const section = ([x, z]) => /* @__PURE__ */ jsx(Translate, { offset: { x: side * x, y, z }, children: /* @__PURE__ */ jsx(Cuboid, { size: [slice, leadWidth, leadThickness] }) });
629
+ return /* @__PURE__ */ jsx(Union, { children: points.slice(1).map((point, i) => /* @__PURE__ */ jsxs(Hull, { children: [
630
+ section(points[i]),
631
+ section(point)
632
+ ] }, i)) });
633
+ };
634
+ return /* @__PURE__ */ jsxs(Fragment2, { children: [
635
+ /* @__PURE__ */ jsx(Colorize, { color: "#353535", children: /* @__PURE__ */ jsxs(Subtract, { children: [
636
+ body,
637
+ /* @__PURE__ */ jsx(
638
+ Translate,
639
+ {
640
+ offset: {
641
+ x: -bodyWidth / 2 + taperInset + dimpleRadius * 2,
642
+ y: bodyLength10 / 2 - taperInset - dimpleRadius * 2,
643
+ z: bodyHeight
644
+ },
645
+ children: /* @__PURE__ */ jsx(Cylinder, { radius: dimpleRadius, height: dimpleDepth * 2 })
646
+ }
647
+ )
648
+ ] }) }),
649
+ /* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: Array.from(
650
+ { length: pinCount },
651
+ (_, i) => lead(
652
+ i < pinCount / 2 ? -1 : 1,
653
+ ((pinCount / 2 - 1) / 2 - i % (pinCount / 2)) * pitch
654
+ )
655
+ ) }),
656
+ exposedPadWidth > 0 && /* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: /* @__PURE__ */ jsx(Translate, { z: (standoff + leadThickness) / 2, children: /* @__PURE__ */ jsx(
657
+ Cuboid,
658
+ {
659
+ size: [
660
+ exposedPadWidth,
661
+ exposedPadLength,
662
+ standoff + leadThickness
663
+ ]
664
+ }
665
+ ) }) })
666
+ ] });
667
+ }
668
+
538
669
  // lib/MSOP.tsx
539
- var MSOP = ({
670
+ var LegacyMSOP = ({
540
671
  pinCount,
541
672
  padContactLength = 0.4,
542
673
  leadWidth = 0.2,
@@ -594,6 +725,7 @@ var MSOP = ({
594
725
  )
595
726
  ] });
596
727
  };
728
+ var MSOP = (props) => "leadSpan" in props ? createDualRowGullWing(props) : LegacyMSOP(props);
597
729
 
598
730
  // lib/A0402.tsx
599
731
  var fullLength = 1;
@@ -1913,7 +2045,7 @@ var PushButtonLeg = (props) => {
1913
2045
  };
1914
2046
 
1915
2047
  // lib/SOIC.tsx
1916
- var SOIC = ({
2048
+ var LegacySOIC = ({
1917
2049
  pinCount,
1918
2050
  leadLength,
1919
2051
  leadWidth,
@@ -1973,6 +2105,7 @@ var SOIC = ({
1973
2105
  )
1974
2106
  ] });
1975
2107
  };
2108
+ var SOIC = (props) => "leadSpan" in props ? createDualRowGullWing(props) : LegacySOIC(props);
1976
2109
 
1977
2110
  // lib/VSSOP.tsx
1978
2111
  var VSSOP = ({