brepjs 18.105.0 → 18.107.0

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/brepjs.cjs CHANGED
@@ -12,7 +12,7 @@ const require_planeOps = require("./planeOps-BA4HfgQu.cjs");
12
12
  const require_faceFns = require("./faceFns-DKg2St8b.cjs");
13
13
  const require_shapeFns = require("./shapeFns-L4a8kH_A.cjs");
14
14
  const require_curveFns = require("./curveFns-Dx7_wMut.cjs");
15
- const require_meshFns = require("./meshFns-DNDsv2vH.cjs");
15
+ const require_meshFns = require("./meshFns-BgF4Xesg.cjs");
16
16
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
17
17
  const require_surfaceBuilders = require("./surfaceBuilders-FLnYYA70.cjs");
18
18
  const require_solidBuilders = require("./solidBuilders-CgRmJEdn.cjs");
@@ -30,7 +30,7 @@ const require_loftFns = require("./loftFns-DaRDYpfB.cjs");
30
30
  const require_cameraFns = require("./cameraFns-S7YbAxfg.cjs");
31
31
  const require_textMetrics = require("./textMetrics-W-H6jUDj.cjs");
32
32
  const require_shapeRefFns = require("./shapeRefFns-Dij41NuC.cjs");
33
- const require_workerPool = require("./workerPool-edtPrfHM.cjs");
33
+ const require_workerPool = require("./workerPool-D30NsiIW.cjs");
34
34
  const require_primitiveFns = require("./primitiveFns-BAWtMd9H.cjs");
35
35
  //#region src/topology/shapeBooleans.ts
36
36
  var BOPAlgo_GlueShift = 1;
