brepjs 14.8.0 → 15.0.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.
Files changed (70) hide show
  1. package/dist/2d.cjs +5 -5
  2. package/dist/2d.js +5 -5
  3. package/dist/{blueprint-vVmKMvfa.cjs → blueprint-BwRTIyAw.cjs} +5 -5
  4. package/dist/{blueprint-BLKzZkxW.js → blueprint-CdYlEXfG.js} +5 -5
  5. package/dist/{blueprintFns-BaMTtxJe.js → blueprintFns-C0Gt-QwZ.js} +2 -2
  6. package/dist/{blueprintFns-DPSslVJL.cjs → blueprintFns-QcO6rMWf.cjs} +2 -2
  7. package/dist/{boolean2D-Co9nkj7F.cjs → boolean2D-DFrT2rWk.cjs} +7 -7
  8. package/dist/{boolean2D-CoXCldti.js → boolean2D-s-HOkw92.js} +7 -7
  9. package/dist/{booleanFns-18PG17fJ.cjs → booleanFns-DdTELRHb.cjs} +7 -6
  10. package/dist/{booleanFns-Be4tu95v.js → booleanFns-Ddyxzgk3.js} +4 -3
  11. package/dist/brepjs.cjs +50 -50
  12. package/dist/brepjs.js +20 -20
  13. package/dist/core/shapeTypeCache.d.ts +14 -0
  14. package/dist/core/shapeTypeCache.d.ts.map +1 -0
  15. package/dist/core/shapeTypes.d.ts.map +1 -1
  16. package/dist/core/typeDiscriminants.d.ts.map +1 -1
  17. package/dist/core.cjs +1 -1
  18. package/dist/core.js +1 -1
  19. package/dist/{cornerFinder-BxoweqWQ.js → cornerFinder-CJBB9kPk.js} +1 -1
  20. package/dist/{cornerFinder-Dj00KU4D.cjs → cornerFinder-CadmkLDu.cjs} +1 -1
  21. package/dist/{curveFns-BL-a8bye.js → curveFns-CPSCjYH3.js} +1 -1
  22. package/dist/{curveFns-BEoIUi_W.cjs → curveFns-DT7CUf9U.cjs} +1 -1
  23. package/dist/{drawFns-KYO2AZ10.cjs → drawFns-DH5jLoyU.cjs} +12 -13
  24. package/dist/{drawFns-CmSkNIJ8.js → drawFns-vCEEAtD-.js} +10 -11
  25. package/dist/{extrudeFns-D5HbbN3j.cjs → extrudeFns-YkniZn07.cjs} +1 -1
  26. package/dist/{extrudeFns-gjNTbh1v.js → extrudeFns-jteSdJFq.js} +1 -1
  27. package/dist/{faceFns-BOtIllUV.cjs → faceFns-CIH50WZl.cjs} +241 -2
  28. package/dist/{faceFns-B0eQeMRl.js → faceFns-DSijGggR.js} +146 -3
  29. package/dist/{helpers-DWxhEPaX.js → helpers-CnNA3o2i.js} +5 -5
  30. package/dist/{helpers-BcTw9ulW.cjs → helpers-Cs9_5_7k.cjs} +10 -10
  31. package/dist/{historyFns-DfSmddHI.js → historyFns-BGemHNyO.js} +4 -4
  32. package/dist/{historyFns-D0fh1JbE.cjs → historyFns-DJ7D_HBa.cjs} +4 -4
  33. package/dist/{importFns-BZyWuPje.cjs → importFns-BIq-kGc4.cjs} +2 -2
  34. package/dist/{importFns-D6l6ojCY.js → importFns-CXrs2hUZ.js} +2 -2
  35. package/dist/io.cjs +2 -2
  36. package/dist/io.js +2 -2
  37. package/dist/{measureFns-ekclW7RC.js → measureFns-2OfU2IUx.js} +2 -2
  38. package/dist/{measureFns-ziEaFhgs.cjs → measureFns-DlgliEOF.cjs} +2 -2
  39. package/dist/measurement.cjs +1 -1
  40. package/dist/measurement.js +1 -1
  41. package/dist/{meshFns-D_xgh-cq.cjs → meshFns-BcsZJiab.cjs} +2 -2
  42. package/dist/{meshFns-DzKNEwLn.js → meshFns-DQDOBWkh.js} +2 -2
  43. package/dist/operations.cjs +2 -2
  44. package/dist/operations.js +2 -2
  45. package/dist/{primitiveFns-Cl6nxjV_.js → primitiveFns-C8sf6m4x.js} +6 -6
  46. package/dist/{primitiveFns-BIf2euKF.cjs → primitiveFns-DtFo8I-j.cjs} +16 -16
  47. package/dist/query.cjs +2 -2
  48. package/dist/query.js +2 -2
  49. package/dist/{shapeFns-B0qsEh-h.js → shapeFns-CquegVyR.js} +3 -134
  50. package/dist/{shapeFns-BMqU4lpk.cjs → shapeFns-DT-NmO_I.cjs} +12 -221
  51. package/dist/shapeRef.cjs +1 -1
  52. package/dist/shapeRef.js +1 -1
  53. package/dist/{shapeRefFns-BrwSuUBt.js → shapeRefFns-CAOYPDJJ.js} +3 -3
  54. package/dist/{shapeRefFns-bYjmdd_Q.cjs → shapeRefFns-CfrgfNYR.cjs} +5 -5
  55. package/dist/{shapeTypes-CCNnCMyK.cjs → shapeTypes-BUaUj4tR.cjs} +27 -2
  56. package/dist/{shapeTypes-s18kDLub.js → shapeTypes-DRUSTY2w.js} +22 -3
  57. package/dist/sketching.cjs +2 -2
  58. package/dist/sketching.js +2 -2
  59. package/dist/{solidBuilders-Csgxzr_F.js → solidBuilders-D2n0c6sb.js} +2 -2
  60. package/dist/{solidBuilders-DwdZPulT.cjs → solidBuilders-DW5yg81T.cjs} +2 -2
  61. package/dist/{surfaceBuilders-Cg9kro6D.cjs → surfaceBuilders-C31J-3Bz.cjs} +2 -2
  62. package/dist/{surfaceBuilders-DGaOP_Mz.js → surfaceBuilders-C78Cywl6.js} +2 -2
  63. package/dist/topology/faceFns.d.ts.map +1 -1
  64. package/dist/topology/healingFns.d.ts.map +1 -1
  65. package/dist/topology/minkowskiFns.d.ts.map +1 -1
  66. package/dist/topology/topologyQueryFns.d.ts +8 -3
  67. package/dist/topology/topologyQueryFns.d.ts.map +1 -1
  68. package/dist/topology.cjs +17 -17
  69. package/dist/topology.js +6 -6
  70. package/package.json +1 -1
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as isOrientedFace, D as manifoldShell, E as isValidSolid, F as is2D, G as withScope, I as is3D, K as withScopeResult, L as DisposalScope, M as getShapeKind, O as orientedFace, R as createHandle, S as isManifoldShell, V as isLive, _ as isSolid, b as closedWire, d as isCompound, f as isEdge, g as isShell, h as isShape3D, j as validSolid, m as isShape1D, p as isFace, q as withScopeResultAsync, t as castShape, v as isVertex, x as isClosedWire, y as isWire, z as createKernelHandle } from "./shapeTypes-s18kDLub.js";
1
+ import { B as createKernelHandle, C as isOrientedFace, D as manifoldShell, E as isValidSolid, H as isLive, I as is2D, J as withScopeResultAsync, K as withScope, L as is3D, M as getShapeKind, O as orientedFace, R as DisposalScope, S as isManifoldShell, _ as isSolid, b as closedWire, d as isCompound, f as isEdge, g as isShell, h as isShape3D, j as validSolid, m as isShape1D, p as isFace, q as withScopeResult, t as castShape, v as isVertex, x as isClosedWire, y as isWire, z as createHandle } from "./shapeTypes-DRUSTY2w.js";
2
2
  import { A as ok, B as unwrapOr, E as map, I as tryCatch, L as tryCatchAsync, O as mapErr, R as unwrap, T as isOk, V as unwrapOrElse, a as moduleInitError, b as err, c as sketcherStateError, d as validationError, g as OK, h as bug, i as kernelError, k as match, l as typeCastError, m as BrepBugError, n as computationError, o as queryError, r as ioError, u as unsupportedError, v as andThen, w as isErr, x as flatMap, y as collect, z as unwrapErr } from "./errors-C-cgQA3w.js";
