@tscircuit/3d-viewer 0.0.430 → 0.0.432

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.
Files changed (2) hide show
  1. package/dist/index.js +1546 -72
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -14228,7 +14228,7 @@ var require_browser = __commonJS({
14228
14228
  });
14229
14229
 
14230
14230
  // src/CadViewer.tsx
14231
- import { useState as useState33, useCallback as useCallback20, useRef as useRef22, useEffect as useEffect39 } from "react";
14231
+ import { useState as useState33, useCallback as useCallback20, useRef as useRef23, useEffect as useEffect39 } from "react";
14232
14232
 
14233
14233
  // src/CadViewerJscad.tsx
14234
14234
  import { su as su4 } from "@tscircuit/circuit-json-util";
@@ -15959,6 +15959,8 @@ var pcb_component = z69.object({
15959
15959
  do_not_place: z69.boolean().optional(),
15960
15960
  subcircuit_id: z69.string().optional(),
15961
15961
  pcb_group_id: z69.string().optional(),
15962
+ position_mode: z69.enum(["packed", "relative_to_group_anchor", "none"]).optional(),
15963
+ positioned_relative_to_pcb_group_id: z69.string().optional(),
15962
15964
  obstructs_within_bounds: z69.boolean().default(true).describe(
15963
15965
  "Does this component take up all the space within its bounds on a layer. This is generally true except for when separated pin headers are being represented by a single component (in which case, chips can be placed between the pin headers) or for tall modules where chips fit underneath"
15964
15966
  )
@@ -16488,12 +16490,13 @@ var pcb_board = z83.object({
16488
16490
  pcb_panel_id: z83.string().optional(),
16489
16491
  is_subcircuit: z83.boolean().optional(),
16490
16492
  subcircuit_id: z83.string().optional(),
16491
- width: length,
16492
- height: length,
16493
+ width: length.optional(),
16494
+ height: length.optional(),
16493
16495
  center: point,
16494
16496
  thickness: length.optional().default(1.4),
16495
16497
  num_layers: z83.number().optional().default(4),
16496
16498
  outline: z83.array(point).optional(),
16499
+ shape: z83.enum(["rect", "polygon"]).optional(),
16497
16500
  material: z83.enum(["fr4", "fr1"]).default("fr4")
16498
16501
  }).describe("Defines the board outline of the PCB");
16499
16502
  expectTypesMatch(true);
@@ -16939,6 +16942,7 @@ var pcb_group = z109.object({
16939
16942
  anchor_position: point.optional(),
16940
16943
  anchor_alignment: z109.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).optional(),
16941
16944
  pcb_component_ids: z109.array(z109.string()),
16945
+ child_layout_mode: z109.enum(["packed", "none"]).optional(),
16942
16946
  name: z109.string().optional(),
16943
16947
  description: z109.string().optional(),
16944
16948
  layout_mode: z109.string().optional(),
@@ -24576,6 +24580,7 @@ var Hull = Symbol("Hull");
24576
24580
  var Colorize = Symbol("Colorize");
24577
24581
  var Polygon = Symbol("Polygon");
24578
24582
  var ExtrudeLinear = Symbol("ExtrudeLinear");
24583
+ var RoundedCylinder = Symbol("RoundedCylinder");
24579
24584
  var Fragment22 = Fragment2;
24580
24585
  var jsx5 = (type, props, _key) => h(type, props);
24581
24586
  var jsxs = (type, props, _key) => h(type, props);
@@ -24584,31 +24589,68 @@ var ChipBody = ({
24584
24589
  width: width10,
24585
24590
  length: length2,
24586
24591
  height: height10,
24587
- heightAboveSurface: heightAboveSurface2 = 0.15
24592
+ heightAboveSurface: heightAboveSurface2 = 0.15,
24593
+ color = "#555",
24594
+ taperRatio = 0.12,
24595
+ faceRatio = 0.75,
24596
+ straightHeightRatio = 0.5,
24597
+ includeNotch = true,
24598
+ notchRadius,
24599
+ notchPosition,
24600
+ notchRotation = [0, 0, 0],
24601
+ notchLength = 0.5,
24602
+ notchWidth = 0.25,
24603
+ chamferSize = 0
24588
24604
  }) => {
24589
- const straightHeight = height10 * 0.5;
24605
+ const straightHeight = height10 * straightHeightRatio;
24590
24606
  const taperHeight = height10 - straightHeight;
24591
- const taperInset = Math.min(width10, length2) * 0.12;
24592
- const faceWidth = Math.max(width10 - taperInset, width10 * 0.75);
24593
- const faceLength = Math.max(length2 - taperInset, length2 * 0.75);
24594
- const notchRadius = Math.min(width10, length2) * 0.12;
24595
- const notchCenterZ = height10 - notchRadius * 0.6;
24596
- const notchCenterY = length2 / 2 - notchRadius * 0.25;
24597
- const notchLength = faceLength / 8;
24598
- const notchWidth = height10 / 4;
24599
- return /* @__PURE__ */ jsx5(Colorize, { color: "#555", children: /* @__PURE__ */ jsx5(Translate, { offset: center, children: /* @__PURE__ */ jsx5(Translate, { offset: { x: 0, y: 0, z: heightAboveSurface2 }, children: /* @__PURE__ */ jsxs(Subtract, { children: [
24600
- /* @__PURE__ */ jsxs(Union, { children: [
24601
- /* @__PURE__ */ jsxs(Hull, { children: [
24602
- /* @__PURE__ */ jsx5(Translate, { z: 5e-3, children: /* @__PURE__ */ jsx5(Cuboid, { size: [faceWidth, faceLength, 0.01] }) }),
24603
- /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [width10, length2, 0.01] }) })
24604
- ] }),
24605
- /* @__PURE__ */ jsxs(Hull, { children: [
24606
- /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [width10, length2, 0.01] }) }),
24607
- /* @__PURE__ */ jsx5(Translate, { z: straightHeight + taperHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [faceWidth, faceLength, 0.01] }) })
24608
- ] })
24607
+ const taperInset = Math.min(width10, length2) * taperRatio;
24608
+ const faceWidth = Math.max(width10 - taperInset, width10 * faceRatio);
24609
+ const faceLength = Math.max(length2 - taperInset, length2 * faceRatio);
24610
+ const defaultNotchRadius = Math.min(width10, length2) * 0.12;
24611
+ const actualNotchRadius = notchRadius ?? defaultNotchRadius;
24612
+ const defaultNotchPosition = {
24613
+ x: 0,
24614
+ y: length2 / 2 - actualNotchRadius * 0.25,
24615
+ z: height10
24616
+ };
24617
+ const actualNotchPosition = notchPosition ?? defaultNotchPosition;
24618
+ const body = /* @__PURE__ */ jsxs(Union, { children: [
24619
+ /* @__PURE__ */ jsxs(Hull, { children: [
24620
+ /* @__PURE__ */ jsx5(Translate, { z: 5e-3, children: /* @__PURE__ */ jsx5(Cuboid, { size: [faceWidth, faceLength, 0.01] }) }),
24621
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [width10, length2, 0.01] }) })
24609
24622
  ] }),
24610
- /* @__PURE__ */ jsx5(Translate, { offset: { x: 0, y: notchCenterY, z: height10 }, children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, 0, 0], children: /* @__PURE__ */ jsx5(Cylinder, { radius: notchLength, height: notchWidth }) }) })
24611
- ] }) }) }) });
24623
+ /* @__PURE__ */ jsxs(Hull, { children: [
24624
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [width10, length2, 0.01] }) }),
24625
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight + taperHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [faceWidth, faceLength, 0.01] }) })
24626
+ ] })
24627
+ ] });
24628
+ const chamferCutout = (xPos, yPos) => /* @__PURE__ */ jsx5(Translate, { offset: { x: xPos, y: yPos, z: 0 }, children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, 0, Math.PI / 4], children: /* @__PURE__ */ jsx5(
24629
+ Cuboid,
24630
+ {
24631
+ size: [
24632
+ chamferSize * Math.SQRT2,
24633
+ chamferSize * Math.SQRT2,
24634
+ height10 * 3
24635
+ ]
24636
+ }
24637
+ ) }) });
24638
+ let finalBody = body;
24639
+ if (chamferSize > 0) {
24640
+ const xOffset = width10 / 2;
24641
+ const yOffset = length2 / 2;
24642
+ finalBody = /* @__PURE__ */ jsxs(Subtract, { children: [
24643
+ body,
24644
+ chamferCutout(xOffset, yOffset),
24645
+ chamferCutout(-xOffset, yOffset),
24646
+ chamferCutout(xOffset, -yOffset),
24647
+ chamferCutout(-xOffset, -yOffset)
24648
+ ] });
24649
+ }
24650
+ return /* @__PURE__ */ jsx5(Colorize, { color, children: /* @__PURE__ */ jsx5(Translate, { offset: center, children: /* @__PURE__ */ jsx5(Translate, { offset: { x: 0, y: 0, z: heightAboveSurface2 }, children: includeNotch ? /* @__PURE__ */ jsxs(Subtract, { children: [
24651
+ finalBody,
24652
+ /* @__PURE__ */ jsx5(Translate, { offset: actualNotchPosition, children: /* @__PURE__ */ jsx5(Rotate, { rotation: notchRotation, children: /* @__PURE__ */ jsx5(Cylinder, { radius: actualNotchRadius, height: notchWidth }) }) })
24653
+ ] }) : finalBody }) }) });
24612
24654
  };
24613
24655
  var range = (end) => Array.from({ length: end }, (_, i) => i);
24614
24656
  function getExpandedStroke(strokeInput, width10) {
@@ -24697,7 +24739,12 @@ var heightAboveSurface = 0.5;
24697
24739
  var DipPinLeg = ({ x, y, z: z133 }) => {
24698
24740
  const isRotated = x > 0;
24699
24741
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24700
- /* @__PURE__ */ jsx5(Translate, { offset: { x: x + 0.25 / 2, y, z: z133 }, children: /* @__PURE__ */ jsx5(Rotate, { rotation: ["-90deg", 0, "90deg"], children: /* @__PURE__ */ jsx5(ExtrudeLinear, { height: 0.25, children: /* @__PURE__ */ jsx5(Polygon, { points: svgPathPoints.map((p) => [p.x, p.y]) }) }) }) }),
24742
+ /* @__PURE__ */ jsx5(Translate, { offset: { x: x + 0.25 / 2, y, z: z133 }, children: /* @__PURE__ */ jsx5(Rotate, { rotation: ["-90deg", 0, "90deg"], children: /* @__PURE__ */ jsx5(ExtrudeLinear, { height: 0.25, children: /* @__PURE__ */ jsx5(
24743
+ Polygon,
24744
+ {
24745
+ points: svgPathPoints.slice().reverse().map((p) => [p.x, p.y])
24746
+ }
24747
+ ) }) }) }),
24701
24748
  /* @__PURE__ */ jsx5(
24702
24749
  Translate,
24703
24750
  {
@@ -24839,6 +24886,64 @@ var Tssop = ({
24839
24886
  )
24840
24887
  ] });
24841
24888
  };
24889
+ var MSOP = ({
24890
+ pinCount,
24891
+ padContactLength = 0.4,
24892
+ leadWidth = 0.2,
24893
+ pitch = 0.65,
24894
+ bodyWidth = 3
24895
+ }) => {
24896
+ const sidePinCount = Math.ceil(pinCount / 2);
24897
+ const pinOffsetToCenter = (sidePinCount - 1) * pitch / 2;
24898
+ const leadThickness = 0.2;
24899
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
24900
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
24901
+ SmdChipLead,
24902
+ {
24903
+ position: {
24904
+ x: -bodyWidth / 2 - padContactLength - 0.3,
24905
+ y: i * pitch - pinOffsetToCenter,
24906
+ z: leadThickness / 2
24907
+ },
24908
+ width: leadWidth,
24909
+ thickness: leadThickness,
24910
+ padContactLength,
24911
+ bodyDistance: padContactLength + 0.4,
24912
+ height: 0.6
24913
+ },
24914
+ i
24915
+ )),
24916
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
24917
+ SmdChipLead,
24918
+ {
24919
+ rotation: Math.PI,
24920
+ position: {
24921
+ x: bodyWidth / 2 + padContactLength + 0.3,
24922
+ y: i * pitch - pinOffsetToCenter,
24923
+ z: leadThickness / 2
24924
+ },
24925
+ width: leadWidth,
24926
+ thickness: leadThickness,
24927
+ padContactLength,
24928
+ bodyDistance: padContactLength + 0.4,
24929
+ height: 0.6
24930
+ },
24931
+ i
24932
+ )),
24933
+ /* @__PURE__ */ jsx5(
24934
+ ChipBody,
24935
+ {
24936
+ center: { x: 0, y: 0, z: leadThickness / 2 },
24937
+ width: bodyWidth,
24938
+ length: bodyWidth,
24939
+ height: 1.1,
24940
+ notchRadius: 0.35,
24941
+ heightAboveSurface: 0.1,
24942
+ taperRatio: 0.09
24943
+ }
24944
+ )
24945
+ ] });
24946
+ };
24842
24947
  var fullLength = 1;
