brepjs 12.8.2 → 12.10.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 (294) hide show
  1. package/dist/2d/blueprints/{approximations.d.ts → blueprintApproximations.d.ts} +1 -1
  2. package/dist/2d/blueprints/blueprintApproximations.d.ts.map +1 -0
  3. package/dist/2d/blueprints/{customCorners.d.ts → blueprintCustomCorners.d.ts} +1 -1
  4. package/dist/2d/blueprints/blueprintCustomCorners.d.ts.map +1 -0
  5. package/dist/2d/blueprints/blueprintFns.d.ts +17 -3
  6. package/dist/2d/blueprints/blueprintFns.d.ts.map +1 -1
  7. package/dist/2d/blueprints/{offset.d.ts → blueprintOffset.d.ts} +1 -1
  8. package/dist/2d/blueprints/blueprintOffset.d.ts.map +1 -0
  9. package/dist/2d/blueprints/index.d.ts +4 -4
  10. package/dist/2d/blueprints/index.d.ts.map +1 -1
  11. package/dist/2d/lib/Curve2D.d.ts +1 -1
  12. package/dist/2d/lib/Curve2D.d.ts.map +1 -1
  13. package/dist/2d/lib/svgPath.d.ts.map +1 -1
  14. package/dist/2d/lib/vectorOperations.d.ts +4 -1
  15. package/dist/2d/lib/vectorOperations.d.ts.map +1 -1
  16. package/dist/2d-CzEysb7A.js +108 -0
  17. package/dist/2d-DCxS_sb_.cjs +107 -0
  18. package/dist/2d.cjs +24 -88
  19. package/dist/2d.d.ts +1 -1
  20. package/dist/2d.js +34 -99
  21. package/dist/{Blueprint-CQ28WJhz.cjs → Blueprint-BoC0DsDm.cjs} +15 -45
  22. package/dist/{Blueprint-DbVaf6k7.js → Blueprint-CQNRtmYG.js} +33 -63
  23. package/dist/{boolean2D-y3E92F0u.js → boolean2D-DXAt4GAK.js} +132 -62
  24. package/dist/{boolean2D-0blbVtJ8.cjs → boolean2D-N9Pgumgg.cjs} +112 -42
  25. package/dist/{booleanFns-BCTjYZAg.js → booleanFns-BXV7Oh0h.js} +53 -50
  26. package/dist/{booleanFns-gmsX3Cv2.cjs → booleanFns-CxArUj_q.cjs} +43 -40
  27. package/dist/brepjs.cjs +448 -379
  28. package/dist/brepjs.js +1634 -1563
  29. package/dist/core/dimensionTypes.d.ts +52 -0
  30. package/dist/core/dimensionTypes.d.ts.map +1 -0
  31. package/dist/core/disposal.d.ts +18 -0
  32. package/dist/core/disposal.d.ts.map +1 -1
  33. package/dist/core/errors.d.ts +7 -8
  34. package/dist/core/errors.d.ts.map +1 -1
  35. package/dist/core/kernelErrorTranslation.d.ts +15 -0
  36. package/dist/core/kernelErrorTranslation.d.ts.map +1 -0
  37. package/dist/core/planeOps.d.ts +14 -0
  38. package/dist/core/planeOps.d.ts.map +1 -1
  39. package/dist/core/result.d.ts +4 -0
  40. package/dist/core/result.d.ts.map +1 -1
  41. package/dist/core/shapeTypes.d.ts +14 -146
  42. package/dist/core/shapeTypes.d.ts.map +1 -1
  43. package/dist/core/{definitionMaps.d.ts → typeDiscriminants.d.ts} +5 -1
  44. package/dist/core/typeDiscriminants.d.ts.map +1 -0
  45. package/dist/core/validityTypes.d.ts +100 -0
  46. package/dist/core/validityTypes.d.ts.map +1 -0
  47. package/dist/core.cjs +52 -11
  48. package/dist/core.d.ts +1 -1
  49. package/dist/core.d.ts.map +1 -1
  50. package/dist/core.js +119 -76
  51. package/dist/{curveFns-BZngcnQ1.cjs → curveFns-CWZRuXQ3.cjs} +2 -2
  52. package/dist/{curveFns-mROFhiuG.js → curveFns-OmbtFSG8.js} +14 -14
  53. package/dist/{drawFns-Bwakrq7w.js → drawFns-8S0ULGRj.js} +146 -118
  54. package/dist/{drawFns-CjRc1NfQ.cjs → drawFns-voV2wEp8.cjs} +153 -125
  55. package/dist/{faceFns-B8GnxjdY.js → faceFns-Bn2seBfp.js} +16 -24
  56. package/dist/{faceFns-DB1Fc5gy.cjs → faceFns-CmIrjdt1.cjs} +2 -10
  57. package/dist/{helpers-X0juxnwj.js → helpers-CEn618MW.js} +89 -21
  58. package/dist/{helpers-C8NoT0Wu.cjs → helpers-mipaxDTy.cjs} +77 -9
  59. package/dist/index.d.ts +20 -19
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/io/gltfImportFns.d.ts +18 -0
  62. package/dist/io/gltfImportFns.d.ts.map +1 -0
  63. package/dist/io/ioUtils.d.ts +16 -0
  64. package/dist/io/ioUtils.d.ts.map +1 -0
  65. package/dist/io/objImportFns.d.ts.map +1 -1
  66. package/dist/io/threemfImportFns.d.ts.map +1 -1
  67. package/dist/io.cjs +4 -4
  68. package/dist/io.js +4 -4
  69. package/dist/kernel/brepkit/booleanOps.d.ts +23 -0
  70. package/dist/kernel/brepkit/booleanOps.d.ts.map +1 -0
  71. package/dist/kernel/brepkit/constructionOps.d.ts +51 -0
  72. package/dist/kernel/brepkit/constructionOps.d.ts.map +1 -0
  73. package/dist/kernel/brepkit/evolutionOps.d.ts +31 -0
  74. package/dist/kernel/brepkit/evolutionOps.d.ts.map +1 -0
  75. package/dist/kernel/brepkit/geometryOps.d.ts +56 -0
  76. package/dist/kernel/brepkit/geometryOps.d.ts.map +1 -0
  77. package/dist/kernel/brepkit/helpers.d.ts +84 -0
  78. package/dist/kernel/brepkit/helpers.d.ts.map +1 -0
  79. package/dist/kernel/brepkit/internalOps.d.ts +28 -0
  80. package/dist/kernel/brepkit/internalOps.d.ts.map +1 -0
  81. package/dist/kernel/brepkit/ioOps.d.ts +43 -0
  82. package/dist/kernel/brepkit/ioOps.d.ts.map +1 -0
  83. package/dist/kernel/brepkit/measureOps.d.ts +30 -0
  84. package/dist/kernel/brepkit/measureOps.d.ts.map +1 -0
  85. package/dist/kernel/brepkit/meshOps.d.ts +7 -0
  86. package/dist/kernel/brepkit/meshOps.d.ts.map +1 -0
  87. package/dist/kernel/brepkit/modifierOps.d.ts +15 -0
  88. package/dist/kernel/brepkit/modifierOps.d.ts.map +1 -0
  89. package/dist/kernel/brepkit/repairOps.d.ts +14 -0
  90. package/dist/kernel/brepkit/repairOps.d.ts.map +1 -0
  91. package/dist/kernel/brepkit/sweepOps.d.ts +27 -0
  92. package/dist/kernel/brepkit/sweepOps.d.ts.map +1 -0
  93. package/dist/kernel/brepkit/topologyOps.d.ts +16 -0
  94. package/dist/kernel/brepkit/topologyOps.d.ts.map +1 -0
  95. package/dist/kernel/brepkit/transformOps.d.ts +14 -0
  96. package/dist/kernel/brepkit/transformOps.d.ts.map +1 -0
  97. package/dist/kernel/brepkitAdapter.d.ts +1 -1
  98. package/dist/kernel/brepkitAdapter.d.ts.map +1 -1
  99. package/dist/kernel/brepkitWasmTypes.d.ts +8 -0
  100. package/dist/kernel/brepkitWasmTypes.d.ts.map +1 -1
  101. package/dist/kernel/defaultAdapter.d.ts.map +1 -1
  102. package/dist/kernel/extendedConstructorOps.d.ts +9 -1
  103. package/dist/kernel/extendedConstructorOps.d.ts.map +1 -1
  104. package/dist/kernel/index.d.ts +1 -0
  105. package/dist/kernel/index.d.ts.map +1 -1
  106. package/dist/kernel/interfaces/boolean-ops.d.ts +25 -0
  107. package/dist/kernel/interfaces/boolean-ops.d.ts.map +1 -0
  108. package/dist/kernel/interfaces/builder-ops.d.ts +57 -0
  109. package/dist/kernel/interfaces/builder-ops.d.ts.map +1 -0
  110. package/dist/kernel/interfaces/core.d.ts +30 -0
  111. package/dist/kernel/interfaces/core.d.ts.map +1 -0
  112. package/dist/kernel/interfaces/curve-ops.d.ts +41 -0
  113. package/dist/kernel/interfaces/curve-ops.d.ts.map +1 -0
  114. package/dist/kernel/interfaces/evolution-ops.d.ts +19 -0
  115. package/dist/kernel/interfaces/evolution-ops.d.ts.map +1 -0
  116. package/dist/kernel/interfaces/index.d.ts +37 -0
  117. package/dist/kernel/interfaces/index.d.ts.map +1 -0
  118. package/dist/kernel/interfaces/io-ops.d.ts +66 -0
  119. package/dist/kernel/interfaces/io-ops.d.ts.map +1 -0
  120. package/dist/kernel/interfaces/measure-ops.d.ts +35 -0
  121. package/dist/kernel/interfaces/measure-ops.d.ts.map +1 -0
  122. package/dist/kernel/interfaces/mesh-ops.d.ts +21 -0
  123. package/dist/kernel/interfaces/mesh-ops.d.ts.map +1 -0
  124. package/dist/kernel/interfaces/modifier-ops.d.ts +22 -0
  125. package/dist/kernel/interfaces/modifier-ops.d.ts.map +1 -0
  126. package/dist/kernel/interfaces/primitive-ops.d.ts +13 -0
  127. package/dist/kernel/interfaces/primitive-ops.d.ts.map +1 -0
  128. package/dist/kernel/interfaces/repair-ops.d.ts +36 -0
  129. package/dist/kernel/interfaces/repair-ops.d.ts.map +1 -0
  130. package/dist/kernel/interfaces/surface-ops.d.ts +50 -0
  131. package/dist/kernel/interfaces/surface-ops.d.ts.map +1 -0
  132. package/dist/kernel/interfaces/sweep-ops.d.ts +49 -0
  133. package/dist/kernel/interfaces/sweep-ops.d.ts.map +1 -0
  134. package/dist/kernel/interfaces/topology-ops.d.ts +30 -0
  135. package/dist/kernel/interfaces/topology-ops.d.ts.map +1 -0
  136. package/dist/kernel/interfaces/transform-ops.d.ts +35 -0
  137. package/dist/kernel/interfaces/transform-ops.d.ts.map +1 -0
  138. package/dist/kernel/modifierOps.d.ts +2 -2
  139. package/dist/kernel/modifierOps.d.ts.map +1 -1
  140. package/dist/kernel/types.d.ts +2 -446
  141. package/dist/kernel/types.d.ts.map +1 -1
  142. package/dist/measurement/measureCache.d.ts +11 -9
  143. package/dist/measurement/measureCache.d.ts.map +1 -1
  144. package/dist/measurement/measureFns.d.ts +24 -71
  145. package/dist/measurement/measureFns.d.ts.map +1 -1
  146. package/dist/measurement/measureTypes.d.ts +30 -0
  147. package/dist/measurement/measureTypes.d.ts.map +1 -0
  148. package/dist/{measurement-D8EJ694A.js → measurement-fJWDEpz0.js} +53 -34
  149. package/dist/measurement-ph-kanQ7.cjs +154 -0
  150. package/dist/measurement.cjs +2 -1
  151. package/dist/measurement.d.ts +1 -1
  152. package/dist/measurement.d.ts.map +1 -1
  153. package/dist/measurement.js +4 -3
  154. package/dist/{meshFns-BnV0ZR8w.cjs → meshFns-B9p4EVV8.cjs} +4 -4
  155. package/dist/{meshFns-nQjK38EC.js → meshFns-D0qIoxm-.js} +3 -3
  156. package/dist/operations/compoundOpsFns.d.ts +38 -0
  157. package/dist/operations/compoundOpsFns.d.ts.map +1 -0
  158. package/dist/operations/convexHullFns.d.ts +21 -0
  159. package/dist/operations/convexHullFns.d.ts.map +1 -0
  160. package/dist/operations/extrudeFns.d.ts +2 -93
  161. package/dist/operations/extrudeFns.d.ts.map +1 -1
  162. package/dist/operations/guidedSweepFns.d.ts +3 -22
  163. package/dist/operations/guidedSweepFns.d.ts.map +1 -1
  164. package/dist/operations/multiSweepFns.d.ts +3 -29
  165. package/dist/operations/multiSweepFns.d.ts.map +1 -1
  166. package/dist/operations/roofFns.d.ts +2 -2
  167. package/dist/operations/roofFns.d.ts.map +1 -1
  168. package/dist/operations/straightSkeleton.d.ts.map +1 -1
  169. package/dist/operations/sweepFns.d.ts +121 -0
  170. package/dist/operations/sweepFns.d.ts.map +1 -0
  171. package/dist/{operations-BfbkK6DU.js → operations-DX_qy_TB.js} +29 -177
  172. package/dist/{operations-CYpmLSC4.cjs → operations-Ds4xoyxR.cjs} +6 -154
  173. package/dist/operations.cjs +6 -10
  174. package/dist/operations.d.ts +0 -2
  175. package/dist/operations.d.ts.map +1 -1
  176. package/dist/operations.js +26 -30
  177. package/dist/originTrackingFns-BOCAMfd0.js +137 -0
  178. package/dist/originTrackingFns-SPU7ly3_.cjs +136 -0
  179. package/dist/query/edgeFinder.d.ts +4 -14
  180. package/dist/query/edgeFinder.d.ts.map +1 -1
  181. package/dist/query/faceFinder.d.ts +4 -14
  182. package/dist/query/faceFinder.d.ts.map +1 -1
  183. package/dist/query/finderCore.d.ts +6 -0
  184. package/dist/query/finderCore.d.ts.map +1 -1
  185. package/dist/query/shapeFinders.d.ts +32 -0
  186. package/dist/query/shapeFinders.d.ts.map +1 -0
  187. package/dist/query/wireFinder.d.ts +4 -9
  188. package/dist/query/wireFinder.d.ts.map +1 -1
  189. package/dist/query.cjs +54 -32
  190. package/dist/query.js +56 -34
  191. package/dist/{result-BaSD1fqR.js → result-CoDaWsvc.js} +48 -90
  192. package/dist/{result-fAX0OZzI.cjs → result-DULetAht.cjs} +17 -59
  193. package/dist/result.cjs +1 -1
  194. package/dist/result.js +23 -23
  195. package/dist/shapeFns-BZ6zk7nd.js +34 -0
  196. package/dist/shapeFns-bRkrwI8R.cjs +33 -0
  197. package/dist/{shapeTypes-7xEam9Ri.cjs → shapeTypes-T0n6mRmt.cjs} +170 -137
  198. package/dist/{shapeTypes-CpSaBLDv.js → shapeTypes-dhhm-T5A.js} +205 -172
  199. package/dist/sketching/CompoundSketch.d.ts +4 -4
  200. package/dist/sketching/CompoundSketch.d.ts.map +1 -1
  201. package/dist/sketching/Sketch.d.ts +3 -3
  202. package/dist/sketching/Sketch.d.ts.map +1 -1
  203. package/dist/sketching/Sketcher.d.ts.map +1 -1
  204. package/dist/sketching/Sketches.d.ts +1 -1
  205. package/dist/sketching/Sketches.d.ts.map +1 -1
  206. package/dist/sketching/draw.d.ts +1 -20
  207. package/dist/sketching/draw.d.ts.map +1 -1
  208. package/dist/sketching/draw3d.d.ts +22 -0
  209. package/dist/sketching/draw3d.d.ts.map +1 -0
  210. package/dist/sketching/sketchFns.d.ts +3 -3
  211. package/dist/sketching/sketchFns.d.ts.map +1 -1
  212. package/dist/sketching/sketchLib.d.ts +2 -2
  213. package/dist/sketching/sketchLib.d.ts.map +1 -1
  214. package/dist/sketching.cjs +2 -2
  215. package/dist/sketching.d.ts +2 -1
  216. package/dist/sketching.d.ts.map +1 -1
  217. package/dist/sketching.js +2 -2
  218. package/dist/{solidBuilders-994_MQwB.cjs → solidBuilders-BEAoLYvr.cjs} +3 -3
  219. package/dist/{solidBuilders-DmwhTCCd.js → solidBuilders-tVmD3R7Z.js} +12 -12
  220. package/dist/{surfaceBuilders-5VA34a3_.cjs → surfaceBuilders-DYS8AMSS.cjs} +3 -3
  221. package/dist/{surfaceBuilders-nQdJ56fe.js → surfaceBuilders-Dl0ATFbO.js} +15 -15
  222. package/dist/sweepFns-BKnQs59A.js +215 -0
  223. package/dist/sweepFns-COqeYIUp.cjs +214 -0
  224. package/dist/text/textBlueprints.d.ts +4 -3
  225. package/dist/text/textBlueprints.d.ts.map +1 -1
  226. package/dist/topology/booleanFns.d.ts.map +1 -1
  227. package/dist/topology/cast.d.ts +1 -5
  228. package/dist/topology/cast.d.ts.map +1 -1
  229. package/dist/topology/compoundOpsFns.d.ts +3 -35
  230. package/dist/topology/compoundOpsFns.d.ts.map +1 -1
  231. package/dist/topology/curveFns.d.ts +1 -1
  232. package/dist/topology/curveFns.d.ts.map +1 -1
  233. package/dist/topology/index.d.ts +2 -3
  234. package/dist/topology/index.d.ts.map +1 -1
  235. package/dist/topology/{colorFns.d.ts → metadata/colorFns.d.ts} +2 -2
  236. package/dist/topology/metadata/colorFns.d.ts.map +1 -0
  237. package/dist/topology/{faceTagFns.d.ts → metadata/faceTagFns.d.ts} +2 -2
  238. package/dist/topology/metadata/faceTagFns.d.ts.map +1 -0
  239. package/dist/topology/metadata/metadataPropagation.d.ts +30 -0
  240. package/dist/topology/metadata/metadataPropagation.d.ts.map +1 -0
  241. package/dist/topology/metadata/originTrackingFns.d.ts +23 -0
  242. package/dist/topology/metadata/originTrackingFns.d.ts.map +1 -0
  243. package/dist/topology/modifierFns.d.ts.map +1 -1
  244. package/dist/topology/shapeFns.d.ts +6 -120
  245. package/dist/topology/shapeFns.d.ts.map +1 -1
  246. package/dist/topology/topologyQueryFns.d.ts +67 -0
  247. package/dist/topology/topologyQueryFns.d.ts.map +1 -0
  248. package/dist/topology/transformFns.d.ts +49 -0
  249. package/dist/topology/transformFns.d.ts.map +1 -0
  250. package/dist/topology/wrapperFns.d.ts.map +1 -1
  251. package/dist/{topology-C7x98OVn.js → topology-C1oUQXZS.js} +235 -50
  252. package/dist/{topology-ANwCzGL8.cjs → topology-xyDYbkHW.cjs} +205 -20
  253. package/dist/topology.cjs +18 -17
  254. package/dist/topology.js +97 -96
  255. package/dist/topologyQueryFns-0IptTUCo.cjs +118 -0
  256. package/dist/topologyQueryFns-Dj4Xd5kx.js +119 -0
  257. package/dist/{types-CWDdqcrq.js → types-CcKqsmd0.js} +2 -2
  258. package/dist/utils/precisionRound.d.ts +4 -0
  259. package/dist/utils/precisionRound.d.ts.map +1 -1
  260. package/dist/utils/vec2d.d.ts +5 -0
  261. package/dist/utils/vec2d.d.ts.map +1 -1
  262. package/dist/{vecOps-ZDdZWbwT.js → vecOps-LTN--A58.js} +15 -15
  263. package/dist/{vectors-Bx8wkNui.js → vectors-B8juLsQB.js} +15 -7
  264. package/dist/{vectors-D_IiZx0q.cjs → vectors-I_0zdD3O.cjs} +9 -1
  265. package/dist/vectors.cjs +1 -1
  266. package/dist/vectors.js +23 -23
  267. package/package.json +9 -9
  268. package/dist/2d/blueprints/approximations.d.ts.map +0 -1
  269. package/dist/2d/blueprints/customCorners.d.ts.map +0 -1
  270. package/dist/2d/blueprints/offset.d.ts.map +0 -1
  271. package/dist/core/definitionMaps.d.ts.map +0 -1
  272. package/dist/core/geometryHelpers.d.ts +0 -30
  273. package/dist/core/geometryHelpers.d.ts.map +0 -1
  274. package/dist/core/memory.d.ts +0 -6
  275. package/dist/core/memory.d.ts.map +0 -1
  276. package/dist/core/typeErrors.d.ts +0 -17
  277. package/dist/core/typeErrors.d.ts.map +0 -1
  278. package/dist/cornerFinder-Ckz-mPHE.js +0 -59
  279. package/dist/cornerFinder-ZmOyOOsh.cjs +0 -58
  280. package/dist/loft-Bhw-FMoL.js +0 -228
  281. package/dist/loft-hp3pc1M7.cjs +0 -227
  282. package/dist/measurement-BoNTUBAp.cjs +0 -135
  283. package/dist/operations/extrude.d.ts +0 -72
  284. package/dist/operations/extrude.d.ts.map +0 -1
  285. package/dist/operations/loft.d.ts +0 -33
  286. package/dist/operations/loft.d.ts.map +0 -1
  287. package/dist/shapeFns-C2SnNvdH.cjs +0 -468
  288. package/dist/shapeFns-FDuKkrDR.js +0 -469
  289. package/dist/topology/colorFns.d.ts.map +0 -1
  290. package/dist/topology/faceTagFns.d.ts.map +0 -1
  291. package/dist/utils/round2.d.ts +0 -3
  292. package/dist/utils/round2.d.ts.map +0 -1
  293. package/dist/utils/round5.d.ts +0 -3
  294. package/dist/utils/round5.d.ts.map +0 -1