3
3
  import { n as HASH_CODE_MAX, r as RAD2DEG, t as DEG2RAD } from "./constants-B9u763C3.js";
4
4
  import { n as toVec2, r as toVec3, t as resolveDirection } from "./types-BWBlwp6w.js";
@@ -1,6 +1,6 @@
1
1
  import { t as DEG2RAD } from "./constants-B9u763C3.js";
2
2
  import { n as getAtOrThrow } from "./arrayAccess-xxcB3YNq.js";
3
- import { _ as samePoint, p as distance2d, u as angle2d } from "./helpers-DWxhEPaX.js";
3
+ import { _ as samePoint, p as distance2d, u as angle2d } from "./helpers-CnNA3o2i.js";
4
4
  //#region src/query/cornerFinder.ts
5
5
  var PI_2 = 2 * Math.PI;
6
6
  function positiveHalfAngle(angle) {
@@ -1,6 +1,6 @@
1
1
  const require_constants = require("./constants-unWN8k4c.cjs");
2
2
  const require_arrayAccess = require("./arrayAccess-CmulMesb.cjs");
3
- const require_helpers = require("./helpers-BcTw9ulW.cjs");
3
+ const require_helpers = require("./helpers-Cs9_5_7k.cjs");
4
4
  //#region src/query/cornerFinder.ts
5
5
  var PI_2 = 2 * Math.PI;
6
6
  function positiveHalfAngle(angle) {
@@ -1,4 +1,4 @@
1
- import { Y as getKernel, f as isEdge, t as castShape, y as isWire } from "./shapeTypes-s18kDLub.js";
1
+ import { X as getKernel, f as isEdge, t as castShape, y as isWire } from "./shapeTypes-DRUSTY2w.js";
2
2
  import { A as ok, b as err, l as typeCastError } from "./errors-C-cgQA3w.js";
3
3
  //#region src/topology/curveFns.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- const require_shapeTypes = require("./shapeTypes-CCNnCMyK.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-BUaUj4tR.cjs");
2
2
  const require_errors = require("./errors-9zQcQK1H.cjs");
3
3
  //#region src/topology/curveFns.ts
4
4
  /**
@@ -29,23 +29,22 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  enumerable: true
30
30
  }) : target, mod));
31
31
  //#endregion
32
- const require_shapeTypes = require("./shapeTypes-CCNnCMyK.cjs");
32
+ const require_shapeTypes = require("./shapeTypes-BUaUj4tR.cjs");
33
33
  const require_errors = require("./errors-9zQcQK1H.cjs");
34
- const require_faceFns = require("./faceFns-BOtIllUV.cjs");
34
+ const require_faceFns = require("./faceFns-CIH50WZl.cjs");
35
35
  const require_constants = require("./constants-unWN8k4c.cjs");
36
36
  const require_types = require("./types-BjDcsS7l.cjs");
37
37
  const require_vecOps = require("./vecOps-BXvBYIor.cjs");
38
38
  const require_planeOps = require("./planeOps-6Wu7dMDN.cjs");
39
- const require_shapeFns = require("./shapeFns-BMqU4lpk.cjs");
40
- const require_curveFns = require("./curveFns-BEoIUi_W.cjs");
39
+ const require_curveFns = require("./curveFns-DT7CUf9U.cjs");
41
40
  const require_arrayAccess = require("./arrayAccess-CmulMesb.cjs");
42
- const require_surfaceBuilders = require("./surfaceBuilders-Cg9kro6D.cjs");
43
- const require_boolean2D = require("./boolean2D-Co9nkj7F.cjs");
44
- const require_helpers = require("./helpers-BcTw9ulW.cjs");
45
- const require_blueprint = require("./blueprint-vVmKMvfa.cjs");
46
- const require_solidBuilders = require("./solidBuilders-DwdZPulT.cjs");
47
- const require_cornerFinder = require("./cornerFinder-Dj00KU4D.cjs");
48
- const require_extrudeFns = require("./extrudeFns-D5HbbN3j.cjs");
41
+ const require_surfaceBuilders = require("./surfaceBuilders-C31J-3Bz.cjs");
42
+ const require_boolean2D = require("./boolean2D-DFrT2rWk.cjs");
43
+ const require_helpers = require("./helpers-Cs9_5_7k.cjs");
44
+ const require_blueprint = require("./blueprint-BwRTIyAw.cjs");
45
+ const require_solidBuilders = require("./solidBuilders-DW5yg81T.cjs");
46
+ const require_cornerFinder = require("./cornerFinder-CadmkLDu.cjs");
47
+ const require_extrudeFns = require("./extrudeFns-YkniZn07.cjs");
49
48
  let opentype_js = require("opentype.js");
50
49
  opentype_js = __toESM(opentype_js);
51
50
  //#region src/2d/lib/stitching.ts
@@ -1600,7 +1599,7 @@ function isProjectionPlane(plane) {
1600
1599
  //#region src/projection/makeProjectedEdges.ts
1601
1600
  var getEdgesFromOc = (shape) => {
1602
1601
  if (shape.IsNull()) return [];
1603
- return require_shapeFns.getEdges(require_shapeTypes.castShape(shape));
1602
+ return require_faceFns.getEdges(require_shapeTypes.castShape(shape));
1604
1603
  };
1605
1604
  /**
1606
1605
  * Project a 3D shape onto a 2D plane using hidden-line removal (HLR).
@@ -1757,7 +1756,7 @@ function drawFaceOutline(face) {
1757
1756
  var _usingCtx3 = require_shapeTypes._usingCtx();
1758
1757
  const scope = _usingCtx3.u(new require_shapeTypes.DisposalScope());
1759
1758
  const clonedFace = scope.register(require_shapeTypes.createFace(require_errors.unwrap(require_faceFns.downcast(face.wrapped))));
1760
- const stitchedCurves = stitchCurves(require_shapeFns.getEdges(scope.register(require_faceFns.outerWire(clonedFace))).map((e) => require_blueprint.edgeToCurve(e, face))).map((s) => new require_blueprint.Blueprint(s));
1759
+ const stitchedCurves = stitchCurves(require_faceFns.getEdges(scope.register(require_faceFns.outerWire(clonedFace))).map((e) => require_blueprint.edgeToCurve(e, face))).map((s) => new require_blueprint.Blueprint(s));
1761
1760
  if (stitchedCurves.length === 0) return new Drawing();
1762
1761
  if (stitchedCurves.length === 1) return new Drawing(stitchedCurves[0]);
1763
1762
  return new Drawing(new require_boolean2D.Blueprints(stitchedCurves));
@@ -1,20 +1,19 @@
1
- import { J as _usingCtx, L as DisposalScope, Y as getKernel, o as createFace, p as isFace, t as castShape, u as createWire } from "./shapeTypes-s18kDLub.js";
1
+ import { R as DisposalScope, X as getKernel, Y as _usingCtx, o as createFace, p as isFace, t as castShape, u as createWire } from "./shapeTypes-DRUSTY2w.js";
2
2
  import { A as ok, R as unwrap, T as isOk, b as err, d as validationError, h as bug, r as ioError, s as safeIndex, t as BrepErrorCode } from "./errors-C-cgQA3w.js";
3
- import { _ as downcast, c as normalAt, g as cast, l as outerWire, n as faceCenter } from "./faceFns-B0eQeMRl.js";
3
+ import { M as cast, N as downcast, b as getEdges, c as normalAt, l as outerWire, n as faceCenter } from "./faceFns-DSijGggR.js";
4
4
  import { t as DEG2RAD } from "./constants-B9u763C3.js";
5
5
  import { r as toVec3 } from "./types-BWBlwp6w.js";
6
6
  import { c as vecLength, d as vecNormalize, g as vecSub, h as vecScale, m as vecRotate, r as vecCross } from "./vecOps-D9etjPgV.js";
7
7
  import { a as planeToWorld, o as resolvePlane } from "./planeOps-gTOEarV2.js";
8
- import { M as getEdges } from "./shapeFns-B0qsEh-h.js";
9
- import { m as offsetWire2D } from "./curveFns-BL-a8bye.js";
8
+ import { m as offsetWire2D } from "./curveFns-CPSCjYH3.js";
10
9
  import { n as getAtOrThrow, r as lastOrThrow, t as firstOrThrow } from "./arrayAccess-xxcB3YNq.js";
11
- import { c as makeBSplineApproximation, d as makeEllipse, p as makeHelix, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeCircle } from "./surfaceBuilders-DGaOP_Mz.js";
12
- import { S as Flatbush, _ as Blueprints, b as make2dOffset, c as roundedRectangleBlueprint, f as Sketch, g as CompoundBlueprint, h as organiseBlueprints, l as BaseSketcher2d, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D, u as BlueprintSketcher, v as chamferCurves, x as intersectCurves, y as filletCurves } from "./boolean2D-CoXCldti.js";
13
- import { _ as samePoint$1, b as subtract2d, c as PRECISION_OFFSET, l as add2d, y as squareDistance2d } from "./helpers-DWxhEPaX.js";
14
- import { _ as Curve2D, a as edgeToCurve, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D, y as BoundingBox2d } from "./blueprint-BLKzZkxW.js";
15
- import { o as makeSolid, t as makeCompound } from "./solidBuilders-Csgxzr_F.js";
16
- import { t as cornerFinder } from "./cornerFinder-BxoweqWQ.js";
17
- import { i as complexExtrude, l as twistExtrude, r as revolve, t as extrude } from "./extrudeFns-gjNTbh1v.js";
10
+ import { c as makeBSplineApproximation, d as makeEllipse, p as makeHelix, r as makeFace, s as assembleWire, t as addHolesInFace, u as makeCircle } from "./surfaceBuilders-C78Cywl6.js";
11
+ import { S as Flatbush, _ as Blueprints, b as make2dOffset, c as roundedRectangleBlueprint, f as Sketch, g as CompoundBlueprint, h as organiseBlueprints, l as BaseSketcher2d, n as fuse2D, r as intersect2D, s as polysidesBlueprint, t as cut2D, u as BlueprintSketcher, v as chamferCurves, x as intersectCurves, y as filletCurves } from "./boolean2D-s-HOkw92.js";
12
+ import { _ as samePoint$1, b as subtract2d, c as PRECISION_OFFSET, l as add2d, y as squareDistance2d } from "./helpers-CnNA3o2i.js";
13
+ import { _ as Curve2D, a as edgeToCurve, c as make2dCircle, d as make2dInerpolatedBSplineCurve, f as make2dSegmentCurve, g as approximateAsSvgCompatibleCurve, i as curvesAsEdgesOnPlane, l as make2dEllipse, o as make2dArcFromCenter, t as Blueprint, v as deserializeCurve2D, y as BoundingBox2d } from "./blueprint-CdYlEXfG.js";
14
+ import { o as makeSolid, t as makeCompound } from "./solidBuilders-D2n0c6sb.js";
15
+ import { t as cornerFinder } from "./cornerFinder-CJBB9kPk.js";
16
+ import { i as complexExtrude, l as twistExtrude, r as revolve, t as extrude } from "./extrudeFns-jteSdJFq.js";
18
17
  import opentype from "opentype.js";
19
18
  //#region src/2d/lib/stitching.ts
20
19
  /**
@@ -1,4 +1,4 @@
1
- const require_shapeTypes = require("./shapeTypes-CCNnCMyK.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-BUaUj4tR.cjs");
2
2
  const require_errors = require("./errors-9zQcQK1H.cjs");
3
3
  const require_vecOps = require("./vecOps-BXvBYIor.cjs");
4
4
  //#region src/operations/extrudeUtils.ts
@@ -1,4 +1,4 @@
1
- import { Y as getKernel, c as createSolid, h as isShape3D, t as castShape, y as isWire } from "./shapeTypes-s18kDLub.js";
1
+ import { X as getKernel, c as createSolid, h as isShape3D, t as castShape, y as isWire } from "./shapeTypes-DRUSTY2w.js";
2
2
  import { A as ok, R as unwrap, b as err, d as validationError, i as kernelError, l as typeCastError, t as BrepErrorCode } from "./errors-C-cgQA3w.js";
3
3
  import { c as vecLength, d as vecNormalize, t as vecAdd } from "./vecOps-D9etjPgV.js";
4
4
  //#region src/operations/extrudeUtils.ts
@@ -1,4 +1,4 @@
1
- const require_shapeTypes = require("./shapeTypes-CCNnCMyK.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-BUaUj4tR.cjs");
2
2
  const require_errors = require("./errors-9zQcQK1H.cjs");
3
3
  const require_types = require("./types-BjDcsS7l.cjs");
4
4
  //#region src/core/kernelCall.ts
@@ -174,6 +174,149 @@ function fromBREP(data) {
174
174
  return cast(require_shapeTypes.getKernel().fromBREP(data));
175
175
  }
176
176
  //#endregion
177
+ //#region src/topology/topologyQueryFns.ts
178
+ /**
179
+ * Topology query functions — extract sub-shapes, compute bounds, and
180
+ * describe shape topology. All results are lazily cached per shape.
181
+ */
182
+ /**
183
+ * Extract sub-shapes of a known type, bypassing the generator wrapper and
184
+ * redundant downcast calls. Uses iterShapes (C++ bulk extraction) directly
185
+ * and passes the known type to castShape to skip the shapeType() WASM call.
186
+ */
187
+ function castSubShapes(parentShape, type) {
188
+ const rawShapes = require_shapeTypes.getKernel().iterShapes(parentShape, type);
189
+ const result = new Array(rawShapes.length);
190
+ for (let i = 0; i < rawShapes.length; i++) result[i] = require_shapeTypes.castShapeWithKnownType(rawShapes[i], type);
191
+ return result;
192
+ }
193
+ var topoCache = /* @__PURE__ */ new WeakMap();
194
+ /** @internal Get or create a cache entry for a shape. Used by originTrackingFns. */
195
+ function getOrCreateCache(shape) {
196
+ let entry = topoCache.get(shape.wrapped);
197
+ if (!entry) {
198
+ entry = {};
199
+ topoCache.set(shape.wrapped, entry);
200
+ }
201
+ return entry;
202
+ }
203
+ /** @internal Direct cache access. Used by originTrackingFns for getFaceOrigins. */
204
+ function getCacheEntry(shape) {
205
+ return topoCache.get(shape.wrapped);
206
+ }
207
+ /**
208
+ * Invalidate cached topology data for a shape.
209
+ * Call this after operations that modify a shape in-place (e.g., unifyFaces).
210
+ */
211
+ function invalidateShapeCache(shape) {
212
+ topoCache.delete(shape.wrapped);
213
+ }
214
+ /** Get all edges of a shape as branded Edge handles. Results are cached per shape. */
215
+ function getEdges(shape) {
216
+ const cache = getOrCreateCache(shape);
217
+ if (cache.edges) return cache.edges;
218
+ const edges = castSubShapes(shape.wrapped, "edge");
219
+ cache.edges = edges;
220
+ return edges;
221
+ }
222
+ /**
223
+ * Get all faces of a shape. Results are cached per shape.
224
+ *
225
+ * Returns `Face[]` — use `isOrientedFace()` or `orientedFace()` to narrow
226
+ * individual faces to `OrientedFace` when the orientation guarantee is needed.
227
+ */
228
+ function getFaces(shape) {
229
+ const cache = getOrCreateCache(shape);
230
+ if (cache.faces) return cache.faces;
231
+ const faces = castSubShapes(shape.wrapped, "face");
232
+ cache.faces = faces;
233
+ return faces;
234
+ }
235
+ /** Get all wires of a shape as branded Wire handles. Results are cached per shape. */
236
+ function getWires(shape) {
237
+ const cache = getOrCreateCache(shape);
238
+ if (cache.wires) return cache.wires;
239
+ const wires = castSubShapes(shape.wrapped, "wire");
240
+ cache.wires = wires;
241
+ return wires;
242
+ }
243
+ /** Get all vertices of a shape as branded Vertex handles. Results are cached per shape. */
244
+ function getVertices(shape) {
245
+ const cache = getOrCreateCache(shape);
246
+ if (cache.vertices) return cache.vertices;
247
+ const vertices = castSubShapes(shape.wrapped, "vertex");
248
+ cache.vertices = vertices;
249
+ return vertices;
250
+ }
251
+ /** Lazily iterate edges of a shape, yielding branded Edge handles one at a time. */
252
+ function* iterEdges(shape) {
253
+ for (const e of require_shapeTypes.getKernel().iterShapes(shape.wrapped, "edge")) yield require_shapeTypes.castShapeWithKnownType(e, "edge");
254
+ }
255
+ /** Lazily iterate faces of a shape, yielding branded Face handles one at a time. */
256
+ function* iterFaces(shape) {
257
+ for (const f of require_shapeTypes.getKernel().iterShapes(shape.wrapped, "face")) yield require_shapeTypes.castShapeWithKnownType(f, "face");
258
+ }
259
+ /** Lazily iterate wires of a shape, yielding branded Wire handles one at a time. */
260
+ function* iterWires(shape) {
261
+ for (const w of require_shapeTypes.getKernel().iterShapes(shape.wrapped, "wire")) yield require_shapeTypes.castShapeWithKnownType(w, "wire");
262
+ }
263
+ /** Lazily iterate vertices of a shape, yielding branded Vertex handles one at a time. */
264
+ function* iterVertices(shape) {
265
+ for (const v of require_shapeTypes.getKernel().iterShapes(shape.wrapped, "vertex")) yield require_shapeTypes.castShapeWithKnownType(v, "vertex");
266
+ }
267
+ /** Get the axis-aligned bounding box of a shape. Cached per shape. */
268
+ function getBounds(shape) {
269
+ const cache = getOrCreateCache(shape);
270
+ if (cache.bounds) return cache.bounds;
271
+ const { min, max } = require_shapeTypes.getKernel().boundingBox(shape.wrapped);
272
+ const bounds = {
273
+ xMin: min[0],
274
+ xMax: max[0],
275
+ yMin: min[1],
276
+ yMax: max[1],
277
+ zMin: min[2],
278
+ zMax: max[2]
279
+ };
280
+ cache.bounds = bounds;
281
+ return bounds;
282
+ }
283
+ /** Get the topological kind of a shape. Cached per shape via shapeTypeCache. */
284
+ function getCachedShapeKind(shape) {
285
+ return require_shapeTypes.getOrQueryType(require_shapeTypes.getKernel(), shape.wrapped);
286
+ }
287
+ /** Get the kernel surface type of a face. Cached per face (shapes are immutable). */
288
+ function getCachedSurfaceType(face) {
289
+ const cache = getOrCreateCache(face);
290
+ if (cache.surfaceType !== void 0) return cache.surfaceType;
291
+ const surfType = require_shapeTypes.getKernel().surfaceType(face.wrapped);
292
+ cache.surfaceType = surfType;
293
+ return surfType;
294
+ }
295
+ /** Get whether a shape is valid. Cached per shape (shapes are immutable). */
296
+ function getCachedIsValid(shape) {
297
+ const cache = getOrCreateCache(shape);
298
+ if (cache.isValid !== void 0) return cache.isValid;
299
+ const valid = require_shapeTypes.getKernel().isValid(shape.wrapped);
300
+ cache.isValid = valid;
301
+ return valid;
302
+ }
303
+ /** Get a quick summary of a shape for debugging and inspection. */
304
+ function describe(shape) {
305
+ return {
306
+ kind: getCachedShapeKind(shape),
307
+ faceCount: getFaces(shape).length,
308
+ edgeCount: getEdges(shape).length,
309
+ wireCount: getWires(shape).length,
310
+ vertexCount: getVertices(shape).length,
311
+ valid: getCachedIsValid(shape),
312
+ bounds: getBounds(shape)
313
+ };
314
+ }
315
+ /** Get the position of a vertex as a Vec3 tuple. */
316
+ function vertexPosition(vertex) {
317
+ return require_shapeTypes.getKernel().vertexPosition(vertex.wrapped);
318
+ }
319
+ //#endregion
177
320
  //#region src/topology/faceFns.ts
178
321
  /**
179
322
  * Face-specific functions — functional replacements for Face class methods.
@@ -199,7 +342,7 @@ var KERNEL_TO_PUBLIC_SURFACE_TYPE = {
199
342
  * @returns Ok with the surface type, or Err for unrecognized kernel surface types.
200
343
  */
201
344
  function getSurfaceType(face) {
202
- return require_errors.ok(KERNEL_TO_PUBLIC_SURFACE_TYPE[require_shapeTypes.getKernel().surfaceType(face.wrapped)]);
345
+ return require_errors.ok(KERNEL_TO_PUBLIC_SURFACE_TYPE[getCachedSurfaceType(face)]);
203
346
  }
204
347
  /** Get the surface type of a face (unwrapped convenience). */
205
348
  function faceGeomType(face) {
@@ -322,6 +465,12 @@ Object.defineProperty(exports, "classifyPointOnFace", {
322
465
  return classifyPointOnFace;
323
466
  }
324
467
  });
468
+ Object.defineProperty(exports, "describe", {
469
+ enumerable: true,
470
+ get: function() {
471
+ return describe;
472
+ }
473
+ });
325
474
  Object.defineProperty(exports, "downcast", {
326
475
  enumerable: true,
327
476
  get: function() {
@@ -358,30 +507,114 @@ Object.defineProperty(exports, "fromBREP", {
358
507
  return fromBREP;
359
508
  }
360
509
  });
510
+ Object.defineProperty(exports, "getBounds", {
511
+ enumerable: true,
512
+ get: function() {
513
+ return getBounds;
514
+ }
515
+ });
516
+ Object.defineProperty(exports, "getCacheEntry", {
517
+ enumerable: true,
518
+ get: function() {
519
+ return getCacheEntry;
520
+ }
521
+ });
522
+ Object.defineProperty(exports, "getCachedIsValid", {
523
+ enumerable: true,
524
+ get: function() {
525
+ return getCachedIsValid;
526
+ }
527
+ });
528
+ Object.defineProperty(exports, "getCachedSurfaceType", {
529
+ enumerable: true,
530
+ get: function() {
531
+ return getCachedSurfaceType;
532
+ }
533
+ });
534
+ Object.defineProperty(exports, "getEdges", {
535
+ enumerable: true,
536
+ get: function() {
537
+ return getEdges;
538
+ }
539
+ });
540
+ Object.defineProperty(exports, "getFaces", {
541
+ enumerable: true,
542
+ get: function() {
543
+ return getFaces;
544
+ }
545
+ });
546
+ Object.defineProperty(exports, "getOrCreateCache", {
547
+ enumerable: true,
548
+ get: function() {
549
+ return getOrCreateCache;
550
+ }
551
+ });
361
552
  Object.defineProperty(exports, "getSurfaceType", {
362
553
  enumerable: true,
363
554
  get: function() {
364
555
  return getSurfaceType;
365
556
  }
366
557
  });
558
+ Object.defineProperty(exports, "getVertices", {
559
+ enumerable: true,
560
+ get: function() {
561
+ return getVertices;
562
+ }
563
+ });
564
+ Object.defineProperty(exports, "getWires", {
565
+ enumerable: true,
566
+ get: function() {
567
+ return getWires;
568
+ }
569
+ });
367
570
  Object.defineProperty(exports, "innerWires", {
368
571
  enumerable: true,
369
572
  get: function() {
370
573
  return innerWires;
371
574
  }
372
575
  });
576
+ Object.defineProperty(exports, "invalidateShapeCache", {
577
+ enumerable: true,
578
+ get: function() {
579
+ return invalidateShapeCache;
580
+ }
581
+ });
373
582
  Object.defineProperty(exports, "isCompSolid", {
374
583
  enumerable: true,
375
584
  get: function() {
376
585
  return isCompSolid;
377
586
  }
378
587
  });
588
+ Object.defineProperty(exports, "iterEdges", {
589
+ enumerable: true,
590
+ get: function() {
591
+ return iterEdges;
592
+ }
593
+ });
594
+ Object.defineProperty(exports, "iterFaces", {
595
+ enumerable: true,
596
+ get: function() {
597
+ return iterFaces;
598
+ }
599
+ });
379
600
  Object.defineProperty(exports, "iterTopo", {
380
601
  enumerable: true,
381
602
  get: function() {
382
603
  return iterTopo;
383
604
  }
384
605
  });
606
+ Object.defineProperty(exports, "iterVertices", {
607
+ enumerable: true,
608
+ get: function() {
609
+ return iterVertices;
610
+ }
611
+ });
612
+ Object.defineProperty(exports, "iterWires", {
613
+ enumerable: true,
614
+ get: function() {
615
+ return iterWires;
616
+ }
617
+ });
385
618
  Object.defineProperty(exports, "kernelCall", {
386
619
  enumerable: true,
387
620
  get: function() {
@@ -448,3 +681,9 @@ Object.defineProperty(exports, "uvCoordinates", {
448
681
  return uvCoordinates;
449
682
  }
450
683
  });
684
+ Object.defineProperty(exports, "vertexPosition", {
685
+ enumerable: true,
686
+ get: function() {
687
+ return vertexPosition;
688
+ }
689
+ });
@@ -1,4 +1,4 @@
1
- import { J as _usingCtx, L as DisposalScope, Y as getKernel, t as castShape } from "./shapeTypes-s18kDLub.js";
1
+ import { N as getOrQueryType, R as DisposalScope, X as getKernel, Y as _usingCtx, r as castShapeWithKnownType, t as castShape } from "./shapeTypes-DRUSTY2w.js";
2
2
  import { A as ok, R as unwrap, b as err, f as getSuggestionForCode, l as typeCastError, p as translateKernelError } from "./errors-C-cgQA3w.js";
3
3
  import { r as toVec3 } from "./types-BWBlwp6w.js";
4
4
  //#region src/core/kernelCall.ts
@@ -174,6 +174,149 @@ function fromBREP(data) {
174
174
  return cast(getKernel().fromBREP(data));
175
175
  }
176
176
  //#endregion
177
+ //#region src/topology/topologyQueryFns.ts
178
+ /**
179
+ * Topology query functions — extract sub-shapes, compute bounds, and
180
+ * describe shape topology. All results are lazily cached per shape.
181
+ */
182
+ /**
183
+ * Extract sub-shapes of a known type, bypassing the generator wrapper and
184
+ * redundant downcast calls. Uses iterShapes (C++ bulk extraction) directly
185
+ * and passes the known type to castShape to skip the shapeType() WASM call.
186
+ */
187
+ function castSubShapes(parentShape, type) {
188
+ const rawShapes = getKernel().iterShapes(parentShape, type);
189
+ const result = new Array(rawShapes.length);
190
+ for (let i = 0; i < rawShapes.length; i++) result[i] = castShapeWithKnownType(rawShapes[i], type);
191
+ return result;
192
+ }
193
+ var topoCache = /* @__PURE__ */ new WeakMap();
194
+ /** @internal Get or create a cache entry for a shape. Used by originTrackingFns. */
195
+ function getOrCreateCache(shape) {
196
+ let entry = topoCache.get(shape.wrapped);
197
+ if (!entry) {
198
+ entry = {};
199
+ topoCache.set(shape.wrapped, entry);
200
+ }
201
+ return entry;
202
+ }
203
+ /** @internal Direct cache access. Used by originTrackingFns for getFaceOrigins. */
204
+ function getCacheEntry(shape) {
205
+ return topoCache.get(shape.wrapped);
206
+ }
207
+ /**
208
+ * Invalidate cached topology data for a shape.
209
+ * Call this after operations that modify a shape in-place (e.g., unifyFaces).
210
+ */
211
+ function invalidateShapeCache(shape) {
212
+ topoCache.delete(shape.wrapped);
213
+ }
214
+ /** Get all edges of a shape as branded Edge handles. Results are cached per shape. */
215
+ function getEdges(shape) {
216
+ const cache = getOrCreateCache(shape);
217
+ if (cache.edges) return cache.edges;
218
+ const edges = castSubShapes(shape.wrapped, "edge");
219
+ cache.edges = edges;
220
+ return edges;
221
+ }
222
+ /**
223
+ * Get all faces of a shape. Results are cached per shape.
224
+ *
225
+ * Returns `Face[]` — use `isOrientedFace()` or `orientedFace()` to narrow
226
+ * individual faces to `OrientedFace` when the orientation guarantee is needed.
227
+ */
228
+ function getFaces(shape) {
229
+ const cache = getOrCreateCache(shape);
230
+ if (cache.faces) return cache.faces;
231
+ const faces = castSubShapes(shape.wrapped, "face");
232
+ cache.faces = faces;
233
+ return faces;
234
+ }
235
+ /** Get all wires of a shape as branded Wire handles. Results are cached per shape. */
236
+ function getWires(shape) {
237
+ const cache = getOrCreateCache(shape);
238
+ if (cache.wires) return cache.wires;
239
+ const wires = castSubShapes(shape.wrapped, "wire");
240
+ cache.wires = wires;
241
+ return wires;
242
+ }
243
+ /** Get all vertices of a shape as branded Vertex handles. Results are cached per shape. */
244
+ function getVertices(shape) {
245
+ const cache = getOrCreateCache(shape);
246
+ if (cache.vertices) return cache.vertices;
247
+ const vertices = castSubShapes(shape.wrapped, "vertex");
248
+ cache.vertices = vertices;
249
+ return vertices;
250
+ }
251
+ /** Lazily iterate edges of a shape, yielding branded Edge handles one at a time. */
252
+ function* iterEdges(shape) {
253
+ for (const e of getKernel().iterShapes(shape.wrapped, "edge")) yield castShapeWithKnownType(e, "edge");
254
+ }
255
+ /** Lazily iterate faces of a shape, yielding branded Face handles one at a time. */
256
+ function* iterFaces(shape) {
257
+ for (const f of getKernel().iterShapes(shape.wrapped, "face")) yield castShapeWithKnownType(f, "face");
258
+ }
259
+ /** Lazily iterate wires of a shape, yielding branded Wire handles one at a time. */
260
+ function* iterWires(shape) {
261
+ for (const w of getKernel().iterShapes(shape.wrapped, "wire")) yield castShapeWithKnownType(w, "wire");
262
+ }
263
+ /** Lazily iterate vertices of a shape, yielding branded Vertex handles one at a time. */
264
+ function* iterVertices(shape) {
265
+ for (const v of getKernel().iterShapes(shape.wrapped, "vertex")) yield castShapeWithKnownType(v, "vertex");
266
+ }
267
+ /** Get the axis-aligned bounding box of a shape. Cached per shape. */
268
+ function getBounds(shape) {
269
+ const cache = getOrCreateCache(shape);
270
+ if (cache.bounds) return cache.bounds;
271
+ const { min, max } = getKernel().boundingBox(shape.wrapped);
272
+ const bounds = {
273
+ xMin: min[0],
274
+ xMax: max[0],
275
+ yMin: min[1],
276
+ yMax: max[1],
277
+ zMin: min[2],
278
+ zMax: max[2]
279
+ };
280
+ cache.bounds = bounds;
281
+ return bounds;
282
+ }
283
+ /** Get the topological kind of a shape. Cached per shape via shapeTypeCache. */
284
+ function getCachedShapeKind(shape) {
285
+ return getOrQueryType(getKernel(), shape.wrapped);
286
+ }
287
+ /** Get the kernel surface type of a face. Cached per face (shapes are immutable). */
288
+ function getCachedSurfaceType(face) {
289
+ const cache = getOrCreateCache(face);
290
+ if (cache.surfaceType !== void 0) return cache.surfaceType;
291
+ const surfType = getKernel().surfaceType(face.wrapped);
292
+ cache.surfaceType = surfType;
293
+ return surfType;
294
+ }
295
+ /** Get whether a shape is valid. Cached per shape (shapes are immutable). */
296
+ function getCachedIsValid(shape) {
297
+ const cache = getOrCreateCache(shape);
298
+ if (cache.isValid !== void 0) return cache.isValid;
299
+ const valid = getKernel().isValid(shape.wrapped);
300
+ cache.isValid = valid;
301
+ return valid;
302
+ }
303
+ /** Get a quick summary of a shape for debugging and inspection. */
304
+ function describe(shape) {
305
+ return {
306
+ kind: getCachedShapeKind(shape),
307
+ faceCount: getFaces(shape).length,
308
+ edgeCount: getEdges(shape).length,
309
+ wireCount: getWires(shape).length,
310
+ vertexCount: getVertices(shape).length,
311
+ valid: getCachedIsValid(shape),
312
+ bounds: getBounds(shape)
313
+ };
314
+ }
315
+ /** Get the position of a vertex as a Vec3 tuple. */
316
+ function vertexPosition(vertex) {
317
+ return getKernel().vertexPosition(vertex.wrapped);
318
+ }
319
+ //#endregion
177
320
  //#region src/topology/faceFns.ts
178
321
  /**
179
322
  * Face-specific functions — functional replacements for Face class methods.
@@ -199,7 +342,7 @@ var KERNEL_TO_PUBLIC_SURFACE_TYPE = {
199
342
  * @returns Ok with the surface type, or Err for unrecognized kernel surface types.
200
343
  */
201
344
  function getSurfaceType(face) {
202
- return ok(KERNEL_TO_PUBLIC_SURFACE_TYPE[getKernel().surfaceType(face.wrapped)]);
345
+ return ok(KERNEL_TO_PUBLIC_SURFACE_TYPE[getCachedSurfaceType(face)]);
203
346
  }
204
347
  /** Get the surface type of a face (unwrapped convenience). */
205
348
  function faceGeomType(face) {
@@ -304,4 +447,4 @@ function innerWires(face) {
304
447
  return Array.from(iterTopo(face.wrapped, "wire")).map((w) => castShape(unwrap(downcast(w)))).filter((w) => !getKernel().isSame(w.wrapped, outer.wrapped));
305
448
  }
306
449
  //#endregion
307
- export { kernelCallRaw as C, kernelCall as S, downcast as _, flipFaceOrientation as a, iterTopo as b, normalAt as c, projectPointOnFace as d, removeHolesFromFace as f, cast as g, asTopo as h, faceOrientation as i, outerWire as l, uvCoordinates as m, faceCenter as n, getSurfaceType as o, uvBounds as p, faceGeomType as r, innerWires as s, classifyPointOnFace as t, pointOnSurface as u, fromBREP as v, kernelCallScoped as w, shapeType as x, isCompSolid as y };
450
+ export { vertexPosition as A, kernelCallScoped as B, getVertices as C, iterFaces as D, iterEdges as E, isCompSolid as F, iterTopo as I, shapeType as L, cast as M, downcast as N, iterVertices as O, fromBREP as P, kernelCall as R, getOrCreateCache as S, invalidateShapeCache as T, getCacheEntry as _, flipFaceOrientation as a, getEdges as b, normalAt as c, projectPointOnFace as d, removeHolesFromFace as f, getBounds as g, describe as h, faceOrientation as i, asTopo as j, iterWires as k, outerWire as l, uvCoordinates as m, faceCenter as n, getSurfaceType as o, uvBounds as p, faceGeomType as r, innerWires as s, classifyPointOnFace as t, pointOnSurface as u, getCachedIsValid as v, getWires as w, getFaces as x, getCachedSurfaceType as y, kernelCallRaw as z };
@@ -1,11 +1,11 @@
1
- import { Y as getKernel, p as isFace } from "./shapeTypes-s18kDLub.js";
1
+ import { X as getKernel, p as isFace } from "./shapeTypes-DRUSTY2w.js";
2
2
  import { A as ok, R as unwrap, T as isOk, b as err, h as bug, o as queryError } from "./errors-C-cgQA3w.js";
3
- import { c as normalAt, o as getSurfaceType } from "./faceFns-B0eQeMRl.js";
3
+ import { C as getVertices, b as getEdges, c as normalAt, o as getSurfaceType, w as getWires, x as getFaces } from "./faceFns-DSijGggR.js";
4
4
  import { t as DEG2RAD } from "./constants-B9u763C3.js";
5
5
  import { a as vecDot, d as vecNormalize } from "./vecOps-D9etjPgV.js";
6
- import { F as getVertices, I as getWires, M as getEdges, N as getFaces, a as isSameShape, n as getHashCode } from "./shapeFns-B0qsEh-h.js";
7
- import { a as curveLength, d as getCurveType, r as curveIsClosed } from "./curveFns-BL-a8bye.js";
8
- import { n as measureArea } from "./measureFns-ekclW7RC.js";
6
+ import { a as isSameShape, n as getHashCode } from "./shapeFns-CquegVyR.js";
7
+ import { a as curveLength, d as getCurveType, r as curveIsClosed } from "./curveFns-CPSCjYH3.js";
8
+ import { n as measureArea } from "./measureFns-2OfU2IUx.js";
9
9
  //#region src/utils/vec2d.ts
10
10
  /** Precision for curve intersection and parameter operations. */
11
11
  var PRECISION_INTERSECTION = 1e-9;