jscad-electronics 0.0.56 → 0.0.58
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 +5 -1
- package/dist/index.js +207 -57
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +145 -1
- package/dist/vanilla.js.map +1 -1
- package/package.json +1 -1
package/dist/vanilla.js
CHANGED
|
@@ -1548,6 +1548,146 @@ var SOD523 = () => {
|
|
|
1548
1548
|
] });
|
|
1549
1549
|
};
|
|
1550
1550
|
|
|
1551
|
+
// lib/SMA.tsx
|
|
1552
|
+
var SMA = () => {
|
|
1553
|
+
const bodyWidth = 4.4;
|
|
1554
|
+
const bodyLength10 = 3.4;
|
|
1555
|
+
const bodyHeight = 2.3;
|
|
1556
|
+
const padWidth = 1.45;
|
|
1557
|
+
const padThickness = 0.12;
|
|
1558
|
+
const leadThickness = 0.2;
|
|
1559
|
+
const leadHeight = 1.14;
|
|
1560
|
+
const taperOffset = 0.4;
|
|
1561
|
+
const straightHeight = bodyHeight * 0.5;
|
|
1562
|
+
const Body = /* @__PURE__ */ jsx(Colorize, { color: "#1a1a1a", children: /* @__PURE__ */ jsxs(Union, { children: [
|
|
1563
|
+
/* @__PURE__ */ jsxs(Hull, { children: [
|
|
1564
|
+
/* @__PURE__ */ jsx(Translate, { z: padThickness + 0.01, children: /* @__PURE__ */ jsx(
|
|
1565
|
+
Cuboid,
|
|
1566
|
+
{
|
|
1567
|
+
size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.03]
|
|
1568
|
+
}
|
|
1569
|
+
) }),
|
|
1570
|
+
/* @__PURE__ */ jsx(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) })
|
|
1571
|
+
] }),
|
|
1572
|
+
/* @__PURE__ */ jsxs(Hull, { children: [
|
|
1573
|
+
/* @__PURE__ */ jsx(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) }),
|
|
1574
|
+
/* @__PURE__ */ jsx(Translate, { z: bodyHeight, children: /* @__PURE__ */ jsx(
|
|
1575
|
+
Cuboid,
|
|
1576
|
+
{
|
|
1577
|
+
size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.01]
|
|
1578
|
+
}
|
|
1579
|
+
) })
|
|
1580
|
+
] })
|
|
1581
|
+
] }) });
|
|
1582
|
+
const Lead = ({ xDir }) => {
|
|
1583
|
+
const verticalGap = 1;
|
|
1584
|
+
const lowerPadGap = 1;
|
|
1585
|
+
const lowerPadX = xDir * (bodyLength10 / 2 - bodyHeight * 0.8 / 2 + lowerPadGap);
|
|
1586
|
+
const verticalLeadX = xDir * (bodyLength10 / 2 - leadThickness / 2 + verticalGap);
|
|
1587
|
+
const bodyEdgeX = xDir * (bodyLength10 / 2 - leadThickness / 2);
|
|
1588
|
+
const bridgeLength = Math.abs(bodyEdgeX - verticalLeadX);
|
|
1589
|
+
const bridgeCenterX = (verticalLeadX + bodyEdgeX) / 2;
|
|
1590
|
+
return /* @__PURE__ */ jsx(Colorize, { color: "#c0c0c0", children: /* @__PURE__ */ jsxs(Union, { children: [
|
|
1591
|
+
/* @__PURE__ */ jsx(
|
|
1592
|
+
Cuboid,
|
|
1593
|
+
{
|
|
1594
|
+
size: [bodyHeight * 0.8, padWidth, leadThickness],
|
|
1595
|
+
center: [lowerPadX, 0, leadThickness / 2]
|
|
1596
|
+
}
|
|
1597
|
+
),
|
|
1598
|
+
/* @__PURE__ */ jsx(
|
|
1599
|
+
Cuboid,
|
|
1600
|
+
{
|
|
1601
|
+
size: [leadThickness, padWidth, leadHeight],
|
|
1602
|
+
center: [verticalLeadX, 0, leadHeight / 2 + leadThickness]
|
|
1603
|
+
}
|
|
1604
|
+
),
|
|
1605
|
+
/* @__PURE__ */ jsx(
|
|
1606
|
+
Cuboid,
|
|
1607
|
+
{
|
|
1608
|
+
size: [bridgeLength, padWidth, leadThickness],
|
|
1609
|
+
center: [bridgeCenterX, 0, leadThickness / 2 + leadHeight]
|
|
1610
|
+
}
|
|
1611
|
+
)
|
|
1612
|
+
] }) });
|
|
1613
|
+
};
|
|
1614
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
1615
|
+
/* @__PURE__ */ jsx(Lead, { xDir: 1 }),
|
|
1616
|
+
/* @__PURE__ */ jsx(Lead, { xDir: -1 }),
|
|
1617
|
+
Body
|
|
1618
|
+
] });
|
|
1619
|
+
};
|
|
1620
|
+
|
|
1621
|
+
// lib/SMB.tsx
|
|
1622
|
+
var SMB = () => {
|
|
1623
|
+
const bodyWidth = 4.4;
|
|
1624
|
+
const bodyLength10 = 3.4;
|
|
1625
|
+
const bodyHeight = 2.3;
|
|
1626
|
+
const padWidth = 1.45;
|
|
1627
|
+
const padThickness = 0.12;
|
|
1628
|
+
const leadThickness = 0.2;
|
|
1629
|
+
const leadHeight = 1.14;
|
|
1630
|
+
const taperOffset = 0.4;
|
|
1631
|
+
const straightHeight = bodyHeight * 0.5;
|
|
1632
|
+
const Body = /* @__PURE__ */ jsx(Colorize, { color: "#1a1a1a", children: /* @__PURE__ */ jsxs(Union, { children: [
|
|
1633
|
+
/* @__PURE__ */ jsxs(Hull, { children: [
|
|
1634
|
+
/* @__PURE__ */ jsx(Translate, { z: padThickness + 0.01, children: /* @__PURE__ */ jsx(
|
|
1635
|
+
Cuboid,
|
|
1636
|
+
{
|
|
1637
|
+
size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.03]
|
|
1638
|
+
}
|
|
1639
|
+
) }),
|
|
1640
|
+
/* @__PURE__ */ jsx(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) })
|
|
1641
|
+
] }),
|
|
1642
|
+
/* @__PURE__ */ jsxs(Hull, { children: [
|
|
1643
|
+
/* @__PURE__ */ jsx(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) }),
|
|
1644
|
+
/* @__PURE__ */ jsx(Translate, { z: bodyHeight, children: /* @__PURE__ */ jsx(
|
|
1645
|
+
Cuboid,
|
|
1646
|
+
{
|
|
1647
|
+
size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.01]
|
|
1648
|
+
}
|
|
1649
|
+
) })
|
|
1650
|
+
] })
|
|
1651
|
+
] }) });
|
|
1652
|
+
const Lead = ({ xDir }) => {
|
|
1653
|
+
const verticalGap = 1;
|
|
1654
|
+
const lowerPadGap = 1;
|
|
1655
|
+
const lowerPadX = xDir * (bodyLength10 / 2 - bodyHeight * 0.8 / 2 + lowerPadGap);
|
|
1656
|
+
const verticalLeadX = xDir * (bodyLength10 / 2 - leadThickness / 2 + verticalGap);
|
|
1657
|
+
const bodyEdgeX = xDir * (bodyLength10 / 2 - leadThickness / 2);
|
|
1658
|
+
const bridgeLength = Math.abs(bodyEdgeX - verticalLeadX);
|
|
1659
|
+
const bridgeCenterX = (verticalLeadX + bodyEdgeX) / 2;
|
|
1660
|
+
return /* @__PURE__ */ jsx(Colorize, { color: "#c0c0c0", children: /* @__PURE__ */ jsxs(Union, { children: [
|
|
1661
|
+
/* @__PURE__ */ jsx(
|
|
1662
|
+
Cuboid,
|
|
1663
|
+
{
|
|
1664
|
+
size: [bodyHeight * 0.8, padWidth, leadThickness],
|
|
1665
|
+
center: [lowerPadX, 0, leadThickness / 2]
|
|
1666
|
+
}
|
|
1667
|
+
),
|
|
1668
|
+
/* @__PURE__ */ jsx(
|
|
1669
|
+
Cuboid,
|
|
1670
|
+
{
|
|
1671
|
+
size: [leadThickness, padWidth, leadHeight],
|
|
1672
|
+
center: [verticalLeadX, 0, leadHeight / 2 + leadThickness]
|
|
1673
|
+
}
|
|
1674
|
+
),
|
|
1675
|
+
/* @__PURE__ */ jsx(
|
|
1676
|
+
Cuboid,
|
|
1677
|
+
{
|
|
1678
|
+
size: [bridgeLength, padWidth, leadThickness],
|
|
1679
|
+
center: [bridgeCenterX, 0, leadThickness / 2 + leadHeight]
|
|
1680
|
+
}
|
|
1681
|
+
)
|
|
1682
|
+
] }) });
|
|
1683
|
+
};
|
|
1684
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
1685
|
+
/* @__PURE__ */ jsx(Lead, { xDir: 1 }),
|
|
1686
|
+
/* @__PURE__ */ jsx(Lead, { xDir: -1 }),
|
|
1687
|
+
Body
|
|
1688
|
+
] });
|
|
1689
|
+
};
|
|
1690
|
+
|
|
1551
1691
|
// lib/Footprinter3d.tsx
|
|
1552
1692
|
var Footprinter3d = ({ footprint }) => {
|
|
1553
1693
|
const fpJson = fp.string(footprint).json();
|
|
@@ -1656,6 +1796,10 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
1656
1796
|
);
|
|
1657
1797
|
case "sod523":
|
|
1658
1798
|
return /* @__PURE__ */ jsx(SOD523, {});
|
|
1799
|
+
case "sma":
|
|
1800
|
+
return /* @__PURE__ */ jsx(SMA, {});
|
|
1801
|
+
case "smb":
|
|
1802
|
+
return /* @__PURE__ */ jsx(SMB, {});
|
|
1659
1803
|
}
|
|
1660
1804
|
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
1661
1805
|
const color = colorMatch ? colorMatch[1] : void 0;
|
|
@@ -1760,7 +1904,7 @@ function renderNode(node, colorCtx, renderCtx) {
|
|
|
1760
1904
|
else if (type === Subtract)
|
|
1761
1905
|
geom = booleans.subtract(geoms[0], geoms.slice(1));
|
|
1762
1906
|
else geom = hulls.hull(geoms);
|
|
1763
|
-
return [{ geom }];
|
|
1907
|
+
return [{ geom, color: colorCtx }];
|
|
1764
1908
|
}
|
|
1765
1909
|
if (type === Polygon) {
|
|
1766
1910
|
const points = props?.points ?? [];
|