@@ -0,0 +1,32 @@
1
+ import { Vec3 } from '../core/types.js';
2
+ import { Edge, Face, Wire } from '../core/shapeTypes.js';
3
+ import { SurfaceType } from '../topology/faceFns.js';
4
+ import { CurveType } from '../core/typeDiscriminants.js';
5
+ import { ShapeFinder } from './finderCore.js';
6
+ import { DirectionInput } from './directionUtils.js';
7
+ export interface EdgeFinderFn extends ShapeFinder<Edge> {
8
+ readonly inDirection: (dir?: DirectionInput, angle?: number) => EdgeFinderFn;
9
+ readonly ofLength: (length: number, tolerance?: number) => EdgeFinderFn;
10
+ readonly ofCurveType: (curveType: CurveType) => EdgeFinderFn;
11
+ readonly parallelTo: (dir?: DirectionInput) => EdgeFinderFn;
12
+ readonly atDistance: (distance: number, point?: Vec3) => EdgeFinderFn;
13
+ }
14
+ /** Create an immutable edge finder. */
15
+ export declare function edgeFinder(): EdgeFinderFn;
16
+ export interface FaceFinderFn extends ShapeFinder<Face> {
17
+ readonly inDirection: (dir?: DirectionInput, angle?: number) => FaceFinderFn;
18
+ readonly parallelTo: (dir?: DirectionInput) => FaceFinderFn;
19
+ readonly ofSurfaceType: (surfaceType: SurfaceType) => FaceFinderFn;
20
+ readonly ofArea: (area: number, tolerance?: number) => FaceFinderFn;
21
+ readonly atDistance: (distance: number, point?: Vec3) => FaceFinderFn;
22
+ }
23
+ /** Create an immutable face finder. */
24
+ export declare function faceFinder(): FaceFinderFn;
25
+ export interface WireFinderFn extends ShapeFinder<Wire> {
26
+ readonly isClosed: () => WireFinderFn;
27
+ readonly isOpen: () => WireFinderFn;
28
+ readonly ofEdgeCount: (count: number) => WireFinderFn;
29
+ }
30
+ /** Create an immutable wire finder. */
31
+ export declare function wireFinder(): WireFinderFn;
32
+ //# sourceMappingURL=shapeFinders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shapeFinders.d.ts","sourceRoot":"","sources":["../../src/query/shapeFinders.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAK9D,OAAO,EAA4C,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIpG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,KAAK,WAAW,EAAqC,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,KAAK,cAAc,EAAc,MAAM,qBAAqB,CAAC;AAOtE,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IAC7E,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IACxE,QAAQ,CAAC,WAAW,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,YAAY,CAAC;IAC7D,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,KAAK,YAAY,CAAC;IAC5D,QAAQ,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,KAAK,YAAY,CAAC;CACvE;AAqCD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC;AAMD,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IAC7E,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,KAAK,YAAY,CAAC;IAC5D,QAAQ,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,YAAY,CAAC;IACnE,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IACpE,QAAQ,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,IAAI,KAAK,YAAY,CAAC;CACvE;AAqCD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC;AAMD,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,YAAY,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,YAAY,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;CACvD;AAwBD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC"}
@@ -1,10 +1,5 @@
1
- import { Wire } from '../core/shapeTypes.js';
2
- import { ShapeFinder } from './finderCore.js';
3
- export interface WireFinderFn extends ShapeFinder<Wire> {
4
- readonly isClosed: () => WireFinderFn;
5
- readonly isOpen: () => WireFinderFn;
6
- readonly ofEdgeCount: (count: number) => WireFinderFn;
7
- }
8
- /** Create an immutable wire finder. */
9
- export declare function wireFinder(): WireFinderFn;
1
+ /**
2
+ * Re-exports from `./shapeFinders.js` for backward compatibility.
3
+ */
4
+ export { wireFinder, type WireFinderFn } from './shapeFinders.js';
10
5
  //# sourceMappingURL=wireFinder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wireFinder.d.ts","sourceRoot":"","sources":["../../src/query/wireFinder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAE,KAAK,WAAW,EAAqC,MAAM,iBAAiB,CAAC;AAMtF,MAAM,WAAW,YAAa,SAAQ,WAAW,CAAC,IAAI,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,YAAY,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,YAAY,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;CACvD;AA4BD,uCAAuC;AACvC,wBAAgB,UAAU,IAAI,YAAY,CAEzC"}
