jscad-electronics 0.0.168 → 0.0.170
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 +71 -21
- package/dist/index.js +1186 -1025
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +133 -1
- package/dist/vanilla.js.map +1 -1
- package/package.json +1 -1
package/dist/vanilla.js
CHANGED
|
@@ -1912,8 +1912,139 @@ var PushButtonLeg = (props) => {
|
|
|
1912
1912
|
) });
|
|
1913
1913
|
};
|
|
1914
1914
|
|
|
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
|
+
|
|
1915
2046
|
// lib/SOIC.tsx
|
|
1916
|
-
var
|
|
2047
|
+
var LegacySOIC = ({
|
|
1917
2048
|
pinCount,
|
|
1918
2049
|
leadLength,
|
|
1919
2050
|
leadWidth,
|
|
@@ -1973,6 +2104,7 @@ var SOIC = ({
|
|
|
1973
2104
|
)
|
|
1974
2105
|
] });
|
|
1975
2106
|
};
|
|
2107
|
+
var SOIC = (props) => "leadSpan" in props ? createDualRowGullWing(props) : LegacySOIC(props);
|
|
1976
2108
|
|
|
1977
2109
|
// lib/VSSOP.tsx
|
|
1978
2110
|
var VSSOP = ({
|