brepjs 18.124.0 → 18.124.2

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 (86) hide show
  1. package/dist/2d.cjs +10 -8
  2. package/dist/2d.js +10 -8
  3. package/dist/{adjacencyFns-BJ6jcQ-N.cjs → adjacencyFns-CpKlADYt.cjs} +3 -3
  4. package/dist/{adjacencyFns-CnehwLNj.js → adjacencyFns-DECdcer5.js} +3 -3
  5. package/dist/{blueprint-BGWbpQ-w.js → blueprint-CaY00-X2.js} +16 -11
  6. package/dist/{blueprint-BSfG0Uik.cjs → blueprint-CpJLcUJV.cjs} +14 -10
  7. package/dist/{blueprintFns-C0-nGqlW.cjs → blueprintFns-B5nFaJI0.cjs} +2 -2
  8. package/dist/{blueprintFns-Bt1hKlL7.js → blueprintFns-vgwEIgI0.js} +2 -2
  9. package/dist/{blueprintSketcher-Bd5ZS9p6.cjs → blueprintSketcher-4e0yYtCY.cjs} +19 -11
  10. package/dist/{blueprintSketcher-BTGRoQ_G.js → blueprintSketcher-BjBjj2cK.js} +19 -11
  11. package/dist/{boolean2D-Cr6oLsbf.cjs → boolean2D-7heWA1co.cjs} +12 -8
  12. package/dist/{boolean2D-zZ9-qR5a.js → boolean2D-Bk-VrRyQ.js} +14 -9
  13. package/dist/brepjs.cjs +121 -81
  14. package/dist/brepjs.js +132 -85
  15. package/dist/{cameraFns-j2I9G3L_.cjs → cameraFns-CGwrxgqB.cjs} +5 -4
  16. package/dist/{cameraFns-CGMawqfi.js → cameraFns-DKEilV2v.js} +5 -4
  17. package/dist/core.cjs +2 -2
  18. package/dist/core.js +2 -2
  19. package/dist/{cornerFinder-CaXBdZz9.js → cornerFinder-C4s6pVZ-.js} +1 -1
  20. package/dist/{cornerFinder-CPwSLgpM.cjs → cornerFinder-zEgIFMnk.cjs} +1 -1
  21. package/dist/{curveFns-BBLaLG1U.cjs → curveFns-BZZYHVow.cjs} +8 -5
  22. package/dist/{curveFns-BoHbhtqX.js → curveFns-RczIU30U.js} +8 -5
  23. package/dist/{drawFns-DOkSdo8E.cjs → drawFns-BcXzWFfn.cjs} +59 -30
  24. package/dist/{drawFns-BrRbAeYB.js → drawFns-BjT3RaeQ.js} +59 -30
  25. package/dist/{faceFns-UozswcwP.cjs → faceFns-C4xNv2zn.cjs} +4 -3
  26. package/dist/{faceFns-Ce7Fq6j5.js → faceFns-fvp_zfuI.js} +6 -4
  27. package/dist/{healingFns-Dn0EFSHm.js → healingFns-AE5182Ds.js} +38 -21
  28. package/dist/{healingFns-mKogaVOk.cjs → healingFns-SxSiVPQa.cjs} +38 -21
  29. package/dist/{helpers-DuTAcGVX.cjs → helpers-CHYzwQMk.cjs} +6 -6
  30. package/dist/{helpers-CZsK8STz.js → helpers-CyLQ07aD.js} +6 -6
  31. package/dist/{importFns-Ch2YwieP.cjs → importFns-90S7P_7P.cjs} +5 -6
  32. package/dist/{importFns-CE4byS-8.js → importFns-DdXOAX6k.js} +5 -6
  33. package/dist/io.cjs +2 -2
  34. package/dist/io.js +2 -2
  35. package/dist/kernel/occtWasm/occtWasmAdapter.cjs +1 -1
  36. package/dist/kernel/occtWasm/occtWasmAdapter.js +1 -1
  37. package/dist/{loftFns-BYiUcAxk.cjs → loftFns-B3mbh5RA.cjs} +15 -9
  38. package/dist/{loftFns-DQVg8qxM.js → loftFns-CyY4qfvC.js} +15 -9
  39. package/dist/{measureFns-BbLLBg5q.js → measureFns-B1uLQugf.js} +3 -3
  40. package/dist/{measureFns-Cao9gY1L.cjs → measureFns-Cx2XJVVC.cjs} +3 -3
  41. package/dist/measurement.cjs +1 -1
  42. package/dist/measurement.js +1 -1
  43. package/dist/{meshFns-CnYIUU9b.cjs → meshFns-2ZxW-X9I.cjs} +3 -3
  44. package/dist/{meshFns-B6NveFwc.js → meshFns-DrO3d03M.js} +3 -3
  45. package/dist/{occtWasmAdapter-BQKQXF63.js → occtWasmAdapter-BEe---7w.js} +3 -1
  46. package/dist/{occtWasmAdapter-Aubfbks6.cjs → occtWasmAdapter-DEpy64ji.cjs} +3 -1
  47. package/dist/operations.cjs +2 -2
  48. package/dist/operations.js +2 -2
  49. package/dist/{originTrackingFns-uz38yuMp.cjs → originTrackingFns-D3rUK08B.cjs} +2 -2
  50. package/dist/{originTrackingFns-DXcggmgf.js → originTrackingFns-DIAwMSih.js} +2 -2
  51. package/dist/{primitiveFns-CmmTWOkO.js → primitiveFns-CDPqVTcc.js} +7 -5
  52. package/dist/{primitiveFns-DmEPf6av.cjs → primitiveFns-c7wqS-K2.cjs} +7 -5
  53. package/dist/projection.cjs +1 -1
  54. package/dist/projection.js +1 -1
  55. package/dist/query.cjs +2 -2
  56. package/dist/query.js +2 -2
  57. package/dist/{refResolveFns-CnPEaqHw.cjs → refResolveFns-Cm8ZHPl5.cjs} +10 -8
  58. package/dist/{refResolveFns-DqY7Cd00.js → refResolveFns-o3-Gdnjn.js} +10 -8
  59. package/dist/{rolldown-runtime-DakpK96I.cjs → rolldown-runtime-C0BPl7ul.cjs} +1 -1
  60. package/dist/{shapeFns-BLZ1dDSz.cjs → shapeFns-CJ6mph9b.cjs} +2 -2
  61. package/dist/{shapeFns-mYczuWOy.js → shapeFns-DEpbxB9Z.js} +2 -2
  62. package/dist/shapeRef.cjs +1 -1
  63. package/dist/shapeRef.js +1 -1
  64. package/dist/{shapeTypes-bHlssytH.js → shapeTypes-BHRboc_x.js} +235 -20
  65. package/dist/{shapeTypes-DZKuRt24.cjs → shapeTypes-D5Y41q7x.cjs} +219 -12
  66. package/dist/sketching.cjs +3 -3
  67. package/dist/sketching.js +3 -3
  68. package/dist/{solidBuilders-5tA9O1SM.cjs → solidBuilders-CsUkRC69.cjs} +14 -9
  69. package/dist/{solidBuilders-9s-j-ZiW.js → solidBuilders-DQQ0re9T.js} +14 -9
  70. package/dist/{surfaceBuilders-0x7j0ibk.cjs → surfaceBuilders-BXNZydNl.cjs} +7 -5
  71. package/dist/{surfaceBuilders-B7UnwkQz.js → surfaceBuilders-C8k0K7DR.js} +7 -5
  72. package/dist/text.cjs +2 -2
  73. package/dist/text.js +2 -2
  74. package/dist/{textBlueprints-DE3M-E9o.js → textBlueprints-BAyLXffK.js} +36 -21
  75. package/dist/{textBlueprints-BPbIpA4-.cjs → textBlueprints-t8MdWfki.cjs} +37 -22
  76. package/dist/{textMetrics-D3Bly1w4.js → textMetrics-CefI-bMN.js} +3 -2
  77. package/dist/{textMetrics-rRuWxQG_.cjs → textMetrics-DUEI9s5M.cjs} +3 -2
  78. package/dist/{threadFns-BAjFNk2_.js → threadFns-Bau5Sqad.js} +17 -12
  79. package/dist/{threadFns-BMT6ziG_.cjs → threadFns-OVYAleOH.cjs} +17 -12
  80. package/dist/topology.cjs +9 -9
  81. package/dist/topology.js +9 -9
  82. package/dist/{topologyQueryFns-DVhWxBwT.js → topologyQueryFns-QvPyCF-7.js} +1 -1
  83. package/dist/{topologyQueryFns-DZUpJz2p.cjs → topologyQueryFns-gah07J7-.cjs} +1 -1
  84. package/dist/{validityTypes-19mfqWVv.js → validityTypes-DokbYKzd.js} +1 -1
  85. package/dist/{validityTypes-CCnRq3A9.cjs → validityTypes-Dx-04qO0.cjs} +1 -1
  86. package/package.json +7 -7
