jscad-electronics 0.0.100 → 0.0.102

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
@@ -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 = ({ pad }) => {
469
+ var FootprintPad = ({
470
+ pad,
471
+ isPin1
472
+ }) => {
470
473
  if (pad.shape === "rect") {
471
- return /* @__PURE__ */ jsx12(Colorize3, { color: [255, 0, 0], children: /* @__PURE__ */ jsx12(Translate4, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx12(Cuboid12, { size: [pad.width, pad.height, 0.01] }) }) });
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 = ({ hole }) => {
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: "#b87333", children: /* @__PURE__ */ jsx13(Translate5, { offset: [hole.x, hole.y, -5e-3], children: /* @__PURE__ */ jsxs12(Subtract2, { children: [
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: "#b87333", children: /* @__PURE__ */ jsx13(Translate5, { offset: [hole.x, hole.y, 0], children: /* @__PURE__ */ jsxs12(Subtract2, { children: [
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
- // biome-ignore lint/suspicious/noArrayIndexKey:
516
- /* @__PURE__ */ jsx14(FootprintPad, { pad }, i)
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
  ] });
@@ -944,7 +956,7 @@ var QFP = ({
944
956
  taperRatio: 0.03,
945
957
  chamferSize: 0.7,
946
958
  notchPosition: {
947
- x: bodyLength10 / 2 - 1.5,
959
+ x: -(bodyLength10 / 2 - 1.5),
948
960
  y: bodyWidth / 2 - 1.5,
949
961
  z: 1.5
950
962
  },
@@ -2686,7 +2698,7 @@ var TQFP = () => {
2686
2698
  height: 1.2,
2687
2699
  chamferSize: 0.7,
2688
2700
  taperRatio: 0.05,
2689
- notchPosition: { x: 3.5, y: 3.5, z: 1.2 },
2701
+ notchPosition: { x: -3.5, y: 3.5, z: 1.2 },
2690
2702
  notchRadius: 1.2 / 2
2691
2703
  }
2692
2704
  )
@@ -2876,7 +2888,7 @@ var LQFP = ({
2876
2888
  taperRatio: 0.04,
2877
2889
  chamferSize: 0.7,
2878
2890
  notchPosition: {
2879
- x: bodyLength10 / 2 - 1.5,
2891
+ x: -(bodyLength10 / 2 - 1.5),
2880
2892
  y: bodyLength10 / 2 - 1.5,
2881
2893
  z: 1.5
2882
2894
  },
@@ -2993,7 +3005,7 @@ var DFN = ({
2993
3005
  chamferSize: 0.2,
2994
3006
  taperRatio: 0,
2995
3007
  notchPosition: {
2996
- x: bodyWidth / 2 - padLength,
3008
+ x: -(bodyWidth / 2 - padLength),
2997
3009
  y: bodyLength10 / 2 - padLength,
2998
3010
  z: bodyThickness
2999
3011
  }
@@ -3307,7 +3319,11 @@ var MS012 = ({
3307
3319
  width: bodyLength10,
3308
3320
  length: bodyWidth,
3309
3321
  height: 1.55,
3310
- notchPosition: { x: bodyLength10 / 2 - 1, y: bodyWidth / 2 - 1, z: 1.55 },
3322
+ notchPosition: {
3323
+ x: -(bodyLength10 / 2 - 1),
3324
+ y: bodyWidth / 2 - 1,
3325
+ z: 1.55
3326
+ },
3311
3327
  heightAboveSurface: 0.17,
3312
3328
  taperRatio: 0.09
3313
3329
  }
@@ -3373,7 +3389,7 @@ var MS013 = ({
3373
3389
  length: bodyLength10,
3374
3390
  height: 1.1,
3375
3391
  notchPosition: {
3376
- x: bodyWidth / 2 - 1.5,
3392
+ x: -(bodyWidth / 2 - 1.5),
3377
3393
  y: bodyLength10 / 2 - 1.5,
3378
3394
  z: 1.1
3379
3395
  },
@@ -3591,7 +3607,7 @@ var SOT457 = () => {
3591
3607
  height: bodyHeight,
3592
3608
  straightHeightRatio: 0.6,
3593
3609
  notchPosition: {
3594
- x: bodyWidth / 2 - 0.4,
3610
+ x: -(bodyWidth / 2 - 0.4),
3595
3611
  y: bodyHeight / 2 + 0.4,
3596
3612
  z: bodyHeight + 0.05
3597
3613
  },
@@ -3768,7 +3784,7 @@ var SOT363 = () => {
3768
3784
  height: bodyHeight,
3769
3785
  straightHeightRatio: 0.6,
3770
3786
  notchPosition: {
3771
- x: bodyWidth / 2 - 0.25,
3787
+ x: -(bodyWidth / 2 - 0.25),
3772
3788
  y: bodyHeight / 2 + 0.2,
3773
3789
  z: bodyHeight
3774
3790
  },