jscad-electronics 0.0.89 → 0.0.91
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 +3 -1
- package/dist/index.js +229 -114
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +131 -27
- package/dist/vanilla.js.map +1 -1
- package/package.json +2 -2
package/dist/vanilla.js
CHANGED
|
@@ -2501,38 +2501,65 @@ var LQFP = ({
|
|
|
2501
2501
|
};
|
|
2502
2502
|
|
|
2503
2503
|
// lib/SOT-723.tsx
|
|
2504
|
-
var getCcwSot723Coords = (pn) => {
|
|
2505
|
-
if (pn === 1) {
|
|
2506
|
-
return { x: 0, y: 0 };
|
|
2507
|
-
} else if (pn === 2) {
|
|
2508
|
-
return { x: 1, y: -0.4 };
|
|
2509
|
-
} else {
|
|
2510
|
-
return { x: 1, y: 0.4 };
|
|
2511
|
-
}
|
|
2512
|
-
};
|
|
2513
2504
|
var SOT723 = () => {
|
|
2514
|
-
const bodyWidth = 0.
|
|
2505
|
+
const bodyWidth = 0.85;
|
|
2515
2506
|
const bodyLength10 = 1.2;
|
|
2516
|
-
const bodyHeight = 0.
|
|
2517
|
-
const
|
|
2518
|
-
const
|
|
2519
|
-
const
|
|
2520
|
-
const
|
|
2507
|
+
const bodyHeight = 0.38;
|
|
2508
|
+
const straightHeight = bodyHeight * 0.55;
|
|
2509
|
+
const taperOffset = 0.1;
|
|
2510
|
+
const padLength = 0.3;
|
|
2511
|
+
const padThickness = 0.1;
|
|
2512
|
+
const leftPadWidth = 0.2;
|
|
2513
|
+
const rightPadWidth = 0.25;
|
|
2514
|
+
const rightPadCenterX = 0.55;
|
|
2515
|
+
const rightPadCenterY = 0;
|
|
2516
|
+
const leftTopPadCenterX = -0.55;
|
|
2517
|
+
const leftTopPadCenterY = 0.4;
|
|
2518
|
+
const leftBottomPadCenterX = -0.55;
|
|
2519
|
+
const leftBottomPadCenterY = -0.4;
|
|
2521
2520
|
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
2522
|
-
/* @__PURE__ */ jsx(
|
|
2523
|
-
|
|
2524
|
-
const { x, y } = getCcwSot723Coords(pn);
|
|
2525
|
-
return /* @__PURE__ */ jsx(Translate, { center: [x, y, 0.05], children: /* @__PURE__ */ jsx(
|
|
2521
|
+
/* @__PURE__ */ jsx(Colorize, { color: "#222", children: /* @__PURE__ */ jsxs(Union, { children: [
|
|
2522
|
+
/* @__PURE__ */ jsx(
|
|
2526
2523
|
Cuboid,
|
|
2527
2524
|
{
|
|
2528
|
-
size: [
|
|
2529
|
-
|
|
2530
|
-
pn === 1 ? centerLeadWidth : leadWidth,
|
|
2531
|
-
leadHeight
|
|
2532
|
-
]
|
|
2525
|
+
size: [bodyWidth, bodyLength10, straightHeight],
|
|
2526
|
+
center: [0, 0, straightHeight / 2]
|
|
2533
2527
|
}
|
|
2534
|
-
)
|
|
2535
|
-
|
|
2528
|
+
),
|
|
2529
|
+
/* @__PURE__ */ jsxs(Hull, { children: [
|
|
2530
|
+
/* @__PURE__ */ jsx(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) }),
|
|
2531
|
+
/* @__PURE__ */ jsx(Translate, { z: bodyHeight, children: /* @__PURE__ */ jsx(
|
|
2532
|
+
Cuboid,
|
|
2533
|
+
{
|
|
2534
|
+
size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.01]
|
|
2535
|
+
}
|
|
2536
|
+
) })
|
|
2537
|
+
] })
|
|
2538
|
+
] }) }),
|
|
2539
|
+
/* @__PURE__ */ jsx(
|
|
2540
|
+
Cuboid,
|
|
2541
|
+
{
|
|
2542
|
+
color: "#ccc",
|
|
2543
|
+
size: [padLength, rightPadWidth, padThickness],
|
|
2544
|
+
center: [rightPadCenterX, rightPadCenterY, padThickness / 2]
|
|
2545
|
+
}
|
|
2546
|
+
),
|
|
2547
|
+
/* @__PURE__ */ jsx(
|
|
2548
|
+
Cuboid,
|
|
2549
|
+
{
|
|
2550
|
+
color: "#ccc",
|
|
2551
|
+
size: [padLength, leftPadWidth, padThickness],
|
|
2552
|
+
center: [leftTopPadCenterX, leftTopPadCenterY, padThickness / 2]
|
|
2553
|
+
}
|
|
2554
|
+
),
|
|
2555
|
+
/* @__PURE__ */ jsx(
|
|
2556
|
+
Cuboid,
|
|
2557
|
+
{
|
|
2558
|
+
color: "#ccc",
|
|
2559
|
+
size: [padLength, leftPadWidth, padThickness],
|
|
2560
|
+
center: [leftBottomPadCenterX, leftBottomPadCenterY, padThickness / 2]
|
|
2561
|
+
}
|
|
2562
|
+
)
|
|
2536
2563
|
] });
|
|
2537
2564
|
};
|
|
2538
2565
|
|
|
@@ -2883,6 +2910,81 @@ var MS012 = ({
|
|
|
2883
2910
|
] });
|
|
2884
2911
|
};
|
|
2885
2912
|
|
|
2913
|
+
// lib/TO220.tsx
|
|
2914
|
+
var TO220 = () => {
|
|
2915
|
+
const fullLength10 = 20;
|
|
2916
|
+
const bodyLength10 = 9.9;
|
|
2917
|
+
const bodyHeight = 4.5;
|
|
2918
|
+
const zOffset = 1;
|
|
2919
|
+
const padWidth = 9.9;
|
|
2920
|
+
const padLength = 6.5;
|
|
2921
|
+
const padThickness = 1.3;
|
|
2922
|
+
const padHoleDiameter = 3;
|
|
2923
|
+
const prongWidth = 0.81;
|
|
2924
|
+
const prongLength = 16;
|
|
2925
|
+
const prongHeight = 0.5;
|
|
2926
|
+
const prongPitch = 2.7;
|
|
2927
|
+
const bodyWidth = padWidth;
|
|
2928
|
+
const bodyFrontX = fullLength10 - bodyLength10 / 2;
|
|
2929
|
+
const bodyBackX = fullLength10 + bodyLength10 / 2;
|
|
2930
|
+
const prongCenterX = bodyFrontX - prongLength / 2;
|
|
2931
|
+
const padCenterX = bodyBackX + padLength / 2;
|
|
2932
|
+
return /* @__PURE__ */ jsx(Translate, { center: [0, 0, zOffset], children: /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
2933
|
+
/* @__PURE__ */ jsxs(Rotate, { rotation: [0, 55, -55], children: [
|
|
2934
|
+
/* @__PURE__ */ jsxs(Subtract, { children: [
|
|
2935
|
+
/* @__PURE__ */ jsx(
|
|
2936
|
+
Cuboid,
|
|
2937
|
+
{
|
|
2938
|
+
color: "#ccc",
|
|
2939
|
+
size: [padLength + 0.1, padWidth, padThickness],
|
|
2940
|
+
center: [padCenterX, 0, padThickness - 2]
|
|
2941
|
+
}
|
|
2942
|
+
),
|
|
2943
|
+
/* @__PURE__ */ jsx(
|
|
2944
|
+
Cylinder,
|
|
2945
|
+
{
|
|
2946
|
+
color: "black",
|
|
2947
|
+
center: [padCenterX, 0, padThickness - 2],
|
|
2948
|
+
radius: padHoleDiameter / 2,
|
|
2949
|
+
height: padThickness * 1.2
|
|
2950
|
+
}
|
|
2951
|
+
)
|
|
2952
|
+
] }),
|
|
2953
|
+
/* @__PURE__ */ jsx(Colorize, { color: "#222", children: /* @__PURE__ */ jsx(
|
|
2954
|
+
ChipBody,
|
|
2955
|
+
{
|
|
2956
|
+
width: bodyWidth,
|
|
2957
|
+
length: bodyLength10,
|
|
2958
|
+
height: bodyHeight,
|
|
2959
|
+
center: { x: fullLength10, y: 0, z: -2.4 },
|
|
2960
|
+
includeNotch: false,
|
|
2961
|
+
straightHeightRatio: 0.3,
|
|
2962
|
+
taperRatio: 0.04,
|
|
2963
|
+
heightAboveSurface: 1
|
|
2964
|
+
}
|
|
2965
|
+
) })
|
|
2966
|
+
] }),
|
|
2967
|
+
/* @__PURE__ */ jsx(Rotate, { rotation: [0, 55, 55], children: Array.from({ length: 3 }).map((_, i) => {
|
|
2968
|
+
const x = prongCenterX;
|
|
2969
|
+
const y = (i - 1) * prongPitch;
|
|
2970
|
+
const z = -prongHeight - 0.6;
|
|
2971
|
+
return /* @__PURE__ */ jsxs(Colorize, { color: "gold", children: [
|
|
2972
|
+
/* @__PURE__ */ jsxs(Hull, { children: [
|
|
2973
|
+
/* @__PURE__ */ jsx(Translate, { center: [bodyFrontX - bodyHeight / 2 + 0.1, y, z], children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyHeight, prongWidth + 1, prongHeight] }) }),
|
|
2974
|
+
/* @__PURE__ */ jsx(
|
|
2975
|
+
Translate,
|
|
2976
|
+
{
|
|
2977
|
+
center: [bodyFrontX - bodyHeight / 2 - 1 + 0.1, y, z],
|
|
2978
|
+
children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyHeight, prongWidth, prongHeight] })
|
|
2979
|
+
}
|
|
2980
|
+
)
|
|
2981
|
+
] }),
|
|
2982
|
+
/* @__PURE__ */ jsx(Translate, { center: [x, y, z], children: /* @__PURE__ */ jsx(Cuboid, { size: [prongLength + 0.1, prongWidth, prongHeight] }) })
|
|
2983
|
+
] }, `prong-${i}`);
|
|
2984
|
+
}) })
|
|
2985
|
+
] }) });
|
|
2986
|
+
};
|
|
2987
|
+
|
|
2886
2988
|
// lib/Footprinter3d.tsx
|
|
2887
2989
|
var Footprinter3d = ({ footprint }) => {
|
|
2888
2990
|
const fpJson = fp.string(footprint).json();
|
|
@@ -3065,6 +3167,8 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
3065
3167
|
);
|
|
3066
3168
|
case "sot723":
|
|
3067
3169
|
return /* @__PURE__ */ jsx(SOT723, {});
|
|
3170
|
+
case "to220":
|
|
3171
|
+
return /* @__PURE__ */ jsx(TO220, {});
|
|
3068
3172
|
}
|
|
3069
3173
|
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
3070
3174
|
const color = colorMatch ? colorMatch[1] : void 0;
|
|
@@ -3130,7 +3234,7 @@ function renderNode(node, colorCtx, renderCtx) {
|
|
|
3130
3234
|
}
|
|
3131
3235
|
if (type === Translate) {
|
|
3132
3236
|
const off = toVec3(
|
|
3133
|
-
props?.offset ?? { x: props?.x, y: props?.y, z: props?.z }
|
|
3237
|
+
props?.offset ?? props?.center ?? { x: props?.x, y: props?.y, z: props?.z }
|
|
3134
3238
|
);
|
|
3135
3239
|
const geoms = (children ?? []).flatMap(
|
|
3136
3240
|
(c) => renderNode(c, colorCtx, renderCtx)
|