jscad-electronics 0.0.148 → 0.0.149

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 CHANGED
@@ -96,7 +96,7 @@ declare const ExtrudedPads: ({ circuitJson, footprint, }: {
96
96
  declare const FootprintPad: ({ pad, isPin1, }: {
97
97
  pad: PcbSmtPad;
98
98
  isPin1?: boolean;
99
- }) => react_jsx_runtime.JSX.Element;
99
+ }) => react_jsx_runtime.JSX.Element | null;
100
100
 
101
101
  declare const FootprintPlatedHole: ({ hole, isPin1, }: {
102
102
  hole: PcbPlatedHole;
package/dist/index.js CHANGED
@@ -602,18 +602,31 @@ var Crystal = ({
602
602
  import { fp as fp2 } from "@tscircuit/footprinter";
603
603
 
604
604
  // lib/FootprintPad.tsx
605
- import { Colorize as Colorize4, Cuboid as Cuboid12, Translate as Translate4 } from "jscad-fiber";
605
+ import {
606
+ Colorize as Colorize4,
607
+ Cuboid as Cuboid12,
608
+ ExtrudeLinear as ExtrudeLinear2,
609
+ Polygon as Polygon2,
610
+ Translate as Translate4
611
+ } from "jscad-fiber";
606
612
  import { jsx as jsx13 } from "react/jsx-runtime";
613
+ var PAD_THICKNESS = 0.01;
607
614
  var FootprintPad = ({
608
615
  pad,
609
616
  isPin1
610
617
  }) => {
618
+ const color = isPin1 ? [0, 255, 0] : [255, 0, 0];
611
619
  if (pad.shape === "rect") {
612
- const color = isPin1 ? [0, 255, 0] : [255, 0, 0];
613
- return /* @__PURE__ */ jsx13(Colorize4, { color, children: /* @__PURE__ */ jsx13(Translate4, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx13(Cuboid12, { size: [pad.width, pad.height, 0.01] }) }) });
614
- } else {
615
- throw new Error("Shape not supported: " + pad.shape);
620
+ return /* @__PURE__ */ jsx13(Colorize4, { color, children: /* @__PURE__ */ jsx13(Translate4, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx13(Cuboid12, { size: [pad.width, pad.height, PAD_THICKNESS] }) }) });
621
+ }
622
+ if (pad.shape === "polygon") {
623
+ const points = (pad.points ?? []).map(
624
+ ({ x, y }) => [x, y]
625
+ );
626
+ if (points.length < 3) return null;
627
+ return /* @__PURE__ */ jsx13(Colorize4, { color, children: /* @__PURE__ */ jsx13(Translate4, { offset: [0, 0, -5e-3], children: /* @__PURE__ */ jsx13(ExtrudeLinear2, { height: PAD_THICKNESS, children: /* @__PURE__ */ jsx13(Polygon2, { points }) }) }) });
616
628
  }
629
+ throw new Error("Shape not supported: " + pad.shape);
617
630
  };
618
631
 
619
632
  // lib/FootprintPlatedHole.tsx
@@ -747,7 +760,7 @@ var ExtrudedPads = ({
747
760
  import { fp as fp3 } from "@tscircuit/footprinter";
748
761
 
749
762
  // lib/DualInlinePackage.tsx
750
- import { Polygon as Polygon2, ExtrudeLinear as ExtrudeLinear2, Rotate as Rotate3, Translate as Translate6 } from "jscad-fiber";
763
+ import { Polygon as Polygon3, ExtrudeLinear as ExtrudeLinear3, Rotate as Rotate3, Translate as Translate6 } from "jscad-fiber";
751
764
 
752
765
  // lib/utils/range.ts
753
766
  var range = (end) => Array.from({ length: end }, (_, i) => i);
@@ -842,8 +855,8 @@ var heightAboveSurface = 0.5;
842
855
  var DipPinLeg = ({ x, y, z }) => {
843
856
  const isRotated = x > 0;
844
857
  return /* @__PURE__ */ jsxs15(Fragment13, { children: [
845
- /* @__PURE__ */ jsx16(Translate6, { offset: { x: x + 0.25 / 2, y, z }, children: /* @__PURE__ */ jsx16(Rotate3, { rotation: ["-90deg", 0, "90deg"], children: /* @__PURE__ */ jsx16(ExtrudeLinear2, { height: 0.25, children: /* @__PURE__ */ jsx16(
846
- Polygon2,
858
+ /* @__PURE__ */ jsx16(Translate6, { offset: { x: x + 0.25 / 2, y, z }, children: /* @__PURE__ */ jsx16(Rotate3, { rotation: ["-90deg", 0, "90deg"], children: /* @__PURE__ */ jsx16(ExtrudeLinear3, { height: 0.25, children: /* @__PURE__ */ jsx16(
859
+ Polygon3,
847
860
  {
848
861
  points: svgPathPoints.slice().reverse().map((p) => [p.x, p.y])
849
862
  }
@@ -856,8 +869,8 @@ var DipPinLeg = ({ x, y, z }) => {
856
869
  y: y + (isRotated ? 1 : -1),
857
870
  z
858
871
  },
859
- children: /* @__PURE__ */ jsx16(Rotate3, { rotation: ["-90deg", "90deg", isRotated ? "180deg" : "0deg"], children: /* @__PURE__ */ jsx16(ExtrudeLinear2, { height: 2, children: /* @__PURE__ */ jsx16(
860
- Polygon2,
872
+ children: /* @__PURE__ */ jsx16(Rotate3, { rotation: ["-90deg", "90deg", isRotated ? "180deg" : "0deg"], children: /* @__PURE__ */ jsx16(ExtrudeLinear3, { height: 2, children: /* @__PURE__ */ jsx16(
873
+ Polygon3,
861
874
  {
862
875
  points: getExpandedStroke(
863
876
  [
@@ -911,8 +924,8 @@ var Dip = ({
911
924
 
912
925
  // lib/SmdChipLead.tsx
913
926
  import {
914
- Polygon as Polygon3,
915
- ExtrudeLinear as ExtrudeLinear3,
927
+ Polygon as Polygon4,
928
+ ExtrudeLinear as ExtrudeLinear4,
916
929
  Translate as Translate7,
917
930
  Rotate as Rotate4,
918
931
  Colorize as Colorize6
@@ -943,7 +956,7 @@ var SmdChipLead = (props) => {
943
956
  const N = 15;
944
957
  const points = Array.from({ length: N }).map((_, i) => i / (N - 1) * bodyDistance).map((x) => [x, calculateSCurve(x, props)]);
945
958
  const polygon = getExpandedStroke(points, thickness);
946
- return /* @__PURE__ */ jsx17(Colorize6, { color: "#fff", children: /* @__PURE__ */ jsx17(Translate7, { offset: { z: 0, y: 0, x: 0, ...props.position }, children: /* @__PURE__ */ jsx17(Rotate4, { rotation: ["90deg", 0, rotation ?? 0], children: /* @__PURE__ */ jsx17(Translate7, { offset: { x: 0, y: 0, z: -width10 / 2 }, children: /* @__PURE__ */ jsx17(ExtrudeLinear3, { height: width10, children: /* @__PURE__ */ jsx17(Polygon3, { points: polygon.map((p) => [p.x, p.y]) }) }) }) }) }) });
959
+ return /* @__PURE__ */ jsx17(Colorize6, { color: "#fff", children: /* @__PURE__ */ jsx17(Translate7, { offset: { z: 0, y: 0, x: 0, ...props.position }, children: /* @__PURE__ */ jsx17(Rotate4, { rotation: ["90deg", 0, rotation ?? 0], children: /* @__PURE__ */ jsx17(Translate7, { offset: { x: 0, y: 0, z: -width10 / 2 }, children: /* @__PURE__ */ jsx17(ExtrudeLinear4, { height: width10, children: /* @__PURE__ */ jsx17(Polygon4, { points: polygon.map((p) => [p.x, p.y]) }) }) }) }) }) });
947
960
  };
948
961
 
949
962
  // lib/Tssop.tsx
@@ -1934,8 +1947,8 @@ var FemaleHeaderRow = ({
1934
1947
  import {
1935
1948
  Colorize as Colorize10,
1936
1949
  Cylinder as Cylinder4,
1937
- ExtrudeLinear as ExtrudeLinear4,
1938
- Polygon as Polygon4,
1950
+ ExtrudeLinear as ExtrudeLinear5,
1951
+ Polygon as Polygon5,
1939
1952
  Rotate as Rotate6,
1940
1953
  RoundedCuboid,
1941
1954
  Translate as Translate9
@@ -2110,7 +2123,7 @@ var PushButtonLeg = (props) => {
2110
2123
  y: position?.y || 0,
2111
2124
  z: position?.z || 0
2112
2125
  },
2113
- children: /* @__PURE__ */ jsx29(Rotate6, { rotation: [0, 55, rotation], children: /* @__PURE__ */ jsx29(ExtrudeLinear4, { height: width10, children: /* @__PURE__ */ jsx29(Polygon4, { points: polygon.map((p) => [p.y, p.x]) }) }) })
2126
+ children: /* @__PURE__ */ jsx29(Rotate6, { rotation: [0, 55, rotation], children: /* @__PURE__ */ jsx29(ExtrudeLinear5, { height: width10, children: /* @__PURE__ */ jsx29(Polygon5, { points: polygon.map((p) => [p.y, p.x]) }) }) })
2114
2127
  }
2115
2128
  ) });
2116
2129
  };