jscad-electronics 0.0.17 → 0.0.19

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;
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)(
@@ -78901,15 +78951,90 @@ var getLeadWidth = (pinCount, width4) => {
78901
78951
  }
78902
78952
  };
78903
78953
 
78904
- // lib/Footprinter3d.tsx
78954
+ // lib/PinRow.tsx
78955
+ var import_jscad_fiber10 = __toESM(require_dist(), 1);
78905
78956
  var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
78957
+ var PinRow = ({
78958
+ numberOfPins,
78959
+ pitch = 2.54,
78960
+ longSidePinLength = 6
78961
+ }) => {
78962
+ const pinThickness = 0.63;
78963
+ const bodyHeight = 2;
78964
+ const bodyWidth = numberOfPins * pitch;
78965
+ const shortSidePinLength = 3;
78966
+ const xoff = -((numberOfPins - 1) / 2) * pitch;
78967
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
78968
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
78969
+ import_jscad_fiber10.Cuboid,
78970
+ {
78971
+ color: "#222",
78972
+ size: [bodyWidth, pinThickness * 3, bodyHeight],
78973
+ center: [0, 0, bodyHeight / 2]
78974
+ }
78975
+ ),
78976
+ Array.from({ length: numberOfPins }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
78977
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jscad_fiber10.Colorize, { color: "gold", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jscad_fiber10.Hull, { children: [
78978
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
78979
+ import_jscad_fiber10.Cuboid,
78980
+ {
78981
+ color: "gold",
78982
+ size: [pinThickness, pinThickness, shortSidePinLength * 0.9],
78983
+ center: [
78984
+ xoff + i * pitch,
78985
+ 0,
78986
+ bodyHeight * 0.9 + bodyHeight / 2
78987
+ ]
78988
+ }
78989
+ ),
78990
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
78991
+ import_jscad_fiber10.Cuboid,
78992
+ {
78993
+ color: "gold",
78994
+ size: [
78995
+ pinThickness / 1.8,
78996
+ pinThickness / 1.8,
78997
+ shortSidePinLength
78998
+ ],
78999
+ center: [xoff + i * pitch, 0, bodyHeight + bodyHeight / 2]
79000
+ }
79001
+ )
79002
+ ] }) }),
79003
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jscad_fiber10.Colorize, { color: "gold", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jscad_fiber10.Hull, { children: [
79004
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
79005
+ import_jscad_fiber10.Cuboid,
79006
+ {
79007
+ color: "gold",
79008
+ size: [pinThickness, pinThickness, longSidePinLength * 0.9],
79009
+ center: [xoff + i * pitch, 0, -longSidePinLength / 2 * 0.9]
79010
+ }
79011
+ ),
79012
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
79013
+ import_jscad_fiber10.Cuboid,
79014
+ {
79015
+ color: "gold",
79016
+ size: [
79017
+ pinThickness / 1.8,
79018
+ pinThickness / 1.8,
79019
+ longSidePinLength
79020
+ ],
79021
+ center: [xoff + i * pitch, 0, -longSidePinLength / 2]
79022
+ }
79023
+ )
79024
+ ] }) })
79025
+ ] }))
79026
+ ] });
79027
+ };
79028
+
79029
+ // lib/Footprinter3d.tsx
79030
+ var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
78906
79031
  var Footprinter3d = ({ footprint }) => {
78907
79032
  const fpJson = fp3.string(footprint).json();
78908
79033
  switch (fpJson.fn) {
78909
79034
  case "dip":
78910
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Dip, { numPins: fpJson.num_pins, pitch: fpJson.p, bodyWidth: fpJson.w });
79035
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Dip, { numPins: fpJson.num_pins, pitch: fpJson.p, bodyWidth: fpJson.w });
78911
79036
  case "tssop":
78912
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
79037
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
78913
79038
  Tssop,
78914
79039
  {
78915
79040
  pinCount: fpJson.num_pins,
@@ -78920,7 +79045,7 @@ var Footprinter3d = ({ footprint }) => {
78920
79045
  }
78921
79046
  );
78922
79047
  case "qfp":
78923
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
79048
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
78924
79049
  QFP,
78925
79050
  {
78926
79051
  pinCount: fpJson.num_pins,
@@ -78930,8 +79055,20 @@ var Footprinter3d = ({ footprint }) => {
78930
79055
  bodyWidth: fpJson.w
78931
79056
  }
78932
79057
  );