@@ -7008,6 +7008,7 @@ Object.defineProperty(exports, "io", {
7008
7008
  exports.ioError = require_errors.ioError;
7009
7009
  exports.is2D = require_shapeTypes.is2D;
7010
7010
  exports.is3D = require_shapeTypes.is3D;
7011
+ exports.isBatchRequest = require_workerPool.isBatchRequest;
7011
7012
  exports.isChamferRadius = isChamferRadius;
7012
7013
  exports.isClosedWire = require_shapeTypes.isClosedWire;
7013
7014
  exports.isCompSolid = require_faceFns.isCompSolid;
@@ -7097,6 +7098,7 @@ exports.mechanismDOF = require_threadFns.mechanismDOF;
7097
7098
  exports.mesh = mesh;
7098
7099
  exports.meshEdges = meshEdges;
7099
7100
  exports.meshLODs = require_meshFns.meshLODs;
7101
+ exports.meshLODsProgressive = require_meshFns.meshLODsProgressive;
7100
7102
  exports.meshMultiLOD = require_meshFns.meshMultiLOD;
7101
7103
  exports.minkowski = minkowski;
7102
7104
  exports.mirror = mirror;
package/dist/brepjs.js CHANGED
@@ -10,7 +10,7 @@ import { i as pivotPlane, n as createPlane, o as resolvePlane, r as makePlane, s
10
10
  import { S as shapeType, _ as cast, a as faceOrientation, b as isCompSolid, c as innerWires, d as pointOnSurface, f as projectPointOnFace, g as asTopo, h as uvCoordinates, i as faceGeomType, l as normalAt, m as uvBounds, n as faceAxis, o as flipFaceOrientation, p as removeHolesFromFace, r as faceCenter, s as getSurfaceType, t as classifyPointOnFace, u as outerWire, v as downcast, x as iterTopo, y as fromBREP } from "./faceFns-mo4ThIHz.js";
11
11
  import { C as findFacesByTag, D as tagFaces, E as setTagMetadata, O as getFaceOrigins, S as getShapeColor, T as getTagMetadata, a as isSameShape, b as colorShape, c as applyMatrix$1, d as resize, f as rotate$2, h as translate$2, i as isEqualShape, k as setShapeOrigin, l as composeTransforms, m as transformCopy$1, n as getHashCode, o as simplify$1, p as scale$3, r as isEmpty$2, s as toBREP$1, t as clone$1, u as mirror$2, w as getFaceTags, x as getFaceColor, y as colorFaces } from "./shapeFns-DyBbhU30.js";
12
12
  import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-CG05Jygr.js";
13
- import { a as meshEdges$1, c as clearMeshCache, i as mesh$1, l as createMeshCache, n as exportSTEP, o as meshLODs, r as exportSTL, s as meshMultiLOD, t as exportIGES } from "./meshFns-DoVH8EPW.js";
13
+ import { a as meshEdges$1, c as meshMultiLOD, i as mesh$1, l as clearMeshCache, n as exportSTEP, o as meshLODs, r as exportSTL, s as meshLODsProgressive, t as exportIGES, u as createMeshCache } from "./meshFns-BvP9Tm5Q.js";
14
14
  import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
15
15
  import { _ as makeThreePointArc, d as makeCircle, h as makeLine, l as makeBSplineInterpolation, n as fill, r as makeFace, s as assembleWire } from "./surfaceBuilders-Bww4jhBo.js";
16
16
  import { _ as section$1, b as split$1, d as booleanPipeline, f as cut$2, g as intersect$2, h as fuseAll$2, m as fuse$2, p as cutAll$2, r as makeCylinder, t as makeCompound, v as sectionToFace$1, y as slice$1 } from "./solidBuilders-Biwv2cW3.js";
@@ -29,7 +29,7 @@ import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft,
29
29
  import { a as makeProjectedEdges, i as projectEdges, n as cameraLookAt, r as createCamera, s as isProjectionPlane, t as cameraFromPlane } from "./cameraFns-Bu6jgTKc.js";
30
30
  import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-CBbDQ5QW.js";
31
31
  import { a as updateRoles, i as resolveRef, n as captureHint, o as defaultScorer, r as createRef, t as assignRoles } from "./shapeRefFns-Cn4WNb3q.js";
32
- import { a as createWorkerClient, c as enqueueTask, d as rejectAll, f as isDisposeRequest, g as isSuccessResponse, h as isOperationRequest, i as registerHandler, l as isEmpty$1, m as isInitRequest, n as createOperationRegistry, o as createTaskQueue, p as isErrorResponse, r as createWorkerHandler, s as dequeueTask, t as createWorkerPool, u as pendingCount } from "./workerPool-BxBKpKeI.js";
32
+ import { _ as isSuccessResponse, a as createWorkerClient, c as enqueueTask, d as rejectAll, f as isBatchRequest, g as isOperationRequest, h as isInitRequest, i as registerHandler, l as isEmpty$1, m as isErrorResponse, n as createOperationRegistry, o as createTaskQueue, p as isDisposeRequest, r as createWorkerHandler, s as dequeueTask, t as createWorkerPool, u as pendingCount } from "./workerPool-XcYX2UZ0.js";
33
33
  import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere$1, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus$1, x as subFace, y as solid } from "./primitiveFns-62SO4ti5.js";
34
34
  //#region \0rolldown/runtime.js
35
35
  var __defProp = Object.defineProperty;
@@ -6702,4 +6702,4 @@ var csg_exports = /* @__PURE__ */ __exportAll({
6702
6702
  withEvaluator: () => withEvaluator
6703
6703
  });
6704
6704
  //#endregion
6705
- export { BaseSketcher2d, BlueprintSketcher, BrepBugError, BrepErrorCode, BrepWrapperError, BrepkitAdapter, CompoundSketch, DEFAULT_CAPABILITIES, DEG2RAD, DisposalScope, EXACT_BREP_CAPABILITIES, FaceSketcher, HASH_CODE_MAX, OK, OcctWasmAdapter, RAD2DEG, Sketch, Sketcher, Sketches, addChild, addHoles, addJoint, addMate, addStep, adjacentFaces, all, andThen, applyGlue, applyMatrix, approximateCurve, as2D, as3D, asTopo, assignRoles, autoHeal, bezier, blueprintToDXF, booleanPipeline, booleans_exports as booleans, boss, box, bsplineApprox, bug, cameraFromPlane, cameraLookAt, captureHint, cast, castShape, castShape3D, chamfer, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkAllInterferences, checkBoolean, checkInterference, circle, circularPattern, classifyPointOnFace, clearMeshCache, clone, closedWire, collect, collectShapes, colorFaces, colorShape, complexExtrude, composeTransforms, compound, compoundSketchExtrude, compoundSketchFace, compoundSketchLoft, compoundSketchRevolve, computationError, computeStraightSkeleton, cone, construction_exports as construction, convexHull, cornerFinder, countNodes, createAssembly, createAssemblyNode, createBlueprint, createCamera, createCompound, createCompoundBlueprint, createDistanceQuery, createEdge, createFace, createHandle, createHistory, createKernelHandle, createMeshCache, createNamedPlane, createOperationRegistry, createPlane, createRef, createRegistry, createShell, createSolid, createTaskQueue, createVertex, createWire, createWorkerClient, createWorkerHandler, createWorkerPool, csg_exports as csg, currentQuality, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cut, cut2D, cutAll, cutAllBisect, cutBlueprints, cutWithEvolution, cylinder, cylindricalJoint, defaultScorer, dequeueTask, describe, deserializeDrawing, deserializeHistory, fromBREP as deserializeShape, downcast, draft, draw, drawCircle, drawEllipse, drawFaceOutline, drawParametricFunction, drawPointsInterpolation, drawPolysides, drawProjection, drawRectangle, drawRoundedRectangle, drawSingleCircle, drawSingleEllipse, drawText, drawingChamfer, drawingCut, drawingFillet, drawingFuse, drawingIntersect, drawingToSketchOnPlane, drill, edgeFinder, edgesOfFace, ellipse, ellipseArc, ellipsoid, enqueueTask, err, exportAssemblySTEP, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, exportURDF, extrude, extrudeAll, face, faceAxis, faceCenter, faceFinder, faceGeomType, faceOrientation, facesOfEdge, fieldBoolean, fieldContour, fieldOffset, fieldReinit, fieldShell, fill, filledFace, fillet, filletWithEvolution, findFacesByTag, findNode, findStep, fixSelfIntersection, fixShape, flatMap, flatten, flipFaceOrientation, flipOrientation, fontMetrics, forwardKinematics, fromBREP$1 as fromBREP, fromKernelDir, fromKernelPnt, fromKernelVec, fromNullable, fuse, fuse2D, fuseAll, fuseAllBisect, fuseBlueprints, fuseWithEvolution, gearGeometry, getActiveVoxelId, getBounds, getBounds2D, getCompSolids, getCurveType, getDisposalStats, getEdges, getFaceColor, getFaceOrigins, getFaceTags, getFaces, getFont, getHashCode, getShape as getHistoryShape, getKernel, getKernelCapabilities, getKernelTier, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getOrientation2D, getPerformanceStats, getShapeColor, getShapeKind, getShells, getSingleFace, getSolids, getSurfaceType, getTagMetadata, getVertices, getVoxel, getWires, gridPattern, guidedSweep, heal, healFace, healSolid, healWire, helix, hull, importDXF, importGLB, importIGES, importOBJ, importSTEP, importSTL, importSVG, importSVGPathD, importThreeMF, importURDF, init, initFromManifold, initFromOC, initVoxel, innerWires, instance, instanceCount, instanceGrid, instancedMesh, interpolateCurve, intersect, intersect2D, intersectBlueprints, intersectWithEvolution, invalidateShapeCache, inverseKinematics, ioNs_exports as io, ioError, is2D, is3D, isChamferRadius, isClosedWire, isCompSolid, isCompound, isDisposeRequest, isEdge, isEmpty, isEqualShape, isErr, isErrorResponse, isFace, isFilletRadius, isInitRequest, isInside2D, isInstanced, isLive, isManifoldShell, isNumber, isOk, isOperationRequest, isOrientedFace, isPlanarFace, isPlanarWire, isProjectionPlane, isEmpty$1 as isQueueEmpty, isSameShape, isShape1D, isShape3D, isShell, isSolid, isSuccessResponse, isValid, isValidSolid, isVertex, isWire, iterCompSolids, iterEdges, iterFaces, iterShells, iterSolids, iterTopo, iterVertices, iterWires, jointTrajectory, jointTransform, jointsFromDH, kernelCall, kernelCallRaw, kernelCallScoped, kernelError, latticeInfill, latticeInfillShape, line, linearPattern, loadFont, loft, loftAll, makeBaseBox, makeExternalGear, makeInternalGear, makePlane, makePlanetaryGear, makeProjectedEdges, manifoldShell, map, mapBoth, mapErr, match, materialize, measureArea, measureCurvatureAt, measureCurvatureAtMid, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, measurement_exports as measurement, mechanismDOF, mesh, meshEdges, meshLODs, meshMultiLOD, minkowski, mirror, mirror2D, mirrorDrawing, mirrorJoin, modifiers_exports as modifiers, modifyStep, moduleInitError, multiSectionSweep, normalAt, offset, offsetFace, offsetMesh, offsetShape, offsetWire2D, ok, or, orElse, organiseBlueprints, orientedFace, outerWire, patterns_exports as patterns, pendingCount, pipeline, pivotPlane, planarFace, planarJoint, planarWire, planetPlacements, pocket, pointOnSurface, pointsInside, polygon, polyhedron, polysideInnerRadius, polysidesBlueprint, positionOnCurve, prewarm, primitives_exports as primitives, prismaticJoint, projectEdges, projectPointOnFace, query_exports as query, queryError, rectangularPattern, registerHandler, registerKernel, registerKernelTier, registerOperation, registerShape, registerVoxel, rejectAll, removeChild, removeHolesFromFace, repairMesh, replayFrom, replayHistory, resetDisposalStats, resetPerformanceStats, resize, resolve, resolve3D, resolveDirection, resolvePlane, resolveRef, reverseCurve, revoluteJoint, revolve, roof, rotate, rotate2D, rotateDrawing, roundedRectangleBlueprint, scale, scale2D, scaleDrawing, box$1 as sdfBox, capsule as sdfCapsule, cone$1 as sdfCone, cylinder$1 as sdfCylinder, fieldAxialRamp as sdfFieldAxialRamp, fieldClamp as sdfFieldClamp, fieldConst as sdfFieldConst, fieldFromSdf as sdfFieldFromSdf, fieldRadialRamp as sdfFieldRadialRamp, lattice as sdfLattice, plane as sdfPlane, roundedBox as sdfRoundedBox, sphere as sdfSphere, strutLattice as sdfStrutLattice, sweep as sdfSweep, torus as sdfTorus, section, sectionToFace, serializeHistory, setJointValue, setJointValues, setShapeOrigin, setTagMetadata, sewShells, shape, shapeToMeshInput, shapeType, sharedEdges, shell, shellMesh, shellShape, shellWithEvolution, simplify, sketchCircle, sketchEllipse, sketchExtrude, sketchFace, sketchFaceOffset, sketchHelix, sketchLoft, sketchOnFace2D, sketchOnPlane2D, sketchParametricFunction, sketchPolysides, sketchRectangle, sketchRevolve, sketchRoundedRectangle, sketchSweep, sketchText, sketchWires, sketcherStateError, slice, solid, solidFromShell, solveAssembly, sphere$1 as sphere, sphericalJoint, split, stepCount, stepsFrom, stretch2D, subFace, supportExtrude, supportsConstraintSketch, supportsProjection, surfaceFromGrid, surfaceFromImage, sweep$1 as sweep, tagFaces, tangentArc, tap, tapErr, textBlueprints, textMetrics, thicken, thread, threePointArc, toBREP, toBufferGeometryData, toGroupedBufferGeometryData, toKernelVec, toLODGeometryData, toLODGeometryLevels, toLineGeometryData, toSVGPathD, toVec2, toVec3, torus$1 as torus, tpmsLattice, transformCopy, transforms_exports as transforms, translate, translate2D, translateDrawing, translatePlane, tryCatch, tryCatchAsync, twistExtrude, typeCastError, undoLast, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, updateNode, updateRoles, uvBounds, uvCoordinates, validSolid, validatePlanetary, validationError, variableFillet, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, vertex, vertexFinder, vertexPosition, verticesOfEdge, voxelBoolean, voxelBooleanField, voxelBooleanFieldShapes, voxelBooleanShapes, voxelField, voxelFieldFromShape, walkAssembly, windingNumbers, wire, wireFinder, wireLoop, wiresOfFace, withKernel, withKernelDir, withKernelPnt, withKernelVec, withQuality, withScope, withScopeResult, withScopeResultAsync, withTier, zip as zipResults };
6705
+ export { BaseSketcher2d, BlueprintSketcher, BrepBugError, BrepErrorCode, BrepWrapperError, BrepkitAdapter, CompoundSketch, DEFAULT_CAPABILITIES, DEG2RAD, DisposalScope, EXACT_BREP_CAPABILITIES, FaceSketcher, HASH_CODE_MAX, OK, OcctWasmAdapter, RAD2DEG, Sketch, Sketcher, Sketches, addChild, addHoles, addJoint, addMate, addStep, adjacentFaces, all, andThen, applyGlue, applyMatrix, approximateCurve, as2D, as3D, asTopo, assignRoles, autoHeal, bezier, blueprintToDXF, booleanPipeline, booleans_exports as booleans, boss, box, bsplineApprox, bug, cameraFromPlane, cameraLookAt, captureHint, cast, castShape, castShape3D, chamfer, chamferDistAngle as chamferDistAngleShape, chamferWithEvolution, checkAllInterferences, checkBoolean, checkInterference, circle, circularPattern, classifyPointOnFace, clearMeshCache, clone, closedWire, collect, collectShapes, colorFaces, colorShape, complexExtrude, composeTransforms, compound, compoundSketchExtrude, compoundSketchFace, compoundSketchLoft, compoundSketchRevolve, computationError, computeStraightSkeleton, cone, construction_exports as construction, convexHull, cornerFinder, countNodes, createAssembly, createAssemblyNode, createBlueprint, createCamera, createCompound, createCompoundBlueprint, createDistanceQuery, createEdge, createFace, createHandle, createHistory, createKernelHandle, createMeshCache, createNamedPlane, createOperationRegistry, createPlane, createRef, createRegistry, createShell, createSolid, createTaskQueue, createVertex, createWire, createWorkerClient, createWorkerHandler, createWorkerPool, csg_exports as csg, currentQuality, curve2dBoundingBox, curve2dDistanceFrom, curve2dFirstPoint, curve2dIsOnCurve, curve2dLastPoint, curve2dParameter, curve2dSplitAt, curve2dTangentAt, curveAxis, curveEndPoint, curveIsClosed, curveIsPeriodic, curveLength, curvePeriod, curvePointAt, curveStartPoint, curveTangentAt, cut, cut2D, cutAll, cutAllBisect, cutBlueprints, cutWithEvolution, cylinder, cylindricalJoint, defaultScorer, dequeueTask, describe, deserializeDrawing, deserializeHistory, fromBREP as deserializeShape, downcast, draft, draw, drawCircle, drawEllipse, drawFaceOutline, drawParametricFunction, drawPointsInterpolation, drawPolysides, drawProjection, drawRectangle, drawRoundedRectangle, drawSingleCircle, drawSingleEllipse, drawText, drawingChamfer, drawingCut, drawingFillet, drawingFuse, drawingIntersect, drawingToSketchOnPlane, drill, edgeFinder, edgesOfFace, ellipse, ellipseArc, ellipsoid, enqueueTask, err, exportAssemblySTEP, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, exportURDF, extrude, extrudeAll, face, faceAxis, faceCenter, faceFinder, faceGeomType, faceOrientation, facesOfEdge, fieldBoolean, fieldContour, fieldOffset, fieldReinit, fieldShell, fill, filledFace, fillet, filletWithEvolution, findFacesByTag, findNode, findStep, fixSelfIntersection, fixShape, flatMap, flatten, flipFaceOrientation, flipOrientation, fontMetrics, forwardKinematics, fromBREP$1 as fromBREP, fromKernelDir, fromKernelPnt, fromKernelVec, fromNullable, fuse, fuse2D, fuseAll, fuseAllBisect, fuseBlueprints, fuseWithEvolution, gearGeometry, getActiveVoxelId, getBounds, getBounds2D, getCompSolids, getCurveType, getDisposalStats, getEdges, getFaceColor, getFaceOrigins, getFaceTags, getFaces, getFont, getHashCode, getShape as getHistoryShape, getKernel, getKernelCapabilities, getKernelTier, getNurbsCurveData, getNurbsSurfaceData, getOrientation, getOrientation2D, getPerformanceStats, getShapeColor, getShapeKind, getShells, getSingleFace, getSolids, getSurfaceType, getTagMetadata, getVertices, getVoxel, getWires, gridPattern, guidedSweep, heal, healFace, healSolid, healWire, helix, hull, importDXF, importGLB, importIGES, importOBJ, importSTEP, importSTL, importSVG, importSVGPathD, importThreeMF, importURDF, init, initFromManifold, initFromOC, initVoxel, innerWires, instance, instanceCount, instanceGrid, instancedMesh, interpolateCurve, intersect, intersect2D, intersectBlueprints, intersectWithEvolution, invalidateShapeCache, inverseKinematics, ioNs_exports as io, ioError, is2D, is3D, isBatchRequest, isChamferRadius, isClosedWire, isCompSolid, isCompound, isDisposeRequest, isEdge, isEmpty, isEqualShape, isErr, isErrorResponse, isFace, isFilletRadius, isInitRequest, isInside2D, isInstanced, isLive, isManifoldShell, isNumber, isOk, isOperationRequest, isOrientedFace, isPlanarFace, isPlanarWire, isProjectionPlane, isEmpty$1 as isQueueEmpty, isSameShape, isShape1D, isShape3D, isShell, isSolid, isSuccessResponse, isValid, isValidSolid, isVertex, isWire, iterCompSolids, iterEdges, iterFaces, iterShells, iterSolids, iterTopo, iterVertices, iterWires, jointTrajectory, jointTransform, jointsFromDH, kernelCall, kernelCallRaw, kernelCallScoped, kernelError, latticeInfill, latticeInfillShape, line, linearPattern, loadFont, loft, loftAll, makeBaseBox, makeExternalGear, makeInternalGear, makePlane, makePlanetaryGear, makeProjectedEdges, manifoldShell, map, mapBoth, mapErr, match, materialize, measureArea, measureCurvatureAt, measureCurvatureAtMid, measureDistance, measureDistanceProps, measureLength, measureLinearProps, measureSurfaceProps, measureVolume, measureVolumeProps, measurement_exports as measurement, mechanismDOF, mesh, meshEdges, meshLODs, meshLODsProgressive, meshMultiLOD, minkowski, mirror, mirror2D, mirrorDrawing, mirrorJoin, modifiers_exports as modifiers, modifyStep, moduleInitError, multiSectionSweep, normalAt, offset, offsetFace, offsetMesh, offsetShape, offsetWire2D, ok, or, orElse, organiseBlueprints, orientedFace, outerWire, patterns_exports as patterns, pendingCount, pipeline, pivotPlane, planarFace, planarJoint, planarWire, planetPlacements, pocket, pointOnSurface, pointsInside, polygon, polyhedron, polysideInnerRadius, polysidesBlueprint, positionOnCurve, prewarm, primitives_exports as primitives, prismaticJoint, projectEdges, projectPointOnFace, query_exports as query, queryError, rectangularPattern, registerHandler, registerKernel, registerKernelTier, registerOperation, registerShape, registerVoxel, rejectAll, removeChild, removeHolesFromFace, repairMesh, replayFrom, replayHistory, resetDisposalStats, resetPerformanceStats, resize, resolve, resolve3D, resolveDirection, resolvePlane, resolveRef, reverseCurve, revoluteJoint, revolve, roof, rotate, rotate2D, rotateDrawing, roundedRectangleBlueprint, scale, scale2D, scaleDrawing, box$1 as sdfBox, capsule as sdfCapsule, cone$1 as sdfCone, cylinder$1 as sdfCylinder, fieldAxialRamp as sdfFieldAxialRamp, fieldClamp as sdfFieldClamp, fieldConst as sdfFieldConst, fieldFromSdf as sdfFieldFromSdf, fieldRadialRamp as sdfFieldRadialRamp, lattice as sdfLattice, plane as sdfPlane, roundedBox as sdfRoundedBox, sphere as sdfSphere, strutLattice as sdfStrutLattice, sweep as sdfSweep, torus as sdfTorus, section, sectionToFace, serializeHistory, setJointValue, setJointValues, setShapeOrigin, setTagMetadata, sewShells, shape, shapeToMeshInput, shapeType, sharedEdges, shell, shellMesh, shellShape, shellWithEvolution, simplify, sketchCircle, sketchEllipse, sketchExtrude, sketchFace, sketchFaceOffset, sketchHelix, sketchLoft, sketchOnFace2D, sketchOnPlane2D, sketchParametricFunction, sketchPolysides, sketchRectangle, sketchRevolve, sketchRoundedRectangle, sketchSweep, sketchText, sketchWires, sketcherStateError, slice, solid, solidFromShell, solveAssembly, sphere$1 as sphere, sphericalJoint, split, stepCount, stepsFrom, stretch2D, subFace, supportExtrude, supportsConstraintSketch, supportsProjection, surfaceFromGrid, surfaceFromImage, sweep$1 as sweep, tagFaces, tangentArc, tap, tapErr, textBlueprints, textMetrics, thicken, thread, threePointArc, toBREP, toBufferGeometryData, toGroupedBufferGeometryData, toKernelVec, toLODGeometryData, toLODGeometryLevels, toLineGeometryData, toSVGPathD, toVec2, toVec3, torus$1 as torus, tpmsLattice, transformCopy, transforms_exports as transforms, translate, translate2D, translateDrawing, translatePlane, tryCatch, tryCatchAsync, twistExtrude, typeCastError, undoLast, unsupportedError, unwrap, unwrapErr, unwrapOr, unwrapOrElse, updateNode, updateRoles, uvBounds, uvCoordinates, validSolid, validatePlanetary, validationError, variableFillet, vecAdd, vecAngle, vecCross, vecDistance, vecDot, vecEquals, vecIsZero, vecLength, vecLengthSq, vecNegate, vecNormalize, vecProjectToPlane, vecRepr, vecRotate, vecScale, vecSub, vertex, vertexFinder, vertexPosition, verticesOfEdge, voxelBoolean, voxelBooleanField, voxelBooleanFieldShapes, voxelBooleanShapes, voxelField, voxelFieldFromShape, walkAssembly, windingNumbers, wire, wireFinder, wireLoop, wiresOfFace, withKernel, withKernelDir, withKernelPnt, withKernelVec, withQuality, withScope, withScopeResult, withScopeResultAsync, withTier, zip as zipResults };
package/dist/index.d.ts CHANGED
@@ -92,7 +92,7 @@ export { getCurveType, curveStartPoint, curveEndPoint, curvePointAt, curveTangen
92
92
  export { getNurbsCurveData, getNurbsSurfaceData } from './topology/nurbsFns.js';
93
93
  export type { NurbsCurveData, NurbsSurfaceData } from './kernel/types.js';
94
94
  export { getSurfaceType, faceGeomType, faceOrientation, flipFaceOrientation, uvBounds, pointOnSurface, uvCoordinates, normalAt, faceCenter, faceAxis, classifyPointOnFace, outerWire, innerWires, removeHolesFromFace, projectPointOnFace, type UVBounds, type PointProjectionResult, } from './topology/faceFns.js';
95
- export { exportSTEP, exportSTL, exportIGES, meshMultiLOD, meshLODs, type ShapeMesh, type EdgeMesh, type MeshOptions, type MultiLODMesh, type LODMesh, type MeshLODsOptions, } from './topology/meshFns.js';
95
+ export { exportSTEP, exportSTL, exportIGES, meshMultiLOD, meshLODs, meshLODsProgressive, type ShapeMesh, type EdgeMesh, type MeshOptions, type MultiLODMesh, type LODMesh, type MeshLODsOptions, type MeshLODsProgressiveOptions, type MeshLevelFn, } from './topology/meshFns.js';
96
96
  export { clearMeshCache, createMeshCache, type MeshCacheContext } from './topology/meshCache.js';
97
97
  export { toBufferGeometryData, toLineGeometryData, toGroupedBufferGeometryData, type BufferGeometryData, type LineGeometryData, type GroupedBufferGeometryData, type BufferGeometryGroup, toLODGeometryData, type LODGeometryData, toLODGeometryLevels, type LODGeometryLevel, } from './topology/threeHelpers.js';
98
98
  export { booleanPipeline, type BooleanOptions, type BooleanPipelineStep, } from './topology/booleanFns.js';
@@ -137,7 +137,7 @@ export { importGLB } from './io/gltfImportFns.js';
137
137
  export type { DXFImportOptions } from './io/dxfImportFns.js';
138
138
  export { edgeFinder, faceFinder, wireFinder, vertexFinder, cornerFinder, type EdgeFinderFn, type FaceFinderFn, type WireFinderFn, type VertexFinderFn, type CornerFinderFn, type CornerFilter, type ShapeFinder, } from './query/finderFns.js';
139
139
  export { createCamera, cameraLookAt, cameraFromPlane, projectEdges, type Camera, } from './projection/cameraFns.js';
140
- export { type WorkerRequest, type InitRequest, type OperationRequest, type DisposeRequest, type WorkerResponse, type SuccessResponse, type ErrorResponse, isInitRequest, isOperationRequest, isDisposeRequest, isSuccessResponse, isErrorResponse, type PendingTask, type TaskQueue, createTaskQueue, enqueueTask, dequeueTask, pendingCount, isQueueEmpty, rejectAll, createWorkerClient, createOperationRegistry, registerHandler, createWorkerHandler, createWorkerPool, type WorkerClient, type WorkerClientOptions, type WorkerResult, type OperationHandler, type OperationRegistry, type WorkerPool, type WorkerPoolOptions, type WorkerOperation, } from './worker/index.js';
140
+ export { type WorkerRequest, type InitRequest, type OperationRequest, type DisposeRequest, type WorkerResponse, type SuccessResponse, type ErrorResponse, type BatchRequest, type BatchOperation, type BatchItemResult, isInitRequest, isOperationRequest, isDisposeRequest, isBatchRequest, isSuccessResponse, isErrorResponse, type PendingTask, type TaskQueue, createTaskQueue, enqueueTask, dequeueTask, pendingCount, isQueueEmpty, rejectAll, createWorkerClient, createOperationRegistry, registerHandler, createWorkerHandler, createWorkerPool, type WorkerClient, type WorkerClientOptions, type WorkerResult, type OperationHandler, type OperationRegistry, type WorkerPool, type WorkerPoolOptions, type WorkerOperation, } from './worker/index.js';
141
141
  export type { Shapeable, WrappedMarker, FinderFn, FilletRadius, ChamferDistance, DraftAngle, DraftOptions, DrawingLike, DrillOptions, PocketOptions, BossOptions, MirrorJoinOptions, RectangularPatternOptions, } from './topology/apiTypes.js';
142
142
  export { resolve, resolve3D } from './topology/apiTypes.js';
143
143
  export { box, cylinder, sphere, cone, torus, ellipsoid, line, circle, ellipse, helix, threePointArc, ellipseArc, bsplineApprox, bezier, tangentArc, wire, wireLoop, face, filledFace, subFace, polygon, vertex, compound, solid, offsetFace, sewShells, addHoles, type BoxOptions, type CylinderOptions, type SphereOptions, type ConeOptions, type TorusOptions, type EllipsoidOptions, type CircleOptions, type EllipseOptions, type HelixOptions, type EllipseArcOptions, } from './topology/primitiveFns.js';
package/dist/io.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_meshFns = require("./meshFns-DNDsv2vH.cjs");
2
+ const require_meshFns = require("./meshFns-BgF4Xesg.cjs");
3
3
  const require_importFns = require("./importFns-B6hw9Nhx.cjs");
4
4
  exports.blueprintToDXF = require_importFns.blueprintToDXF;
5
5
  exports.exportDXF = require_importFns.exportDXF;
package/dist/io.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-DoVH8EPW.js";
1
+ import { n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-BvP9Tm5Q.js";
2
2
  import { a as importSVG, c as blueprintToDXF, d as exportGltf, f as exportOBJ, i as exportSTEPConfigured, l as exportDXF, n as importSTEP, o as importSVGPathD, r as importSTL, s as exportThreeMF, t as importIGES, u as exportGlb } from "./importFns-CEczwPdN.js";
3
3
  export { blueprintToDXF, exportDXF, exportGlb, exportGltf, exportIGES, exportOBJ, exportSTEP, exportSTEPConfigured, exportSTL, exportThreeMF, importIGES, importSTEP, importSTL, importSVG, importSVGPathD };
@@ -321,6 +321,24 @@ function boundsDiagonal(shape) {
321
321
  const dz = b.zMax - b.zMin;
322
322
  return Math.sqrt(dx * dx + dy * dy + dz * dz) || 1;
323
323
  }
324
+ /** Per-level linear tolerances for a LOD ladder, coarse (large) → fine (small). */
325
+ function lodTolerances(shape, options) {
326
+ let tolerances;
327
+ if (options.tolerances && options.tolerances.length > 0) tolerances = [...options.tolerances];
328
+ else {
329
+ const levels = Math.max(1, Math.floor(options.levels ?? 3));
330
+ const spacing = options.spacing ?? 4;
331
+ const finest = (options.relativeTolerance ?? 5e-4) * boundsDiagonal(shape) || Number.EPSILON;
332
+ tolerances = [];
333
+ for (let i = levels - 1; i >= 0; i--) tolerances.push(finest * spacing ** i);
334
+ }
335
+ tolerances.sort((a, b) => b - a);
336
+ return tolerances;
337
+ }
338
+ /** A level's angular deflection scales with how much coarser it is than the finest (capped at 1 rad). */
339
+ function levelAngular(tolerance, finestTol, finestAngular) {
340
+ return Math.min(finestAngular * (tolerance / finestTol), 1);
341
+ }
324
342
  /**
325
343
  * Mesh a shape at several levels of detail, coarse → fine.
326
344
  *
@@ -334,22 +352,12 @@ function boundsDiagonal(shape) {
334
352
  * @see toLODGeometryLevels — convert to THREE.LOD geometry data
335
353
  */
336
354
  function meshLODs(shape, options = {}) {
337
- const quality = require_shapeTypes.qualityDeflection();
338
- const finestAngular = options.angularTolerance ?? quality.angularTolerance;
355
+ const finestAngular = options.angularTolerance ?? require_shapeTypes.qualityDeflection().angularTolerance;
339
356
  const cache = options.cache ?? true;
340
- let tolerances;
341
- if (options.tolerances && options.tolerances.length > 0) tolerances = [...options.tolerances];
342
- else {
343
- const levels = Math.max(1, Math.floor(options.levels ?? 3));
344
- const spacing = options.spacing ?? 4;
345
- const finest = (options.relativeTolerance ?? 5e-4) * boundsDiagonal(shape) || Number.EPSILON;
346
- tolerances = [];
347
- for (let i = levels - 1; i >= 0; i--) tolerances.push(finest * spacing ** i);
348
- }
349
- tolerances.sort((a, b) => b - a);
357
+ const tolerances = lodTolerances(shape, options);
350
358
  const finestTol = Math.min(...tolerances);
351
359
  return tolerances.map((tolerance) => {
352
- const angularTolerance = Math.min(finestAngular * (tolerance / finestTol), 1);
360
+ const angularTolerance = levelAngular(tolerance, finestTol, finestAngular);
353
361
  return {
354
362
  tolerance,
355
363
  angularTolerance,
@@ -362,6 +370,59 @@ function meshLODs(shape, options = {}) {
362
370
  };
363
371
  });
364
372
  }
373
+ function nextTick() {
374
+ return new Promise((resolve) => {
375
+ setTimeout(resolve, 0);
376
+ });
377
+ }
378
+ /**
379
+ * Mesh a shape at several levels of detail, delivering them over time coarse →
380
+ * fine instead of all at once — so a viewer paints the coarse preview first and
381
+ * refines as finer levels land.
382
+ *
383
+ * The coarsest level is meshed first and reported via `onLevel`; control then
384
+ * yields to the event loop before each finer (heavier) level so the UI stays
385
+ * responsive. Each level is meshed synchronously on the calling thread by
386
+ * default; pass `meshLevel` to offload finer levels (e.g. to a worker). An
387
+ * aborted `signal` stops refinement and resolves with the levels produced so far.
388
+ *
389
+ * @returns the delivered LOD levels, coarsest → finest.
390
+ * @see meshLODs — the synchronous, all-at-once variant
391
+ */
392
+ async function meshLODsProgressive(shape, options = {}) {
393
+ const finestAngular = options.angularTolerance ?? require_shapeTypes.qualityDeflection().angularTolerance;
394
+ const cache = options.cache ?? true;
395
+ const meshLevel = options.meshLevel ?? ((s, tolerance, angularTolerance) => mesh(s, {
396
+ tolerance,
397
+ angularTolerance,
398
+ cache,
399
+ ...options.signal ? { signal: options.signal } : {}
400
+ }));
401
+ const tolerances = lodTolerances(shape, options);
402
+ const finestTol = Math.min(...tolerances);
403
+ const results = [];
404
+ for (const [index, tolerance] of tolerances.entries()) {
405
+ if (options.signal?.aborted) break;
406
+ const angularTolerance = levelAngular(tolerance, finestTol, finestAngular);
407
+ let levelMesh;
408
+ try {
409
+ levelMesh = await meshLevel(shape, tolerance, angularTolerance);
410
+ } catch (e) {
411
+ if (options.signal?.aborted) break;
412
+ throw e;
413
+ }
414
+ const level = {
415
+ tolerance,
416
+ angularTolerance,
417
+ mesh: levelMesh
418
+ };
419
+ results.push(level);
420
+ options.onLevel?.(level, index);
421
+ if (options.signal?.aborted || index === tolerances.length - 1) break;
422
+ await nextTick();
423
+ }
424
+ return results;
425
+ }
365
426
  //#endregion
366
427
  Object.defineProperty(exports, "clearMeshCache", {
367
428
  enumerable: true,
@@ -411,6 +472,12 @@ Object.defineProperty(exports, "meshLODs", {
411
472
  return meshLODs;
412
473
  }
413
474
  });
475
+ Object.defineProperty(exports, "meshLODsProgressive", {
476
+ enumerable: true,
477
+ get: function() {
478
+ return meshLODsProgressive;
479
+ }
480
+ });
414
481
  Object.defineProperty(exports, "meshMultiLOD", {
415
482
  enumerable: true,
416
483
  get: function() {
@@ -321,6 +321,24 @@ function boundsDiagonal(shape) {
321
321
  const dz = b.zMax - b.zMin;
322
322
  return Math.sqrt(dx * dx + dy * dy + dz * dz) || 1;
323
323
  }
324
+ /** Per-level linear tolerances for a LOD ladder, coarse (large) → fine (small). */
325
+ function lodTolerances(shape, options) {
326
+ let tolerances;
327
+ if (options.tolerances && options.tolerances.length > 0) tolerances = [...options.tolerances];
328
+ else {
329
+ const levels = Math.max(1, Math.floor(options.levels ?? 3));
330
+ const spacing = options.spacing ?? 4;
331
+ const finest = (options.relativeTolerance ?? 5e-4) * boundsDiagonal(shape) || Number.EPSILON;
332
+ tolerances = [];
333
+ for (let i = levels - 1; i >= 0; i--) tolerances.push(finest * spacing ** i);
334
+ }
335
+ tolerances.sort((a, b) => b - a);
336
+ return tolerances;
337
+ }
338
+ /** A level's angular deflection scales with how much coarser it is than the finest (capped at 1 rad). */
339
+ function levelAngular(tolerance, finestTol, finestAngular) {
340
+ return Math.min(finestAngular * (tolerance / finestTol), 1);
341
+ }
324
342
  /**
325
343
  * Mesh a shape at several levels of detail, coarse → fine.
326
344
  *
@@ -334,22 +352,12 @@ function boundsDiagonal(shape) {
334
352
  * @see toLODGeometryLevels — convert to THREE.LOD geometry data
335
353
  */
336
354
  function meshLODs(shape, options = {}) {
337
- const quality = qualityDeflection();
338
- const finestAngular = options.angularTolerance ?? quality.angularTolerance;
355
+ const finestAngular = options.angularTolerance ?? qualityDeflection().angularTolerance;
339
356
  const cache = options.cache ?? true;
340
- let tolerances;
341
- if (options.tolerances && options.tolerances.length > 0) tolerances = [...options.tolerances];
342
- else {
343
- const levels = Math.max(1, Math.floor(options.levels ?? 3));
344
- const spacing = options.spacing ?? 4;
345
- const finest = (options.relativeTolerance ?? 5e-4) * boundsDiagonal(shape) || Number.EPSILON;
346
- tolerances = [];
347
- for (let i = levels - 1; i >= 0; i--) tolerances.push(finest * spacing ** i);
348
- }
349
- tolerances.sort((a, b) => b - a);
357
+ const tolerances = lodTolerances(shape, options);
350
358
  const finestTol = Math.min(...tolerances);
351
359
  return tolerances.map((tolerance) => {
352
- const angularTolerance = Math.min(finestAngular * (tolerance / finestTol), 1);
360
+ const angularTolerance = levelAngular(tolerance, finestTol, finestAngular);
353
361
  return {
354
362
  tolerance,
355
363
  angularTolerance,
@@ -362,5 +370,58 @@ function meshLODs(shape, options = {}) {
362
370
  };
363
371
  });
364
372
  }
373
+ function nextTick() {
374
+ return new Promise((resolve) => {
375
+ setTimeout(resolve, 0);
376
+ });
377
+ }
378
+ /**
379
+ * Mesh a shape at several levels of detail, delivering them over time coarse →
380
+ * fine instead of all at once — so a viewer paints the coarse preview first and
381
+ * refines as finer levels land.
382
+ *
383
+ * The coarsest level is meshed first and reported via `onLevel`; control then
384
+ * yields to the event loop before each finer (heavier) level so the UI stays
385
+ * responsive. Each level is meshed synchronously on the calling thread by
386
+ * default; pass `meshLevel` to offload finer levels (e.g. to a worker). An
387
+ * aborted `signal` stops refinement and resolves with the levels produced so far.
388
+ *
389
+ * @returns the delivered LOD levels, coarsest → finest.
390
+ * @see meshLODs — the synchronous, all-at-once variant
391
+ */
392
+ async function meshLODsProgressive(shape, options = {}) {
393
+ const finestAngular = options.angularTolerance ?? qualityDeflection().angularTolerance;
394
+ const cache = options.cache ?? true;
395
+ const meshLevel = options.meshLevel ?? ((s, tolerance, angularTolerance) => mesh(s, {
396
+ tolerance,
397
+ angularTolerance,
398
+ cache,
399
+ ...options.signal ? { signal: options.signal } : {}
400
+ }));
401
+ const tolerances = lodTolerances(shape, options);
402
+ const finestTol = Math.min(...tolerances);
403
+ const results = [];
404
+ for (const [index, tolerance] of tolerances.entries()) {
405
+ if (options.signal?.aborted) break;
406
+ const angularTolerance = levelAngular(tolerance, finestTol, finestAngular);
407
+ let levelMesh;
408
+ try {
409
+ levelMesh = await meshLevel(shape, tolerance, angularTolerance);
410
+ } catch (e) {
411
+ if (options.signal?.aborted) break;
412
+ throw e;
413
+ }
414
+ const level = {
415
+ tolerance,
416
+ angularTolerance,
417
+ mesh: levelMesh
418
+ };
419
+ results.push(level);
420
+ options.onLevel?.(level, index);
421
+ if (options.signal?.aborted || index === tolerances.length - 1) break;
422
+ await nextTick();
423
+ }
424
+ return results;
425
+ }
365
426
  //#endregion
366
- export { meshEdges as a, clearMeshCache as c, mesh as i, createMeshCache as l, exportSTEP as n, meshLODs as o, exportSTL as r, meshMultiLOD as s, exportIGES as t };
427
+ export { meshEdges as a, meshMultiLOD as c, mesh as i, clearMeshCache as l, exportSTEP as n, meshLODs as o, exportSTL as r, meshLODsProgressive as s, exportIGES as t, createMeshCache as u };
@@ -139,3 +139,34 @@ export interface MeshLODsOptions {
139
139
  * @see toLODGeometryLevels — convert to THREE.LOD geometry data
140
140
  */
141
141
  export declare function meshLODs(shape: AnyShape<Dimension>, options?: MeshLODsOptions): LODMesh[];
142
+ /**
143
+ * Mesh one LOD level. Defaults to the synchronous main-thread {@link mesh}; pass
144
+ * an async implementation (e.g. one that serializes the shape with `toBREP` and
145
+ * meshes it on a worker) to refine finer levels off the main thread.
146
+ */
147
+ export type MeshLevelFn = (shape: AnyShape<Dimension>, tolerance: number, angularTolerance: number) => ShapeMesh | Promise<ShapeMesh>;
148
+ /** Options for {@link meshLODsProgressive}. */
149
+ export interface MeshLODsProgressiveOptions extends MeshLODsOptions {
150
+ /**
151
+ * Called as each level finishes, coarsest first, so a viewer can show the
152
+ * coarse preview immediately and swap in finer meshes as they arrive.
153
+ */
154
+ readonly onLevel?: (level: LODMesh, index: number) => void;
155
+ /** How to mesh one level. Defaults to the synchronous main-thread {@link mesh}. */
156
+ readonly meshLevel?: MeshLevelFn;
157
+ }
158
+ /**
159
+ * Mesh a shape at several levels of detail, delivering them over time coarse →
160
+ * fine instead of all at once — so a viewer paints the coarse preview first and
161
+ * refines as finer levels land.
162
+ *
163
+ * The coarsest level is meshed first and reported via `onLevel`; control then
164
+ * yields to the event loop before each finer (heavier) level so the UI stays
165
+ * responsive. Each level is meshed synchronously on the calling thread by
166
+ * default; pass `meshLevel` to offload finer levels (e.g. to a worker). An
167
+ * aborted `signal` stops refinement and resolves with the levels produced so far.
168
+ *
169
+ * @returns the delivered LOD levels, coarsest → finest.
170
+ * @see meshLODs — the synchronous, all-at-once variant
171
+ */
172
+ export declare function meshLODsProgressive(shape: AnyShape<Dimension>, options?: MeshLODsProgressiveOptions): Promise<LODMesh[]>;
package/dist/topology.cjs CHANGED
@@ -3,7 +3,7 @@ const require_topologyQueryFns = require("./topologyQueryFns-ygBBXxnP.cjs");
3
3
  const require_faceFns = require("./faceFns-DKg2St8b.cjs");
4
4
  const require_shapeFns = require("./shapeFns-L4a8kH_A.cjs");
5
5
  const require_curveFns = require("./curveFns-Dx7_wMut.cjs");
6
- const require_meshFns = require("./meshFns-DNDsv2vH.cjs");
6
+ const require_meshFns = require("./meshFns-BgF4Xesg.cjs");
7
7
  const require_solidBuilders = require("./solidBuilders-CgRmJEdn.cjs");
8
8
  const require_healingFns = require("./healingFns-OL0bBSSY.cjs");
9
9
  const require_primitiveFns = require("./primitiveFns-BAWtMd9H.cjs");
package/dist/topology.js CHANGED
@@ -2,7 +2,7 @@ import { S as vertexPosition, _ as iterFaces, b as iterVertices, c as getFaces,
2
2
  import { S as shapeType, _ as cast, a as faceOrientation, b as isCompSolid, c as innerWires, d as pointOnSurface, f as projectPointOnFace, g as asTopo, h as uvCoordinates, i as faceGeomType, l as normalAt, m as uvBounds, n as faceAxis, o as flipFaceOrientation, r as faceCenter, s as getSurfaceType, t as classifyPointOnFace, u as outerWire, v as downcast, x as iterTopo, y as fromBREP } from "./faceFns-mo4ThIHz.js";
3
3
  import { a as isSameShape, i as isEqualShape, n as getHashCode } from "./shapeFns-DyBbhU30.js";
4
4
  import { a as curveIsPeriodic, c as curvePointAt, d as flipOrientation, f as getCurveType, h as offsetWire2D, i as curveIsClosed, l as curveStartPoint, m as interpolateCurve, n as curveAxis, o as curveLength, p as getOrientation, r as curveEndPoint, s as curvePeriod, t as approximateCurve, u as curveTangentAt } from "./curveFns-CG05Jygr.js";
5
- import { c as clearMeshCache, l as createMeshCache, n as exportSTEP, r as exportSTL, t as exportIGES } from "./meshFns-DoVH8EPW.js";
5
+ import { l as clearMeshCache, n as exportSTEP, r as exportSTL, t as exportIGES, u as createMeshCache } from "./meshFns-BvP9Tm5Q.js";
6
6
  import { h as fuseAll, p as cutAll } from "./solidBuilders-Biwv2cW3.js";
7
7
  import { A as edgesOfFace, B as toLineGeometryData, C as shellWithEvolution, D as getNurbsCurveData, E as fuseAllBisect, F as chamferDistAngle, I as toBufferGeometryData, L as toGroupedBufferGeometryData, M as sharedEdges, N as verticesOfEdge, O as getNurbsSurfaceData, P as wiresOfFace, S as intersectWithEvolution, T as cutAllBisect, _ as positionOnCurve, a as healFace, b as filletWithEvolution, g as variableFillet, j as facesOfEdge, k as adjacentFaces, l as solidFromShell, n as fixSelfIntersection, o as healSolid, r as fixShape, s as healWire, t as autoHeal, v as chamferWithEvolution, w as checkBoolean, x as fuseWithEvolution, y as cutWithEvolution } from "./healingFns-C5AomW4j.js";
8
8
  import { C as threePointArc, D as wireLoop, E as wire, S as tangentArc, T as vertex, _ as polygon, a as circle, b as sphere, c as cylinder, d as ellipsoid, f as face, g as offsetFace, h as line, i as bsplineApprox, l as ellipse, m as helix, n as bezier, o as compound, p as filledFace, r as box, s as cone, t as addHoles, u as ellipseArc, v as sewShells, w as torus, x as subFace, y as solid } from "./primitiveFns-62SO4ti5.js";
@@ -4,7 +4,7 @@
4
4
  * Provides protocol types and helpers for running CAD operations
5
5
  * in Web Workers. Shapes are serialized as BREP strings for transfer.
6
6
  */
7
- export { type WorkerRequest, type InitRequest, type OperationRequest, type DisposeRequest, type WorkerResponse, type SuccessResponse, type ErrorResponse, isInitRequest, isOperationRequest, isDisposeRequest, isSuccessResponse, isErrorResponse, } from './protocol.js';
7
+ export { type WorkerRequest, type InitRequest, type OperationRequest, type DisposeRequest, type WorkerResponse, type SuccessResponse, type ErrorResponse, type BatchRequest, type BatchOperation, type BatchItemResult, isInitRequest, isOperationRequest, isDisposeRequest, isBatchRequest, isSuccessResponse, isErrorResponse, } from './protocol.js';
8
8
  export { type PendingTask, type TaskQueue, createTaskQueue, enqueueTask, dequeueTask, pendingCount, isEmpty as isQueueEmpty, rejectAll, } from './taskQueue.js';
9
9
  export { createWorkerClient, type WorkerClient, type WorkerClientOptions, type WorkerResult, } from './workerClient.js';
10
10
  export { createOperationRegistry, registerHandler, createWorkerHandler, type OperationHandler, type OperationRegistry, } from './workerHandler.js';
@@ -9,7 +9,7 @@ export interface WorkerRequest {
9
9
  /** Unique identifier for correlating requests with responses. */
10
10
  readonly id: string;
11
11
  /** Discriminant indicating the kind of request. */
12
- readonly type: 'init' | 'operation' | 'dispose';
12
+ readonly type: 'init' | 'operation' | 'dispose' | 'batch';
13
13
  }
14
14
  /** Request to initialize the worker (load the WASM geometry kernel). */
15
15
  export interface InitRequest extends WorkerRequest {
@@ -36,6 +36,36 @@ export interface OperationRequest extends WorkerRequest {
36
36
  export interface DisposeRequest extends WorkerRequest {
37
37
  readonly type: 'dispose';
38
38
  }
39
+ /** A single operation inside a {@link BatchRequest}. */
40
+ export interface BatchOperation {
41
+ /** Name of the registered operation to invoke. */
42
+ readonly operation: string;
43
+ /** BREP-serialized input shapes. */
44
+ readonly shapesBrep: ReadonlyArray<string>;
45
+ /** Parameters forwarded to the operation handler. */
46
+ readonly params: Readonly<Record<string, unknown>>;
47
+ }
48
+ /**
49
+ * Request to run several operations in a single message, instead of one
50
+ * message per op. Cuts per-message round-trip + serialization overhead when a
51
+ * caller has many small ops for one worker.
52
+ */
53
+ export interface BatchRequest extends WorkerRequest {
54
+ readonly type: 'batch';
55
+ /** Operations to run, in order. */
56
+ readonly operations: ReadonlyArray<BatchOperation>;
57
+ }
58
+ /**
59
+ * Outcome of one operation in a batch. Each item carries its own success/error,
60
+ * so one failing op doesn't discard the others. Returned (as `resultData`) in
61
+ * the batch's {@link SuccessResponse}.
62
+ */
63
+ export interface BatchItemResult {
64
+ readonly success: boolean;
65
+ readonly resultBrep?: string;
66
+ readonly resultData?: unknown;
67
+ readonly error?: string;
68
+ }
39
69
  /** Base interface for all messages sent from a worker back to the main thread. */
40
70
  export interface WorkerResponse {
41
71
  /** Matches the {@link WorkerRequest.id} of the originating request. */
@@ -63,6 +93,8 @@ export declare function isInitRequest(msg: WorkerRequest): msg is InitRequest;
63
93
  export declare function isOperationRequest(msg: WorkerRequest): msg is OperationRequest;
64
94
  /** Narrow a {@link WorkerRequest} to a {@link DisposeRequest}. */
65
95
  export declare function isDisposeRequest(msg: WorkerRequest): msg is DisposeRequest;
96
+ /** Narrow a {@link WorkerRequest} to a {@link BatchRequest}. */
97
+ export declare function isBatchRequest(msg: WorkerRequest): msg is BatchRequest;
66
98
  /** Narrow a {@link WorkerResponse} to a {@link SuccessResponse}. */
67
99
  export declare function isSuccessResponse(msg: WorkerResponse): msg is SuccessResponse;
68
100
  /** Narrow a {@link WorkerResponse} to an {@link ErrorResponse}. */
@@ -1,8 +1,4 @@
1
- /**
2
- * Worker client for offloading CAD operations to a Web Worker.
3
- *
4
- * Provides a promise-based API over the worker message protocol.
5
- */
1
+ import { BatchOperation, BatchItemResult } from './protocol.js';
6
2
  export interface WorkerClientOptions {
7
3
  /** The Worker instance to communicate with. */
8
4
  worker: Worker;
@@ -19,6 +15,12 @@ export interface WorkerClient {
19
15
  init(): Promise<void>;
20
16
  /** Execute a named operation with BREP-serialized shapes and parameters. */
21
17
  execute(operation: string, shapesBrep: string[], params: Record<string, unknown>): Promise<WorkerResult>;
18
+ /**
19
+ * Run several operations in a single message. Resolves with one result per
20
+ * operation, in order; a failing op yields `{ success: false, error }` rather
21
+ * than rejecting the whole batch (unlike a worker pool's `executeBatch`).
22
+ */
23
+ executeBatch(operations: ReadonlyArray<BatchOperation>): Promise<BatchItemResult[]>;
22
24
  /** Dispose the client, rejecting all pending operations. */
23
25
  dispose(): void;
24
26
  }
package/dist/worker.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_workerPool = require("./workerPool-edtPrfHM.cjs");
2
+ const require_workerPool = require("./workerPool-D30NsiIW.cjs");
3
3
  exports.createOperationRegistry = require_workerPool.createOperationRegistry;
4
4
  exports.createTaskQueue = require_workerPool.createTaskQueue;
5
5
  exports.createWorkerClient = require_workerPool.createWorkerClient;
@@ -7,6 +7,7 @@ exports.createWorkerHandler = require_workerPool.createWorkerHandler;
7
7
  exports.createWorkerPool = require_workerPool.createWorkerPool;
8
8
  exports.dequeueTask = require_workerPool.dequeueTask;
9
9
  exports.enqueueTask = require_workerPool.enqueueTask;
10
+ exports.isBatchRequest = require_workerPool.isBatchRequest;
10
11
  exports.isDisposeRequest = require_workerPool.isDisposeRequest;
11
12
  exports.isErrorResponse = require_workerPool.isErrorResponse;
12
13
  exports.isInitRequest = require_workerPool.isInitRequest;
package/dist/worker.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as createWorkerClient, c as enqueueTask, d as rejectAll, f as isDisposeRequest, g as isSuccessResponse, h as isOperationRequest, i as registerHandler, l as isEmpty, m as isInitRequest, n as createOperationRegistry, o as createTaskQueue, p as isErrorResponse, r as createWorkerHandler, s as dequeueTask, t as createWorkerPool, u as pendingCount } from "./workerPool-BxBKpKeI.js";
2
- export { createOperationRegistry, createTaskQueue, createWorkerClient, createWorkerHandler, createWorkerPool, dequeueTask, enqueueTask, isDisposeRequest, isErrorResponse, isInitRequest, isOperationRequest, isEmpty as isQueueEmpty, isSuccessResponse, pendingCount, registerHandler, rejectAll };
1
+ import { _ as isSuccessResponse, a as createWorkerClient, c as enqueueTask, d as rejectAll, f as isBatchRequest, g as isOperationRequest, h as isInitRequest, i as registerHandler, l as isEmpty, m as isErrorResponse, n as createOperationRegistry, o as createTaskQueue, p as isDisposeRequest, r as createWorkerHandler, s as dequeueTask, t as createWorkerPool, u as pendingCount } from "./workerPool-XcYX2UZ0.js";
2
+ export { createOperationRegistry, createTaskQueue, createWorkerClient, createWorkerHandler, createWorkerPool, dequeueTask, enqueueTask, isBatchRequest, isDisposeRequest, isErrorResponse, isInitRequest, isOperationRequest, isEmpty as isQueueEmpty, isSuccessResponse, pendingCount, registerHandler, rejectAll };
@@ -11,6 +11,10 @@ function isOperationRequest(msg) {
11
11
  function isDisposeRequest(msg) {
12
12
  return msg.type === "dispose";
13
13
  }
14
+ /** Narrow a {@link WorkerRequest} to a {@link BatchRequest}. */
15
+ function isBatchRequest(msg) {
16
+ return msg.type === "batch";
17
+ }
14
18
  /** Narrow a {@link WorkerResponse} to a {@link SuccessResponse}. */
15
19
  function isSuccessResponse(msg) {
16
20
  return msg.success;
@@ -111,6 +115,18 @@ function createWorkerClient(options) {
111
115
  parameters: params
112
116
  });
113
117
  },
118
+ executeBatch(operations) {
119
+ const expected = operations.length;
120
+ return send({
121
+ id: nextId(),
122
+ type: "batch",
123
+ operations
124
+ }).then((result) => {
125
+ const data = result.resultData;
126
+ if (!Array.isArray(data) || data.length !== expected) throw new Error(`Invalid batch response: expected ${expected} results`);
127
+ return data;
128
+ });
129
+ },
114
130
  dispose() {
115
131
  disposed = true;
116
132
  for (const entry of pending.values()) entry.reject(/* @__PURE__ */ new Error("WorkerClient disposed"));
@@ -136,6 +152,44 @@ function registerHandler(registry, name, handler) {
136
152
  operations.set(name, handler);
137
153
  return { operations };
138
154
  }
155
+ function errorMessage(e) {
156
+ return e instanceof Error ? e.message : String(e);
157
+ }
158
+ /** Run one registered operation, capturing unknown-op and thrown errors as a result. */
159
+ function runOp(registry, operation, shapesBrep, params) {
160
+ const handler = registry.operations.get(operation);
161
+ if (!handler) return {
162
+ success: false,
163
+ error: `Unknown operation: ${operation}`
164
+ };
165
+ try {
166
+ const r = handler(shapesBrep, params);
167
+ return {
168
+ success: true,
169
+ ...r.resultBrep !== void 0 ? { resultBrep: r.resultBrep } : {},
170
+ ...r.resultData !== void 0 ? { resultData: r.resultData } : {}
171
+ };
172
+ } catch (e) {
173
+ return {
174
+ success: false,
175
+ error: errorMessage(e)
176
+ };
177
+ }
178
+ }
179
+ /** Build a single-operation response from a per-op result. */
180
+ function itemToResponse(id, item) {
181
+ if (!item.success) return {
182
+ id,
183
+ success: false,
184
+ error: item.error ?? "operation failed"
185
+ };
186
+ return {
187
+ id,
188
+ success: true,
189
+ ...item.resultBrep !== void 0 ? { resultBrep: item.resultBrep } : {},
190
+ ...item.resultData !== void 0 ? { resultData: item.resultData } : {}
191
+ };
192
+ }
139
193
  /**
140
194
  * Set up message handling in a Web Worker context.
141
195
  *
@@ -158,40 +212,25 @@ function createWorkerHandler(registry, initFn) {
158
212
  const response = {
159
213
  id: msg.id,
160
214
  success: false,
161
- error: e instanceof Error ? e.message : String(e)
215
+ error: errorMessage(e)
162
216
  };
163
217
  scope.postMessage(response);
164
218
  }
165
219
  return;
166
220
  }
167
221
  if (isOperationRequest(msg)) {
168
- const handler = registry.operations.get(msg.operation);
169
- if (!handler) {
170
- const response = {
171
- id: msg.id,
172
- success: false,
173
- error: `Unknown operation: ${msg.operation}`
174
- };
175
- scope.postMessage(response);
176
- return;
177
- }
178
- try {
179
- const result = handler(msg.shapesBrep, msg.parameters);
180
- const response = {
181
- id: msg.id,
182
- success: true,
183
- ...result.resultBrep !== void 0 ? { resultBrep: result.resultBrep } : {},
184
- ...result.resultData !== void 0 ? { resultData: result.resultData } : {}
185
- };
186
- scope.postMessage(response);
187
- } catch (e) {
188
- const response = {
189
- id: msg.id,
190
- success: false,
191
- error: e instanceof Error ? e.message : String(e)
192
- };
193
- scope.postMessage(response);
194
- }
222
+ const item = runOp(registry, msg.operation, msg.shapesBrep, msg.parameters);
223
+ scope.postMessage(itemToResponse(msg.id, item));
224
+ return;
225
+ }
226
+ if (isBatchRequest(msg)) {
227
+ const results = msg.operations.map((op) => runOp(registry, op.operation, op.shapesBrep, op.params));
228
+ const response = {
229
+ id: msg.id,
230
+ success: true,
231
+ resultData: results
232
+ };
233
+ scope.postMessage(response);
195
234
  return;
196
235
  }
197
236
  if (isDisposeRequest(msg)) {
@@ -311,6 +350,12 @@ Object.defineProperty(exports, "enqueueTask", {
311
350
  return enqueueTask;
312
351
  }
313
352
  });
353
+ Object.defineProperty(exports, "isBatchRequest", {
354
+ enumerable: true,
355
+ get: function() {
356
+ return isBatchRequest;
357
+ }
358
+ });
314
359
  Object.defineProperty(exports, "isDisposeRequest", {
315
360
  enumerable: true,
316
361
  get: function() {
@@ -11,6 +11,10 @@ function isOperationRequest(msg) {
11
11
  function isDisposeRequest(msg) {
12
12
  return msg.type === "dispose";
13
13
  }
14
+ /** Narrow a {@link WorkerRequest} to a {@link BatchRequest}. */
15
+ function isBatchRequest(msg) {
16
+ return msg.type === "batch";
17
+ }
14
18
  /** Narrow a {@link WorkerResponse} to a {@link SuccessResponse}. */
15
19
  function isSuccessResponse(msg) {
16
20
  return msg.success;
@@ -111,6 +115,18 @@ function createWorkerClient(options) {
111
115
  parameters: params
112
116
  });
113
117
  },
118
+ executeBatch(operations) {
119
+ const expected = operations.length;
120
+ return send({
121
+ id: nextId(),
122
+ type: "batch",
123
+ operations
124
+ }).then((result) => {
125
+ const data = result.resultData;
126
+ if (!Array.isArray(data) || data.length !== expected) throw new Error(`Invalid batch response: expected ${expected} results`);
127
+ return data;
128
+ });
129
+ },
114
130
  dispose() {
115
131
  disposed = true;
116
132
  for (const entry of pending.values()) entry.reject(/* @__PURE__ */ new Error("WorkerClient disposed"));
@@ -136,6 +152,44 @@ function registerHandler(registry, name, handler) {
136
152
  operations.set(name, handler);
137
153
  return { operations };
138
154
  }
155
+ function errorMessage(e) {
156
+ return e instanceof Error ? e.message : String(e);
157
+ }
158
+ /** Run one registered operation, capturing unknown-op and thrown errors as a result. */
159
+ function runOp(registry, operation, shapesBrep, params) {
160
+ const handler = registry.operations.get(operation);
161
+ if (!handler) return {
162
+ success: false,
163
+ error: `Unknown operation: ${operation}`
164
+ };
165
+ try {
166
+ const r = handler(shapesBrep, params);
167
+ return {
168
+ success: true,
169
+ ...r.resultBrep !== void 0 ? { resultBrep: r.resultBrep } : {},
170
+ ...r.resultData !== void 0 ? { resultData: r.resultData } : {}
171
+ };
172
+ } catch (e) {
173
+ return {
174
+ success: false,
175
+ error: errorMessage(e)
176
+ };
177
+ }
178
+ }
179
+ /** Build a single-operation response from a per-op result. */
180
+ function itemToResponse(id, item) {
181
+ if (!item.success) return {
182
+ id,
183
+ success: false,
184
+ error: item.error ?? "operation failed"
185
+ };
186
+ return {
187
+ id,
188
+ success: true,
189
+ ...item.resultBrep !== void 0 ? { resultBrep: item.resultBrep } : {},
190
+ ...item.resultData !== void 0 ? { resultData: item.resultData } : {}
191
+ };
192
+ }
139
193
  /**
140
194
  * Set up message handling in a Web Worker context.
141
195
  *
@@ -158,40 +212,25 @@ function createWorkerHandler(registry, initFn) {
158
212
  const response = {
159
213
  id: msg.id,
160
214
  success: false,
161
- error: e instanceof Error ? e.message : String(e)
215
+ error: errorMessage(e)
162
216
  };
163
217
  scope.postMessage(response);
164
218
  }
165
219
  return;
166
220
  }
167
221
  if (isOperationRequest(msg)) {
168
- const handler = registry.operations.get(msg.operation);
169
- if (!handler) {
170
- const response = {
171
- id: msg.id,
172
- success: false,
173
- error: `Unknown operation: ${msg.operation}`
174
- };
175
- scope.postMessage(response);
176
- return;
177
- }
178
- try {
179
- const result = handler(msg.shapesBrep, msg.parameters);
180
- const response = {
181
- id: msg.id,
182
- success: true,
183
- ...result.resultBrep !== void 0 ? { resultBrep: result.resultBrep } : {},
184
- ...result.resultData !== void 0 ? { resultData: result.resultData } : {}
185
- };
186
- scope.postMessage(response);
187
- } catch (e) {
188
- const response = {
189
- id: msg.id,
190
- success: false,
191
- error: e instanceof Error ? e.message : String(e)
192
- };
193
- scope.postMessage(response);
194
- }
222
+ const item = runOp(registry, msg.operation, msg.shapesBrep, msg.parameters);
223
+ scope.postMessage(itemToResponse(msg.id, item));
224
+ return;
225
+ }
226
+ if (isBatchRequest(msg)) {
227
+ const results = msg.operations.map((op) => runOp(registry, op.operation, op.shapesBrep, op.params));
228
+ const response = {
229
+ id: msg.id,
230
+ success: true,
231
+ resultData: results
232
+ };
233
+ scope.postMessage(response);
195
234
  return;
196
235
  }
197
236
  if (isDisposeRequest(msg)) {
@@ -269,4 +308,4 @@ function createWorkerPool(options) {
269
308
  };
270
309
  }
271
310
  //#endregion
272
- export { createWorkerClient as a, enqueueTask as c, rejectAll as d, isDisposeRequest as f, isSuccessResponse as g, isOperationRequest as h, registerHandler as i, isEmpty as l, isInitRequest as m, createOperationRegistry as n, createTaskQueue as o, isErrorResponse as p, createWorkerHandler as r, dequeueTask as s, createWorkerPool as t, pendingCount as u };
311
+ export { isSuccessResponse as _, createWorkerClient as a, enqueueTask as c, rejectAll as d, isBatchRequest as f, isOperationRequest as g, isInitRequest as h, registerHandler as i, isEmpty as l, isErrorResponse as m, createOperationRegistry as n, createTaskQueue as o, isDisposeRequest as p, createWorkerHandler as r, dequeueTask as s, createWorkerPool as t, pendingCount as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs",
3
- "version": "18.105.0",
3
+ "version": "18.107.0",
4
4
  "description": "Web CAD library with pluggable geometry kernel",
5
5
  "keywords": [
6
6
  "cad",