jscad-electronics 0.0.79 → 0.0.81
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 +30 -1
- package/dist/index.js +227 -66
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +164 -1
- package/dist/vanilla.js.map +1 -1
- package/package.json +1 -1
package/dist/vanilla.js
CHANGED
|
@@ -35,6 +35,7 @@ var Hull = Symbol("Hull");
|
|
|
35
35
|
var Colorize = Symbol("Colorize");
|
|
36
36
|
var Polygon = Symbol("Polygon");
|
|
37
37
|
var ExtrudeLinear = Symbol("ExtrudeLinear");
|
|
38
|
+
var RoundedCylinder = Symbol("RoundedCylinder");
|
|
38
39
|
|
|
39
40
|
// lib/vanilla/react-shim.ts
|
|
40
41
|
var Fragment2 = Fragment;
|
|
@@ -2437,6 +2438,150 @@ var DFN = ({
|
|
|
2437
2438
|
] });
|
|
2438
2439
|
};
|
|
2439
2440
|
|
|
2441
|
+
// lib/hc49.tsx
|
|
2442
|
+
var HC49 = ({
|
|
2443
|
+
bodyLength: bodyLength10 = 10.2,
|
|
2444
|
+
bodyWidth = 4.65,
|
|
2445
|
+
bodyHeight = 13.46,
|
|
2446
|
+
leadSpacing = 5,
|
|
2447
|
+
leadDiameter = 0.8,
|
|
2448
|
+
leadLength = 12.7,
|
|
2449
|
+
color = "#ddd",
|
|
2450
|
+
leadColor = "#b87333"
|
|
2451
|
+
}) => {
|
|
2452
|
+
const halfLength = bodyLength10 / 2;
|
|
2453
|
+
const endRadius = bodyWidth / 2;
|
|
2454
|
+
const endCenterX = halfLength - endRadius;
|
|
2455
|
+
const leadCenterX = leadSpacing / 2;
|
|
2456
|
+
const baseHeight = 0.85;
|
|
2457
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
2458
|
+
/* @__PURE__ */ jsxs(Colorize, { color, children: [
|
|
2459
|
+
/* @__PURE__ */ jsxs(Hull, { children: [
|
|
2460
|
+
/* @__PURE__ */ jsx(
|
|
2461
|
+
RoundedCylinder,
|
|
2462
|
+
{
|
|
2463
|
+
height: bodyHeight,
|
|
2464
|
+
roundRadius: 0.5,
|
|
2465
|
+
radius: endRadius,
|
|
2466
|
+
center: [-endCenterX, 0, bodyHeight]
|
|
2467
|
+
}
|
|
2468
|
+
),
|
|
2469
|
+
/* @__PURE__ */ jsx(
|
|
2470
|
+
RoundedCylinder,
|
|
2471
|
+
{
|
|
2472
|
+
height: bodyHeight,
|
|
2473
|
+
roundRadius: 0.5,
|
|
2474
|
+
radius: endRadius,
|
|
2475
|
+
center: [endCenterX, 0, bodyHeight]
|
|
2476
|
+
}
|
|
2477
|
+
)
|
|
2478
|
+
] }),
|
|
2479
|
+
/* @__PURE__ */ jsxs(Hull, { children: [
|
|
2480
|
+
/* @__PURE__ */ jsx(
|
|
2481
|
+
RoundedCylinder,
|
|
2482
|
+
{
|
|
2483
|
+
height: baseHeight,
|
|
2484
|
+
roundRadius: 0.1,
|
|
2485
|
+
radius: endRadius + 0.85,
|
|
2486
|
+
center: [-endCenterX, 0, bodyHeight / 2 + baseHeight / 2]
|
|
2487
|
+
}
|
|
2488
|
+
),
|
|
2489
|
+
/* @__PURE__ */ jsx(
|
|
2490
|
+
RoundedCylinder,
|
|
2491
|
+
{
|
|
2492
|
+
height: baseHeight,
|
|
2493
|
+
roundRadius: 0.1,
|
|
2494
|
+
radius: endRadius + 0.85,
|
|
2495
|
+
center: [endCenterX, 0, bodyHeight / 2 + baseHeight / 2]
|
|
2496
|
+
}
|
|
2497
|
+
)
|
|
2498
|
+
] })
|
|
2499
|
+
] }),
|
|
2500
|
+
/* @__PURE__ */ jsxs(Colorize, { color: leadColor, children: [
|
|
2501
|
+
/* @__PURE__ */ jsx(
|
|
2502
|
+
Cylinder,
|
|
2503
|
+
{
|
|
2504
|
+
height: leadLength + bodyHeight / 2,
|
|
2505
|
+
radius: leadDiameter / 2,
|
|
2506
|
+
center: [-leadCenterX + 0.06, 0, -(leadLength / 2) + bodyHeight / 2]
|
|
2507
|
+
}
|
|
2508
|
+
),
|
|
2509
|
+
/* @__PURE__ */ jsx(
|
|
2510
|
+
Cylinder,
|
|
2511
|
+
{
|
|
2512
|
+
height: leadLength + bodyHeight / 2,
|
|
2513
|
+
radius: leadDiameter / 2,
|
|
2514
|
+
center: [leadCenterX - 0.06, 0, -(leadLength / 2) + bodyHeight / 2]
|
|
2515
|
+
}
|
|
2516
|
+
)
|
|
2517
|
+
] })
|
|
2518
|
+
] });
|
|
2519
|
+
};
|
|
2520
|
+
|
|
2521
|
+
// lib/ms012.tsx
|
|
2522
|
+
var MS012 = ({
|
|
2523
|
+
pinCount,
|
|
2524
|
+
padContactLength = 0.6,
|
|
2525
|
+
leadWidth = 0.41,
|
|
2526
|
+
pitch = 1.27
|
|
2527
|
+
}) => {
|
|
2528
|
+
if (pinCount % 2 !== 0) {
|
|
2529
|
+
throw new Error("MS012 pinCount must be even");
|
|
2530
|
+
}
|
|
2531
|
+
const sidePinCount = pinCount / 2;
|
|
2532
|
+
const bodyWidth = 4.9;
|
|
2533
|
+
const bodyLength10 = 3.9;
|
|
2534
|
+
const pinOffsetToCenter = (sidePinCount - 1) * pitch / 2;
|
|
2535
|
+
const leadThickness = 0.2;
|
|
2536
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
2537
|
+
Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx(
|
|
2538
|
+
SmdChipLead,
|
|
2539
|
+
{
|
|
2540
|
+
position: {
|
|
2541
|
+
x: -bodyLength10 / 2 - padContactLength - 0.3,
|
|
2542
|
+
y: i * pitch - pinOffsetToCenter,
|
|
2543
|
+
z: leadThickness / 2
|
|
2544
|
+
},
|
|
2545
|
+
width: leadWidth,
|
|
2546
|
+
thickness: leadThickness,
|
|
2547
|
+
padContactLength,
|
|
2548
|
+
bodyDistance: padContactLength + 0.4,
|
|
2549
|
+
height: 0.85
|
|
2550
|
+
},
|
|
2551
|
+
i
|
|
2552
|
+
)),
|
|
2553
|
+
Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx(
|
|
2554
|
+
SmdChipLead,
|
|
2555
|
+
{
|
|
2556
|
+
rotation: Math.PI,
|
|
2557
|
+
position: {
|
|
2558
|
+
x: bodyLength10 / 2 + padContactLength + 0.3,
|
|
2559
|
+
y: i * pitch - pinOffsetToCenter,
|
|
2560
|
+
z: leadThickness / 2
|
|
2561
|
+
},
|
|
2562
|
+
width: leadWidth,
|
|
2563
|
+
thickness: leadThickness,
|
|
2564
|
+
padContactLength,
|
|
2565
|
+
bodyDistance: padContactLength + 0.4,
|
|
2566
|
+
height: 0.85
|
|
2567
|
+
},
|
|
2568
|
+
`right-${i}`
|
|
2569
|
+
)),
|
|
2570
|
+
/* @__PURE__ */ jsx(
|
|
2571
|
+
ChipBody,
|
|
2572
|
+
{
|
|
2573
|
+
center: { x: 0, y: 0, z: leadThickness / 2 },
|
|
2574
|
+
width: bodyLength10,
|
|
2575
|
+
length: bodyWidth,
|
|
2576
|
+
height: 1.55,
|
|
2577
|
+
notchPosition: { x: bodyLength10 / 2 - 1, y: bodyWidth / 2 - 1, z: 1.55 },
|
|
2578
|
+
heightAboveSurface: 0.17,
|
|
2579
|
+
taperRatio: 0.09
|
|
2580
|
+
}
|
|
2581
|
+
)
|
|
2582
|
+
] });
|
|
2583
|
+
};
|
|
2584
|
+
|
|
2440
2585
|
// lib/Footprinter3d.tsx
|
|
2441
2586
|
var Footprinter3d = ({ footprint }) => {
|
|
2442
2587
|
const fpJson = fp.string(footprint).json();
|
|
@@ -2586,6 +2731,18 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
2586
2731
|
return /* @__PURE__ */ jsx(SOD123FL, {});
|
|
2587
2732
|
case "sod923":
|
|
2588
2733
|
return /* @__PURE__ */ jsx(SOD923, {});
|
|
2734
|
+
case "hc49":
|
|
2735
|
+
return /* @__PURE__ */ jsx(HC49, {});
|
|
2736
|
+
case "ms012":
|
|
2737
|
+
return /* @__PURE__ */ jsx(
|
|
2738
|
+
MS012,
|
|
2739
|
+
{
|
|
2740
|
+
pinCount: fpJson.num_pins,
|
|
2741
|
+
padContactLength: fpJson.pl,
|
|
2742
|
+
leadWidth: fpJson.pw,
|
|
2743
|
+
pitch: fpJson.p
|
|
2744
|
+
}
|
|
2745
|
+
);
|
|
2589
2746
|
}
|
|
2590
2747
|
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
2591
2748
|
const color = colorMatch ? colorMatch[1] : void 0;
|
|
@@ -2711,7 +2868,7 @@ function renderNode(node, colorCtx, renderCtx) {
|
|
|
2711
2868
|
}
|
|
2712
2869
|
return [{ geom: g3, color: colorCtx ?? props?.color }];
|
|
2713
2870
|
}
|
|
2714
|
-
if (type === Cuboid || type === Cube || type === Cylinder || type === Sphere || type === RoundedCuboid) {
|
|
2871
|
+
if (type === Cuboid || type === Cube || type === Cylinder || type === Sphere || type === RoundedCuboid || type === RoundedCylinder) {
|
|
2715
2872
|
let g;
|
|
2716
2873
|
if (type === Cuboid) {
|
|
2717
2874
|
const size = props?.size ?? [1, 1, 1];
|
|
@@ -2732,6 +2889,12 @@ function renderNode(node, colorCtx, renderCtx) {
|
|
|
2732
2889
|
const radius = props?.radius ?? 1;
|
|
2733
2890
|
const center = props?.center ?? [0, 0, 0];
|
|
2734
2891
|
g = primitives.sphere({ radius, center });
|
|
2892
|
+
} else if (type === RoundedCylinder) {
|
|
2893
|
+
const height10 = props?.height ?? 1;
|
|
2894
|
+
const radius = props?.radius ?? 1;
|
|
2895
|
+
const roundRadius = props?.roundRadius ?? 0.1;
|
|
2896
|
+
const center = props?.center ?? [0, 0, 0];
|
|
2897
|
+
g = primitives.roundedCylinder({ height: height10, radius, roundRadius, center });
|
|
2735
2898
|
} else {
|
|
2736
2899
|
const size = props?.size ?? [1, 1, 1];
|
|
2737
2900
|
const roundRadius = props?.roundRadius ?? 0.1;
|