79058
+ case "pinrow":
79059
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PinRow, { numberOfPins: fpJson.num_pins, pitch: fpJson.p });
79060
+ case "cap": {
79061
+ switch (fpJson.imperial) {
79062
+ case "0402":
79063
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(A0402, { color: "#856c4d" });
79064
+ case "0603":
79065
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(A0603, { color: "#856c4d" });
79066
+ case "0805":
79067
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(A0805, { color: "#856c4d" });
79068
+ }
79069
+ }
78933
79070
  case "soic":
78934
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
79071
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
78935
79072
  Tssop,
78936
79073
  {
78937
79074
  pinCount: fpJson.num_pins,
@@ -78944,17 +79081,17 @@ var Footprinter3d = ({ footprint }) => {
78944
79081
  }
78945
79082
  switch (fpJson.imperial) {
78946
79083
  case "0402":
78947
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(A0402, {});
79084
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(A0402, {});
78948
79085
  case "0603":
78949
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(A0603, {});
79086
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(A0603, {});
78950
79087
  case "0805":
78951
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(A0805, {});
79088
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(A0805, {});
78952
79089
  }
78953
79090
  return null;
78954
79091
  };
78955
79092
 
78956
79093
  // lib/SOT-23-3P.tsx
78957
- var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
79094
+ var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
78958
79095
  var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
78959
79096
  const bodyWidth = 1.3;
78960
79097
  const bodyLength4 = 2.9;
@@ -78964,8 +79101,8 @@ var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
78964
79101
  const leadHeight = 0.95;
78965
79102
  const padContactLength = 0.4;
78966
79103
  const extendedBodyDistance = (fullWidth - bodyWidth) / 2 + 0.3;
78967
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
78968
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
79104
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
79105
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
78969
79106
  SmdChipLead,
78970
79107
  {
78971
79108
  rotation: Math.PI,
@@ -78982,7 +79119,7 @@ var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
78982
79119
  },
78983
79120
  1
78984
79121
  ),
78985
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
79122
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
78986
79123
  SmdChipLead,
78987
79124
  {
78988
79125
  rotation: Math.PI,
@@ -78999,7 +79136,7 @@ var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
78999
79136
  },
79000
79137
  2
79001
79138
  ),
79002
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
79139
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
79003
79140
  SmdChipLead,
79004
79141
  {
79005
79142
  position: {
@@ -79015,7 +79152,7 @@ var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
79015
79152
  },
79016
79153
  3
79017
79154
  ),
79018
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
79155
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
79019
79156
  ChipBody,
