jscad-electronics 0.0.13 → 0.0.15

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 +36 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -77320,6 +77320,7 @@ var require_dist = __commonJS({
77320
77320
  RoundedCuboid: () => RoundedCuboid2,
77321
77321
  RoundedCylinder: () => RoundedCylinder,
77322
77322
  Sphere: () => Sphere2,
77323
+ Subtract: () => Subtract,
77323
77324
  Torus: () => Torus,
77324
77325
  Translate: () => Translate10,
77325
77326
  Union: () => Union3,
@@ -77520,6 +77521,24 @@ var require_dist = __commonJS({
77520
77521
  );
77521
77522
  return geometries.reduce((acc, curr) => jscad3.booleans.union(acc, curr));
77522
77523
  }
77524
+ case "subtract": {
77525
+ const { children } = props;
77526
+ if (!Array.isArray(children) || children.length < 2) {
77527
+ throw new Error("Subtract must have at least two children");
77528
+ }
77529
+ const geometries = children.map(
77530
+ (child) => createInstance(
77531
+ child.type,
77532
+ child.props,
77533
+ rootContainerInstance,
77534
+ hostContext,
77535
+ internalInstanceHandle
77536
+ )
77537
+ );
77538
+ return geometries.reduce(
77539
+ (acc, curr) => jscad3.booleans.subtract(acc, curr)
77540
+ );
77541
+ }
77523
77542
  case "translate": {
77524
77543
  const { args, children } = props;
77525
77544
  const childGeometry = renderChildren(children);
@@ -77931,6 +77950,14 @@ var require_dist = __commonJS({
77931
77950
  };
77932
77951
  var Sphere2 = withColorProp(withOffsetProp(SphereBase));
77933
77952
  var import_jsx_runtime27 = require_jsx_runtime();
77953
+ var SubtractBase = ({ children }) => {
77954
+ if (!Array.isArray(children) || children.length < 2) {
77955
+ throw new Error("Subtract must have at least two children");
77956
+ }
77957
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("subtract", { children });
77958
+ };
77959
+ var Subtract = withOffsetProp(withColorProp(SubtractBase));
77960
+ var import_jsx_runtime28 = require_jsx_runtime();
77934
77961
  var TorusBase = ({
77935
77962
  innerRadius,
77936
77963
  outerRadius,
@@ -77940,7 +77967,7 @@ var require_dist = __commonJS({
77940
77967
  outerRotation = 1,
77941
77968
  startAngle = 0
77942
77969
  }) => {
77943
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
77970
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
77944
77971
  "torus",
77945
77972
  {
77946
77973
  innerRadius,
@@ -77954,11 +77981,11 @@ var require_dist = __commonJS({
77954
77981
  );
77955
77982
  };
77956
77983
  var Torus = withOffsetProp(withColorProp(TorusBase));
77957
- var import_jsx_runtime28 = require_jsx_runtime();
77984
+ var import_jsx_runtime29 = require_jsx_runtime();
77958
77985
  function Union3({ children }) {
77959
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("union", { children });
77986
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("union", { children });
77960
77987
  }
77961
- var import_jsx_runtime29 = require_jsx_runtime();
77988
+ var import_jsx_runtime30 = require_jsx_runtime();
77962
77989
  var ExtrudeFromSlicesBase = ({
77963
77990
  numberOfSlices,
77964
77991
  capStart,
@@ -77968,7 +77995,7 @@ var require_dist = __commonJS({
77968
77995
  baseSlice,
77969
77996
  callback
77970
77997
  }) => {
77971
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
77998
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
77972
77999
  "extrudeFromSlices",
77973
78000
  {
77974
78001
  numberOfSlices,
@@ -78066,7 +78093,7 @@ var require_dist = __commonJS({
78066
78093
  return new import_three2.BufferGeometry();
78067
78094
  }
78068
78095
  var convert_csg_to_three_geom_default = convertCSGToThreeGeom;
78069
- var import_jsx_runtime30 = require_jsx_runtime();
78096
+ var import_jsx_runtime31 = require_jsx_runtime();
78070
78097
  var { createJSCADRoot } = createJSCADRenderer(jscad);
78071
78098
  function JsCadFixture({
78072
78099
  children,
@@ -78161,7 +78188,7 @@ var require_dist = __commonJS({
78161
78188
  gridRef.current.visible = showGrid;
78162
78189
  }
78163
78190
  }, [showGrid]);
78164
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { ref: containerRef, style: { width: "100%", minHeight: "400px" } });
78191
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { ref: containerRef, style: { width: "100%", minHeight: "400px" } });
78165
78192
  }
78166
78193
  var jscad2 = __toESM2(require_src(), 1);
78167
78194
  var import_react22 = require_react();
@@ -78213,7 +78240,7 @@ var require_dist = __commonJS({
78213
78240
  }, [children, root, container]);
78214
78241
  return mesh;
78215
78242
  }
78216
- var import_jsx_runtime31 = require_jsx_runtime();
78243
+ var import_jsx_runtime322 = require_jsx_runtime();
78217
78244
  function JSCadThreeMesh({
78218
78245
  children
78219
78246
  }) {
@@ -78221,7 +78248,7 @@ var require_dist = __commonJS({
78221
78248
  if (!mesh) {
78222
78249
  return null;
78223
78250
  }
78224
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("primitive", { object: mesh });
78251
+ return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("primitive", { object: mesh });
78225
78252
  }
78226
78253
  var import_react3 = __toESM2(require_react(), 1);
78227
78254
  var useRenderElementsToJscadPlan = (jscad3, children) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jscad-electronics",
3
3
  "type": "module",
4
- "version": "0.0.13",
4
+ "version": "0.0.15",
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.67",
25
+ "jscad-fiber": "^0.0.68",
26
26
  "react": "^18.3.1",
27
27
  "react-cosmos": "^6.2.0",
28
28
  "react-cosmos-plugin-vite": "^6.2.0",