@@ -1,4 +1,4 @@
1
- const require_occtWasmAdapter = require("./occtWasmAdapter-Aubfbks6.cjs");
1
+ const require_occtWasmAdapter = require("./occtWasmAdapter-DEpy64ji.cjs");
2
2
  const require_bug = require("./bug-O02CsAmt.cjs");
3
3
  //#region src/kernel/quality.ts
4
4
  /**
@@ -2176,9 +2176,7 @@ function transformBatch$2(oc, entries) {
2176
2176
  case "scale":
2177
2177
  batch.addScale(e.shape, ...e.center, e.factor);
2178
2178
  break;
2179
- case "mirror":
2180
- batch.addMirror(e.shape, ...e.origin, ...e.normal);
2181
- break;
2179
+ case "mirror": batch.addMirror(e.shape, ...e.origin, ...e.normal);
2182
2180
  }
2183
2181
  const result = batch.execute();
2184
2182
  try {
@@ -3956,7 +3954,8 @@ function makeFaceOnSurface$1(oc, surfaceOrFace, wire) {
3956
3954
  function bsplineSurface$1(oc, points, rows, cols) {
3957
3955
  const arr = new oc.TColgp_Array2OfPnt_2(1, rows, 1, cols);
3958
3956
  for (let r = 0; r < rows; r++) for (let c = 0; c < cols; c++) {
3959
- const pt = require_bug.wasmIndex(points, r * cols + c);
3957
+ const idx = r * cols + c;
3958
+ const pt = require_bug.wasmIndex(points, idx);
3960
3959
  const pnt = new oc.gp_Pnt_3(pt[0], pt[1], pt[2]);
3961
3960
  arr.SetValue_1(r + 1, c + 1, pnt);
3962
3961
  pnt.delete();
@@ -6690,8 +6689,6 @@ function fuseAll(bk, shapes, options) {
6690
6689
  }
6691
6690
  function cutAll(bk, shape, tools, options) {
6692
6691
  if (tools.length === 0) return shape;
6693
- if (tools.length === 1) return cut(bk, shape, tools[0], options);
6694
- const baseId = unwrapSolidOrThrow(shape, "cutAll");
6695
6692
  const toolIds = [];
6696
6693
  for (const tool of tools) {
6697
6694
  const h = tool;
@@ -6699,7 +6696,24 @@ function cutAll(bk, shape, tools, options) {
6699
6696
  else toolIds.push(unwrapSolidOrThrow(tool, "cutAll"));
6700
6697
  }
6701
6698
  if (toolIds.length === 0) return shape;
6702
- return solidHandle(bk.compoundCut(baseId, new Uint32Array(toolIds)));
6699
+ const baseHandle = shape;
6700
+ if (isBrepkitHandle(shape) && baseHandle.type === "compound") {
6701
+ const survivors = [];
6702
+ for (const childId of toArray(bk.getCompoundSolids(baseHandle.id))) try {
6703
+ survivors.push(bk.compoundCut(childId, toolIds));
6704
+ } catch (e) {
6705
+ if (!isEmptyBooleanError(e)) throw e;
6706
+ }
6707
+ return compoundHandle(bk.makeCompound(survivors));
6708
+ }
6709
+ if (tools.length === 1) return cut(bk, shape, tools[0], options);
6710
+ const baseId = unwrapSolidOrThrow(shape, "cutAll");
6711
+ try {
6712
+ return solidHandle(bk.compoundCut(baseId, new Uint32Array(toolIds)));
6713
+ } catch (e) {
6714
+ if (isEmptyBooleanError(e)) return emptyCompound(bk);
6715
+ throw e;
6716
+ }
6703
6717
  }
6704
6718
  function split(bk, shape, tools) {
6705
6719
  if (tools.length === 0) throw new Error("brepkit: split requires at least one tool");
@@ -8359,7 +8373,8 @@ function exportSTEP(bk, shapes) {
8359
8373
  return parts.join("\n");
8360
8374
  }
8361
8375
  function exportSTL$1(bk, shape, binary, tolerance = require_occtWasmAdapter.DEFAULT_STL_TOLERANCE, angularTolerance = require_occtWasmAdapter.DEFAULT_STL_ANGULAR_TOLERANCE) {
8362
- const { vertices, triangles } = mesh$1(bk, solidHandle(require_bug.wasmIndex(unwrapSolidsForExport(bk, shape, "exportSTL"), 0)), {
8376
+ const solidIds = unwrapSolidsForExport(bk, shape, "exportSTL");
8377
+ const { vertices, triangles } = mesh$1(bk, solidHandle(require_bug.wasmIndex(solidIds, 0)), {
8363
8378
  tolerance,
8364
8379
  angularTolerance,
8365
8380
  skipNormals: true
@@ -8613,7 +8628,6 @@ function reverseCurve2d(curve) {
8613
8628
  if (Array.isArray(m.weights)) m.weights = [...m.weights].reverse();
8614
8629
  break;
8615
8630
  }
8616
- default: break;
8617
8631
  }
8618
8632
  }
8619
8633
  function copyCurve2d(curve) {
@@ -9916,6 +9930,7 @@ function makeSweepOps$1(bk) {
9916
9930
  }
9917
9931
  //#endregion
9918
9932
  //#region src/kernel/brepkit/brepkitAdapter.ts
9933
+ /* v8 ignore file -- brepkit WASM kernel not available in OCCT test suite */
9919
9934
  /**
9920
9935
  * Kernel-lifecycle ops that call directly into the brepkit WASM instance
9921
9936
  * without delegating through a `*Ops.ts` module. These are too thin to
@@ -10474,7 +10489,181 @@ function affineMatrix(linear, translation) {
10474
10489
  m[14] = translation[2];
10475
10490
  return m;
10476
10491
  }
10492
+ /**
10493
+ * Profile shapes — edges, wires and faces — have no Manifold counterpart, so
10494
+ * they carry a placeholder value and live purely as op-graph nodes holding
10495
+ * their points. Calling Manifold's solid transform on one throws
10496
+ * `solid.transform is not a function`.
10497
+ *
10498
+ * Transform them by baking the matrix into the recorded points and emitting a
10499
+ * node of the same kind. `ringOrPts` reads points off the node and does not
10500
+ * walk inputs, so a transform-shaped node would read as an empty profile;
10501
+ * replay rebuilds profile nodes from those same points, so a baked transform
10502
+ * applies exactly once.
10503
+ */
10504
+ var PROFILE_POINT_KEYS = [
10505
+ "pts",
10506
+ "ring",
10507
+ "outline"
10508
+ ];
10509
+ function isVec3(v) {
10510
+ return Array.isArray(v) && v.length === 3 && v.every((n) => typeof n === "number");
10511
+ }
10512
+ function applyMat4(m, v) {
10513
+ const g = (i) => m[i] ?? 0;
10514
+ return [
10515
+ g(0) * v[0] + g(4) * v[1] + g(8) * v[2] + g(12),
10516
+ g(1) * v[0] + g(5) * v[1] + g(9) * v[2] + g(13),
10517
+ g(2) * v[0] + g(6) * v[1] + g(10) * v[2] + g(14)
10518
+ ];
10519
+ }
10520
+ function numOf(v, fallback = 0) {
10521
+ return typeof v === "number" ? v : fallback;
10522
+ }
10523
+ function transformDir(matrix, v) {
10524
+ const o = applyMat4(matrix, [
10525
+ 0,
10526
+ 0,
10527
+ 0
10528
+ ]);
10529
+ const p = applyMat4(matrix, v);
10530
+ return [
10531
+ p[0] - o[0],
10532
+ p[1] - o[1],
10533
+ p[2] - o[2]
10534
+ ];
10535
+ }
10536
+ function unit3(v) {
10537
+ const n = Math.hypot(v[0], v[1], v[2]);
10538
+ return n < 1e-12 ? v : [
10539
+ v[0] / n,
10540
+ v[1] / n,
10541
+ v[2] / n
10542
+ ];
10543
+ }
10544
+ function similarityScale(m) {
10545
+ const g = (i) => m[i] ?? 0;
10546
+ const cx = [
10547
+ g(0),
10548
+ g(1),
10549
+ g(2)
10550
+ ];
10551
+ const cy = [
10552
+ g(4),
10553
+ g(5),
10554
+ g(6)
10555
+ ];
10556
+ const cz = [
10557
+ g(8),
10558
+ g(9),
10559
+ g(10)
10560
+ ];
10561
+ const len = (v) => Math.hypot(v[0], v[1], v[2]);
10562
+ const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
10563
+ const nx = len(cx);
10564
+ const ny = len(cy);
10565
+ const nz = len(cz);
10566
+ if (nx < 1e-12 || ny < 1e-12 || nz < 1e-12) return void 0;
10567
+ const tol = 1e-9 * nx;
10568
+ if (Math.abs(nx - ny) > tol || Math.abs(nx - nz) > tol) return void 0;
10569
+ if (Math.abs(dot(cx, cy)) > tol * ny) return void 0;
10570
+ if (Math.abs(dot(cx, cz)) > tol * nz) return void 0;
10571
+ if (Math.abs(dot(cy, cz)) > tol * nz) return void 0;
10572
+ return nx;
10573
+ }
10574
+ function transformCurveDesc(desc, matrix) {
10575
+ const kind = desc["k"];
10576
+ if (kind === "line") {
10577
+ const p1 = desc["p1"];
10578
+ const p2 = desc["p2"];
10579
+ if (!isVec3(p1) || !isVec3(p2)) return void 0;
10580
+ return {
10581
+ ...desc,
10582
+ p1: applyMat4(matrix, p1),
10583
+ p2: applyMat4(matrix, p2)
10584
+ };
10585
+ }
10586
+ if (kind === "bezier") {
10587
+ const pts = desc["points"];
10588
+ if (!Array.isArray(pts)) return void 0;
10589
+ return {
10590
+ ...desc,
10591
+ points: pts.map((p) => isVec3(p) ? applyMat4(matrix, p) : p)
10592
+ };
10593
+ }
10594
+ const s = similarityScale(matrix);
10595
+ if (s === void 0) return void 0;
10596
+ if (kind === "conic") {
10597
+ const c = desc["center"];
10598
+ const x = desc["x"];
10599
+ const y = desc["y"];
10600
+ if (!isVec3(c) || !isVec3(x) || !isVec3(y)) return void 0;
10601
+ return {
10602
+ ...desc,
10603
+ center: applyMat4(matrix, c),
10604
+ x: unit3(transformDir(matrix, x)),
10605
+ y: unit3(transformDir(matrix, y)),
10606
+ rx: numOf(desc["rx"]) * s,
10607
+ ry: numOf(desc["ry"]) * s
10608
+ };
10609
+ }
10610
+ if (kind === "helix") {
10611
+ const c = desc["center"];
10612
+ const ax = desc["axis"];
10613
+ const x = desc["x"];
10614
+ const y = desc["y"];
10615
+ if (!isVec3(c) || !isVec3(ax) || !isVec3(x) || !isVec3(y)) return void 0;
10616
+ return {
10617
+ ...desc,
10618
+ center: applyMat4(matrix, c),
10619
+ axis: unit3(transformDir(matrix, ax)),
10620
+ x: unit3(transformDir(matrix, x)),
10621
+ y: unit3(transformDir(matrix, y)),
10622
+ radius: numOf(desc["radius"]) * s,
10623
+ pitch: numOf(desc["pitch"]) * s
10624
+ };
10625
+ }
10626
+ }
10627
+ function transformProfileNode(node, matrix, input) {
10628
+ const src = node.params ?? {};
10629
+ const params = { ...src };
10630
+ for (const k of PROFILE_POINT_KEYS) {
10631
+ const pts = src[k];
10632
+ if (!Array.isArray(pts)) continue;
10633
+ params[k] = pts.map((v) => isVec3(v) ? applyMat4(matrix, v) : v);
10634
+ }
10635
+ for (const k of ["origin"]) {
10636
+ const v = src[k];
10637
+ if (isVec3(v)) params[k] = applyMat4(matrix, v);
10638
+ }
10639
+ for (const k of ["xAxis", "yAxis"]) {
10640
+ const v = src[k];
10641
+ if (!isVec3(v)) continue;
10642
+ const a = applyMat4(matrix, [
10643
+ 0,
10644
+ 0,
10645
+ 0
10646
+ ]);
10647
+ const b = applyMat4(matrix, v);
10648
+ params[k] = [
10649
+ b[0] - a[0],
10650
+ b[1] - a[1],
10651
+ b[2] - a[2]
10652
+ ];
10653
+ }
10654
+ const curve = src["curve"];
10655
+ if (curve !== null && typeof curve === "object") {
10656
+ const moved = transformCurveDesc(curve, matrix);
10657
+ if (moved === void 0) delete params["curve"];
10658
+ else params["curve"] = moved;
10659
+ }
10660
+ return wrap({
10661
+ delete: () => {},
10662
+ isEmpty: () => false
10663
+ }, makeNode(node.op ?? "profileWire", params, [input]));
10664
+ }
10477
10665
  function applyMatrix(solid, matrix, op, params, input) {
10666
+ if (typeof solid.transform !== "function") return transformProfileNode(input, matrix, input);
10478
10667
  return wrap(solid.transform(matrix), makeNode(op, params, [input]));
10479
10668
  }
