jscad-electronics 0.0.100 → 0.0.101
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 +4 -2
- package/dist/index.js +22 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -84,12 +84,14 @@ declare const ExtrudedPads: ({ circuitJson, footprint, }: {
|
|
|
84
84
|
footprint?: string;
|
|
85
85
|
}) => react_jsx_runtime.JSX.Element;
|
|
86
86
|
|
|
87
|
-
declare const FootprintPad: ({ pad }: {
|
|
87
|
+
declare const FootprintPad: ({ pad, isPin1, }: {
|
|
88
88
|
pad: PcbSmtPad;
|
|
89
|
+
isPin1?: boolean;
|
|
89
90
|
}) => react_jsx_runtime.JSX.Element;
|
|
90
91
|
|
|
91
|
-
declare const FootprintPlatedHole: ({ hole }: {
|
|
92
|
+
declare const FootprintPlatedHole: ({ hole, isPin1, }: {
|
|
92
93
|
hole: PcbPlatedHole;
|
|
94
|
+
isPin1?: boolean;
|
|
93
95
|
}) => react_jsx_runtime.JSX.Element;
|
|
94
96
|
|
|
95
97
|
/**
|
package/dist/index.js
CHANGED
|
@@ -466,9 +466,13 @@ import { fp as fp2 } from "@tscircuit/footprinter";
|
|
|
466
466
|
// lib/FootprintPad.tsx
|
|
467
467
|
import { Colorize as Colorize3, Cuboid as Cuboid12, Translate as Translate4 } from "jscad-fiber";
|
|
468
468
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
469
|
-
var FootprintPad = ({
|
|
469
|
+
var FootprintPad = ({
|
|
470
|
+
pad,
|
|
471
|
+
isPin1
|
|
472
|
+
}) => {
|
|
470
473
|
if (pad.shape === "rect") {
|
|
471
|
-
|
|
474
|
+
const color = isPin1 ? [0, 255, 0] : [255, 0, 0];
|
|
475
|
+
return /* @__PURE__ */ jsx12(Colorize3, { color, children: /* @__PURE__ */ jsx12(Translate4, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx12(Cuboid12, { size: [pad.width, pad.height, 0.01] }) }) });
|
|
472
476
|
} else {
|
|
473
477
|
throw new Error("Shape not supported: " + pad.shape);
|
|
474
478
|
}
|
|
@@ -477,15 +481,19 @@ var FootprintPad = ({ pad }) => {
|
|
|
477
481
|
// lib/FootprintPlatedHole.tsx
|
|
478
482
|
import { Colorize as Colorize4, Cuboid as Cuboid13, Translate as Translate5, Cylinder as Cylinder2, Subtract as Subtract2 } from "jscad-fiber";
|
|
479
483
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
480
|
-
var FootprintPlatedHole = ({
|
|
484
|
+
var FootprintPlatedHole = ({
|
|
485
|
+
hole,
|
|
486
|
+
isPin1
|
|
487
|
+
}) => {
|
|
488
|
+
const color = isPin1 ? "#00ff00" : "#b87333";
|
|
481
489
|
if (hole.shape === "circle") {
|
|
482
|
-
return /* @__PURE__ */ jsx13(Colorize4, { color
|
|
490
|
+
return /* @__PURE__ */ jsx13(Colorize4, { color, children: /* @__PURE__ */ jsx13(Translate5, { offset: [hole.x, hole.y, -5e-3], children: /* @__PURE__ */ jsxs12(Subtract2, { children: [
|
|
483
491
|
/* @__PURE__ */ jsx13(Cylinder2, { radius: hole.outer_diameter / 2, height: 0.01 }),
|
|
484
492
|
/* @__PURE__ */ jsx13(Cylinder2, { radius: hole.hole_diameter / 2, height: 0.01 })
|
|
485
493
|
] }) }) });
|
|
486
494
|
}
|
|
487
495
|
if (hole.shape === "circular_hole_with_rect_pad") {
|
|
488
|
-
return /* @__PURE__ */ jsx13(Colorize4, { color
|
|
496
|
+
return /* @__PURE__ */ jsx13(Colorize4, { color, children: /* @__PURE__ */ jsx13(Translate5, { offset: [hole.x, hole.y, 0], children: /* @__PURE__ */ jsxs12(Subtract2, { children: [
|
|
489
497
|
/* @__PURE__ */ jsx13(
|
|
490
498
|
Cuboid13,
|
|
491
499
|
{
|
|
@@ -511,14 +519,18 @@ var ExtrudedPads = ({
|
|
|
511
519
|
if (!circuitJson)
|
|
512
520
|
throw new Error("No circuit json or footprint provided to ExtrudedPads");
|
|
513
521
|
return /* @__PURE__ */ jsxs13(Fragment11, { children: [
|
|
514
|
-
circuitJson.filter((s) => s.type === "pcb_smtpad").map((pad, i) =>
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
522
|
+
circuitJson.filter((s) => s.type === "pcb_smtpad").map((pad, i) => {
|
|
523
|
+
const isPin1 = pad.port_hints?.includes("1");
|
|
524
|
+
return (
|
|
525
|
+
// biome-ignore lint/suspicious/noArrayIndexKey:
|
|
526
|
+
/* @__PURE__ */ jsx14(FootprintPad, { pad, isPin1 }, i)
|
|
527
|
+
);
|
|
528
|
+
}),
|
|
518
529
|
circuitJson.filter((s) => s.type === "pcb_plated_hole").map((hole, i) => {
|
|
530
|
+
const isPin1 = hole.port_hints?.includes("1");
|
|
519
531
|
return (
|
|
520
532
|
// biome-ignore lint/suspicious/noArrayIndexKey:
|
|
521
|
-
/* @__PURE__ */ jsx14(FootprintPlatedHole, { hole }, i)
|
|
533
|
+
/* @__PURE__ */ jsx14(FootprintPlatedHole, { hole, isPin1 }, i)
|
|
522
534
|
);
|
|
523
535
|
})
|
|
524
536
|
] });
|