jscad-electronics 0.0.170 → 0.0.172

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
@@ -426,6 +426,137 @@ var Dip = ({
426
426
  ] });
427
427
  };
428
428
 
429
+ // lib/utils/DualRowGullWing.tsx
430
+ function createDualRowGullWing(p) {
431
+ const {
432
+ pinCount,
433
+ pitch,
434
+ bodyWidth,
435
+ bodyLength: bodyLength10,
436
+ bodyHeight,
437
+ standoff,
438
+ leadSpan,
439
+ leadWidth,
440
+ leadThickness,
441
+ contactLength,
442
+ taperInset,
443
+ exposedPadWidth = 0,
444
+ exposedPadLength = 0
445
+ } = p;
446
+ for (const key of [
447
+ "pitch",
448
+ "bodyWidth",
449
+ "bodyLength",
450
+ "bodyHeight",
451
+ "leadSpan",
452
+ "leadWidth",
453
+ "leadThickness",
454
+ "contactLength"
455
+ ])
456
+ if (!Number.isFinite(p[key]) || p[key] <= 0)
457
+ throw new Error(`${key} must be finite and positive`);
458
+ for (const [name, value] of Object.entries({
459
+ standoff,
460
+ taperInset,
461
+ exposedPadWidth,
462
+ exposedPadLength
463
+ }))
464
+ if (!Number.isFinite(value) || value < 0)
465
+ throw new Error(`${name} must be finite and nonnegative`);
466
+ if (!Number.isInteger(pinCount) || pinCount < 4 || pinCount % 2)
467
+ throw new Error("pinCount must be even and at least 4");
468
+ const moldHeight = bodyHeight - standoff;
469
+ const reach = (leadSpan - bodyWidth) / 2;
470
+ const rowLength = (pinCount / 2 - 1) * pitch + leadWidth;
471
+ if (moldHeight <= leadThickness * 2 || leadWidth >= pitch || rowLength >= bodyLength10 - 2 * taperInset || taperInset * 2 >= Math.min(bodyWidth, bodyLength10) || contactLength >= reach)
472
+ throw new Error("Invalid mold, lead spacing, or terminal reach");
473
+ if (exposedPadWidth === 0 !== (exposedPadLength === 0) || exposedPadWidth >= bodyWidth - 2 * taperInset || exposedPadLength >= bodyLength10 - 2 * taperInset)
474
+ throw new Error("Exposed pad must fit inside the bottom mold face");
475
+ const midZ = standoff + moldHeight / 2;
476
+ const slice = Math.min(2e-3, moldHeight / 100);
477
+ const body = /* @__PURE__ */ jsxs(Hull, { children: [
478
+ /* @__PURE__ */ jsx(Translate, { z: standoff + slice / 2, children: /* @__PURE__ */ jsx(
479
+ Cuboid,
480
+ {
481
+ size: [
482
+ bodyWidth - 2 * taperInset,
483
+ bodyLength10 - 2 * taperInset,
484
+ slice
485
+ ]
486
+ }
487
+ ) }),
488
+ /* @__PURE__ */ jsx(Translate, { z: midZ, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, slice] }) }),
489
+ /* @__PURE__ */ jsx(Translate, { z: bodyHeight - slice / 2, children: /* @__PURE__ */ jsx(
490
+ Cuboid,
491
+ {
492
+ size: [
493
+ bodyWidth - 2 * taperInset,
494
+ bodyLength10 - 2 * taperInset,
495
+ slice
496
+ ]
497
+ }
498
+ ) })
499
+ ] });
500
+ const dimpleRadius = Math.min(bodyWidth, bodyLength10) * 0.045;
501
+ const dimpleDepth = Math.min(0.04, moldHeight / 10);
502
+ const lead = (side, y) => {
503
+ const outer = leadSpan / 2;
504
+ const root = bodyWidth / 2 - Math.min(bodyWidth / 8, 0.15);
505
+ const bendStart = outer - contactLength;
506
+ const bendEnd = bodyWidth / 2 + Math.min(0.08, (reach - contactLength) / 4);
507
+ const points = [
508
+ [outer - slice / 2, leadThickness / 2],
509
+ [bendStart, leadThickness / 2]
510
+ ];
511
+ for (let i = 1; i <= 12; i++) {
512
+ const t = i / 12;
513
+ points.push([
514
+ bendStart + (bendEnd - bendStart) * t,
515
+ leadThickness / 2 + (midZ - leadThickness / 2) * t * t * (3 - 2 * t)
516
+ ]);
517
+ }
518
+ points.push([root, midZ]);
519
+ const section = ([x, z]) => /* @__PURE__ */ jsx(Translate, { offset: { x: side * x, y, z }, children: /* @__PURE__ */ jsx(Cuboid, { size: [slice, leadWidth, leadThickness] }) });
520
+ return /* @__PURE__ */ jsx(Union, { children: points.slice(1).map((point, i) => /* @__PURE__ */ jsxs(Hull, { children: [
521
+ section(points[i]),
522
+ section(point)
523
+ ] }, i)) });
524
+ };
525
+ return /* @__PURE__ */ jsxs(Fragment2, { children: [
526
+ /* @__PURE__ */ jsx(Colorize, { color: "#353535", children: /* @__PURE__ */ jsxs(Subtract, { children: [
527
+ body,
528
+ /* @__PURE__ */ jsx(
529
+ Translate,
530
+ {
531
+ offset: {
532
+ x: -bodyWidth / 2 + taperInset + dimpleRadius * 2,
533
+ y: bodyLength10 / 2 - taperInset - dimpleRadius * 2,
534
+ z: bodyHeight
535
+ },
536
+ children: /* @__PURE__ */ jsx(Cylinder, { radius: dimpleRadius, height: dimpleDepth * 2 })
537
+ }
538
+ )
539
+ ] }) }),
540
+ /* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: Array.from(
541
+ { length: pinCount },
542
+ (_, i) => lead(
543
+ i < pinCount / 2 ? -1 : 1,
544
+ ((pinCount / 2 - 1) / 2 - i % (pinCount / 2)) * pitch
545
+ )
546
+ ) }),
547
+ exposedPadWidth > 0 && /* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: /* @__PURE__ */ jsx(Translate, { z: (standoff + leadThickness) / 2, children: /* @__PURE__ */ jsx(
548
+ Cuboid,
549
+ {
550
+ size: [
551
+ exposedPadWidth,
552
+ exposedPadLength,
553
+ standoff + leadThickness
554
+ ]
555
+ }
556
+ ) }) })
557
+ ] });
558
+ }
559
+
429
560
  // lib/SmdChipLead.tsx
