brepjs 18.114.0 → 18.115.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
@@ -30,7 +30,7 @@ const require_loftFns = require("./loftFns-fpTmrIdd.cjs");
30
30
  const require_cameraFns = require("./cameraFns-uo1sZbBT.cjs");
31
31
  const require_textMetrics = require("./textMetrics-IC_IoI7l.cjs");
32
32
  const require_adjacencyFns = require("./adjacencyFns-d8ZabkvX.cjs");
33
- const require_refResolveFns = require("./refResolveFns-BK5NSDFd.cjs");
33
+ const require_refResolveFns = require("./refResolveFns-pRVyjy35.cjs");
34
34
  const require_workerPool = require("./workerPool-D30NsiIW.cjs");
35
35
  const require_primitiveFns = require("./primitiveFns-DLIWtQWA.cjs");
36
36
  //#region src/topology/shapeBooleans.ts
package/dist/brepjs.js CHANGED
@@ -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-bk9e0F-T.js";
30
30
  import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-COGYk0LE.js";
31
31
  import { a as sharedEdges, c as wiresOfFace, i as facesOfVertex, n as edgesOfFace, o as verticesOfEdge, r as facesOfEdge, s as verticesOfFace, t as adjacentFaces } from "./adjacencyFns-BYnyXXqt.js";
32
- import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-CayDQeug.js";
32
+ import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-hEOEcFZ8.js";
33
33
  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";
34
34
  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-CBrOyk5S.js";
35
35
  //#region \0rolldown/runtime.js
@@ -70,33 +70,56 @@ function boxRoleFromNormal(n) {
70
70
  if (n[0] > AXIS_THRESHOLD) return "box:right";
71
71
  if (n[0] < -.9) return "box:left";
72
72
  }
73
+ /** Axial cap name for a Z-axis primitive: 'top' (+Z) / 'bottom' (-Z). */
74
+ function axialCapName(prefix, face) {
75
+ if (faceGeomType(face) !== "PLANE") return void 0;
76
+ const z = normalAt(face)[2];
77
+ if (z > AXIS_THRESHOLD) return `${prefix}:top`;
78
+ if (z < -.9) return `${prefix}:bottom`;
79
+ }
80
+ /** Semantic role for a Z-axis cylinder face: top/bottom caps + lateral wall. */
81
+ function cylinderRole(face) {
82
+ return faceGeomType(face) === "CYLINDRE" ? "cylinder:lateral" : axialCapName("cylinder", face);
83
+ }
84
+ /** Semantic role for a Z-axis cone/frustum face: top/bottom caps + lateral. */
85
+ function coneRole(face) {
86
+ return faceGeomType(face) === "CONE" ? "cone:lateral" : axialCapName("cone", face);
87
+ }
88
+ /** Semantic role for a sphere's single spherical face. */
89
+ function sphereRole(face) {
90
+ return faceGeomType(face) === "SPHERE" ? "sphere:surface" : void 0;
91
+ }
92
+ /** Per-primitive semantic face namers, keyed by operation type. */
93
+ var ROLE_ASSIGNERS = {
94
+ box: (face) => boxRoleFromNormal(normalAt(face)),
95
+ cylinder: cylinderRole,
96
+ cone: coneRole,
97
+ sphere: sphereRole
98
+ };
73
99
  /**
74
- * Auto-assign role names to the faces of a shape based on operation type.
100
+ * Auto-assign role names to a shape's faces from its operation type.
75
101
  *
76
- * For 'box': uses face normals to assign cardinal names
77
- * ('box:top', 'box:bottom', 'box:front', 'box:back', 'box:left', 'box:right').
78
- * **Note:** Box role detection assumes axis-aligned faces (normal within 0.9 of
79
- * a cardinal axis). Rotated boxes may receive fewer than 6 named roles; remaining
80
- * faces fall through to sequential naming.
102
+ * Known primitives get **semantic** names from face geometry — rebuild-stable
103
+ * across parameter edits that preserve orientation:
104
+ * - `box`: cardinal names by normal ('box:top'/'bottom'/'front'/'back'/'left'/'right').
105
+ * - `cylinder`/`cone` (Z-axis): 'top'/'bottom' caps + 'lateral' wall.
106
+ * - `sphere`: 'sphere:surface'.
81
107
  *
82
- * For other types: sequential naming ('opType:face_0', 'opType:face_1', ...).
108
+ * Faces a primitive namer doesn't recognize (a rotated box's non-cardinal faces),
109
+ * and every face of any other operation type, fall back to positional names
110
+ * ('opType:face_0', 'opType:face_1', ...) — so each face always gets a role.
83
111
  *
84
112
  * @returns Map from role name to its face hash codes (one at assignment time;
85
113
  * a role accrues more hashes only later, when `updateRoles` tracks a split).
86
114
  */
