jscad-electronics 0.0.18 → 0.0.20

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
@@ -1,11 +1,17 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { AnyCircuitElement, PcbSmtPad, PcbPlatedHole } from 'circuit-json';
3
3
 
4
- declare const A0402: () => react_jsx_runtime.JSX.Element;
4
+ declare const A0402: ({ color }: {
5
+ color?: string | undefined;
6
+ }) => react_jsx_runtime.JSX.Element;
5
7
 
6
- declare const A0603: () => react_jsx_runtime.JSX.Element;
8
+ declare const A0603: ({ color }: {
9
+ color?: string | undefined;
10
+ }) => react_jsx_runtime.JSX.Element;
7
11
 
8
- declare const A0805: () => react_jsx_runtime.JSX.Element;
12
+ declare const A0805: ({ color }: {
13
+ color?: string | undefined;
14
+ }) => react_jsx_runtime.JSX.Element;
9
15
 
10
16
  interface BGAProps {
11
17
  packageWidth?: number;
@@ -94,10 +100,19 @@ declare const Tssop: ({ pinCount, leadLength, leadWidth, pitch, bodyWidth, }: {
94
100
  bodyWidth: number;
95
101
  }) => react_jsx_runtime.JSX.Element;
96
102
 
97
- declare const QFN: ({ fullWidth, height, thermalPadSize, }: {
98
- fullWidth?: number;
99
- height?: number;
100
- thermalPadSize?: number;
103
+ declare const QFN: ({ num_pins, bodyWidth, bodyLength, bodyThickness, thermalPadSize, padWidth, padLength, pitch, thermalPadThickness, }: {
104
+ num_pins: number;
105
+ bodyWidth?: number;
106
+ bodyLength?: number;
107
+ bodyThickness?: number;
108
+ thermalPadSize?: {
109
+ width: number;
110
+ length: number;
111
+ };
112
+ padWidth?: number;
113
+ padLength?: number;
114
+ pitch?: number;
115
+ thermalPadThickness?: number;
101
116
  }) => react_jsx_runtime.JSX.Element;
102
117
 
103
118
  declare const QFP: ({ pinCount, pitch, leadWidth, padContactLength, bodyWidth, }: {
package/dist/index.js CHANGED
@@ -77332,22 +77332,42 @@ var require_dist = __commonJS({
77332
77332
  });
77333
77333
  module.exports = __toCommonJS2(lib_exports);
77334
77334
  var import_react_reconciler2 = __toESM2(require_react_reconciler(), 1);
77335
+ var import_react2 = __toESM2(require_react(), 1);
77336
+ function flattenArray(arr) {
77337
+ return arr.reduce(
77338
+ (flat, item) => flat.concat(Array.isArray(item) ? flattenArray(item) : item),
77339
+ []
77340
+ );
77341
+ }
77335
77342
  function createHostConfig(jscad3) {
77336
77343
  const createInstance = (type, props, rootContainerInstance, hostContext, internalInstanceHandle) => {
77337
77344
  const renderChildren = (children) => {
77345
+ if (!children) return [];
77338
77346
  if (Array.isArray(children)) {
77339
- throw new Error("Unioning multiple children is not yet supported");
77340
- }
77341
- if (children) {
77342
- return createInstance(
77343
- children.type,
77344
- children.props,
77345
- [],
77346
- hostContext,
77347
- internalInstanceHandle
77347
+ return flattenArray(
77348
+ children.filter(import_react2.default.isValidElement).map(
77349
+ (child) => createInstance(
77350
+ child.type,
77351
+ child.props,
77352
+ [],
77353
+ hostContext,
77354
+ internalInstanceHandle
77355
+ )
77356
+ )
77348
77357
  );
77349
77358
  }
77350
- return null;
77359
+ if (import_react2.default.isValidElement(children)) {
77360
+ return [
77361
+ createInstance(
77362
+ children.type,
77363
+ children.props,
77364
+ [],
77365
+ hostContext,
77366
+ internalInstanceHandle
77367
+ )
77368
+ ];
77369
+ }
77370
+ return [];
77351
77371
  };
77352
77372
  if (typeof type === "function") {
77353
77373
  const element = type(props);
@@ -77523,21 +77543,43 @@ var require_dist = __commonJS({
77523
77543
  }
77524
77544
  case "subtract": {
77525
77545
  const { children } = props;
77526
- if (!Array.isArray(children) || children.length < 2) {
77527
- throw new Error("Subtract must have at least two children");
77546
+ if (!children || children.length < 2) {
77547
+ throw new Error(
77548
+ "Subtract must have at least one base component and one component to subtract."
77549
+ );
77528
77550
  }
77529
- const geometries = children.map(
77530
- (child) => createInstance(
77531
- child.type,
77532
- child.props,
77533
- rootContainerInstance,
77534
- hostContext,
77535
- internalInstanceHandle
77536
- )
77551
+ const validChildren = import_react2.default.Children.toArray(children).filter(
77552
+ import_react2.default.isValidElement
77553
+ );
77554
+ if (validChildren.length < 2) {
77555
+ throw new Error(
77556
+ "Subtract must have at least one base component and one component to subtract."
77557
+ );
77558
+ }
77559
+ const baseGeometry = createInstance(
77560
+ validChildren[0].type,
77561
+ validChildren[0].props,
77562
+ rootContainerInstance,
77563
+ hostContext,
77564
+ internalInstanceHandle
77537
77565
  );
77538
- return geometries.reduce(
77539
- (acc, curr) => jscad3.booleans.subtract(acc, curr)
77566
+ const subtractGeometries = flattenArray(
77567
+ validChildren.slice(1).map(
77568
+ (child) => createInstance(
77569
+ child.type,
77570
+ child.props,
77571
+ rootContainerInstance,
77572
+ hostContext,
77573
+ internalInstanceHandle
77574
+ )
77575
+ )
77540
77576
  );
77577
+ if (!baseGeometry || subtractGeometries.some((geo) => geo == null)) {
77578
+ throw new Error(
77579
+ "One or more geometries could not be processed for subtraction."
77580
+ );
77581
+ }
77582
+ return jscad3.booleans.subtract(baseGeometry, subtractGeometries);
77541
77583
  }
77542
77584
  case "translate": {
77543
77585
  const { args, children } = props;
@@ -78012,7 +78054,7 @@ var require_dist = __commonJS({
78012
78054
  withColorProp(ExtrudeFromSlicesBase)
78013
78055
  );
78014
78056
  var jscad = __toESM2(require_src(), 1);
78015
- var import_react2 = __toESM2(require_react(), 1);
78057
+ var import_react22 = __toESM2(require_react(), 1);
78016
78058
  var THREE = __toESM2(require_three(), 1);
78017
78059
  var import_OrbitControls = (init_OrbitControls(), __toCommonJS(OrbitControls_exports));
78018
78060
  var import_three2 = require_three();
@@ -78101,17 +78143,43 @@ var require_dist = __commonJS({
78101
78143
  zAxisUp = false,
78102
78144
  showGrid = false
78103
78145
  }) {
78104
- const containerRef = import_react2.default.useRef(null);
78105
- const sceneRef = import_react2.default.useRef(null);
78106
- const gridRef = import_react2.default.useRef(null);
78107
- import_react2.default.useEffect(() => {
78146
+ const containerRef = import_react22.default.useRef(null);
78147
+ const sceneRef = import_react22.default.useRef(null);
78148
+ const gridRef = import_react22.default.useRef(null);
78149
+ import_react22.default.useEffect(() => {
78108
78150
  if (containerRef.current) {
78109
- let animate2 = function() {
78151
+ let processCGS2 = function(csg) {
78152
+ if (Array.isArray(csg)) {
78153
+ for (const child of csg) {
78154
+ processCGS2(child);
78155
+ }
78156
+ } else {
78157
+ const geometry = convert_csg_to_three_geom_default(csg);
78158
+ if (csg.sides) {
78159
+ const material = new THREE.LineBasicMaterial({
78160
+ vertexColors: true,
78161
+ linewidth: 2
78162
+ // Note: linewidth > 1 only works in WebGL 2
78163
+ });
78164
+ const lineLoop = new THREE.LineLoop(geometry, material);
78165
+ scene.add(lineLoop);
78166
+ } else {
78167
+ const material = new THREE.MeshStandardMaterial({
78168
+ vertexColors: true,
78169
+ wireframe,
78170
+ side: THREE.DoubleSide
78171
+ // Ensure both sides are visible
78172
+ });
78173
+ const mesh = new THREE.Mesh(geometry, material);
78174
+ scene.add(mesh);
78175
+ }
78176
+ }
78177
+ }, animate2 = function() {
78110
78178
  requestAnimationFrame(animate2);
78111
78179
  controls.update();
78112
78180
  renderer.render(scene, camera);
78113
78181
  };
78114
- var animate = animate2;
78182
+ var processCGS = processCGS2, animate = animate2;
78115
78183
  const jscadGeoms = [];
78116
78184
  const root = createJSCADRoot(jscadGeoms);
78117
78185
  root.render(children);
@@ -78145,25 +78213,7 @@ var require_dist = __commonJS({
78145
78213
  scene.add(gridHelper);
78146
78214
  gridRef.current = gridHelper;
78147
78215
  for (const csg of jscadGeoms) {
78148
- const geometry = convert_csg_to_three_geom_default(csg);
78149
- if (csg.sides) {
78150
- const material = new THREE.LineBasicMaterial({
78151
- vertexColors: true,
78152
- linewidth: 2
78153
- // Note: linewidth > 1 only works in WebGL 2
78154
- });
78155
- const lineLoop = new THREE.LineLoop(geometry, material);
78156
- scene.add(lineLoop);
78157
- } else {
78158
- const material = new THREE.MeshStandardMaterial({
78159
- vertexColors: true,
78160
- wireframe,
78161
- side: THREE.DoubleSide
78162
- // Ensure both sides are visible
78163
- });
78164
- const mesh = new THREE.Mesh(geometry, material);
78165
- scene.add(mesh);
78166
- }
78216
+ processCGS2(csg);
78167
78217
  }
78168
78218
  camera.position.x = 20;
78169
78219
  camera.position.y = 20;
@@ -78183,7 +78233,7 @@ var require_dist = __commonJS({
78183
78233
  };
78184
78234
  }
78185
78235
  }, [children, wireframe, zAxisUp, showGrid]);
78186
- import_react2.default.useEffect(() => {
78236
+ import_react22.default.useEffect(() => {
78187
78237
  if (gridRef.current) {
78188
78238
  gridRef.current.visible = showGrid;
78189
78239
  }
@@ -78191,14 +78241,14 @@ var require_dist = __commonJS({
78191
78241
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { ref: containerRef, style: { width: "100%", minHeight: "400px" } });
78192
78242
  }
78193
78243
  var jscad2 = __toESM2(require_src(), 1);
78194
- var import_react22 = require_react();
78244
+ var import_react3 = require_react();
78195
78245
  var import_react_reconciler = __toESM2(require_react_reconciler(), 1);
78196
78246
  var THREE2 = __toESM2(require_three(), 1);
78197
78247
  var hostConfig = createHostConfig(jscad2);
78198
78248
  var reconciler = (0, import_react_reconciler.default)(hostConfig);
78199
78249
  function useJSCADRenderer(children) {
78200
- const container = (0, import_react22.useMemo)(() => [], []);
78201
- const root = (0, import_react22.useMemo)(() => {
78250
+ const container = (0, import_react3.useMemo)(() => [], []);
78251
+ const root = (0, import_react3.useMemo)(() => {
78202
78252
  const root2 = reconciler.createContainer(
78203
78253
  container,
78204
78254
  0,
@@ -78211,8 +78261,8 @@ var require_dist = __commonJS({
78211
78261
  );
78212
78262
  return root2;
78213
78263
  }, [container]);
78214
- const [mesh, setMesh] = (0, import_react22.useState)(null);
78215
- (0, import_react22.useEffect)(() => {
78264
+ const [mesh, setMesh] = (0, import_react3.useState)(null);
78265
+ (0, import_react3.useEffect)(() => {
78216
78266
  reconciler.updateContainer(children, root, null, () => {
78217
78267
  });
78218
78268
  const scene = new THREE2.Scene();
@@ -78250,15 +78300,15 @@ var require_dist = __commonJS({
78250
78300
  }
78251
78301
  return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("primitive", { object: mesh });
78252
78302
  }
78253
- var import_react3 = __toESM2(require_react(), 1);
78303
+ var import_react4 = __toESM2(require_react(), 1);
78254
78304
  var useRenderElementsToJscadPlan = (jscad3, children) => {
78255
- const { renderer } = import_react3.default.useMemo(() => {
78305
+ const { renderer } = import_react4.default.useMemo(() => {
78256
78306
  const renderer2 = createJSCADRenderer(jscad3);
78257
78307
  return { renderer: renderer2 };
78258
78308
  }, [jscad3]);
78259
- const [error, setError] = import_react3.default.useState(null);
78260
- const [loading, setLoading] = import_react3.default.useState(true);
78261
- const jscadElms = import_react3.default.useMemo(() => {
78309
+ const [error, setError] = import_react4.default.useState(null);
78310
+ const [loading, setLoading] = import_react4.default.useState(true);
78311
+ const jscadElms = import_react4.default.useMemo(() => {
78262
78312
  setLoading(true);
78263
78313
  const jscadElms2 = [];
78264
78314
  const root = renderer.createJSCADRoot(jscadElms2);
@@ -78307,14 +78357,14 @@ var width = 0.5;
78307
78357
  var height = 0.5;
78308
78358
  var terminatorWidth = 0.2;
78309
78359
  var bodyLength = fullLength - terminatorWidth * 2;
78310
- var A0402 = () => {
78360
+ var A0402 = ({ color = "#333" }) => {
78311
78361
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
78312
78362
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
78313
78363
  import_jscad_fiber.Cuboid,
78314
78364
  {
78315
78365
  size: [bodyLength, width, height],
78316
78366
  offset: [0, 0, height / 2],
78317
- color: "#333"
78367
+ color
78318
78368
  }
78319
78369
  ),
78320
78370
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -78344,14 +78394,14 @@ var bodyLength2 = fullLength2 - 0.3 * 2;
78344
78394
  var terminatorLength = 0.3;
78345
78395
  var width2 = 0.85;
78346
78396
  var height2 = 0.6;
78347
- var A0603 = () => {
78397
+ var A0603 = ({ color = "#333" }) => {
78348
78398
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
78349
78399
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
78350
78400
  import_jscad_fiber2.Cuboid,
78351
78401
  {
78352
78402
  size: [bodyLength2, width2, height2],
78353
78403
  offset: [0, 0, height2 / 2],
78354
- color: "#333"
78404
+ color
78355
78405
  }
78356
78406
  ),
78357
78407
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
@@ -78381,14 +78431,14 @@ var width3 = 1.25;
78381
78431
  var height3 = 0.55;
78382
78432
  var terminatorWidth2 = 0.5;
78383
78433
  var bodyLength3 = fullLength3 - terminatorWidth2 * 2;
78384
- var A0805 = () => {
78434
+ var A0805 = ({ color = "#333" }) => {
78385
78435
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
78386
78436
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
78387
78437
  import_jscad_fiber3.Cuboid,
78388
78438
  {
78389
78439
  size: [bodyLength3, width3, height3],
78390
78440
  offset: [0, 0, height3 / 2],
78391
- color: "#333"
78441
+ color
78392
78442
  }
78393
78443
  ),
78394
78444
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -78976,15 +79026,179 @@ var PinRow = ({
78976
79026
  ] });
78977
79027
  };
78978
79028
 
78979
- // lib/Footprinter3d.tsx
79029
+ // lib/qfn.tsx
79030
+ var import_jscad_fiber11 = __toESM(require_dist(), 1);
79031
+
79032
+ // lib/utils/getQuadCoords.ts
79033
+ var getQuadCoords = (params) => {
79034
+ const SIDES_CCW = ["left", "bottom", "right", "top"];
79035
+ const { pin_count, pn, w, h, p, pl, legsoutside } = params;
79036
+ const sidePinCount = pin_count / 4;
79037
+ const side = SIDES_CCW[Math.floor((pn - 1) / sidePinCount)];
79038
+ const pos = (pn - 1) % sidePinCount;
79039
+ const ibw = p * (sidePinCount - 1);
79040
+ const ibh = p * (sidePinCount - 1);
79041
+ const pcdfe = legsoutside ? pl / 2 : -pl / 2;
79042
+ switch (side) {
79043
+ case "left":
79044
+ return { x: -w / 2 - pcdfe, y: ibh / 2 - pos * p, o: "vert" };
79045
+ case "bottom":
79046
+ return { x: -ibw / 2 + pos * p, y: -h / 2 - pcdfe, o: "horz" };
79047
+ case "right":
79048
+ return { x: w / 2 + pcdfe, y: -ibh / 2 + pos * p, o: "vert" };
79049
+ case "top":
79050
+ return { x: ibw / 2 - pos * p, y: h / 2 + pcdfe, o: "horz" };
79051
+ default:
79052
+ throw new Error("Invalid pin number");
79053
+ }
79054
+ };
79055
+
79056
+ // lib/utils/getQuadPinMap.ts
79057
+ var getQuadPinMap = ({
79058
+ num_pins,
79059
+ cw,
79060
+ ccw,
79061
+ startingpin
79062
+ }) => {
79063
+ const pin_map = [];
79064
+ const pins_per_side = num_pins / 4;
79065
+ let current_position_ccw_normal = 1;
79066
+ const sfp = {};
79067
+ for (const specifier of startingpin ?? []) {
79068
+ sfp[specifier] = true;
79069
+ }
79070
+ if (!sfp.leftside && !sfp.topside && !sfp.rightside && !sfp.bottomside) {
79071
+ sfp.leftside = true;
79072
+ }
79073
+ if (!sfp.bottompin && !sfp.leftpin && !sfp.rightpin && !sfp.toppin) {
79074
+ if (sfp.leftside) {
79075
+ sfp.toppin = true;
79076
+ } else if (sfp.topside) {
79077
+ sfp.rightpin = true;
79078
+ } else if (sfp.rightside) {
79079
+ sfp.bottompin = true;
79080
+ } else if (sfp.bottomside) {
79081
+ sfp.leftpin = true;
79082
+ }
79083
+ }
79084
+ if (sfp.leftside && sfp.toppin) {
79085
+ current_position_ccw_normal = 1;
79086
+ } else if (sfp.leftside && sfp.bottompin) {
79087
+ current_position_ccw_normal = pins_per_side;
79088
+ } else if (sfp.bottomside && sfp.leftpin) {
79089
+ current_position_ccw_normal = pins_per_side + 1;
79090
+ } else if (sfp.bottomside && sfp.rightpin) {
79091
+ current_position_ccw_normal = pins_per_side * 2;
79092
+ } else if (sfp.rightside && sfp.bottompin) {
79093
+ current_position_ccw_normal = pins_per_side * 2 + 1;
79094
+ } else if (sfp.rightside && sfp.toppin) {
79095
+ current_position_ccw_normal = pins_per_side * 3;
79096
+ } else if (sfp.topside && sfp.rightpin) {
79097
+ current_position_ccw_normal = pins_per_side * 3 + 1;
79098
+ } else if (sfp.topside && sfp.leftpin) {
79099
+ current_position_ccw_normal = pins_per_side * 4;
79100
+ }
79101
+ pin_map.push(-1);
79102
+ for (let i = 0; i < num_pins; i++) {
79103
+ pin_map[current_position_ccw_normal] = i + 1;
79104
+ if (ccw || !cw) {
79105
+ current_position_ccw_normal++;
79106
+ if (current_position_ccw_normal > num_pins) {
79107
+ current_position_ccw_normal = 1;
79108
+ }
79109
+ } else {
79110
+ current_position_ccw_normal--;
79111
+ if (current_position_ccw_normal < 1) {
79112
+ current_position_ccw_normal = num_pins;
79113
+ }
79114
+ }
79115
+ }
79116
+ return pin_map;
79117
+ };
79118
+
79119
+ // lib/qfn.tsx
78980
79120
  var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
79121
+ var QFN = ({
79122
+ num_pins = 16,
79123
+ bodyWidth = 9,
79124
+ bodyLength: bodyLength4 = 9,
79125
+ bodyThickness = 0.8,
79126
+ thermalPadSize,
79127
+ padWidth = 0.25,
79128
+ padLength = 0.25,
79129
+ pitch = 0.5,
79130
+ thermalPadThickness = 0.05
79131
+ }) => {
79132
+ const pin_map = getQuadPinMap({
79133
+ num_pins,
79134
+ cw: true,
79135
+ ccw: true
79136
+ });
79137
+ const pinPositions = [];
79138
+ const spc = num_pins / 4;
79139
+ for (let i = 0; i < num_pins; i++) {
79140
+ const {
79141
+ x,
79142
+ y,
79143
+ o: orientation
79144
+ } = getQuadCoords({
79145
+ pin_count: num_pins,
79146
+ pn: i + 1,
79147
+ w: bodyWidth,
79148
+ h: bodyLength4,
79149
+ p: pitch,
79150
+ pl: padLength,
79151
+ legsoutside: false
79152
+ });
79153
+ let pw = padWidth;
79154
+ let pl = padLength;
79155
+ if (orientation === "vert") {
79156
+ ;
79157
+ [pw, pl] = [pl, pw];
79158
+ }
79159
+ const pn = pin_map[i + 1];
79160
+ pinPositions.push({ pn, x, y, pw, pl });
79161
+ }
79162
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
79163
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jscad_fiber11.Colorize, { color: "grey", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
79164
+ import_jscad_fiber11.Cuboid,
79165
+ {
79166
+ center: { x: 0, y: 0, z: bodyThickness / 2 },
79167
+ size: [bodyWidth, bodyLength4, bodyThickness]
79168
+ }
79169
+ ) }),
79170
+ pinPositions.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
79171
+ import_jscad_fiber11.Cuboid,
79172
+ {
79173
+ center: { x: p.x, y: p.y, z: 0 },
79174
+ size: [p.pw, p.pl, thermalPadThickness]
79175
+ },
79176
+ i
79177
+ )),
79178
+ thermalPadSize?.length !== void 0 && thermalPadSize?.width !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
79179
+ import_jscad_fiber11.Cuboid,
79180
+ {
79181
+ center: { x: 0, y: 0, z: 0 },
79182
+ size: [
79183
+ thermalPadSize.width,
79184
+ thermalPadSize.length,
79185
+ thermalPadThickness
79186
+ ]
79187
+ }
79188
+ )
79189
+ ] });
79190
+ };
79191
+ var qfn_default = QFN;
79192
+
79193
+ // lib/Footprinter3d.tsx
79194
+ var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
78981
79195
  var Footprinter3d = ({ footprint }) => {
78982
79196
  const fpJson = fp3.string(footprint).json();
78983
79197
  switch (fpJson.fn) {
78984
79198
  case "dip":
78985
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Dip, { numPins: fpJson.num_pins, pitch: fpJson.p, bodyWidth: fpJson.w });
79199
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Dip, { numPins: fpJson.num_pins, pitch: fpJson.p, bodyWidth: fpJson.w });
78986
79200
  case "tssop":
78987
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
79201
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
78988
79202
  Tssop,
78989
79203
  {
78990
79204
  pinCount: fpJson.num_pins,
@@ -78995,7 +79209,7 @@ var Footprinter3d = ({ footprint }) => {
78995
79209
  }
78996
79210
  );
78997
79211
  case "qfp":
78998
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
79212
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
78999
79213
  QFP,
79000
79214
  {
79001
79215
  pinCount: fpJson.num_pins,
@@ -79005,10 +79219,36 @@ var Footprinter3d = ({ footprint }) => {
79005
79219
  bodyWidth: fpJson.w
79006
79220
  }
79007
79221
  );
79222
+ case "qfn":
79223
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
79224
+ qfn_default,
79225
+ {
79226
+ num_pins: fpJson.num_pins,
79227
+ bodyWidth: fpJson.w,
79228
+ bodyLength: fpJson.h,
79229
+ pitch: fpJson.p,
79230
+ padLength: fpJson.pl,
79231
+ padWidth: fpJson.pw,
79232
+ thermalPadSize: {
79233
+ width: fpJson.thermalpad.x,
79234
+ length: fpJson.thermalpad.y
79235
+ }
79236
+ }
79237
+ );
79008
79238
  case "pinrow":
79009
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PinRow, { numberOfPins: fpJson.num_pins, pitch: fpJson.p });
79239
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PinRow, { numberOfPins: fpJson.num_pins, pitch: fpJson.p });
79240
+ case "cap": {
79241
+ switch (fpJson.imperial) {
79242
+ case "0402":
79243
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(A0402, { color: "#856c4d" });
79244
+ case "0603":
79245
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(A0603, { color: "#856c4d" });
79246
+ case "0805":
79247
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(A0805, { color: "#856c4d" });
79248
+ }
79249
+ }
79010
79250
  case "soic":
79011
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
79251
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
79012
79252
  Tssop,
79013
79253
  {
79014
79254
  pinCount: fpJson.num_pins,
@@ -79021,17 +79261,17 @@ var Footprinter3d = ({ footprint }) => {
79021
79261
  }
79022
79262
  switch (fpJson.imperial) {
79023
79263
  case "0402":
79024
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(A0402, {});
79264
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(A0402, {});
79025
79265
  case "0603":
79026
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(A0603, {});
79266
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(A0603, {});
79027
79267
  case "0805":
79028
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(A0805, {});
79268
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(A0805, {});
79029
79269
  }
79030
79270
  return null;
79031
79271
  };
79032
79272
 
79033
79273
  // lib/SOT-23-3P.tsx
79034
- var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
79274
+ var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
79035
79275
  var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
79036
79276
  const bodyWidth = 1.3;
79037
79277
  const bodyLength4 = 2.9;
@@ -79041,8 +79281,8 @@ var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
79041
79281
  const leadHeight = 0.95;
79042
79282
  const padContactLength = 0.4;
79043
79283
  const extendedBodyDistance = (fullWidth - bodyWidth) / 2 + 0.3;
79044
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
79045
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
79284
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
79285
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
79046
79286
  SmdChipLead,
79047
79287
  {
79048
79288
  rotation: Math.PI,
@@ -79059,7 +79299,7 @@ var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
79059
79299
  },
79060
79300
  1
79061
79301
  ),
79062
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
79302
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
79063
79303
  SmdChipLead,
79064
79304
  {
79065
79305
  rotation: Math.PI,
@@ -79076,7 +79316,7 @@ var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
79076
79316
  },
79077
79317
  2
79078
79318
  ),
79079
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
79319
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
79080
79320
  SmdChipLead,
79081
79321
  {
79082
79322
  position: {
@@ -79092,7 +79332,7 @@ var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
79092
79332
  },
79093
79333
  3
79094
79334
  ),
79095
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
79335
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
79096
79336
  ChipBody,
79097
79337
  {
79098
79338
  center: { x: 0, y: 0, z: 0 },
@@ -79105,8 +79345,8 @@ var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
79105
79345
  };
79106
79346
 
79107
79347
  // lib/SOT-563.tsx
79108
- var import_jscad_fiber11 = __toESM(require_dist(), 1);
79109
- var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
79348
+ var import_jscad_fiber12 = __toESM(require_dist(), 1);
79349
+ var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
79110
79350
  var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength4 = 1.6 }) => {
79111
79351
  const bodyWidth = 1.2;
79112
79352
  const bodyLength4 = 1.6;
@@ -79116,24 +79356,24 @@ var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength4 = 1.6 }) => {
79116
79356
  const leadHeight = 0.13;
79117
79357
  const leadSpacing = 0.5;
79118
79358
  const bodyZOffset = -0.3;
79119
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
79120
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jscad_fiber11.Rotate, { rotation: [45 * Math.PI, 0, 0], children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jscad_fiber11.Translate, { center: [0, 0, bodyZOffset], children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jscad_fiber11.Colorize, { color: "grey", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jscad_fiber11.Cuboid, { size: [bodyWidth, bodyLength4, bodyHeight] }) }) }) }),
79359
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
79360
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Rotate, { rotation: [45 * Math.PI, 0, 0], children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Translate, { center: [0, 0, bodyZOffset], children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Colorize, { color: "grey", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Cuboid, { size: [bodyWidth, bodyLength4, bodyHeight] }) }) }) }),
79121
79361
  [-1, 0, 1].flatMap((yOffset, index) => [
79122
79362
  // Left lead
79123
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
79124
- import_jscad_fiber11.Translate,
79363
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
79364
+ import_jscad_fiber12.Translate,
79125
79365
  {
79126
79366
  center: [-bodyWidth / 2 - 0.03, yOffset * leadSpacing, 0],
79127
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jscad_fiber11.Cuboid, { size: [leadLength, leadWidth, leadHeight] })
79367
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Cuboid, { size: [leadLength, leadWidth, leadHeight] })
79128
79368
  },
79129
79369
  `left-${index}`
79130
79370
  ),
79131
79371
  // Right lead
79132
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
79133
- import_jscad_fiber11.Translate,
79372
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
79373
+ import_jscad_fiber12.Translate,
79134
79374
  {
79135
79375
  center: [bodyWidth / 2 + 0.03, yOffset * leadSpacing, 0],
79136
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jscad_fiber11.Cuboid, { size: [leadLength, leadWidth, leadHeight] })
79376
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Cuboid, { size: [leadLength, leadWidth, leadHeight] })
79137
79377
  },
79138
79378
  `right-${index}`
79139
79379
  )
@@ -79142,8 +79382,8 @@ var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength4 = 1.6 }) => {
79142
79382
  };
79143
79383
 
79144
79384
  // lib/SOT-723.tsx
79145
- var import_jscad_fiber12 = __toESM(require_dist(), 1);
79146
- var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
79385
+ var import_jscad_fiber13 = __toESM(require_dist(), 1);
79386
+ var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
79147
79387
  var getCcwSot723Coords = (pn) => {
79148
79388
  if (pn === 1) {
79149
79389
  return { x: 0, y: 0 };
@@ -79161,12 +79401,12 @@ var SOT723 = () => {
79161
79401
  const leadLength = 0.3;
79162
79402
  const leadHeight = 0.1;
79163
79403
  const centerLeadWidth = 0.42;
79164
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
79165
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Rotate, { rotation: [45 * Math.PI, 0, 0], children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Translate, { center: [0.475, leadHeight / 2, -0.25], children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Colorize, { color: "grey", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Cuboid, { size: [bodyWidth, bodyLength4, bodyHeight] }) }) }) }),
79404
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
79405
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jscad_fiber13.Rotate, { rotation: [45 * Math.PI, 0, 0], children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jscad_fiber13.Translate, { center: [0.475, leadHeight / 2, -0.25], children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jscad_fiber13.Colorize, { color: "grey", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jscad_fiber13.Cuboid, { size: [bodyWidth, bodyLength4, bodyHeight] }) }) }) }),
79166
79406
  [1, 2, 3].map((pn) => {
79167
79407
  const { x, y } = getCcwSot723Coords(pn);
79168
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Translate, { center: [x, y, 0], children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
79169
- import_jscad_fiber12.Cuboid,
79408
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jscad_fiber13.Translate, { center: [x, y, 0], children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
79409
+ import_jscad_fiber13.Cuboid,
79170
79410
  {
79171
79411
  size: [
79172
79412
  leadLength,
@@ -79179,35 +79419,6 @@ var SOT723 = () => {
79179
79419
  ] });
79180
79420
  };
79181
79421
 
79182
- // lib/qfn.tsx
79183
- var import_jscad_fiber13 = __toESM(require_dist(), 1);
79184
- var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
79185
- var QFN = ({
79186
- fullWidth = 5,
79187
- height: height4 = 0.8,
79188
- thermalPadSize = 2
79189
- }) => {
79190
- const bodyWidth = fullWidth;
79191
- const bodyLength4 = fullWidth;
79192
- const thermalPadHeight = 0.1;
79193
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
79194
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jscad_fiber13.Colorize, { color: "grey", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
79195
- import_jscad_fiber13.Cuboid,
79196
- {
79197
- center: { x: 0, y: 0, z: height4 / 2 },
79198
- size: [bodyWidth, bodyLength4, height4]
79199
- }
79200
- ) }),
79201
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
79202
- import_jscad_fiber13.Cuboid,
79203
- {
79204
- center: { x: 0, y: 0, z: -thermalPadHeight / 2 },
79205
- size: [thermalPadSize, thermalPadSize, thermalPadHeight]
79206
- }
79207
- )
79208
- ] });
79209
- };
79210
-
79211
79422
  // lib/sod-123.tsx
79212
79423
  var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
79213
79424
  var SOD123 = ({ fullWidth = 3.8, fullLength: fullLength4 = 1.6 }) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jscad-electronics",
3
3
  "type": "module",
4
- "version": "0.0.18",
4
+ "version": "0.0.20",
5
5
  "main": "./dist/index.js",
6
6
  "repository": {
7
7
  "type": "git",
@@ -22,7 +22,7 @@
22
22
  "@biomejs/biome": "^1.9.3",
23
23
  "@types/react": "^18.3.11",
24
24
  "@types/react-dom": "^18.3.1",
25
- "jscad-fiber": "^0.0.68",
25
+ "jscad-fiber": "^0.0.71",
26
26
  "react": "^18.3.1",
27
27
  "react-cosmos": "^6.2.0",
28
28
  "react-cosmos-plugin-vite": "^6.2.0",
@@ -32,7 +32,7 @@
32
32
  "vite-tsconfig-paths": "^5.0.1"
33
33
  },
34
34
  "dependencies": {
35
- "@tscircuit/footprinter": "^0.0.70",
36
- "circuit-json": "^0.0.84"
35
+ "@tscircuit/footprinter": "^0.0.82",
36
+ "circuit-json": "^0.0.92"
37
37
  }
38
38
  }