430
561
  function calculateSCurve(x, {
431
562
  height: height10,
@@ -456,7 +587,7 @@ var SmdChipLead = (props) => {
456
587
  };
457
588
 
458
589
  // lib/Tssop.tsx
459
- var Tssop = ({
590
+ var LegacyTssop = ({
460
591
  pinCount,
461
592
  leadLength,
462
593
  leadWidth,
@@ -534,9 +665,10 @@ var Tssop = ({
534
665
  )
535
666
  ] });
536
667
  };
668
+ var Tssop = (props) => "leadSpan" in props ? createDualRowGullWing(props) : LegacyTssop(props);
537
669
 
538
670
  // lib/MSOP.tsx
539
- var MSOP = ({
671
+ var LegacyMSOP = ({
540
672
  pinCount,
541
673
  padContactLength = 0.4,
542
674
  leadWidth = 0.2,
@@ -594,6 +726,7 @@ var MSOP = ({
594
726
  )
595
727
  ] });
596
728
  };
729
+ var MSOP = (props) => "leadSpan" in props ? createDualRowGullWing(props) : LegacyMSOP(props);
597
730
 
598
731
  // lib/A0402.tsx
599
732
  var fullLength = 1;
@@ -1912,137 +2045,6 @@ var PushButtonLeg = (props) => {
1912
2045
  ) });
1913
2046
  };
1914
2047
 
1915
- // lib/utils/DualRowGullWing.tsx
1916
- function createDualRowGullWing(p) {
1917
- const {
1918
- pinCount,
1919
- pitch,
1920
- bodyWidth,
1921
- bodyLength: bodyLength10,
1922
- bodyHeight,
1923
- standoff,
1924
- leadSpan,
1925
- leadWidth,
1926
- leadThickness,
1927
- contactLength,
1928
- taperInset,
1929
- exposedPadWidth = 0,
1930
- exposedPadLength = 0
1931
- } = p;
1932
- for (const key of [
1933
- "pitch",
1934
- "bodyWidth",
1935
- "bodyLength",
1936
- "bodyHeight",
1937
- "leadSpan",
1938
- "leadWidth",
1939
- "leadThickness",
1940
- "contactLength"
1941
- ])
1942
- if (!Number.isFinite(p[key]) || p[key] <= 0)
1943
- throw new Error(`${key} must be finite and positive`);
1944
- for (const [name, value] of Object.entries({
1945
- standoff,
1946
- taperInset,
1947
- exposedPadWidth,
1948
- exposedPadLength
1949
- }))
1950
- if (!Number.isFinite(value) || value < 0)
1951
- throw new Error(`${name} must be finite and nonnegative`);
1952
- if (!Number.isInteger(pinCount) || pinCount < 4 || pinCount % 2)
1953
- throw new Error("pinCount must be even and at least 4");
1954
- const moldHeight = bodyHeight - standoff;
1955
- const reach = (leadSpan - bodyWidth) / 2;
1956
- const rowLength = (pinCount / 2 - 1) * pitch + leadWidth;
1957
- if (moldHeight <= leadThickness * 2 || leadWidth >= pitch || rowLength >= bodyLength10 - 2 * taperInset || taperInset * 2 >= Math.min(bodyWidth, bodyLength10) || contactLength >= reach)
1958
- throw new Error("Invalid mold, lead spacing, or terminal reach");
1959
- if (exposedPadWidth === 0 !== (exposedPadLength === 0) || exposedPadWidth >= bodyWidth - 2 * taperInset || exposedPadLength >= bodyLength10 - 2 * taperInset)
1960
- throw new Error("Exposed pad must fit inside the bottom mold face");
1961
- const midZ = standoff + moldHeight / 2;
1962
- const slice = Math.min(2e-3, moldHeight / 100);
1963
- const body = /* @__PURE__ */ jsxs(Hull, { children: [
1964
- /* @__PURE__ */ jsx(Translate, { z: standoff + slice / 2, children: /* @__PURE__ */ jsx(
1965
- Cuboid,
1966
- {
1967
- size: [
1968
- bodyWidth - 2 * taperInset,
1969
- bodyLength10 - 2 * taperInset,
1970
- slice
1971
- ]
1972
- }
1973
- ) }),
1974
- /* @__PURE__ */ jsx(Translate, { z: midZ, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, slice] }) }),
1975
- /* @__PURE__ */ jsx(Translate, { z: bodyHeight - slice / 2, children: /* @__PURE__ */ jsx(
1976
- Cuboid,
1977
- {
1978
- size: [
1979
- bodyWidth - 2 * taperInset,
1980
- bodyLength10 - 2 * taperInset,
1981
- slice
1982
- ]
1983
- }
1984
- ) })
1985
- ] });
1986
- const dimpleRadius = Math.min(bodyWidth, bodyLength10) * 0.045;
1987
- const dimpleDepth = Math.min(0.04, moldHeight / 10);
1988
- const lead = (side, y) => {
1989
- const outer = leadSpan / 2;
1990
- const root = bodyWidth / 2 - Math.min(bodyWidth / 8, 0.15);
1991
- const bendStart = outer - contactLength;
1992
- const bendEnd = bodyWidth / 2 + Math.min(0.08, (reach - contactLength) / 4);
1993
- const points = [
1994
- [outer - slice / 2, leadThickness / 2],
1995
- [bendStart, leadThickness / 2]
1996
- ];
1997
- for (let i = 1; i <= 12; i++) {
1998
- const t = i / 12;
1999
- points.push([
2000
- bendStart + (bendEnd - bendStart) * t,
2001
- leadThickness / 2 + (midZ - leadThickness / 2) * t * t * (3 - 2 * t)
2002
- ]);
2003
- }
2004
- points.push([root, midZ]);
2005
- const section = ([x, z]) => /* @__PURE__ */ jsx(Translate, { offset: { x: side * x, y, z }, children: /* @__PURE__ */ jsx(Cuboid, { size: [slice, leadWidth, leadThickness] }) });
2006
- return /* @__PURE__ */ jsx(Union, { children: points.slice(1).map((point, i) => /* @__PURE__ */ jsxs(Hull, { children: [
2007
- section(points[i]),
2008
- section(point)
2009
- ] }, i)) });
2010
- };
2011
- return /* @__PURE__ */ jsxs(Fragment2, { children: [
2012
- /* @__PURE__ */ jsx(Colorize, { color: "#353535", children: /* @__PURE__ */ jsxs(Subtract, { children: [
2013
- body,
2014
- /* @__PURE__ */ jsx(
2015
- Translate,
2016
- {
2017
- offset: {
2018
- x: -bodyWidth / 2 + taperInset + dimpleRadius * 2,
2019
- y: bodyLength10 / 2 - taperInset - dimpleRadius * 2,
2020
- z: bodyHeight
2021
- },
2022
- children: /* @__PURE__ */ jsx(Cylinder, { radius: dimpleRadius, height: dimpleDepth * 2 })
2023
- }
2024
- )
2025
- ] }) }),
2026
- /* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: Array.from(
2027
- { length: pinCount },
2028
- (_, i) => lead(
2029
- i < pinCount / 2 ? -1 : 1,
2030
- ((pinCount / 2 - 1) / 2 - i % (pinCount / 2)) * pitch
2031
- )
2032
- ) }),
2033
- exposedPadWidth > 0 && /* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: /* @__PURE__ */ jsx(Translate, { z: (standoff + leadThickness) / 2, children: /* @__PURE__ */ jsx(
2034
- Cuboid,
2035
- {
2036
- size: [
2037
- exposedPadWidth,
2038
- exposedPadLength,
2039
- standoff + leadThickness
2040
- ]
2041
- }
2042
- ) }) })
2043
- ] });
2044
- }
2045
-
2046
2048
  // lib/SOIC.tsx
