jscad-electronics 0.0.172 → 0.0.174

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
@@ -1118,6 +1118,105 @@ var PinRow = ({
1118
1118
  }) });
1119
1119
  };
1120
1120
 
1121
+ // lib/utils/PhysicalQfn.tsx
1122
+ function createPhysicalQfn(p) {
1123
+ const {
1124
+ num_pins,
1125
+ bodyWidth,
1126
+ bodyLength: bodyLength10,
1127
+ bodyHeight,
1128
+ standoff,
1129
+ terminalSpanX,
1130
+ terminalSpanY,
1131
+ terminalThickness,
1132
+ padWidth,
1133
+ padLength,
1134
+ pitch,
1135
+ exposedPadWidth,
1136
+ exposedPadLength
1137
+ } = p;
1138
+ for (const key of [
1139
+ "bodyWidth",
1140
+ "bodyLength",
1141
+ "bodyHeight",
1142
+ "terminalSpanX",
1143
+ "terminalSpanY",
1144
+ "terminalThickness",
1145
+ "padWidth",
1146
+ "padLength",
1147
+ "pitch",
1148
+ "exposedPadWidth",
1149
+ "exposedPadLength"
1150
+ ])
1151
+ if (!Number.isFinite(p[key]) || p[key] <= 0)
1152
+ throw new Error(`${key} must be finite and positive`);
1153
+ if (!Number.isInteger(num_pins) || num_pins < 8 || num_pins % 4)
1154
+ throw new Error("num_pins must be divisible by four and at least eight");
1155
+ if (!Number.isFinite(standoff) || standoff < 0)
1156
+ throw new Error("standoff must be finite and nonnegative");
1157
+ const rowLength = (num_pins / 4 - 1) * pitch + padWidth;
1158
+ if (terminalThickness <= standoff || terminalThickness >= bodyHeight || padWidth >= pitch || rowLength >= Math.min(bodyWidth, bodyLength10))
1159
+ throw new Error("Invalid mold, terminal thickness or spacing");
1160
+ if (terminalSpanX < bodyWidth || terminalSpanY < bodyLength10 || terminalSpanX / 2 - padLength >= bodyWidth / 2 || terminalSpanY / 2 - padLength >= bodyLength10 / 2 || exposedPadWidth >= Math.min(bodyWidth, terminalSpanX - 2 * padLength) || exposedPadLength >= Math.min(bodyLength10, terminalSpanY - 2 * padLength) || rowLength >= Math.min(terminalSpanX, terminalSpanY) - 2 * padLength)
1161
+ throw new Error(
1162
+ "Terminals must enter the mold and clear the exposed pad and corners"
1163
+ );
1164
+ const body = /* @__PURE__ */ jsx(Translate, { z: (bodyHeight + standoff) / 2, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, bodyHeight - standoff] }) });
1165
+ const radius = Math.min(bodyWidth, bodyLength10) * 0.035;
1166
+ return /* @__PURE__ */ jsxs(Fragment2, { children: [
1167
+ /* @__PURE__ */ jsx(Colorize, { color: "#353535", children: /* @__PURE__ */ jsxs(Subtract, { children: [
1168
+ body,
1169
+ /* @__PURE__ */ jsx(
1170
+ Translate,
1171
+ {
1172
+ offset: {
1173
+ x: -bodyWidth / 2 + radius * 2,
1174
+ y: bodyLength10 / 2 - radius * 2,
1175
+ z: bodyHeight
1176
+ },
1177
+ children: /* @__PURE__ */ jsx(
1178
+ Cylinder,
1179
+ {
1180
+ radius,
1181
+ height: Math.min(0.06, (bodyHeight - standoff) / 5)
1182
+ }
1183
+ )
1184
+ }
1185
+ )
1186
+ ] }) }),
1187
+ /* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: Array.from({ length: num_pins }, (_, i) => {
1188
+ const side = Math.floor(i / (num_pins / 4));
1189
+ const along = ((num_pins / 4 - 1) / 2 - i % (num_pins / 4)) * pitch;
1190
+ const horizontal = side % 2 === 0;
1191
+ const sign = side < 2 ? -1 : 1;
1192
+ const across = ((horizontal ? terminalSpanX : terminalSpanY) - padLength) / 2 * sign;
1193
+ return /* @__PURE__ */ jsx(
1194
+ Translate,
1195
+ {
1196
+ offset: {
1197
+ x: horizontal ? across : along,
1198
+ y: horizontal ? along : across,
1199
+ z: terminalThickness / 2
1200
+ },
1201
+ children: /* @__PURE__ */ jsx(
1202
+ Cuboid,
1203
+ {
1204
+ size: horizontal ? [padLength, padWidth, terminalThickness] : [padWidth, padLength, terminalThickness]
1205
+ }
1206
+ )
1207
+ },
1208
+ i
1209
+ );
1210
+ }) }),
1211
+ /* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: /* @__PURE__ */ jsx(Translate, { z: terminalThickness / 2, children: /* @__PURE__ */ jsx(
1212
+ Cuboid,
1213
+ {
1214
+ size: [exposedPadWidth, exposedPadLength, terminalThickness]
1215
+ }
1216
+ ) }) })
1217
+ ] });
1218
+ }
1219
+
1121
1220
  // lib/utils/getQuadCoords.ts
1122
1221
  var getQuadCoords = (params) => {
1123
1222
  const SIDES_CCW = ["left", "bottom", "right", "top"];
@@ -1206,7 +1305,7 @@ var getQuadPinMap = ({
1206
1305
  };
1207
1306
 
1208
1307
  // lib/qfn.tsx
1209
- var QFN = ({
1308
+ var LegacyQFN = ({
1210
1309
  num_pins = 16,
1211
1310
  bodyWidth = 9,
1212
1311
  bodyLength: bodyLength10 = 9,
@@ -1276,6 +1375,7 @@ var QFN = ({
1276
1375
  )
1277
1376
  ] });
1278
1377
  };
1378
+ var QFN = (props) => "bodyHeight" in props ? createPhysicalQfn(props) : LegacyQFN(props);
1279
1379
  var qfn_default = QFN;
1280
1380
 
1281
1381
  // lib/SOT-235.tsx