jscad-electronics 0.0.90 → 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/vanilla.js CHANGED
@@ -2910,6 +2910,81 @@ var MS012 = ({
2910
2910
  ] });
2911
2911
  };
2912
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
+
2913
2988
  // lib/Footprinter3d.tsx
2914
2989
  var Footprinter3d = ({ footprint }) => {
2915
2990
  const fpJson = fp.string(footprint).json();
@@ -3092,6 +3167,8 @@ var Footprinter3d = ({ footprint }) => {
3092
3167
  );
3093
3168
  case "sot723":
3094
3169
  return /* @__PURE__ */ jsx(SOT723, {});
3170
+ case "to220":
3171
+ return /* @__PURE__ */ jsx(TO220, {});
3095
3172
  }
3096
3173
  const colorMatch = footprint.match(/_color\(([^)]+)\)/);
3097
3174
  const color = colorMatch ? colorMatch[1] : void 0;
@@ -3157,7 +3234,7 @@ function renderNode(node, colorCtx, renderCtx) {
3157
3234
  }
3158
3235
  if (type === Translate) {
3159
3236
  const off = toVec3(
3160
- 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 }
3161
3238
  );
3162
3239
  const geoms = (children ?? []).flatMap(
3163
3240
  (c) => renderNode(c, colorCtx, renderCtx)