2047
2049
  var LegacySOIC = ({
2048
2050
  pinCount,
@@ -3186,8 +3188,143 @@ var SOT323 = () => {
3186
3188
  ] });
3187
3189
  };
3188
3190
 
3191
+ // lib/utils/PhysicalLqfp.tsx
3192
+ function createPhysicalLqfp(p) {
3193
+ const {
3194
+ pinCount,
3195
+ pitch,
3196
+ bodyWidth,
3197
+ bodyLength: bodyLength10,
3198
+ bodyHeight,
3199
+ standoff,
3200
+ leadSpanX,
3201
+ leadSpanY,
3202
+ leadWidth,
3203
+ leadThickness,
3204
+ contactLength,
3205
+ taperInset
3206
+ } = p;
3207
+ for (const key of [
3208
+ "pitch",
3209
+ "bodyWidth",
3210
+ "bodyLength",
3211
+ "bodyHeight",
3212
+ "leadSpanX",
3213
+ "leadSpanY",
3214
+ "leadWidth",
3215
+ "leadThickness",
3216
+ "contactLength"
3217
+ ])
3218
+ if (!Number.isFinite(p[key]) || p[key] <= 0)
3219
+ throw new Error(`${key} must be finite and positive`);
3220
+ for (const [name, value] of Object.entries({
3221
+ standoff,
3222
+ taperInset
3223
+ }))
3224
+ if (!Number.isFinite(value) || value < 0)
3225
+ throw new Error(`${name} must be finite and nonnegative`);
3226
+ if (!Number.isInteger(pinCount) || pinCount < 8 || pinCount % 4)
3227
+ throw new Error("pinCount must be divisible by four and at least eight");
3228
+ const moldHeight = bodyHeight - standoff;
3229
+ const reach = Math.min(leadSpanX - bodyWidth, leadSpanY - bodyLength10) / 2;
3230
+ const rowLength = (pinCount / 4 - 1) * pitch + leadWidth;
3231
+ if (moldHeight <= leadThickness * 2 || leadWidth >= pitch || rowLength >= Math.min(bodyWidth, bodyLength10) - 2 * taperInset || taperInset * 2 >= Math.min(bodyWidth, bodyLength10) || contactLength >= reach)
3232
+ throw new Error("Invalid mold, lead spacing, or terminal reach");
3233
+ const midZ = standoff + moldHeight / 2;
3234
+ const slice = Math.min(2e-3, moldHeight / 100);
3235
+ const body = /* @__PURE__ */ jsxs(Hull, { children: [
3236
+ /* @__PURE__ */ jsx(Translate, { z: standoff + slice / 2, children: /* @__PURE__ */ jsx(
3237
+ Cuboid,
3238
+ {
3239
+ size: [
3240
+ bodyWidth - 2 * taperInset,
3241
+ bodyLength10 - 2 * taperInset,
3242
+ slice
3243
+ ]
3244
+ }
3245
+ ) }),
3246
+ /* @__PURE__ */ jsx(Translate, { z: midZ, children: /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyLength10, slice] }) }),
3247
+ /* @__PURE__ */ jsx(Translate, { z: bodyHeight - slice / 2, children: /* @__PURE__ */ jsx(
3248
+ Cuboid,
3249
+ {
3250
+ size: [
3251
+ bodyWidth - 2 * taperInset,
3252
+ bodyLength10 - 2 * taperInset,
3253
+ slice
3254
+ ]
3255
+ }
3256
+ ) })
3257
+ ] });
3258
+ const dimpleRadius = Math.min(bodyWidth, bodyLength10) * 0.045;
3259
+ const dimpleDepth = Math.min(0.04, moldHeight / 10);
3260
+ const lead = (side, along) => {
3261
+ const horizontal = side % 2 === 0;
3262
+ const sign = side < 2 ? -1 : 1;
3263
+ const width10 = horizontal ? bodyWidth : bodyLength10;
3264
+ const outer = (horizontal ? leadSpanX : leadSpanY) / 2;
3265
+ const root = width10 / 2 - Math.min(width10 / 8, 0.15);
3266
+ const bendStart = outer - contactLength;
3267
+ const bendEnd = width10 / 2 + Math.min(0.08, (reach - contactLength) / 4);
3268
+ const points = [
3269
+ [outer - slice / 2, leadThickness / 2],
3270
+ [bendStart, leadThickness / 2]
3271
+ ];
3272
+ for (let i = 1; i <= 12; i++) {
3273
+ const t = i / 12;
3274
+ points.push([
3275
+ bendStart + (bendEnd - bendStart) * t,
3276
+ leadThickness / 2 + (midZ - leadThickness / 2) * t * t * (3 - 2 * t)
3277
+ ]);
3278
+ }
3279
+ points.push([root, midZ]);
3280
+ const section = ([x, z]) => /* @__PURE__ */ jsx(
3281
+ Translate,
3282
+ {
3283
+ offset: {
3284
+ x: horizontal ? sign * x : along,
3285
+ y: horizontal ? along : sign * x,
3286
+ z
3287
+ },
3288
+ children: /* @__PURE__ */ jsx(
3289
+ Cuboid,
3290
+ {
3291
+ size: horizontal ? [slice, leadWidth, leadThickness] : [leadWidth, slice, leadThickness]
3292
+ }
3293
+ )
3294
+ }
3295
+ );
3296
+ return /* @__PURE__ */ jsx(Union, { children: points.slice(1).map((point, i) => /* @__PURE__ */ jsxs(Hull, { children: [
3297
+ section(points[i]),
3298
+ section(point)
3299
+ ] }, i)) });
3300
+ };
3301
+ return /* @__PURE__ */ jsxs(Fragment2, { children: [
3302
+ /* @__PURE__ */ jsx(Colorize, { color: "#353535", children: /* @__PURE__ */ jsxs(Subtract, { children: [
3303
+ body,
3304
+ /* @__PURE__ */ jsx(
3305
+ Translate,
3306
+ {
3307
+ offset: {
3308
+ x: -bodyWidth / 2 + taperInset + dimpleRadius * 2,
3309
+ y: bodyLength10 / 2 - taperInset - dimpleRadius * 2,
3310
+ z: bodyHeight
3311
+ },
3312
+ children: /* @__PURE__ */ jsx(Cylinder, { radius: dimpleRadius, height: dimpleDepth * 2 })
3313
+ }
3314
+ )
3315
+ ] }) }),
3316
+ /* @__PURE__ */ jsx(Colorize, { color: "#bfc1c4", children: Array.from(
3317
+ { length: pinCount },
3318
+ (_, i) => lead(
3319
+ Math.floor(i / (pinCount / 4)),
3320
+ ((pinCount / 4 - 1) / 2 - i % (pinCount / 4)) * pitch
3321
+ )
3322
+ ) })
3323
+ ] });
3324
+ }
3325
+
3189
3326
  // lib/lqfp.tsx
3190
- var LQFP = ({
3327
+ var LegacyLQFP = ({
3191
3328
  pinCount,
3192
3329
  pitch,
3193
3330
  leadWidth,
@@ -3297,6 +3434,7 @@ var LQFP = ({
3297
3434
  )
3298
3435
  ] });
3299
3436
  };
3437
+ var LQFP = (props) => "leadSpanX" in props ? createPhysicalLqfp(props) : LegacyLQFP(props);
3300
3438
 
3301
3439
  // lib/SOT-723.tsx
3302
3440
  var SOT723 = () => {