10480
10669
  function translate(shape, x, y, z) {
@@ -12762,6 +12951,14 @@ var HANDLERS = {
12762
12951
  0,
12763
12952
  0
12764
12953
  ];
12954
+ if (pts.length > 2) {
12955
+ const through = pts.map((q) => [
12956
+ q[0],
12957
+ q[1],
12958
+ q[2]
12959
+ ]);
12960
+ return t.interpolatePoints(through);
12961
+ }
12765
12962
  const b = pts.length > 1 ? pts[pts.length - 1] ?? a : [
12766
12963
  a[0] + .001,
12767
12964
  a[1],
@@ -13261,6 +13458,16 @@ function makeMeasureOps(_module) {
13261
13458
  if (e && e.__nativeEdge && typeof e.length === "number") return e.length;
13262
13459
  const node = asManifoldShape(shape)?.node;
13263
13460
  if (node?.op === "profileEdge" && node.params?.curve) return descLength(node.params.curve);
13461
+ const pts = node?.op === "profileEdge" ? node.params?.pts : void 0;
13462
+ if (pts && pts.length > 1) {
13463
+ let total = 0;
13464
+ for (let i = 1; i < pts.length; i++) {
13465
+ const a = pts[i - 1] ?? [];
13466
+ const b = pts[i] ?? [];
13467
+ total += Math.hypot((b[0] ?? 0) - (a[0] ?? 0), (b[1] ?? 0) - (a[1] ?? 0), (b[2] ?? 0) - (a[2] ?? 0));
13468
+ }
13469
+ return total;
13470
+ }
13264
13471
  return notImplemented("length");
13265
13472
  },
13266
13473
  centerOfMass: (shape) => centerOfMass(shape),
@@ -14816,7 +15023,7 @@ function segSeg(p1, p2, p3, p4) {
14816
15023
  if (Math.abs(den) < 1e-15) return null;
14817
15024
  const t = ((p3[0] - p1[0]) * d2y - (p3[1] - p1[1]) * d2x) / den;
14818
15025
  const u = ((p3[0] - p1[0]) * d1y - (p3[1] - p1[1]) * d1x) / den;
14819
- if (t < -1e-9 || t > 1.000000001 || u < -1e-9 || u > 1.000000001) return null;
15026
+ if (t < -1e-9 || t > 1 + 1e-9 || u < -1e-9 || u > 1 + 1e-9) return null;
14820
15027
  return [p1[0] + d1x * t, p1[1] + d1y * t];
14821
15028
  }
14822
15029
  /**
@@ -15937,7 +16144,7 @@ async function init() {
15937
16144
  throw new Error("brepjs: no kernel package found. Install one of:\n npm install occt-wasm (recommended, default)\n npm install brepjs-opencascade\n npm install brepkit-wasm");
15938
16145
  }
15939
16146
  //#endregion
15940
- //#region \0@oxc-project+runtime@0.139.0/helpers/esm/usingCtx.js
16147
+ //#region \0@oxc-project+runtime@0.143.0/helpers/esm/usingCtx.js
15941
16148
  function _usingCtx() {
15942
16149
  var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
15943
16150
  var n = Error();
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_blueprintSketcher = require("./blueprintSketcher-Bd5ZS9p6.cjs");
3
- const require_drawFns = require("./drawFns-DOkSdo8E.cjs");
4
- const require_textBlueprints = require("./textBlueprints-BPbIpA4-.cjs");
2
+ const require_blueprintSketcher = require("./blueprintSketcher-4e0yYtCY.cjs");
3
+ const require_drawFns = require("./drawFns-BcXzWFfn.cjs");
4
+ const require_textBlueprints = require("./textBlueprints-t8MdWfki.cjs");
5
5
  //#region src/sketching.ts
6
6
  /**
7
7
  * brepjs/sketching — Sketcher, Drawing, and sketch-to-shape operations.
package/dist/sketching.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as BaseSketcher2d, t as BlueprintSketcher } from "./blueprintSketcher-BTGRoQ_G.js";
2
- import { A as sketchEllipse, C as DrawingPen, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, T as Drawing, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-BrRbAeYB.js";
3
- import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, o as compoundSketchExtrude, p as sketchRevolve, s as compoundSketchFace, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-DE3M-E9o.js";
1
+ import { n as BaseSketcher2d, t as BlueprintSketcher } from "./blueprintSketcher-BjBjj2cK.js";
2
+ import { A as sketchEllipse, C as DrawingPen, D as makeBaseBox, E as deserializeDrawing, F as sketchRectangle, I as sketchRoundedRectangle, L as FaceSketcher, M as sketchHelix, N as sketchParametricFunction, O as polysideInnerRadius, P as sketchPolysides, R as Sketcher, S as drawText, T as Drawing, _ as drawPolysides, a as drawingIntersect, b as drawSingleCircle, c as rotateDrawing, d as drawFaceOutline, f as drawProjection, g as drawPointsInterpolation, h as drawParametricFunction, i as drawingFuse, j as sketchFaceOffset, k as sketchCircle, l as scaleDrawing, m as drawEllipse, n as drawingCut, o as drawingToSketchOnPlane, p as drawCircle, r as drawingFillet, s as mirrorDrawing, t as drawingChamfer, u as translateDrawing, v as drawRectangle, w as draw, x as drawSingleEllipse, y as drawRoundedRectangle } from "./drawFns-BjT3RaeQ.js";
3
+ import { a as Sketch, c as compoundSketchLoft, d as sketchFace, f as sketchLoft, h as sketchWires, i as Sketches, l as compoundSketchRevolve, m as sketchSweep, o as compoundSketchExtrude, p as sketchRevolve, s as compoundSketchFace, u as sketchExtrude, v as CompoundSketch } from "./textBlueprints-BAyLXffK.js";
4
4
  //#region src/sketching.ts
5
5
  /**
6
6
  * brepjs/sketching — Sketcher, Drawing, and sketch-to-shape operations.
@@ -1,13 +1,13 @@
1
- const require_shapeTypes = require("./shapeTypes-DZKuRt24.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-D5Y41q7x.cjs");
2
2
  const require_errors = require("./errors-RHkKO5bZ.cjs");
3
- const require_topologyQueryFns = require("./topologyQueryFns-DZUpJz2p.cjs");
3
+ const require_topologyQueryFns = require("./topologyQueryFns-gah07J7-.cjs");
4
4
  const require_constants = require("./constants-BOVyEYGH.cjs");
5
5
  const require_vecOps = require("./vecOps-CCnJt-yH.cjs");
6
6
  const require_planeOps = require("./planeOps-VlFxtvzY.cjs");
7
- const require_faceFns = require("./faceFns-UozswcwP.cjs");
8
- const require_originTrackingFns = require("./originTrackingFns-uz38yuMp.cjs");
7
+ const require_faceFns = require("./faceFns-C4xNv2zn.cjs");
8
+ const require_originTrackingFns = require("./originTrackingFns-D3rUK08B.cjs");
9
9
  const require_arrayAccess = require("./arrayAccess-e4H9cBfh.cjs");
10
- const require_surfaceBuilders = require("./surfaceBuilders-0x7j0ibk.cjs");
10
+ const require_surfaceBuilders = require("./surfaceBuilders-BXNZydNl.cjs");
11
11
  //#region src/topology/metadata/faceTagFns.ts
12
12
  var shapeTagStore = /* @__PURE__ */ new WeakMap();
13
13
  var tagMetadataStore = /* @__PURE__ */ new WeakMap();
@@ -595,7 +595,9 @@ function section(shape, plane, { approximation = true, planeSize } = {}) {
595
595
  const { size, center } = resolveSectionPlacement(shape, resolvedPlane, planeSize);
596
596
  const sectionFace = makeSectionFace(resolvedPlane, size, center);
597
597
  try {
598
- return require_errors.ok(require_shapeTypes.castResultShape(require_shapeTypes.getKernel().section(shape.wrapped, sectionFace, approximation)));
598
+ const resultOc = require_shapeTypes.getKernel().section(shape.wrapped, sectionFace, approximation);
599
+ const wrapped = require_shapeTypes.castResultShape(resultOc);
600
+ return require_errors.ok(wrapped);
599
601
  } catch (e) {
600
602
  const raw = e instanceof Error ? e.message : String(e);
601
603
  const planeName = typeof plane === "string" ? plane : "custom";
@@ -743,7 +745,8 @@ function split(shape, tools) {
743
745
  if (require_shapeTypes.getKernel().isNull(shape.wrapped)) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, "split: shape is a null shape"));
744
746
  for (let i = 0; i < tools.length; i++) if (require_shapeTypes.getKernel().isNull(require_arrayAccess.getAtOrThrow(tools, i).wrapped)) return require_errors.err(require_errors.validationError(require_errors.BrepErrorCode.NULL_SHAPE_INPUT, `splitShape: tool at index ${i} is a null shape`));
745
747
  try {
746
- return require_errors.ok(require_shapeTypes.castResultShape(require_shapeTypes.getKernel().split(shape.wrapped, tools.map((t) => t.wrapped))));
748
+ const result = require_shapeTypes.getKernel().split(shape.wrapped, tools.map((t) => t.wrapped));
749
+ return require_errors.ok(require_shapeTypes.castResultShape(result));
747
750
  } catch (e) {
748
751
  const raw = e instanceof Error ? e.message : String(e);
749
752
  return require_errors.err(require_errors.kernelError("SPLIT_FAILED", `Split operation failed on ${tools.length} tool(s): ${raw}`, e, {
@@ -817,7 +820,8 @@ function booleanPipelineFallback(base, steps, options) {
817
820
  */
818
821
  /** Sew faces/shells into a single shape using the kernel's sewing algorithm. */
819
822
  function weldShapes(facesOrShells) {
820
- return require_shapeTypes.castResultShape(require_shapeTypes.getKernel().sew(facesOrShells.map((s) => s.wrapped)));
823
+ const sewn = require_shapeTypes.getKernel().sew(facesOrShells.map((s) => s.wrapped));
824
+ return require_shapeTypes.castResultShape(sewn);
821
825
  }
822
826
  /**
823
827
  * Welds faces and shells into a single shell.
@@ -917,7 +921,8 @@ function makeVertex(point) {
917
921
  * @returns An error if the result is not a valid 3D shape.
918
922
  */
919
923
  function makeOffset(face, offset, tolerance = 1e-6) {
920
- return require_errors.andThen(require_faceFns.downcast(require_shapeTypes.getKernel().offset(face.wrapped, offset, tolerance)), (downcasted) => require_errors.andThen(require_faceFns.cast(downcasted), (newShape) => {
924
+ const resultShape = require_shapeTypes.getKernel().offset(face.wrapped, offset, tolerance);
925
+ return require_errors.andThen(require_faceFns.downcast(resultShape), (downcasted) => require_errors.andThen(require_faceFns.cast(downcasted), (newShape) => {
921
926
  if (!require_shapeTypes.isShape3D(newShape)) return require_errors.err(require_errors.typeCastError("OFFSET_NOT_3D", "Could not offset to a 3d shape"));
922
927
  return require_errors.ok(newShape);
923
928
  }));
@@ -1,13 +1,13 @@
1
- import { C as isSolid, E as getShapeKind, K as getKernel, S as isShell, W as _usingCtx, d as createSolid, f as createVertex, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, s as createCompound, x as isShape3D } from "./shapeTypes-bHlssytH.js";
1
+ import { C as isSolid, E as getShapeKind, K as getKernel, S as isShell, W as _usingCtx, d as createSolid, f as createVertex, h as disposeResultShape, i as castShape, m as disposeDowncastSource, n as castResultShape, s as createCompound, x as isShape3D } from "./shapeTypes-BHRboc_x.js";
2
2
  import { E as ok, P as unwrap, b as isErr, d as validationError, g as err, i as kernelError, l as typeCastError, m as andThen, t as BrepErrorCode } from "./errors-MHLiNE-C.js";
3
- import { S as subShapeHashes, c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-DVhWxBwT.js";
3
+ import { S as subShapeHashes, c as getFaces, f as getVertices, p as getWires, s as getEdges } from "./topologyQueryFns-QvPyCF-7.js";
4
4
  import { n as HASH_CODE_MAX } from "./constants-ITRzCnCp.js";
5
5
  import { a as vecDot, g as vecSub, h as vecScale, t as vecAdd } from "./vecOps-SKPRvPH-.js";
6
6
  import { o as resolvePlane } from "./planeOps-CQahLrCx.js";
7
- import { _ as cast, y as downcast } from "./faceFns-Ce7Fq6j5.js";
8
- import { n as propagateOriginsByHash, r as propagateOriginsFromEvolution, t as getFaceOrigins } from "./originTrackingFns-DXcggmgf.js";
7
+ import { _ as cast, y as downcast } from "./faceFns-fvp_zfuI.js";
8
+ import { n as propagateOriginsByHash, r as propagateOriginsFromEvolution, t as getFaceOrigins } from "./originTrackingFns-DIAwMSih.js";
9
9
  import { n as getAtOrThrow, t as firstOrThrow } from "./arrayAccess-DrUGPADn.js";
10
- import { r as makeFace } from "./surfaceBuilders-B7UnwkQz.js";
10
+ import { r as makeFace } from "./surfaceBuilders-C8k0K7DR.js";
11
11
  //#region src/topology/metadata/faceTagFns.ts
12
12
  var shapeTagStore = /* @__PURE__ */ new WeakMap();
13
13
  var tagMetadataStore = /* @__PURE__ */ new WeakMap();
@@ -595,7 +595,9 @@ function section(shape, plane, { approximation = true, planeSize } = {}) {
595
595
  const { size, center } = resolveSectionPlacement(shape, resolvedPlane, planeSize);
596
596
  const sectionFace = makeSectionFace(resolvedPlane, size, center);
597
597
  try {
598
- return ok(castResultShape(getKernel().section(shape.wrapped, sectionFace, approximation)));
598
+ const resultOc = getKernel().section(shape.wrapped, sectionFace, approximation);
599
+ const wrapped = castResultShape(resultOc);
600
+ return ok(wrapped);
599
601
  } catch (e) {
600
602
  const raw = e instanceof Error ? e.message : String(e);
601
603
  const planeName = typeof plane === "string" ? plane : "custom";
@@ -743,7 +745,8 @@ function split(shape, tools) {
743
745
  if (getKernel().isNull(shape.wrapped)) return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, "split: shape is a null shape"));
744
746
  for (let i = 0; i < tools.length; i++) if (getKernel().isNull(getAtOrThrow(tools, i).wrapped)) return err(validationError(BrepErrorCode.NULL_SHAPE_INPUT, `splitShape: tool at index ${i} is a null shape`));
745
747
  try {
746
- return ok(castResultShape(getKernel().split(shape.wrapped, tools.map((t) => t.wrapped))));
748
+ const result = getKernel().split(shape.wrapped, tools.map((t) => t.wrapped));
749
+ return ok(castResultShape(result));
747
750
  } catch (e) {
748
751
  const raw = e instanceof Error ? e.message : String(e);
749
752
  return err(kernelError("SPLIT_FAILED", `Split operation failed on ${tools.length} tool(s): ${raw}`, e, {
@@ -817,7 +820,8 @@ function booleanPipelineFallback(base, steps, options) {
817
820
  */
818
821
  /** Sew faces/shells into a single shape using the kernel's sewing algorithm. */
819
822
  function weldShapes(facesOrShells) {
820
- return castResultShape(getKernel().sew(facesOrShells.map((s) => s.wrapped)));
823
+ const sewn = getKernel().sew(facesOrShells.map((s) => s.wrapped));
824
+ return castResultShape(sewn);
821
825
  }
822
826
  /**
823
827
  * Welds faces and shells into a single shell.
@@ -917,7 +921,8 @@ function makeVertex(point) {
917
921
  * @returns An error if the result is not a valid 3D shape.
918
922
  */
919
923
  function makeOffset(face, offset, tolerance = 1e-6) {
920
- return andThen(downcast(getKernel().offset(face.wrapped, offset, tolerance)), (downcasted) => andThen(cast(downcasted), (newShape) => {
924
+ const resultShape = getKernel().offset(face.wrapped, offset, tolerance);
925
+ return andThen(downcast(resultShape), (downcasted) => andThen(cast(downcasted), (newShape) => {
921
926
  if (!isShape3D(newShape)) return err(typeCastError("OFFSET_NOT_3D", "Could not offset to a 3d shape"));
922
927
  return ok(newShape);
923
928
  }));
@@ -1,7 +1,7 @@
1
- const require_shapeTypes = require("./shapeTypes-DZKuRt24.cjs");
1
+ const require_shapeTypes = require("./shapeTypes-D5Y41q7x.cjs");
2
2
  const require_errors = require("./errors-RHkKO5bZ.cjs");
3
- const require_validityTypes = require("./validityTypes-CCnRq3A9.cjs");
4
- const require_faceFns = require("./faceFns-UozswcwP.cjs");
3
+ const require_validityTypes = require("./validityTypes-Dx-04qO0.cjs");
4
+ const require_faceFns = require("./faceFns-C4xNv2zn.cjs");
5
5
  //#region src/utils/range.ts
6
6
  /** Generate an array of integers `[0, 1, …, len - 1]`. */
7
7
  function range(len) {
@@ -214,7 +214,8 @@ function makeNewFaceWithinFace(originFace, wire) {
214
214
  */
215
215
  function makeNonPlanarFace(wire) {
216
216
  try {
217
- return require_errors.andThen(require_faceFns.cast(require_shapeTypes.getKernel().makeNonPlanarFace(wire.wrapped)), (newFace) => {
217
+ const shape = require_shapeTypes.getKernel().makeNonPlanarFace(wire.wrapped);
218
+ return require_errors.andThen(require_faceFns.cast(shape), (newFace) => {
218
219
  if (!require_shapeTypes.isFace(newFace)) return require_errors.err(require_errors.kernelError("FACE_BUILD_FAILED", "Failed to create a non-planar face"));
219
220
  return require_errors.ok(newFace);
220
221
  });
@@ -236,7 +237,8 @@ function makePolygon(points) {
236
237
  if (points.length < 3) return require_errors.err(require_errors.validationError("POLYGON_MIN_POINTS", "You need at least 3 points to make a polygon"));
237
238
  const closing = [...points.slice(1), points[0]];
238
239
  const scope = _usingCtx$1.u(new require_shapeTypes.DisposalScope());
239
- return require_errors.andThen(assembleWire(zip([points, closing]).map(([p1, p2]) => scope.register(makeLine(p1, p2)))), (wire) => makeFace(scope.register(wire)));
240
+ const edges = zip([points, closing]).map(([p1, p2]) => scope.register(makeLine(p1, p2)));
241
+ return require_errors.andThen(assembleWire(edges), (wire) => makeFace(scope.register(wire)));
240
242
  } catch (_) {
241
243
  _usingCtx$1.e = _;
242
244
  } finally {
@@ -1,7 +1,7 @@
1
- import { K as getKernel, M as DisposalScope, W as _usingCtx, c as createEdge, l as createFace, p as createWire, y as isFace } from "./shapeTypes-bHlssytH.js";
1
+ import { K as getKernel, M as DisposalScope, W as _usingCtx, c as createEdge, l as createFace, p as createWire, y as isFace } from "./shapeTypes-BHRboc_x.js";
2
2
  import { E as ok, d as validationError, g as err, i as kernelError, m as andThen } from "./errors-MHLiNE-C.js";
3
- import { a as isPlanarFace } from "./validityTypes-19mfqWVv.js";
4
- import { _ as cast, u as outerWire } from "./faceFns-Ce7Fq6j5.js";
3
+ import { a as isPlanarFace } from "./validityTypes-DokbYKzd.js";
4
+ import { _ as cast, u as outerWire } from "./faceFns-fvp_zfuI.js";
5
5
  //#region src/utils/range.ts
6
6
  /** Generate an array of integers `[0, 1, …, len - 1]`. */
7
7
  function range(len) {
@@ -214,7 +214,8 @@ function makeNewFaceWithinFace(originFace, wire) {
214
214
  */
215
215
  function makeNonPlanarFace(wire) {
216
216
  try {
217
- return andThen(cast(getKernel().makeNonPlanarFace(wire.wrapped)), (newFace) => {
217
+ const shape = getKernel().makeNonPlanarFace(wire.wrapped);
218
+ return andThen(cast(shape), (newFace) => {
218
219
  if (!isFace(newFace)) return err(kernelError("FACE_BUILD_FAILED", "Failed to create a non-planar face"));
219
220
  return ok(newFace);
220
221
  });
@@ -236,7 +237,8 @@ function makePolygon(points) {
236
237
  if (points.length < 3) return err(validationError("POLYGON_MIN_POINTS", "You need at least 3 points to make a polygon"));
237
238
  const closing = [...points.slice(1), points[0]];
238
239
  const scope = _usingCtx$1.u(new DisposalScope());
239
- return andThen(assembleWire(zip([points, closing]).map(([p1, p2]) => scope.register(makeLine(p1, p2)))), (wire) => makeFace(scope.register(wire)));
240
+ const edges = zip([points, closing]).map(([p1, p2]) => scope.register(makeLine(p1, p2)));
241
+ return andThen(assembleWire(edges), (wire) => makeFace(scope.register(wire)));
240
242
  } catch (_) {
241
243
  _usingCtx$1.e = _;
242
244
  } finally {
package/dist/text.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_textBlueprints = require("./textBlueprints-BPbIpA4-.cjs");
3
- const require_textMetrics = require("./textMetrics-rRuWxQG_.cjs");
2
+ const require_textBlueprints = require("./textBlueprints-t8MdWfki.cjs");
3
+ const require_textMetrics = require("./textMetrics-DUEI9s5M.cjs");
4
4
  exports.fontMetrics = require_textMetrics.fontMetrics;
5
5
  exports.getFont = require_textBlueprints.getFont;
6
6
  exports.loadFont = require_textBlueprints.loadFont;
package/dist/text.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as getFont, r as loadFont, t as textBlueprints } from "./textBlueprints-DE3M-E9o.js";
2
- import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-D3Bly1w4.js";
1
+ import { n as getFont, r as loadFont, t as textBlueprints } from "./textBlueprints-BAyLXffK.js";
2
+ import { n as textMetrics, r as sketchText, t as fontMetrics } from "./textMetrics-CefI-bMN.js";
3
3
  export { fontMetrics, getFont, loadFont, sketchText, textBlueprints, textMetrics };