87
115
  function assignRoles(shape, operationType) {
88
- const faces = getFaces(shape);
89
116
  const roles = /* @__PURE__ */ new Map();
90
- if (operationType === "box") {
91
- for (const face of faces) {
92
- const role = boxRoleFromNormal(normalAt(face));
93
- if (role !== void 0 && !roles.has(role)) roles.set(role, [getHashCode(face)]);
94
- }
95
- return roles;
96
- }
117
+ const assigner = ROLE_ASSIGNERS[operationType];
97
118
  let index = 0;
98
- for (const face of faces) {
99
- roles.set(`${operationType}:face_${index}`, [getHashCode(face)]);
119
+ for (const face of getFaces(shape)) {
120
+ const semantic = assigner?.(face);
121
+ const role = semantic !== void 0 && !roles.has(semantic) ? semantic : `${operationType}:face_${index}`;
122
+ roles.set(role, [getHashCode(face)]);
100
123
  index++;
101
124
  }
102
125
  return roles;
@@ -70,33 +70,56 @@ function boxRoleFromNormal(n) {
70
70
  if (n[0] > AXIS_THRESHOLD) return "box:right";
71
71
  if (n[0] < -.9) return "box:left";
72
72
  }
73
+ /** Axial cap name for a Z-axis primitive: 'top' (+Z) / 'bottom' (-Z). */
74
+ function axialCapName(prefix, face) {
75
+ if (require_faceFns.faceGeomType(face) !== "PLANE") return void 0;
76
+ const z = require_faceFns.normalAt(face)[2];
77
+ if (z > AXIS_THRESHOLD) return `${prefix}:top`;
78
+ if (z < -.9) return `${prefix}:bottom`;
79
+ }
80
+ /** Semantic role for a Z-axis cylinder face: top/bottom caps + lateral wall. */
81
+ function cylinderRole(face) {
82
+ return require_faceFns.faceGeomType(face) === "CYLINDRE" ? "cylinder:lateral" : axialCapName("cylinder", face);
83
+ }
84
+ /** Semantic role for a Z-axis cone/frustum face: top/bottom caps + lateral. */
85
+ function coneRole(face) {
86
+ return require_faceFns.faceGeomType(face) === "CONE" ? "cone:lateral" : axialCapName("cone", face);
87
+ }
88
+ /** Semantic role for a sphere's single spherical face. */
89
+ function sphereRole(face) {
90
+ return require_faceFns.faceGeomType(face) === "SPHERE" ? "sphere:surface" : void 0;
91
+ }
92
+ /** Per-primitive semantic face namers, keyed by operation type. */
93
+ var ROLE_ASSIGNERS = {
94
+ box: (face) => boxRoleFromNormal(require_faceFns.normalAt(face)),
95
+ cylinder: cylinderRole,
96
+ cone: coneRole,
97
+ sphere: sphereRole
98
+ };
73
99
  /**
74
- * Auto-assign role names to the faces of a shape based on operation type.
100
+ * Auto-assign role names to a shape's faces from its operation type.
75
101
  *
76
- * For 'box': uses face normals to assign cardinal names
77
- * ('box:top', 'box:bottom', 'box:front', 'box:back', 'box:left', 'box:right').
78
- * **Note:** Box role detection assumes axis-aligned faces (normal within 0.9 of
79
- * a cardinal axis). Rotated boxes may receive fewer than 6 named roles; remaining
80
- * faces fall through to sequential naming.
102
+ * Known primitives get **semantic** names from face geometry — rebuild-stable
103
+ * across parameter edits that preserve orientation:
104
+ * - `box`: cardinal names by normal ('box:top'/'bottom'/'front'/'back'/'left'/'right').
105
+ * - `cylinder`/`cone` (Z-axis): 'top'/'bottom' caps + 'lateral' wall.
106
+ * - `sphere`: 'sphere:surface'.
81
107
  *
82
- * For other types: sequential naming ('opType:face_0', 'opType:face_1', ...).
108
+ * Faces a primitive namer doesn't recognize (a rotated box's non-cardinal faces),
109
+ * and every face of any other operation type, fall back to positional names
110
+ * ('opType:face_0', 'opType:face_1', ...) — so each face always gets a role.
83
111
  *
84
112
  * @returns Map from role name to its face hash codes (one at assignment time;
85
113
  * a role accrues more hashes only later, when `updateRoles` tracks a split).
86
114
  */
87
115
  function assignRoles(shape, operationType) {
88
- const faces = require_topologyQueryFns.getFaces(shape);
89
116
  const roles = /* @__PURE__ */ new Map();
90
- if (operationType === "box") {
91
- for (const face of faces) {
92
- const role = boxRoleFromNormal(require_faceFns.normalAt(face));
93
- if (role !== void 0 && !roles.has(role)) roles.set(role, [require_shapeFns.getHashCode(face)]);
94
- }
95
- return roles;
96
- }
117
+ const assigner = ROLE_ASSIGNERS[operationType];
97
118
  let index = 0;
98
- for (const face of faces) {
99
- roles.set(`${operationType}:face_${index}`, [require_shapeFns.getHashCode(face)]);
119
+ for (const face of require_topologyQueryFns.getFaces(shape)) {
120
+ const semantic = assigner?.(face);
121
+ const role = semantic !== void 0 && !roles.has(semantic) ? semantic : `${operationType}:face_${index}`;
122
+ roles.set(role, [require_shapeFns.getHashCode(face)]);
100
123
  index++;
101
124
  }
102
125
  return roles;
package/dist/shapeRef.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_refResolveFns = require("./refResolveFns-BK5NSDFd.cjs");
2
+ const require_refResolveFns = require("./refResolveFns-pRVyjy35.cjs");
3
3
  exports.assignRoles = require_refResolveFns.assignRoles;
4
4
  exports.captureHint = require_refResolveFns.captureHint;
5
5
  exports.createDerivedFaceRef = require_refResolveFns.createDerivedFaceRef;
package/dist/shapeRef.js CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-CayDQeug.js";
1
+ import { _ as createRef, a as isVertexRef, b as defaultScorer, c as resolveRefParams, d as createVertexRef, f as resolveVertexRef, g as captureHint, h as assignRoles, i as isLineageRef, l as createDerivedFaceRef, m as resolveEdgeRef, n as isEdgeRef, o as resolveLineageRef, p as createEdgeRef, r as isFaceRef, s as resolveRefIn, t as isDerivedFaceRef, u as resolveDerivedFaceRef, v as resolveRef, y as updateRoles } from "./refResolveFns-hEOEcFZ8.js";
2
2
  export { assignRoles, captureHint, createDerivedFaceRef, createEdgeRef, createRef, createVertexRef, defaultScorer, isDerivedFaceRef, isEdgeRef, isFaceRef, isLineageRef, isVertexRef, resolveDerivedFaceRef, resolveEdgeRef, resolveLineageRef, resolveRef, resolveRefIn, resolveRefParams, resolveVertexRef, updateRoles };
@@ -5,15 +5,17 @@ import { FaceScorer } from './scoring.js';
5
5
  /** Snapshot the geometric properties of a face for later matching. */
6
6
  export declare function captureHint(face: Face): GeometricHint;
7
7
  /**
8
- * Auto-assign role names to the faces of a shape based on operation type.
8
+ * Auto-assign role names to a shape's faces from its operation type.
9
9
  *
10
- * For 'box': uses face normals to assign cardinal names
11
- * ('box:top', 'box:bottom', 'box:front', 'box:back', 'box:left', 'box:right').
12
- * **Note:** Box role detection assumes axis-aligned faces (normal within 0.9 of
13
- * a cardinal axis). Rotated boxes may receive fewer than 6 named roles; remaining
14
- * faces fall through to sequential naming.
10
+ * Known primitives get **semantic** names from face geometry — rebuild-stable
11
+ * across parameter edits that preserve orientation:
12
+ * - `box`: cardinal names by normal ('box:top'/'bottom'/'front'/'back'/'left'/'right').
13
+ * - `cylinder`/`cone` (Z-axis): 'top'/'bottom' caps + 'lateral' wall.
14
+ * - `sphere`: 'sphere:surface'.
15
15
  *
16
- * For other types: sequential naming ('opType:face_0', 'opType:face_1', ...).
16
+ * Faces a primitive namer doesn't recognize (a rotated box's non-cardinal faces),
17
+ * and every face of any other operation type, fall back to positional names
18
+ * ('opType:face_0', 'opType:face_1', ...) — so each face always gets a role.
17
19
  *
18
20
  * @returns Map from role name to its face hash codes (one at assignment time;
19
21
  * a role accrues more hashes only later, when `updateRoles` tracks a split).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs",
3
- "version": "18.114.0",
3
+ "version": "18.115.0",
4
4
  "description": "Web CAD library with pluggable geometry kernel",
5
5
  "keywords": [
6
6
  "cad",