jscad-electronics 0.0.170 → 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/index.d.ts +7 -2
- package/dist/index.js +251 -250
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +133 -132
- package/dist/vanilla.js.map +1 -1
- package/package.json +1 -1
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
|
|
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;
|
|
@@ -1912,137 +2044,6 @@ var PushButtonLeg = (props) => {
|
|
|
1912
2044
|
) });
|
|
1913
2045
|
};
|
|
1914
2046
|
|
|
1915
|
-
// lib/utils/DualRowGullWing.tsx
|
|
1916
|
-
function createDualRowGullWing(p) {
|
|
1917
|
-
const {
|
|
1918
|
-
pinCount,
|
|
1919
|
-
pitch,
|
|
1920
|
-
bodyWidth,
|
|
1921
|
-
bodyLength: bodyLength10,
|
|
1922
|
-
bodyHeight,
|
|
1923
|
-
standoff,
|
|
1924
|
-
leadSpan,
|
|
1925
|
-
leadWidth,
|
|
1926
|
-
leadThickness,
|
|
1927
|
-
contactLength,
|
|
1928
|
-
taperInset,
|
|
1929
|
-
exposedPadWidth = 0,
|
|
1930
|
-
exposedPadLength = 0
|
|
1931
|
-
} = p;
|
|
1932
|
-
for (const key of [
|
|
1933
|
-
"pitch",
|
|
1934
|
-
"bodyWidth",
|
|
1935
|
-
"bodyLength",
|
|
1936
|
-
"bodyHeight",
|
|
1937
|
-
"leadSpan",
|
|
1938
|
-
"leadWidth",
|
|
1939
|
-
"leadThickness",
|
|
1940
|
-
"contactLength"
|
|
1941
|
-
])
|
|
1942
|
-
if (!Number.isFinite(p[key]) || p[key] <= 0)
|
|
1943
|
-
throw new Error(`${key} must be finite and positive`);
|
|
1944
|
-
for (const [name, value] of Object.entries({
|
|
1945
|
-
standoff,
|
|
1946
|
-
taperInset,
|
|
1947
|
-
exposedPadWidth,
|
|
1948
|
-
exposedPadLength
|
|
1949
|
-
}))
|
|
1950
|
-
if (!Number.isFinite(value) || value < 0)
|
|
1951
|
-
throw new Error(`${name} must be finite and nonnegative`);
|
|
1952
|
-
if (!Number.isInteger(pinCount) || pinCount < 4 || pinCount % 2)
|
|
1953
|
-
throw new Error("pinCount must be even and at least 4");
|
|
1954
|
-
const moldHeight = bodyHeight - standoff;
|
|
1955
|
-
const reach = (leadSpan - bodyWidth) / 2;
|
|
1956
|
-
const rowLength = (pinCount / 2 - 1) * pitch + leadWidth;
|
|
1957
|
-
if (moldHeight <= leadThickness * 2 || leadWidth >= pitch || rowLength >= bodyLength10 - 2 * taperInset || taperInset * 2 >= Math.min(bodyWidth, bodyLength10) || contactLength >= reach)
|
|
1958
|
-
throw new Error("Invalid mold, lead spacing, or terminal reach");
|
|
1959
|
-
if (exposedPadWidth === 0 !== (exposedPadLength === 0) || exposedPadWidth >= bodyWidth - 2 * taperInset || exposedPadLength >= bodyLength10 - 2 * taperInset)
|
|
1960
|
-
throw new Error("Exposed pad must fit inside the bottom mold face");
|
|
1961
|
-
const midZ = standoff + moldHeight / 2;
|
|
1962
|
-
const slice = Math.min(2e-3, moldHeight / 100);
|
|
1963
|
-
const body = /* @__PURE__ */ jsxs(Hull, { children: [
|
|
1964
|
-
/* @__PURE__ */ jsx(Translate, { z: standoff + slice / 2, children: /* @__PURE__ */ jsx(
|
|
1965
|
-
Cuboid,
|
|
1966
|
-
{
|
|
1967
|
-
size: [
|
|
1968
|
-
bodyWidth - 2 * taperInset,
|
|
1969
|
-
bodyLength10 - 2 * taperInset,
|
|
1970
|
-
slice
|
|
1971
|
-
]
|
|
1972
|
-
}
|
|
1973
|
-
) }),
|
|
1974
|
-
/* @__PURE__ */ jsx(Translate, { z: midZ, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, slice] }) }),
|
|
1975
|
-
/* @__PURE__ */ jsx(Translate, { z: bodyHeight - slice / 2, children: /* @__PURE__ */ jsx(
|
|
1976
|
-
Cuboid,
|
|
1977
|
-
{
|
|
1978
|
-
size: [
|
|
1979
|
-
bodyWidth - 2 * taperInset,
|
|
1980
|
-
bodyLength10 - 2 * taperInset,
|
|
1981
|
-
slice
|
|
1982
|
-
]
|
|
1983
|
-
}
|
|
1984
|
-
) })
|
|
1985
|
-
] });
|
|
1986
|
-
const dimpleRadius = Math.min(bodyWidth, bodyLength10) * 0.045;
|
|
1987
|
-
const dimpleDepth = Math.min(0.04, moldHeight / 10);
|
|
1988
|
-
const lead = (side, y) => {
|
|
1989
|
-
const outer = leadSpan / 2;
|
|
1990
|
-
const root = bodyWidth / 2 - Math.min(bodyWidth / 8, 0.15);
|
|
1991
|
-
const bendStart = outer - contactLength;
|
|
1992
|
-
const bendEnd = bodyWidth / 2 + Math.min(0.08, (reach - contactLength) / 4);
|
|
1993
|
-
const points = [
|
|
1994
|
-
[outer - slice / 2, leadThickness / 2],
|
|
1995
|
-
[bendStart, leadThickness / 2]
|
|
1996
|
-
];
|
|
1997
|
-
for (let i = 1; i <= 12; i++) {
|
|
1998
|
-
const t = i / 12;
|
|
1999
|
-
points.push([
|
|
2000
|
-
bendStart + (bendEnd - bendStart) * t,
|
|
2001
|
-
leadThickness / 2 + (midZ - leadThickness / 2) * t * t * (3 - 2 * t)
|
|
2002
|
-
]);
|
|
2003
|
-
}
|
|
2004
|
-
points.push([root, midZ]);
|
|
2005
|
-
const section = ([x, z]) => /* @__PURE__ */ jsx(Translate, { offset: { x: side * x, y, z }, children: /* @__PURE__ */ jsx(Cuboid, { size: [slice, leadWidth, leadThickness] }) });
|
|
2006
|
-
return /* @__PURE__ */ jsx(Union, { children: points.slice(1).map((point, i) => /* @__PURE__ */ jsxs(Hull, { children: [
|
|
2007
|
-
section(points[i]),
|
|
2008
|
-
section(point)
|
|
2009
|
-
] }, i)) });
|
|
2010
|
-
};
|
|
2011
|
-
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
2012
|
-
/* @__PURE__ */ jsx(Colorize, { color: "#353535", children: /* @__PURE__ */ jsxs(Subtract, { children: [
|
|
2013
|
-
body,
|
|
2014
|
-
/* @__PURE__ */ jsx(
|
|
2015
|
-
Translate,
|
|
2016
|
-
{
|
|
2017
|
-
offset: {
|
|
2018
|
-
x: -bodyWidth / 2 + taperInset + dimpleRadius * 2,
|
|
2019
|
-
y: bodyLength10 / 2 - taperInset - dimpleRadius * 2,
|
|
2020
|
-
z: bodyHeight
|
|
2021
|
-
},
|
|
2022
|
-
children: /* @__PURE__ */ jsx(Cylinder, { radius: dimpleRadius, height: dimpleDepth * 2 })
|
|
2023
|
-
}
|
|
2024
|
-
)
|
|
2025
|
-
] }) }),
|
|
2026
|
-
/* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: Array.from(
|
|
2027
|
-
{ length: pinCount },
|
|
2028
|
-
(_, i) => lead(
|
|
2029
|
-
i < pinCount / 2 ? -1 : 1,
|
|
2030
|
-
((pinCount / 2 - 1) / 2 - i % (pinCount / 2)) * pitch
|
|
2031
|
-
)
|
|
2032
|
-
) }),
|
|
2033
|
-
exposedPadWidth > 0 && /* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: /* @__PURE__ */ jsx(Translate, { z: (standoff + leadThickness) / 2, children: /* @__PURE__ */ jsx(
|
|
2034
|
-
Cuboid,
|
|
2035
|
-
{
|
|
2036
|
-
size: [
|
|
2037
|
-
exposedPadWidth,
|
|
2038
|
-
exposedPadLength,
|
|
2039
|
-
standoff + leadThickness
|
|
2040
|
-
]
|
|
2041
|
-
}
|
|
2042
|
-
) }) })
|
|
2043
|
-
] });
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
2047
|
// lib/SOIC.tsx
|
|
2047
2048
|
var LegacySOIC = ({
|
|
2048
2049
|
pinCount,
|