24843
24948
  var width = 0.5;
24844
24949
  var height = 0.5;
@@ -24956,13 +25061,13 @@ var QFP = ({
24956
25061
  const fullWidth = fullLength10;
24957
25062
  const leadHeight = 0.8;
24958
25063
  const leadThickness = 0.15;
24959
- const bodyDistance = (fullWidth - bodyWidth) / 2;
25064
+ const bodyDistance = (fullWidth - bodyWidth) / 2 + 0.5;
24960
25065
  return /* @__PURE__ */ jsxs(Fragment22, { children: [
24961
25066
  Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
24962
25067
  SmdChipLead,
24963
25068
  {
24964
25069
  position: {
24965
- x: -fullWidth / 2,
25070
+ x: -fullWidth / 2 - 0.4,
24966
25071
  y: i * pitch - pinOffsetToCenter,
24967
25072
  z: leadThickness / 2
24968
25073
  },
@@ -24979,7 +25084,7 @@ var QFP = ({
24979
25084
  {
24980
25085
  rotation: Math.PI,
24981
25086
  position: {
24982
- x: fullWidth / 2,
25087
+ x: fullWidth / 2 + 0.4,
24983
25088
  y: i * pitch - pinOffsetToCenter,
24984
25089
  z: leadThickness / 2
24985
25090
  },
@@ -24997,7 +25102,7 @@ var QFP = ({
24997
25102
  rotation: Math.PI / 2,
24998
25103
  position: {
24999
25104
  x: i * pitch - pinOffsetToCenter,
25000
- y: -fullLength10 / 2,
25105
+ y: -fullLength10 / 2 - 0.4,
25001
25106
  z: leadThickness / 2
25002
25107
  },
25003
25108
  width: leadWidth,
@@ -25014,7 +25119,7 @@ var QFP = ({
25014
25119
  rotation: -Math.PI / 2,
25015
25120
  position: {
25016
25121
  x: i * pitch - pinOffsetToCenter,
25017
- y: fullLength10 / 2,
25122
+ y: fullLength10 / 2 + 0.4,
25018
25123
  z: leadThickness / 2
25019
25124
  },
25020
25125
  width: leadWidth,
@@ -25028,10 +25133,18 @@ var QFP = ({
25028
25133
  /* @__PURE__ */ jsx5(
25029
25134
  ChipBody,
25030
25135
  {
25031
- center: { x: 0, y: 0, z: leadThickness / 2 },
25136
+ center: { x: 0, y: 0, z: 0 },
25032
25137
  width: bodyWidth,
25033
25138
  length: bodyLength10,
25034
- height: 1.5
25139
+ height: 1.5,
25140
+ taperRatio: 0.03,
25141
+ chamferSize: 0.7,
25142
+ notchPosition: {
25143
+ x: bodyLength10 / 2 - 1.5,
25144
+ y: bodyWidth / 2 - 1.5,
25145
+ z: 1.5
25146
+ },
25147
+ notchRadius: 1.5 / 2
25035
25148
  }
25036
25149
  )
25037
25150
  ] });
@@ -25051,14 +25164,17 @@ var getPitch = (pinCount, width10) => {
25051
25164
  };
25052
25165
  var getPadContactLength = (pinCount) => {
25053
25166
  switch (pinCount) {
25054
- case 44:
25167
+ case 32:
25168
+ return 0.6;
25169
+ case 40:
25170
+ return 0.6;
25055
25171
  case 52:
25056
25172
  case 64:
25057
- return 2.25;
25173
+ return 0.65;
25058
25174
  case 208:
25059
25175
  return 1.65;
25060
25176
  default:
25061
- return 1;
25177
+ return 0.6;
25062
25178
  }
25063
25179
  };
25064
25180
  var getLeadWidth = (pinCount, width10) => {
@@ -25878,7 +25994,7 @@ var SOIC = ({
25878
25994
  width: leadWidth,
25879
25995
  thickness: leadThickness,
25880
25996
  padContactLength: leadLength / 2,
25881
- bodyDistance: leadLength + 0.2,
25997
+ bodyDistance: leadLength + 0.3,
25882
25998
  height: leadHeight
25883
25999
  },
25884
26000
  i
@@ -25895,7 +26011,7 @@ var SOIC = ({
25895
26011
  width: leadWidth,
25896
26012
  thickness: leadThickness,
25897
26013
  padContactLength: leadLength / 2,
25898
- bodyDistance: leadLength + 0.2,
26014
+ bodyDistance: leadLength + 0.3,
25899
26015
  height: leadHeight
25900
26016
  },
25901
26017
  i
@@ -25952,7 +26068,7 @@ var VSSOP = ({
25952
26068
  width: _leadWidth,
25953
26069
  thickness: leadThickness,
25954
26070
  padContactLength: padContactLength + 0.05,
25955
- bodyDistance: leadBodyDistance + 0.05,
26071
+ bodyDistance: leadBodyDistance + 0.1,
25956
26072
  height: leadHeight
25957
26073
  },
25958
26074
  `left-${i}`
@@ -25969,7 +26085,7 @@ var VSSOP = ({
25969
26085
  width: _leadWidth,
25970
26086
  thickness: leadThickness,
25971
26087
  padContactLength: padContactLength + 0.05,
25972
- bodyDistance: leadBodyDistance + 0.05,
26088
+ bodyDistance: leadBodyDistance + 0.1,
25973
26089
  height: leadHeight
25974
26090
  },
25975
26091
  `right-${i}`
@@ -25997,6 +26113,315 @@ var SOD523 = () => {
25997
26113
  const rightPadCenterX = bodyWidth / 2 - padLength / 2 + 0.15;
25998
26114
  const taperOffset = 0.2;
25999
26115
  const straightHeight = bodyHeight * 0.5;
26116
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26117
+ /* @__PURE__ */ jsx5(
26118
+ Cuboid,
26119
+ {
26120
+ color: "#ccc",
26121
+ size: [padLength, padWidth, padThickness],
26122
+ center: [leftPadCenterX, 0, padThickness / 2]
26123
+ }
26124
+ ),
26125
+ /* @__PURE__ */ jsx5(
26126
+ Cuboid,
26127
+ {
26128
+ color: "#ccc",
26129
+ size: [padLength, padWidth, padThickness],
26130
+ center: [rightPadCenterX, 0, padThickness / 2]
26131
+ }
26132
+ ),
26133
+ /* @__PURE__ */ jsx5(Colorize, { color: "#222", children: /* @__PURE__ */ jsxs(Union, { children: [
26134
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight / 2, children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyWidth, bodyLength10, straightHeight] }) }),
26135
+ /* @__PURE__ */ jsxs(Hull, { children: [
26136
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) }),
26137
+ /* @__PURE__ */ jsx5(Translate, { z: bodyHeight, children: /* @__PURE__ */ jsx5(
26138
+ Cuboid,
26139
+ {
26140
+ size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.01]
26141
+ }
26142
+ ) })
26143
+ ] })
26144
+ ] }) })
26145
+ ] });
26146
+ };
26147
+ var SOD882 = () => {
26148
+ const bodyLength10 = 0.98;
26149
+ const bodyHeight = 0.47;
26150
+ const pitch = 0.65;
26151
+ const padWidth = 0.51;
26152
+ const padLength = 0.26;
26153
+ const padThickness = 0.12;
26154
+ const bodyWidth = 0.58;
26155
+ const leftPadCenterX = -pitch / 2;
26156
+ const rightPadCenterX = pitch / 2;
26157
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26158
+ /* @__PURE__ */ jsx5(
26159
+ Cuboid,
26160
+ {
26161
+ color: "#ccc",
26162
+ size: [padLength, padWidth, padThickness],
26163
+ center: [leftPadCenterX, 0, padThickness / 2]
26164
+ }
26165
+ ),
26166
+ /* @__PURE__ */ jsx5(
26167
+ Cuboid,
26168
+ {
26169
+ color: "#ccc",
26170
+ size: [padLength, padWidth, padThickness],
26171
+ center: [rightPadCenterX, 0, padThickness / 2]
26172
+ }
26173
+ ),
26174
+ /* @__PURE__ */ jsx5(Colorize, { color: "#222", children: /* @__PURE__ */ jsx5(Translate, { z: bodyHeight / 2 + 0.02, children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyLength10, bodyWidth, bodyHeight] }) }) }),
26175
+ /* @__PURE__ */ jsx5(
26176
+ Cuboid,
26177
+ {
26178
+ color: "#ccc",
26179
+ size: [bodyLength10 + 1e-3, padLength / 2, padLength / 4],
26180
+ center: [0, padLength / 2, bodyHeight / 4]
26181
+ }
26182
+ ),
26183
+ /* @__PURE__ */ jsx5(
26184
+ Cuboid,
26185
+ {
26186
+ color: "#ccc",
26187
+ size: [bodyLength10 + 1e-3, padLength / 2, padLength / 4],
26188
+ center: [0, -padLength / 2, bodyHeight / 4]
26189
+ }
26190
+ ),
26191
+ /* @__PURE__ */ jsx5(
26192
+ Cuboid,
26193
+ {
26194
+ color: "#ccc",
26195
+ size: [padLength / 1.5, bodyWidth + 1e-3, padLength / 4],
26196
+ center: [pitch / 2, 0, bodyHeight / 4]
26197
+ }
26198
+ ),
26199
+ /* @__PURE__ */ jsx5(
26200
+ Cuboid,
26201
+ {
26202
+ color: "#ccc",
26203
+ size: [padLength / 1.5, bodyWidth + 1e-3, padLength / 4],
26204
+ center: [-pitch / 2, 0, bodyHeight / 4]
26205
+ }
26206
+ )
26207
+ ] });
26208
+ };
26209
+ var SMA = () => {
26210
+ const bodyWidth = 4.4;
26211
+ const bodyLength10 = 3.4;
26212
+ const bodyHeight = 2.3;
26213
+ const padWidth = 1.45;
26214
+ const padThickness = 0.12;
26215
+ const leadThickness = 0.2;
26216
+ const leadHeight = 1.14;
26217
+ const taperOffset = 0.4;
26218
+ const straightHeight = bodyHeight * 0.5;
26219
+ const Body = /* @__PURE__ */ jsx5(Colorize, { color: "#1a1a1a", children: /* @__PURE__ */ jsxs(Union, { children: [
26220
+ /* @__PURE__ */ jsxs(Hull, { children: [
26221
+ /* @__PURE__ */ jsx5(Translate, { z: padThickness + 0.01, children: /* @__PURE__ */ jsx5(
26222
+ Cuboid,
26223
+ {
26224
+ size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.03]
26225
+ }
26226
+ ) }),
26227
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) })
26228
+ ] }),
26229
+ /* @__PURE__ */ jsxs(Hull, { children: [
26230
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) }),
26231
+ /* @__PURE__ */ jsx5(Translate, { z: bodyHeight, children: /* @__PURE__ */ jsx5(
26232
+ Cuboid,
26233
+ {
26234
+ size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.01]
26235
+ }
26236
+ ) })
26237
+ ] })
26238
+ ] }) });
26239
+ const Lead = ({ xDir }) => {
26240
+ const verticalGap = 1;
26241
+ const lowerPadGap = 1;
26242
+ const lowerPadX = xDir * (bodyLength10 / 2 - bodyHeight * 0.8 / 2 + lowerPadGap);
26243
+ const verticalLeadX = xDir * (bodyLength10 / 2 - leadThickness / 2 + verticalGap);
26244
+ const bodyEdgeX = xDir * (bodyLength10 / 2 - leadThickness / 2);
26245
+ const bridgeLength = Math.abs(bodyEdgeX - verticalLeadX);
26246
+ const bridgeCenterX = (verticalLeadX + bodyEdgeX) / 2;
26247
+ return /* @__PURE__ */ jsx5(Colorize, { color: "#c0c0c0", children: /* @__PURE__ */ jsxs(Union, { children: [
26248
+ /* @__PURE__ */ jsx5(
26249
+ Cuboid,
26250
+ {
26251
+ size: [bodyHeight * 0.8, padWidth, leadThickness],
26252
+ center: [lowerPadX, 0, leadThickness / 2]
26253
+ }
26254
+ ),
26255
+ /* @__PURE__ */ jsx5(
26256
+ Cuboid,
26257
+ {
26258
+ size: [leadThickness, padWidth, leadHeight],
26259
+ center: [verticalLeadX, 0, leadHeight / 2 + leadThickness]
26260
+ }
26261
+ ),
26262
+ /* @__PURE__ */ jsx5(
26263
+ Cuboid,
26264
+ {
26265
+ size: [bridgeLength, padWidth, leadThickness],
26266
+ center: [bridgeCenterX, 0, leadThickness / 2 + leadHeight]
26267
+ }
26268
+ )
26269
+ ] }) });
26270
+ };
26271
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26272
+ /* @__PURE__ */ jsx5(Lead, { xDir: 1 }),
26273
+ /* @__PURE__ */ jsx5(Lead, { xDir: -1 }),
26274
+ Body
26275
+ ] });
26276
+ };
26277
+ var SMB = () => {
26278
+ const bodyWidth = 4.4;
26279
+ const bodyLength10 = 3.4;
26280
+ const bodyHeight = 2.3;
26281
+ const padWidth = 1.45;
26282
+ const padThickness = 0.12;
26283
+ const leadThickness = 0.2;
26284
+ const leadHeight = 1.14;
26285
+ const taperOffset = 0.4;
26286
+ const straightHeight = bodyHeight * 0.5;
26287
+ const Body = /* @__PURE__ */ jsx5(Colorize, { color: "#1a1a1a", children: /* @__PURE__ */ jsxs(Union, { children: [
26288
+ /* @__PURE__ */ jsxs(Hull, { children: [
26289
+ /* @__PURE__ */ jsx5(Translate, { z: padThickness + 0.01, children: /* @__PURE__ */ jsx5(
26290
+ Cuboid,
26291
+ {
26292
+ size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.03]
26293
+ }
26294
+ ) }),
26295
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) })
26296
+ ] }),
26297
+ /* @__PURE__ */ jsxs(Hull, { children: [
26298
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) }),
26299
+ /* @__PURE__ */ jsx5(Translate, { z: bodyHeight, children: /* @__PURE__ */ jsx5(
26300
+ Cuboid,
26301
+ {
26302
+ size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.01]
26303
+ }
26304
+ ) })
26305
+ ] })
26306
+ ] }) });
26307
+ const Lead = ({ xDir }) => {
26308
+ const verticalGap = 1;
26309
+ const lowerPadGap = 1;
26310
+ const lowerPadX = xDir * (bodyLength10 / 2 - bodyHeight * 0.8 / 2 + lowerPadGap);
26311
+ const verticalLeadX = xDir * (bodyLength10 / 2 - leadThickness / 2 + verticalGap);
26312
+ const bodyEdgeX = xDir * (bodyLength10 / 2 - leadThickness / 2);
26313
+ const bridgeLength = Math.abs(bodyEdgeX - verticalLeadX);
26314
+ const bridgeCenterX = (verticalLeadX + bodyEdgeX) / 2;
26315
+ return /* @__PURE__ */ jsx5(Colorize, { color: "#c0c0c0", children: /* @__PURE__ */ jsxs(Union, { children: [
26316
+ /* @__PURE__ */ jsx5(
26317
+ Cuboid,
26318
+ {
26319
+ size: [bodyHeight * 0.8, padWidth, leadThickness],
26320
+ center: [lowerPadX, 0, leadThickness / 2]
26321
+ }
26322
+ ),
26323
+ /* @__PURE__ */ jsx5(
26324
+ Cuboid,
26325
+ {
26326
+ size: [leadThickness, padWidth, leadHeight],
26327
+ center: [verticalLeadX, 0, leadHeight / 2 + leadThickness]
26328
+ }
26329
+ ),
26330
+ /* @__PURE__ */ jsx5(
26331
+ Cuboid,
26332
+ {
26333
+ size: [bridgeLength, padWidth, leadThickness],
26334
+ center: [bridgeCenterX, 0, leadThickness / 2 + leadHeight]
26335
+ }
26336
+ )
26337
+ ] }) });
26338
+ };
26339
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26340
+ /* @__PURE__ */ jsx5(Lead, { xDir: 1 }),
26341
+ /* @__PURE__ */ jsx5(Lead, { xDir: -1 }),
26342
+ Body
26343
+ ] });
26344
+ };
26345
+ var SMC = () => {
26346
+ const bodyWidth = 6.8;
26347
+ const bodyLength10 = 6;
26348
+ const bodyHeight = 2.3;
26349
+ const padWidth = 2.95;
26350
+ const padThickness = 0.2;
26351
+ const leadThickness = 0.2;
26352
+ const leadHeight = 1.14;
26353
+ const taperOffset = 0.4;
26354
+ const straightHeight = bodyHeight * 0.5;
26355
+ const Body = /* @__PURE__ */ jsx5(Colorize, { color: "#1a1a1a", children: /* @__PURE__ */ jsxs(Union, { children: [
26356
+ /* @__PURE__ */ jsxs(Hull, { children: [
26357
+ /* @__PURE__ */ jsx5(Translate, { z: padThickness + 0.01, children: /* @__PURE__ */ jsx5(
26358
+ Cuboid,
26359
+ {
26360
+ size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.03]
26361
+ }
26362
+ ) }),
26363
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) })
26364
+ ] }),
26365
+ /* @__PURE__ */ jsxs(Hull, { children: [
26366
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) }),
26367
+ /* @__PURE__ */ jsx5(Translate, { z: bodyHeight, children: /* @__PURE__ */ jsx5(
26368
+ Cuboid,
26369
+ {
26370
+ size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.01]
26371
+ }
26372
+ ) })
26373
+ ] })
26374
+ ] }) });
26375
+ const Lead = ({ xDir }) => {
26376
+ const verticalGap = 1;
26377
+ const lowerPadGap = 1;
26378
+ const lowerPadX = xDir * (bodyLength10 / 2 - bodyHeight * 0.8 / 2 + lowerPadGap);
26379
+ const verticalLeadX = xDir * (bodyLength10 / 2 - leadThickness / 2 + verticalGap);
26380
+ const bodyEdgeX = xDir * (bodyLength10 / 2 - leadThickness / 2);
26381
+ const bridgeLength = Math.abs(bodyEdgeX - verticalLeadX);
26382
+ const bridgeCenterX = (verticalLeadX + bodyEdgeX) / 2;
26383
+ return /* @__PURE__ */ jsx5(Colorize, { color: "#c0c0c0", children: /* @__PURE__ */ jsxs(Union, { children: [
26384
+ /* @__PURE__ */ jsx5(
26385
+ Cuboid,
26386
+ {
26387
+ size: [bodyHeight * 0.8, padWidth, leadThickness],
26388
+ center: [lowerPadX, 0, leadThickness / 2]
26389
+ }
26390
+ ),
26391
+ /* @__PURE__ */ jsx5(
26392
+ Cuboid,
26393
+ {
26394
+ size: [leadThickness, padWidth, leadHeight],
26395
+ center: [verticalLeadX, 0, leadHeight / 2 + leadThickness]
26396
+ }
26397
+ ),
26398
+ /* @__PURE__ */ jsx5(
26399
+ Cuboid,
26400
+ {
26401
+ size: [bridgeLength, padWidth, leadThickness],
26402
+ center: [bridgeCenterX, 0, leadThickness / 2 + leadHeight]
26403
+ }
26404
+ )
26405
+ ] }) });
26406
+ };
26407
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26408
+ /* @__PURE__ */ jsx5(Lead, { xDir: 1 }),
26409
+ /* @__PURE__ */ jsx5(Lead, { xDir: -1 }),
26410
+ Body
26411
+ ] });
26412
+ };
26413
+ var SMF = () => {
26414
+ const fullWidth = 2.9;
26415
+ const bodyLength10 = 1.9;
26416
+ const bodyHeight = 1.08;
26417
+ const padWidth = 1.2;
26418
+ const padLength = 1;
26419
+ const padThickness = 0.25;
26420
+ const bodyWidth = fullWidth;
26421
+ const leftPadCenterX = -1.3;
26422
+ const rightPadCenterX = 1.3;
26423
+ const taperOffset = 0.2;
26424
+ const straightHeight = bodyHeight * 0.5;
26000
26425
  const Body = /* @__PURE__ */ jsx5(Colorize, { color: "#222", children: /* @__PURE__ */ jsxs(Union, { children: [
26001
26426
  /* @__PURE__ */ jsx5(Translate, { z: straightHeight / 2, children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyWidth, bodyLength10, straightHeight] }) }),
26002
26427
  /* @__PURE__ */ jsxs(Hull, { children: [
@@ -26029,10 +26454,889 @@ var SOD523 = () => {
26029
26454
  Body
26030
26455
  ] });
26031
26456
  };
26032
- var Footprinter3d = ({ footprint }) => {
26033
- const fpJson = fp.string(footprint).json();
26034
- switch (fpJson.fn) {
26035
- case "dip":
26457
+ var SOD123F = () => {
26458
+ const fullWidth = 2.7;
26459
+ const bodyLength10 = 1.6;
26460
+ const bodyHeight = 1.1;
26461
+ const padWidth = 0.6;
26462
+ const padLength = 1;
26463
+ const padThickness = 0.12;
26464
+ const leftPadCenterX = -1.3;
26465
+ const rightPadCenterX = 1.3;
26466
+ const taperOffset = 0.2;
26467
+ const straightHeight = bodyHeight * 0.5;
26468
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26469
+ /* @__PURE__ */ jsx5(
26470
+ Cuboid,
26471
+ {
26472
+ color: "#ccc",
26473
+ size: [padLength, padWidth, padThickness],
26474
+ center: [leftPadCenterX, 0, padThickness / 2]
26475
+ }
26476
+ ),
26477
+ /* @__PURE__ */ jsx5(
26478
+ Cuboid,
26479
+ {
26480
+ color: "#ccc",
26481
+ size: [padLength, padWidth, padThickness],
26482
+ center: [rightPadCenterX, 0, padThickness / 2]
26483
+ }
26484
+ ),
26485
+ /* @__PURE__ */ jsx5(Colorize, { color: "#222", children: /* @__PURE__ */ jsxs(Union, { children: [
26486
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight / 2, children: /* @__PURE__ */ jsx5(Cuboid, { size: [fullWidth, bodyLength10, straightHeight] }) }),
26487
+ /* @__PURE__ */ jsxs(Hull, { children: [
26488
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [fullWidth, bodyLength10, 0.01] }) }),
26489
+ /* @__PURE__ */ jsx5(Translate, { z: bodyHeight, children: /* @__PURE__ */ jsx5(
26490
+ Cuboid,
26491
+ {
26492
+ size: [fullWidth - taperOffset, bodyLength10 - taperOffset, 0.01]
26493
+ }
26494
+ ) })
26495
+ ] })
26496
+ ] }) })
26497
+ ] });
26498
+ };
26499
+ var SOD123FL = () => {
26500
+ const fullWidth = 2.75;
26501
+ const bodyLength10 = 1.8;
26502
+ const bodyHeight = 1;
26503
+ const padWidth = 0.9;
26504
+ const padLength = 1;
26505
+ const padThickness = 0.2;
26506
+ const leftPadCenterX = -(fullWidth / 2 - 0.075);
26507
+ const rightPadCenterX = fullWidth / 2 - 0.075;
26508
+ const taperOffset = 0.4;
26509
+ const straightHeight = bodyHeight * 0.2;
26510
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26511
+ /* @__PURE__ */ jsx5(
26512
+ Cuboid,
26513
+ {
26514
+ color: "#ccc",
26515
+ size: [padLength, padWidth, padThickness],
26516
+ center: [leftPadCenterX, 0, padThickness / 2]
26517
+ }
26518
+ ),
26519
+ /* @__PURE__ */ jsx5(
26520
+ Cuboid,
26521
+ {
26522
+ color: "#ccc",
26523
+ size: [padLength, padWidth, padThickness],
26524
+ center: [rightPadCenterX, 0, padThickness / 2]
26525
+ }
26526
+ ),
26527
+ /* @__PURE__ */ jsx5(Colorize, { color: "#222", children: /* @__PURE__ */ jsxs(Union, { children: [
26528
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight / 2, children: /* @__PURE__ */ jsx5(Cuboid, { size: [fullWidth, bodyLength10, straightHeight] }) }),
26529
+ /* @__PURE__ */ jsxs(Hull, { children: [
26530
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [fullWidth, bodyLength10, 0.01] }) }),
26531
+ /* @__PURE__ */ jsx5(Translate, { z: bodyHeight, children: /* @__PURE__ */ jsx5(
26532
+ Cuboid,
26533
+ {
26534
+ size: [fullWidth - taperOffset, bodyLength10 - taperOffset, 0.01]
26535
+ }
26536
+ ) })
26537
+ ] })
26538
+ ] }) }),
26539
+ /* @__PURE__ */ jsx5(
26540
+ Cuboid,
26541
+ {
26542
+ color: "#777",
26543
+ size: [padThickness, bodyLength10 - taperOffset, 0.01],
26544
+ center: [leftPadCenterX + taperOffset, 0, bodyHeight]
26545
+ }
26546
+ )
26547
+ ] });
26548
+ };
26549
+ var SOD923 = () => {
26550
+ const fullWidth = 0.8;
26551
+ const bodyLength10 = 0.6;
26552
+ const bodyHeight = 0.37;
26553
+ const padWidth = 0.25;
26554
+ const padLength = 0.4;
26555
+ const padThickness = 0.14;
26556
+ const leftPadCenterX = -(fullWidth / 2);
26557
+ const rightPadCenterX = fullWidth / 2;
26558
+ const taperOffset = 0.1;
26559
+ const straightHeight = padThickness;
26560
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26561
+ /* @__PURE__ */ jsx5(
26562
+ Cuboid,
26563
+ {
26564
+ color: "#ccc",
26565
+ size: [padLength, padWidth, padThickness],
26566
+ center: [leftPadCenterX, 0, padThickness / 2]
26567
+ }
26568
+ ),
26569
+ /* @__PURE__ */ jsx5(
26570
+ Cuboid,
26571
+ {
26572
+ color: "#ccc",
26573
+ size: [padLength, padWidth, padThickness],
26574
+ center: [rightPadCenterX, 0, padThickness / 2]
26575
+ }
26576
+ ),
26577
+ /* @__PURE__ */ jsx5(Colorize, { color: "#222", children: /* @__PURE__ */ jsxs(Union, { children: [
26578
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight / 2, children: /* @__PURE__ */ jsx5(Cuboid, { size: [fullWidth, bodyLength10, straightHeight] }) }),
26579
+ /* @__PURE__ */ jsxs(Hull, { children: [
26580
+ /* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [fullWidth, bodyLength10, 0.01] }) }),
26581
+ /* @__PURE__ */ jsx5(Translate, { z: bodyHeight, children: /* @__PURE__ */ jsx5(
26582
+ Cuboid,
26583
+ {
26584
+ size: [fullWidth - taperOffset, bodyLength10 - taperOffset, 0.01]
26585
+ }
26586
+ ) })
26587
+ ] })
26588
+ ] }) })
26589
+ ] });
26590
+ };
26591
+ var SOT223 = () => {
26592
+ const fullWidth = 6.6;
26593
+ const bodyWidth = 3.5;
26594
+ const bodyLength10 = 6.5;
26595
+ const bodyHeight = 1.7;
26596
+ const leadWidth = 0.7;
26597
+ const leftLeadWidth = 3;
26598
+ const leadThickness = 0.25;
26599
+ const leadHeight = 0.75;
26600
+ const padContactLength = 0.5;
26601
+ const padPitch = 2.3;
26602
+ const extendedBodyDistance = fullWidth - bodyWidth;
26603
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26604
+ /* @__PURE__ */ jsx5(
26605
+ SmdChipLead,
26606
+ {
26607
+ rotation: Math.PI,
26608
+ position: {
26609
+ x: fullWidth / 2 + extendedBodyDistance / 4,
26610
+ y: 0,
26611
+ z: leadThickness / 2
26612
+ },
26613
+ width: leftLeadWidth,
26614
+ thickness: leadThickness,
26615
+ padContactLength,
26616
+ bodyDistance: extendedBodyDistance,
26617
+ height: leadHeight
26618
+ },
26619
+ 4
26620
+ ),
26621
+ /* @__PURE__ */ jsx5(
26622
+ SmdChipLead,
26623
+ {
26624
+ position: {
26625
+ x: -fullWidth / 2 - extendedBodyDistance / 4,
26626
+ y: 0,
26627
+ z: leadThickness / 2
26628
+ },
26629
+ width: leadWidth,
26630
+ thickness: leadThickness,
26631
+ padContactLength,
26632
+ bodyDistance: extendedBodyDistance,
26633
+ height: leadHeight
26634
+ },
26635
+ 3
26636
+ ),
26637
+ /* @__PURE__ */ jsx5(
26638
+ SmdChipLead,
26639
+ {
26640
+ position: {
26641
+ x: -fullWidth / 2 - extendedBodyDistance / 4,
26642
+ y: -padPitch,
26643
+ z: leadThickness / 2
26644
+ },
26645
+ width: leadWidth,
26646
+ thickness: leadThickness,
26647
+ padContactLength,
26648
+ bodyDistance: extendedBodyDistance,
26649
+ height: leadHeight
26650
+ },
26651
+ 1
26652
+ ),
26653
+ /* @__PURE__ */ jsx5(
26654
+ SmdChipLead,
26655
+ {
26656
+ position: {
26657
+ x: -fullWidth / 2 - extendedBodyDistance / 4,
26658
+ y: padPitch,
26659
+ z: leadThickness / 2
26660
+ },
26661
+ width: leadWidth,
26662
+ thickness: leadThickness,
26663
+ padContactLength,
26664
+ bodyDistance: extendedBodyDistance,
26665
+ height: leadHeight
26666
+ },
26667
+ 2
26668
+ ),
26669
+ /* @__PURE__ */ jsx5(
26670
+ ChipBody,
26671
+ {
26672
+ center: { x: 0, y: 0, z: 0 },
26673
+ width: bodyWidth,
26674
+ length: bodyLength10,
26675
+ height: bodyHeight,
26676
+ includeNotch: false,
26677
+ taperRatio: 0.06,
26678
+ straightHeightRatio: 0.45
26679
+ }
26680
+ )
26681
+ ] });
26682
+ };
26683
+ var TQFP = () => {
26684
+ const pinCount = 64;
26685
+ const pitch = 0.5;
26686
+ const leadWidth = 0.2;
26687
+ const padContactLength = 0.45;
26688
+ const bodyWidth = 9;
26689
+ const sidePinCount = pinCount / 4;
26690
+ const bodyLength10 = bodyWidth;
26691
+ const pinOffsetToCenter = (sidePinCount - 1) * pitch / 2;
26692
+ const fullLength10 = bodyLength10 + 2 * padContactLength + 0.6;
26693
+ const fullWidth = fullLength10;
26694
+ const leadHeight = 0.65;
26695
+ const leadThickness = 0.25;
26696
+ const bodyDistance = (fullWidth - bodyWidth) / 2 + 0.2;
26697
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26698
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
26699
+ SmdChipLead,
26700
+ {
26701
+ position: {
26702
+ x: -fullWidth / 2,
26703
+ y: i * pitch - pinOffsetToCenter,
26704
+ z: leadThickness / 2
26705
+ },
26706
+ width: leadWidth,
26707
+ thickness: leadThickness,
26708
+ padContactLength,
26709
+ bodyDistance,
26710
+ height: leadHeight
26711
+ },
26712
+ `left-${i}`
26713
+ )),
26714
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
26715
+ SmdChipLead,
26716
+ {
26717
+ rotation: Math.PI,
26718
+ position: {
26719
+ x: fullWidth / 2,
26720
+ y: i * pitch - pinOffsetToCenter,
26721
+ z: leadThickness / 2
26722
+ },
26723
+ width: leadWidth,
26724
+ thickness: leadThickness,
26725
+ padContactLength,
26726
+ bodyDistance,
26727
+ height: leadHeight
26728
+ },
26729
+ `right-${i}`
26730
+ )),
26731
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
26732
+ SmdChipLead,
26733
+ {
26734
+ rotation: Math.PI / 2,
26735
+ position: {
26736
+ x: i * pitch - pinOffsetToCenter,
26737
+ y: -fullLength10 / 2,
26738
+ z: leadThickness / 2
26739
+ },
26740
+ width: leadWidth,
26741
+ thickness: leadThickness,
26742
+ padContactLength,
26743
+ bodyDistance,
26744
+ height: leadHeight
26745
+ },
26746
+ `bottom-${i}`
26747
+ )),
26748
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
26749
+ SmdChipLead,
26750
+ {
26751
+ rotation: -Math.PI / 2,
26752
+ position: {
26753
+ x: i * pitch - pinOffsetToCenter,
26754
+ y: fullLength10 / 2,
26755
+ z: leadThickness / 2
26756
+ },
26757
+ width: leadWidth,
26758
+ thickness: leadThickness,
26759
+ padContactLength,
26760
+ bodyDistance,
26761
+ height: leadHeight
26762
+ },
26763
+ `top-${i}`
26764
+ )),
26765
+ /* @__PURE__ */ jsx5(
26766
+ ChipBody,
26767
+ {
26768
+ center: { x: 0, y: 0, z: 0 },
26769
+ width: bodyWidth,
26770
+ length: bodyLength10,
26771
+ height: 1.2,
26772
+ chamferSize: 0.7,
26773
+ taperRatio: 0.05,
26774
+ notchPosition: { x: 3.5, y: 3.5, z: 1.2 },
26775
+ notchRadius: 1.2 / 2
26776
+ }
26777
+ )
26778
+ ] });
26779
+ };
26780
+ var tqfp_default = TQFP;
26781
+ var SOT323 = () => {
26782
+ const fullWidth = 2.05;
26783
+ const bodyWidth = 1.25;
26784
+ const bodyLength10 = 2;
26785
+ const bodyHeight = 0.9;
26786
+ const leadWidth = 0.3;
26787
+ const leadThickness = 0.18;
26788
+ const leadHeight = 0.65;
26789
+ const padContactLength = 0.2;
26790
+ const padPitch = 0.65;
26791
+ const extendedBodyDistance = fullWidth - bodyWidth;
26792
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26793
+ /* @__PURE__ */ jsx5(
26794
+ SmdChipLead,
26795
+ {
26796
+ rotation: Math.PI,
26797
+ position: {
26798
+ x: fullWidth / 2 + extendedBodyDistance / 4,
26799
+ y: 0,
26800
+ z: leadThickness / 2
26801
+ },
26802
+ width: leadWidth,
26803
+ thickness: leadThickness,
26804
+ padContactLength,
26805
+ bodyDistance: extendedBodyDistance,
26806
+ height: leadHeight
26807
+ },
26808
+ 4
26809
+ ),
26810
+ /* @__PURE__ */ jsx5(
26811
+ SmdChipLead,
26812
+ {
26813
+ position: {
26814
+ x: -fullWidth / 2 - extendedBodyDistance / 4,
26815
+ y: -padPitch,
26816
+ z: leadThickness / 2
26817
+ },
26818
+ width: leadWidth,
26819
+ thickness: leadThickness,
26820
+ padContactLength,
26821
+ bodyDistance: extendedBodyDistance,
26822
+ height: leadHeight
26823
+ },
26824
+ 1
26825
+ ),
26826
+ /* @__PURE__ */ jsx5(
26827
+ SmdChipLead,
26828
+ {
26829
+ position: {
26830
+ x: -fullWidth / 2 - extendedBodyDistance / 4,
26831
+ y: padPitch,
26832
+ z: leadThickness / 2
26833
+ },
26834
+ width: leadWidth,
26835
+ thickness: leadThickness,
26836
+ padContactLength,
26837
+ bodyDistance: extendedBodyDistance,
26838
+ height: leadHeight
26839
+ },
26840
+ 2
26841
+ ),
26842
+ /* @__PURE__ */ jsx5(
26843
+ ChipBody,
26844
+ {
26845
+ center: { x: 0, y: 0, z: 0 },
26846
+ width: bodyWidth,
26847
+ length: bodyLength10,
26848
+ height: bodyHeight,
26849
+ includeNotch: false,
26850
+ taperRatio: 0.06,
26851
+ straightHeightRatio: 0.7,
26852
+ heightAboveSurface: 0.05
26853
+ }
26854
+ )
26855
+ ] });
26856
+ };
26857
+ var LQFP = ({
26858
+ pinCount,
26859
+ pitch,
26860
+ leadWidth,
26861
+ padContactLength,
26862
+ bodyWidth
26863
+ }) => {
26864
+ const sidePinCount = pinCount / 4;
26865
+ if (sidePinCount !== Math.floor(sidePinCount)) {
26866
+ throw new Error(`LQFP pinCount must be divisible by 4, got ${pinCount}`);
26867
+ }
26868
+ if (!pitch) pitch = 0.5;
26869
+ if (!padContactLength) padContactLength = 0.6;
26870
+ if (!leadWidth) leadWidth = 0.22;
26871
+ if (!bodyWidth) bodyWidth = pitch * (sidePinCount + 4);
26872
+ const bodyLength10 = bodyWidth;
26873
+ const pinOffsetToCenter = (sidePinCount - 1) * pitch / 2;
26874
+ const fullLength10 = bodyLength10 + 3.3 * padContactLength;
26875
+ const fullWidth = fullLength10;
26876
+ const leadHeight = 0.8;
26877
+ const leadThickness = 0.2;
26878
+ const bodyDistance = (fullWidth - bodyWidth) / 2 + 0.4;
26879
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26880
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
26881
+ SmdChipLead,
26882
+ {
26883
+ position: {
26884
+ x: -fullWidth / 2 - 0.36,
26885
+ y: i * pitch - pinOffsetToCenter,
26886
+ z: leadThickness / 2
26887
+ },
26888
+ width: leadWidth,
26889
+ thickness: leadThickness,
26890
+ padContactLength,
26891
+ bodyDistance,
26892
+ height: leadHeight
26893
+ },
26894
+ `left-${i}`
26895
+ )),
26896
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
26897
+ SmdChipLead,
26898
+ {
26899
+ rotation: Math.PI,
26900
+ position: {
26901
+ x: fullWidth / 2 + 0.36,
26902
+ y: i * pitch - pinOffsetToCenter,
26903
+ z: leadThickness / 2
26904
+ },
26905
+ width: leadWidth,
26906
+ thickness: leadThickness,
26907
+ padContactLength,
26908
+ bodyDistance,
26909
+ height: leadHeight
26910
+ },
26911
+ `right-${i}`
26912
+ )),
26913
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
26914
+ SmdChipLead,
26915
+ {
26916
+ rotation: Math.PI / 2,
26917
+ position: {
26918
+ x: i * pitch - pinOffsetToCenter,
26919
+ y: -fullLength10 / 2 - 0.36,
26920
+ z: leadThickness / 2
26921
+ },
26922
+ width: leadWidth,
26923
+ thickness: leadThickness,
26924
+ padContactLength,
26925
+ bodyDistance,
26926
+ height: leadHeight
26927
+ },
26928
+ `bottom-${i}`
26929
+ )),
26930
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
26931
+ SmdChipLead,
26932
+ {
26933
+ rotation: -Math.PI / 2,
26934
+ position: {
26935
+ x: i * pitch - pinOffsetToCenter,
26936
+ y: fullLength10 / 2 + 0.36,
26937
+ z: leadThickness / 2
26938
+ },
26939
+ width: leadWidth,
26940
+ thickness: leadThickness,
26941
+ padContactLength,
26942
+ bodyDistance,
26943
+ height: leadHeight
26944
+ },
26945
+ `top-${i}`
26946
+ )),
26947
+ /* @__PURE__ */ jsx5(
26948
+ ChipBody,
26949
+ {
26950
+ center: { x: 0, y: 0, z: 0 },
26951
+ width: bodyWidth,
26952
+ length: bodyLength10,
26953
+ height: 1.5,
26954
+ heightAboveSurface: 0.1,
26955
+ taperRatio: 0.04,
26956
+ chamferSize: 0.7,
26957
+ notchPosition: {
26958
+ x: bodyLength10 / 2 - 1.5,
26959
+ y: bodyLength10 / 2 - 1.5,
26960
+ z: 1.5
26961
+ },
26962
+ notchRadius: 1.5 / 2
26963
+ }
26964
+ )
26965
+ ] });
26966
+ };
26967
+ var getCcwSot723Coords2 = (pn) => {
26968
+ if (pn === 1) {
26969
+ return { x: 0, y: 0 };
26970
+ } else if (pn === 2) {
26971
+ return { x: 1, y: -0.4 };
26972
+ } else {
26973
+ return { x: 1, y: 0.4 };
26974
+ }
26975
+ };
26976
+ var SOT723 = () => {
26977
+ const bodyWidth = 0.8;
26978
+ const bodyLength10 = 1.2;
26979
+ const bodyHeight = 0.5;
26980
+ const leadWidth = 0.32;
26981
+ const leadLength = 0.3;
26982
+ const leadHeight = 0.1;
26983
+ const centerLeadWidth = 0.42;
26984
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
26985
+ /* @__PURE__ */ jsx5(Rotate, { rotation: [45 * Math.PI, 0, 0], children: /* @__PURE__ */ jsx5(Translate, { center: [0.475, leadHeight / 2, -0.25], children: /* @__PURE__ */ jsx5(Colorize, { color: "grey", children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyWidth, bodyLength10, bodyHeight] }) }) }) }),
26986
+ [1, 2, 3].map((pn) => {
26987
+ const { x, y } = getCcwSot723Coords2(pn);
26988
+ return /* @__PURE__ */ jsx5(Translate, { center: [x, y, 0.05], children: /* @__PURE__ */ jsx5(
26989
+ Cuboid,
26990
+ {
26991
+ size: [
26992
+ leadLength,
26993
+ pn === 1 ? centerLeadWidth : leadWidth,
26994
+ leadHeight
26995
+ ]
26996
+ }
26997
+ ) }, `lead-${pn}`);
26998
+ })
26999
+ ] });
27000
+ };
27001
+ var DFN = ({
27002
+ num_pins,
27003
+ bodyWidth = 5.3,
27004
+ bodyLength: bodyLength10 = 5.3,
27005
+ bodyThickness = 1,
27006
+ thermalPadSize,
27007
+ // For a body length of 5 the typical pad width/length are 0.6 and 1.
27008
+ // Scale those values proportionally when `bodyLength` changes.
27009
+ padWidth = bodyLength10 / 5.3 * 0.6,
27010
+ padLength = bodyLength10 / 5.3 * 1,
27011
+ pitch = 0.5,
27012
+ thermalPadThickness = 0.2
27013
+ }) => {
27014
+ const pinPositions = [];
27015
+ const pinsPerSide = Math.floor(num_pins / 2);
27016
+ const pinSpan = pitch * (pinsPerSide - 1);
27017
+ for (let i = 0; i < num_pins; i++) {
27018
+ const side = i < pinsPerSide ? "left" : "right";
27019
+ const indexOnSide = i % pinsPerSide;
27020
+ const y = pinSpan / 2 - indexOnSide * pitch;
27021
+ const padSizeX = padLength;
27022
+ const padSizeY = padWidth;
27023
+ const x = side === "left" ? -bodyWidth / 2 + padSizeX / 2 : bodyWidth / 2 - padSizeX / 2;
27024
+ const pinNumber = i + 1;
27025
+ pinPositions.push({ pinNumber, x, y, padSizeX, padSizeY });
27026
+ }
27027
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
27028
+ /* @__PURE__ */ jsx5(
27029
+ ChipBody,
27030
+ {
27031
+ center: { x: 0, y: 0, z: 0 },
27032
+ width: bodyWidth,
27033
+ length: bodyLength10,
27034
+ height: bodyThickness,
27035
+ heightAboveSurface: 0,
27036
+ color: "grey",
27037
+ chamferSize: 0.2,
27038
+ taperRatio: 0,
27039
+ notchPosition: {
27040
+ x: bodyWidth / 2 - padLength,
27041
+ y: bodyLength10 / 2 - padLength,
27042
+ z: bodyThickness
27043
+ }
27044
+ }
27045
+ ),
27046
+ pinPositions.map((p, i) => /* @__PURE__ */ jsx5(
27047
+ Cuboid,
27048
+ {
27049
+ center: [p.x, p.y, thermalPadThickness / 2],
27050
+ size: [p.padSizeX, p.padSizeY, thermalPadThickness]
27051
+ },
27052
+ i
27053
+ )),
27054
+ thermalPadSize?.length !== void 0 && thermalPadSize?.width !== void 0 && /* @__PURE__ */ jsx5(
27055
+ Cuboid,
27056
+ {
27057
+ center: [0, 0, thermalPadThickness / 2],
27058
+ size: [
27059
+ thermalPadSize.width,
27060
+ thermalPadSize.length,
27061
+ thermalPadThickness
27062
+ ]
27063
+ }
27064
+ )
27065
+ ] });
27066
+ };
27067
+ var HC49 = ({
27068
+ bodyLength: bodyLength10 = 10.2,
27069
+ bodyWidth = 4.65,
27070
+ bodyHeight = 13.46,
27071
+ leadSpacing = 5,
27072
+ leadDiameter = 0.8,
27073
+ leadLength = 12.7,
27074
+ color = "#ddd",
27075
+ leadColor = "#b87333"
27076
+ }) => {
27077
+ const halfLength = bodyLength10 / 2;
27078
+ const endRadius = bodyWidth / 2;
27079
+ const endCenterX = halfLength - endRadius;
27080
+ const leadCenterX = leadSpacing / 2;
27081
+ const baseHeight = 0.85;
27082
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
27083
+ /* @__PURE__ */ jsxs(Colorize, { color, children: [
27084
+ /* @__PURE__ */ jsxs(Hull, { children: [
27085
+ /* @__PURE__ */ jsx5(
27086
+ RoundedCylinder,
27087
+ {
27088
+ height: bodyHeight,
27089
+ roundRadius: 0.5,
27090
+ radius: endRadius,
27091
+ center: [-endCenterX, 0, bodyHeight]
27092
+ }
27093
+ ),
27094
+ /* @__PURE__ */ jsx5(
27095
+ RoundedCylinder,
27096
+ {
27097
+ height: bodyHeight,
27098
+ roundRadius: 0.5,
27099
+ radius: endRadius,
27100
+ center: [endCenterX, 0, bodyHeight]
27101
+ }
27102
+ )
27103
+ ] }),
27104
+ /* @__PURE__ */ jsxs(Hull, { children: [
27105
+ /* @__PURE__ */ jsx5(
27106
+ RoundedCylinder,
27107
+ {
27108
+ height: baseHeight,
27109
+ roundRadius: 0.1,
27110
+ radius: endRadius + 0.85,
27111
+ center: [-endCenterX, 0, bodyHeight / 2 + baseHeight / 2]
27112
+ }
27113
+ ),
27114
+ /* @__PURE__ */ jsx5(
27115
+ RoundedCylinder,
27116
+ {
27117
+ height: baseHeight,
27118
+ roundRadius: 0.1,
27119
+ radius: endRadius + 0.85,
27120
+ center: [endCenterX, 0, bodyHeight / 2 + baseHeight / 2]
27121
+ }
27122
+ )
27123
+ ] })
27124
+ ] }),
27125
+ /* @__PURE__ */ jsxs(Colorize, { color: leadColor, children: [
27126
+ /* @__PURE__ */ jsx5(
27127
+ Cylinder,
27128
+ {
27129
+ height: leadLength + bodyHeight / 2,
27130
+ radius: leadDiameter / 2,
27131
+ center: [-leadCenterX + 0.06, 0, -(leadLength / 2) + bodyHeight / 2]
27132
+ }
27133
+ ),
27134
+ /* @__PURE__ */ jsx5(
27135
+ Cylinder,
27136
+ {
27137
+ height: leadLength + bodyHeight / 2,
27138
+ radius: leadDiameter / 2,
27139
+ center: [leadCenterX - 0.06, 0, -(leadLength / 2) + bodyHeight / 2]
27140
+ }
27141
+ )
27142
+ ] })
27143
+ ] });
27144
+ };
27145
+ var MicroMELF = ({
27146
+ bodyLength: bodyLength10 = 1.4,
27147
+ bodyDiameter = 1.1,
27148
+ color = "#3a3a3aff",
27149
+ contactColor = "#c6c6c6",
27150
+ cathodeIdentification = "#111"
27151
+ }) => {
27152
+ const padLength = 0.2;
27153
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
27154
+ /* @__PURE__ */ jsx5(Colorize, { color, children: /* @__PURE__ */ jsxs(Rotate, { rotation: [0, "90deg", 0], children: [
27155
+ /* @__PURE__ */ jsx5(
27156
+ RoundedCuboid,
27157
+ {
27158
+ size: [bodyDiameter, bodyDiameter, bodyLength10 - padLength],
27159
+ roundRadius: padLength,
27160
+ center: [-bodyDiameter / 2, 0, 0.05]
27161
+ }
27162
+ ),
27163
+ /* @__PURE__ */ jsx5(
27164
+ Cylinder,
27165
+ {
27166
+ height: padLength / 2,
27167
+ radius: bodyDiameter / 2 - padLength,
27168
+ center: [-bodyDiameter / 2, 0, -bodyLength10 / 2 + padLength / 2]
27169
+ }
27170
+ )
27171
+ ] }) }),
27172
+ /* @__PURE__ */ jsx5(Colorize, { color: cathodeIdentification, children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, "90deg", 0], children: /* @__PURE__ */ jsx5(
27173
+ RoundedCuboid,
27174
+ {
27175
+ size: [bodyDiameter * 1.01, bodyDiameter * 1.01, bodyLength10 / 3],
27176
+ roundRadius: padLength,
27177
+ center: [-bodyDiameter / 2, 0, -bodyLength10 / 4 + 0.1]
27178
+ }
27179
+ ) }) }),
27180
+ /* @__PURE__ */ jsx5(Colorize, { color: contactColor, children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, "90deg", 0], children: /* @__PURE__ */ jsx5(
27181
+ RoundedCylinder,
27182
+ {
27183
+ height: padLength,
27184
+ radius: bodyDiameter / 2,
27185
+ roundRadius: padLength / 3,
27186
+ center: [-bodyDiameter / 2, 0, -bodyLength10 / 2]
27187
+ }
27188
+ ) }) }),
27189
+ /* @__PURE__ */ jsx5(Colorize, { color: contactColor, children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, "90deg", 0], children: /* @__PURE__ */ jsx5(
27190
+ RoundedCylinder,
27191
+ {
27192
+ height: padLength,
27193
+ radius: bodyDiameter / 2,
27194
+ roundRadius: padLength / 3,
27195
+ center: [-bodyDiameter / 2, 0, bodyLength10 / 2]
27196
+ }
27197
+ ) }) })
27198
+ ] });
27199
+ };
27200
+ var MINIMELF = ({
27201
+ bodyLength: bodyLength10 = 3.5,
27202
+ bodyDiameter = 1.5,
27203
+ color = "#3a3a3aff",
27204
+ contactColor = "#c6c6c6"
27205
+ }) => {
27206
+ const padLength = 0.5;
27207
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
27208
+ /* @__PURE__ */ jsx5(Colorize, { color, children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, "90deg", 0], children: /* @__PURE__ */ jsx5(
27209
+ RoundedCylinder,
27210
+ {
27211
+ height: bodyLength10,
27212
+ radius: bodyDiameter / 2,
27213
+ roundRadius: 0.3,
27214
+ center: [-bodyDiameter / 2, 0, 0]
27215
+ }
27216
+ ) }) }),
27217
+ /* @__PURE__ */ jsx5(Colorize, { color: contactColor, children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, "90deg", 0], children: /* @__PURE__ */ jsx5(
27218
+ RoundedCylinder,
27219
+ {
27220
+ height: padLength,
27221
+ radius: bodyDiameter / 2,
27222
+ roundRadius: 0.2,
27223
+ center: [-bodyDiameter / 2, 0, -bodyLength10 / 2]
27224
+ }
27225
+ ) }) }),
27226
+ /* @__PURE__ */ jsx5(Colorize, { color: contactColor, children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, "90deg", 0], children: /* @__PURE__ */ jsx5(
27227
+ RoundedCylinder,
27228
+ {
27229
+ height: padLength,
27230
+ radius: bodyDiameter / 2,
27231
+ roundRadius: 0.2,
27232
+ center: [-bodyDiameter / 2, 0, bodyLength10 / 2]
27233
+ }
27234
+ ) }) })
27235
+ ] });
27236
+ };
27237
+ var MELF = ({
27238
+ bodyLength: bodyLength10 = 3.9,
27239
+ bodyDiameter = 2.5,
27240
+ color = "#3a3a3aff",
27241
+ contactColor = "#c6c6c6"
27242
+ }) => {
27243
+ const padLength = 0.55;
27244
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
27245
+ /* @__PURE__ */ jsx5(Colorize, { color, children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, "90deg", 0], children: /* @__PURE__ */ jsx5(
27246
+ RoundedCylinder,
27247
+ {
27248
+ height: bodyLength10,
27249
+ radius: bodyDiameter / 2,
27250
+ roundRadius: 0.3,
27251
+ center: [-bodyDiameter / 2, 0, 0]
27252
+ }
27253
+ ) }) }),
27254
+ /* @__PURE__ */ jsx5(Colorize, { color: contactColor, children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, "90deg", 0], children: /* @__PURE__ */ jsx5(
27255
+ RoundedCylinder,
27256
+ {
27257
+ height: padLength,
27258
+ radius: bodyDiameter / 2,
27259
+ roundRadius: 0.2,
27260
+ center: [-bodyDiameter / 2, 0, -bodyLength10 / 2]
27261
+ }
27262
+ ) }) }),
27263
+ /* @__PURE__ */ jsx5(Colorize, { color: contactColor, children: /* @__PURE__ */ jsx5(Rotate, { rotation: [0, "90deg", 0], children: /* @__PURE__ */ jsx5(
27264
+ RoundedCylinder,
27265
+ {
27266
+ height: padLength,
27267
+ radius: bodyDiameter / 2,
27268
+ roundRadius: 0.2,
27269
+ center: [-bodyDiameter / 2, 0, bodyLength10 / 2]
27270
+ }
27271
+ ) }) })
27272
+ ] });
27273
+ };
27274
+ var MS012 = ({
27275
+ pinCount,
27276
+ padContactLength = 0.6,
27277
+ leadWidth = 0.41,
27278
+ pitch = 1.27
27279
+ }) => {
27280
+ if (pinCount % 2 !== 0) {
27281
+ throw new Error("MS012 pinCount must be even");
27282
+ }
27283
+ const sidePinCount = pinCount / 2;
27284
+ const bodyWidth = 4.9;
27285
+ const bodyLength10 = 3.9;
27286
+ const pinOffsetToCenter = (sidePinCount - 1) * pitch / 2;
27287
+ const leadThickness = 0.2;
27288
+ return /* @__PURE__ */ jsxs(Fragment22, { children: [
27289
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
27290
+ SmdChipLead,
27291
+ {
27292
+ position: {
27293
+ x: -bodyLength10 / 2 - padContactLength - 0.3,
27294
+ y: i * pitch - pinOffsetToCenter,
27295
+ z: leadThickness / 2
27296
+ },
27297
+ width: leadWidth,
27298
+ thickness: leadThickness,
27299
+ padContactLength,
27300
+ bodyDistance: padContactLength + 0.4,
27301
+ height: 0.85
27302
+ },
27303
+ i
27304
+ )),
27305
+ Array.from({ length: sidePinCount }).map((_, i) => /* @__PURE__ */ jsx5(
27306
+ SmdChipLead,
27307
+ {
27308
+ rotation: Math.PI,
27309
+ position: {
27310
+ x: bodyLength10 / 2 + padContactLength + 0.3,
27311
+ y: i * pitch - pinOffsetToCenter,
27312
+ z: leadThickness / 2
27313
+ },
27314
+ width: leadWidth,
27315
+ thickness: leadThickness,
27316
+ padContactLength,
27317
+ bodyDistance: padContactLength + 0.4,
27318
+ height: 0.85
27319
+ },
27320
+ `right-${i}`
27321
+ )),
27322
+ /* @__PURE__ */ jsx5(
27323
+ ChipBody,
27324
+ {
27325
+ center: { x: 0, y: 0, z: leadThickness / 2 },
27326
+ width: bodyLength10,
27327
+ length: bodyWidth,
27328
+ height: 1.55,
27329
+ notchPosition: { x: bodyLength10 / 2 - 1, y: bodyWidth / 2 - 1, z: 1.55 },
27330
+ heightAboveSurface: 0.17,
27331
+ taperRatio: 0.09
27332
+ }
27333
+ )
27334
+ ] });
27335
+ };
27336
+ var Footprinter3d = ({ footprint }) => {
27337
+ const fpJson = fp.string(footprint).json();
27338
+ switch (fpJson.fn) {
27339
+ case "dip":
26036
27340
  return /* @__PURE__ */ jsx5(Dip, { numPins: fpJson.num_pins, pitch: fpJson.p, bodyWidth: fpJson.w });
26037
27341
  case "tssop":
26038
27342
  return /* @__PURE__ */ jsx5(
@@ -26045,6 +27349,17 @@ var Footprinter3d = ({ footprint }) => {
26045
27349
  bodyWidth: fpJson.w
26046
27350
  }
26047
27351
  );
27352
+ case "msop":
27353
+ return /* @__PURE__ */ jsx5(
27354
+ MSOP,
27355
+ {
27356
+ pinCount: fpJson.num_pins,
27357
+ padContactLength: fpJson.pl,
27358
+ leadWidth: fpJson.pw,
27359
+ pitch: fpJson.p,
27360
+ bodyWidth: fpJson.w
27361
+ }
27362
+ );
26048
27363
  case "vssop":
26049
27364
  return /* @__PURE__ */ jsx5(
26050
27365
  VSSOP,
@@ -26068,7 +27383,12 @@ var Footprinter3d = ({ footprint }) => {
26068
27383
  bodyWidth: fpJson.w
26069
27384
  }
26070
27385
  );
26071
- case "qfn":
27386
+ case "tqfp":
27387
+ return /* @__PURE__ */ jsx5(tqfp_default, {});
27388
+ case "lqfp":
27389
+ return /* @__PURE__ */ jsx5(LQFP, { pinCount: fpJson.num_pins });
27390
+ case "qfn": {
27391
+ const hasThermalPad = typeof fpJson.thermalpad?.x === "number" && typeof fpJson.thermalpad?.y === "number";
26072
27392
  return /* @__PURE__ */ jsx5(
26073
27393
  qfn_default,
26074
27394
  {
@@ -26078,12 +27398,31 @@ var Footprinter3d = ({ footprint }) => {
26078
27398
  pitch: fpJson.p,
26079
27399
  padLength: fpJson.pl,
26080
27400
  padWidth: fpJson.pw,
26081
- thermalPadSize: {
27401
+ thermalPadSize: hasThermalPad ? {
26082
27402
  width: fpJson.thermalpad.x,
26083
27403
  length: fpJson.thermalpad.y
26084
- }
27404
+ } : void 0
27405
+ }
27406
+ );
27407
+ }
27408
+ case "dfn": {
27409
+ const hasThermalPad = typeof fpJson.thermalpad?.x === "number" && typeof fpJson.thermalpad?.y === "number";
27410
+ return /* @__PURE__ */ jsx5(
27411
+ DFN,
27412
+ {
27413
+ num_pins: fpJson.num_pins,
27414
+ bodyWidth: fpJson.w,
27415
+ bodyLength: fpJson.h,
27416
+ pitch: fpJson.p,
27417
+ padLength: fpJson.pl,
27418
+ padWidth: fpJson.pw,
27419
+ thermalPadSize: hasThermalPad ? {
27420
+ width: fpJson.thermalpad.x,
27421
+ length: fpJson.thermalpad.y
27422
+ } : void 0
26085
27423
  }
26086
27424
  );
27425
+ }
26087
27426
  case "pinrow":
26088
27427
  if (fpJson.male)
26089
27428
  return /* @__PURE__ */ jsx5(PinRow, { numberOfPins: fpJson.num_pins, pitch: fpJson.p });
@@ -26113,6 +27452,10 @@ var Footprinter3d = ({ footprint }) => {
26113
27452
  }
26114
27453
  case "sot235":
26115
27454
  return /* @__PURE__ */ jsx5(SOT_235_default, {});
27455
+ case "sot223":
27456
+ return /* @__PURE__ */ jsx5(SOT223, {});
27457
+ case "sot323":
27458
+ return /* @__PURE__ */ jsx5(SOT323, {});
26116
27459
  case "pushbutton":
26117
27460
  return /* @__PURE__ */ jsx5(
26118
27461
  PushButton,
@@ -26135,6 +27478,42 @@ var Footprinter3d = ({ footprint }) => {
26135
27478
  );
26136
27479
  case "sod523":
26137
27480
  return /* @__PURE__ */ jsx5(SOD523, {});
27481
+ case "sod882":
27482
+ return /* @__PURE__ */ jsx5(SOD882, {});
27483
+ case "sma":
27484
+ return /* @__PURE__ */ jsx5(SMA, {});
27485
+ case "smb":
27486
+ return /* @__PURE__ */ jsx5(SMB, {});
27487
+ case "smc":
27488
+ return /* @__PURE__ */ jsx5(SMC, {});
27489
+ case "smf":
27490
+ return /* @__PURE__ */ jsx5(SMF, {});
27491
+ case "sod123f":
27492
+ return /* @__PURE__ */ jsx5(SOD123F, {});
27493
+ case "sod123fl":
27494
+ return /* @__PURE__ */ jsx5(SOD123FL, {});
27495
+ case "sod923":
27496
+ return /* @__PURE__ */ jsx5(SOD923, {});
27497
+ case "hc49":
27498
+ return /* @__PURE__ */ jsx5(HC49, {});
27499
+ case "micromelf":
27500
+ return /* @__PURE__ */ jsx5(MicroMELF, {});
27501
+ case "minimelf":
27502
+ return /* @__PURE__ */ jsx5(MINIMELF, {});
27503
+ case "melf":
27504
+ return /* @__PURE__ */ jsx5(MELF, {});
27505
+ case "ms012":
27506
+ return /* @__PURE__ */ jsx5(
27507
+ MS012,
27508
+ {
27509
+ pinCount: fpJson.num_pins,
27510
+ padContactLength: fpJson.pl,
27511
+ leadWidth: fpJson.pw,
27512
+ pitch: fpJson.p
27513
+ }
27514
+ );
27515
+ case "sot723":
27516
+ return /* @__PURE__ */ jsx5(SOT723, {});
26138
27517
  }
26139
27518
  const colorMatch = footprint.match(/_color\(([^)]+)\)/);
26140
27519
  const color = colorMatch ? colorMatch[1] : void 0;
@@ -26237,7 +27616,7 @@ function renderNode(node, colorCtx, renderCtx) {
26237
27616
  else if (type === Subtract)
26238
27617
  geom = booleans.subtract(geoms[0], geoms.slice(1));
26239
27618
  else geom = hulls.hull(geoms);
26240
- return [{ geom }];
27619
+ return [{ geom, color: colorCtx }];
26241
27620
  }
26242
27621
  if (type === Polygon) {
26243
27622
  const points = props?.points ?? [];
@@ -26258,7 +27637,7 @@ function renderNode(node, colorCtx, renderCtx) {
26258
27637
  }
26259
27638
  return [{ geom: g3, color: colorCtx ?? props?.color }];
26260
27639
  }
26261
- if (type === Cuboid || type === Cube || type === Cylinder || type === Sphere || type === RoundedCuboid) {
27640
+ if (type === Cuboid || type === Cube || type === Cylinder || type === Sphere || type === RoundedCuboid || type === RoundedCylinder) {
26262
27641
  let g;
26263
27642
  if (type === Cuboid) {
26264
27643
  const size5 = props?.size ?? [1, 1, 1];
@@ -26279,6 +27658,12 @@ function renderNode(node, colorCtx, renderCtx) {
26279
27658
  const radius = props?.radius ?? 1;
26280
27659
  const center = props?.center ?? [0, 0, 0];
26281
27660
  g = primitives.sphere({ radius, center });
27661
+ } else if (type === RoundedCylinder) {
27662
+ const height10 = props?.height ?? 1;
27663
+ const radius = props?.radius ?? 1;
27664
+ const roundRadius = props?.roundRadius ?? 0.1;
27665
+ const center = props?.center ?? [0, 0, 0];
27666
+ g = primitives.roundedCylinder({ height: height10, radius, roundRadius, center });
26282
27667
  } else {
26283
27668
  const size5 = props?.size ?? [1, 1, 1];
26284
27669
  const roundRadius = props?.roundRadius ?? 0.1;
@@ -26783,13 +28168,13 @@ var AnyCadComponent = ({
26783
28168
  };
26784
28169
 
26785
28170
  // src/CadViewerContainer.tsx
26786
- import { forwardRef as forwardRef2, useMemo as useMemo15, useState as useState8 } from "react";
28171
+ import { forwardRef as forwardRef2, useMemo as useMemo15, useRef as useRef6, useState as useState8 } from "react";
26787
28172
  import * as THREE14 from "three";
26788
28173
 
26789
28174
  // package.json
26790
28175
  var package_default = {
26791
28176
  name: "@tscircuit/3d-viewer",
26792
- version: "0.0.429",
28177
+ version: "0.0.431",
26793
28178
  main: "./dist/index.js",
26794
28179
  module: "./dist/index.js",
26795
28180
  type: "module",
@@ -26850,10 +28235,10 @@ var package_default = {
26850
28235
  "@vitejs/plugin-react": "^4.3.4",
26851
28236
  "bun-match-svg": "^0.0.9",
26852
28237
  "bun-types": "1.2.1",
26853
- "circuit-json": "0.0.300",
28238
+ "circuit-json": "0.0.303",
26854
28239
  "circuit-to-svg": "^0.0.179",
26855
28240
  debug: "^4.4.0",
26856
- "jscad-electronics": "^0.0.48",
28241
+ "jscad-electronics": "^0.0.89",
26857
28242
  "jscad-planner": "^0.0.13",
26858
28243
  jsdom: "^26.0.0",
26859
28244
  "manifold-3d": "^3.2.1",
@@ -27075,7 +28460,7 @@ var configureRenderer = (renderer) => {
27075
28460
  // src/react-three/Canvas.tsx
27076
28461
  import { jsx as jsx11 } from "react/jsx-runtime";
27077
28462
  var Canvas = forwardRef(
27078
- ({ children, scene: sceneProps, camera: cameraProps, style }, ref) => {
28463
+ ({ children, scene: sceneProps, camera: cameraProps, style, onCreated }, ref) => {
27079
28464
  const mountRef = useRef4(null);
27080
28465
  const [contextState, setContextState] = useState7(
27081
28466
  null
@@ -27083,6 +28468,8 @@ var Canvas = forwardRef(
27083
28468
  const frameListeners = useRef4(
27084
28469
  []
27085
28470
  );
28471
+ const onCreatedRef = useRef4(void 0);
28472
+ onCreatedRef.current = onCreated;
27086
28473
  const addFrameListener = useCallback4(
27087
28474
  (listener) => {
27088
28475
  frameListeners.current.push(listener);
@@ -27141,6 +28528,7 @@ var Canvas = forwardRef(
27141
28528
  addFrameListener,
27142
28529
  removeFrameListener
27143
28530
  });
28531
+ onCreatedRef.current?.({ camera, renderer });
27144
28532
  let animationFrameId;
27145
28533
  const clock = new THREE10.Clock();
27146
28534
  const animate = () => {
@@ -27200,10 +28588,17 @@ var OrbitControls = ({
27200
28588
  return new ThreeOrbitControls(camera, renderer.domElement);
27201
28589
  }, [camera, renderer]);
27202
28590
  useEffect13(() => {
27203
- if (!onControlsChange) return;
27204
- onControlsChange(controls ?? null);
28591
+ onControlsChange?.(controls ?? null);
28592
+ return () => onControlsChange?.(null);
28593
+ }, [controls, onControlsChange]);
28594
+ useEffect13(() => {
28595
+ if (!controls) return;
28596
+ const handleChange = () => {
28597
+ onControlsChange?.(controls);
28598
+ };
28599
+ controls.addEventListener("change", handleChange);
27205
28600
  return () => {
27206
- onControlsChange(null);
28601
+ controls.removeEventListener("change", handleChange);
27207
28602
  };
27208
28603
  }, [controls, onControlsChange]);
27209
28604
  useEffect13(() => {
@@ -27369,6 +28764,45 @@ var Lights = () => {
27369
28764
  return null;
27370
28765
  };
27371
28766
 
28767
+ // src/hooks/useSessionCamera.ts
28768
+ var CAMERA_KEY = "cadViewerCameraStateSession";
28769
+ var saveCameraToSession = (camera, controls) => {
28770
+ try {
28771
+ const savedCameraSession = {
28772
+ position: camera.position.toArray(),
28773
+ quaternion: camera.quaternion.toArray(),
28774
+ up: camera.up.toArray(),
28775
+ fov: camera.fov ?? 50,
28776
+ target: controls.target.toArray()
28777
+ };
28778
+ sessionStorage.setItem(CAMERA_KEY, JSON.stringify(savedCameraSession));
28779
+ } catch (err) {
28780
+ console.warn("Failed to save camera:", err);
28781
+ }
28782
+ };
28783
+ var loadCameraFromSession = (camera, controls) => {
28784
+ try {
28785
+ const raw = sessionStorage.getItem(CAMERA_KEY);
28786
+ if (!raw) return false;
28787
+ const state = JSON.parse(raw);
28788
+ camera.position.fromArray(state.position);
28789
+ camera.quaternion.fromArray(state.quaternion);
28790
+ camera.up.fromArray(state.up);
28791
+ if ("fov" in camera) {
28792
+ const persp = camera;
28793
+ persp.fov = state.fov;
28794
+ persp.updateProjectionMatrix?.();
28795
+ }
28796
+ controls.target.fromArray(state.target);
28797
+ controls.update();
28798
+ camera.updateMatrixWorld();
28799
+ return true;
28800
+ } catch (err) {
28801
+ console.warn("Failed to restore camera:", err);
28802
+ return false;
28803
+ }
28804
+ };
28805
+
27372
28806
  // src/hooks/useCameraController.ts
27373
28807
  import { useCallback as useCallback5, useEffect as useEffect16, useMemo as useMemo14, useRef as useRef5 } from "react";
27374
28808
  import * as THREE13 from "three";
@@ -27660,6 +29094,10 @@ var CadViewerContainer = forwardRef2(
27660
29094
  const [isInteractionEnabled, setIsInteractionEnabled] = useState8(
27661
29095
  !clickToInteractEnabled
27662
29096
  );
29097
+ const saveTimeoutRef = useRef6(null);
29098
+ const controlsRef = useRef6(null);
29099
+ const cameraRef = useRef6(null);
29100
+ const restoredOnceRef = useRef6(false);
27663
29101
  const gridSectionSize = useMemo15(() => {
27664
29102
  if (!boardDimensions) return 10;
27665
29103
  const width10 = boardDimensions.width ?? 0;
@@ -27713,6 +29151,23 @@ var CadViewerContainer = forwardRef2(
27713
29151
  ref,
27714
29152
  scene: { up: new THREE14.Vector3(0, 0, 1) },
27715
29153
  camera: { up: [0, 0, 1], position: initialCameraPosition },
29154
+ onCreated: ({ camera }) => {
29155
+ cameraRef.current = camera;
29156
+ if (!restoredOnceRef.current && controlsRef.current) {
29157
+ const restored = loadCameraFromSession(
29158
+ cameraRef.current,
29159
+ controlsRef.current
29160
+ );
29161
+ if (restored) restoredOnceRef.current = true;
29162
+ }
29163
+ if (controlsRef.current && !restoredOnceRef.current) {
29164
+ setTimeout(() => {
29165
+ if (cameraRef.current && controlsRef.current) {
29166
+ saveCameraToSession(cameraRef.current, controlsRef.current);
29167
+ }
29168
+ }, 0);
29169
+ }
29170
+ },
27716
29171
  children: [
27717
29172
  /* @__PURE__ */ jsx12(CameraAnimator, { ...cameraAnimatorProps }),
27718
29173
  /* @__PURE__ */ jsx12(RotationTracker, {}),
@@ -27728,7 +29183,26 @@ var CadViewerContainer = forwardRef2(
27728
29183
  enableDamping: true,
27729
29184
  dampingFactor: 0.1,
27730
29185
  target: orbitTarget,
27731
- onControlsChange: handleControlsChange
29186
+ onControlsChange: (controls) => {
29187
+ handleControlsChange(controls);
29188
+ controlsRef.current = controls;
29189
+ if (cameraRef.current && controlsRef.current && !restoredOnceRef.current) {
29190
+ const restored = loadCameraFromSession(
29191
+ cameraRef.current,
29192
+ controlsRef.current
29193
+ );
29194
+ if (restored) {
29195
+ restoredOnceRef.current = true;
29196
+ return;
29197
+ }
29198
+ }
29199
+ clearTimeout(saveTimeoutRef.current);
29200
+ saveTimeoutRef.current = setTimeout(() => {
29201
+ if (cameraRef.current && controlsRef.current) {
29202
+ saveCameraToSession(cameraRef.current, controlsRef.current);
29203
+ }
29204
+ }, 150);
29205
+ }
27732
29206
  }
27733
29207
  ),
27734
29208
  /* @__PURE__ */ jsx12(Lights, {}),
@@ -27852,7 +29326,7 @@ var useStlsFromGeom = (geom) => {
27852
29326
  };
27853
29327
 
27854
29328
  // src/hooks/useBoardGeomBuilder.ts
27855
- import { useState as useState10, useEffect as useEffect18, useRef as useRef6 } from "react";
29329
+ import { useState as useState10, useEffect as useEffect18, useRef as useRef7 } from "react";
27856
29330
 
27857
29331
  // src/soup-to-3d/index.ts
27858
29332
  var import_primitives2 = __toESM(require_primitives(), 1);
@@ -29713,7 +31187,7 @@ var BoardGeomBuilder = class {
29713
31187
  // src/hooks/useBoardGeomBuilder.ts
29714
31188
  var useBoardGeomBuilder = (circuitJson) => {
29715
31189
  const [boardGeom, setBoardGeom] = useState10(null);
29716
- const isProcessingRef = useRef6(false);
31190
+ const isProcessingRef = useRef7(false);
29717
31191
  useEffect18(() => {
29718
31192
  let isCancelled = false;
29719
31193
  if (!circuitJson) {
@@ -30091,7 +31565,7 @@ import { su as su13 } from "@tscircuit/circuit-json-util";
30091
31565
  import { useEffect as useEffect22, useMemo as useMemo21, useState as useState15 } from "react";
30092
31566
 
30093
31567
  // src/hooks/useManifoldBoardBuilder.ts
30094
- import { useState as useState14, useEffect as useEffect21, useMemo as useMemo20, useRef as useRef7 } from "react";
31568
+ import { useState as useState14, useEffect as useEffect21, useMemo as useMemo20, useRef as useRef8 } from "react";
30095
31569
  import { su as su12 } from "@tscircuit/circuit-json-util";
30096
31570
  import * as THREE24 from "three";
30097
31571
 
@@ -31436,7 +32910,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
31436
32910
  const [pcbThickness, setPcbThickness] = useState14(null);
31437
32911
  const [error, setError] = useState14(null);
31438
32912
  const [isLoading, setIsLoading] = useState14(true);
31439
- const manifoldInstancesForCleanup = useRef7([]);
32913
+ const manifoldInstancesForCleanup = useRef8([]);
31440
32914
  const boardData = useMemo20(() => {
31441
32915
  const boards = su12(circuitJson).pcb_board.list();
31442
32916
  if (boards.length === 0) {
@@ -32085,17 +33559,17 @@ try {
32085
33559
  var CadViewerManifold_default = CadViewerManifold;
32086
33560
 
32087
33561
  // src/hooks/useContextMenu.ts
32088
- import { useState as useState16, useCallback as useCallback8, useRef as useRef8, useEffect as useEffect23 } from "react";
33562
+ import { useState as useState16, useCallback as useCallback8, useRef as useRef9, useEffect as useEffect23 } from "react";
32089
33563
  var useContextMenu = ({ containerRef }) => {
32090
33564
  const [menuVisible, setMenuVisible] = useState16(false);
32091
33565
  const [menuPos, setMenuPos] = useState16({
32092
33566
  x: 0,
32093
33567
  y: 0
32094
33568
  });
32095
- const menuRef = useRef8(null);
32096
- const interactionOriginPosRef = useRef8(null);
32097
- const longPressTimeoutRef = useRef8(null);
32098
- const ignoreNextContextMenuRef = useRef8(false);
33569
+ const menuRef = useRef9(null);
33570
+ const interactionOriginPosRef = useRef9(null);
33571
+ const longPressTimeoutRef = useRef9(null);
33572
+ const ignoreNextContextMenuRef = useRef9(false);
32099
33573
  const clearLongPressTimeout = () => {
32100
33574
  if (longPressTimeoutRef.current !== null) {
32101
33575
  clearTimeout(longPressTimeoutRef.current);
@@ -38209,7 +39683,7 @@ var ContextMenu = ({
38209
39683
  import { jsx as jsx34, jsxs as jsxs10 } from "react/jsx-runtime";
38210
39684
  var CadViewerInner = (props) => {
38211
39685
  const [engine, setEngine] = useState33("manifold");
38212
- const containerRef = useRef22(null);
39686
+ const containerRef = useRef23(null);
38213
39687
  const [autoRotate, setAutoRotate] = useState33(() => {
38214
39688
  const stored = window.localStorage.getItem("cadViewerAutoRotate");
38215
39689
  return stored === "false" ? false : true;
@@ -38220,7 +39694,7 @@ var CadViewerInner = (props) => {
38220
39694
  });
38221
39695
  const [cameraPreset, setCameraPreset] = useState33("Custom");
38222
39696
  const { visibility, toggleLayer } = useLayerVisibility();
38223
- const cameraControllerRef = useRef22(null);
39697
+ const cameraControllerRef = useRef23(null);
38224
39698
  const externalCameraControllerReady = props.onCameraControllerReady;
38225
39699
  const {
38226
39700
  menuVisible,
@@ -38229,10 +39703,10 @@ var CadViewerInner = (props) => {
38229
39703
  contextMenuEventHandlers,
38230
39704
  setMenuVisible
38231
39705
  } = useContextMenu({ containerRef });
38232
- const autoRotateUserToggledRef = useRef22(autoRotateUserToggled);
39706
+ const autoRotateUserToggledRef = useRef23(autoRotateUserToggled);
38233
39707
  autoRotateUserToggledRef.current = autoRotateUserToggled;
38234
- const isAnimatingRef = useRef22(false);
38235
- const lastPresetSelectTime = useRef22(0);
39708
+ const isAnimatingRef = useRef23(false);
39709
+ const lastPresetSelectTime = useRef23(0);
38236
39710
  const PRESET_COOLDOWN = 1e3;
38237
39711
  const handleUserInteraction = useCallback20(() => {
38238
39712
  if (isAnimatingRef.current || Date.now() - lastPresetSelectTime.current < PRESET_COOLDOWN) {