jscad-electronics 0.0.77 → 0.0.79

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
@@ -2369,6 +2369,74 @@ var LQFP = ({
2369
2369
  ] });
2370
2370
  };
2371
2371
 
2372
+ // lib/dfn.tsx
2373
+ var DFN = ({
2374
+ num_pins,
2375
+ bodyWidth = 5.3,
2376
+ bodyLength: bodyLength10 = 5.3,
2377
+ bodyThickness = 1,
2378
+ thermalPadSize,
2379
+ // For a body length of 5 the typical pad width/length are 0.6 and 1.
2380
+ // Scale those values proportionally when `bodyLength` changes.
2381
+ padWidth = bodyLength10 / 5.3 * 0.6,
2382
+ padLength = bodyLength10 / 5.3 * 1,
2383
+ pitch = 0.5,
2384
+ thermalPadThickness = 0.2
2385
+ }) => {
2386
+ const pinPositions = [];
2387
+ const pinsPerSide = Math.floor(num_pins / 2);
2388
+ const pinSpan = pitch * (pinsPerSide - 1);
2389
+ for (let i = 0; i < num_pins; i++) {
2390
+ const side = i < pinsPerSide ? "left" : "right";
2391
+ const indexOnSide = i % pinsPerSide;
2392
+ const y = pinSpan / 2 - indexOnSide * pitch;
2393
+ const padSizeX = padLength;
2394
+ const padSizeY = padWidth;
2395
+ const x = side === "left" ? -bodyWidth / 2 + padSizeX / 2 : bodyWidth / 2 - padSizeX / 2;
2396
+ const pinNumber = i + 1;
2397
+ pinPositions.push({ pinNumber, x, y, padSizeX, padSizeY });
2398
+ }
2399
+ return /* @__PURE__ */ jsxs(Fragment2, { children: [
2400
+ /* @__PURE__ */ jsx(
2401
+ ChipBody,
2402
+ {
2403
+ center: { x: 0, y: 0, z: 0 },
2404
+ width: bodyWidth,
2405
+ length: bodyLength10,
2406
+ height: bodyThickness,
2407
+ heightAboveSurface: 0,
2408
+ color: "grey",
2409
+ chamferSize: 0.2,
2410
+ taperRatio: 0,
2411
+ notchPosition: {
2412
+ x: bodyWidth / 2 - padLength,
2413
+ y: bodyLength10 / 2 - padLength,
2414
+ z: bodyThickness
2415
+ }
2416
+ }
2417
+ ),
2418
+ pinPositions.map((p, i) => /* @__PURE__ */ jsx(
2419
+ Cuboid,
2420
+ {
2421
+ center: [p.x, p.y, thermalPadThickness / 2],
2422
+ size: [p.padSizeX, p.padSizeY, thermalPadThickness]
2423
+ },
2424
+ i
2425
+ )),
2426
+ thermalPadSize?.length !== void 0 && thermalPadSize?.width !== void 0 && /* @__PURE__ */ jsx(
2427
+ Cuboid,
2428
+ {
2429
+ center: [0, 0, thermalPadThickness / 2],
2430
+ size: [
2431
+ thermalPadSize.width,
2432
+ thermalPadSize.length,
2433
+ thermalPadThickness
2434
+ ]
2435
+ }
2436
+ )
2437
+ ] });
2438
+ };
2439
+
2372
2440
  // lib/Footprinter3d.tsx
2373
2441
  var Footprinter3d = ({ footprint }) => {
2374
2442
  const fpJson = fp.string(footprint).json();
@@ -2413,7 +2481,7 @@ var Footprinter3d = ({ footprint }) => {
2413
2481
  return /* @__PURE__ */ jsx(tqfp_default, {});
2414
2482
  case "lqfp":
2415
2483
  return /* @__PURE__ */ jsx(LQFP, { pinCount: fpJson.num_pins });
2416
- case "qfn":
2484
+ case "qfn": {
2417
2485
  const hasThermalPad = typeof fpJson.thermalpad?.x === "number" && typeof fpJson.thermalpad?.y === "number";
2418
2486
  return /* @__PURE__ */ jsx(
2419
2487
  qfn_default,
@@ -2430,6 +2498,25 @@ var Footprinter3d = ({ footprint }) => {
2430
2498
  } : void 0
2431
2499
  }
2432
2500
  );
2501
+ }
2502
+ case "dfn": {
2503
+ const hasThermalPad = typeof fpJson.thermalpad?.x === "number" && typeof fpJson.thermalpad?.y === "number";
2504
+ return /* @__PURE__ */ jsx(
2505
+ DFN,
2506
+ {
2507
+ num_pins: fpJson.num_pins,
2508
+ bodyWidth: fpJson.w,
2509
+ bodyLength: fpJson.h,
2510
+ pitch: fpJson.p,
2511
+ padLength: fpJson.pl,
2512
+ padWidth: fpJson.pw,
2513
+ thermalPadSize: hasThermalPad ? {
2514
+ width: fpJson.thermalpad.x,
2515
+ length: fpJson.thermalpad.y
2516
+ } : void 0
2517
+ }
2518
+ );
2519
+ }
2433
2520
  case "pinrow":
2434
2521
  if (fpJson.male)
2435
2522
  return /* @__PURE__ */ jsx(PinRow, { numberOfPins: fpJson.num_pins, pitch: fpJson.p });