79020
79157
  {
79021
79158
  center: { x: 0, y: 0, z: 0 },
@@ -79028,8 +79165,8 @@ var SOT233P = ({ fullWidth = 2.9, fullLength: fullLength4 = 2.8 }) => {
79028
79165
  };
79029
79166
 
79030
79167
  // lib/SOT-563.tsx
79031
- var import_jscad_fiber10 = __toESM(require_dist(), 1);
79032
- var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
79168
+ var import_jscad_fiber11 = __toESM(require_dist(), 1);
79169
+ var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
79033
79170
  var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength4 = 1.6 }) => {
79034
79171
  const bodyWidth = 1.2;
79035
79172
  const bodyLength4 = 1.6;
@@ -79039,24 +79176,24 @@ var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength4 = 1.6 }) => {
79039
79176
  const leadHeight = 0.13;
79040
79177
  const leadSpacing = 0.5;
79041
79178
  const bodyZOffset = -0.3;
79042
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
79043
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jscad_fiber10.Rotate, { rotation: [45 * Math.PI, 0, 0], children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jscad_fiber10.Translate, { center: [0, 0, bodyZOffset], children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jscad_fiber10.Colorize, { color: "grey", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jscad_fiber10.Cuboid, { size: [bodyWidth, bodyLength4, bodyHeight] }) }) }) }),
79179
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
79180
+ /* @__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] }) }) }) }),
79044
79181
  [-1, 0, 1].flatMap((yOffset, index) => [
79045
79182
  // Left lead
79046
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
79047
- import_jscad_fiber10.Translate,
79183
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
79184
+ import_jscad_fiber11.Translate,
79048
79185
  {
79049
79186
  center: [-bodyWidth / 2 - 0.03, yOffset * leadSpacing, 0],
79050
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jscad_fiber10.Cuboid, { size: [leadLength, leadWidth, leadHeight] })
79187
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jscad_fiber11.Cuboid, { size: [leadLength, leadWidth, leadHeight] })
79051
79188
  },
79052
79189
  `left-${index}`
79053
79190
  ),
79054
79191
  // Right lead
79055
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
79056
- import_jscad_fiber10.Translate,
79192
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
79193
+ import_jscad_fiber11.Translate,
79057
79194
  {
79058
79195
  center: [bodyWidth / 2 + 0.03, yOffset * leadSpacing, 0],
79059
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jscad_fiber10.Cuboid, { size: [leadLength, leadWidth, leadHeight] })
79196
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jscad_fiber11.Cuboid, { size: [leadLength, leadWidth, leadHeight] })
79060
79197
  },
79061
79198
  `right-${index}`
79062
79199
  )
@@ -79065,8 +79202,8 @@ var SOT563 = ({ fullWidth = 1.94, fullLength: fullLength4 = 1.6 }) => {
79065
79202
  };
79066
79203
 
79067
79204
  // lib/SOT-723.tsx
79068
- var import_jscad_fiber11 = __toESM(require_dist(), 1);
79069
- var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
79205
+ var import_jscad_fiber12 = __toESM(require_dist(), 1);
79206
+ var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
79070
79207
  var getCcwSot723Coords = (pn) => {
79071
79208
  if (pn === 1) {
79072
79209
  return { x: 0, y: 0 };
@@ -79084,12 +79221,12 @@ var SOT723 = () => {
79084
79221
  const leadLength = 0.3;
79085
79222
  const leadHeight = 0.1;
79086
79223
  const centerLeadWidth = 0.42;
79087
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
79088
- /* @__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.475, leadHeight / 2, -0.25], 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] }) }) }) }),
79224
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
79225
+ /* @__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] }) }) }) }),
79089
79226
  [1, 2, 3].map((pn) => {
79090
79227
  const { x, y } = getCcwSot723Coords(pn);
79091
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jscad_fiber11.Translate, { center: [x, y, 0], children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
79092
- import_jscad_fiber11.Cuboid,
79228
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Translate, { center: [x, y, 0], children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
79229
+ import_jscad_fiber12.Cuboid,
79093
79230
  {
79094
79231
  size: [
79095
79232
  leadLength,
@@ -79103,8 +79240,8 @@ var SOT723 = () => {
79103
79240
  };
79104
79241
 
79105
79242
  // lib/qfn.tsx
79106
- var import_jscad_fiber12 = __toESM(require_dist(), 1);
79107
- var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
79243
+ var import_jscad_fiber13 = __toESM(require_dist(), 1);
79244
+ var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
79108
79245
  var QFN = ({
79109
79246
  fullWidth = 5,
79110
79247
  height: height4 = 0.8,
@@ -79113,16 +79250,16 @@ var QFN = ({
79113
79250
  const bodyWidth = fullWidth;
79114
79251
  const bodyLength4 = fullWidth;
79115
79252
  const thermalPadHeight = 0.1;
79116
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
79117
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jscad_fiber12.Colorize, { color: "grey", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
79118
- import_jscad_fiber12.Cuboid,
79253
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
79254
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jscad_fiber13.Colorize, { color: "grey", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
79255
+ import_jscad_fiber13.Cuboid,
79119
79256
  {
79120
79257
  center: { x: 0, y: 0, z: height4 / 2 },
79121
79258
  size: [bodyWidth, bodyLength4, height4]
79122
79259
  }
79123
79260
  ) }),
79124
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
79125
- import_jscad_fiber12.Cuboid,
79261
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
79262
+ import_jscad_fiber13.Cuboid,
79126
79263
  {
79127
79264
  center: { x: 0, y: 0, z: -thermalPadHeight / 2 },
79128
79265
  size: [thermalPadSize, thermalPadSize, thermalPadHeight]
@@ -79132,7 +79269,7 @@ var QFN = ({
79132
79269
  };
79133
79270
 
79134
79271
  // lib/sod-123.tsx
79135
- var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
79272
+ var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
79136
79273
  var SOD123 = ({ fullWidth = 3.8, fullLength: fullLength4 = 1.6 }) => {
79137
79274
  const bodyWidth = 2.9;
79138
79275
  const bodyLength4 = 1.3;
@@ -79144,8 +79281,8 @@ var SOD123 = ({ fullWidth = 3.8, fullLength: fullLength4 = 1.6 }) => {
79144
79281
  const leadYOffset = leadHeight / 1 - 0.4;
79145
79282
  const bodyYOffset = leadHeight / 2 - 0.4;
79146
79283
  const bodyDistance = (fullWidth - bodyWidth) / 2;
79147
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
79148
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
79284
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
79285
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
79149
79286
  SmdChipLead,
79150
79287
  {
79151
79288
  position: {
@@ -79161,7 +79298,7 @@ var SOD123 = ({ fullWidth = 3.8, fullLength: fullLength4 = 1.6 }) => {
79161
79298
  },
79162
79299
  1
79163
79300
  ),
79164
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
79301
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
79165
79302
  SmdChipLead,
79166
79303
  {
79167
79304
  rotation: Math.PI,
@@ -79178,7 +79315,7 @@ var SOD123 = ({ fullWidth = 3.8, fullLength: fullLength4 = 1.6 }) => {
79178
79315
  },
79179
79316
  2
79180
79317
  ),
79181
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
79318
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
79182
79319
  ChipBody,
79183
79320
  {
79184
79321
  center: { x: 0, y: bodyYOffset, z: 0 },
@@ -79189,81 +79326,6 @@ var SOD123 = ({ fullWidth = 3.8, fullLength: fullLength4 = 1.6 }) => {
79189
79326
  )
79190
79327
  ] });
79191
79328
  };
79192
-
79193
- // lib/PinRow.tsx
79194
- var import_jscad_fiber13 = __toESM(require_dist(), 1);
79195
- var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
79196
- var PinRow = ({
79197
- numberOfPins,
79198
- pitch = 2.54,
79199
- longSidePinLength = 6
79200
- }) => {
79201
- const pinThickness = 0.63;
79202
- const bodyHeight = 2;
79203
- const bodyWidth = numberOfPins * pitch;
79204
- const shortSidePinLength = 3;
79205
- const xoff = -((numberOfPins - 1) / 2) * pitch;
79206
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
79207
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
79208
- import_jscad_fiber13.Cuboid,
79209
- {
79210
- color: "#222",
79211
- size: [bodyWidth, pinThickness * 3, bodyHeight],
79212
- center: [0, 0, bodyHeight / 2]
79213
- }
79214
- ),
79215
- Array.from({ length: numberOfPins }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
79216
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jscad_fiber13.Colorize, { color: "gold", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jscad_fiber13.Hull, { children: [
79217
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
79218
- import_jscad_fiber13.Cuboid,
79219
- {
79220
- color: "gold",
79221
- size: [pinThickness, pinThickness, shortSidePinLength * 0.9],
79222
- center: [
79223
- xoff + i * pitch,
79224
- 0,
79225
- bodyHeight * 0.9 + bodyHeight / 2
79226
- ]
79227
- }
79228
- ),
79229
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
79230
- import_jscad_fiber13.Cuboid,
79231
- {
79232
- color: "gold",
79233
- size: [
79234
- pinThickness / 1.8,
79235
- pinThickness / 1.8,
79236
- shortSidePinLength
79237
- ],
79238
- center: [xoff + i * pitch, 0, bodyHeight + bodyHeight / 2]
79239
- }
79240
- )
79241
- ] }) }),
79242
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jscad_fiber13.Colorize, { color: "gold", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jscad_fiber13.Hull, { children: [
79243
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
79244
- import_jscad_fiber13.Cuboid,
79245
- {
79246
- color: "gold",
79247
- size: [pinThickness, pinThickness, longSidePinLength * 0.9],
79248
- center: [xoff + i * pitch, 0, -longSidePinLength / 2 * 0.9]
79249
- }
79250
- ),
79251
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
79252
- import_jscad_fiber13.Cuboid,
79253
- {
79254
- color: "gold",
79255
- size: [
79256
- pinThickness / 1.8,
79257
- pinThickness / 1.8,
79258
- longSidePinLength
79259
- ],
79260
- center: [xoff + i * pitch, 0, -longSidePinLength / 2]
79261
- }
79262
- )
79263
- ] }) })
79264
- ] }))
79265
- ] });
79266
- };
79267
79329
  export {
79268
79330
  A0402,
79269
79331
  A0603,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jscad-electronics",
3
3
  "type": "module",
4
- "version": "0.0.17",
4
+ "version": "0.0.19",
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
  }