1
+ {"version":3,"file":"wireFinder.d.ts","sourceRoot":"","sources":["../../src/query/wireFinder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/query.cjs CHANGED
@@ -1,40 +1,62 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const helpers = require("./helpers-C8NoT0Wu.cjs");
4
- const cornerFinder = require("./cornerFinder-ZmOyOOsh.cjs");
5
- const shapeTypes = require("./shapeTypes-7xEam9Ri.cjs");
3
+ const helpers = require("./helpers-mipaxDTy.cjs");
6
4
  const vecOps = require("./vecOps-CjRL1jau.cjs");
7
- const curveFns = require("./curveFns-BZngcnQ1.cjs");
8
- function edgeDirectionFilter(dir, angle) {
9
- const d = vecOps.vecNormalize(helpers.resolveDir(dir));
10
- return (edge) => {
11
- const kernel = shapeTypes.getKernel();
12
- const [firstParam, lastParam] = kernel.curveParameters(edge.wrapped);
13
- const midParam = (firstParam + lastParam) / 2;
14
- const { tangent: rawTangent } = kernel.curveTangent(edge.wrapped, midParam);
15
- const tangent = vecOps.vecNormalize(rawTangent);
16
- const ang = Math.acos(Math.min(1, Math.abs(vecOps.vecDot(tangent, d))));
17
- return Math.abs(ang - vecOps.DEG2RAD * angle) < 1e-6;
18
- };
5
+ const PI_2 = 2 * Math.PI;
6
+ function positiveHalfAngle(angle) {
7
+ const limitedAngle = angle % PI_2;
8
+ const coterminalAngle = limitedAngle < 0 ? limitedAngle + PI_2 : limitedAngle;
9
+ if (coterminalAngle < Math.PI) return coterminalAngle;
10
+ if (coterminalAngle === Math.PI) return 0;
11
+ return Math.abs(coterminalAngle - PI_2);
12
+ }
13
+ function blueprintCorners(blueprint) {
14
+ return blueprint.curves.map((curve, index) => ({
15
+ firstCurve: curve,
16
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- modulo wraps within bounds
17
+ secondCurve: blueprint.curves[(index + 1) % blueprint.curves.length],
18
+ point: curve.lastPoint
19
+ }));
19
20
  }
20
- function buildEdgeFinder(filters) {
21
- return helpers.createTypedFinder(
22
- "edge",
23
- filters,
24
- buildEdgeFinder,
25
- (_base, withFilter) => ({
26
- inDirection: (dir = "Z", angle = 0) => withFilter(edgeDirectionFilter(dir, angle)),
27
- ofLength: (length, tolerance = 1e-3) => withFilter((edge) => Math.abs(curveFns.curveLength(edge) - length) < tolerance),
28
- ofCurveType: (curveType) => withFilter((edge) => curveFns.getCurveType(edge) === curveType),
29
- parallelTo: (dir = "Z") => buildEdgeFinder(filters).inDirection(dir, 0),
30
- atDistance: (distance, point = [0, 0, 0]) => withFilter(helpers.distanceFromPointFilter(distance, point, 1e-6))
31
- })
32
- );
21
+ function buildCornerFinder(filters) {
22
+ const withFilter = (pred) => buildCornerFinder([...filters, pred]);
23
+ const shouldKeep = (corner) => filters.every((f) => f(corner));
24
+ return {
25
+ shouldKeep,
26
+ when: (pred) => withFilter(pred),
27
+ inList: (points) => withFilter((corner) => points.some((p) => helpers.samePoint(p, corner.point))),
28
+ atDistance: (distance, point = [0, 0]) => withFilter((corner) => Math.abs(helpers.distance2d(point, corner.point) - distance) < 1e-9),
29
+ atPoint: (point) => withFilter((corner) => helpers.samePoint(point, corner.point)),
30
+ inBox: (corner1, corner2) => {
31
+ const minX = Math.min(corner1[0], corner2[0]);
32
+ const maxX = Math.max(corner1[0], corner2[0]);
33
+ const minY = Math.min(corner1[1], corner2[1]);
34
+ const maxY = Math.max(corner1[1], corner2[1]);
35
+ return withFilter((corner) => {
36
+ const [x, y] = corner.point;
37
+ return x >= minX && x <= maxX && y >= minY && y <= maxY;
38
+ });
39
+ },
40
+ ofAngle: (angle) => withFilter((corner) => {
41
+ const tgt1 = corner.firstCurve.tangentAt(1);
42
+ const tgt2 = corner.secondCurve.tangentAt(0);
43
+ return Math.abs(positiveHalfAngle(helpers.angle2d(tgt1, tgt2)) - positiveHalfAngle(vecOps.DEG2RAD * angle)) < 1e-9;
44
+ }),
45
+ not: (fn) => {
46
+ const inner = fn(buildCornerFinder([]));
47
+ return withFilter((corner) => !inner.shouldKeep(corner));
48
+ },
49
+ either: (fns) => {
50
+ const builtFinders = fns.map((fn) => fn(buildCornerFinder([])));
51
+ return withFilter((corner) => builtFinders.some((f) => f.shouldKeep(corner)));
52
+ },
53
+ find: (blueprint) => blueprintCorners(blueprint).filter(shouldKeep)
54
+ };
33
55
  }
34
- function edgeFinder() {
35
- return buildEdgeFinder([]);
56
+ function cornerFinder() {
57
+ return buildCornerFinder([]);
36
58
  }
59
+ exports.edgeFinder = helpers.edgeFinder;
37
60
  exports.faceFinder = helpers.faceFinder;
38
61
  exports.getSingleFace = helpers.getSingleFace;
39
- exports.cornerFinder = cornerFinder.cornerFinder;
40
- exports.edgeFinder = edgeFinder;
62
+ exports.cornerFinder = cornerFinder;
package/dist/query.js CHANGED
@@ -1,41 +1,63 @@
1
- import { l as createTypedFinder, n as distanceFromPointFilter, o as resolveDir } from "./helpers-X0juxnwj.js";
2
- import { m, g } from "./helpers-X0juxnwj.js";
3
- import { c } from "./cornerFinder-Ckz-mPHE.js";
4
- import { B as getKernel } from "./shapeTypes-CpSaBLDv.js";
5
- import { j as vecNormalize, d as vecDot, D as DEG2RAD } from "./vecOps-ZDdZWbwT.js";
6
- import { l as getCurveType, f as curveLength } from "./curveFns-mROFhiuG.js";
7
- function edgeDirectionFilter(dir, angle) {
8
- const d = vecNormalize(resolveDir(dir));
9
- return (edge) => {
10
- const kernel = getKernel();
11
- const [firstParam, lastParam] = kernel.curveParameters(edge.wrapped);
12
- const midParam = (firstParam + lastParam) / 2;
13
- const { tangent: rawTangent } = kernel.curveTangent(edge.wrapped, midParam);
14
- const tangent = vecNormalize(rawTangent);
15
- const ang = Math.acos(Math.min(1, Math.abs(vecDot(tangent, d))));
16
- return Math.abs(ang - DEG2RAD * angle) < 1e-6;
17
- };
1
+ import { o as angle2d, s as samePoint, d as distance2d } from "./helpers-CEn618MW.js";
2
+ import { l, m, g } from "./helpers-CEn618MW.js";
3
+ import { D as DEG2RAD } from "./vecOps-LTN--A58.js";
4
+ const PI_2 = 2 * Math.PI;
5
+ function positiveHalfAngle(angle) {
6
+ const limitedAngle = angle % PI_2;
7
+ const coterminalAngle = limitedAngle < 0 ? limitedAngle + PI_2 : limitedAngle;
8
+ if (coterminalAngle < Math.PI) return coterminalAngle;
9
+ if (coterminalAngle === Math.PI) return 0;
10
+ return Math.abs(coterminalAngle - PI_2);
11
+ }
12
+ function blueprintCorners(blueprint) {
13
+ return blueprint.curves.map((curve, index) => ({
14
+ firstCurve: curve,
15
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- modulo wraps within bounds
16
+ secondCurve: blueprint.curves[(index + 1) % blueprint.curves.length],
17
+ point: curve.lastPoint
18
+ }));
18
19
  }
19
- function buildEdgeFinder(filters) {
20
- return createTypedFinder(
21
- "edge",
22
- filters,
23
- buildEdgeFinder,
24
- (_base, withFilter) => ({
25
- inDirection: (dir = "Z", angle = 0) => withFilter(edgeDirectionFilter(dir, angle)),
26
- ofLength: (length, tolerance = 1e-3) => withFilter((edge) => Math.abs(curveLength(edge) - length) < tolerance),
27
- ofCurveType: (curveType) => withFilter((edge) => getCurveType(edge) === curveType),
28
- parallelTo: (dir = "Z") => buildEdgeFinder(filters).inDirection(dir, 0),
29
- atDistance: (distance, point = [0, 0, 0]) => withFilter(distanceFromPointFilter(distance, point, 1e-6))
30
- })
31
- );
20
+ function buildCornerFinder(filters) {
21
+ const withFilter = (pred) => buildCornerFinder([...filters, pred]);
22
+ const shouldKeep = (corner) => filters.every((f) => f(corner));
23
+ return {
24
+ shouldKeep,
25
+ when: (pred) => withFilter(pred),
26
+ inList: (points) => withFilter((corner) => points.some((p) => samePoint(p, corner.point))),
27
+ atDistance: (distance, point = [0, 0]) => withFilter((corner) => Math.abs(distance2d(point, corner.point) - distance) < 1e-9),
28
+ atPoint: (point) => withFilter((corner) => samePoint(point, corner.point)),
29
+ inBox: (corner1, corner2) => {
30
+ const minX = Math.min(corner1[0], corner2[0]);
31
+ const maxX = Math.max(corner1[0], corner2[0]);
32
+ const minY = Math.min(corner1[1], corner2[1]);
33
+ const maxY = Math.max(corner1[1], corner2[1]);
34
+ return withFilter((corner) => {
35
+ const [x, y] = corner.point;
36
+ return x >= minX && x <= maxX && y >= minY && y <= maxY;
37
+ });
38
+ },
39
+ ofAngle: (angle) => withFilter((corner) => {
40
+ const tgt1 = corner.firstCurve.tangentAt(1);
41
+ const tgt2 = corner.secondCurve.tangentAt(0);
42
+ return Math.abs(positiveHalfAngle(angle2d(tgt1, tgt2)) - positiveHalfAngle(DEG2RAD * angle)) < 1e-9;
43
+ }),
44
+ not: (fn) => {
45
+ const inner = fn(buildCornerFinder([]));
46
+ return withFilter((corner) => !inner.shouldKeep(corner));
47
+ },
48
+ either: (fns) => {
49
+ const builtFinders = fns.map((fn) => fn(buildCornerFinder([])));
50
+ return withFilter((corner) => builtFinders.some((f) => f.shouldKeep(corner)));
51
+ },
52
+ find: (blueprint) => blueprintCorners(blueprint).filter(shouldKeep)
53
+ };
32
54
  }
33
- function edgeFinder() {
34
- return buildEdgeFinder([]);
55
+ function cornerFinder() {
56
+ return buildCornerFinder([]);
35
57
  }
36
58
  export {
37
- c as cornerFinder,
38
- edgeFinder,
59
+ cornerFinder,
60
+ l as edgeFinder,
39
61
  m as faceFinder,
40
62
  g as getSingleFace
41
63
  };
@@ -46,6 +46,12 @@ function tapErr(result, fn) {
46
46
  if (!result.ok) fn(result.error);
47
47
  return result;
48
48
  }
49
+ function flatten(result) {
50
+ return result.ok ? result.value : result;
51
+ }
52
+ function mapBoth(result, okFn, errFn) {
53
+ return result.ok ? ok(okFn(result.value)) : err(errFn(result.error));
54
+ }
49
55
  function fromNullable(value, errorFn) {
50
56
  if (value === null || value === void 0) return err(errorFn());
51
57
  return ok(value);
@@ -233,6 +239,15 @@ const BrepErrorCode = {
233
239
  ASSEMBLY_MATE_INVALID: "ASSEMBLY_MATE_INVALID",
234
240
  ASSEMBLY_SOLVE_FAILED: "ASSEMBLY_SOLVE_FAILED",
235
241
  ASSEMBLY_NOT_CONVERGED: "ASSEMBLY_NOT_CONVERGED",
242
+ // Blueprint / CompoundBlueprint errors
243
+ BLUEPRINT_EMPTY_CURVES: "BLUEPRINT_EMPTY_CURVES",
244
+ COMPOUND_BLUEPRINT_EMPTY: "COMPOUND_BLUEPRINT_EMPTY",
245
+ // GLB/glTF import errors
246
+ GLB_IMPORT_FAILED: "GLB_IMPORT_FAILED",
247
+ // Font/text errors
248
+ FONT_FETCH_FAILED: "FONT_FETCH_FAILED",
249
+ FONT_PARSE_FAILED: "FONT_PARSE_FAILED",
250
+ NO_FONT_LOADED: "NO_FONT_LOADED",
236
251
  // Unsupported capability errors (ADR-0006 Phase 4)
237
252
  UNSUPPORTED_CAPABILITY: "UNSUPPORTED_CAPABILITY"
238
253
  };
@@ -273,64 +288,6 @@ function queryError(code, message, cause, metadata, suggestion) {
273
288
  function unsupportedError(code, message, cause, metadata, suggestion) {
274
289
  return makeError("UNSUPPORTED", code, message, cause, metadata, suggestion);
275
290
  }
276
- const kernel_ERROR_PATTERNS = [
277
- {
278
- pattern: /invalid edge configuration|edges?.*(not|fail|invalid)/i,
279
- translation: "The edges may not form a continuous loop. Check that edges connect end-to-end without gaps."
280
- },
281
- {
282
- pattern: /BRepAlgoAPI.*failed|boolean.*operation.*failed/i,
283
- translation: "Boolean operation failed. Common causes: overlapping faces, zero-thickness geometry, or degenerate shapes. Try healing input shapes first."
284
- },
285
- {
286
- pattern: /fillet.*radius.*too.*large|fillet.*failed/i,
287
- translation: "Fillet operation failed. The radius may be too large for the selected edges. Try reducing the radius or check that edges have enough room."
288
- },
289
- {
290
- pattern: /chamfer.*failed|chamfer.*distance.*too.*large/i,
291
- translation: "Chamfer operation failed. The distance may be too large for the selected edges. Try reducing the distance or check edge geometry."
292
- },
293
- {
294
- pattern: /shell.*failed|offset.*failed/i,
295
- translation: "Shell/offset operation failed. The thickness may be too large, or the shape may have complex geometry. Try reducing thickness."
296
- },
297
- {
298
- pattern: /sweep.*failed|pipe.*failed/i,
299
- translation: "Sweep operation failed. Check that the profile and spine are compatible, and that the spine has no sharp twists or self-intersections."
300
- },
301
- {
302
- pattern: /loft.*failed/i,
303
- translation: "Loft operation failed. Profiles may be incompatible or have different orientations. Ensure profiles are ordered consistently."
304
- },
305
- {
306
- pattern: /extrude.*failed|prism.*failed/i,
307
- translation: "Extrusion failed. The profile may be invalid or self-intersecting. Check that the profile forms a valid closed wire."
308
- },
309
- {
310
- pattern: /revolve.*failed|revolution.*failed/i,
311
- translation: "Revolution operation failed. The profile may intersect the axis of revolution, or the angle may be invalid."
312
- },
313
- {
314
- pattern: /self.*intersect|self-intersect/i,
315
- translation: "Shape has self-intersections. The operation resulted in overlapping geometry. Simplify the input or adjust parameters."
316
- },
317
- {
318
- pattern: /degener|degenerat/i,
319
- translation: "Degenerate geometry detected. The shape has edges or faces with zero length/area. Check input geometry for collapsed elements."
320
- },
321
- {
322
- pattern: /BRepCheck.*fail|shape.*invalid|shape.*not.*valid/i,
323
- translation: "Shape validation failed. The resulting shape has invalid topology. Try healing the shape or checking input geometry."
324
- }
325
- ];
326
- function translateKernelError(kernelMessage) {
327
- for (const { pattern, translation } of kernel_ERROR_PATTERNS) {
328
- if (pattern.test(kernelMessage)) {
329
- return `${translation} (kernel: ${kernelMessage})`;
330
- }
331
- }
332
- return kernelMessage;
333
- }
334
291
  function safeIndex(arr, index, context) {
335
292
  if (index < 0 || index >= arr.length) {
336
293
  bug(context ?? "safeIndex", `Index ${index} is out of bounds (array length ${arr.length})`);
@@ -338,43 +295,44 @@ function safeIndex(arr, index, context) {
338
295
  return arr[index];
339
296
  }
340
297
  export {
341
- BrepErrorCode as A,
342
- BrepBugError as B,
343
- safeIndex as C,
344
- translateKernelError as D,
345
- all as E,
346
- fromNullable as F,
347
- or as G,
348
- orElse as H,
349
- pipeline as I,
350
- tap as J,
351
- tapErr as K,
352
- zip as L,
298
+ orElse as A,
299
+ BrepErrorCode as B,
300
+ pipeline as C,
301
+ sketcherStateError as D,
302
+ tap as E,
303
+ tapErr as F,
304
+ tryCatch as G,
305
+ tryCatchAsync as H,
306
+ unsupportedError as I,
307
+ unwrapErr as J,
308
+ unwrapOr as K,
309
+ unwrapOrElse as L,
310
+ zip as M,
353
311
  OK as O,
354
312
  andThen as a,
355
- bug as b,
356
- collect as c,
357
- computationError as d,
313
+ isErr as b,
314
+ isOk as c,
315
+ bug as d,
358
316
  err as e,
359
- flatMap as f,
360
- isErr as g,
361
- isOk as h,
317
+ computationError as f,
318
+ BrepBugError as g,
319
+ all as h,
362
320
  ioError as i,
363
- mapErr as j,
321
+ collect as j,
364
322
  kernelError as k,
365
- match as l,
366
- map as m,
367
- moduleInitError as n,
323
+ flatMap as l,
324
+ flatten as m,
325
+ fromNullable as n,
368
326
  ok as o,
369
- tryCatchAsync as p,
327
+ map as p,
370
328
  queryError as q,
371
- typeCastError as r,
372
- sketcherStateError as s,
373
- tryCatch as t,
374
- unsupportedError as u,
375
- unwrap as v,
376
- unwrapErr as w,
377
- unwrapOr as x,
378
- unwrapOrElse as y,
379
- validationError as z
329
+ mapBoth as r,
330
+ safeIndex as s,
331
+ typeCastError as t,
332
+ unwrap as u,
333
+ validationError as v,
334
+ mapErr as w,
335
+ match as x,
336
+ moduleInitError as y,
337
+ or as z
380
338
  };
@@ -47,6 +47,12 @@ function tapErr(result, fn) {
47
47
  if (!result.ok) fn(result.error);
48
48
  return result;
49
49
  }
50
+ function flatten(result) {
51
+ return result.ok ? result.value : result;
52
+ }
53
+ function mapBoth(result, okFn, errFn) {
54
+ return result.ok ? ok(okFn(result.value)) : err(errFn(result.error));
55
+ }
50
56
  function fromNullable(value, errorFn) {
51
57
  if (value === null || value === void 0) return err(errorFn());
52
58
  return ok(value);
@@ -234,6 +240,15 @@ const BrepErrorCode = {
234
240
  ASSEMBLY_MATE_INVALID: "ASSEMBLY_MATE_INVALID",
235
241
  ASSEMBLY_SOLVE_FAILED: "ASSEMBLY_SOLVE_FAILED",
236
242
  ASSEMBLY_NOT_CONVERGED: "ASSEMBLY_NOT_CONVERGED",
243
+ // Blueprint / CompoundBlueprint errors
244
+ BLUEPRINT_EMPTY_CURVES: "BLUEPRINT_EMPTY_CURVES",
245
+ COMPOUND_BLUEPRINT_EMPTY: "COMPOUND_BLUEPRINT_EMPTY",
246
+ // GLB/glTF import errors
247
+ GLB_IMPORT_FAILED: "GLB_IMPORT_FAILED",
248
+ // Font/text errors
249
+ FONT_FETCH_FAILED: "FONT_FETCH_FAILED",
250
+ FONT_PARSE_FAILED: "FONT_PARSE_FAILED",
251
+ NO_FONT_LOADED: "NO_FONT_LOADED",
237
252
  // Unsupported capability errors (ADR-0006 Phase 4)
238
253
  UNSUPPORTED_CAPABILITY: "UNSUPPORTED_CAPABILITY"
239
254
  };
@@ -274,64 +289,6 @@ function queryError(code, message, cause, metadata, suggestion) {
274
289
  function unsupportedError(code, message, cause, metadata, suggestion) {
275
290
  return makeError("UNSUPPORTED", code, message, cause, metadata, suggestion);
276
291
  }
277
- const kernel_ERROR_PATTERNS = [
278
- {
279
- pattern: /invalid edge configuration|edges?.*(not|fail|invalid)/i,
280
- translation: "The edges may not form a continuous loop. Check that edges connect end-to-end without gaps."
281
- },
282
- {
283
- pattern: /BRepAlgoAPI.*failed|boolean.*operation.*failed/i,
284
- translation: "Boolean operation failed. Common causes: overlapping faces, zero-thickness geometry, or degenerate shapes. Try healing input shapes first."
285
- },
286
- {
287
- pattern: /fillet.*radius.*too.*large|fillet.*failed/i,
288
- translation: "Fillet operation failed. The radius may be too large for the selected edges. Try reducing the radius or check that edges have enough room."
289
- },
290
- {
291
- pattern: /chamfer.*failed|chamfer.*distance.*too.*large/i,
292
- translation: "Chamfer operation failed. The distance may be too large for the selected edges. Try reducing the distance or check edge geometry."
293
- },
294
- {
295
- pattern: /shell.*failed|offset.*failed/i,
296
- translation: "Shell/offset operation failed. The thickness may be too large, or the shape may have complex geometry. Try reducing thickness."
297
- },
298
- {
299
- pattern: /sweep.*failed|pipe.*failed/i,
300
- translation: "Sweep operation failed. Check that the profile and spine are compatible, and that the spine has no sharp twists or self-intersections."
301
- },
302
- {
303
- pattern: /loft.*failed/i,
304
- translation: "Loft operation failed. Profiles may be incompatible or have different orientations. Ensure profiles are ordered consistently."
305
- },
306
- {
307
- pattern: /extrude.*failed|prism.*failed/i,
308
- translation: "Extrusion failed. The profile may be invalid or self-intersecting. Check that the profile forms a valid closed wire."
309
- },
310
- {
311
- pattern: /revolve.*failed|revolution.*failed/i,
312
- translation: "Revolution operation failed. The profile may intersect the axis of revolution, or the angle may be invalid."
313
- },
314
- {
315
- pattern: /self.*intersect|self-intersect/i,
316
- translation: "Shape has self-intersections. The operation resulted in overlapping geometry. Simplify the input or adjust parameters."
317
- },
318
- {
319
- pattern: /degener|degenerat/i,
320
- translation: "Degenerate geometry detected. The shape has edges or faces with zero length/area. Check input geometry for collapsed elements."
321
- },
322
- {
323
- pattern: /BRepCheck.*fail|shape.*invalid|shape.*not.*valid/i,
324
- translation: "Shape validation failed. The resulting shape has invalid topology. Try healing the shape or checking input geometry."
325
- }
326
- ];
327
- function translateKernelError(kernelMessage) {
328
- for (const { pattern, translation } of kernel_ERROR_PATTERNS) {
329
- if (pattern.test(kernelMessage)) {
330
- return `${translation} (kernel: ${kernelMessage})`;
331
- }
332
- }
333
- return kernelMessage;
334
- }
335
292
  function safeIndex(arr, index, context) {
336
293
  if (index < 0 || index >= arr.length) {
337
294
  bug(context ?? "safeIndex", `Index ${index} is out of bounds (array length ${arr.length})`);
@@ -348,12 +305,14 @@ exports.collect = collect;
348
305
  exports.computationError = computationError;
349
306
  exports.err = err;
350
307
  exports.flatMap = flatMap;
308
+ exports.flatten = flatten;
351
309
  exports.fromNullable = fromNullable;
352
310
  exports.ioError = ioError;
353
311
  exports.isErr = isErr;
354
312
  exports.isOk = isOk;
355
313
  exports.kernelError = kernelError;
356
314
  exports.map = map;
315
+ exports.mapBoth = mapBoth;
357
316
  exports.mapErr = mapErr;
358
317
  exports.match = match;
359
318
  exports.moduleInitError = moduleInitError;
@@ -366,7 +325,6 @@ exports.safeIndex = safeIndex;
366
325
  exports.sketcherStateError = sketcherStateError;
367
326
  exports.tap = tap;
368
327
  exports.tapErr = tapErr;
369
- exports.translateKernelError = translateKernelError;
370
328
  exports.tryCatch = tryCatch;
371
329
  exports.tryCatchAsync = tryCatchAsync;
372
330
  exports.typeCastError = typeCastError;
package/dist/result.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const result = require("./result-fAX0OZzI.cjs");
3
+ const result = require("./result-DULetAht.cjs");
4
4
  exports.BrepBugError = result.BrepBugError;
5
5
  exports.BrepErrorCode = result.BrepErrorCode;
6
6
  exports.OK = result.OK;
package/dist/result.js CHANGED
@@ -1,32 +1,32 @@
1
- import { B, A, O, a, b, c, d, e, f, i, g, h, k, m, j, l, n, o, I, q, s, t, p, r, v, w, x, y, z } from "./result-BaSD1fqR.js";
1
+ import { g, B, O, a, d, j, f, e, l, i, b, c, k, p, w, x, y, o, C, q, D, G, H, t, u, J, K, L, v } from "./result-CoDaWsvc.js";
2
2
  export {
3
- B as BrepBugError,
4
- A as BrepErrorCode,
3
+ g as BrepBugError,
4
+ B as BrepErrorCode,
5
5
  O as OK,
6
6
  a as andThen,
7
- b as bug,
8
- c as collect,
9
- d as computationError,
7
+ d as bug,
8
+ j as collect,
9
+ f as computationError,
10
10
  e as err,
11
- f as flatMap,
11
+ l as flatMap,
12
12
  i as ioError,
13
- g as isErr,
14
- h as isOk,
13
+ b as isErr,
14
+ c as isOk,
15
15
  k as kernelError,
16
- m as map,
17
- j as mapErr,
18
- l as match,
19
- n as moduleInitError,
16
+ p as map,
17
+ w as mapErr,
18
+ x as match,
19
+ y as moduleInitError,
20
20
  o as ok,
21
- I as pipeline,
21
+ C as pipeline,
22
22
  q as queryError,
23
- s as sketcherStateError,
24
- t as tryCatch,
25
- p as tryCatchAsync,
26
- r as typeCastError,
27
- v as unwrap,
28
- w as unwrapErr,
29
- x as unwrapOr,
30
- y as unwrapOrElse,
31
- z as validationError
23
+ D as sketcherStateError,
24
+ G as tryCatch,
25
+ H as tryCatchAsync,
26
+ t as typeCastError,
27
+ u as unwrap,
28
+ J as unwrapErr,
29
+ K as unwrapOr,
30
+ L as unwrapOrElse,
31
+ v as validationError
32
32
  };
@@ -0,0 +1,34 @@
1
+ import { g as getKernel, c as castShape } from "./shapeTypes-dhhm-T5A.js";
2
+ import { H as HASH_CODE_MAX } from "./vecOps-LTN--A58.js";
3
+ import { d as downcast } from "./faceFns-Bn2seBfp.js";
4
+ import { u as unwrap } from "./result-CoDaWsvc.js";
5
+ function clone(shape) {
6
+ return castShape(unwrap(downcast(shape.wrapped)));
7
+ }
8
+ function toBREP(shape) {
9
+ return getKernel().toBREP(shape.wrapped);
10
+ }
11
+ function getHashCode(shape) {
12
+ return getKernel().hashCode(shape.wrapped, HASH_CODE_MAX);
13
+ }
14
+ function isEmpty(shape) {
15
+ return getKernel().isNull(shape.wrapped);
16
+ }
17
+ function isSameShape(a, b) {
18
+ return getKernel().isSame(a.wrapped, b.wrapped);
19
+ }
20
+ function isEqualShape(a, b) {
21
+ return getKernel().isEqual(a.wrapped, b.wrapped);
22
+ }
23
+ function simplify(shape) {
24
+ return castShape(getKernel().simplify(shape.wrapped));
25
+ }
26
+ export {
27
+ isEmpty as a,
28
+ isEqualShape as b,
29
+ clone as c,
30
+ getHashCode as g,
31
+ isSameShape as i,
32
+ simplify as s,
33
+ toBREP as t
34
+ };