jscad-electronics 0.0.79 → 0.0.80
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 +23 -1
- package/dist/index.js +151 -66
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +90 -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,86 @@ 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
|
+
|
|
2440
2521
|
// lib/Footprinter3d.tsx
|
|
2441
2522
|
var Footprinter3d = ({ footprint }) => {
|
|
2442
2523
|
const fpJson = fp.string(footprint).json();
|
|
@@ -2586,6 +2667,8 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
2586
2667
|
return /* @__PURE__ */ jsx(SOD123FL, {});
|
|
2587
2668
|
case "sod923":
|
|
2588
2669
|
return /* @__PURE__ */ jsx(SOD923, {});
|
|
2670
|
+
case "hc49":
|
|
2671
|
+
return /* @__PURE__ */ jsx(HC49, {});
|
|
2589
2672
|
}
|
|
2590
2673
|
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
2591
2674
|
const color = colorMatch ? colorMatch[1] : void 0;
|
|
@@ -2711,7 +2794,7 @@ function renderNode(node, colorCtx, renderCtx) {
|
|
|
2711
2794
|
}
|
|
2712
2795
|
return [{ geom: g3, color: colorCtx ?? props?.color }];
|
|
2713
2796
|
}
|
|
2714
|
-
if (type === Cuboid || type === Cube || type === Cylinder || type === Sphere || type === RoundedCuboid) {
|
|
2797
|
+
if (type === Cuboid || type === Cube || type === Cylinder || type === Sphere || type === RoundedCuboid || type === RoundedCylinder) {
|
|
2715
2798
|
let g;
|
|
2716
2799
|
if (type === Cuboid) {
|
|
2717
2800
|
const size = props?.size ?? [1, 1, 1];
|
|
@@ -2732,6 +2815,12 @@ function renderNode(node, colorCtx, renderCtx) {
|
|
|
2732
2815
|
const radius = props?.radius ?? 1;
|
|
2733
2816
|
const center = props?.center ?? [0, 0, 0];
|
|
2734
2817
|
g = primitives.sphere({ radius, center });
|
|
2818
|
+
} else if (type === RoundedCylinder) {
|
|
2819
|
+
const height10 = props?.height ?? 1;
|
|
2820
|
+
const radius = props?.radius ?? 1;
|
|
2821
|
+
const roundRadius = props?.roundRadius ?? 0.1;
|
|
2822
|
+
const center = props?.center ?? [0, 0, 0];
|
|
2823
|
+
g = primitives.roundedCylinder({ height: height10, radius, roundRadius, center });
|
|
2735
2824
|
} else {
|
|
2736
2825
|
const size = props?.size ?? [1, 1, 1];
|
|
2737
2826
|
const roundRadius = props?.roundRadius ?? 0.1;
|